Java Code Examples for org.wso2.carbon.integration.common.admin.client.LogViewerClient

The following examples show how to use org.wso2.carbon.integration.common.admin.client.LogViewerClient. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: product-ei   Source File: Utils.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Get set of logs with expected string and given priority
 *
 * @param logViewerClient LogViewerClient object
 * @param priority        priority level
 * @param expected        expected string
 * @return set of logs with expected string and given priority
 * @throws RemoteException
 */
public static ArrayList<LogEvent> getLogsWithExpectedValue(LogViewerClient logViewerClient, String priority,
                                                  String expected) throws RemoteException {
    LogEvent[] allLogs;
    allLogs = logViewerClient.getAllRemoteSystemLogs();
    ArrayList<LogEvent> systemLogs = new ArrayList<>();
    int i = 0;
    if (allLogs != null) {
        for (LogEvent logEvent : allLogs) {
            if (logEvent == null) {
                continue;
            }
            if (logEvent.getPriority().equals(priority) && logEvent.getMessage().contains(expected)) {
                systemLogs.add(logEvent);
            }
        }
    }
    return systemLogs;
}
 
Example 2
Source Project: product-ei   Source File: Utils.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Check whether a log found with expected string of given priority
 *
 * @param logViewerClient LogViewerClient object
 * @param priority        priority level
 * @param expected        expected string
 * @return true if a log found with expected string of given priority, false otherwise
 * @throws RemoteException
 */
private static boolean assertIfLogExistsWithGivenPriority(LogViewerClient logViewerClient, String priority, String expected)
        throws RemoteException {

    LogEvent[] systemLogs;
    systemLogs = logViewerClient.getAllRemoteSystemLogs();
    boolean matchFound = false;
    if (systemLogs != null) {
        for (LogEvent logEvent : systemLogs) {
            if (logEvent == null) {
                continue;
            }
            if (logEvent.getPriority().equals(priority) && logEvent.getMessage().contains(expected)) {
                matchFound = true;
                break;
            }
        }
    }
    return matchFound;
}
 
Example 3
@Test(groups = {"wso2.esb"}, description = "Test successful deployment of scheduled task with large interval value")
public void testDeployWithLargeIntervalValue() throws Exception {

    OMElement task = AXIOMUtil.stringToOM("<task:task xmlns:task=\"http://www.wso2.org/products/wso2commons/tasks\"\n" +
            "           name=\"ESBJAVA5234TestTask\"\n" +
            "           class=\"org.apache.synapse.startup.tasks.MessageInjector\" group=\"synapse.simple.quartz\">\n" +
            "    <task:trigger count=\"1\" interval=\"25920000\"/>\n" +
            "    <task:property name=\"message\">\n" +
            "        <m0:placeOrder xmlns:m0=\"http://services.samples\">\n" +
            "            <m0:order>\n" +
            "                <m0:price>100</m0:price>\n" +
            "                <m0:quantity>200</m0:quantity>\n" +
            "                <m0:symbol>IBM</m0:symbol>\n" +
            "            </m0:order>\n" +
            "        </m0:placeOrder>\n" +
            "    </task:property>\n" +
            "</task:task>");

    addScheduledTask(task);

    LogViewerClient logViewerClient = new LogViewerClient(context.getContextUrls().getBackEndUrl(), getSessionCookie());
    boolean assertValue = Utils.checkForLog(logViewerClient,
            "ESBJAVA5234TestTask was added to the Synapse configuration successfully",
            5);
    assertTrue(assertValue, "Scheduled task with large interval value has not deployed.");
}
 
Example 4
@BeforeClass
public void init() throws Exception {
    super.init();
    AutomationContext automationContext = new AutomationContext();
    DB_PASSWORD = automationContext.getConfigurationValue(XPathConstants.DATA_SOURCE_DB_PASSWORD);
    JDBC_URL = automationContext.getConfigurationValue(XPathConstants.DATA_SOURCE_URL);
    DB_USER = automationContext.getConfigurationValue(XPathConstants.DATA_SOURCE_DB_USER_NAME);
    String databaseName = System.getProperty("basedir") + File.separator + "target" + File.separator +
            "testdb_store" + new Random().nextInt();
    JDBC_URL = JDBC_URL + databaseName + ";DB_CLOSE_ON_EXIT=FALSE;AUTO_SERVER=TRUE";
    h2DatabaseManager = new H2DataBaseManager(JDBC_URL, DB_USER, DB_PASSWORD);
    h2DatabaseManager.executeUpdate("CREATE TABLE IF NOT EXISTS JDBC_MESSAGE_STORE(\n" +
            "indexId BIGINT(20) NOT NULL AUTO_INCREMENT,\n" +
            "msg_id VARCHAR(200) NOT NULL ,\n" +
            "message BLOB NOT NULL,\n" +
            "PRIMARY KEY ( indexId )\n" +
            ")");
    logViewer = new LogViewerClient(context.getContextUrls().getBackEndUrl(), sessionCookie);
    super.init();
}
 
Example 5
Source Project: product-ei   Source File: ESBJAVA3714JMXPauseJMSListener.java    License: Apache License 2.0 6 votes vote down vote up
@Test(groups = "wso2.esb", description = "JMS Consumer Test after resume", enabled = false)
public void testJMSResume() throws Exception {

    // redeploy proxy service
    addProxyService(AXIOMUtil.stringToOM(getJMSProxy()));

    LogViewerClient logViewerClient = new LogViewerClient(contextUrls.getBackEndUrl(), getSessionCookie());
    // JMS should still be paused.
    assertFalse(Utils.checkForLogsWithPriority(logViewerClient, "INFO", msgAfter, 16));

    // resume JMS Listener from JMXClient
    Set<ObjectInstance> objSet = mbsc.queryMBeans(new ObjectName("org.apache.axis2:Type=Transport,ConnectorName=jms-listener-*"), null);
    Iterator i = objSet.iterator();
    while (i.hasNext()) {
        ObjectInstance obj = (ObjectInstance) i.next();
        mbsc.invoke(obj.getObjectName(), "resume" , null, null);
    }

    assertTrue(Utils.checkForLogsWithPriority(logViewerClient, "INFO", "Listener resumed", 10));
    assertTrue(Utils.checkForLogsWithPriority(logViewerClient, "INFO", msgAfter, 10));
}
 
Example 6
/**
 * Test whether consuming message from a queue and sending to a backend works (i.e. JMS -> HTTP)
 *
 * @throws Exception if any error occurred while running tests
 */
@SetEnvironment(executionEnvironments = {ExecutionEnvironment.STANDALONE})
@Test(groups = {"wso2.esb"}, description = "Test JMS to HTTP communication with inbound endpoint")
public void testJmsQueueToHttpWithInboundEndpoint() throws Exception {
    LogViewerClient logViewerClient = new LogViewerClient(contextUrls.getBackEndUrl(), getSessionCookie());
    logViewerClient.clearLogs();

    //send a message to the queue
    sendMessage();

    //check for the log
    boolean assertValue = Utils.assertIfSystemLogContains(logViewerClient,
                                                          "** testJmsQueueToHttpWithInboundEndpoint RESPONSE **");

    Assert.assertTrue(assertValue, "HTTP backend response did not receive with the inbound endpoint.");
}
 
Example 7
@BeforeClass(alwaysRun = true)
protected void init() throws Exception {
    super.init();

    rabbitMQServer = RabbitMQTestUtils.getRabbitMQServerInstance();

    rabbitMQServer.stop();
    modifyAndAddRabbitMQConfigs();
    rabbitMQServer.start();

    headers.put("Test-Header-Field", "TestHeaderValue");

    modifyAndUpdateSynapseConfigs();

    logViewer = new LogViewerClient(contextUrls.getBackEndUrl(),getSessionCookie());
    url = getApiInvocationURL("rabbitMQRestWithClientCert") + "/store";
}
 
Example 8
Source Project: product-ei   Source File: ESBJAVA4565TestCase.java    License: Apache License 2.0 6 votes vote down vote up
@Test(groups = "wso2.esb", description = "Analyze carbon logs to find NPE due to unresolved tenant domain.")
public void checkErrorLog() throws Exception {
    LogViewerClient cli = new LogViewerClient(contextUrls.getBackEndUrl(), getSessionCookie());
    LogEvent[] logs = cli.getAllRemoteSystemLogs();
    Assert.assertNotNull(logs, "No logs found");
    Assert.assertTrue(logs.length > 0, "No logs found");
    boolean hasErrorLog = false;
    for (LogEvent logEvent : logs) {
        String msg = logEvent.getMessage();
        if (msg.contains("java.lang.NullPointerException: Tenant domain has not been set in CarbonContext")) {
            hasErrorLog = true;
            break;
        }
    }
    Assert.assertFalse(hasErrorLog, "Tenant domain not resolved when registry resource is accessed inside " +
                                    "a scheduled task");
}
 
Example 9
Source Project: product-ei   Source File: MSMPCronForwarderCase.java    License: Apache License 2.0 6 votes vote down vote up
private Callable<Boolean> isLogWritten() {
    return new Callable<Boolean>() {
        @Override
        public Boolean call() throws Exception {
            LogViewerClient logViewerClient =
                    new LogViewerClient(contextUrls.getBackEndUrl(), getSessionCookie());
            LogEvent[] logEvents = logViewerClient.getAllRemoteSystemLogs();

            boolean success = false;
            int msgCount = 0;
            for (int i = 0; i < logEvents.length; i++) {
                if (logEvents[i].getMessage().contains("Jack")) {
                    msgCount = ++msgCount;
                    if (NUMBER_OF_MESSAGES == msgCount) {
                        success = true;
                        break;
                    }
                }
            }
            return success;
        }
    };
}
 
Example 10
@Test(groups = { "wso2.esb" }, description = "Test Sending message to a jms endpoint and check for response")
public void testJmsResponse() throws Exception {
	try {
		axis2Client.sendSimpleStockQuoteRequest(getMainSequenceURL(),
				null, "IBM");
		
	} catch (AxisFault fault) {
		String errMsg=fault.getMessage();						
		Assert.assertEquals(errMsg,"Send timeout", "JMS Client did not receive Send timeout");			
		
		LogViewerClient cli = new LogViewerClient(contextUrls.getBackEndUrl(), getSessionCookie());
		LogEvent[] logs = cli.getAllRemoteSystemLogs();
		Assert.assertNotNull(logs, "No logs found");
		Assert.assertTrue(logs.length > 0, "No logs found");
		boolean errorMsgTrue = Utils.checkForLogsWithPriority(cli,"ERROR", logLine0, 10);
		Assert.assertTrue(errorMsgTrue, "Axis Fault Did not receive");
	}
}
 
Example 11
Source Project: product-ei   Source File: ESBJAVA3714JMXPauseJMSListener.java    License: Apache License 2.0 6 votes vote down vote up
@Test(groups = "wso2.esb", description = "JMS Consumer Test after pause")
public void testJMSPause() throws Exception {

    // pause JMS Listener from JMXClient
    Set<ObjectInstance> objSet = mbsc.queryMBeans(new ObjectName("org.apache.axis2:Type=Transport,ConnectorName=jms-listener-*"), null);
    Iterator i = objSet.iterator();
    while (i.hasNext()) {
        ObjectInstance obj = (ObjectInstance) i.next();
        mbsc.invoke(obj.getObjectName(), "pause" , null, null);
    }

    LogViewerClient logViewerClient = new LogViewerClient(contextUrls.getBackEndUrl(), getSessionCookie());
    assertTrue(Utils.checkForLogsWithPriority(logViewerClient, "INFO", "Listener paused", 10));

    // Put message in queue.
    sendMessage(msgAfter);
    assertFalse(Utils.checkForLogsWithPriority(logViewerClient, "INFO", msgAfter, 10));
}
 
Example 12
@BeforeClass(alwaysRun = true)
public void init() throws Exception {
    super.init();

    rabbitMQServer = RabbitMQTestUtils.getRabbitMQServerInstance();
    sender = new RabbitMQProducerClient("localhost", 5672, "guest", "guest");
    consumer = new RabbitMQConsumerClient("localhost");

    configurationManagerAxis2 =
            new ServerConfigurationManager(new AutomationContext("ESB", TestUserMode.SUPER_TENANT_ADMIN));
    File customAxisConfigAxis2 = new File(getESBResourceLocation() + File.separator +
            "axis2config" + File.separator + "axis2.xml");
    configurationManagerAxis2.applyConfiguration(customAxisConfigAxis2);
    super.init();

    logViewer = new LogViewerClient(contextUrls.getBackEndUrl(), getSessionCookie());

    loadESBConfigurationFromClasspath("/artifacts/ESB/rabbitmq/transport/rabbitmq_consumer_proxy.xml");
}
 
Example 13
@BeforeClass(alwaysRun = true)
protected void init() throws Exception {
    super.init();
    AutomationContext automationContext = new AutomationContext();
    DATASOURCE_NAME = automationContext.getConfigurationValue(XPathConstants.DATA_SOURCE_NAME);
    DB_PASSWORD = automationContext.getConfigurationValue(XPathConstants.DATA_SOURCE_DB_PASSWORD);
    JDBC_URL = automationContext.getConfigurationValue(XPathConstants.DATA_SOURCE_URL);
    DB_USER = automationContext.getConfigurationValue(XPathConstants.DATA_SOURCE_DB_USER_NAME);
    JDBC_DRIVER = automationContext.getConfigurationValue(XPathConstants.DATA_SOURCE_DRIVER_CLASS_NAME);
    serverConfigurationManager = new ServerConfigurationManager(context);
    copyJDBCDriverToClassPath();
    mySqlDatabaseManager = new MySqlDatabaseManager(JDBC_URL, DB_USER, DB_PASSWORD);
    mySqlDatabaseManager.executeUpdate("DROP DATABASE IF EXISTS WSO2SampleDBForAutomation");

    super.init();

    headers.put("Test-Header-Field", "TestHeaderValue");

    logViewer = new LogViewerClient(contextUrls.getBackEndUrl(),getSessionCookie());
}
 
Example 14
Source Project: product-ei   Source File: Sample364TestCase.java    License: Apache License 2.0 6 votes vote down vote up
@SetEnvironment(executionEnvironments = { ExecutionEnvironment.PLATFORM })
@Test(groups = {"wso2.esb"}, description = "testDBMediator ")
public void testDBMediator() throws Exception {

    LogViewerClient logViewerClient =
            new LogViewerClient(contextUrls.getBackEndUrl(), getSessionCookie());

    logViewerClient.clearLogs();

    AxisServiceClient client = new AxisServiceClient();

    client.sendRobust(Utils.getStockQuoteRequest("IBM")
            , getMainSequenceURL(), "getQuote");

    LogEvent[] getLogsInfo = logViewerClient.getAllRemoteSystemLogs();
    boolean assertValue = false;
    for (LogEvent event : getLogsInfo) {
        if (event.getMessage().contains("Stock Prize")) {
            assertValue = true;
            break;
        }
    }
    Assert.assertTrue(assertValue,
            "db lookup failed");

}
 
Example 15
Source Project: product-ei   Source File: EagerLoadingTestCase.java    License: Apache License 2.0 6 votes vote down vote up
@BeforeClass(alwaysRun = true)
protected void startServerWithEagerLoading() throws Exception {
    super.init(TestUserMode.SUPER_TENANT_USER);
    serverManager = new ServerConfigurationManager(context);
    AutomationContext autoContext = new AutomationContext();
    // upload a faulty sequence which refer registry resource doesn't exists
    FileUtils.copyFileToDirectory(new File(FrameworkPathUtil.getSystemResourceLocation() +
                                           "/artifacts/ESB/eager/loading/ESBJAVA3602-FaultySeq.xml"),
                                  getSynapseDeploymentDir());

    File carbonXml = new File(FrameworkPathUtil.getSystemResourceLocation() +
                              "/artifacts/ESB/eager/loading/ESBJAVA3602Carbon.xml");
    serverManager.applyConfiguration(carbonXml, getCarbonXmlFile());
    super.init(TestUserMode.TENANT_ADMIN);
    logViewerClient = new LogViewerClient(contextUrls.getBackEndUrl(), getSessionCookie());

}
 
Example 16
private boolean searchInLogs(LogViewerClient logViewerClient, String searchString)
        throws RemoteException, InterruptedException {
    boolean logFound = false;
    for (int i = 0; i < 60; i++) {
        LogEvent[] logEvents = logViewerClient.getAllRemoteSystemLogs();
        if (logEvents != null) {
            for (LogEvent logEvent : logEvents) {
                if (logEvent == null) {
                    continue;
                }
                if (logEvent.getMessage().contains(searchString)) {
                    logFound = true;
                    break;
                }
            }
        }
        if (logFound) {
            break;
        }
        Thread.sleep(500);
    }
    return logFound;
}
 
Example 17
@Test(groups = "wso2.esb", description = "Proxy service with providing endpoint through url")
public void testLoggingProxy() throws Exception {
    OMElement response =
            axis2Client.sendSimpleStockQuoteRequest(getProxyServiceURLHttp("StockQuoteLoggingProxy"), null, "WSO2");

    String lastPrice = response.getFirstElement().
            getFirstChildWithName(new QName("http://services.samples/xsd", "last")).getText();
    assertNotNull(lastPrice, "Fault: response message 'last' price null");

    String symbol = response.getFirstElement().
            getFirstChildWithName(new QName("http://services.samples/xsd", "symbol")).getText();
    assertEquals(symbol, "WSO2", "Fault: value 'symbol' mismatched");

    LogViewerClient logViewerClient =
            new LogViewerClient(context.getContextUrls().getBackEndUrl(), getSessionCookie());

    assertNotNull(Utils.checkForLogsWithPriority(logViewerClient, "INFO", "getQuote", 30),
            "Request INFO log entry not found");
    assertNotNull(Utils.checkForLogsWithPriority(logViewerClient, "INFO", "<ns:symbol>WSO2</ns:symbol>", 30),
            "Request INFO log entry not found");
    assertNotNull(Utils.checkForLogsWithPriority(logViewerClient, "INFO", "ns:getQuoteResponse", 30),
            "Request INFO log entry not found");
}
 
Example 18
Source Project: product-ei   Source File: InboundEPWithNonWorkerManager.java    License: Apache License 2.0 6 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void setEnvironment() throws Exception {
    super.init();
    serverConfigurationManager =
            new ServerConfigurationManager(new AutomationContext("ESB", TestUserMode.SUPER_TENANT_ADMIN));
    serverConfigurationManager.applyConfigurationWithoutRestart(new File(FULL_RESOURCE_PATH + "axis2.xml"));
    serverConfigurationManager.copyToComponentLib
            (new File(getClass().getResource(JAR_LOCATION + File.separator + HAWTBUF).toURI()));
    serverConfigurationManager.copyToComponentLib
            (new File(getClass().getResource(JAR_LOCATION + File.separator + ACTIVEMQ_BROKER).toURI()));
    serverConfigurationManager.copyToComponentLib
            (new File(getClass().getResource(JAR_LOCATION + File.separator + ACTIVEMQ_CLIENT).toURI()));
    serverConfigurationManager.copyToComponentLib
            (new File(getClass().getResource(JAR_LOCATION + File.separator + GERONIMO_J2EE_MANAGEMENT).toURI()));
    serverConfigurationManager.copyToComponentLib
            (new File(getClass().getResource(JAR_LOCATION + File.separator + GERONIMO_JMS).toURI()));
    serverConfigurationManager.restartGracefully();
    super.init();
    addInboundEndpoint(esbUtils.loadResource(RELATIVE_RESOURCE_PATH + "JMSEndpoint.xml"));
    logViewerClient = new LogViewerClient(contextUrls.getBackEndUrl(), getSessionCookie());
}
 
Example 19
Source Project: product-ei   Source File: FaviconTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test(groups = {"wso2.esb"}, description = "Test for ClosedChannel Exception")
public void faviconTest() throws Exception {
    HttpsResponse response = HttpsURLConnectionClient.
            getRequest("https://localhost:8443/" + "favicon.ico", null);
    Assert.assertEquals(response.getResponseCode(), 301, "Response code mismatch");

    LogViewerClient logViewerClient =
            new LogViewerClient(contextUrls.getBackEndUrl(), getSessionCookie());


    LogEvent[] logs = logViewerClient.getAllRemoteSystemLogs();
    boolean exceptionFound = false;
    for (LogEvent item : logs) {
        String message = item.getMessage();
        if (message.contains("ClosedChannelException")) {
            exceptionFound = true;
            break;
        }
    }
    Assert.assertTrue(!exceptionFound, "ClosedChannelException occurred while retrieving favicon.ico");
}
 
Example 20
Source Project: micro-integrator   Source File: Sample264TestCase.java    License: Apache License 2.0 5 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void init() throws Exception {
    super.init();
    context = new AutomationContext("ESB", TestUserMode.SUPER_TENANT_ADMIN);

    logViewerClient = new LogViewerClient(contextUrls.getBackEndUrl(), getSessionCookie());
    logViewerClient.clearLogs();
    Thread.sleep(2000);
    loadSampleESBConfiguration(264);

}
 
Example 21
Source Project: product-ei   Source File: ForEachSmallMessageTestCase.java    License: Apache License 2.0 5 votes vote down vote up
@BeforeClass
public void setEnvironment() throws Exception {
    init();
    verifyProxyServiceExistence("foreachSmallMessageTestProxy");
    symbol = FixedSizeSymbolGenerator.generateMessageKB(5);
    logViewer =
            new LogViewerClient(contextUrls.getBackEndUrl(), getSessionCookie());

}
 
Example 22
Source Project: product-ei   Source File: Utils.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Check if the system log contains the expected string. The search will be done for maximum 10 seconds.
 *
 * @param logViewerClient log viewer used for test
 * @param expected        expected string
 * @return true if a match found, false otherwise
 * @throws RemoteException             due to a logviewer error
 */
public static boolean assertIfSystemLogContains(LogViewerClient logViewerClient, String expected)
        throws RemoteException {
    boolean matchFound = false;
    long startTime = System.currentTimeMillis();
    LogEvent[] systemLogs;
    while (!matchFound && (System.currentTimeMillis() - startTime) < 10000) {
        matchFound = assertIfLogExists(logViewerClient, expected);
    }
    return matchFound;
}
 
Example 23
@BeforeClass(alwaysRun = true)
public void setEnvironment() throws Exception {

	init();
	loadESBConfigurationFromClasspath(
			"/artifacts/ESB/generic/inbound/transport/generic_inbound_transport_config.xml");
	logViewerClient = new LogViewerClient(contextUrls.getBackEndUrl(), getSessionCookie());
}
 
Example 24
@BeforeClass(alwaysRun = true)
public void initialize() throws Exception {
    super.init();
    loadESBConfigurationFromClasspath(
            File.separator + "artifacts" + File.separator + "ESB" + File.separator + "mailTransport" +
            File.separator + "mailTransportReceiver" + File.separator + "mail_transport_invalid_address.xml");
    logViewerClient = new LogViewerClient(contextUrls.getBackEndUrl(), getSessionCookie());

    // Since ESB reads all unread emails one by one, we have to delete
    // the all unread emails before run the test
    GreenMailServer.deleteAllEmails("pop3");
}
 
Example 25
@BeforeClass(alwaysRun = true)
public void initialize() throws Exception {
    super.init();
    loadESBConfigurationFromClasspath(
            File.separator + "artifacts" + File.separator + "ESB" + File.separator + "mailTransport" +
            File.separator + "mailTransportReceiver" + File.separator + "mail_transport_invalid_folder.xml");
    logViewerClient = new LogViewerClient(contextUrls.getBackEndUrl(), getSessionCookie());

    // Since ESB reads all unread emails one by one, we have to delete
    // the all unread emails before run the test
    GreenMailServer.deleteAllEmails("imap");
}
 
Example 26
Source Project: product-ei   Source File: MailToTransportFolderTestCase.java    License: Apache License 2.0 5 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void initialize() throws Exception {
    super.init();
    loadESBConfigurationFromClasspath(
            File.separator + "artifacts" + File.separator + "ESB" + File.separator + "mailTransport" +
            File.separator + "mailTransportReceiver" + File.separator + "mail_transport_folder.xml");
    logViewerClient = new LogViewerClient(contextUrls.getBackEndUrl(), getSessionCookie());
    greenMailUser = GreenMailServer.getPrimaryUser();
    greenMailClient = new GreenMailClient(greenMailUser);

    // Since ESB reads all unread emails one by one, we have to delete
    // the all unread emails before run the test
    GreenMailServer.deleteAllEmails("imap");
}
 
Example 27
@BeforeClass(alwaysRun = true)
public void initialize() throws Exception {
    super.init();
    loadESBConfigurationFromClasspath(
            File.separator + "artifacts" + File.separator + "ESB" + File.separator + "mailTransport" +
            File.separator + "mailTransportReceiver" + File.separator +
            "mail_transport_actionafter_failure_move.xml");
    logViewerClient = new LogViewerClient(contextUrls.getBackEndUrl(), getSessionCookie());
    greenMailUser = GreenMailServer.getPrimaryUser();
    greenMailClient = new GreenMailClient(greenMailUser);

    // Since ESB reads all unread emails one by one, we have to
    // delete the all unread emails before run the test
    GreenMailServer.deleteAllEmails("imap");
}
 
Example 28
@BeforeClass(alwaysRun = true)
public void initialize() throws Exception {
    super.init();
    loadESBConfigurationFromClasspath(
            File.separator + "artifacts" + File.separator + "ESB" + File.separator + "mailTransport" +
                    File.separator + "mailTransportReceiver" + File.separator + "mail_transport_remove_header.xml");
    logViewerClient = new LogViewerClient(contextUrls.getBackEndUrl(), getSessionCookie());
    greenMailUser = GreenMailServer.getPrimaryUser();
    greenMailClient = new GreenMailClient(greenMailUser);

    // Since ESB reads all unread emails one by one, we have to delete
    // the all unread emails before run the test
    GreenMailServer.deleteAllEmails("imap");
}
 
Example 29
Source Project: product-ei   Source File: LogMediatorLevelTest.java    License: Apache License 2.0 5 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void setEnvironment() throws Exception {
    super.init();
    logAdmin = new LoggingAdminClient(contextUrls.getBackEndUrl(), getSessionCookie());
    logViewer = new LogViewerClient(contextUrls.getBackEndUrl(), getSessionCookie());
    verifyProxyServiceExistence("logMediatorLevelTestProxy");
    verifySequenceExistence("logCategoryTestSequence");


}
 
Example 30
@Test(groups = {"wso2.esb"}, description = "Callout JMS headers test case")
public void testCalloutJMSHeaders() throws Exception {

    AxisServiceClient client = new AxisServiceClient();
    String payload = "<payload/>";
    AXIOMUtil.stringToOM(payload);
     client.sendRobust(AXIOMUtil.stringToOM(payload),
                       getProxyServiceURLHttp("JMCalloutClientProxy"), "urn:mediate");

    Thread.sleep(60000); //wait until all message received to jms proxy

    LogViewerClient logViewerClient = new LogViewerClient(contextUrls.getBackEndUrl(), getSessionCookie());
    LogEvent[] logs = logViewerClient.getAllRemoteSystemLogs();
    boolean logFound = false;
    for (LogEvent item : logs) {
        if (item.getPriority().equals("INFO")) {
            String message = item.getMessage();
            if (message.contains("RequestHeaderVal")) {
                logFound = true;
                break;
            }
        }
    }

    assertTrue(logFound);

}