org.wso2.carbon.integration.common.admin.client.AuthenticatorClient Java Examples

The following examples show how to use org.wso2.carbon.integration.common.admin.client.AuthenticatorClient. 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: ServiceChainingTest.java    From product-ei with Apache License 2.0 6 votes vote down vote up
@Test(groups = {"wso2.esb"})
public void testTenantIDInTenantResponsePath() throws Exception {
    // create a tenant
    TenantManagementServiceClient tenantMgtAdminServiceClient = new TenantManagementServiceClient(contextUrls.getBackEndUrl(), sessionCookie);
    tenantMgtAdminServiceClient.addTenant("t5.com", "jhonporter", "jhon", "demo");
    // log as tenant
    AuthenticatorClient authClient = new AuthenticatorClient(contextUrls.getBackEndUrl());
    String session = authClient.login("[email protected]", "jhonporter", "localhost");
    // load configuration in tenant space
    esbUtils.loadESBConfigurationFrom("artifacts/ESB/ServiceChainingConfig.xml", contextUrls.getBackEndUrl(), session);
    // Create service client
    ServiceClient sc = getServiceClient("http://localhost:8480/services/t/t5.com/ServiceChainingProxy", null,
                                        "wso2");
    sc.fireAndForget(createStandardSimpleRequest("wso2"));
    // Get logs by tenant name
    LogViewerClient logViewerClient = new LogViewerClient(contextUrls.getBackEndUrl(), sessionCookie);
    ArrayList<LogEvent> logs = Utils.getLogsWithExpectedValue(logViewerClient, "INFO", "RECEIVE");
    Assert.assertNotNull(logs, "Expected logs were not found");
    LogEvent receiveSeqLog_1 = getLogEventByMessage(logs, "DEBUG SEQ 1 = FIRST RECEIVE SEQUENCE");
    Assert.assertNotNull(receiveSeqLog_1);
    LogEvent receiveSeqLog_2 = getLogEventByMessage(logs, "DEBUG SEQ 2 = SECOND RECEIVE SEQUENCE");
    Assert.assertNotNull(receiveSeqLog_2);
}
 
Example #2
Source File: HttpEpTemplateWithSystemPropsTestCase.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
private void deploySynapseConfig() throws Exception {
    AuthenticatorClient authenticatorClient = new AuthenticatorClient(BACKEND_URL);
    ClientConnectionUtil.waitForPort(SERVER_PORT, HOST);
    ClientConnectionUtil.waitForLogin(context);// (SERVER_PORT, HOST,
    // BACKEND_URL);
    TimeUnit.SECONDS.sleep(15);
    String sessionCookie = authenticatorClient.login("admin", "admin", new URL(BACKEND_URL).getHost());

    String relativeFilePath =
            File.separator + "artifacts" + File.separator + "ESB" + File.separator + "template" + File.separator
                    + "httpEpTemplateTest.xml";
    relativeFilePath = relativeFilePath.replaceAll("[\\\\/]", File.separator);
    OMElement synapseConfig = esbUtils.loadResource(relativeFilePath);
    esbUtils.updateESBConfiguration(synapseConfig, BACKEND_URL, sessionCookie);
}
 
Example #3
Source File: HttpEpTemplateWithSystemPropsTestCase.java    From product-ei with Apache License 2.0 5 votes vote down vote up
private void deploySynapseConfig() throws Exception {
	AuthenticatorClient authenticatorClient = new AuthenticatorClient(BACKEND_URL);
	ClientConnectionUtil.waitForPort(SERVER_PORT, HOST);
	ClientConnectionUtil.waitForLogin(context);// (SERVER_PORT, HOST,
	// BACKEND_URL);
	TimeUnit.SECONDS.sleep(15);
	String sessionCookie = authenticatorClient.login("admin", "admin",
			new URL(BACKEND_URL).getHost());

	String relativeFilePath = File.separator + "artifacts" + File.separator + "ESB"
			+ File.separator + "template" + File.separator + "httpEpTemplateTest.xml";
	relativeFilePath = relativeFilePath.replaceAll("[\\\\/]", File.separator);
	OMElement synapseConfig = esbUtils.loadResource(relativeFilePath);
	esbUtils.updateESBConfiguration(synapseConfig, BACKEND_URL, sessionCookie);
}
 
Example #4
Source File: IOTIntegrationUIBaseTestCase.java    From product-iots with Apache License 2.0 5 votes vote down vote up
protected String getSessionCookie(AutomationContext context)
        throws RemoteException, XPathExpressionException, LoginAuthenticationExceptionException {
    AuthenticatorClient authenticationAdminClient = new AuthenticatorClient(context.getContextUrls().getBackEndUrl());
    return authenticationAdminClient.login(automationContext.getSuperTenant().
                                                   getTenantAdmin().getUserName(), automationContext.getSuperTenant().
                                                   getTenantAdmin().getPassword(),
                                           automationContext.getDefaultInstance().getHosts().get("default"));
}
 
Example #5
Source File: EMMIntegrationUiBaseTestCase.java    From product-emm with Apache License 2.0 5 votes vote down vote up
protected String getSessionCookie(AutomationContext context) throws RemoteException, XPathExpressionException,
    LoginAuthenticationExceptionException {
    AuthenticatorClient authenticationAdminClient = new AuthenticatorClient(context.getContextUrls().getBackEndUrl());
    String sessionCookie = authenticationAdminClient.login(automationContext.getSuperTenant().
            getTenantAdmin().getUserName(), automationContext.getSuperTenant().
            getTenantAdmin().getPassword(),
            automationContext.getDefaultInstance().getHosts().get("default"));

    return sessionCookie;
}
 
Example #6
Source File: DS1069DifferentTimeStampStoreIssueTestCase.java    From micro-integrator with Apache License 2.0 4 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void serviceDeployment() throws Exception {

    super.init();

    startupParameterMap = new HashMap<String, String>();
    startupParameterMap.put("-DportOffset", "1210");

    testServerManager = new DSSTestServerManager(dssContext, null, startupParameterMap) {

        public void configureServer() throws AutomationFrameworkException {

            try {
                File sourceFile = new File(
                        getResourceLocation() + File.separator + "serverConfigs" + File.separator + getParameter(
                                "shFilename"));
                //                    File destinationFile = new File(testServerManager.getCarbonHome() + File.separator + "bin" + File.separator + "wso2server.sh");

                //copying wso2server.sh file to bin folder
                FileManager.copyFile(sourceFile,
                        this.getCarbonHome() + File.separator + "bin" + File.separator + "wso2server.sh");

            } catch (IOException e) {
                throw new AutomationFrameworkException(e.getMessage(), e);
            } catch (XPathExpressionException e) {
                throw new AutomationFrameworkException(e.getMessage(), e);
            }

        }
    };

    testServerManager.setParameter("shFilename", "wso2server.sh");

    String testServerCarbonHome = testServerManager.startServer();

    backupUserDir = System.getProperty("user.dir");
    backupCarbonHome = System.getProperty("carbon.home");

    System.out.println("****************  back up user dir   " + backupUserDir);
    System.out.println("****************  back up carbonhome " + backupCarbonHome);

    System.setProperty("carbon.home", testServerCarbonHome);
    //        System.setProperty("user.dir", testServerCarbonHome);

    loginClient = new AuthenticatorClient(backendUrl);
    sessionCookie = loginClient.login(userInfo.getUserName(), userInfo.getPassword(), "localhost");

    List<File> sqlFileLis = new ArrayList<File>();
    sqlFileLis.add(selectSqlFile("CreateTableWithTimeStamp.sql"));
    deployService(serviceName, createArtifact(
            getResourceLocation() + File.separator + "dbs" + File.separator + "rdbms" + File.separator + "h2"
                    + File.separator + serviceName + ".dbs", sqlFileLis));

    //        backendUrl = dssContext.getContextUrls().getBackEndUrl();

    insertTimeStampToDb("Insert With America/New_York Time Zone", "1970-01-02T12:00:00.000+02:00");

    testServerManager.stopServer();

    testServerManager.removeParameter("shFilename");
    testServerManager.setParameter("shFilename", "wso2server1.sh");
    testServerManager.configureServer();
    testServerManager.startServer();
    sessionCookie = loginClient.login(userInfo.getUserName(), userInfo.getPassword(), "localhost");

    insertTimeStampToDb("Insert With America/New_York Time Zone", "1970-01-02T12:00:00.000+02:00");

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

    super.init();

    startupParameterMap = new HashMap<String, String>();
    startupParameterMap.put("-DportOffset", "1210");

    testServerManager = new DSSTestServerManager(dssContext, null, startupParameterMap) {

        public void configureServer() throws AutomationFrameworkException {

            try {
                File sourceFile = new File(
                        getResourceLocation() + File.separator + "serverConfigs" + File.separator + getParameter(
                                "shFilename"));

                //copying wso2server.sh file to bin folder
                FileManager.copyFile(sourceFile,
                        this.getCarbonHome() + File.separator + "bin" + File.separator + "wso2server.sh");

            } catch (IOException e) {
                throw new AutomationFrameworkException(e.getMessage(), e);
            } catch (XPathExpressionException e) {
                throw new AutomationFrameworkException(e.getMessage(), e);
            }

        }
    };

    testServerManager.setParameter("shFilename", "wso2serverLegacyMode.sh");

    String testServerCarbonHome = testServerManager.startServer();

    backupUserDir = System.getProperty("user.dir");
    backupCarbonHome = System.getProperty("carbon.home");

    System.out.println("****************  back up user dir   " + backupUserDir);
    System.out.println("****************  back up carbonhome " + backupCarbonHome);

    System.setProperty("carbon.home", testServerCarbonHome);

    loginClient = new AuthenticatorClient(backendUrl);
    sessionCookie = loginClient.login(userInfo.getUserName(), userInfo.getPassword(), "localhost");

    List<File> sqlFileLis = new ArrayList<File>();
    sqlFileLis.add(selectSqlFile("CreateTableTimeStamp.sql"));
    deployService(serviceName, createArtifact(
            getResourceLocation() + File.separator + "dbs" + File.separator + "rdbms" + File.separator + "h2"
                    + File.separator + serviceName + ".dbs", sqlFileLis));

    insertTimeStampToDb("Insert With America/New_York Time Zone", "1970-01-02T12:00:00.000+02:00");

    testServerManager.stopServer();
    testServerManager.removeParameter("shFilename");
    testServerManager.setParameter("shFilename", "wso2serverLegacyMode1.sh");
    testServerManager.configureServer();
    testServerManager.startServer();

    sessionCookie = loginClient.login(userInfo.getUserName(), userInfo.getPassword(), "localhost");

    insertTimeStampToDb("Insert With UTC Time Zone", "1970-01-02T12:00:00.000+02:00");

}
 
Example #8
Source File: LoginLogoutClient.java    From product-ei with Apache License 2.0 4 votes vote down vote up
public LoginLogoutClient(String backendURL,String userName,String password) throws AxisFault {

        this.userName=userName;
        this.password = password;
        this.loginClient = new AuthenticatorClient(backendURL);
    }
 
Example #9
Source File: RegistryUserCreator.java    From product-es with Apache License 2.0 4 votes vote down vote up
protected static String login(String userName, String password, String hostName)
        throws RemoteException, LoginAuthenticationExceptionException {
    AuthenticatorClient loginClient = new AuthenticatorClient(hostName);
    return loginClient.login(userName, password, hostName);
}
 
Example #10
Source File: DS1069DifferentTimeStampStoreIssueTestCase.java    From product-ei with Apache License 2.0 2 votes vote down vote up
@BeforeClass(alwaysRun = true)
    public void serviceDeployment() throws Exception {

        super.init();

        startupParameterMap = new HashMap<String, String>();
        startupParameterMap.put("-DportOffset", "1210");

        testServerManager = new DSSTestServerManager(dssContext, null, startupParameterMap) {

            public void configureServer() throws AutomationFrameworkException {

                try {
                    File sourceFile = new File(getResourceLocation() + File.separator + "serverConfigs" + File.separator
                            + getParameter("shFilename"));
//                    File destinationFile = new File(testServerManager.getCarbonHome() + File.separator + "bin" + File.separator + "wso2server.sh");

                    //copying wso2server.sh file to bin folder
                    FileManager.copyFile(sourceFile, this.getCarbonHome() + File.separator + "bin" + File.separator + "wso2server.sh");


                } catch (IOException e) {
                    throw new AutomationFrameworkException(e.getMessage(), e);
                } catch (XPathExpressionException e) {
                    throw new AutomationFrameworkException(e.getMessage(), e);
                }

            }
        };

        testServerManager.setParameter("shFilename", "wso2server.sh");

        String testServerCarbonHome = testServerManager.startServer();

        backupUserDir = System.getProperty("user.dir");
        backupCarbonHome = System.getProperty("carbon.home");

        System.out.println("****************  back up user dir   " + backupUserDir);
        System.out.println("****************  back up carbonhome " + backupCarbonHome);


        System.setProperty("carbon.home", testServerCarbonHome);
//        System.setProperty("user.dir", testServerCarbonHome);

        loginClient = new AuthenticatorClient(backendUrl);
        sessionCookie = loginClient.login(userInfo.getUserName(), userInfo.getPassword(), "localhost");

        List<File> sqlFileLis = new ArrayList<File>();
        sqlFileLis.add(selectSqlFile("CreateTableWithTimeStamp.sql"));
        deployService(serviceName,
                createArtifact(getResourceLocation() + File.separator + "dbs" + File.separator
                        + "rdbms" + File.separator + "h2" + File.separator
                        + serviceName + ".dbs", sqlFileLis));

//        backendUrl = dssContext.getContextUrls().getBackEndUrl();

        insertTimeStampToDb("Insert With America/New_York Time Zone", "1970-01-02T12:00:00.000+02:00");

        testServerManager.stopServer();

        testServerManager.removeParameter("shFilename");
        testServerManager.setParameter("shFilename", "wso2server1.sh");
        testServerManager.configureServer();
        testServerManager.startServer();
        sessionCookie = loginClient.login(userInfo.getUserName(), userInfo.getPassword(), "localhost");

        insertTimeStampToDb("Insert With America/New_York Time Zone", "1970-01-02T12:00:00.000+02:00");

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

    super.init();

    startupParameterMap = new HashMap<String, String>();
    startupParameterMap.put("-DportOffset", "1210");

    testServerManager = new DSSTestServerManager(dssContext, null, startupParameterMap) {

        public void configureServer() throws AutomationFrameworkException {

            try {
                File sourceFile = new File(getResourceLocation() + File.separator + "serverConfigs" + File.separator
                        + getParameter("shFilename"));

                //copying wso2server.sh file to bin folder
                FileManager.copyFile(sourceFile, this.getCarbonHome() + File.separator + "bin" + File.separator + "wso2server.sh");


            } catch (IOException e) {
                throw new AutomationFrameworkException(e.getMessage(), e);
            } catch (XPathExpressionException e) {
                throw new AutomationFrameworkException(e.getMessage(), e);
            }

        }
    };

    testServerManager.setParameter("shFilename", "wso2serverLegacyMode.sh");

    String testServerCarbonHome = testServerManager.startServer();

    backupUserDir = System.getProperty("user.dir");
    backupCarbonHome = System.getProperty("carbon.home");

    System.out.println("****************  back up user dir   " + backupUserDir);
    System.out.println("****************  back up carbonhome " + backupCarbonHome);


    System.setProperty("carbon.home", testServerCarbonHome);

    loginClient = new AuthenticatorClient(backendUrl);
    sessionCookie = loginClient.login(userInfo.getUserName(), userInfo.getPassword(), "localhost");

    List<File> sqlFileLis = new ArrayList<File>();
    sqlFileLis.add(selectSqlFile("CreateTableTimeStamp.sql"));
    deployService(serviceName,
            createArtifact(getResourceLocation() + File.separator + "dbs" + File.separator
                    + "rdbms" + File.separator + "h2" + File.separator
                    + serviceName + ".dbs", sqlFileLis));

    insertTimeStampToDb("Insert With America/New_York Time Zone", "1970-01-02T12:00:00.000+02:00");

    testServerManager.stopServer();
    testServerManager.removeParameter("shFilename");
    testServerManager.setParameter("shFilename", "wso2serverLegacyMode1.sh");
    testServerManager.configureServer();
    testServerManager.startServer();

    sessionCookie = loginClient.login(userInfo.getUserName(), userInfo.getPassword(), "localhost");

    insertTimeStampToDb("Insert With UTC Time Zone", "1970-01-02T12:00:00.000+02:00");

}