org.wso2.carbon.automation.engine.frameworkutils.FrameworkPathUtil Java Examples

The following examples show how to use org.wso2.carbon.automation.engine.frameworkutils.FrameworkPathUtil. 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: ServerUtils.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
static void copyResources(String product, String destCarbonHome, String clusterDepDir, String clusterRegDir)
        throws IOException {

    String carbonHome =
            FrameworkPathUtil.getSystemResourceLocation() + File.separator + "artifacts" + File.separator + product
                    + File.separator + "server";
    copyFolders(new File(carbonHome + File.separator + "conf"), new File(destCarbonHome + File.separator + "conf"));
    copyFolders(new File(carbonHome + File.separator + "lib"), new File(destCarbonHome + File.separator + "lib"));

    File destinationDeploymentDirectory = new File(
            String.join(File.separator, destCarbonHome, "repository", "deployment"));
    if (clusterDepDir == null) {
        copyFolders(new File(String.join(File.separator, carbonHome, "repository", "deployment")),
                    destinationDeploymentDirectory);
    } else {
        createSymlink(new File(clusterDepDir), destinationDeploymentDirectory);
    }

    File regDest = new File(destCarbonHome + File.separator + "registry");
    if (clusterRegDir == null) {
        copyFolders(new File(carbonHome + File.separator + "registry"), regDest);
    } else {
        createSymlink(new File(clusterRegDir), regDest);
    }

}
 
Example #2
Source File: NhttpMaximumOpenConnections.java    From product-ei with Apache License 2.0 6 votes vote down vote up
@BeforeClass(alwaysRun = true)
   public void init() throws Exception {
       super.init();

serverConfigurationManagerProp = new ServerConfigurationManager(new AutomationContext("ESB", TestUserMode.SUPER_TENANT_ADMIN));
       String nhttpFile = /*ProductConstant.getResourceLocations(ProductConstant.ESB_SERVER_NAME)*/FrameworkPathUtil.getSystemResourceLocation()  + "artifacts" + separator +
               "ESB" +separator + "synapseconfig" + separator + "MaxOpenConnections" + separator
               + "nhttp.properties";
       File srcFile = new File(nhttpFile);


       serverConfigurationManagerProp.applyConfigurationWithoutRestart(srcFile);

       serverConfigurationManagerAxis2 = new ServerConfigurationManager(new AutomationContext("ESB", TestUserMode.SUPER_TENANT_ADMIN));
       String nhttpAxis2xml = /*ProductConstant.getResourceLocations(ProductConstant.ESB_SERVER_NAME)*/FrameworkPathUtil.getSystemResourceLocation()  + "artifacts" + separator +
               "ESB" +separator +separator + "synapseconfig" + separator + "MaxOpenConnections" + separator + "nhttp"
               + separator + "axis2.xml";
       File axis2File = new File(nhttpAxis2xml);
       serverConfigurationManagerAxis2.applyConfiguration(axis2File);

       super.init();

       list = Collections.synchronizedList(new ArrayList());
       maxOpenConnectionClients = new MaximumOpenConnectionsClient[CONCURRENT_CLIENTS];
       clients = new Thread[CONCURRENT_CLIENTS];
   }
 
Example #3
Source File: WildCardSearch.java    From product-es with Apache License 2.0 6 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void init() throws Exception {
    super.init(userMode);
    genericRestClient = new GenericRestClient();
    queryParamMap = new HashMap<>();
    headerMap = new HashMap<>();
    resourcePath =
            FrameworkPathUtil.getSystemResourceLocation() + "artifacts" + File.separator + "GREG" + File.separator;
    publisherUrl = publisherContext.getContextUrls().getSecureServiceUrl().replace("services", "publisher/apis");
    storeUrl = storeContext.getContextUrls().getSecureServiceUrl().replace("services", "store/apis");
    resourceAdminServiceClient = new ResourceAdminServiceClient(automationContext.getContextUrls().getBackEndUrl(),
            sessionCookie);

    deteleExistingData();

}
 
Example #4
Source File: StreamingXpathExceptionTestCase.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void setEnvironment() throws Exception {
    super.init();
    serverManager = new ServerConfigurationManager(new AutomationContext("ESB", TestUserMode.SUPER_TENANT_ADMIN));
    File sourceFile = new File(
            FrameworkPathUtil.getSystemResourceLocation() + "artifacts" + File.separator + "ESB" + File.separator
                    + "streamingxpath" + File.separator + "synapse.properties");
    serverManager.applyConfiguration(sourceFile);
    super.init();
    String relativePath = "artifacts" + File.separator + "ESB" + File.separator + "streamingxpath" + File.separator
            + "StreamingException.xml";
    ESBTestCaseUtils util = new ESBTestCaseUtils();
    OMElement proxyConfig = util.loadResource(relativePath);

    try {
        addProxyService(proxyConfig);
    } catch (Exception ignore) {
        exceptionCaught = true;
    }

}
 
Example #5
Source File: Sample153TestCase.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
@Test(groups = "wso2.esb", description = "Custom sequences and endpoints with proxy services")
public void sample153Test() throws Exception {
    String policyPath = FrameworkPathUtil.getSystemResourceLocation() + "security" + File.separator + "policies"
            + File.separator + "scenario27-policy.xml";
    OMElement response = new SecureStockQuoteClient()
            .sendSecuredSimpleStockQuoteRequest(null, null, getProxyServiceURLHttp("StockQuoteProxy"), policyPath,
                    "Secured");

    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, "Secured", "Fault: value 'symbol' mismatched");

}
 
Example #6
Source File: RestResourceLifeCycleManagementTestCase.java    From product-es with Apache License 2.0 6 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void init() throws Exception {
    super.init(userMode);
    genericRestClient = new GenericRestClient();
    publisherUrl = automationContext.getContextUrls()
            .getSecureServiceUrl().replace("services", "publisher/apis");
    manageGenericArtifactAdminServiceClient =
            new ManageGenericArtifactAdminServiceClient(backendURL, sessionCookie);
    lifeCycleAdminServiceClient = new LifeCycleManagementClient(backendURL, sessionCookie);
    resourceAdminServiceClient = new ResourceAdminServiceClient(backendURL, sessionCookie);
    serverConfigurationManager = new ServerConfigurationManager(automationContext);
    resourcePath = FrameworkPathUtil.getSystemResourceLocation()
                   + "artifacts" + File.separator + "GREG" + File.separator;
    resourceRegistryPath = "/_system/governance/repository/components" +
                           "/org.wso2.carbon.governance/types/updated-serviceLC.rxt";
    lifeCycleName = "ServiceLifeCycleLC2";
    restServiceResourcePath = "/_system/governance/trunk/restservices/1.0.0/testservice1234";
}
 
Example #7
Source File: LifecycleUtil.java    From product-es with Apache License 2.0 6 votes vote down vote up
/**
 * add a life cycle to a collection or resource
 *
 * @param path path of the collection or resource to be subscribed
 * @return true if the life cycle is added to the resource or collection,
 *         false otherwise
 * @throws Exception
 */
private boolean addLifeCycle(String path) throws Exception {
    LifeCycleManagementClient lifeCycleManagementClient =
            new LifeCycleManagementClient(
                    backEndUrl, sessionCookie);
    String filePath =
            FrameworkPathUtil.getSystemResourceLocation() + "artifacts" +

            File.separator + "es" + File.separator + "lifecycle" +
            File.separator + "StateDemoteLifeCycle.xml";
    String lifeCycleConfiguration = FileManager.readFile(filePath);
    // add life cycle
    lifeCycleManagementClient.addLifeCycle(lifeCycleConfiguration);
    wsRegistryServiceClient.associateAspect(path, ASPECT_NAME);
    return (lifeCycleAdminServiceClient.getLifecycleBean(path) != null);
}
 
Example #8
Source File: InvalidBPMNPackageDeploymentTestCase.java    From product-ei with Apache License 2.0 6 votes vote down vote up
/**
 * The BPMN package being used to test is Invalid, it is used to test how gracefully
 * the system handles the invalid bpmn package,
 *
 * @throws Exception
 */
@Test(groups = {"wso2.bps.test.deploy.invalidPackage"}, description = "Deploy/UnDeploy " +
                                                                      "Invalid Package Test",
      priority = 1, singleThreaded = true)
public void deployUnDeployInvalidBPMNPackage() throws Exception {
    init();
    ActivitiRestClient tester = new ActivitiRestClient(bpsServer.getInstance().getPorts().get
            (BPMNTestConstants.HTTP), bpsServer.getInstance().getHosts().get
            (BPMNTestConstants.DEFAULT));
    String filePath = FrameworkPathUtil.getSystemResourceLocation() + File.separator
                      + BPMNTestConstants.DIR_ARTIFACTS + File.separator
                      + BPMNTestConstants.DIR_BPMN + File.separator + "InvalidHelloApprove.bar";
    String fileName = "InvalidHelloApprove.bar";

    //trying to deploy an invalid bpmn package will cause the server to throw an "error parsing
    //XML" we are using the this message to validate.
    try {
        String[] deploymentResponse;
        deploymentResponse = tester.deployBPMNPackage(filePath, fileName);
        Assert.fail("Invalid package was deployed.");
    } catch (RestClientException | IOException | JSONException exception) {
        Assert.assertTrue("Could not upload the invalid bpmn package",
                          "Error parsing XML".equals(exception.getMessage()));
    }
}
 
Example #9
Source File: HttpAccessLogTestCase.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void init() throws Exception {

    super.init();
    serverConfigurationManager = new ServerConfigurationManager(
            new AutomationContext("ESB", TestUserMode.SUPER_TENANT_ADMIN));
    String accessLogFile =
            FrameworkPathUtil.getSystemResourceLocation() + "artifacts" + separator + "ESB" + separator + "passthru"
                    + separator + "transport" + separator + "httpaccesslogs" + separator + "access-log.properties";

    File srcFile = new File(accessLogFile);
    String carbonHome = System.getProperty(ServerConstants.CARBON_HOME);
    httpLogDir = carbonHome + File.separator + "repository" + File.separator + "logs" + File.separator + "httpLogs";
    File log4jProperties = new File(carbonHome + File.separator + "conf" + File.separator + "log4j2.properties");
    String propertyName = "nhttp.log.directory";
    CarbonServerExtension.shutdownServer();
    createNewDir(httpLogDir);
    applyProperty(srcFile, propertyName, httpLogDir);
    String loggers = getProperty(log4jProperties, "loggers");
    applyLog4j2Properties(loggers, log4jProperties);
    CarbonServerExtension.startServer();
    super.init();
}
 
Example #10
Source File: JavaServiceTaskDeploymentUndeploymentTestCase.java    From product-ei with Apache License 2.0 6 votes vote down vote up
@BeforeClass
public void envSetup() throws Exception {
    init();
    final String artifactLocation = FrameworkPathUtil.getSystemResourceLocation() + File
            .separator
                                    + BPMNTestConstants.DIR_ARTIFACTS + File.separator
                                    + BPMNTestConstants.DIR_BPMN + File.separator
                                    + "testArtifactid-1.0.jar";

    ServerConfigurationManager Loader = new ServerConfigurationManager(bpsServer);
    File javaArtifact = new File(artifactLocation);
    Loader.copyToComponentLib(javaArtifact);
    Loader.restartForcefully();

    //reinitialising, as session cookies and other configuration which expired during restart is
    // needs to be reset
    init();
}
 
Example #11
Source File: PropertyIntegrationForceSCAcceptedPropertyTestCase.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
@Test(groups = "wso2.esb", description = "Testing functionality of FORCE_SC_ACCEPTED " + "Enabled True  - "
        + "Client should receive 202 message", dependsOnMethods = "testFORCE_SC_ACCEPTEDPropertyEnabledFalseScenario")
public void testWithFORCE_SC_ACCEPTEDPropertyEnabledTrueScenario() throws Exception {
    int responseStatus = 0;

    String strXMLFilename =
            FrameworkPathUtil.getSystemResourceLocation() + "artifacts" + File.separator + "ESB" + File.separator
                    + "mediatorconfig" + File.separator + "property" + File.separator + "PlaceOrder.xml";

    File input = new File(strXMLFilename);
    PostMethod post = new PostMethod(getProxyServiceURLHttp("FORCE_SC_ACCEPTED_TrueTestProxy"));
    RequestEntity entity = new FileRequestEntity(input, "text/xml");
    post.setRequestEntity(entity);
    post.setRequestHeader("SOAPAction", "placeOrder");

    HttpClient httpclient = new HttpClient();

    try {
        responseStatus = httpclient.executeMethod(post);
    } finally {
        post.releaseConnection();
    }

    assertEquals(responseStatus, 202, "Response status should be 202");
}
 
Example #12
Source File: PropertyIntegrationHTTP_SCTestCase.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
@Test(groups = "wso2.esb", description = "Getting HTTP status code number ")
public void testHttpResponseCode() throws Exception {

    int responseStatus = 0;

    String strXMLFilename =
            FrameworkPathUtil.getSystemResourceLocation() + "artifacts" + File.separator + "ESB" + File.separator
                    + "mediatorconfig" + File.separator + "property" + File.separator + "GetQuoteRequest.xml";

    File input = new File(strXMLFilename);
    PostMethod post = new PostMethod(getProxyServiceURLHttp("HTTP_SCTestProxy"));
    RequestEntity entity = new FileRequestEntity(input, "text/xml");
    post.setRequestEntity(entity);
    post.setRequestHeader("SOAPAction", "getQuote");

    HttpClient httpclient = new HttpClient();

    try {
        responseStatus = httpclient.executeMethod(post);
    } finally {
        post.releaseConnection();
    }

    assertEquals(responseStatus, 404, "Response status should be 404");
}
 
Example #13
Source File: StreamingXpathExceptionTestCase.java    From product-ei with Apache License 2.0 6 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void setEnvironment() throws Exception {
    super.init();
    serverManager = new ServerConfigurationManager(new AutomationContext("ESB", TestUserMode.SUPER_TENANT_ADMIN));
    File sourceFile = new File(FrameworkPathUtil.getSystemResourceLocation() + "artifacts" + File.separator +
            "ESB" + File.separator + "streamingxpath" + File.separator + "synapse.properties");
    serverManager.applyConfiguration(sourceFile);
    super.init();
    String relativePath = "artifacts" + File.separator + "ESB" + File.separator + "streamingxpath" +
            File.separator + "StreamingException.xml";
    ESBTestCaseUtils util = new ESBTestCaseUtils();
    OMElement proxyConfig = util.loadResource(relativePath);

    try {
        addProxyService(proxyConfig);
    } catch (Exception ignore) {
       exceptionCaught=true;
    }

}
 
Example #14
Source File: ValidPathAxis2XmlTestCase.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void setEnvironment() throws Exception {

    super.init();
    String axis2XmlPath = FrameworkPathUtil.getSystemResourceLocation()
            + "/artifacts/ESB/mediatorconfig/callout/client_repo/conf/axis2.xml";
    String uriSynapse = FrameworkPathUtil.getSystemResourceLocation()
            + "/artifacts/ESB/mediatorconfig/callout/ValidPath_Axis2Xml.xml";

    OMElement lineItem = AXIOMUtil.stringToOM(FileManager.readFile(uriSynapse));
    AXIOMXPath xPath = new AXIOMXPath("//ns:configuration");
    xPath.addNamespace("ns", "http://ws.apache.org/ns/synapse");
    OMElement configuration = (OMElement) xPath.selectSingleNode(lineItem);
    //replacing the path
    configuration.getAttribute(new QName("axis2xml")).setAttributeValue(axis2XmlPath);
    updateESBConfiguration(lineItem);

}
 
Example #15
Source File: BPMNCappDeploymentTestCase.java    From product-ei with Apache License 2.0 6 votes vote down vote up
/**
 * Deploy the uploaded C-App file
 */

@BeforeClass(alwaysRun = true)
public void deployTask() throws Exception {
    super.init();
    CarbonAppUploaderClient carbonAppUploaderClient =
            new CarbonAppUploaderClient(backEndUrl, sessionCookie);

    carbonAppUploaderClient.uploadCarbonAppArtifact(carFileName + BPMNTestConstants.CAR_EXTENSION
            , new DataHandler(new URL("file:" + File.separator + File.separator +
            FrameworkPathUtil.getSystemResourceLocation() + "artifacts"
            + File.separator + "bpmn" + File.separator + carFileName + BPMNTestConstants.CAR_EXTENSION)));
    isCarFileUploaded = true;
    applicationAdminClient = new ApplicationAdminClient(backEndUrl, sessionCookie);
    boolean result = isCarFileDeployed(carFileName);
    Assert.assertTrue(result, "Car file deployment failed");
}
 
Example #16
Source File: PropertyIntegrationHTTP_SCTestCase.java    From product-ei with Apache License 2.0 6 votes vote down vote up
@Test(groups = "wso2.esb", description = "Getting HTTP status code number ")
public void testHttpResponseCode() throws Exception {

    int responseStatus = 0;

    String strXMLFilename = FrameworkPathUtil.getSystemResourceLocation() + "artifacts"
                            + File.separator + "ESB" + File.separator + "mediatorconfig" +
                            File.separator + "property" + File.separator + "GetQuoteRequest.xml";

    File input = new File(strXMLFilename);
    PostMethod post = new PostMethod(getProxyServiceURLHttp("HTTP_SCTestProxy"));
    RequestEntity entity = new FileRequestEntity(input, "text/xml");
    post.setRequestEntity(entity);
    post.setRequestHeader("SOAPAction", "getQuote");

    HttpClient httpclient = new HttpClient();

    try {
        responseStatus = httpclient.executeMethod(post);
    } finally {
        post.releaseConnection();
    }

    assertEquals(responseStatus, 404, "Response status should be 404");
}
 
Example #17
Source File: CarbonServerManager.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
/**
 * This methods will insert jacoco agent settings into startup script under JAVA_OPTS
 *
 * @param scriptName - Name of the startup script
 * @throws IOException - throws if shell script edit fails
 */
private void insertJacocoAgentToShellScript(String scriptName) throws IOException {

    String jacocoAgentFile = CodeCoverageUtils.getJacocoAgentJarLocation();
    coverageDumpFilePath = FrameworkPathUtil.getCoverageDumpFilePath();

    File inFile = Paths.get(carbonHome, "bin", scriptName + ".sh").toFile();
    File tmpFile = Paths.get(carbonHome, "tmp" + scriptName + ".sh").toFile();
    String lineToBeChecked = "-Dwso2.server.standalone=true";
    String lineToBeInserted =
            "-javaagent:" + jacocoAgentFile + "=destfile=" + coverageDumpFilePath + "" + ",append=true,includes="
                    + CodeCoverageUtils.getInclusionJarsPattern(":") + ",excludes=" + CodeCoverageUtils
                    .getExclusionJarsPattern(":") + " \\";

    CodeCoverageUtils.insertStringToFile(inFile, tmpFile, lineToBeChecked, lineToBeInserted);
}
 
Example #18
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 #19
Source File: ValidPathAxis2XmlTestCase.java    From product-ei with Apache License 2.0 6 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void setEnvironment() throws Exception {

    super.init();
    String axis2XmlPath = FrameworkPathUtil.getSystemResourceLocation()
            + "/artifacts/ESB/mediatorconfig/callout/client_repo/conf/axis2.xml";
    String uriSynapse = FrameworkPathUtil.getSystemResourceLocation()
            + "/artifacts/ESB/mediatorconfig/callout/ValidPath_Axis2Xml.xml";

    OMElement lineItem = AXIOMUtil.stringToOM(FileManager.readFile(uriSynapse));
    AXIOMXPath xPath = new AXIOMXPath("//ns:configuration");
    xPath.addNamespace("ns", "http://ws.apache.org/ns/synapse");
    OMElement configuration = (OMElement) xPath.selectSingleNode(lineItem);
    //replacing the path
    configuration.getAttribute(new QName("axis2xml")).setAttributeValue(axis2XmlPath);
    updateESBConfiguration(lineItem);

}
 
Example #20
Source File: TestServerManager.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
private void configureServer(String deploymentDirectory, String registryDir) throws IOException {

        if ("ESB".equalsIgnoreCase(System.getProperty("server.list"))) {
            //copying the files before server start. Ex: synapse artifacts, conf, etc...
            ServerUtils.copyResources("ESB", this.getCarbonHome(), deploymentDirectory, registryDir);
            String resourceHome =
                    FrameworkPathUtil.getSystemResourceLocation() + File.separator + "artifacts" + File.separator
                            + "ESB" + File.separator + "server";
            File dropinsDirectorySource = new File(resourceHome + File.separator + "dropins");
            File dropinsDestination = new File(this.getCarbonHome() + File.separator + "dropins");
            if (dropinsDirectorySource.exists() && dropinsDirectorySource.isDirectory()) {
                try {
                    log.info("Copying " + dropinsDirectorySource.getPath() + " to " + dropinsDestination.getPath());
                    FileUtils.copyDirectory(dropinsDirectorySource, dropinsDestination);
                } catch (IOException e) {
                    log.error("Error while copying lib directory.", e);
                }
            }
        } else if ("DSS".equalsIgnoreCase(System.getProperty("server.list"))) {
            ServerUtils.copyResources("DSS", this.getCarbonHome(), deploymentDirectory, registryDir);
        }
    }
 
Example #21
Source File: MBIntegrationUiBaseTest.java    From product-ei with Apache License 2.0 5 votes vote down vote up
/**
 * Restart the server with admin role name set to "administrator" instead of default value admin.
 *
 * @throws IOException
 * @throws AutomationUtilException
 * @throws XPathExpressionException
 */
protected void restartServerWithDifferentAdminRoleName() throws IOException, AutomationUtilException,
        XPathExpressionException {
    serverManager = new ServerConfigurationManager(mbServer);

    // Replace the user-mgt.xml with the new configuration and restarts the server.
    serverManager.applyConfiguration(new File(FrameworkPathUtil.getSystemResourceLocation() + File.separator +
            "artifacts" + File.separator + "mb" + File.separator + "config" + File.separator
            + "user-mgt-admin-role-name.xml"), new File(ServerConfigurationManager.getCarbonHome() +
            File.separator + "wso2" + File.separator + "broker" + File.separator + "conf" + File.separator +
            "user-mgt.xml"), true, true);
}
 
Example #22
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 #23
Source File: TcpClient.java    From product-ei with Apache License 2.0 5 votes vote down vote up
public TcpClient() {
    String repositoryPath = /*ProductConstant.getModuleClientPath()*/FrameworkPathUtil.getSystemResourceLocation()+File.separator+"client";


    File repository = new File(repositoryPath);
    try {
        cfgCtx =
                ConfigurationContextFactory.createConfigurationContextFromFileSystem(repository.getCanonicalPath(),
                                                                                     /*ProductConstant.getResourceLocations(ProductConstant.ESB_SERVER_NAME)*/FrameworkPathUtil.getSystemResourceLocation()+File.separator + "artifacts"+File.separator + "ESB"
                                                                                     + File.separator + "tcp" + File.separator + "transport" + File.separator + "client_axis2.xml");
        serviceClient = new ServiceClient(cfgCtx, null);
    } catch (Exception e) {
        log.error(e);
    }
}
 
Example #24
Source File: RestResourceSearchAndAdvanceSearchTestCase.java    From product-es with Apache License 2.0 5 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void init() throws Exception {
    super.init(userMode);
    genericRestClient = new GenericRestClient();
    queryParamMap = new HashMap<>();
    headerMap = new HashMap<>();
    resourcePath =
            FrameworkPathUtil.getSystemResourceLocation() + "artifacts" + File.separator + "GREG" + File.separator;
    publisherUrl = publisherContext.getContextUrls().getSecureServiceUrl().replace("services", "publisher/apis");
    crudTestCommonUtils = new ESTestCommonUtils(genericRestClient, publisherUrl, headerMap);
    resourceAdminServiceClient = new ResourceAdminServiceClient(automationContext.getContextUrls().getBackEndUrl(),
            sessionCookie);

    deteleExistingData();
}
 
Example #25
Source File: HumanTaskPeopleAssignment.java    From product-ei with Apache License 2.0 5 votes vote down vote up
/**
 * deployArtifact() test1 sample Generic Human Roles.
 * potentialOwners - htd:getInput("ClaimApprovalRequest")/test10:cust/test10:owners
 * businessAdministrators - htd:union(htd:getInput("ClaimApprovalRequest")/test10:cust/test10:globleAdmins,htd:getInput("ClaimApprovalRequest")/test10:cust/test10:regionalAdmins)
 * excludedOwners - htd:getInput("ClaimApprovalRequest")/test10:cust/test10:excludedOwners
 */
public void deployArtifact() throws Exception {
	final String artifactLocation = FrameworkPathUtil.getSystemResourceLocation() + BPSTestConstants.DIR_ARTIFACTS
			+ File.separator + BPSTestConstants.DIR_HUMAN_TASK + File.separator + HumanTaskTestConstants.DIR_PEOPLE_ASSIGNMENT
			+ File.separator + "test1";
	uploadHumanTaskForTest(HumanTaskTestConstants.CLAIMS_APPROVAL_PACKAGE_ORG_ENTITY_NAME, artifactLocation);
}
 
Example #26
Source File: StreamingXpathTestCase.java    From product-ei with Apache License 2.0 5 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void setEnvironment() throws Exception {
    super.init();
    serverManager = new ServerConfigurationManager(new AutomationContext("ESB", TestUserMode.SUPER_TENANT_ADMIN));
    File sourceFile = new File(FrameworkPathUtil.getSystemResourceLocation() + "artifacts" + File.separator +
            "ESB" + File.separator + "streamingxpath" + File.separator + "synapse.properties");
    serverManager.applyConfiguration(sourceFile);
    super.init();
    String relativePath = "artifacts" + File.separator + "ESB" + File.separator + "streamingxpath" +
            File.separator + "Streaming.xml";
    ESBTestCaseUtils util = new ESBTestCaseUtils();
    OMElement proxyConfig = util.loadResource(relativePath);
    addProxyService(proxyConfig);

}
 
Example #27
Source File: HumanTaskCoordinationTest.java    From product-ei with Apache License 2.0 5 votes vote down vote up
/**
 * Deploy ClaimsApprovalProcess.zip BPEL process and ClaimsApprovalTask.zip HumanTask artifacts.
 *
 * @throws Exception
 */
public void deployArtifact() throws Exception {

	final String artifactLocation =
			FrameworkPathUtil.getSystemResourceLocation() + BPSTestConstants.DIR_ARTIFACTS + File.separator +
			BPSTestConstants.DIR_HUMAN_TASK + File.separator + BPSTestConstants.DIR_SCENARIOS + File.separator +
			BPSTestConstants.DIR_HT_COORDINATION;
	uploadBpelForTest(BPSTestConstants.CLAIMS_APPROVAL_PROCESS, artifactLocation);
	uploadHumanTaskForTest(BPSTestConstants.CLAIMS_APPROVAL_TASK, artifactLocation);
}
 
Example #28
Source File: PttMaximumOpenConnections.java    From product-ei with Apache License 2.0 5 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void init() throws Exception {
    super.init();

    serverConfigurationManagerProp = new ServerConfigurationManager(new AutomationContext("ESB", TestUserMode.SUPER_TENANT_ADMIN));
    String pttFile = /*ProductConstant.getResourceLocations(ProductConstant.ESB_SERVER_NAME)*/FrameworkPathUtil.getSystemResourceLocation()  + "artifacts" + separator +
            "ESB" +separator + "synapseconfig" + separator + "MaxOpenConnections" + separator
                     + "passthru-http.properties";
    File propFile = new File(pttFile);
    serverConfigurationManagerProp.applyConfiguration(propFile);

    super.init();
    maxOpenConnectionClients = new MaximumOpenConnectionsClient[CONCURRENT_CLIENTS];
    clients = new Thread[CONCURRENT_CLIENTS];
}
 
Example #29
Source File: HumanTaskPeopleAssignment.java    From product-ei with Apache License 2.0 5 votes vote down vote up
/**
 * deployArtifact() test3 artifact. Sample Generic Human Roles.
 * potentialOwners - htd:getInput("ClaimApprovalRequest")/test10:cust/test10:owners
 * businessAdministrators - htd:intersect(htd:getInput("ClaimApprovalRequest")/test10:cust/test10:globleAdmins,htd:getInput("ClaimApprovalRequest")/test10:cust/test10:regionalAdmins)
 * excludedOwners - htd:getInput("ClaimApprovalRequest")/test10:cust/test10:excludedOwners
 */
@Test(groups = { "wso2.bps.task.xpath" }, description = "Deploy and Create Except HumanTask", priority = 30,
		singleThreaded = true)
public void deployAndCreateIntersectHumanTask() throws Exception {

	final String artifactLocation =
			FrameworkPathUtil.getSystemResourceLocation() + BPSTestConstants.DIR_ARTIFACTS + File.separator +
					BPSTestConstants.DIR_HUMAN_TASK + File.separator + HumanTaskTestConstants.DIR_PEOPLE_ASSIGNMENT +
					File.separator + "test3";
	uploadHumanTaskForTest(HumanTaskTestConstants.CLAIMS_APPROVAL_PACKAGE_ORG_ENTITY_NAME, artifactLocation);
	Thread.sleep(30000); // Wait for new version of task deploy.
	createTask(); // create task
	TSimpleQueryInput queryInput = new TSimpleQueryInput();
	queryInput.setPageNumber(0);
	queryInput.setSimpleQueryCategory(TSimpleQueryCategory.ALL_TASKS);

	//Login As Clerk1 user
	TTaskSimpleQueryResultSet taskResults = clerk1Client.simpleQuery(queryInput);
	TTaskSimpleQueryResultRow[] rows = taskResults.getRow();
	TTaskSimpleQueryResultRow b4pTask = null;
	Assert.assertNotNull(rows, "No tasks found. Task creation has failed. ");
	// looking for the latest task
	for (TTaskSimpleQueryResultRow row : rows) {
		if (b4pTask == null) {
			b4pTask = row;
		} else {
			if (Long.parseLong(b4pTask.getId().toString()) < Long.parseLong(row.getId().toString())) {
				b4pTask = row;
			}
		}
	}

	// Validating Task
	Assert.assertNotNull(b4pTask, "Task creation has failed");
	Assert.assertNotEquals(b4pTask.getId().toString(), this.taskID.toString(), "Task creation failed.");
	this.taskID = b4pTask.getId();
}
 
Example #30
Source File: HttpEventPublisherClient.java    From product-cep with Apache License 2.0 5 votes vote down vote up
/**
 * File path will be created for the file to be read with respect to the artifact folder and file name
 *
 * @param testCaseFolderName     Artifact folder name
 * @param dataFileName           Text file to be read
 */
public static String getTestDataFileLocation(String testCaseFolderName, String dataFileName) throws Exception {
	String relativeFilePath = FrameworkPathUtil.getSystemResourceLocation() + CEPIntegrationTestConstants
			.RELATIVE_PATH_TO_TEST_ARTIFACTS + testCaseFolderName + File.separator+ dataFileName;
	relativeFilePath = relativeFilePath.replaceAll("[\\\\/]", Matcher.quoteReplacement(File.separator));
	return relativeFilePath;
}