Re: [Dev] Issues while using Store REST API

2018-02-16 Thread Sivaramya Sivanathan
Thank you for the response. Now it's working with the WUM update pack.

Sivaramya Sivanathan
Associate Software Engineer | WSO2
Tel: 0770874960
WSO2 Inc : http://wso2.org
<http://www.google.com/url?q=http%3A%2F%2Fwso2.org&sa=D&sntz=1&usg=AFQjCNE_eTDfyl2ibPcq0hcXvRDNVuQmMg>
LinkedIn | www.linkedin.com/in/sivaramya

On Fri, Feb 16, 2018 at 12:30 PM, Malintha Amarasinghe 
wrote:

>
>
> On Fri, Feb 16, 2018 at 12:28 PM, Malintha Amarasinghe  > wrote:
>
>> Hi Sivaramya,
>>
>> On Fri, Feb 16, 2018 at 12:13 PM, Sivaramya Sivanathan <
>> sivara...@wso2.com> wrote:
>>
>>> Hi All,
>>>
>>> I followed the following steps,
>>>
>>> 1) Download the fresh package *wso2am-2.1.0*
>>>
>> This API is not included in the fresh pack. This is available in the
>> latest WUM update pack or one of the released updates (2.1.0-updateX). Take
>> the latest one if possible.
>>
>> On a seperate note, this doc need to be updated mentioning those
>> information.
>>
>> Thanks!
>>
>>
>>>
>>> 2) Obtain the *clientId* and *clientSecret* from the token endpoint and
>>>  then get the *access_token. * (*access_token* : 3abb5d89-ddea
>>> -39ae-aca4-c94ec3b4c1d1)
>>> 3) Send that access token as a header in the API call.
>>> 4) When I get the details of the application using the curl command as
>>> below.
>>> curl -k -H "Authorization: Bearer 
>>> 3abb5d89-ddea-39ae-aca4-c94ec3b4c1d1"
>>> "https://localhost:9443/api/am/store/v0.11/applications/a2dc
>>> 9825-8a75-42d5-b1d9-4987612ea8f5"
>>>
>>> I got the response as follows,
>>>
>>> {
>>>"applicationId":"a2dc9825-8a75-42d5-b1d9-4987612ea8f5",
>>>"name":"sampleapp",
>>>"subscriber":"admin",
>>>"throttlingTier":"Unlimited",
>>>"callbackUrl":"http://my.server.com/callback";,
>>>"description":"sample app description",
>>>"status":"APPROVED",
>>>"groupId":null,
>>> "keys":[{
>>>"consumerKey":"RhKMetERTwVWOd
>>> 9UvEU0v14Sflka","consumerSecret":"XWiufquXgT7MfEadNRDdtF_v1Q
>>> ga","supportedGrantTypes":null,"keyState":"COMPLETED","keyTy
>>> pe":"PRODUCTION",
>>>"token":{"accessToken":"58c1d
>>> 49f-7710-342e-85a9-b288f10ba323","tokenScopes":["am_applicat
>>> ion_scope","default"],"validityTime":3600}
>>> }]
>>> }
>>>
>>> 5) But when I used the following curl command to get the key details of
>>> a given type I didn't get any response messages as I mentioned above.
>>>curl -k -H "Authorization: Bearer 
>>> 3abb5d89-ddea-39ae-aca4-c94ec3b4c1d1"
>>> "https://localhost:9443/api/am/store/v0.11/applications/a2dc
>>> 9825-8a75-42d5-b1d9-4987612ea8f5/keys/PRODUCTION"
>>>
>>> Regards,
>>>
>>> Sivaramya Sivanathan
>>> Associate Software Engineer | WSO2
>>> Tel: 0770874960
>>> WSO2 Inc : http://wso2.org
>>> <http://www.google.com/url?q=http%3A%2F%2Fwso2.org&sa=D&sntz=1&usg=AFQjCNE_eTDfyl2ibPcq0hcXvRDNVuQmMg>
>>> LinkedIn | www.linkedin.com/in/sivaramya
>>>
>>> On Fri, Feb 16, 2018 at 10:40 AM, Menaka Jayawardena 
>>> wrote:
>>>
>>>> Hi Sivaramya,
>>>>
>>>> The basic information related to getting authorization code generation
>>>> is in the Getting Started section of the documentation. For every request
>>>> in the documentation, you have to follow the proper request format as
>>>> Viduranga has mentioned.
>>>>
>>>> @Documenatation Team
>>>> It's not clear in the API documentation because in Request section it
>>>> just says,
>>>>
>>>> GET https://localhost:9443/api/am/store/v0.11/apis
>>>>
>>>> There is no indication about the authorization header or the correct
>>>> curl. IMO it's better if we could restructure this documentation because it
>>>> will also be used by the other users as well. As this is an autogenerated
>>>> doc by the swagger file, we have to modify the swag

Re: [Dev] Issues while using Store REST API

2018-02-15 Thread Sivaramya Sivanathan
Hi All,

I followed the following steps,

1) Download the fresh package *wso2am-2.1.0*
2) Obtain the *clientId* and *clientSecret* from the token endpoint and
 then get the *access_token. * (*access_token* : 3abb5d89-
ddea-39ae-aca4-c94ec3b4c1d1)
3) Send that access token as a header in the API call.
4) When I get the details of the application using the curl command as
below.
curl -k -H "Authorization: Bearer 3abb5d89-ddea-39ae-aca4-c94ec3b4c1d1"
"https://localhost:9443/api/am/store/v0.11/applications/
a2dc9825-8a75-42d5-b1d9-4987612ea8f5"

I got the response as follows,

{
   "applicationId":"a2dc9825-8a75-42d5-b1d9-4987612ea8f5",
   "name":"sampleapp",
   "subscriber":"admin",
   "throttlingTier":"Unlimited",
   "callbackUrl":"http://my.server.com/callback";,
   "description":"sample app description",
   "status":"APPROVED",
   "groupId":null,
"keys":[{
   "consumerKey":"RhKMetERTwVWOd9UvEU0v14Sflka",
"consumerSecret":"XWiufquXgT7MfEadNRDdtF_v1Qga","supportedGrantTypes":null,"
keyState":"COMPLETED","keyType":"PRODUCTION",
   "token":{"accessToken":"58c1d49f-7710-
342e-85a9-b288f10ba323","tokenScopes":["am_application_scope","default"],"
validityTime":3600}
}]
}

5) But when I used the following curl command to get the key details of a
given type I didn't get any response messages as I mentioned above.
   curl -k -H "Authorization: Bearer 3abb5d89-ddea-39ae-aca4-c94ec3b4c1d1"
"https://localhost:9443/api/am/store/v0.11/applications/a2dc
9825-8a75-42d5-b1d9-4987612ea8f5/keys/PRODUCTION"

Regards,

Sivaramya Sivanathan
Associate Software Engineer | WSO2
Tel: 0770874960
WSO2 Inc : http://wso2.org
<http://www.google.com/url?q=http%3A%2F%2Fwso2.org&sa=D&sntz=1&usg=AFQjCNE_eTDfyl2ibPcq0hcXvRDNVuQmMg>
LinkedIn | www.linkedin.com/in/sivaramya

On Fri, Feb 16, 2018 at 10:40 AM, Menaka Jayawardena 
wrote:

> Hi Sivaramya,
>
> The basic information related to getting authorization code generation is
> in the Getting Started section of the documentation. For every request in
> the documentation, you have to follow the proper request format as
> Viduranga has mentioned.
>
> @Documenatation Team
> It's not clear in the API documentation because in Request section it just
> says,
>
> GET https://localhost:9443/api/am/store/v0.11/apis
>
> There is no indication about the authorization header or the correct curl.
> IMO it's better if we could restructure this documentation because it will
> also be used by the other users as well. As this is an autogenerated doc by
> the swagger file, we have to modify the swagger file with proper
> information.
>
> Thanks and Regards,
> Menaka
>
> On Fri, Feb 16, 2018 at 10:00 AM, Viduranga Gunarathne  > wrote:
>
>> Hi Sivaramya,
>>
>> I checked the store REST API and the specific resource to get the key
>> details of an individual application that you have mentioned and couldn't
>> replicate the issue that you stated.
>>
>> These are the steps that I followed.
>>
>> 1) Obtain the *clientId * and *clientSecret *from the token endpoint [1]
>> and then get the *accessToken *[1]
>> 2) Send that access token as a header in the API call
>> 3) This is the request path that I used
>>
>> *https://localhost:9443/api/am/store/v0.11/applications/0bb05b1b-7cde-4797-89bf-967f0fb6a856/keys/PRODUCTION
>> <https://localhost:9443/api/am/store/v0.11/applications/0bb05b1b-7cde-4797-89bf-967f0fb6a856/keys/PRODUCTION>*
>>
>>
>> Can you please state the exact steps that you followed?
>>
>> [1] https://docs.wso2.com/display/AM2xx/apidocs/store/index.html#guide
>>
>> Thanks,
>> Viduranga.
>>
>> On Thu, Feb 15, 2018 at 5:36 PM, Sivaramya Sivanathan > > wrote:
>>
>>> Hi all,
>>>
>>> I'm trying to use store REST API to do  the following operations using
>>> the curl command. But for these operations I'm unable to get the response
>>> (I'm getting empty response). But in APIM 2.1.0  console I'm getting the
>>> error as [5]. What could be the reason for this?
>>>
>>>- Get key details of a given type as in [1]
>>>- Get scopes associated with a particular application based on
>>>subscribed APIs as in [2]
>>>- Update grant types and callback url of an application as in [3]
>>>- 

[Dev] Issues while using Store REST API

2018-02-15 Thread Sivaramya Sivanathan
nvoke(AccessLogValve.java:958)
at
org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:57)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:452)
at
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1087)
at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1756)
at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1715)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)


Regards,
Sivaramya Sivanathan
Associate Software Engineer | WSO2
Tel: 0770874960
WSO2 Inc : http://wso2.org
<http://www.google.com/url?q=http%3A%2F%2Fwso2.org&sa=D&sntz=1&usg=AFQjCNE_eTDfyl2ibPcq0hcXvRDNVuQmMg>
LinkedIn | www.linkedin.com/in/sivaramya
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Setup the WebSocket security in msf4j WebSocket server

2017-12-08 Thread Sivaramya Sivanathan
Hi Irunika and Danesh,

Yes, it worked for me as Danesh suggested. Thank you.

Regards,

Sivaramya Sivanathan
Associate Software Engineer | WSO2
Tel: 0770874960
WSO2 Inc : http://wso2.org
<http://www.google.com/url?q=http%3A%2F%2Fwso2.org&sa=D&sntz=1&usg=AFQjCNE_eTDfyl2ibPcq0hcXvRDNVuQmMg>
LinkedIn | www.linkedin.com/in/sivaramya

On Fri, Dec 8, 2017 at 10:49 AM, Danesh Kuruppu  wrote:

> Hi Sivaramya,
>
> In order to make communication secured, we need to change netty
> configurations. netty configuration file format looks like [1]. If you
> running as standalone microservice, we need to give configuration file
> location as system property like below.
>
>  -Dtransports.netty.conf=
>
>
> 1. https://github.com/wso2/msf4j/blob/v2.4.2/distribution/
> binary/conf/netty-transports.yml
>
> Thanks
> Danesh
>
> On Fri, Dec 8, 2017 at 10:15 AM, SajithAR Ariyarathna 
> wrote:
>
>> [+ MSF4J & transport folks]
>>
>> Kindly requests your assistance on this.
>> Thanks.
>>
>> On Fri, Dec 8, 2017 at 10:12 AM, Sivaramya Sivanathan > > wrote:
>>
>>> Hi all,
>>>
>>> I am  using msf4j 2.4.3  WebSocket server for the siddhi-io-websocket
>>> unit test. Can anyone guide me how to setup the WebSocket security in msf4j
>>> WebSocket server?
>>>
>>> Thank you,
>>> Sivaramya Sivanathan
>>> Associate Software Engineer | WSO2
>>> Tel: 0770874960
>>> WSO2 Inc : http://wso2.org
>>> <http://www.google.com/url?q=http%3A%2F%2Fwso2.org&sa=D&sntz=1&usg=AFQjCNE_eTDfyl2ibPcq0hcXvRDNVuQmMg>
>>> LinkedIn | www.linkedin.com/in/sivaramya
>>>
>>
>>
>>
>> --
>> Sajith Janaprasad Ariyarathna
>> Senior Software Engineer; WSO2, Inc.;  http://wso2.com/
>> <https://wso2.com/signature>
>>
>
>
>
> --
>
> *Danesh Kuruppu*
> Senior Software Engineer | WSO2
>
> Email: dan...@wso2.com
> Mobile: +94 (77) 1690552 <+94%2077%20169%200552>
> Web: WSO2 Inc <https://wso2.com/signature>
>
>
> ___
> 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


[Dev] Setup the WebSocket security in msf4j WebSocket server

2017-12-07 Thread Sivaramya Sivanathan
Hi all,

I am  using msf4j 2.4.3  WebSocket server for the siddhi-io-websocket unit
test. Can anyone guide me how to setup the WebSocket security in msf4j
WebSocket server?

Thank you,
Sivaramya Sivanathan
Associate Software Engineer | WSO2
Tel: 0770874960
WSO2 Inc : http://wso2.org
<http://www.google.com/url?q=http%3A%2F%2Fwso2.org&sa=D&sntz=1&usg=AFQjCNE_eTDfyl2ibPcq0hcXvRDNVuQmMg>
LinkedIn | www.linkedin.com/in/sivaramya
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] Review the code for siddhi-io-websocket and siddhi-io-websocketservice

2017-10-29 Thread Sivaramya Sivanathan
Hi SajithAR,

I'm working on siddhi-io-websocket and siddhi-io-websocketservice using the
carbon transport. I've added the code in the following repo

[1] https://github.com/sivaramya/siddhi-io-websocket
[2] https://github.com/sivaramya/siddhi-io-websocketservice

Could you please check on this and let me know the feedback.

Regards,
Sivaramya Sivanathan
Associate Software Engineer | WSO2
Tel: 0770874960
WSO2 Inc : http://wso2.org
<http://www.google.com/url?q=http%3A%2F%2Fwso2.org&sa=D&sntz=1&usg=AFQjCNE_eTDfyl2ibPcq0hcXvRDNVuQmMg>
LinkedIn | www.linkedin.com/in/sivaramya
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] How to mock the CarbonContext?

2017-10-10 Thread Sivaramya Sivanathan
yes, this worked for me also

Sivaramya Sivanathan
Associate Software Engineer | WSO2
Tel: 0770874960
WSO2 Inc : http://wso2.org
<http://www.google.com/url?q=http%3A%2F%2Fwso2.org&sa=D&sntz=1&usg=AFQjCNE_eTDfyl2ibPcq0hcXvRDNVuQmMg>
LinkedIn | www.linkedin.com/in/sivaramya

On Tue, Oct 10, 2017 at 2:33 PM, Farasath Ahamed  wrote:

> Yes, this worked for me.
>
> System.setProperty("carbon.home", "");
> PrivilegedCarbonContext.startTenantFlow();
>
> Thereafter you can access 
> PrivilegedCarbonContext.getThreadLocalCarbonContext()
> as explained by KasunG
>
>
>
> Farasath Ahamed
> Software Engineer, WSO2 Inc.; http://wso2.com
> Mobile: +94777603866
> Blog: blog.farazath.com
> Twitter: @farazath619 <https://twitter.com/farazath619>
> <http://wso2.com/signature>
>
>
>
>
> On Tue, Oct 10, 2017 at 10:56 AM, KasunG Gajasinghe 
> wrote:
>
>>
>> Please note that you need to set the carbon.home system property before
>> initializing privilegedcarboncontext.
>>
>> System.setProperty("carbon.home", );
>>
>> On Thu, Oct 5, 2017 at 12:18 AM, KasunG Gajasinghe 
>> wrote:
>>
>>>
>>> CarbonContext is a thread-local variable. That means the carbon context
>>> can be accessible from anywhere within a given thread. So, you may not need
>>> to mock it!
>>>
>>> Since the test class and the testing class runs in the same thread, we
>>> can try to populate the CarbonContext in the @Test method before actual
>>> testing class invocations.
>>>
>>> Please see the following code example:
>>>
>>> @Test
>>> public void testSetClaimValue() throws Exception{
>>> try {
>>> PrivilegedCarbonContext.startTenantFlow();
>>> PrivilegedCarbonContext.getThreadLocalCarbonContext().setTen
>>> antDomain(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME);
>>> PrivilegedCarbonContext.getThreadLocalCarbonContext().setTen
>>> antId(MultitenantConstants.SUPER_TENANT_ID);
>>>
>>> //actual test code and assertions
>>>
>>> } finally {
>>> PrivilegedCarbonContext.endTenantFlow();
>>> }
>>>
>>> }
>>>
>>> We of course need to test this out. But I think this is ideal if this
>>> works.
>>>
>>>
>>>
>>> On Wed, Oct 4, 2017 at 10:42 PM, Dharshana Warusavitharana <
>>> dharsha...@wso2.com> wrote:
>>>
>>>> Hi Sivaramya,
>>>>
>>>> You dont have to mock the whole carbon context here. You can send a
>>>> mock payload when the particular method is called.
>>>>
>>>> Are you using powerMock + mockito if so do as the document sample in
>>>> [1].
>>>>
>>>> [1]. https://github.com/searls/mockito-testng-example/blob/m
>>>> aster/presentation/Mockito.pdf
>>>>
>>>> Thank you,
>>>> Dharshana.
>>>>
>>>>
>>>>
>>>> On Wed, Oct 4, 2017 at 9:55 PM, Malaka Silva  wrote:
>>>>
>>>>> +Dharshana
>>>>>
>>>>> On Wed, Oct 4, 2017 at 8:26 PM, Sivaramya Sivanathan <
>>>>> sivara...@wso2.com> wrote:
>>>>>
>>>>>> Hi all,
>>>>>>
>>>>>> Currently I am working on the unit testing for the esb-connector-jms
>>>>>> extension. For that I need to mock the CarbonContext for the method
>>>>>> CarbonContext.getThreadLocalCarbonContext().getTenantId(). But, I'm
>>>>>> unable mock the CarbonContext.
>>>>>> Can any one suggest me how can we mock the CarbonContext?
>>>>>>
>>>>>> Thanks,
>>>>>> Sivaramya Sivanathan
>>>>>> Associate Software Engineer | WSO2
>>>>>> Tel: 0770874960 <077%20087%204960>
>>>>>> WSO2 Inc : http://wso2.org
>>>>>> <http://www.google.com/url?q=http%3A%2F%2Fwso2.org&sa=D&sntz=1&usg=AFQjCNE_eTDfyl2ibPcq0hcXvRDNVuQmMg>
>>>>>> LinkedIn | www.linkedin.com/in/sivaramya
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>>
>>>>> Best Regards,
>>>>>
>>>>> Malaka Silva
>>>>> Associate Director / Architect
>>>>> M: +94 777 219 791 <077%20721%209791>
>>>>> Tel : 94 11 214 5345
>>>>> Fax :94 11 2145300 &l

[Dev] How to mock the CarbonContext?

2017-10-04 Thread Sivaramya Sivanathan
Hi all,

Currently I am working on the unit testing for the esb-connector-jms
extension. For that I need to mock the CarbonContext for the method
CarbonContext.getThreadLocalCarbonContext().getTenantId(). But, I'm unable
mock the CarbonContext.
Can any one suggest me how can we mock the CarbonContext?

Thanks,
Sivaramya Sivanathan
Associate Software Engineer | WSO2
Tel: 0770874960
WSO2 Inc : http://wso2.org
<http://www.google.com/url?q=http%3A%2F%2Fwso2.org&sa=D&sntz=1&usg=AFQjCNE_eTDfyl2ibPcq0hcXvRDNVuQmMg>
LinkedIn | www.linkedin.com/in/sivaramya
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev