Hi All,

I was able to find the issue. I have mistakenly forgotten to put Login
permission for that user. Later had trouble connecting to the stub. But
apparently it was an issue from my side.

Sorry for the late reply and trouble.

Thanks for the responses.

Thanks,
Hemika

Hemika Kodikara
Software Engineer
WSO2 Inc.
lean . enterprise . middleware
http://wso2.com

Mobile : +94777688882

On Fri, Jan 16, 2015 at 10:13 AM, Waruna Perera <waru...@wso2.com> wrote:

> Hi Hemika,
>
> Can you try the same thing in following manner as suggested below and see
> whether user can login.
>
> create UserManagementClient.
> login to tenant  using UserManagementClient
> create user with required permission via UserManagementClient
> login with created user
>
> Then we can pin point the issue. I have provided you with a code.
>
> private UserManagementClient userManagementClient;
>
> userManagementClient = new UserManagementClient(
>                 context.getContextUrls().getBackEndUrl(),
> context.getContextTenant().getContextUser().getUserName(),
>                 context.getContextTenant().getContextUser().getPassword());
>
> String subscriberUser = "subscriberUser";
>         String password = "password@123";
>         String accessToken;
>
>         if ((userManagementClient != null) &&
>
> !userManagementClient.userNameExists("Internal/subscriber",
> subscriberUser)) {
>             userManagementClient.addUser(subscriberUser, password,
>                     new String[]{"Internal/subscriber"}, null);
>         }
>
>
> [1]
> https://github.com/amalkasubasinghe/product-apim/blob/master/modules/integration/tests-integration/tests-scenario/src/test/java/org/wso2/carbon/am/tests/sample/JWTTestCase.java
>
> On Fri, Jan 16, 2015 at 9:00 AM, Saneth Dharmakeerthi <sane...@wso2.com>
> wrote:
>
>> Hi Hemika,
>>
>> Can you please check whether you can manually login to the server with 
>> permissionUser
>> by  putting a long sleep or debug point before the "String loginSession =
>> loginLogoutClient.login();", so we can verify that the users is correctly
>> created in the system with correct credential.
>>
>> Also please try with
>> org.wso2.carbon.automation.core.utils.LoginLogoutUtil.
>>
>>
>>
>> Thanks and Best Regards,
>>
>> Saneth Dharmakeerthi
>> Senior Software Engineer
>> WSO2, Inc.
>> Mobile: +94772325511
>>
>> On Fri, Jan 16, 2015 at 7:48 AM, Hemika Kodikara <hem...@wso2.com> wrote:
>>
>>> Hi Nuwan,
>>>
>>> Yes that is there as well. Attaching the automation.xml.
>>>
>>> Following gets printed on the console.
>>>
>>> Jan 16, 2015 1:25:18 AM
>>> org.wso2.carbon.integration.common.extensions.usermgt.UserPopulator
>>> addTenantUsers
>>> INFO: User - permissionUser created in tenant domain of  carbon.super
>>>
>>> Regards,
>>> Hemika
>>>
>>> Hemika Kodikara
>>> Software Engineer
>>> WSO2 Inc.
>>> lean . enterprise . middleware
>>> http://wso2.com
>>>
>>> Mobile : +94777688882
>>>
>>> On Fri, Jan 16, 2015 at 6:53 AM, Nuwan Wimalasekara <nuw...@wso2.com>
>>> wrote:
>>>
>>>> Hi
>>>> Can you please check whether the user is created on the server. In
>>>> order to create the user at the test execution time, you need to have the
>>>> UserPopulateExtension  in automation.xml
>>>>
>>>> <platformExecutionManager>
>>>> <extentionClasses>
>>>> <class>
>>>>
>>>> <name>org.wso2.carbon.integration.common.extensions.usermgt.UserPopulateExtension</name>
>>>> </class>
>>>> </extentionClasses>
>>>> </platformExecutionManager>
>>>>
>>>> Thanks,
>>>> Nuwanw
>>>>
>>>> On Thu, Jan 15, 2015 at 11:41 AM, Hemika Kodikara <hem...@wso2.com>
>>>> wrote:
>>>>
>>>>> Hi All,
>>>>>
>>>>> I am in the middle of writing a test case. I have a need to call a
>>>>> stub through a user. But unable to login to LoginLogoutClient through a
>>>>> user.
>>>>>
>>>>> With Admin, I am able to call the stub as follows.
>>>>>
>>>>> AutomationContext automationContext = new AutomationContext("MB",
>>>>> TestUserMode.SUPER_TENANT_ADMIN);
>>>>> LoginLogoutClient loginLogoutClient = new
>>>>> LoginLogoutClient(automationContext);
>>>>> String loginSession = loginLogoutClient.login();
>>>>> AndesAdminClient andesAdminClient = new AndesAdminClient(backendURL,
>>>>> loginSession,
>>>>> ConfigurationContextProvider.getInstance().getConfigurationContext());
>>>>> String queueName = destination.replace("queue", StringUtils.EMPTY);
>>>>> andesAdminClient.deleteQueue(queueName);
>>>>>
>>>>> But unable to connect through a user as follows.
>>>>>
>>>>> AutomationContext automationContext = new AutomationContext("MB",
>>>>> "mb001", FrameworkConstants.SUPER_TENANT_KEY, "permissionUser");
>>>>> LoginLogoutClient loginLogoutClient = new
>>>>> LoginLogoutClient(automationContext);
>>>>> String loginSession = loginLogoutClient.login();
>>>>> AndesAdminClient andesAdminClient = new AndesAdminClient(backendURL,
>>>>> loginSession,
>>>>> ConfigurationContextProvider.getInstance().getConfigurationContext());
>>>>> String queueName = destination.replace("queue", StringUtils.EMPTY);
>>>>> andesAdminClient.deleteQueue(queueName);
>>>>>
>>>>>
>>>>> Receiving the following error.
>>>>>
>>>>> performAllQueuePermissionCase(org.wso2.mb.integration.tests.amqp.functional.PermissionTreeTestCase)
>>>>>  Time elapsed: 10.821 sec  <<< FAILURE!
>>>>> org.wso2.carbon.authenticator.stub.LoginAuthenticationExceptionException:
>>>>> Login Unsuccessful. Return false as a login status by Server
>>>>> at
>>>>> org.wso2.carbon.integration.common.admin.client.AuthenticatorClient.login(AuthenticatorClient.java:61)
>>>>> at
>>>>> org.wso2.carbon.integration.common.utils.LoginLogoutClient.login(LoginLogoutClient.java:68)
>>>>> at
>>>>> org.wso2.mb.integration.tests.amqp.functional.PermissionTreeTestCase.performDelete(PermissionTreeTestCase.java:287)
>>>>> at
>>>>> org.wso2.mb.integration.tests.amqp.functional.PermissionTreeTestCase.performAllQueuePermissionCase(PermissionTreeTestCase.java:224)
>>>>>
>>>>>
>>>>> Following are user information and platform information from
>>>>> automation.xml
>>>>>
>>>>> <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>
>>>>>                     <user key="permissionUser">
>>>>>                         <userName>permissionUser</userName>
>>>>>                         <password>permissionUser</password>
>>>>>                     </user>
>>>>>                 </users>
>>>>>             </tenant>
>>>>>         </superTenant>
>>>>>
>>>>>
>>>>> <platform>
>>>>>         <!--
>>>>>         cluster instance details to be used to platform test execution
>>>>>         -->
>>>>>         <productGroup name="MB" clusteringEnabled="false"
>>>>> default="true">
>>>>>
>>>>>             <instance name="mb001" type="standalone"
>>>>> nonBlockingTransportEnabled="false">
>>>>>                 <hosts>
>>>>>                     <host type="default">localhost</host>
>>>>>                 </hosts>
>>>>>                 <ports>
>>>>>                     <port type="http">9763</port>
>>>>>                     <port type="https">9443</port>
>>>>>                 </ports>
>>>>>                 <properties>
>>>>>
>>>>>                 </properties>
>>>>>             </instance>
>>>>>         </productGroup>
>>>>>     </platform>
>>>>>
>>>>> Any help would be useful.
>>>>>
>>>>>
>>>>> Regards,
>>>>> Hemika
>>>>>
>>>>> Hemika Kodikara
>>>>> Software Engineer
>>>>> WSO2 Inc.
>>>>> lean . enterprise . middleware
>>>>> http://wso2.com
>>>>>
>>>>> Mobile : +94777688882
>>>>>
>>>>> _______________________________________________
>>>>> Dev mailing list
>>>>> Dev@wso2.org
>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Nuwan Wimalasekara
>>>> Senior Software Engineer - Test Automation
>>>> WSO2, Inc.: http://wso2.com
>>>> lean. enterprise. middleware
>>>>
>>>> phone: +94 71 668 4620
>>>>
>>>>
>>>>
>>>>
>>>
>>> _______________________________________________
>>> Dev mailing list
>>> Dev@wso2.org
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>> _______________________________________________
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> Waruna Perera
> Senior Software Engineer - Test Automation
> Mobile: +94 77 3867037
> 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