Java Code Examples for org.wso2.carbon.integration.common.utils.mgt.ServerConfigurationManager#getCarbonHome()

The following examples show how to use org.wso2.carbon.integration.common.utils.mgt.ServerConfigurationManager#getCarbonHome() . 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 File: DLCQueueTestCase.java    From product-ei with Apache License 2.0 6 votes vote down vote up
/**
 * Initializes the test case and changes the number of delivery attempts of a message to 1.
 *
 * @throws AutomationUtilException
 * @throws XPathExpressionException
 * @throws MalformedURLException
 */
@BeforeClass()
public void initialize() throws AutomationUtilException, XPathExpressionException, IOException,
                                                                                            ConfigurationException {
    super.init();

    // Updating the redelivery attempts to 1 to speed up the test case.
    super.serverManager = new ServerConfigurationManager(mbServer);
    String defaultMBConfigurationPath = ServerConfigurationManager.getCarbonHome() + File.separator + "wso2"
                                        + File.separator + "broker" + File.separator + "conf" + File.separator
                                        + "broker.xml";
    ConfigurationEditor configurationEditor = new ConfigurationEditor(defaultMBConfigurationPath);
    // Changing "maximumRedeliveryAttempts" value to "1" in broker.xml
    configurationEditor.updateProperty(AndesConfiguration.TRANSPORTS_AMQP_MAXIMUM_REDELIVERY_ATTEMPTS, "1");
    // Restarting server
    configurationEditor.applyUpdatedConfigurationAndRestartServer(serverManager);
}
 
Example 2
Source File: LZ4UITestCase.java    From product-ei with Apache License 2.0 6 votes vote down vote up
/**
 * Enabling compression to verify decompression and reducing the maximum content chunk size, to create more content chunks
 * from compressed content, to check chunk data retrieval.
 * Increase the managementConsole/maximumMessageDisplayLength to match the large message size that is tested.
 *
 * @throws XPathExpressionException
 * @throws java.io.IOException
 * @throws org.apache.commons.configuration.ConfigurationException
 * @throws org.wso2.carbon.integration.common.utils.exceptions.AutomationUtilException
 */
@BeforeClass
public void setupConfiguration() throws AutomationUtilException, XPathExpressionException, IOException,
        ConfigurationException {

    super.serverManager = new ServerConfigurationManager(mbServer);

    String defaultMBConfigurationPath = ServerConfigurationManager.getCarbonHome() + File.separator + "wso2"
                                        + File.separator + "broker" + File.separator + "conf" + File.separator
                                        + "broker.xml";

    log.info("DEFAULT_MB_CONFIG_PATH : " + defaultMBConfigurationPath);

    ConfigurationEditor configurationEditor = new ConfigurationEditor(defaultMBConfigurationPath);

    configurationEditor.updateProperty(AndesConfiguration
            .MANAGEMENT_CONSOLE_MAX_DISPLAY_LENGTH_FOR_MESSAGE_CONTENT, String.valueOf(MESSAGE_SIZE_IN_BYTES + 1));
    configurationEditor.updateProperty(AndesConfiguration.PERFORMANCE_TUNING_ALLOW_COMPRESSION, "true");
    configurationEditor.updateProperty(AndesConfiguration.PERFORMANCE_TUNING_MAX_CONTENT_CHUNK_SIZE, "100");

    configurationEditor.applyUpdatedConfigurationAndRestartServer(serverManager);
}
 
Example 3
Source File: PurgeMessagesTestCase.java    From product-ei with Apache License 2.0 6 votes vote down vote up
/**
 * Set values TRANSPORTS_AMQP_MAXIMUM_REDELIVERY_ATTEMPTS = 1 and
 * ANDES_ACK_WAIT_TIMEOUT_PROPERTY = 1
 * so that the time taken for the massages to get moved into DLC is at a minimum
 */
@BeforeClass
public void setupConfiguration() throws XPathExpressionException, IOException,
        ConfigurationException, SAXException, XMLStreamException, LoginAuthenticationExceptionException,
        URISyntaxException, AutomationUtilException {
    ;
    super.serverManager = new ServerConfigurationManager(automationContext);

    String defaultMBConfigurationPath = ServerConfigurationManager.getCarbonHome() +
            File.separator + "wso2" + File.separator + "broker" + File.separator + "conf" + File.separator + "broker.xml";

    ConfigurationEditor configurationEditor = new ConfigurationEditor(defaultMBConfigurationPath);

    //Set values TRANSPORTS_AMQP_MAXIMUM_REDELIVERY_ATTEMPTS = 1 and
    //ANDES_ACK_WAIT_TIMEOUT_PROPERTY = 1
    //so that the time taken for the massages to get moved into DLC is at a minimum
    configurationEditor.updateProperty(AndesConfiguration
            .TRANSPORTS_AMQP_MAXIMUM_REDELIVERY_ATTEMPTS, "1");
    System.setProperty(AndesClientConstants.ANDES_ACK_WAIT_TIMEOUT_PROPERTY, "1");

    //andesAdminClient.deleteQueue(DLCQueueUtils.identifyTenantInformationAndGenerateDLCString(TEST_QUEUE_PURGE));
    //We should restart the server witht he new configuration values
    configurationEditor.applyUpdatedConfigurationAndRestartServer(serverManager);
}
 
Example 4
Source File: PerMessageAcknowledgementsTestCase.java    From product-ei with Apache License 2.0 6 votes vote down vote up
/**
 * Initializing test case
 *
 * @throws XPathExpressionException
 */
@BeforeClass(alwaysRun = true)
public void init() throws XPathExpressionException, IOException, AutomationUtilException, ConfigurationException {
    super.init(TestUserMode.SUPER_TENANT_USER);

    // Updating the redelivery attempts to 1 to speed up the test case.
    super.serverManager = new ServerConfigurationManager(automationContext);
    String defaultMBConfigurationPath = ServerConfigurationManager.getCarbonHome() + File.separator + "wso2" +
                                        File.separator + "broker" + File.separator + "conf" + File.separator +
                                        "broker.xml";
    ConfigurationEditor configurationEditor = new ConfigurationEditor(defaultMBConfigurationPath);

    // Changing "maximumRedeliveryAttempts" value to "1" in broker.xml
    configurationEditor.updateProperty(AndesConfiguration.TRANSPORTS_AMQP_MAXIMUM_REDELIVERY_ATTEMPTS, "1");
    // Restarting server
    configurationEditor.applyUpdatedConfigurationAndRestartServer(serverManager);

    // Get current "AndesAckWaitTimeOut" system property.
    defaultAndesAckWaitTimeOut = System.getProperty(AndesClientConstants.ANDES_ACK_WAIT_TIMEOUT_PROPERTY);

    // Setting system property "AndesAckWaitTimeOut" for andes
    System.setProperty(AndesClientConstants.ANDES_ACK_WAIT_TIMEOUT_PROPERTY, "3000");
}
 
Example 5
Source File: DiscardAllowedMsgDeliveryStrategyTestCase.java    From product-ei with Apache License 2.0 6 votes vote down vote up
/**
 * Set topicMessageDeliveryStrategy to DISCARD_ALLOWED so that broker will simulate an acknowledgement
 * if some subscribers are slow to acknowledge the message
 *
 * @throws XPathExpressionException
 * @throws IOException
 * @throws ConfigurationException
 * @throws SAXException
 * @throws XMLStreamException
 * @throws LoginAuthenticationExceptionException
 * @throws URISyntaxException
 * @throws AutomationUtilException
 */
@BeforeClass
public void setupConfiguration() throws XPathExpressionException, IOException,
		ConfigurationException, SAXException, XMLStreamException, LoginAuthenticationExceptionException,
		URISyntaxException, AutomationUtilException {

	super.serverManager = new ServerConfigurationManager(automationContext);
	String defaultMBConfigurationPath = ServerConfigurationManager.getCarbonHome() +
										File.separator + "wso2" + File.separator + "broker" + File.separator +
										"conf" + File.separator + "broker.xml";

	ConfigurationEditor configurationEditor = new ConfigurationEditor(defaultMBConfigurationPath);

	configurationEditor.updateProperty(AndesConfiguration
			.PERFORMANCE_TUNING_TOPIC_MESSAGE_DELIVERY_STRATEGY, "DISCARD_ALLOWED");

	configurationEditor.updateProperty(AndesConfiguration.PERFORMANCE_TUNING_ACK_HANDLING_MAX_UNACKED_MESSAGES,
			"200");

	configurationEditor.applyUpdatedConfigurationAndRestartServer(serverManager);

}
 
Example 6
Source File: LZ4CompressionTestCase.java    From product-ei with Apache License 2.0 6 votes vote down vote up
/**
 * Set allowCompression to true so that broker will compress messages before storing into the database, and
 * reduce maximum content chunk size to 100 from default value (65500); to create more content chunks
 * from compressed content, to check chunk data retrieval.
 *
 * @throws XPathExpressionException
 * @throws java.io.IOException
 * @throws org.apache.commons.configuration.ConfigurationException
 * @throws org.wso2.carbon.integration.common.utils.exceptions.AutomationUtilException
 */
@BeforeClass
public void setupConfiguration() throws XPathExpressionException, IOException, ConfigurationException,
        AutomationUtilException {

    super.serverManager = new ServerConfigurationManager(automationContext);
    String defaultMBConfigurationPath = ServerConfigurationManager.getCarbonHome() + File.separator + "wso2" +
                                        File.separator + "broker" + File.separator + "conf" + File.separator +
                                        "broker.xml";

    ConfigurationEditor configurationEditor = new ConfigurationEditor(defaultMBConfigurationPath);

    configurationEditor.updateProperty(AndesConfiguration.PERFORMANCE_TUNING_ALLOW_COMPRESSION, "true");
    configurationEditor.updateProperty(AndesConfiguration.PERFORMANCE_TUNING_MAX_CONTENT_CHUNK_SIZE, "100");

    configurationEditor.applyUpdatedConfigurationAndRestartServer(serverManager);
}
 
Example 7
Source File: SlowestSubscriptionRateMsgDeliveryStrategyTestCase.java    From product-ei with Apache License 2.0 6 votes vote down vote up
/**
 * Set topicMessageDeliveryStrategy to SLOWEST_SUB_RATE_TOPIC so that broker will deliver the messages
 *
 * @throws XPathExpressionException
 * @throws java.io.IOException
 * @throws org.apache.commons.configuration.ConfigurationException
 * @throws org.xml.sax.SAXException
 * @throws javax.xml.stream.XMLStreamException
 * @throws org.wso2.carbon.authenticator.stub.LoginAuthenticationExceptionException
 * @throws java.net.URISyntaxException
 * @throws org.wso2.carbon.integration.common.utils.exceptions.AutomationUtilException
 */
@BeforeClass
public void setupConfiguration() throws XPathExpressionException, IOException,
		ConfigurationException, SAXException, XMLStreamException, LoginAuthenticationExceptionException,
		URISyntaxException, AutomationUtilException {

	super.serverManager = new ServerConfigurationManager(automationContext);
	String defaultMBConfigurationPath = ServerConfigurationManager.getCarbonHome() + File.separator + "wso2" +
										File.separator + "broker" + File.separator + "conf" + File.separator +
										"broker.xml";

	ConfigurationEditor configurationEditor = new ConfigurationEditor(defaultMBConfigurationPath);

	configurationEditor.updateProperty(AndesConfiguration
			.PERFORMANCE_TUNING_TOPIC_MESSAGE_DELIVERY_STRATEGY, "SLOWEST_SUB_RATE");

	//reduce this to 200 from default value (1000) so that delivery strategy is effective fast
	configurationEditor.updateProperty(AndesConfiguration.PERFORMANCE_TUNING_ACK_HANDLING_MAX_UNACKED_MESSAGES,
			"2");

	configurationEditor.applyUpdatedConfigurationAndRestartServer(serverManager);

}
 
Example 8
Source File: DLCMessageExpiryTestCase.java    From product-ei with Apache License 2.0 6 votes vote down vote up
/**
 * Set topicMessageDeliveryStrategy to DISCARD_ALLOWED so that broker will simulate an acknowledgement
 * if some subscribers are slow to acknowledge the message
 *
 * @throws XPathExpressionException
 * @throws IOException
 * @throws ConfigurationException
 * @throws SAXException
 * @throws XMLStreamException
 * @throws LoginAuthenticationExceptionException
 * @throws URISyntaxException
 * @throws AutomationUtilException
 */
@BeforeClass
public void setupConfiguration() throws XPathExpressionException, IOException,
        ConfigurationException, SAXException, XMLStreamException, LoginAuthenticationExceptionException,
        URISyntaxException, AutomationUtilException {
    super.serverManager = new ServerConfigurationManager(automationContext);
    String defaultMBConfigurationPath = ServerConfigurationManager.getCarbonHome() +
                                        File.separator + "wso2" + File.separator + "broker" + File.separator +
                                        "conf" + File.separator + "broker.xml";
    ConfigurationEditor configurationEditor = new ConfigurationEditor(defaultMBConfigurationPath);
    configurationEditor.updateProperty(AndesConfiguration.PERFORMANCE_TUNING_PRE_DELIVERY_EXPIRY_DELETION_INTERVAL,
            "60");
    configurationEditor.updateProperty(AndesConfiguration
            .PERFORMANCE_TUNING_PERIODIC_EXPIRY_MESSAGE_DELETION_INTERVAL, "60");
    configurationEditor.updateProperty(AndesConfiguration.TRANSPORTS_AMQP_MAXIMUM_REDELIVERY_ATTEMPTS, "1");
    configurationEditor.applyUpdatedConfigurationAndRestartServer(serverManager);
    // Get current "AndesAckWaitTimeOut" system property.
    defaultAndesAckWaitTimeOut = System.getProperty(AndesClientConstants.ANDES_ACK_WAIT_TIMEOUT_PROPERTY);
    // Setting system property "AndesAckWaitTimeOut" for andes
    System.setProperty(AndesClientConstants.ANDES_ACK_WAIT_TIMEOUT_PROPERTY, "3000");
}
 
Example 9
Source File: MessageContentTestCase.java    From product-ei with Apache License 2.0 6 votes vote down vote up
/**
 * Set allowCompression to false, so that broker won't compress messages
 *
 * @throws XPathExpressionException
 * @throws java.io.IOException
 * @throws org.apache.commons.configuration.ConfigurationException
 * @throws org.wso2.carbon.integration.common.utils.exceptions.AutomationUtilException
 */
@BeforeClass
public void setupConfiguration() throws XPathExpressionException, IOException, ConfigurationException,
        AutomationUtilException {

    super.serverManager = new ServerConfigurationManager(automationContext);
    String defaultMBConfigurationPath = ServerConfigurationManager.getCarbonHome() + File.separator + "wso2" +
                                        File.separator + "broker" + File.separator + "conf" + File.separator +
                                        "broker.xml";

    ConfigurationEditor configurationEditor = new ConfigurationEditor(defaultMBConfigurationPath);

    configurationEditor.updateProperty(AndesConfiguration.PERFORMANCE_TUNING_ALLOW_COMPRESSION, "false");

    configurationEditor.applyUpdatedConfigurationAndRestartServer(serverManager);
}
 
Example 10
Source File: AMQPSessionRecoverTestCase.java    From product-ei with Apache License 2.0 6 votes vote down vote up
/**
 * Set values TRANSPORTS_AMQP_MAXIMUM_REDELIVERY_ATTEMPTS = 3 and
 * ANDES_ACK_WAIT_TIMEOUT_PROPERTY = 10000
 * so that once a message is seen by application for 3 times it goes to DLC
 * and ack timeout is out of the equation
 */
@BeforeClass
public void setupConfiguration() throws XPathExpressionException, IOException,
        ConfigurationException, SAXException, XMLStreamException, LoginAuthenticationExceptionException,
        URISyntaxException, AutomationUtilException {

    super.serverManager = new ServerConfigurationManager(automationContext);

    String defaultMBConfigurationPath = ServerConfigurationManager.getCarbonHome() +
            File.separator + "wso2" + File.separator + "broker" + File.separator + "conf" + File.separator + "broker.xml";

    ConfigurationEditor configurationEditor = new ConfigurationEditor(defaultMBConfigurationPath);

    configurationEditor.updateProperty(AndesConfiguration
            .TRANSPORTS_AMQP_MAXIMUM_REDELIVERY_ATTEMPTS, "3");
    System.setProperty(AndesClientConstants.ANDES_ACK_WAIT_TIMEOUT_PROPERTY, "10000");

    //We should restart the server with the new configuration values
    configurationEditor.applyUpdatedConfigurationAndRestartServer(serverManager);
}
 
Example 11
Source File: DLCReRouteAllTestCase.java    From product-ei with Apache License 2.0 5 votes vote down vote up
/**
 * Initializes test. This class will initialize web driver and
 * restart server with altered broker.xml
 *
 * @throws AutomationUtilException
 * @throws XPathExpressionException
 * @throws IOException
 */
@BeforeClass()
public void initialize() throws AutomationUtilException, XPathExpressionException, IOException, ConfigurationException {
    super.init();

    super.serverManager = new ServerConfigurationManager(mbServer);
    String defaultMBConfigurationPath = ServerConfigurationManager.getCarbonHome() + File.separator + "wso2" +
                                        File.separator + "broker" + File.separator + "conf" + File.separator +
                                        "broker.xml";
    ConfigurationEditor configurationEditor = new ConfigurationEditor(defaultMBConfigurationPath);
    // Changing "maximumRedeliveryAttempts" value to "2" in broker.xml
    configurationEditor.updateProperty(AndesConfiguration.TRANSPORTS_AMQP_MAXIMUM_REDELIVERY_ATTEMPTS, "1");
    // Restarting server
    configurationEditor.applyUpdatedConfigurationAndRestartServer(serverManager);
}
 
Example 12
Source File: DLCDurableTopicTestCase.java    From product-ei with Apache License 2.0 5 votes vote down vote up
/**
 * Initializes test. This class will initialize web driver and
 * restart server with altered broker.xml
 *
 * @throws AutomationUtilException
 * @throws XPathExpressionException
 * @throws IOException
 */
@BeforeClass()
public void initialize() throws AutomationUtilException, XPathExpressionException, IOException, ConfigurationException {
    super.init();

    super.serverManager = new ServerConfigurationManager(mbServer);
    String defaultMBConfigurationPath = ServerConfigurationManager.getCarbonHome() + File.separator + "wso2"
                                        + File.separator + "broker" + File.separator + "conf" + File.separator
                                        + "broker.xml";
    ConfigurationEditor configurationEditor = new ConfigurationEditor(defaultMBConfigurationPath);
    // Changing "maximumRedeliveryAttempts" value to "2" in broker.xml
    configurationEditor.updateProperty(AndesConfiguration.TRANSPORTS_AMQP_MAXIMUM_REDELIVERY_ATTEMPTS, "2");
    // Restarting server
    configurationEditor.applyUpdatedConfigurationAndRestartServer(serverManager);
}
 
Example 13
Source File: SharedDurableSubscriptionTestCase.java    From product-ei with Apache License 2.0 5 votes vote down vote up
/**
 * Initializes the test case and modifying broker.xml to allow shared subscriptions.
 *
 * @throws AutomationUtilException
 * @throws XPathExpressionException
 * @throws MalformedURLException
 */
@BeforeClass()
public void initialize() throws Exception {
    super.init();

    super.serverManager = new ServerConfigurationManager(mbServer);
    String defaultMBConfigurationPath = ServerConfigurationManager.getCarbonHome() + File.separator + "wso2"
                                        + File.separator + "broker" + File.separator + "conf" + File.separator
                                        + "broker.xml";
    ConfigurationEditor configurationEditor = new ConfigurationEditor(defaultMBConfigurationPath);
    // Changing "allowSharedSubscription" value to "true" in broker.xml
    configurationEditor.updateProperty(AndesConfiguration.ALLOW_SHARED_SHARED_SUBSCRIBERS, "true");
    // Restarting server
    configurationEditor.applyUpdatedConfigurationAndRestartServer(serverManager);
}
 
Example 14
Source File: RedeliveryDelayTestCase.java    From product-ei with Apache License 2.0 5 votes vote down vote up
/**
 * Initializing test case.
 *
 * @throws XPathExpressionException
 */
@BeforeClass(alwaysRun = true)
public void init() throws XPathExpressionException, IOException, AutomationUtilException, ConfigurationException {
    super.init(TestUserMode.SUPER_TENANT_USER);

    // Updating the redelivery attempts to 1 to speed up the test case.
    super.serverManager = new ServerConfigurationManager(automationContext);
    String defaultMBConfigurationPath = ServerConfigurationManager.getCarbonHome() + File.separator + "wso2" +
                                        File.separator + "broker" + File.separator + "conf" + File.separator +
                                        "broker.xml";
    ConfigurationEditor configurationEditor = new ConfigurationEditor(defaultMBConfigurationPath);

    // Changing "maximumRedeliveryAttempts" value to "1" in broker.xml
    configurationEditor.updateProperty(AndesConfiguration.TRANSPORTS_AMQP_MAXIMUM_REDELIVERY_ATTEMPTS, "1");
    // Restarting server
    configurationEditor.applyUpdatedConfigurationAndRestartServer(serverManager);

    // Get current "AndesAckWaitTimeOut" system property.
    defaultAndesAckWaitTimeOut = System.getProperty(AndesClientConstants.ANDES_ACK_WAIT_TIMEOUT_PROPERTY);

    // Setting system property "AndesAckWaitTimeOut" for andes
    System.setProperty(AndesClientConstants.ANDES_ACK_WAIT_TIMEOUT_PROPERTY, "0");

    // Get current "AndesRedeliveryDelay" system property.
    defaultAndesRedeliveryDelay = System.getProperty(AndesClientConstants.ANDES_REDELIVERY_DELAY_PROPERTY);

    System.setProperty(AndesClientConstants.ANDES_REDELIVERY_DELAY_PROPERTY, "10000");
}
 
Example 15
Source File: ViewMessageContentTestCase.java    From product-ei with Apache License 2.0 4 votes vote down vote up
/**
 * Increase the managementConsole/maximumMessageDisplayLength to match the large message size that is tested.
 */
@BeforeClass
public void setupConfiguration() throws AutomationUtilException, XPathExpressionException, IOException,
        ConfigurationException {

    super.serverManager = new ServerConfigurationManager(mbServer);

    String defaultMBConfigurationPath = ServerConfigurationManager.getCarbonHome() + File.separator + "wso2"
                                        + File.separator + "broker" + File.separator + "conf" + File.separator
                                        + "broker.xml";

    log.info("DEFAULT_MB_CONFIG_PATH : " + defaultMBConfigurationPath);

    log.info("MESSAGE_CONTENT_INPUT_FILE_PATH" + MESSAGE_CONTENT_INPUT_FILE_PATH);

    ConfigurationEditor configurationEditor = new ConfigurationEditor(defaultMBConfigurationPath);

    configurationEditor.updateProperty(AndesConfiguration
            .MANAGEMENT_CONSOLE_MAX_DISPLAY_LENGTH_FOR_MESSAGE_CONTENT, String.valueOf(MESSAGE_SIZE_IN_BYTES + 1));

    configurationEditor.applyUpdatedConfigurationAndRestartServer(serverManager);
}
 
Example 16
Source File: FileTestCase.java    From product-cep with Apache License 2.0 4 votes vote down vote up
@Test(groups = {"wso2.cep"}, description = "Testing File receiver with event")
public void FileTestScenario() throws Exception {
    ServerConfigurationManager serverManager = new ServerConfigurationManager(cepServer);
    String samplePath = "inputflows" + File.separator + "sample0017";
    String destinationFilePath = serverManager.getCarbonHome() + File.separator + "repository" + File.separator
                                 + "logs" + File.separator + "fileLogs.txt";

    File file = new File(destinationFilePath);
    //Create new file even if it exists
    if (file.exists()) {
        file.delete();
    }
    file.createNewFile();

    int startESCount = eventStreamManagerAdminServiceClient.getEventStreamCount();
    int startERCount = eventReceiverAdminServiceClient.getActiveEventReceiverCount();
    int startEPCount = eventPublisherAdminServiceClient.getActiveEventPublisherCount();

    //Add StreamDefinition
    String streamDefinitionAsString = getJSONArtifactConfiguration(samplePath,
                                                                   "org.wso2.event.sensor.stream_1.0.0.json");
    eventStreamManagerAdminServiceClient.addEventStreamAsString(streamDefinitionAsString);
    Assert.assertEquals(eventStreamManagerAdminServiceClient.getEventStreamCount(), startESCount + 1);

    //Add File EventReceiver without mapping
    String eventReceiverConfig = getXMLArtifactConfiguration(samplePath, "fileReceiver.xml");
    eventReceiverAdminServiceClient.addEventReceiverConfiguration(eventReceiverConfig.replace("$testFilePath",
                                                                                              destinationFilePath));
    Assert.assertEquals(eventReceiverAdminServiceClient.getActiveEventReceiverCount(), startERCount + 1);

    //Add Wso2event EventPublisher
    String eventPublisherConfig2 = getXMLArtifactConfiguration(samplePath, "wso2EventPublisher.xml");
    eventPublisherAdminServiceClient.addEventPublisherConfiguration(eventPublisherConfig2);
    Assert.assertEquals(eventPublisherAdminServiceClient.getActiveEventPublisherCount(), startEPCount + 1);

    // The data-bridge receiver
    Wso2EventServer agentServer = new Wso2EventServer(samplePath, CEPIntegrationTestConstants.TCP_PORT, true);
    Thread agentServerThread = new Thread(agentServer);
    agentServerThread.start();
    // Let the server start
    Thread.sleep(2000);

    FilePublisherClient.publish(destinationFilePath, samplePath, "fileReceiver.txt");
    //File adapter is a poling adapter and it takes 40 seconds to load
    Thread.sleep(40000);

    eventStreamManagerAdminServiceClient.removeEventStream("org.wso2.event.sensor.stream", "1.0.0");
    eventReceiverAdminServiceClient.removeInactiveEventReceiverConfiguration("fileReceiver.xml");
    eventPublisherAdminServiceClient.removeInactiveEventPublisherConfiguration("wso2EventPublisher.xml");
    file.delete();

    Thread.sleep(2000);

    List<String> eventList = new ArrayList<>();
    Event event = new Event();
    event.setStreamId("org.wso2.event.sensor.stream:1.0.0");
    event.setMetaData(new Object[]{4354643, true, 100, "temperature"});
    event.setCorrelationData(new Object[]{90.34344, 5.443435});
    event.setPayloadData(new Object[]{8.9f, 20.44345});
    eventList.add(event.toString());
    Event event2 = new Event();
    event2.setStreamId("org.wso2.event.sensor.stream:1.0.0");
    event2.setMetaData(new Object[]{4354653, false, 101, "temperature"});
    event2.setCorrelationData(new Object[]{90.34344, 5.443435});
    event2.setPayloadData(new Object[]{8.9f, 20.44345});
    eventList.add(event2.toString());
    Event event3 = new Event();
    event3.setStreamId("org.wso2.event.sensor.stream:1.0.0");
    event3.setMetaData(new Object[]{4354343, true, 102, "temperature"});
    event3.setCorrelationData(new Object[]{90.34344, 5.443435});
    event3.setPayloadData(new Object[]{8.9f, 20.44345});
    eventList.add(event3.toString());

    try {
        Assert.assertEquals(agentServer.getMsgCount(), eventList.size(), "Incorrect number of messages consumed!");

        for (Event currentEvent : agentServer.getPreservedEventList()) {
            currentEvent.setTimeStamp(0);
            Assert.assertTrue(eventList.contains(currentEvent.toString()), "Mapping is incorrect!" );
        }

    } catch (Throwable e) {
        log.error("Exception thrown: " + e.getMessage(), e);
        Assert.fail("Exception: " + e.getMessage());
    } finally {
        agentServer.stop();

    }
}