On Mon, Mar 28, 2016 at 5:36 PM, Kalpa Welivitigoda <[email protected]> wrote:
> Hi Lasantha, > > Is there a way in which we can verify the events being published to the > thrift server? > Why can't you have a counter in thrift agent server side and increment it when event received.. We have used similar approach in our test cases [1] .. [1] https://github.com/wso2/product-cep/blob/master/modules/integration/tests-integration/tests/src/test/java/org/wso2/carbon/integration/test/client/Wso2EventServer.java#L160 > > We have the http statistics publishing module in application server 6.0.0 > and need to verify the events published to the thrift server in an > integration test. > > On Tue, Dec 1, 2015 at 3:20 PM, Thanuja Uruththirakodeeswaran < > [email protected]> wrote: > >> Hi Lasantha, >> >> Sorry, I tried this with different ports and when changing the client >> port to 7613, forgot to change the server port to 7613. I've corrected it >> and attached the new log. >> >> [main] INFO >> org.wso2.carbon.databridge.receiver.thrift.ThriftDataReceiver - Thrift >> Server started at localhost >> [main] INFO >> org.wso2.carbon.databridge.receiver.thrift.ThriftDataReceiver - Thrift >> SSL port : 7713 >> [main] INFO >> org.wso2.carbon.databridge.receiver.thrift.ThriftDataReceiver - Thrift >> port : 7613 >> [main] INFO >> org.apache.stratos.cloud.controller.statistics.publisher.ThriftTestServer >> - Test Server Started >> [main] INFO org.wso2.carbon.databridge.agent.thrift.AgentHolder - Agent >> created ! >> [main] INFO org.apache.stratos.common.threading.StratosThreadPool - >> Thread pool created: [type] Executor Service [id] >> cloud.controller.stats.publisher.thread.pool [size] 10 >> [pool-5-thread-1] ERROR >> org.wso2.carbon.databridge.agent.thrift.AsyncDataPublisher - Error while >> connection to event receiver >> org.wso2.carbon.databridge.agent.thrift.exception.AgentException: Cannot >> borrow client for TCP,localhost:7613,TCP,localhost:7713 >> at >> org.wso2.carbon.databridge.agent.thrift.internal.publisher.authenticator.AgentAuthenticator.connect(AgentAuthenticator.java:58) >> at >> org.wso2.carbon.databridge.agent.thrift.DataPublisher.start(DataPublisher.java:273) >> at >> org.wso2.carbon.databridge.agent.thrift.DataPublisher.<init>(DataPublisher.java:161) >> at >> org.wso2.carbon.databridge.agent.thrift.AsyncDataPublisher$ReceiverConnectionWorker.run(AsyncDataPublisher.java:787) >> at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) >> at java.util.concurrent.FutureTask.run(FutureTask.java:262) >> at >> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) >> at >> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) >> at java.lang.Thread.run(Thread.java:745) >> Caused by: org.apache.thrift.transport.TTransportException: Could not >> connect to 172.17.8.1 on port 7713 >> at >> org.apache.thrift.transport.TSSLTransportFactory.createClient(TSSLTransportFactory.java:212) >> at >> org.apache.thrift.transport.TSSLTransportFactory.getClientSocket(TSSLTransportFactory.java:166) >> at >> org.wso2.carbon.databridge.agent.thrift.internal.pool.client.secure.SecureClientPoolFactory.makeObject(SecureClientPoolFactory.java:90) >> at >> org.wso2.carbon.databridge.agent.thrift.internal.pool.client.secure.SecureClientPoolFactory.makeObject(SecureClientPoolFactory.java:48) >> at >> org.apache.commons.pool.impl.GenericKeyedObjectPool.borrowObject(GenericKeyedObjectPool.java:1212) >> at >> org.wso2.carbon.databridge.agent.thrift.internal.publisher.authenticator.AgentAuthenticator.connect(AgentAuthenticator.java:50) >> ... 8 more >> Caused by: java.net.ConnectException: Connection refused >> at java.net.PlainSocketImpl.socketConnect(Native Method) >> at >> java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339) >> at >> java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200) >> at >> java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182) >> at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) >> at java.net.Socket.connect(Socket.java:579) >> at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:625) >> at sun.security.ssl.SSLSocketImpl.<init>(SSLSocketImpl.java:413) >> at >> sun.security.ssl.SSLSocketFactoryImpl.createSocket(SSLSocketFactoryImpl.java:88) >> at >> org.apache.thrift.transport.TSSLTransportFactory.createClient(TSSLTransportFactory.java:208) >> ... 13 more >> >> Thanks. >> >> On Tue, Dec 1, 2015 at 3:14 PM, Lasantha Fernando <[email protected]> >> wrote: >> >>> Hi Thanuja, >>> >>> Looking at the logs above, it seems that the ThriftDataReceiver started >>> on port 7612, with SSL port 7712. >>> >>> [main] INFO >>> org.wso2.carbon.databridge.receiver.thrift.ThriftDataReceiver - Thrift >>> SSL port : 7712 >>> [main] INFO >>> org.wso2.carbon.databridge.receiver.thrift.ThriftDataReceiver - Thrift >>> port : 7612 >>> [main] INFO >>> org.apache.stratos.cloud.controller.statistics.publisher.ThriftTestServer >>> - Test Server Started >>> >>> But the agent is trying to connect to port 7613,7713. >>> >>> [pool-5-thread-1] ERROR >>> org.wso2.carbon.databridge.agent.thrift.AsyncDataPublisher - Error while >>> connection to event receiver >>> org.wso2.carbon.databridge.agent.thrift.exception.AgentException: Cannot >>> borrow client for TCP,localhost:7613,TCP,localhost:7713 >>> >>> Can you go through the code and verify that the agent is sending to the >>> same port on which agent is started? It is probably a minor issue when >>> setting the offsets. >>> >>> Thanks, >>> Lasantha >>> >>> >>> On 1 December 2015 at 15:09, Thanuja Uruththirakodeeswaran < >>> [email protected]> wrote: >>> >>>> Hi Lasantha, >>>> >>>> I'm using the ThriftTestServer [1] to check data publisher >>>> functionality in a java test class. I have set the TrustStore paramby >>>> DataPublisherTestUtil.setTrustStoreParams(); after setting KeyStore >>>> param in my local code. >>>> >>>> After start the ThriftTestServer instance, I'm trying to create a >>>> publisher object and while doing that I'm getting the below error: >>>> >>>> [main] INFO >>>> org.wso2.carbon.databridge.receiver.thrift.ThriftDataReceiver - Thrift >>>> Server started at localhost >>>> [main] INFO >>>> org.wso2.carbon.databridge.receiver.thrift.ThriftDataReceiver - Thrift >>>> SSL port : 7712 >>>> [main] INFO >>>> org.wso2.carbon.databridge.receiver.thrift.ThriftDataReceiver - Thrift >>>> port : 7612 >>>> [main] INFO >>>> org.apache.stratos.cloud.controller.statistics.publisher.ThriftTestServer >>>> - Test Server Started >>>> [main] INFO org.wso2.carbon.databridge.agent.thrift.AgentHolder - >>>> Agent created ! >>>> [main] INFO org.apache.stratos.common.threading.StratosThreadPool - >>>> Thread pool created: [type] Executor Service [id] >>>> cloud.controller.stats.publisher.thread.pool [size] 10 >>>> [pool-5-thread-1] ERROR >>>> org.wso2.carbon.databridge.agent.thrift.AsyncDataPublisher - Error while >>>> connection to event receiver >>>> org.wso2.carbon.databridge.agent.thrift.exception.AgentException: >>>> Cannot borrow client for TCP,localhost:7613,TCP,localhost:7713 >>>> at >>>> org.wso2.carbon.databridge.agent.thrift.internal.publisher.authenticator.AgentAuthenticator.connect(AgentAuthenticator.java:58) >>>> at >>>> org.wso2.carbon.databridge.agent.thrift.DataPublisher.start(DataPublisher.java:273) >>>> at >>>> org.wso2.carbon.databridge.agent.thrift.DataPublisher.<init>(DataPublisher.java:161) >>>> at >>>> org.wso2.carbon.databridge.agent.thrift.AsyncDataPublisher$ReceiverConnectionWorker.run(AsyncDataPublisher.java:787) >>>> at >>>> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) >>>> at java.util.concurrent.FutureTask.run(FutureTask.java:262) >>>> at >>>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) >>>> at >>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) >>>> at java.lang.Thread.run(Thread.java:745) >>>> Caused by: org.apache.thrift.transport.TTransportException: Could not >>>> connect to 172.17.8.1 on port 7713 >>>> at >>>> org.apache.thrift.transport.TSSLTransportFactory.createClient(TSSLTransportFactory.java:212) >>>> at >>>> org.apache.thrift.transport.TSSLTransportFactory.getClientSocket(TSSLTransportFactory.java:166) >>>> at >>>> org.wso2.carbon.databridge.agent.thrift.internal.pool.client.secure.SecureClientPoolFactory.makeObject(SecureClientPoolFactory.java:90) >>>> at >>>> org.wso2.carbon.databridge.agent.thrift.internal.pool.client.secure.SecureClientPoolFactory.makeObject(SecureClientPoolFactory.java:48) >>>> at >>>> org.apache.commons.pool.impl.GenericKeyedObjectPool.borrowObject(GenericKeyedObjectPool.java:1212) >>>> at >>>> org.wso2.carbon.databridge.agent.thrift.internal.publisher.authenticator.AgentAuthenticator.connect(AgentAuthenticator.java:50) >>>> ... 8 more >>>> Caused by: java.net.ConnectException: Connection refused >>>> at java.net.PlainSocketImpl.socketConnect(Native Method) >>>> at >>>> java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339) >>>> at >>>> java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200) >>>> at >>>> java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182) >>>> at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) >>>> at java.net.Socket.connect(Socket.java:579) >>>> at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:625) >>>> at sun.security.ssl.SSLSocketImpl.<init>(SSLSocketImpl.java:413) >>>> at >>>> sun.security.ssl.SSLSocketFactoryImpl.createSocket(SSLSocketFactoryImpl.java:88) >>>> at >>>> org.apache.thrift.transport.TSSLTransportFactory.createClient(TSSLTransportFactory.java:208) >>>> ... 13 more >>>> >>>> >>>> What is the reason for this? Could you please point what I'm doing >>>> wrong. >>>> >>>> Thanks. >>>> >>>> [1]. >>>> https://github.com/apache/stratos/blob/master/products/python-cartridge-agent/modules/integration/test-common/src/main/java/org/apache/stratos/python/cartridge/agent/integration/common/ThriftTestServer.java >>>> >>>> On Tue, Sep 1, 2015 at 1:26 AM, Akila Ravihansa Perera < >>>> [email protected]> wrote: >>>> >>>>> Hi Lasantha, >>>>> >>>>> This is exactly what I needed. Had to struggle a bit to connect to the >>>>> test server from a Python client but managed to do that after couple of >>>>> tweaks. I faced an issue since we cannot define the cipher set to be used >>>>> in ThriftTestServer. Therefore, ThriftDataReceiver will get initialized >>>>> with default set of parameters for TSSLTransportParameters. I'd like to >>>>> suggest that we provide a method to customize these SSL parameters. >>>>> >>>>> Thanks a lot for the prompt response. This was really helpful :) >>>>> >>>>> On Sun, Aug 30, 2015 at 3:20 PM, Lasantha Fernando <[email protected]> >>>>> wrote: >>>>> >>>>>> Hi Akila, >>>>>> >>>>>> There is a ThriftTestServer we've written for tests in >>>>>> carbon-analytics-common. You can find an example here [1]. Also you can >>>>>> find other examples in the databridge-agent test cases. Can you go >>>>>> through >>>>>> them and see if that fits your purpose? >>>>>> >>>>>> [1] >>>>>> https://github.com/wso2/carbon-analytics-common/blob/master/components/data-bridge/org.wso2.carbon.databridge.agent/src/test/java/org/wso2/carbon/databridge/agent/test/thrift/ThriftTestServer.java >>>>>> >>>>>> Thanks, >>>>>> Lasantha >>>>>> >>>>>> On 30 August 2015 at 12:59, Akila Ravihansa Perera < >>>>>> [email protected]> wrote: >>>>>> >>>>>>> Hi, >>>>>>> >>>>>>> I'm looking for a way to mock the Thrift receiver in CEP. My >>>>>>> requirement is to write an integration test to assert stat publishing >>>>>>> functionality (to CEP via Thrift) in my Python app. I'm developing the >>>>>>> automation test cases using TestNG framework so I can use any Java based >>>>>>> library. Is this possible by using regular Java sockets? >>>>>>> >>>>>>> I'd rather prefer to start an embedded CEP Thrift receiver in my >>>>>>> test method and verify the functionality. Appreciate any help regarding >>>>>>> this. >>>>>>> >>>>>>> Thanks. >>>>>>> -- >>>>>>> Akila Ravihansa Perera >>>>>>> WSO2 Inc.; http://wso2.com/ >>>>>>> >>>>>>> Blog: http://ravihansa3000.blogspot.com >>>>>>> >>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> *Lasantha Fernando* >>>>>> Senior Software Engineer - Data Technologies Team >>>>>> WSO2 Inc. http://wso2.com >>>>>> >>>>>> email: [email protected] >>>>>> mobile: (+94) 71 5247551 >>>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> Akila Ravihansa Perera >>>>> WSO2 Inc.; http://wso2.com/ >>>>> >>>>> Blog: http://ravihansa3000.blogspot.com >>>>> >>>>> _______________________________________________ >>>>> Dev mailing list >>>>> [email protected] >>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev >>>>> >>>>> >>>> >>>> >>>> -- >>>> Thanuja Uruththirakodeeswaran >>>> Software Engineer >>>> WSO2 Inc.;http://wso2.com >>>> lean.enterprise.middleware >>>> >>>> mobile: +94 774363167 >>>> >>> >>> >>> >>> -- >>> *Lasantha Fernando* >>> Senior Software Engineer - Data Technologies Team >>> WSO2 Inc. http://wso2.com >>> >>> email: [email protected] >>> mobile: (+94) 71 5247551 >>> >> >> >> >> -- >> Thanuja Uruththirakodeeswaran >> Software Engineer >> WSO2 Inc.;http://wso2.com >> lean.enterprise.middleware >> >> mobile: +94 774363167 >> >> _______________________________________________ >> Dev mailing list >> [email protected] >> http://wso2.org/cgi-bin/mailman/listinfo/dev >> >> > > > -- > Best Regards, > > Kalpa Welivitigoda > Software Engineer, WSO2 Inc. http://wso2.com > Email: [email protected] > Mobile: +94776509215 > > _______________________________________________ > Dev mailing list > [email protected] > http://wso2.org/cgi-bin/mailman/listinfo/dev > > -- *V. Mohanadarshan* *Senior Software Engineer,* *Data Technologies Team,* *WSO2, Inc. http://wso2.com <http://wso2.com> * *lean.enterprise.middleware.* email: [email protected] phone:(+94) 771117673
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
