private static void p(String s) { if (VERBOSE) { LOGGER.info("[FileStringBuffer] " + s); } }
protected void dump() { LOG.info("===== Test class\n" + m_testClass.getName()); for (ITestNGMethod m : m_beforeClassMethods) { LOG.info(" @BeforeClass " + m); } for (ITestNGMethod m : m_beforeTestMethods) { LOG.info(" @BeforeMethod " + m); } for (ITestNGMethod m : m_testMethods) { LOG.info(" @Test " + m); } for (ITestNGMethod m : m_afterTestMethods) { LOG.info(" @AfterMethod " + m); } for (ITestNGMethod m : m_afterClassMethods) { LOG.info(" @AfterClass " + m); } LOG.info("======"); }
/** * @deprecated The TestNG version is now established at load time. This * method is not required anymore and is now a no-op. */ @Deprecated public static void setTestNGVersion() { LOGGER.info("setTestNGVersion has been deprecated."); }
protected void dump() { LOG.info("===== Test class\n" + m_testClass.getName()); for (ITestNGMethod m : m_beforeClassMethods) { LOG.info(" @BeforeClass " + m); } for (ITestNGMethod m : m_beforeTestMethods) { LOG.info(" @BeforeMethod " + m); } for (ITestNGMethod m : m_testMethods) { LOG.info(" @Test " + m); } for (ITestNGMethod m : m_afterTestMethods) { LOG.info(" @AfterMethod " + m); } for (ITestNGMethod m : m_afterClassMethods) { LOG.info(" @AfterClass " + m); } LOG.info("======"); }
/** * Logs the the message to System.out if level is greater than * or equal to TestRunner.getVerbose(). The message is logged as: * <pre> * "[cls] msg" * </pre> * * @param cls the class name to prefix the log message. * @param level the logging level of the message. * @param msg the message to log to System.out. */ public static void log(String cls, int level, String msg) { // Why this coupling on a static member of TestRunner.getVerbose()? if (TestRunner.getVerbose() >= level) { if (cls.length() > 0) { LOG.info("[" + cls + "] " + msg); } else { LOG.info(msg); } } }
/** * Logs the the message to System.out if level is greater than or equal to * TestRunner.getVerbose(). The message is logged as: * * <pre> * "[cls] msg" * </pre> * * @param cls the class name to prefix the log message. * @param level the logging level of the message. * @param msg the message to log to System.out. */ public static void log(String cls, int level, String msg) { // Why this coupling on a static member of TestRunner.getVerbose()? if (TestRunner.getVerbose() >= level) { if (cls.length() > 0) { LOG.info("[" + cls + "] " + msg); } else { LOG.info(msg); } } }
Assert.assertEquals(out1.toString(), ""); Assert.assertEquals(err1.toString(), ""); strLogger.info("info should not appear"); Assert.assertEquals(out1.toString(), ""); Assert.assertEquals(err1.toString(), "");
Assert.assertEquals(out1.toString(), ""); Assert.assertEquals(err1.toString(), ""); strLogger.info("info should not appear"); Assert.assertEquals(out1.toString(), ""); Assert.assertEquals(err1.toString(), "");
public static void handleTimout(Queue<String> failures, ExecutorService es, TimeoutException e) { for (StackTraceElement[] trace : Thread.getAllStackTraces().values()) { for (StackTraceElement element : trace) { logger.info("\tat " + element); } if (trace.length > 0) { logger.info("------"); } } MoreExecutors.shutdownAndAwaitTermination(es, 10, TimeUnit.SECONDS); for (String failure : failures) { logger.debug(failure); } fail("Spun forever", e); }
@Test(priority = 20, groups = "integration") public void testGetAccessToken() throws PayPalRESTException { Map<String, String> configurationMap = new HashMap<String, String>(); configurationMap.put("service.EndPoint", "https://api.sandbox.paypal.com"); OAuthTokenCredential merchantTokenCredential = new OAuthTokenCredential( clientID, clientSecret, configurationMap); String accessToken = merchantTokenCredential.getAccessToken(); logger.info("Generated Access Token = " + accessToken); Assert.assertEquals(true, accessToken.length() > 0); Assert.assertEquals(true, merchantTokenCredential.expiresIn() > 0); }
@Test(groups = "unit") public void testTOJSON() { EventType eventType = createEventType(); Assert.assertEquals(eventType.toJSON().length() == 0, false); logger.info("EventTypeJSON = " + eventType.toJSON()); }
@Test(groups = "unit") public void testTOJSON() { EventList eventList = createEventList(); Assert.assertEquals(eventList.toJSON().length() == 0, false); logger.info("EventListJSON = " + eventList.toJSON()); }
@Test(expectedExceptions = RuntimeException.class) public void testLogoutURLError() { Map<String, String> m = new HashMap<String, String>(); APIContext apiContext = new APIContext(); apiContext.setConfigurationMap(m); String logoutURL = Session.getLogoutUrl("http://google.com", "tokenId", apiContext); logger.info("Redirect URL: " + logoutURL); Assert.assertEquals( logoutURL, "https://www.paypal.com/webapps/auth/protocol/openidconnect/v1/endsession?id_token=tokenId&redirect_uri=http%3A%2F%2Fgoogle.com&logout=true"); }
@Test(groups = "integration") public void testUserinfoDynamic() throws PayPalRESTException { APIContext apiContext = new APIContext(generateAccessToken()); apiContext.setConfigurationMap(configurationMap); Userinfo userInfo = Userinfo.getUserinfo(apiContext); Assert.assertNotNull(userInfo.getUserId()); logger.info("User ID: " + userInfo.getUserId()); logger.info("User Info Email: " + userInfo.getEmail()); logger.info("User Info Account Type: " + userInfo.getAccountType()); logger.info("User Info Name: " + userInfo.getGivenName()); }
@Test(groups = "integration", enabled=false, dependsOnMethods = { "testCreateInvoice" }) public void testGetInvoice() throws PayPalRESTException { Invoice invoice = Invoice.get(TestConstants.SANDBOX_CONTEXT, this.id); logger.info("Invoice returned: ID=" + invoice.getId()); this.id = invoice.getId(); }
@Test(groups = "integration") public void testGetRefund() throws PayPalRESTException { if (ObjectHolder.refundId == null) { new SaleTestCase().testSaleRefundAPI(); } try { Refund refund = Refund.get(TestConstants.SANDBOX_CONTEXT, ObjectHolder.refundId); logger.info("Refund ID = " + refund.getId()); } catch (PayPalRESTException e) { Assert.fail(); } }
@Test(groups = "integration", enabled=false) public void testCreateInvoice() throws PayPalRESTException { Invoice invoice = loadInvoice(); invoice = invoice.create(TestConstants.SANDBOX_CONTEXT); logger.info("Invoice created: ID=" + invoice.getId()); this.id = invoice.getId(); }
@Test(groups = "integration", dependsOnMethods = { "testGetAuthorization" }) public void testAuthorizationCapture() throws PayPalRESTException { Capture capture = new Capture(); Amount amount = new Amount(); amount.setCurrency("USD").setTotal("1"); capture.setAmount(amount); capture.setIsFinalCapture(true); Capture responsecapture = authorization.capture(TestConstants.SANDBOX_CONTEXT, capture); Assert.assertEquals(responsecapture.getState(), "completed"); logger.info("Returned Capture state: " + responsecapture.getState()); }