org.wso2.carbon.databridge.commons.utils.EventDefinitionConverterUtils Java Examples
The following examples show how to use
org.wso2.carbon.databridge.commons.utils.EventDefinitionConverterUtils.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Wso2EventTestCase.java From product-cep with Apache License 2.0 | 4 votes |
@Test(groups = {"wso2.cep"}, description = "Testing wso2 event") public void wso2EventTestScenario() throws Exception { final int messageCount = 5; int startESCount = eventStreamManagerAdminServiceClient.getEventStreamCount(); int startERCount = eventReceiverAdminServiceClient.getActiveEventReceiverCount(); int startEPCount = eventPublisherAdminServiceClient.getActiveEventPublisherCount(); //Add StreamDefinition String streamDefinitionAsString = getJSONArtifactConfiguration("Wso2EventTestCase", "testWso2EventStream.json"); eventStreamManagerAdminServiceClient.addEventStreamAsString(streamDefinitionAsString); Assert.assertEquals(eventStreamManagerAdminServiceClient.getEventStreamCount(), startESCount + 1); StreamDefinition streamDefinition = EventDefinitionConverterUtils .convertFromJson(streamDefinitionAsString); //Add Wso2event EventReceiver String eventReceiverConfig = getXMLArtifactConfiguration("Wso2EventTestCase", "Wso2EventReceiver.xml"); eventReceiverAdminServiceClient.addEventReceiverConfiguration(eventReceiverConfig); Assert.assertEquals(eventReceiverAdminServiceClient.getActiveEventReceiverCount(), startERCount + 1); //Add Wso2event EventPublisher String eventPublisherConfig = getXMLArtifactConfiguration("Wso2EventTestCase", "Wso2EventPublisher.xml"); eventPublisherAdminServiceClient.addEventPublisherConfiguration(eventPublisherConfig); Assert.assertEquals(eventPublisherAdminServiceClient.getActiveEventPublisherCount(), startEPCount + 1); // The data-bridge receiver Wso2EventServer agentServer = new Wso2EventServer("Wso2EventTestCase", CEPIntegrationTestConstants.TCP_PORT, false); Thread agentServerThread = new Thread(agentServer); agentServerThread.start(); // Let the server start Thread.sleep(1000); Wso2EventClient.publish("thrift", "localhost", String.valueOf(CEPIntegrationTestConstants.TCP_PORT), "admin", "admin", streamDefinition.getStreamId(), "testWso2EventStreamData.csv", "Wso2EventTestCase", streamDefinition, 5, 1000); //wait while all stats are published Thread.sleep(30000); try { Assert.assertEquals(agentServer.getMsgCount(), messageCount, "Incorrect number of messages consumed!"); eventStreamManagerAdminServiceClient.removeEventStream("org.wso2.sample.pizza.order", "1.0.0"); eventPublisherAdminServiceClient.removeInactiveEventPublisherConfiguration("sendWso2EventsPublisher"); eventReceiverAdminServiceClient.removeInactiveEventReceiverConfiguration("wso2EventReceiver"); Thread.sleep(2000); } catch (Throwable e) { log.error("Exception thrown: " + e.getMessage(), e); Assert.fail("Exception: " + e.getMessage()); } finally { agentServer.stop(); } }
Example #2
Source File: ThriftTestServer.java From attic-stratos with Apache License 2.0 | 4 votes |
public void addStreamDefinition(String streamDefinitionStr, int tenantId) throws StreamDefinitionStoreException, MalformedStreamDefinitionException { StreamDefinition streamDefinition = EventDefinitionConverterUtils.convertFromJson(streamDefinitionStr); getStreamDefinitionStore().saveStreamDefinitionToStore(streamDefinition, tenantId); }
Example #3
Source File: ThriftTestServer.java From attic-stratos with Apache License 2.0 | 4 votes |
public void addStreamDefinition(String streamDefinitionStr, int tenantId) throws StreamDefinitionStoreException, MalformedStreamDefinitionException { StreamDefinition streamDefinition = EventDefinitionConverterUtils.convertFromJson(streamDefinitionStr); getStreamDefinitionStore().saveStreamDefinitionToStore(streamDefinition, tenantId); }
Example #4
Source File: ThriftTestServer.java From product-private-paas with Apache License 2.0 | 4 votes |
public void addStreamDefinition(String streamDefinitionStr, int tenantId) throws StreamDefinitionStoreException, MalformedStreamDefinitionException { StreamDefinition streamDefinition = EventDefinitionConverterUtils.convertFromJson(streamDefinitionStr); getStreamDefinitionStore().saveStreamDefinitionToStore(streamDefinition, tenantId); }