Java Code Examples for org.wso2.carbon.automation.test.utils.common.FileManager#copyResourceToFileSystem()

The following examples show how to use org.wso2.carbon.automation.test.utils.common.FileManager#copyResourceToFileSystem() . 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: HTTPXMLMessageTestCase.java    From product-cep with Apache License 2.0 6 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void init()
        throws Exception {
    super.init(TestUserMode.SUPER_TENANT_ADMIN);
    serverManager = new ServerConfigurationManager(cepServer);

    try {
        String warFilePath = FrameworkPathUtil.getSystemResourceLocation() +
                             "artifacts" + File.separator + "CEP" + File.separator + "war"
                             + File.separator;

        webAppDirectoryPath = FrameworkPathUtil.getCarbonHome() + File.separator + "repository" + File.separator +
                              "deployment" + File.separator + "server" + File.separator + "webapps" + File.separator;
        FileManager.copyResourceToFileSystem(warFilePath + webAppFileName, webAppDirectoryPath, webAppFileName);
        Thread.sleep(5000);
    } catch (Exception e) {
        throw new RemoteException("Exception caught when deploying the war file into CEP server", e);
    }

    String loggedInSessionCookie = new LoginLogoutClient(cepServer).login();
    eventProcessorAdminServiceClient = configurationUtil.getEventProcessorAdminServiceClient(backendURL, loggedInSessionCookie);
    eventStreamManagerAdminServiceClient = configurationUtil.getEventStreamManagerAdminServiceClient(backendURL, loggedInSessionCookie);
    eventReceiverAdminServiceClient = configurationUtil.getEventReceiverAdminServiceClient(backendURL, loggedInSessionCookie);
    eventPublisherAdminServiceClient = configurationUtil.getEventPublisherAdminServiceClient(backendURL, loggedInSessionCookie);
}
 
Example 2
Source File: RegistryConfiguratorTestCase.java    From product-es with Apache License 2.0 5 votes vote down vote up
private void copyMimeMappingFile() throws IOException {

        String fileName = "mime.mappings";
        String targetPath = CarbonUtils.getCarbonHome() + File.separator + "repository" +
                File.separator + "conf" + File.separator + "etc";
        String sourcePath = getTestArtifactLocation() + "artifacts" +
                File.separator + "GREG" + File.separator + "config" + File.separator +
                "mime.mappings";
        FileManager.copyResourceToFileSystem(sourcePath, targetPath, fileName);
    }
 
Example 3
Source File: RegistryConfiguratorTestCase.java    From product-es with Apache License 2.0 5 votes vote down vote up
private void copyMimeMappingFile() throws IOException {

        String fileName = "mime.mappings";
        String targetPath = CarbonUtils.getCarbonHome() + File.separator + "repository" +
                File.separator + "conf" + File.separator + "etc";
        String sourcePath = getTestArtifactLocation() + "artifacts" +
                File.separator + "GREG" + File.separator + "config" + File.separator +
                "mime.mappings";
        FileManager.copyResourceToFileSystem(sourcePath, targetPath, fileName);
    }
 
Example 4
Source File: EventSimulatorTestCase.java    From product-cep with Apache License 2.0 4 votes vote down vote up
@Test(groups = {"wso2.cep"}, description = "Testing Event Simulation (Play, Pause and Resume)")
public void EventSimulatorTestScenario() throws Exception {
    int startESCount = eventStreamManagerAdminServiceClient.getEventStreamCount();
    int startEPCount = eventPublisherAdminServiceClient.getActiveEventPublisherCount();
    Wso2EventServer wso2EventServer = new Wso2EventServer("eventsimulatorFiles", CEPIntegrationTestConstants.TCP_PORT, true);


    //Add StreamDefinition
    String streamDefinitionAsString = getJSONArtifactConfiguration("eventsimulatorFiles",
            "TempStream_1.0.0.json");
    eventStreamManagerAdminServiceClient.addEventStreamAsString(streamDefinitionAsString);
    Assert.assertEquals(eventStreamManagerAdminServiceClient.getEventStreamCount(), startESCount + 1);

    //Add Text Logger
    String eventPublisherConfig = getXMLArtifactConfiguration("eventsimulatorFiles", "tempEventPublisher.xml");
    eventPublisherAdminServiceClient.addEventPublisherConfiguration(eventPublisherConfig);
    Assert.assertEquals(eventPublisherAdminServiceClient.getActiveEventPublisherCount(), startEPCount + 1);

    //Copy Event Simulator File
    String eventSimulatorFilePath = FrameworkPathUtil.getSystemResourceLocation() +
            "artifacts" + File.separator + "CEP" + File.separator + "eventsimulatorFiles"
            + File.separator;

    String eventSimulatorDirectoryPath = FrameworkPathUtil.getCarbonHome() + File.separator
            + "repository" + File.separator + "deployment" + File.separator + "server"
            + File.separator + "eventsimulatorfiles" + File.separator;
    try {
        FileManager.copyResourceToFileSystem(eventSimulatorFilePath + "events.csv", eventSimulatorDirectoryPath, "events.csv");
    } catch (Exception e) {
        throw new RemoteException("Exception caught when deploying the car file into CEP server", e);
    }
    log.info("deploying Event Simulator File...");
    Thread.sleep(35000);

    wso2EventServer.startServer();

    eventSimulatorAdminServiceClient.sendConfigDetails("events.csv", "TempStream:1.0.0", ",", 1000);
    Thread.sleep(10000);
    eventSimulatorAdminServiceClient.sendEventsViaFile("events.csv");
    Thread.sleep(3000);
    eventSimulatorAdminServiceClient.pauseEventsViaFile("events.csv");
    Thread.sleep(3000);
    eventSimulatorAdminServiceClient.resumeEventsViaFile("events.csv");
    Thread.sleep(10000);

    Assert.assertEquals(wso2EventServer.getMsgCount(), 13, "Incorrect number of messages consumed!");
    Thread.sleep(2000);

    eventStreamManagerAdminServiceClient.removeEventStream("org.wso2.event.sensor.stream", "1.0.0");
    eventPublisherAdminServiceClient.removeInactiveEventPublisherConfiguration("logger.xml");
    eventSimulatorAdminServiceClient.deleteFile("events.csv");
    wso2EventServer.stop();

    Thread.sleep(2000);

}