Java Code Examples for org.wso2.carbon.automation.engine.frameworkutils.FrameworkPathUtil#getCarbonHome()

The following examples show how to use org.wso2.carbon.automation.engine.frameworkutils.FrameworkPathUtil#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: HumanTaskCoordinationTest.java    From product-ei with Apache License 2.0 6 votes vote down vote up
/**
 * Copy humantask.xml and b4p-coordination-config.xml configuration files and restart server
 *
 * @throws Exception
 */
private void applyCoordinationConfig() throws Exception {
	final String artifactLocation =
			FrameworkPathUtil.getSystemResourceLocation() + BPSTestConstants.DIR_CONFIG + File.separator +
			BPSTestConstants.DIR_HT_COORDINATION + File.separator;

	File humantaskConfigNew = new File(artifactLocation + BPSTestConstants.HUMANTASK_XML);
	File humantaskConfigOriginal = new File(
			FrameworkPathUtil.getCarbonHome() + File.separator + BPSTestConstants.NEW_CONF_DIR + File.separator + BPSTestConstants.HUMANTASK_XML);
	// Do not restart server. We need to apply another config file.
	serverConfigurationManager.applyConfiguration(humantaskConfigNew, humantaskConfigOriginal, true, false);

	File b4pConfigNew = new File(artifactLocation + BPSTestConstants.B4P_COORDINATION_CONFIG_XML);
	File b4pConfigOriginal = new File(FrameworkPathUtil.getCarbonHome() + File.separator + BPSTestConstants.NEW_CONF_DIR + File.separator +
	                                  BPSTestConstants.B4P_COORDINATION_CONFIG_XML);
	serverConfigurationManager.applyConfiguration(b4pConfigNew, b4pConfigOriginal, true, true);
}
 
Example 2
Source File: HumanTaskCoordinationTest.java    From product-ei with Apache License 2.0 6 votes vote down vote up
/**
 * Apply WS-Coordination enabled config files.
 * Copy humantask.xml and b4p-coordination-config.xml configuration files and restart server
 *
 * @throws Exception
 */
private void applyWSCoordinationConfig() throws Exception {
	final String artifactLocation =
			FrameworkPathUtil.getSystemResourceLocation() + BPSTestConstants.DIR_CONFIG + File.separator +
			HumanTaskTestConstants.DIR_WS_COORDINATION + File.separator;

	File humantaskConfigNew = new File(artifactLocation + BPSTestConstants.HUMANTASK_XML);
	File humantaskConfigOriginal = new File(
			FrameworkPathUtil.getCarbonHome() + File.separator + BPSTestConstants.NEW_CONF_DIR + File.separator + BPSTestConstants.HUMANTASK_XML);
	// Do not restart server. We need to apply another config file.
	serverConfigurationManager.applyConfiguration(humantaskConfigNew, humantaskConfigOriginal, true, false);

	File b4pConfigNew = new File(artifactLocation + BPSTestConstants.B4P_COORDINATION_CONFIG_XML);
	File b4pConfigOriginal = new File(FrameworkPathUtil.getCarbonHome() + File.separator + BPSTestConstants.NEW_CONF_DIR + File.separator +
	                                  BPSTestConstants.B4P_COORDINATION_CONFIG_XML);
	serverConfigurationManager.applyConfiguration(b4pConfigNew, b4pConfigOriginal, true, true);
}
 
Example 3
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 4
Source File: Sample650TestCase.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void uploadSynapseConfig() throws Exception {

    super.init();
    serverManager = new ServerConfigurationManager(context);

    File existingDir = new File(
            FrameworkPathUtil.getCarbonHome() + File.separator + "samples" + File.separator + "service-bus"
                    + File.separator + "synapse_sample_650.xml");

    File newDir = new File(
            FrameworkPathUtil.getCarbonHome() + File.separator + "samples" + File.separator + "service-bus"
                    + File.separator + "default");

    File targetDir = new File(
            FrameworkPathUtil.getCarbonHome() + File.separator + "samples" + File.separator + "service-bus"
                    + File.separator + "synapse_sample_650.xml" + File.separator + "default");

    FileUtils.moveDirectory(existingDir, newDir);

    FileUtils.moveDirectory(newDir, targetDir);

    carbonLogReader = new CarbonLogReader();
    carbonLogReader.start();
    serverManager.applyMIConfigurationWithRestart(new File(
            TestConfigurationProvider.getResourceLocation() + File.separator + "artifacts" + File.separator + "ESB"
                    + File.separator + "miscellaneous" + File.separator + "deployment.toml"));

    super.init();
}
 
Example 5
Source File: HumanTaskNotificationsTestCase.java    From product-ei with Apache License 2.0 5 votes vote down vote up
/**
 * Update content in humantask.xml/output-event-adapters.xml & restart server
 *
 * @throws Exception
 */
private void updateConfigFiles() throws Exception {
    final String artifactLocation = FrameworkPathUtil.getSystemResourceLocation()
            + HumanTaskTestConstants.DIR_ARTIFACTS + File.separator + HumanTaskTestConstants.DIR_CONFIG + File.separator
            + HumanTaskTestConstants.DIR_EMAIL + File.separator;
    //Adding new config file for humantask.xml
    File humantaskConfigNew = new File(artifactLocation + HumanTaskTestConstants.HUMANTASK_XML);
    File humantaskConfigOriginal = new File(FrameworkPathUtil.getCarbonHome() + File.separator + NEW_CONF_DIR + File.separator
            + HumanTaskTestConstants.HUMANTASK_XML);
    serverConfigurationManager.applyConfiguration(humantaskConfigNew, humantaskConfigOriginal, true, false);
    //Adding new config file for axis2_client.xml
    File outputEventAdapterConfigNew = new File(artifactLocation + HumanTaskTestConstants.OUTPUT_EVENT_ADAPTERS_XML);
    File outputEventAdapterConfigOriginal = new File(FrameworkPathUtil.getCarbonHome() + File.separator + NEW_CONF_DIR + File.separator  + HumanTaskTestConstants.OUTPUT_EVENT_ADAPTERS_XML);
    serverConfigurationManager.applyConfiguration(outputEventAdapterConfigNew, outputEventAdapterConfigOriginal, true, true);
}
 
Example 6
Source File: BPMNPackageDeploymentResolveTestCase.java    From product-ei with Apache License 2.0 5 votes vote down vote up
private void updateConfigFiles() throws Exception {
    final String artifactLocation =
            FrameworkPathUtil.getSystemResourceLocation() + BPMNTestConstants.DIR_ARTIFACTS + File.separator
                    + BPMNTestConstants.DIR_CONFIG + File.separator;
    //Adding new config file for activiti.xml
    File activitiConfigNew = new File(artifactLocation + BPMNTestConstants.ACTIVITI_CONFIGURATION_FILE_NAME);
    File activitiConfigOriginal = new File(
            FrameworkPathUtil.getCarbonHome() + File.separator + NEW_CONF_DIR + File.separator
                    + BPMNTestConstants.ACTIVITI_CONFIGURATION_FILE_NAME);
    serverConfigurationManager.applyConfiguration(activitiConfigNew, activitiConfigOriginal, true, true);
}
 
Example 7
Source File: BPMNUserSubstitutionTestCase.java    From product-ei with Apache License 2.0 5 votes vote down vote up
/**
 * Update content in activiti.xml & restart server
 *
 * @throws Exception
 */
private void updateConfigFiles() throws Exception {
    final String artifactLocation = FrameworkPathUtil.getSystemResourceLocation()
            + BPMNTestConstants.DIR_ARTIFACTS + File.separator + BPMNTestConstants.DIR_CONFIG + File.separator;
    //Adding new config file for activiti.xml
    File activitiConfigNew = new File(artifactLocation + BPMNTestConstants.ACTIVITI_CONFIGURATION_FILE_NAME);
    File activitiConfigOriginal = new File(FrameworkPathUtil.getCarbonHome() + File.separator + NEW_CONF_DIR + File.separator
            + BPMNTestConstants.ACTIVITI_CONFIGURATION_FILE_NAME);
    serverConfigurationManager.applyConfiguration(activitiConfigNew, activitiConfigOriginal, true, true);

}
 
Example 8
Source File: ESBJAVA4470StoreMediatorEmptyOMArraySerializeException.java    From product-ei with Apache License 2.0 5 votes vote down vote up
@AfterClass(alwaysRun = true)
public void destroy() throws Exception {
    String carlocation = FrameworkPathUtil.getCarbonHome()+"/repository/deployment/server/carbonapps/"+carFileName;
    File carFile = new File(carlocation);
    if(carFile.exists()){
        carFile.delete();
        log.info(carFileName + " car file deleted successfully");
    }
    super.cleanup();
}
 
Example 9
Source File: MobileQSGTestCase.java    From product-iots with Apache License 2.0 5 votes vote down vote up
@Test(description = "This test case tests the execution of QSG script, whether it executes without any exceptions")
public void executeQSGScript() throws IOException, InterruptedException {
    String scriptPath =
            FrameworkPathUtil.getCarbonHome() + File.separator + "samples" + File.separator + "mobile-qsg";
    File scriptFile = new File(scriptPath);
    String[] cmdArray = new String[] { "sh", "mobile-qsg.sh" };
    Runtime.getRuntime().exec(cmdArray, null, scriptFile);
    // Allow some time to finish its execution
    Thread.sleep(10000);
}
 
Example 10
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);

}
 
Example 11
Source File: Sample364TestCase.java    From product-ei with Apache License 2.0 3 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void initialize() throws Exception {

    super.init();

    NodeList nodeList =  context.getConfigurationNodeList("//datasource");

    mysqlConnection = createMySqlConnection(nodeList);
    addDB();

    datasourceOriginalPath = FrameworkPathUtil.getCarbonHome() + File.separator +
            "repository" + File.separator + "conf"
            + File.separator + "datasources" + File.separator + "master-datasources.xml";

    datasourceBkupPath = FrameworkPathUtil.getCarbonHome() + File.separator +
            "repository" + File.separator + "conf"
            + File.separator + "datasources" + File.separator + "master-datasources.xml_bk";

    serverManager = new ServerConfigurationManager(context);

    //copping dependency jms jar files to component/lib
    serverManager.copyToComponentLib(new File(FrameworkPathUtil.getSystemResourceLocation()
            + File.separator + "artifacts" + File.separator + "ESB" + File.separator + "jar" +
            File.separator + MYSQL_LIB));

    FileUtils.moveFile(new File(datasourceOriginalPath), new File(datasourceBkupPath));

    FileUtils.copyFile(new File(FrameworkPathUtil.getSystemResourceLocation()
            + File.separator + "artifacts" + File.separator + "ESB" + File.separator + "other" +
            File.separator + "master-datasources.xml"), new File(datasourceOriginalPath));

    serverManager.restartGracefully();

    super.init();

    loadSampleESBConfiguration(364);
}
 
Example 12
Source File: Sample650TestCase.java    From product-ei with Apache License 2.0 3 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void uploadSynapseConfig() throws Exception {

    super.init();
    serverManager = new ServerConfigurationManager(context);

    File existingDir = new File(FrameworkPathUtil.getCarbonHome() + File.separator + "samples" + File.separator +
                                "service-bus" + File.separator + "synapse_sample_650.xml");

    File newDir = new File( FrameworkPathUtil.getCarbonHome() + File.separator + "samples" + File.separator +
                            "service-bus" + File.separator + "default" );

    File targetDir = new File(FrameworkPathUtil.getCarbonHome() + File.separator + "samples" + File.separator +
                              "service-bus" + File.separator + "synapse_sample_650.xml" + File.separator +
                              "default");

    FileUtils.moveDirectory(existingDir, newDir);

    FileUtils.moveDirectory(newDir, targetDir);

    serverManager.applyConfiguration(new File(TestConfigurationProvider.getResourceLocation() + File.separator + "artifacts" + File.separator + "ESB"
            + File.separator + "miscellaneous" + File.separator + "axis2.xml"));

   // serverManager.restartGracefully();
    super.init();

    endPointAdminClient = new EndPointAdminClient(contextUrls.getBackEndUrl(), getSessionCookie());

    localEntriesAdminClient = new LocalEntriesAdminClient(contextUrls.getBackEndUrl(),
            getSessionCookie());

    sequenceAdminServiceClient = new SequenceAdminServiceClient(contextUrls.getBackEndUrl(),
            getSessionCookie());

    taskAdminClient = new TaskAdminClient(contextUrls.getBackEndUrl(),
            getSessionCookie());
}