Hi,
Not using tenant key and user key was the reason for the previous
exception.
new AutomationContext("ESB","esbs001","wso2", "user1" ); worked fine.The issue that I have now is, to make the users log in and for them to act as inboundAdminClients. They should use inbound endpoints and send messages from a queue. Above scenario requires separate session keys and contexturls for each client. Such variables are assigned from the base class [1] init method. But the init methods use a default tenant users hence I can't use that method. Is it okay to create another init() method within that class as init(String instanceName, String tenantName, String userName) ..?? If not, can some one suggest what should be done exactly..?? [1] 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 On Wed, Jan 28, 2015 at 11:23 AM, Malintha Adikari <[email protected]> wrote: > Hi Pasadi, > > Can you share the code where you create AutomationContext objects ? Which > parameters you passed in to the constrictors ? > > Regards, > Malintha > > > > On Wed, Jan 28, 2015 at 5:41 AM, Pasadi Munasinghe <[email protected]> > wrote: > >> 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 >> > > > > -- > *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 > -- Pasadi Munasinghe Software Engineer Intern WSO2, Inc Mobile: +9471 377 5515
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
