Hi Hemika,

On Fri, Mar 6, 2015 at 5:21 PM, Hemika Kodikara <hem...@wso2.com> wrote:

> Hi All,
>
> I am working on a writing a test case for a clustered environment. I have
> a need to add users to write up the test case. I have hosted 2 nodes of MB
> a cluster externally.
>
> Correct me if I am wrong, currently the UserPopulationExtension does not
> work in adding up the users when it comes to clustered scenario. Therefore
> I am adding the users by code with the following implementation.
>

We assume user store is shared between nodes In a clustered environment,
and populate users to single node and done with it. Let us know if your
cluster is not sharing common user store.



>         Map<String, String> userNameAndPasswords = new HashMap<String,
> String>();
>         userNameAndPasswords.put("authUser1", "authUser1");
>         userNameAndPasswords.put("authUser2", "authUser2");
>         userNameAndPasswords.put("authUser3", "authUser3");
>         userNameAndPasswords.put("authUser4", "authUser4");
>         userNameAndPasswords.put("authUser5", "authUser5");
>
>         // Gets an MB instance randomly
>         AutomationContext randomMBInstanceAutomationContext =
> getAutomationContextWithKey(getRandomMBInstance());
>         // Logging into user management as admin
>         UserManagementClient userManagementClient = new
> UserManagementClient(randomMBInstanceAutomationContext.getContextUrls().getBackEndUrl(),
> "admin", "admin");
>
>         for (Map.Entry<String, String> userEntry :
> userNameAndPasswords.entrySet()) {
>             userManagementClient.addUser(userEntry.getKey(),
> userEntry.getValue(), new String[]{}, null);
>         }
>
>
> But I am getting the following error .
>
> initializeTestScenarios(org.wso2.mb.platform.tests.clustering.QueueUserAuthorizationTestCase)
>  Time elapsed: 2.373 sec  <<< FAILURE!
> org.wso2.carbon.user.mgt.stub.UserAdminUserAdminException:
> UserAdminUserAdminException
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> at
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
> at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
> at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
> at java.lang.Class.newInstance0(Class.java:357)
> at java.lang.Class.newInstance(Class.java:310)
> at
> org.wso2.carbon.user.mgt.stub.UserAdminStub.addUser(UserAdminStub.java:1575)
> at
> org.wso2.carbon.integration.common.admin.client.UserManagementClient.addUser(UserManagementClient.java:88)
> at
> org.wso2.mb.platform.tests.clustering.QueueUserAuthorizationTestCase.initializeTestScenarios(QueueUserAuthorizationTestCase.java:132)
>
> Any idea of what I am doing ?
>
> Also the 4th argument passed to
> "userManagementClient.addUser(userEntry.getKey(), userEntry.getValue(), new
> String[]{}, null);" is named as profile. May I know what is meant by
> profile[1] ?
>

Please refer - https://docs.wso2.com/display/IS500/Managing+User+Attributes

Thanks,
Krishantha.


>
> [1] -
> https://github.com/wso2/platform/blob/master/components/user-stores/org.wso2.carbon.user.store/src/main/java/org/wso2/carbon/user/store/UserStoreManager.java
>
> Regards,
> Hemika.
>
> Hemika Kodikara
> Software Engineer
> WSO2 Inc.
> lean . enterprise . middleware
> http://wso2.com
>
> Mobile : +94777688882
>



-- 
Krishantha Samaraweera
Senior Technical Lead - Test Automation
Mobile: +94 77 7759918
WSO2, Inc.; http://wso2.com/
lean . enterprise . middlewear.
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to