Hi Imesh, Yes, thanks for correcting :)
I made a wrong assumption since Thrift required generating service classes. It seems Thrift is more like a RPC framework but not bounded to RPC. As you noticed, Thrift client is expecting a session id so we need to implement session handling part if we go down Java sockets path. I tried to embed a Thrift server but hit a blocker since Apache Thrift library required generating service classes. I've raised this question on WSO2 dev list [1] to see if CEP Thrift receiver could be embedded. Will dig into this and figure out a better approach. [1] [Test Automation] Mocking Thrift server for an integration test Thanks. On Sun, Aug 30, 2015 at 12:58 AM, Imesh Gunaratne <im...@apache.org> wrote: > As we discussed offline I do not think Thrift is a RPC based protocol. IMO > it can be used for implementing RPC based services but the protocol may not > RPC based. > > I had a look at the Thrift client code, its waiting for a session id from > the server after connecting. Therefore a standard socket might not work. > Your guess should be correct. > > May be we can try to start a Thrift Data Receiver in a separate thread and > see whether we can use that to mock a CEP server. > > Thanks > > On Sun, Aug 30, 2015 at 12:22 AM, Akila Ravihansa Perera < > raviha...@wso2.com> wrote: > >> Hi Imesh, >> >> It won't work since Thrift is a RPC based protocol not a messaging based >> one. So you need to have those service classes generated via a tool (like >> Axis2). I was looking for a way to mock the CEP server but didn't have >> enough time to complete it. For now we can run a CEP server externally and >> assert the stat publishing by checking agent's log. That's not the ideal >> approach. But that will give a certain level of assurance until we find a >> proper way. >> >> Thanks. >> >> On Sun, Aug 30, 2015 at 12:16 AM, Imesh Gunaratne <im...@apache.org> >> wrote: >> >>> Thanks for the quick response! >>> >>> I prefer if we can simplify this. Why would not a socket >>> (java.net.ServerSocket) work with Thrift? Then again is there a way for the >>> live test to assert statistics published via the external CEP? >>> >>> Thanks >>> >>> On Sun, Aug 30, 2015 at 12:07 AM, Akila Ravihansa Perera < >>> raviha...@wso2.com> wrote: >>> >>>> Hi Imesh, >>>> >>>> I've added a test to verify PCA health stat publishing. For this you >>>> need to run a WSO2 CEP or Stratos server. Regular http sockets will not >>>> work with thrift protocol so I removed thrift socket creation from the >>>> test. Since this is a live test, it won't impact the build. >>>> >>>> Thanks. >>>> >>>> On Sun, Aug 30, 2015 at 12:00 AM, Imesh Gunaratne <im...@apache.org> >>>> wrote: >>>> >>>>> Hi Akila, >>>>> >>>>> I see $subject in 4.1.x branch, any thoughts? >>>>> >>>>> [2015-08-29 23:59:06,219] INFO - [PythonAgentTestManager] [2015-08-29 >>>>> 23:59:06,184] DEBUG {cartridgeagentutils.py:check_ports_active} - Port >>>>> '7712' is not active >>>>> [2015-08-29 23:59:06,219] INFO - [PythonAgentTestManager] [2015-08-29 >>>>> 23:59:06,189] DEBUG {subscriber.py:on_message} - Message received: >>>>> instance/status/InstanceActivatedEvent: >>>>> [2015-08-29 23:59:06,219] INFO - [PythonAgentTestManager] [2015-08-29 >>>>> 23:59:06,189] DEBUG {subscriber.py:run} - Event handler not found for >>>>> event >>>>> : 'InstanceActivatedEvent' >>>>> [2015-08-29 23:59:11,266] INFO - [PythonAgentTestManager] [2015-08-29 >>>>> 23:59:11,189] INFO {cartridgeagentutils.py:wait_until_ports_active} - >>>>> Waiting for ports to be active: [ip] 'localhost' [ports] ['7712'] >>>>> [2015-08-29 23:59:11,266] INFO - [PythonAgentTestManager] [2015-08-29 >>>>> 23:59:11,190] DEBUG {cartridgeagentutils.py:check_ports_active} - Port >>>>> '7712' is not active >>>>> [2015-08-29 23:59:16,293] INFO - [PythonAgentTestManager] [2015-08-29 >>>>> 23:59:16,191] INFO {cartridgeagentutils.py:wait_until_ports_active} - >>>>> Waiting for ports to be active: [ip] 'localhost' [ports] ['7712'] >>>>> >>>>> Thanks >>>>> >>>>> -- >>>>> Imesh Gunaratne >>>>> >>>>> Senior Technical Lead, WSO2 >>>>> Committer & PMC Member, Apache Stratos >>>>> >>>> >>>> >>>> >>>> -- >>>> Akila Ravihansa Perera >>>> WSO2 Inc.; http://wso2.com/ >>>> >>>> Blog: http://ravihansa3000.blogspot.com >>>> >>> >>> >>> >>> -- >>> Imesh Gunaratne >>> >>> Senior Technical Lead, WSO2 >>> Committer & PMC Member, Apache Stratos >>> >> >> >> >> -- >> Akila Ravihansa Perera >> WSO2 Inc.; http://wso2.com/ >> >> Blog: http://ravihansa3000.blogspot.com >> > > > > -- > Imesh Gunaratne > > Senior Technical Lead, WSO2 > Committer & PMC Member, Apache Stratos > -- Akila Ravihansa Perera WSO2 Inc.; http://wso2.com/ Blog: http://ravihansa3000.blogspot.com