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

The following examples show how to use org.wso2.carbon.automation.engine.frameworkutils.TestFrameworkUtils. 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: RegistryProviderUtil.java    From product-es with Apache License 2.0 6 votes vote down vote up
public Registry getGovernanceRegistry (Registry registry, AutomationContext automationContext)
        throws Exception {

    Registry governance = null;
    TestFrameworkUtils.setKeyStoreProperties(automationContext);
    System.setProperty("carbon.repo.write.mode", "true");
    try {
        governance =
                GovernanceUtils.getGovernanceUserRegistry(registry,
                automationContext.getContextTenant().getContextUser().getUserName());

    } catch (Exception e) {
        handleException("Failed to instantiate governance registry instance ", e);
    }
    return governance;
}
 
Example #2
Source File: RegistryProviderUtil.java    From product-es with Apache License 2.0 6 votes vote down vote up
public RemoteRegistry getRemoteRegistry (AutomationContext automationContext) throws Exception {

        RemoteRegistry registry = null;
        TestFrameworkUtils.setKeyStoreProperties(automationContext);
        System.setProperty("carbon.repo.write.mode", "true");
        try {
            registry = new RemoteRegistry(new URL(
                    UrlGenerationUtil.getRemoteRegistryURL(automationContext.getDefaultInstance())),
                    automationContext.getContextTenant().getContextUser().getUserName(),
                    automationContext.getContextTenant().getContextUser().getPassword());

        } catch (Exception e) {
            handleException("Failed to initialized remote registry instance ", e);
        }
        return registry;
    }
 
Example #3
Source File: CarbonServerManager.java    From product-ei with Apache License 2.0 5 votes vote down vote up
/**
 * This method will check the OS and edit server startup script to inject jacoco agent
 *
 * @throws IOException - If agent insertion fails.
 */
private void instrumentForCoverage() throws IOException, AutomationFrameworkException {
    String scriptName = TestFrameworkUtils.getStartupScriptFileName(carbonHome);

    if (System.getProperty("os.name").toLowerCase().contains("windows")) {
        insertJacocoAgentToBatScript(scriptName);
        if (log.isDebugEnabled()) {
            log.debug("Included files " + CodeCoverageUtils.getInclusionJarsPattern(":"));
            log.debug("Excluded files " + CodeCoverageUtils.getExclusionJarsPattern(":"));
        }
    } else {
        insertJacocoAgentToShellScript(scriptName);
    }

}
 
Example #4
Source File: CarbonServerManagerExtension.java    From product-iots with Apache License 2.0 5 votes vote down vote up
/**
 * This method will check the OS and edit server startup script to inject jacoco agent
 *
 * @throws IOException - If agent insertion fails.
 */
private void instrumentForCoverage() throws IOException, AutomationFrameworkException {
    String scriptName = TestFrameworkUtils.getStartupScriptFileName(this.carbonHome);
    if(System.getProperty("os.name").toLowerCase().contains("windows")) {
        this.insertJacocoAgentToBatScript(scriptName);
        if(log.isDebugEnabled()) {
            log.debug("Included files " + CodeCoverageUtils.getInclusionJarsPattern(":"));
            log.debug("Excluded files " + CodeCoverageUtils.getExclusionJarsPattern(":"));
        }
    } else {
        this.insertJacocoAgentToShellScript(scriptName);
    }

}
 
Example #5
Source File: StratosTestServerManager.java    From attic-stratos with Apache License 2.0 5 votes vote down vote up
private void instrumentForCoverage() throws IOException, AutomationFrameworkException {
    String scriptName = TestFrameworkUtils.getStartupScriptFileName(this.carbonHome);
    if (System.getProperty("os.name").toLowerCase().contains("windows")) {
        this.insertJacocoAgentToBatScript(scriptName);
        if (log.isDebugEnabled()) {
            log.debug("Included files " + CodeCoverageUtils.getInclusionJarsPattern(":"));
            log.debug("Excluded files " + CodeCoverageUtils.getExclusionJarsPattern(":"));
        }
    } else {
        this.insertJacocoAgentToShellScript(scriptName);
    }

}
 
Example #6
Source File: RegistryProviderUtil.java    From product-es with Apache License 2.0 5 votes vote down vote up
public WSRegistryServiceClient getWSRegistry (AutomationContext automationContext)
        throws Exception {

    System.setProperty("carbon.repo.write.mode", "true");
    WSRegistryServiceClient registry = null;
    ConfigurationContext configContext;
    String axis2Repo = FrameworkPathUtil.getSystemResourceLocation() + File.separator + "client";
    String axis2Conf = FrameworkPathUtil.getSystemResourceLocation() + "axis2config" +
            File.separator + "axis2_client.xml";
    TestFrameworkUtils.setKeyStoreProperties(automationContext);
    try {
        configContext = ConfigurationContextFactory.
                createConfigurationContextFromFileSystem(axis2Repo, axis2Conf);

        configContext.setProperty(HTTPConstants.CONNECTION_TIMEOUT, TIME_OUT_VALUE);

        log.info("Group ConfigurationContext Timeout " +
                configContext.getServiceGroupContextTimeoutInterval());

        registry = new WSRegistryServiceClient(
                automationContext.getContextUrls().getBackEndUrl(),
                automationContext.getContextTenant().getContextUser().getUserName(),
                automationContext.getContextTenant().getContextUser().getPassword(), configContext);

        log.info("WS Registry Created - Login Successful");

    } catch (Exception e) {
        handleException("Failed instantiate WSRegistry client instance ", e);
    }
    return registry;
}