org.testng.annotations.AfterTest#org.wso2.carbon.automation.engine.context.AutomationContext源码实例Demo

下面列出了org.testng.annotations.AfterTest#org.wso2.carbon.automation.engine.context.AutomationContext 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

/**
 * Subscribe for management console notifications and receive the
 * notification
 *
 * @param path      path of the resource or collection
 * @param eventType event type to be subscribed
 * @param env       ManageEnvironment
 * @param userInf   UserInfo
 * @return true if the subscription is succeeded and notification is
 *         received, false otherwise
 * @throws Exception
 */
public static boolean init(String path, String eventType, AutomationContext autoContext)
        throws Exception {

    automationContext = autoContext;
    backEndUrl = automationContext.getContextUrls().getBackEndUrl();
    LoginLogoutClient loginLogoutClient = new LoginLogoutClient(automationContext);
    sessionCookie = loginLogoutClient.login();
    userName = automationContext.getContextTenant().getContextUser().getUserName();

    if (userName.contains("@"))
        userNameWithoutDomain = userName.substring(0, userName.indexOf('@'));
    else
        userNameWithoutDomain = userName;

    boolean result = (addRole() && consoleSubscribe(path, eventType) && update(path) && getNotification(path));
    clean(path);
    return result;
}
 
源代码2 项目: product-ei   文件: MBPlatformBaseTest.java
/**
 * Create automation context objects for every node in config
 *
 * @param userMode User mode for which the automation context should use
 * @throws XPathExpressionException
 */
protected void initCluster(TestUserMode userMode) throws XPathExpressionException {
    contextMap = new HashMap<String, AutomationContext>();
    AutomationContext automationContext = new AutomationContext("MB_Cluster", userMode);
    log.info("Cluster instance loading");
    Map<String, Instance> instanceMap = automationContext.getProductGroup().getInstanceMap();

    if (instanceMap != null && instanceMap.size() > 0) {
        for (Map.Entry<String, Instance> entry : instanceMap.entrySet()) {
            String instanceKey = entry.getKey();
            contextMap.put(instanceKey, new AutomationContext("MB_Cluster", instanceKey, userMode));
            log.info(instanceKey);
        }
    }

    stack = new Stack<String>();

}
 
@BeforeClass(alwaysRun = true)
public void setEnvironment() throws Exception {
    super.init();
    serverConfigurationManager =
            new ServerConfigurationManager(new AutomationContext("ESB", TestUserMode.SUPER_TENANT_ADMIN));
    serverConfigurationManager.applyConfigurationWithoutRestart(new File(FULL_RESOURCE_PATH + "axis2.xml"));
    serverConfigurationManager.copyToComponentLib
            (new File(getClass().getResource(JAR_LOCATION + File.separator + HAWTBUF).toURI()));
    serverConfigurationManager.copyToComponentLib
            (new File(getClass().getResource(JAR_LOCATION + File.separator + ACTIVEMQ_BROKER).toURI()));
    serverConfigurationManager.copyToComponentLib
            (new File(getClass().getResource(JAR_LOCATION + File.separator + ACTIVEMQ_CLIENT).toURI()));
    serverConfigurationManager.copyToComponentLib
            (new File(getClass().getResource(JAR_LOCATION + File.separator + GERONIMO_J2EE_MANAGEMENT).toURI()));
    serverConfigurationManager.copyToComponentLib
            (new File(getClass().getResource(JAR_LOCATION + File.separator + GERONIMO_JMS).toURI()));
    serverConfigurationManager.restartGracefully();
    super.init();
    addInboundEndpoint(esbUtils.loadResource(RELATIVE_RESOURCE_PATH + "JMSEndpoint.xml"));
    logViewerClient = new LogViewerClient(contextUrls.getBackEndUrl(), getSessionCookie());
}
 
源代码4 项目: micro-integrator   文件: Sample265TestCase.java
@BeforeClass(alwaysRun = true)
public void init() throws Exception {
    super.init();
    pathToVfsDir = getClass().getResource(
            File.separator + "artifacts" + File.separator + "ESB" + File.separator + "synapseconfig"
                    + File.separator + "vfsTransport" + File.separator).getPath(); // change this to get samba path

    serverConfigurationManager = new ServerConfigurationManager(
            new AutomationContext("ESB", TestUserMode.SUPER_TENANT_ADMIN));
    super.init();

    File outFolder = new File(pathToVfsDir + "test" + File.separator + "out" + File.separator);
    File inFolder = new File(pathToVfsDir + "test" + File.separator + "in" + File.separator);
    File originalFolder = new File(pathToVfsDir + "test" + File.separator + "original" + File.separator);
    File failureFolder = new File(pathToVfsDir + "test" + File.separator + "failure" + File.separator);
    assertTrue(outFolder.mkdirs(), "file folder not created");
    assertTrue(inFolder.mkdirs(), "file folder not created");
    assertTrue(originalFolder.mkdirs(), "file folder not created");
    assertTrue(failureFolder.mkdirs(), "file folder not created");
    assertTrue(outFolder.exists(), "File folder doesn't exists");
    assertTrue(inFolder.exists(), "File folder doesn't exists");
    assertTrue(originalFolder.exists(), "File folder doesn't exists");
    assertTrue(failureFolder.exists(), "File folder doesn't exists");
}
 
@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;
    }

}
 
源代码6 项目: micro-integrator   文件: SequenceStatisticsTest.java
@BeforeClass(alwaysRun = true)
protected void initialize() throws Exception {
    //Starting the thrift port to listen to statistics events
    thriftServer = new ThriftServer("Wso2EventTestCase", 7612, true);
    thriftServer.start(7612);
    log.info("Thrift Server is Started on port 7612");

    //Changing synapse configuration to enable statistics and tracing
    ServerConfigurationManager serverConfigurationManager = new ServerConfigurationManager(
            new AutomationContext("ESB", TestUserMode.SUPER_TENANT_ADMIN));
    serverConfigurationManager.applyMIConfigurationWithRestart(new File(
            getESBResourceLocation() + File.separator + "StatisticTestResources" + File.separator
                    + "deployment.toml"));
    super.init();
    thriftServer.waitToReceiveEvents(20000); //waiting for esb to send artifact config data to the thriftserver
}
 
源代码7 项目: product-es   文件: JMXSubscription.java
/**
 * @param path      path of the collection or resource to be subscribed
 * @param eventType event to be subscribed
 * @return true if the required jmx notification is generated for
 *         subscription, false otherwise
 * @throws Exception
 */
public boolean init(String path, String eventType, AutomationContext autoContext)
        throws Exception {

    automationContext = autoContext;
    backEndUrl = automationContext.getContextUrls().getBackEndUrl();
    LoginLogoutClient loginLogoutClient = new LoginLogoutClient(automationContext);
    sessionCookie = loginLogoutClient.login();
    userName = automationContext.getContextTenant().getContextUser().getUserName();

    if (userName.contains("@")){
        userNameWithoutDomain = userName.substring(0, userName.indexOf('@'));
    }
    else {
        userNameWithoutDomain = userName;
    }

    boolean result = JMXSubscribe(path, eventType) && update(path) && getJMXNotification();
    clean(path);
    return result;
}
 
@BeforeClass(alwaysRun = true, enabled = true)
public void setUp() throws Exception {
    super.init(userMode);
    driver = new ESWebDriver(BrowserManager.getWebDriver());
    currentUserName = userInfo.getUserName().split("@")[0];
    currentUserPwd = userInfo.getPassword();
    baseUrl = getWebAppURL();
    AutomationContext automationContext = new AutomationContext(PRODUCT_GROUP_NAME,
            TestUserMode.SUPER_TENANT_ADMIN);
    adminUserName = automationContext.getSuperTenant().getTenantAdmin().getUserName().split("@")[0];
    adminUserPwd = automationContext.getSuperTenant().getTenantAdmin().getPassword();
    backendURL = automationContext.getContextUrls().getBackEndUrl();
    resourceAdminServiceClient = new ResourceAdminServiceClient(backendURL, adminUserName,
            adminUserPwd);
    resourcePath = GADGET_REGISTRY_BASE_PATH + currentUserName + "/" + assetName + "/" + ASSET_VERSION;

    ESUtil.login(driver, baseUrl, PUBLISHER_APP, currentUserName, currentUserPwd);
    ESUtil.loginToAdminConsole(driver, baseUrl, adminUserName, adminUserPwd);
}
 
@BeforeClass(alwaysRun = true)
public void setEnvironment() throws Exception {
    super.init();
    context = new AutomationContext("ESB", TestUserMode.SUPER_TENANT_ADMIN);
    serverConfigurationManager = new ServerConfigurationManager(context);
    serverConfigurationManager.applyMIConfiguration(new File(getESBResourceLocation() + "/other/" + "log4j2.properties"));
    serverConfigurationManager.restartMicroIntegrator();
    init();
    carbonLogReader = new CarbonLogReader();
    carbonLogReader.start();
    //allow time for log reader to start
    Thread.sleep(1000);

    OMElement response = axis2Client
            .sendSimpleStockQuoteRequest(getProxyServiceURLHttp("LogMediatorLevelAndCategoryTestProxy"), null,
                    "WSO2");
    Assert.assertTrue(response.toString().contains("WSO2"), "Did not receive the expected response");
}
 
源代码10 项目: product-ei   文件: Sample265TestCase.java
@BeforeClass(alwaysRun = true)
public void init() throws Exception {
    super.init();
    pathToVfsDir = getClass().getResource(File.separator + "artifacts" + File.separator + "ESB" +
            File.separator + "synapseconfig" + File.separator +
            "vfsTransport" + File.separator).getPath(); // change this to get samba path

    serverConfigurationManager = new ServerConfigurationManager(new AutomationContext("ESB", TestUserMode.SUPER_TENANT_ADMIN));
    serverConfigurationManager.applyConfiguration(new File(pathToVfsDir + File.separator + "axis2.xml"));
    super.init();

    File outFolder = new File(pathToVfsDir + "test" + File.separator + "out" + File.separator);
    File inFolder = new File(pathToVfsDir + "test" + File.separator + "in" + File.separator);
    File originalFolder = new File(pathToVfsDir + "test" + File.separator + "original" + File.separator);
    File failureFolder = new File(pathToVfsDir + "test" + File.separator + "failure" + File.separator);
    assertTrue(outFolder.mkdirs(), "file folder not created");
    assertTrue(inFolder.mkdirs(), "file folder not created");
    assertTrue(originalFolder.mkdirs(), "file folder not created");
    assertTrue(failureFolder.mkdirs(), "file folder not created");
    assertTrue(outFolder.exists(), "File folder doesn't exists");
    assertTrue(inFolder.exists(), "File folder doesn't exists");
    assertTrue(originalFolder.exists(), "File folder doesn't exists");
    assertTrue(failureFolder.exists(), "File folder doesn't exists");
}
 
@BeforeClass(alwaysRun = true)
public void setUp() throws Exception {
    super.init(userMode);
    driver = new ESWebDriver(BrowserManager.getWebDriver());
    currentUserName = userInfo.getUserName();
    currentUserPwd = userInfo.getPassword();
    baseUrl = getStorePublisherUrl();
    AutomationContext automationContext = new AutomationContext(PRODUCT_GROUP_NAME, TestUserMode.TENANT_ADMIN);
    adminUserName = automationContext.getContextTenant().getTenantAdmin().getUserName();
    adminUserPwd = automationContext.getContextTenant().getTenantAdmin().getPassword();
    String resourceLocation = getResourceLocation();
    backendURL = automationContext.getContextUrls().getBackEndUrl();
    resourceAdminServiceClient = new ResourceAdminServiceClient(backendURL, adminUserName, adminUserPwd);
    providerName = currentUserName.split("@")[0];
    resourcePath = GADGET_REGISTRY_BASE_PATH + providerName + "/" + assetName + "/" + VERSION;
    LCNotificationSubject += resourcePath;
    updateNotificationSubject += resourcePath;
    smtpPropertyLocation = resourceLocation + SMTP_PROPERTY_FILE;

    //Update user profiles through Admin console
    ESUtil.loginToAdminConsole(driver, baseUrl, adminUserName, adminUserPwd);
    ESUtil.setupUserProfile(driver, baseUrl, currentUserName, FIRST_NAME, LAST_NAME, EMAIL);
    //login to publisher & add a new gadget
    ESUtil.login(driver, baseUrl, PUBLISHER_APP, currentUserName, currentUserPwd);
    AssetUtil.addNewAsset(driver, baseUrl, ASSET_TYPE, assetName, VERSION, "", "", "");
}
 
@BeforeClass
public void init() throws Exception {
    super.init();
    AutomationContext automationContext = new AutomationContext();
    String dbPassword = automationContext.getConfigurationValue(XPathConstants.DATA_SOURCE_DB_PASSWORD);
    JDBC_URL = automationContext.getConfigurationValue(XPathConstants.DATA_SOURCE_URL);
    String dbUser = automationContext.getConfigurationValue(XPathConstants.DATA_SOURCE_DB_USER_NAME);
    String databaseName =
            System.getProperty("basedir") + File.separator + "target" + File.separator + "testdb_store"
                    + new Random().nextInt();
    JDBC_URL = JDBC_URL + databaseName + ";DB_CLOSE_ON_EXIT=FALSE;AUTO_SERVER=TRUE";
    h2DatabaseManager = new H2DataBaseManager(JDBC_URL, dbUser, dbPassword);
    h2DatabaseManager.executeUpdate(
            "CREATE TABLE IF NOT EXISTS JDBC_MESSAGE_STORE(\n" + "indexId BIGINT(20) NOT NULL AUTO_INCREMENT,\n"
                    + "msg_id VARCHAR(200) NOT NULL ,\n" + "message BLOB NOT NULL,\n" + "PRIMARY KEY ( indexId )\n"
                    + ")");
    carbonLogReader = new CarbonLogReader();
}
 
源代码13 项目: product-ei   文件: HumanTaskCreationTestCase.java
@BeforeClass(alwaysRun = true)
public void setEnvironment() throws Exception {

    init();  //init master class
    bpelPackageManagementClient = new BpelPackageManagementClient(backEndUrl, sessionCookie);
    humanTaskPackageManagementClient = new HumanTaskPackageManagementClient(backEndUrl, sessionCookie);
    requestSender = new RequestSender();
    initialize();

    //initialize HT Client API for Clerk1 user
    AutomationContext clerk1AutomationContext = new AutomationContext("BPS", "bpsServerInstance0001",
            FrameworkConstants.SUPER_TENANT_KEY, "clerk1");
    LoginLogoutClient clerk1LoginLogoutClient = new LoginLogoutClient(clerk1AutomationContext);
    String clerk1SessionCookie = clerk1LoginLogoutClient.login();

    clerk1HumanTaskClientApiClient = new HumanTaskClientApiClient(backEndUrl, clerk1SessionCookie);

    //initialize HT Client API for Manager1 user
    AutomationContext manager1AutomationContext = new AutomationContext("BPS", "bpsServerInstance0001",
            FrameworkConstants.SUPER_TENANT_KEY, "manager1");
    LoginLogoutClient manager1LoginLogoutClient = new LoginLogoutClient(manager1AutomationContext);
    String manager1SessionCookie = manager1LoginLogoutClient.login();
    manager1HumanTaskClientApiClient = new HumanTaskClientApiClient(backEndUrl, manager1SessionCookie);
}
 
源代码14 项目: product-cep   文件: StormTestCase.java
@BeforeClass(alwaysRun = true)
public void init() throws Exception {
    super.init();
    automationContext = new AutomationContext("CEP", TestUserMode.SUPER_TENANT_ADMIN);
    instanceMap = automationContext.getProductGroup().getInstanceMap();
    contextMap = new HashMap<String, AutomationContext>();

    if (instanceMap != null && instanceMap.size() > 0) {
        for (Map.Entry<String, Instance> entry : instanceMap.entrySet()) {
            String instanceKey = entry.getKey();
            contextMap.put(instanceKey, new AutomationContext("CEP", instanceKey,
                                                              TestUserMode.SUPER_TENANT_ADMIN));
            log.info(instanceKey);
        }
    }
    log.info("Cluster instance loading");

}
 
@BeforeClass(alwaysRun = true)
public void init() throws Exception {
    super.init();
    configurationManagerAxis2 =
            new ServerConfigurationManager(new AutomationContext("ESB", TestUserMode.SUPER_TENANT_ADMIN));
    File customAxisConfigAxis2 = new File(getESBResourceLocation() + File.separator +
                                          "axis2config" + File.separator + "axis2.xml");
    configurationManagerAxis2.applyConfiguration(customAxisConfigAxis2);
    super.init();

    rabbitMQServer = RabbitMQTestUtils.getRabbitMQServerInstance();
    //This is to stop existing rabbitMQ server instances
    rabbitMQServer.stop();
    rabbitMQServer.start();
    Assert.assertTrue(rabbitMQServer.isRabbitMQStarted(90), "Failed to start rabbitMQ server properly within given timeout");
    initRabbitMQBroker();
    loadESBConfigurationFromClasspath("/artifacts/ESB/rabbitmq/multipleListner/RabbitMQMultipleListnerProxy.xml");
    proxyServiceAdminClient = new ProxyServiceAdminClient(contextUrls.getBackEndUrl(), getSessionCookie());
}
 
源代码16 项目: product-ei   文件: RDBMSConnectionManager.java
/**
 * Get database connection.
 * @return database connection
 * @throws XPathExpressionException
 * @throws ClassNotFoundException
 * @throws SQLException
 */
public static Connection getConnection() throws XPathExpressionException, ClassNotFoundException, SQLException {

    AutomationContext automationContext = new AutomationContext("MB_Cluster", TestUserMode.SUPER_TENANT_ADMIN);

    String url = automationContext.getConfigurationValue("//datasources/datasource[@name=\'mbCluster\']/url");
    String username = automationContext.getConfigurationValue
            ("//datasources/datasource[@name=\'mbCluster\']/username");
    String password = automationContext.getConfigurationValue
            ("//datasources/datasource[@name=\'mbCluster\']/password");
    String driverName = automationContext.getConfigurationValue
            ("//datasources/datasource[@name=\'mbCluster\']/driverClassName");

    Class.forName(driverName);
    Connection conn = DriverManager.getConnection(url, username, password);
    return conn;
}
 
源代码17 项目: micro-integrator   文件: ESBIntegrationTest.java
private String replaceEndpoints(String config) throws XPathExpressionException {
    //this should be AS context
    String serviceUrl = new AutomationContext("AS", TestUserMode.SUPER_TENANT_ADMIN).getContextUrls()
            .getServiceUrl();

    config = config.replace("http://localhost:9000/services/", serviceUrl);
    config = config.replace("http://127.0.0.1:9000/services/", serviceUrl);
    return config;
}
 
源代码18 项目: product-es   文件: RegistryUserCreator.java
public void setInfoRolesAndUsers(String  adminUserKey)
            throws LoginAuthenticationExceptionException, RemoteException,
                   XPathExpressionException {
        //todo -
//        FrameworkProperties isProperties = FrameworkFactory.getFrameworkProperties(ProductConstant.IS_SERVER_NAME);
        AutomationContext isContext = new AutomationContext("IS", "is", "carbon.supper", adminUserKey);
        Tenant userAdminDetails = isContext.getContextTenant();
        sessionCookie = login(userAdminDetails.getContextUser().getUserName(), userAdminDetails.getContextUser().getPassword(),
                              isContext.getContextUrls().getBackEndUrl());
        userAdminStub = new UserManagementClient(isContext.getContextUrls().getBackEndUrl(), sessionCookie);


    }
 
private TestConfigurationProvider() {
    try {
        context = new AutomationContext();
    } catch (XPathExpressionException e) {
        log.error("Loading Automation Configuration failed", e);
    }
}
 
@BeforeClass(alwaysRun = true)
public void setEnvironment() throws Exception {
    super.init();
    serverConfigurationManager = new ServerConfigurationManager(new AutomationContext("ESB", TestUserMode.SUPER_TENANT_ADMIN));
    serverConfigurationManager.applyConfiguration(new File(getESBResourceLocation() + File.separator
                                                           + "passthru" + File.separator + "transport" + File.separator + "httpproxy" + File.separator + "axis2.xml"));
    super.init();
    loadESBConfigurationFromClasspath("/artifacts/ESB/passthru/transport/httpproxy/httpProxy.xml");
    logViewer = new LogViewerClient(contextUrls.getBackEndUrl(), getSessionCookie());
}
 
源代码21 项目: product-iots   文件: LoginUtils.java
/**
 * This method is used to login as admin.
 *
 * @param driver            The selenium web driver
 * @param automationContext Test Automation context
 * @param webAppURL         The server url
 */
public static void login(WebDriver driver, AutomationContext automationContext,
                         String webAppURL) throws IOException, XPathExpressionException {
    driver.get(webAppURL + Constants.IOT_LOGIN_PATH);
    LoginPage test = new LoginPage(driver);
    test.loginAsAdmin(automationContext.getSuperTenant().getTenantAdmin().getUserName(),
                      automationContext.getSuperTenant().getTenantAdmin().getPassword());
}
 
源代码22 项目: micro-integrator   文件: DSSIntegrationTest.java
protected void init() throws Exception {
    //        dssContext = new AutomationContext("DSS", "dss01", "carbon.supper", "admin");
    dssContext = new AutomationContext();
    /*LoginLogoutClient loginLogoutClient = new LoginLogoutClient(dssContext);
    sessionCookie = loginLogoutClient.login();
    //return the current tenant as the userType(TestUserMode)
    tenantInfo = dssContext.getContextTenant();
    //return the user information initialized with the system
    userInfo = tenantInfo.getContextUser();*/

}
 
源代码23 项目: product-ei   文件: Axis2ServerStartupTestCase.java
@BeforeTest(alwaysRun = true)
public void deployServices() throws Exception {

    if (TestConfigurationProvider.isIntegration()) {
        axis2Server1 = new SampleAxis2Server("test_axis2_server_9009.xml");
        axis2Server1.start();
        axis2Server1.deployService(ESBTestConstant.STUDENT_REST_SERVICE);
        axis2Server1.deployService(ESBTestConstant.SIMPLE_AXIS2_SERVICE);
        axis2Server1.deployService(ESBTestConstant.SIMPLE_STOCK_QUOTE_SERVICE);

    } else {
        asContext = new AutomationContext("AS", TestUserMode.SUPER_TENANT_ADMIN);
        int deploymentDelay = TestConfigurationProvider.getServiceDeploymentDelay();
        String serviceName = ESBTestConstant.SIMPLE_AXIS2_SERVICE;
        String serviceFilePath = TestConfigurationProvider.getResourceLocation("AXIS2")
                                 + File.separator + "aar" + File.separator + serviceName + ".aar";
        ServiceDeploymentUtil deployer = new ServiceDeploymentUtil();
        String sessionCookie = new LoginLogoutClient(asContext).login();
        deployer.deployArrService(asContext.getContextUrls().getBackEndUrl(), sessionCookie
                , serviceName, serviceFilePath, deploymentDelay);

        String studentServiceName = ESBTestConstant.STUDENT_REST_SERVICE;
        String studentServiceFilePath = TestConfigurationProvider.getResourceLocation("AXIS2")
                                        + File.separator + "aar" + File.separator + studentServiceName + ".aar";
        deployer.deployArrService(asContext.getContextUrls().getBackEndUrl(), sessionCookie
                , studentServiceName, studentServiceFilePath, deploymentDelay);

    }
}
 
@BeforeClass
public void init() throws Exception {
    super.init();
    serverConfigurationManager = new ServerConfigurationManager(new AutomationContext("ESB", TestUserMode.SUPER_TENANT_ADMIN));
    /*
       * If test run in external distributed deployment you need to copy
       * following configFiles/preserveContentType/passthru-http.properties resource
       */

    serverConfigurationManager.applyConfiguration(new File(getESBResourceLocation() + File.separator + "passthru" +
            File.separator + "transport" + File.separator + "preserveheaders" + File.separator + "passthru-http.properties"));
    super.init();
    wireServer = new WireMonitorServer(8992);
    verifyAPIExistence("ContentTypePreserveAPI");
}
 
源代码25 项目: product-ei   文件: ESBIntegrationTest.java
private String replaceEndpoints(String config) throws XPathExpressionException {
	//this should be AS context
	String serviceUrl = new AutomationContext("AS", TestUserMode.SUPER_TENANT_ADMIN).getContextUrls().getServiceUrl();

	config = config.replace("http://localhost:9000/services/"
			, serviceUrl);
	config = config.replace("http://127.0.0.1:9000/services/"
			, serviceUrl);
	return config;
}
 
@SetEnvironment(executionEnvironments = { ExecutionEnvironment.STANDALONE })
@BeforeClass(alwaysRun = true)
public void initialize() throws Exception {
    super.init();
    serverManager = new ServerConfigurationManager(new AutomationContext());
    serverManager.applyMIConfigurationWithRestart(new File(CONFIG_LOCATION + "deployment.toml"));
    super.init();
}
 
源代码27 项目: product-iots   文件: AnalyticsServerExtension.java
@Override
public void initiate() throws AutomationFrameworkException {
    try {
        automationContext = new AutomationContext("IOT", TestUserMode.SUPER_TENANT_USER);
        if(getParameters().get(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND) == null) {
            getParameters().put(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND, "2");
        }
        serverManager = new CustomTestServerManager(getAutomationContext(), null, getParameters());
        executionEnvironment =
                automationContext.getConfigurationValue(ContextXpathConstants.EXECUTION_ENVIRONMENT);

    } catch (XPathExpressionException e) {
        handleException("Error while initiating test environment", e);
    }
}
 
@BeforeClass(alwaysRun = true)
public void setEnvironment() throws Exception {
    serverConfigurationManager = new ServerConfigurationManager(new AutomationContext());
    serverConfigurationManager.applyMIConfigurationWithRestart(new File(
            getESBResourceLocation() + File.separator + "passthru" + File.separator + "transport" + File.separator
                    + "httpproxy" + File.separator + "deployment.toml"));
    super.init();
    carbonLogReader.start();
}
 
@BeforeClass(alwaysRun = true)
public void init() throws Exception {
    serverConfigurationManagerProp = new ServerConfigurationManager(new AutomationContext());
    String pttFile = FrameworkPathUtil.getSystemResourceLocation() + "artifacts" + separator + "ESB" + separator
                    + "synapseconfig" + separator + "MaxOpenConnections" + separator + "deployment.toml";
    serverConfigurationManagerProp.applyMIConfigurationWithRestart(new File(pttFile));

    super.init();
    maxOpenConnectionClients = new MaximumOpenConnectionsClient[CONCURRENT_CLIENTS];
    clients = new Thread[CONCURRENT_CLIENTS];
}
 
@BeforeClass(alwaysRun = true)
public void setUp() throws Exception {
    super.init(userMode);
    currentUserName = userInfo.getUserName().split("@")[0];
    currentUserPwd = userInfo.getPassword();
    driver = new ESWebDriver(BrowserManager.getWebDriver());
    baseUrl = getWebAppURL();
    AutomationContext automationContext = new AutomationContext(PRODUCT_GROUP_NAME, TestUserMode.SUPER_TENANT_ADMIN);
    adminUserName = automationContext.getSuperTenant().getTenantAdmin().getUserName();
    adminUserPwd = automationContext.getSuperTenant().getTenantAdmin().getPassword();
    normalUserName = automationContext.getSuperTenant().getTenantUser(USER1).getUserName().split("@")[0];
    String normalUserPwd = automationContext.getSuperTenant().getTenantUser(USER1).getPassword();
    resourcePath = GADGET_REGISTRY_BASE_PATH + normalUserName + "/" + ASSET_NAME + "/" + VERSION_2;
    String backendURL = automationContext.getContextUrls().getBackEndUrl();
    resourceAdminServiceClient = new ResourceAdminServiceClient(backendURL, adminUserName, adminUserPwd);
    if (currentUserName.equals(adminUserName)) {
        ESUtil.login(driver, baseUrl, PUBLISHER_APP, normalUserName, normalUserPwd);
        AssetUtil.addNewAsset(driver, baseUrl, ASSET_TYPE, ASSET_NAME, VERSION_2, "", "", "");
        if (isAlertPresent(driver)) {
            String alert = closeAlertAndGetItsText(driver, true);
            LOG.warn(alert + ": modal box appeared");
        }
        driver.get(baseUrl + PUBLISHER_LOGOUT_URL);
        driver.get(driver.getCurrentUrl());
    }
    ESUtil.login(driver, baseUrl, PUBLISHER_APP, currentUserName, currentUserPwd);
}