Re: [Dev] Regarding the HTTP status code to be used if the response is invalid

2019-01-14 Thread Uvindra Dias Jayasinha
I think 422 is the most appropriate given your use case of validating if a
message matches a given schema. So you can receive a valid JSON or XML(it's
not malformed hence it is not a bad request(400)), but it may not match
with the message schema definition you are matching against.

The specs dont seem to talk about processing from the perspective of the
response. I guess you can use the same code used for the request.

On Wed, 9 Jan 2019 at 14:54, Shalki Wenushika  wrote:

> Hi all,
>
> This is related to the mail thread subjected as “[Architecture]API schema
> based request/response validator for Microgateway”. I’m validating
> requests/responses coming to the microgateway and send error messages to
> the client if the request/response is invalid.
>
> When a client sends a request to the microgateway if the request is
> invalid I’m sending an error message with the HTTP status code
> 422(Unprocessable entity) to the client. And also I’m doing the response
> validation. If the response coming from the backend is invalid I send an
> error message to the client. I need to know what will be the most
> appropriate HTTP status code to be included in the error if the response is
> invalid.
>
> Thank you!
>
> --
>
> *Shalki Wenushika*
> *Software Engineering Intern*
> WSO2  (University of Moratuwa)
> *mobile *: *+94 716792399* |   *email *:
> 
> wenush...@wso2.com
>
>
>
>

-- 
Regards,
Uvindra

Mobile: 33962
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] Regarding the HTTP status code to be used if the response is invalid

2019-01-14 Thread Shalki Wenushika
Hi all,

This is related to the mail thread subjected as “[Architecture]API schema
based request/response validator for Microgateway”. I’m validating
requests/responses coming to the microgateway and send error messages to
the client if the request/response is invalid.

When a client sends a request to the microgateway if the request is invalid
I’m sending an error message with the HTTP status code 422(Unprocessable
entity) to the client. And also I’m doing the response validation. If the
response coming from the backend is invalid I send an error message to the
client. I need to know what will be the most appropriate HTTP status code
to be included in the error if the response is invalid.

Thank you!

-- 

*Shalki Wenushika*
*Software Engineering Intern*
WSO2  (University of Moratuwa)
*mobile *: *+94 716792399* |   *email *:

wenush...@wso2.com
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Avro mapper not working with SP

2019-01-14 Thread Shafana Safwan
Hi Suho,

Samples are done and PR is merged.

Thank you.

Regards,

On Wed, Jan 9, 2019 at 9:03 AM Tishan Dahanayakage  wrote:

> Hi Shafana,
>
> Added a comment. Please check.
>
> On Wed, Jan 9, 2019 at 12:41 AM Shafana Safwan  wrote:
>
>> Hi Tishan,
>>
>> Please merge my PR on Avro mapper samples for product sp.
>>
>> https://github.com/wso2/product-sp/pull/906
>>
>> Thank you.
>> Regards,
>>
>> On Tue, Jan 8, 2019 at 5:49 PM Shafana Safwan  wrote:
>>
>>> +1
>>>
>>> -- Forwarded message -
>>> From: Shafana Safwan 
>>> Date: Tue, 8 Jan 2019, 09:32
>>> Subject: Re: Avro mapper not working with SP
>>> To: Suhothayan Sriskandarajah 
>>>
>>>
>>> Hi suho,
>>>
>>> I am almost done with it. Will put the PR today.
>>>
>>> Thank you.
>>>
>>>
>>> On Tue, 8 Jan 2019, 00:10 Sriskandarajah Suhothayan, 
>>> wrote:
>>>
 Any update on this?


 On Fri, Jan 4, 2019 at 5:02 PM Sriskandarajah Suhothayan 
 wrote:

> Thanks a lot.
>
> On Fri, Jan 4, 2019 at 4:21 PM Shafana Safwan 
> wrote:
>
>> Hi Suho,
>>
>> I will get the avro mapper sample ready by next week.
>>
>> Thank you.
>>
>> On Fri, Jan 4, 2019 at 2:21 PM Sriskandarajah Suhothayan <
>> s...@wso2.com> wrote:
>>
>>> Please inform the team get this done, and continue the team's work!
>>>
>>> Suho
>>>
>>> On Fri, Jan 4, 2019 at 1:46 PM Shafana Safwan 
>>> wrote:
>>>
 Hi,

 I am in working in Installation Experience team.

 On Fri, Jan 4, 2019 at 1:14 PM Sriskandarajah Suhothayan <
 s...@wso2.com> wrote:

> Can you finish this first and move to the development as it has
> delayed for a long time already.
> This might need only about 2 days, is it?
> What team are you working on?
>
> On Fri, Jan 4, 2019 at 1:12 PM Shafana Safwan 
> wrote:
>
>> Hi Suho,
>>
>> I have fixed the above issue and made sure it will not occur
>> again. Now Avro mapper can be used without any problem.
>> No additional jars are need to be added.
>>
>> I have started working on writing a sample on avro mapper for SP.
>> But I would need some time, since I am currently working on some
>> developments in my team as well.
>>
>> Thank you.
>> Regards,
>> --
>> *Shafana Safwan*
>> Software Engineer
>> WSO2
>> lean . enterprise . middleware
>> Mobile : +94(0) 754515687
>> 
>>
>>
>> On Mon, Dec 10, 2018 at 10:28 AM Shafana Safwan 
>> wrote:
>>
>>> Hi Suho,
>>>
>>> Will do ASAP.
>>>
>>> Regards,
>>> Shafana
>>>
>>> On Sun, Dec 9, 2018 at 8:08 PM Sriskandarajah Suhothayan <
>>> s...@wso2.com> wrote:
>>>
 Please share the doc how to use SP with Kafka and avro registry.

 Regards
 Suho

 On Sun, Dec 9, 2018 at 12:07 PM Sriskandarajah Suhothayan <
 s...@wso2.com> wrote:

> Hi Shafana
>
> When I add the latest Avro mapper it's throwing the following
> exception:
>
> org.osgi.framework.BundleException: Could not resolve module:
> siddhi-map-avro [146]
>   Unresolved requirement: Import-Package:
> org.apache.tapestry5.json
> at org.eclipse.osgi.container.Module.start(Module.java:444)
> at
> org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:383)
> at
> org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:402)
> at
> org.eclipse.equinox.internal.simpleconfigurator.ConfigApplier.startBundles(ConfigApplier.java:453)
> at
> org.eclipse.equinox.internal.simpleconfigurator.ConfigApplier.install(ConfigApplier.java:111)
> at
> org.eclipse.equinox.internal.simpleconfigurator.SimpleConfiguratorImpl.applyConfiguration(SimpleConfiguratorImpl.java:191)
> at
> org.eclipse.equinox.internal.simpleconfigurator.SimpleConfiguratorImpl.applyConfiguration(SimpleConfiguratorImpl.java:205)
> at
> org.eclipse.equinox.internal.simpleconfigurator.Activator.start(Activator.java:60)
> at
> org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:774)
> at
> org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:1)
> at java.security.AccessController.doPrivileged(Native Method)
> at
> org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(

Re: [Dev] Avro mapper not working with SP

2019-01-14 Thread Tishan Dahanayakage
Hi Shafana,

Added a comment. Please check.

On Wed, Jan 9, 2019 at 12:41 AM Shafana Safwan  wrote:

> Hi Tishan,
>
> Please merge my PR on Avro mapper samples for product sp.
>
> https://github.com/wso2/product-sp/pull/906
>
> Thank you.
> Regards,
>
> On Tue, Jan 8, 2019 at 5:49 PM Shafana Safwan  wrote:
>
>> +1
>>
>> -- Forwarded message -
>> From: Shafana Safwan 
>> Date: Tue, 8 Jan 2019, 09:32
>> Subject: Re: Avro mapper not working with SP
>> To: Suhothayan Sriskandarajah 
>>
>>
>> Hi suho,
>>
>> I am almost done with it. Will put the PR today.
>>
>> Thank you.
>>
>>
>> On Tue, 8 Jan 2019, 00:10 Sriskandarajah Suhothayan, 
>> wrote:
>>
>>> Any update on this?
>>>
>>>
>>> On Fri, Jan 4, 2019 at 5:02 PM Sriskandarajah Suhothayan 
>>> wrote:
>>>
 Thanks a lot.

 On Fri, Jan 4, 2019 at 4:21 PM Shafana Safwan  wrote:

> Hi Suho,
>
> I will get the avro mapper sample ready by next week.
>
> Thank you.
>
> On Fri, Jan 4, 2019 at 2:21 PM Sriskandarajah Suhothayan <
> s...@wso2.com> wrote:
>
>> Please inform the team get this done, and continue the team's work!
>>
>> Suho
>>
>> On Fri, Jan 4, 2019 at 1:46 PM Shafana Safwan 
>> wrote:
>>
>>> Hi,
>>>
>>> I am in working in Installation Experience team.
>>>
>>> On Fri, Jan 4, 2019 at 1:14 PM Sriskandarajah Suhothayan <
>>> s...@wso2.com> wrote:
>>>
 Can you finish this first and move to the development as it has
 delayed for a long time already.
 This might need only about 2 days, is it?
 What team are you working on?

 On Fri, Jan 4, 2019 at 1:12 PM Shafana Safwan 
 wrote:

> Hi Suho,
>
> I have fixed the above issue and made sure it will not occur
> again. Now Avro mapper can be used without any problem.
> No additional jars are need to be added.
>
> I have started working on writing a sample on avro mapper for SP.
> But I would need some time, since I am currently working on some
> developments in my team as well.
>
> Thank you.
> Regards,
> --
> *Shafana Safwan*
> Software Engineer
> WSO2
> lean . enterprise . middleware
> Mobile : +94(0) 754515687
> 
>
>
> On Mon, Dec 10, 2018 at 10:28 AM Shafana Safwan 
> wrote:
>
>> Hi Suho,
>>
>> Will do ASAP.
>>
>> Regards,
>> Shafana
>>
>> On Sun, Dec 9, 2018 at 8:08 PM Sriskandarajah Suhothayan <
>> s...@wso2.com> wrote:
>>
>>> Please share the doc how to use SP with Kafka and avro registry.
>>>
>>> Regards
>>> Suho
>>>
>>> On Sun, Dec 9, 2018 at 12:07 PM Sriskandarajah Suhothayan <
>>> s...@wso2.com> wrote:
>>>
 Hi Shafana

 When I add the latest Avro mapper it's throwing the following
 exception:

 org.osgi.framework.BundleException: Could not resolve module:
 siddhi-map-avro [146]
   Unresolved requirement: Import-Package:
 org.apache.tapestry5.json
 at org.eclipse.osgi.container.Module.start(Module.java:444)
 at
 org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:383)
 at
 org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:402)
 at
 org.eclipse.equinox.internal.simpleconfigurator.ConfigApplier.startBundles(ConfigApplier.java:453)
 at
 org.eclipse.equinox.internal.simpleconfigurator.ConfigApplier.install(ConfigApplier.java:111)
 at
 org.eclipse.equinox.internal.simpleconfigurator.SimpleConfiguratorImpl.applyConfiguration(SimpleConfiguratorImpl.java:191)
 at
 org.eclipse.equinox.internal.simpleconfigurator.SimpleConfiguratorImpl.applyConfiguration(SimpleConfiguratorImpl.java:205)
 at
 org.eclipse.equinox.internal.simpleconfigurator.Activator.start(Activator.java:60)
 at
 org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:774)
 at
 org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:1)
 at java.security.AccessController.doPrivileged(Native Method)
 at
 org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:767)
 at
 org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:724)
 at
 org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:932)
 at
>>

Re: [Dev] Avro mapper not working with SP

2019-01-14 Thread Shafana Safwan
Hi Tishan,

Please merge my PR on Avro mapper samples for product sp.

https://github.com/wso2/product-sp/pull/906

Thank you.
Regards,

On Tue, Jan 8, 2019 at 5:49 PM Shafana Safwan  wrote:

> +1
>
> -- Forwarded message -
> From: Shafana Safwan 
> Date: Tue, 8 Jan 2019, 09:32
> Subject: Re: Avro mapper not working with SP
> To: Suhothayan Sriskandarajah 
>
>
> Hi suho,
>
> I am almost done with it. Will put the PR today.
>
> Thank you.
>
>
> On Tue, 8 Jan 2019, 00:10 Sriskandarajah Suhothayan, 
> wrote:
>
>> Any update on this?
>>
>>
>> On Fri, Jan 4, 2019 at 5:02 PM Sriskandarajah Suhothayan 
>> wrote:
>>
>>> Thanks a lot.
>>>
>>> On Fri, Jan 4, 2019 at 4:21 PM Shafana Safwan  wrote:
>>>
 Hi Suho,

 I will get the avro mapper sample ready by next week.

 Thank you.

 On Fri, Jan 4, 2019 at 2:21 PM Sriskandarajah Suhothayan 
 wrote:

> Please inform the team get this done, and continue the team's work!
>
> Suho
>
> On Fri, Jan 4, 2019 at 1:46 PM Shafana Safwan 
> wrote:
>
>> Hi,
>>
>> I am in working in Installation Experience team.
>>
>> On Fri, Jan 4, 2019 at 1:14 PM Sriskandarajah Suhothayan <
>> s...@wso2.com> wrote:
>>
>>> Can you finish this first and move to the development as it has
>>> delayed for a long time already.
>>> This might need only about 2 days, is it?
>>> What team are you working on?
>>>
>>> On Fri, Jan 4, 2019 at 1:12 PM Shafana Safwan 
>>> wrote:
>>>
 Hi Suho,

 I have fixed the above issue and made sure it will not occur again.
 Now Avro mapper can be used without any problem.
 No additional jars are need to be added.

 I have started working on writing a sample on avro mapper for SP.
 But I would need some time, since I am currently working on some
 developments in my team as well.

 Thank you.
 Regards,
 --
 *Shafana Safwan*
 Software Engineer
 WSO2
 lean . enterprise . middleware
 Mobile : +94(0) 754515687
 


 On Mon, Dec 10, 2018 at 10:28 AM Shafana Safwan 
 wrote:

> Hi Suho,
>
> Will do ASAP.
>
> Regards,
> Shafana
>
> On Sun, Dec 9, 2018 at 8:08 PM Sriskandarajah Suhothayan <
> s...@wso2.com> wrote:
>
>> Please share the doc how to use SP with Kafka and avro registry.
>>
>> Regards
>> Suho
>>
>> On Sun, Dec 9, 2018 at 12:07 PM Sriskandarajah Suhothayan <
>> s...@wso2.com> wrote:
>>
>>> Hi Shafana
>>>
>>> When I add the latest Avro mapper it's throwing the following
>>> exception:
>>>
>>> org.osgi.framework.BundleException: Could not resolve module:
>>> siddhi-map-avro [146]
>>>   Unresolved requirement: Import-Package:
>>> org.apache.tapestry5.json
>>> at org.eclipse.osgi.container.Module.start(Module.java:444)
>>> at
>>> org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:383)
>>> at
>>> org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:402)
>>> at
>>> org.eclipse.equinox.internal.simpleconfigurator.ConfigApplier.startBundles(ConfigApplier.java:453)
>>> at
>>> org.eclipse.equinox.internal.simpleconfigurator.ConfigApplier.install(ConfigApplier.java:111)
>>> at
>>> org.eclipse.equinox.internal.simpleconfigurator.SimpleConfiguratorImpl.applyConfiguration(SimpleConfiguratorImpl.java:191)
>>> at
>>> org.eclipse.equinox.internal.simpleconfigurator.SimpleConfiguratorImpl.applyConfiguration(SimpleConfiguratorImpl.java:205)
>>> at
>>> org.eclipse.equinox.internal.simpleconfigurator.Activator.start(Activator.java:60)
>>> at
>>> org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:774)
>>> at
>>> org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:1)
>>> at java.security.AccessController.doPrivileged(Native Method)
>>> at
>>> org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:767)
>>> at
>>> org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:724)
>>> at
>>> org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:932)
>>> at
>>> org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:309)
>>> at org.eclipse.osgi.container.Module.doStart(Module.java:581)
>>> at org.eclipse.osgi.container.Module.start(Module.java:449)
>>> at
>

[Dev] Fwd: Avro mapper not working with SP

2019-01-14 Thread Shafana Safwan
+1

-- Forwarded message -
From: Shafana Safwan 
Date: Tue, 8 Jan 2019, 09:32
Subject: Re: Avro mapper not working with SP
To: Suhothayan Sriskandarajah 


Hi suho,

I am almost done with it. Will put the PR today.

Thank you.


On Tue, 8 Jan 2019, 00:10 Sriskandarajah Suhothayan,  wrote:

> Any update on this?
>
>
> On Fri, Jan 4, 2019 at 5:02 PM Sriskandarajah Suhothayan 
> wrote:
>
>> Thanks a lot.
>>
>> On Fri, Jan 4, 2019 at 4:21 PM Shafana Safwan  wrote:
>>
>>> Hi Suho,
>>>
>>> I will get the avro mapper sample ready by next week.
>>>
>>> Thank you.
>>>
>>> On Fri, Jan 4, 2019 at 2:21 PM Sriskandarajah Suhothayan 
>>> wrote:
>>>
 Please inform the team get this done, and continue the team's work!

 Suho

 On Fri, Jan 4, 2019 at 1:46 PM Shafana Safwan  wrote:

> Hi,
>
> I am in working in Installation Experience team.
>
> On Fri, Jan 4, 2019 at 1:14 PM Sriskandarajah Suhothayan <
> s...@wso2.com> wrote:
>
>> Can you finish this first and move to the development as it has
>> delayed for a long time already.
>> This might need only about 2 days, is it?
>> What team are you working on?
>>
>> On Fri, Jan 4, 2019 at 1:12 PM Shafana Safwan 
>> wrote:
>>
>>> Hi Suho,
>>>
>>> I have fixed the above issue and made sure it will not occur again.
>>> Now Avro mapper can be used without any problem.
>>> No additional jars are need to be added.
>>>
>>> I have started working on writing a sample on avro mapper for SP.
>>> But I would need some time, since I am currently working on some
>>> developments in my team as well.
>>>
>>> Thank you.
>>> Regards,
>>> --
>>> *Shafana Safwan*
>>> Software Engineer
>>> WSO2
>>> lean . enterprise . middleware
>>> Mobile : +94(0) 754515687
>>> 
>>>
>>>
>>> On Mon, Dec 10, 2018 at 10:28 AM Shafana Safwan 
>>> wrote:
>>>
 Hi Suho,

 Will do ASAP.

 Regards,
 Shafana

 On Sun, Dec 9, 2018 at 8:08 PM Sriskandarajah Suhothayan <
 s...@wso2.com> wrote:

> Please share the doc how to use SP with Kafka and avro registry.
>
> Regards
> Suho
>
> On Sun, Dec 9, 2018 at 12:07 PM Sriskandarajah Suhothayan <
> s...@wso2.com> wrote:
>
>> Hi Shafana
>>
>> When I add the latest Avro mapper it's throwing the following
>> exception:
>>
>> org.osgi.framework.BundleException: Could not resolve module:
>> siddhi-map-avro [146]
>>   Unresolved requirement: Import-Package:
>> org.apache.tapestry5.json
>> at org.eclipse.osgi.container.Module.start(Module.java:444)
>> at
>> org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:383)
>> at
>> org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:402)
>> at
>> org.eclipse.equinox.internal.simpleconfigurator.ConfigApplier.startBundles(ConfigApplier.java:453)
>> at
>> org.eclipse.equinox.internal.simpleconfigurator.ConfigApplier.install(ConfigApplier.java:111)
>> at
>> org.eclipse.equinox.internal.simpleconfigurator.SimpleConfiguratorImpl.applyConfiguration(SimpleConfiguratorImpl.java:191)
>> at
>> org.eclipse.equinox.internal.simpleconfigurator.SimpleConfiguratorImpl.applyConfiguration(SimpleConfiguratorImpl.java:205)
>> at
>> org.eclipse.equinox.internal.simpleconfigurator.Activator.start(Activator.java:60)
>> at
>> org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:774)
>> at
>> org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:1)
>> at java.security.AccessController.doPrivileged(Native Method)
>> at
>> org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:767)
>> at
>> org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:724)
>> at
>> org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:932)
>> at
>> org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:309)
>> at org.eclipse.osgi.container.Module.doStart(Module.java:581)
>> at org.eclipse.osgi.container.Module.start(Module.java:449)
>> at
>> org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:383)
>> at
>> org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:402)
>> at
>> org.wso2.carbon.launcher.CarbonServer.loadInitialBundles(CarbonServer.java:242)
>> at
>> org.wso2.carbon.launcher.CarbonSe

Re: [Dev] Avro mapper not working with SP

2019-01-14 Thread Sriskandarajah Suhothayan
Any update on this?


On Fri, Jan 4, 2019 at 5:02 PM Sriskandarajah Suhothayan 
wrote:

> Thanks a lot.
>
> On Fri, Jan 4, 2019 at 4:21 PM Shafana Safwan  wrote:
>
>> Hi Suho,
>>
>> I will get the avro mapper sample ready by next week.
>>
>> Thank you.
>>
>> On Fri, Jan 4, 2019 at 2:21 PM Sriskandarajah Suhothayan 
>> wrote:
>>
>>> Please inform the team get this done, and continue the team's work!
>>>
>>> Suho
>>>
>>> On Fri, Jan 4, 2019 at 1:46 PM Shafana Safwan  wrote:
>>>
 Hi,

 I am in working in Installation Experience team.

 On Fri, Jan 4, 2019 at 1:14 PM Sriskandarajah Suhothayan 
 wrote:

> Can you finish this first and move to the development as it has
> delayed for a long time already.
> This might need only about 2 days, is it?
> What team are you working on?
>
> On Fri, Jan 4, 2019 at 1:12 PM Shafana Safwan 
> wrote:
>
>> Hi Suho,
>>
>> I have fixed the above issue and made sure it will not occur again.
>> Now Avro mapper can be used without any problem.
>> No additional jars are need to be added.
>>
>> I have started working on writing a sample on avro mapper for SP. But
>> I would need some time, since I am currently working on some developments
>> in my team as well.
>>
>> Thank you.
>> Regards,
>> --
>> *Shafana Safwan*
>> Software Engineer
>> WSO2
>> lean . enterprise . middleware
>> Mobile : +94(0) 754515687
>> 
>>
>>
>> On Mon, Dec 10, 2018 at 10:28 AM Shafana Safwan 
>> wrote:
>>
>>> Hi Suho,
>>>
>>> Will do ASAP.
>>>
>>> Regards,
>>> Shafana
>>>
>>> On Sun, Dec 9, 2018 at 8:08 PM Sriskandarajah Suhothayan <
>>> s...@wso2.com> wrote:
>>>
 Please share the doc how to use SP with Kafka and avro registry.

 Regards
 Suho

 On Sun, Dec 9, 2018 at 12:07 PM Sriskandarajah Suhothayan <
 s...@wso2.com> wrote:

> Hi Shafana
>
> When I add the latest Avro mapper it's throwing the following
> exception:
>
> org.osgi.framework.BundleException: Could not resolve module:
> siddhi-map-avro [146]
>   Unresolved requirement: Import-Package: org.apache.tapestry5.json
> at org.eclipse.osgi.container.Module.start(Module.java:444)
> at
> org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:383)
> at
> org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:402)
> at
> org.eclipse.equinox.internal.simpleconfigurator.ConfigApplier.startBundles(ConfigApplier.java:453)
> at
> org.eclipse.equinox.internal.simpleconfigurator.ConfigApplier.install(ConfigApplier.java:111)
> at
> org.eclipse.equinox.internal.simpleconfigurator.SimpleConfiguratorImpl.applyConfiguration(SimpleConfiguratorImpl.java:191)
> at
> org.eclipse.equinox.internal.simpleconfigurator.SimpleConfiguratorImpl.applyConfiguration(SimpleConfiguratorImpl.java:205)
> at
> org.eclipse.equinox.internal.simpleconfigurator.Activator.start(Activator.java:60)
> at
> org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:774)
> at
> org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:1)
> at java.security.AccessController.doPrivileged(Native Method)
> at
> org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:767)
> at
> org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:724)
> at
> org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:932)
> at
> org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:309)
> at org.eclipse.osgi.container.Module.doStart(Module.java:581)
> at org.eclipse.osgi.container.Module.start(Module.java:449)
> at
> org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:383)
> at
> org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:402)
> at
> org.wso2.carbon.launcher.CarbonServer.loadInitialBundles(CarbonServer.java:242)
> at
> org.wso2.carbon.launcher.CarbonServer.start(CarbonServer.java:83)
> at org.wso2.carbon.launcher.Main.main(Main.java:84)
>
> Can you please update the Avro documentation home page with the
> relevant other jars we need to add with this to make it work on SP.
>
> Regards
> Suho
> --
> *S. Suhothayan* | Director | WSO2 Inc. 
> (m) (+94) 779 756 757 | (e) s...@wso2.com | (t) @suhothayan
> 

Re: [Dev] Test fails due to NoClassDefFoundError: Could not initialize class

2019-01-14 Thread Uvindra Dias Jayasinha
Since this is a unit test you have no option but to use power mock in order
to mock the PrivilegedCarbonContext.endTenantFlow() static function using
PowerMockito.mockStatic. I think we must be doing this already, not sure
why the test is suddenly failing. We have done this in APIProviderImplTest.

If you dont want to use power mock you will need to refactor the original
code to prevent calling the static function directly.

On Mon, 7 Jan 2019 at 13:16, Ishara Cooray  wrote:

> Hi,
> I am running into below error [1] while using below code snippet.
>
>> AuthorizationGrantCacheEntry cacheEntry = 
>> AuthorizationGrantCache.getInstance().getValueFromCacheByToken(cacheKey);
>> if (cacheEntry == null) {
>> return new HashMap();
>> }
>> Map userAttributes = cacheEntry.getUserAttributes();
>> Map userClaims = new HashMap();
>> for (Map.Entry entry : userAttributes.entrySet()) {
>> userClaims.put(entry.getKey().getRemoteClaim().getClaimUri(), 
>> entry.getValue());
>> }
>>
>>
> Because It fails to access PrivilegedCarbonContext at
>
> * PrivilegedCarbonContext.endTenantFlow();*
> This looks to me a concurrency access issue. *Does anyone has an idea of
> fixing this without using powermock?*
> If i use power mock , *it also fails Prepare classes for test at *
> @PrepareForTest()
>
>  PrivilegedCarbonContext.endTenantFlow();
>
>
> public V getValueFromCache(K key) {
>> if (!isEnabled()) {
>> return null;
>> }
>>
>> if(key == null) {
>> return null;
>> }
>>
>> try {
>> PrivilegedCarbonContext.startTenantFlow();
>> PrivilegedCarbonContext carbonContext = PrivilegedCarbonContext
>> .getThreadLocalCarbonContext();
>> carbonContext.setTenantId(MultitenantConstants.SUPER_TENANT_ID);
>> 
>> carbonContext.setTenantDomain(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME);
>> Cache cache = getBaseCache();
>> if (cache != null && cache.get(key) != null) {
>> return (V) cache.get(key);
>> }
>> return null;
>> } finally {
>> PrivilegedCarbonContext.endTenantFlow();
>> }
>> }
>>
>> Need to fix the test case without using powermock.
>
>
> [1]
> testAbstractJWTGenerator(org.wso2.carbon.apimgt.keymgt.token.TokenGenTest)
> Time elapsed: 0 sec  <<< ERROR!
> java.lang.NoClassDefFoundError: Could not initialize class
> org.wso2.carbon.context.PrivilegedCarbonContext
> at
> org.wso2.carbon.identity.application.common.cache.BaseCache.getValueFromCache(BaseCache.java:158)
> at
> org.wso2.carbon.identity.oauth.cache.AuthorizationGrantCache.getValueFromCacheByToken(AuthorizationGrantCache.java:86)
> at
> org.wso2.carbon.apimgt.keymgt.token.JWTGenerator.getClaimsFromCache(JWTGenerator.java:129)
> at
> org.wso2.carbon.apimgt.keymgt.token.JWTGenerator.populateCustomClaims(JWTGenerator.java:98)
> at
> org.wso2.carbon.apimgt.keymgt.token.AbstractJWTGenerator.buildBody(AbstractJWTGenerator.java:190)
> at
> org.wso2.carbon.apimgt.keymgt.token.AbstractJWTGenerator.generateToken(AbstractJWTGenerator.java:143)
> at
> org.wso2.carbon.apimgt.keymgt.token.TokenGenTest.testAbstractJWTGenerator(TokenGenTest.java:81)
>
> Thanks & Regards,
> Ishara Cooray
> Senior Software Engineer
> Mobile : +9477 262 9512
> WSO2, Inc. | http://wso2.com/
> Lean . Enterprise . Middleware
>


-- 
Regards,
Uvindra

Mobile: 33962
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] Test fails due to NoClassDefFoundError: Could not initialize class

2019-01-14 Thread Ishara Cooray
Hi,
I am running into below error [1] while using below code snippet.

> AuthorizationGrantCacheEntry cacheEntry = 
> AuthorizationGrantCache.getInstance().getValueFromCacheByToken(cacheKey);
> if (cacheEntry == null) {
> return new HashMap();
> }
> Map userAttributes = cacheEntry.getUserAttributes();
> Map userClaims = new HashMap();
> for (Map.Entry entry : userAttributes.entrySet()) {
> userClaims.put(entry.getKey().getRemoteClaim().getClaimUri(), 
> entry.getValue());
> }
>
>
Because It fails to access PrivilegedCarbonContext at

* PrivilegedCarbonContext.endTenantFlow();*
This looks to me a concurrency access issue. *Does anyone has an idea of
fixing this without using powermock?*
If i use power mock , *it also fails Prepare classes for test at *
@PrepareForTest()

 PrivilegedCarbonContext.endTenantFlow();


public V getValueFromCache(K key) {
> if (!isEnabled()) {
> return null;
> }
>
> if(key == null) {
> return null;
> }
>
> try {
> PrivilegedCarbonContext.startTenantFlow();
> PrivilegedCarbonContext carbonContext = PrivilegedCarbonContext
> .getThreadLocalCarbonContext();
> carbonContext.setTenantId(MultitenantConstants.SUPER_TENANT_ID);
> 
> carbonContext.setTenantDomain(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME);
> Cache cache = getBaseCache();
> if (cache != null && cache.get(key) != null) {
> return (V) cache.get(key);
> }
> return null;
> } finally {
> PrivilegedCarbonContext.endTenantFlow();
> }
> }
>
> Need to fix the test case without using powermock.


[1]
testAbstractJWTGenerator(org.wso2.carbon.apimgt.keymgt.token.TokenGenTest)
Time elapsed: 0 sec  <<< ERROR!
java.lang.NoClassDefFoundError: Could not initialize class
org.wso2.carbon.context.PrivilegedCarbonContext
at
org.wso2.carbon.identity.application.common.cache.BaseCache.getValueFromCache(BaseCache.java:158)
at
org.wso2.carbon.identity.oauth.cache.AuthorizationGrantCache.getValueFromCacheByToken(AuthorizationGrantCache.java:86)
at
org.wso2.carbon.apimgt.keymgt.token.JWTGenerator.getClaimsFromCache(JWTGenerator.java:129)
at
org.wso2.carbon.apimgt.keymgt.token.JWTGenerator.populateCustomClaims(JWTGenerator.java:98)
at
org.wso2.carbon.apimgt.keymgt.token.AbstractJWTGenerator.buildBody(AbstractJWTGenerator.java:190)
at
org.wso2.carbon.apimgt.keymgt.token.AbstractJWTGenerator.generateToken(AbstractJWTGenerator.java:143)
at
org.wso2.carbon.apimgt.keymgt.token.TokenGenTest.testAbstractJWTGenerator(TokenGenTest.java:81)

Thanks & Regards,
Ishara Cooray
Senior Software Engineer
Mobile : +9477 262 9512
WSO2, Inc. | http://wso2.com/
Lean . Enterprise . Middleware
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev