Hi Malintha,
I tried to create separate automation contexts using productname as ESB and
instance name as esbs001. But it throws a null pointer exception. Can you
explain what I am doing wrong..?
java.lang.NullPointerException
at
org.wso2.carbon.automation.engine.context.AutomationContext.getNonSuperTenant(AutomationContext.java:345)
at
org.wso2.carbon.automation.engine.context.AutomationContext.getContextTenant(AutomationContext.java:335)
at
org.wso2.carbon.automation.engine.context.AutomationContext.getContextUrls(AutomationContext.java:469)
at
org.wso2.carbon.integration.common.utils.LoginLogoutClient.<init>(LoginLogoutClient.java:51)
at
org.wso2.carbon.integration.common.utils.mgt.ServerConfigurationManager.<init>(ServerConfigurationManager.java:94)
at
org.wso2.carbon.esb.jms.inbound.transport.test.JMSInboundHttpTenantTestCase.init(JMSInboundHttpTenantTestCase.java:43)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)
at
org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:525)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:202)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:130)
at
org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:173)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:105)
at org.testng.TestRunner.runWorkers(TestRunner.java:1178)
at org.testng.TestRunner.privateRun(TestRunner.java:757)
at org.testng.TestRunner.run(TestRunner.java:608)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
at org.testng.SuiteRunner.run(SuiteRunner.java:240)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1158)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1083)
at org.testng.TestNG.run(TestNG.java:999)
at
org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:178)
at
org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:92)
at
org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:96)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
at
org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
at
org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
at
org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
at
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
On Wed, Jan 28, 2015 at 8:08 AM, Saneth Dharmakeerthi <[email protected]>
wrote:
> HI Pasadi,
>
> You can do the multiple user login in same script as bellow.
>
> user login:
>
> LoginLogoutUtil loginUtil = new LoginLogoutUtil(9443, "localhost"); // use
> correct port
> *sessionCookie* = loginUtil.login(TENANT_NAME_1, TENANT_PASSWORD,
> backendURL);
>
> Make sure to update the cookie information as above. Use updated cookie
> for your next activities.
>
> Ex:
> WebAppAdminClient webAppAdminClient = new WebAppAdminClient(backendURL,
> *sessionCookie*);
>
>
>
>
>
> Thanks and Best Regards,
>
> Saneth Dharmakeerthi
> Senior Software Engineer
> WSO2, Inc.
> Mobile: +94772325511
>
> On Tue, Jan 27, 2015 at 6:52 PM, Malintha Adikari <[email protected]>
> wrote:
>
>> Hi Prasadi,
>>
>> In WSO2 Test Automation Framework, we store all configurations details
>> related to tests in automation.xml file [1]. You can add/remove your tents
>> under <userManagement> element of that file. Then Test Framework will
>> automatically create tenants which are mentioned under above tag. So in
>> your case please add two tenants in to that files
>>
>>
>> <tenant domain="wso2.com" key="wso2.com"> <admin> <user key="
>> admin"> <userName>admin</userName> <password>admin</
>> password> </user> </admin> <users> <user key="user1"> <
>> userName>testuser11</userName> <password>testuser11</password> </
>> user> <user key="user2"> <userName>testuser21</userName> <
>> password>testuser21</password> </user> </users>
>>
>> <tenant domain="test.com" key="test.com"> <admin><user key="admin">
>> <userName>admin</userName> <password>admin</password> </user> </
>> admin> <users> <user key="user11"> <userName>testuser111</userName
>> > <password>testuser11</password> </user> <user key="user21"> <
>> userName>testuser211</userName> <password>testuser21</password> </
>> user> </users>
>>
>>
>>
>> Then you can use those tenants seperately inside your tests. You can
>> create separate "AutomationContext" objects in your test (in your case two)
>> and use those AutomationContext objects for writing your test case. You can
>> achieve tenant separation through these objects.
>>
>>
>>
>> *AutomationContext tenant1Context= new
>> AutomationContext(productGroupName, instanceName, "wso2.com
>> <http://wso2.com>", "admin")AutomationContext tenant2Context= new
>> AutomationContext(productGroupName, instanceName, "test.com
>> <http://test.com>", "user11")*
>>
>> (Please refer AutmationContext.java class[4] for different constructors
>> you can use to create your AutomationContext object)
>>
>> In ESB tests above "AutomationContext" object is created inside a base
>> class [3] and all test classes inherited from that class. You can add your
>> "AutomationContext" objects in your test class and it will do no harm
>>
>> Note: Tenant creation process is done by AutomationFramework here. (In
>> the upstart of the carbon server)
>>
>> If you want to create tenants inside your test case it self please refer
>> how Automation Framework do the same thing [2]
>>
>> [1]
>> https://github.com/wso2/product-as/blob/master/modules/integration/tests-integration/tests/src/test/resources/automation.xml
>> [2]
>> https://github.com/wso2-dev/carbon-platform-integration-utils/tree/master/common-framework-extensions/src/main/java/org/wso2/carbon/integration/common/extensions/usermgt
>> [3]
>> https://github.com/wso2-dev/product-esb/blob/master/modules/integration/test-common/integration-test-utils/src/main/java/org/wso2/esb/integration/common/utils/ESBIntegrationTest.java
>> [4]
>> https://github.com/wso2-dev/carbon-platform-integration/blob/master/test-automation-framework/org.wso2.carbon.automation.engine/src/main/java/org/wso2/carbon/automation/engine/context/AutomationContext.java
>>
>> Regards,
>> Malintha Adikari
>>
>>
>>
>> On Tue, Jan 27, 2015 at 12:46 PM, Irham Iqbal <[email protected]> wrote:
>>
>>> Hi,
>>>
>>> In this class[1] we populate users for tenant. you can go through
>>> addTenantUsers method and see how you can add users.
>>>
>>> [1]
>>> https://github.com/wso2-dev/carbon-platform-integration-utils/blob/master/common-framework-extensions/src/main/java/org/wso2/carbon/integration/common/extensions/usermgt/UserPopulator.java
>>>
>>> Thanks,
>>> Iqbal
>>>
>>> On Tue, Jan 27, 2015 at 5:55 PM, Pasadi Munasinghe <[email protected]>
>>> wrote:
>>>
>>>> Hi Irham,
>>>>
>>>> Thank you for the reply.
>>>> What I actually need to do is to create one tenant and make him execute
>>>> a certain process and the other one should log in and some other process.
>>>> Can you please elaborate how can I get each user to perform their
>>>> respective activities..??
>>>> Thanx..!!
>>>>
>>>> On Tue, Jan 27, 2015 at 5:40 PM, Irham Iqbal <[email protected]> wrote:
>>>>
>>>>> Hi Pasadi,
>>>>>
>>>>> You can use automation.xml[1] to create multiple tenants.
>>>>> You can define your tenants inside <userManagement> tag and inside <
>>>>> listenerExtensions> tag add the extension class[2]. This
>>>>> automation.xml[1] already has those configuration.
>>>>>
>>>>> [1]
>>>>> https://github.com/wso2/product-as/blob/master/modules/integration/tests-integration/tests/src/test/resources/automation.xml
>>>>>
>>>>>
>>>>> [2]org.wso2.carbon.integration.common.extensions.usermgt.UserPopulateExtension
>>>>>
>>>>>
>>>>> Thanks,
>>>>> Iqbal
>>>>>
>>>>> On Tue, Jan 27, 2015 at 5:20 PM, Pasadi Munasinghe <[email protected]>
>>>>> wrote:
>>>>>
>>>>>> Hi,
>>>>>> I am in the process of implementing a test case where initially 2
>>>>>> tenant users should be able to log in. How should I do this..??
>>>>>> Thanx..!!!
>>>>>> --
>>>>>> Pasadi Munasinghe
>>>>>> Software Engineer Intern
>>>>>> WSO2, Inc
>>>>>> Mobile: +9471 377 5515
>>>>>>
>>>>>> _______________________________________________
>>>>>> Dev mailing list
>>>>>> [email protected]
>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Irham Iqbal
>>>>> Software Engineer - Test Automation
>>>>> WSO2, Inc.: http://wso2.com
>>>>> lean. enterprise. middleware
>>>>> phone: +94 777888452
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Pasadi Munasinghe
>>>> Software Engineer Intern
>>>> WSO2, Inc
>>>> Mobile: +9471 377 5515
>>>>
>>>
>>>
>>>
>>> --
>>> Irham Iqbal
>>> Software Engineer - Test Automation
>>> WSO2, Inc.: http://wso2.com
>>> lean. enterprise. middleware
>>> phone: +94 777888452
>>>
>>> _______________________________________________
>>> Dev mailing list
>>> [email protected]
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>>
>> --
>> *Malintha Adikari*
>> Software Engineer
>> WSO2 Inc.; http://wso2.com
>> lean.enterprise.middleware
>>
>> Mobile: +94 71 2312958
>> Blog: http://malinthas.blogspot.com
>> Page: http://about.me/malintha
>>
>> _______________________________________________
>> Dev mailing list
>> [email protected]
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
--
Pasadi Munasinghe
Software Engineer Intern
WSO2, Inc
Mobile: +9471 377 5515
<!--
~ Copyright (c) 2005-2010, WSO2 Inc. (http://wso2.com) All Rights Reserved.
~
~ WSO2 Inc. licenses this file to you under the Apache License,
~ Version 2.0 (the "License"); you may not use this file except
~ in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
-->
<automation xmlns="automation_mapping.xsd">
<!-- ================================================= -->
<!-- Parameters -->
<!-- ================================================= -->
<configurations>
<!--
Change this to edit wait time for test artifact deployment
-->
<deploymentDelay>60000</deploymentDelay>
<!--
Change this to standalone|platform|all to execute test on specific environment
-->
<executionEnvironment>standalone</executionEnvironment>
<!--
Change this to true if you want to generate coverage statistics
-->
<coverage>true</coverage>
<!--
Change this to true if you want to enable framework dashboard
-->
<frameworkDashboard>false</frameworkDashboard>
<!--
Browser type with used by framework to execute UI test, supported types - chrome|firefox|opera|ie|htmlUnit
-->
</configurations>
<tools>
<selenium>
<!-- Change to enable remote webDriver -->
<!-- URL of remote webDriver server -->
<remoteDriverUrl enable="true">http://10.100.2.51:4444/wd/hub/</remoteDriverUrl>
<!-- Type of the browser selenium tests are running" -->
<browser>
<browserType>firefox</browserType>
<!-- path to webDriver executable - required only for chrome-->
<webdriverPath enable="false">/home/test/name/webDriver</webdriverPath>
</browser>
</selenium>
</tools>
<!--
Database configuration to be used for data service testing. DB configuration in dbs files will be replaced with
below configuration at test run time
-->
<datasources>
<datasource name="dataService">
<url>jdbc:h2:testDB</url>
<username>wso2carbon</username>
<password>wso2carbon</password>
<driverClassName>org.h2.Driver</driverClassName>
</datasource>
<datasource name="dataService1">
<url>jdbc:h2:testDB</url>
<username>wso2carbon</username>
<password>wso2carbon</password>
<driverClassName>org.h2.Driver</driverClassName>
</datasource>
</datasources>
<security>
<!--
KeyStore which will be used for encrypting/decrypting passwords
and other sensitive information.
-->
<keystore name="wso2">
<!-- Keystore file location -->
<fileName>keystores/products/wso2carbon.jks</fileName>
<!-- Keystore type (JKS/PKCS12 etc.) -->
<type>JKS</type>
<!-- Keystore password -->
<password>wso2carbon</password>
<!-- Private Key alias -->
<keyAlias>wso2carbon</keyAlias>
<!-- Private Key password -->
<keyPassword>wso2carbon</keyPassword>
</keystore>
<!--
System wide trust-store which is used to maintain the certificates of all
the trusted parties.
-->
<truststore name="wso2">
<!-- trust-store file location -->
<fileName>client-truststore.jks</fileName>
<!-- trust-store type (JKS/PKCS12 etc.) -->
<type>JKS</type>
<!-- trust-store password -->
<password>wso2carbon</password>
</truststore>
</security>
<featureManagement>
<p2Repositories>
<repository name="localDefault">
<repository repo-id="online-repository">https://wso2.org/repo</repository>
<repository repo-id="file-repository">file:///home/krishantha/test</repository>
</repository>
</p2Repositories>
</featureManagement>
<!--
System wide users who to be registered at the test initiation
-->
<userManagement>
<superTenant>
<tenant domain="carbon.super" key="superTenant">
<admin>
<user key="superAdmin">
<userName>admin</userName>
<password>admin</password>
</user>
</admin>
<users>
<user key="user1">
<userName>testuser11</userName>
<password>testuser11</password>
</user>
<user key="user2">
<userName>testuser21</userName>
<password>testuser21</password>
</user>
</users>
</tenant>
</superTenant>
<tenants>
<tenant domain="wso2.com" key="wso2">
<admin>
<user key="admin">
<userName>admin</userName>
<password>admin</password>
</user>
</admin>
<users>
<user key="user1">
<userName>testuser11</userName>
<password>testuser11</password>
</user>
<user key="user2">
<userName>testuser21</userName>
<password>testuser21</password>
</user>
</users>
</tenant>
<tenant domain="abc.com" key="abc">
<admin>
<user key="admin">
<userName>admin</userName>
<password>admin</password>
</user>
</admin>
<users>
<user key="user1">
<userName>testuser11</userName>
<password>testuser11</password>
</user>
<user key="user2">
<userName>testuser21</userName>
<password>testuser21</password>
</user>
</users>
</tenant>
<tenant domain="malintha.com" key="malintha">
<admin>
<user key="admin">
<userName>admin</userName>
<password>admin</password>
</user>
</admin>
<users>
<user key="userm1">
<userName>testuse11</userName>
<password>testuse11</password>
</user>
<user key="userm2">
<userName>testuse21</userName>
<password>testuse21</password>
</user>
</users>
</tenant>
</tenants>
</userManagement>
<!--
This section will initiate the initial deployment of the platform required by
the test suites.
-->
<platform>
<!--
cluster instance details to be used to platform test execution
-->
<productGroup name="ESB" clusteringEnabled="false" default="true">
<instance name="lbw001" type="lb_worker_manager" nonBlockingTransportEnabled="true">
<hosts>
<host type="worker">esb.wso2con.com</host>
<host type="manager">mgt.esb.wso2con.com</host>
</hosts>
<ports>
<port type="nhttps">8243</port>
<port type="nhttp">8280</port>
</ports>
<properties>
</properties>
</instance>
<instance name="esbm001" type="manager" nonBlockingTransportEnabled="true">
<hosts>
<host type="default">localhost</host>
</hosts>
<ports>
<port type="http">9764</port>
<port type="https">9444</port>
<port type="nhttps">9446</port>
<port type="nhttp">8280</port>
</ports>
<properties>
</properties>
</instance>
<instance name="esbs001" type="standalone" nonBlockingTransportEnabled="true">
<hosts>
<host type="default">localhost</host>
</hosts>
<ports>
<port type="http">9763</port>
<port type="https">9443</port>
<port type="nhttps">8243</port>
<port type="nhttp">8280</port>
</ports>
<properties>
</properties>
</instance>
<instance name="esbw001" type="worker" nonBlockingTransportEnabled="true">
<hosts>
<host type="default">localhost</host>
</hosts>
<ports>
<port type="http">9765</port>
<port type="https">9445</port>
<port type="nhttps">9446</port>
<port type="nhttp">8280</port>
</ports>
<properties>
</properties>
</instance>
</productGroup>
</platform>
<listenerExtensions>
<!--<className>org.wso2.carbon.automation.extensions.servers.carbonserver.CarbonServerExtension</className>-->
<platformExecutionManager>
<extentionClasses>
<class>
<name>org.wso2.carbon.integration.common.extensions.carbonserver.CarbonServerExtension</name>
<!--<parameter name="-DportOffset" value="0" />-->
<!--<parameter name="cmdArg" value="debug 5005" />-->
</class>
<class>
<name>org.wso2.carbon.integration.common.extensions.usermgt.UserPopulateExtension</name>
</class>
<class>
<name>org.wso2.esb.integration.common.extensions.axis2server.Axis2ServerExtension</name>
</class>
</extentionClasses>
</platformExecutionManager>
<PlatformSuiteManager>
<extentionClasses>
<!--<className>org.wso2.carbon.automation.extensions.servers.carbonserver.CarbonServerExtension</className>-->
</extentionClasses>
</PlatformSuiteManager>
<PlatformAnnotationTransferManager>
<extentionClasses>
<!--<className>org.wso2.carbon.automation.extensions.servers.carbonserver.CarbonServerExtension</className>-->
</extentionClasses>
</PlatformAnnotationTransferManager>
<PlatformTestManager>
<extentionClasses>
</extentionClasses>
</PlatformTestManager>
<PlatformReportManager>
<extentionClasses>
</extentionClasses>
</PlatformReportManager>
</listenerExtensions>
</automation>_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev