org.wso2.carbon.databridge.core.exception.DataBridgeException Java Examples
The following examples show how to use
org.wso2.carbon.databridge.core.exception.DataBridgeException.
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: TestWso2EventServer.java From product-cep with Apache License 2.0 | 6 votes |
public static void main(String[] args) throws DataBridgeException, StreamDefinitionStoreException { Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { try { log.info("Final event count: " + testServer.counter.get()); } catch (Throwable t) { log.error("Unexpected error when running shutdown hook:" + t.getMessage(), t); } } }); log.info("Shutdown hook added."); testServer.start(args[0], Integer.parseInt(args[1]), args[2], Integer.parseInt(args[3]), args[4]); synchronized (testServer) { try { testServer.wait(); } catch (InterruptedException ignored) { //ignore } } }
Example #2
Source File: TestWso2EventServer.java From product-cep with Apache License 2.0 | 5 votes |
public static void main(String[] args) throws DataBridgeException, StreamDefinitionStoreException { testServer.start(args[0], Integer.parseInt(args[1]), args[2], args[3]); synchronized (testServer) { try { testServer.wait(); } catch (InterruptedException ignored) { } } }
Example #3
Source File: ThriftServer.java From micro-integrator with Apache License 2.0 | 4 votes |
public void startServer() throws DataBridgeException, StreamDefinitionStoreException { msgCount.set(0); start(listeningPort); }
Example #4
Source File: ThriftServer.java From product-ei with Apache License 2.0 | 4 votes |
public void startServer() throws DataBridgeException, StreamDefinitionStoreException { msgCount.set(0); start(listeningPort); }
Example #5
Source File: Wso2EventServer.java From product-cep with Apache License 2.0 | 4 votes |
public void startServer() throws DataBridgeException, StreamDefinitionStoreException { msgCount.set(0); start(listeningPort); }
Example #6
Source File: CEPHAModeTestCase.java From attic-stratos with Apache License 2.0 | 4 votes |
@Test(timeOut = STARTUP_TIMEOUT, description = "Test PCA initialization, activation, health stat publishing in " + "CEP HA mode", groups = {"smoke"}) public void testPythonCartridgeAgent() { startCommunicatorThread(); subscribeToThriftDatabridge(); subscribeToSecondThriftDatabridge(); Thread startupTestThread = new Thread(new Runnable() { @Override public void run() { while (!eventReceiverInitialized) { sleep(2000); } List<String> outputLines = new ArrayList<String>(); while (!outputStream.isClosed()) { List<String> newLines = getNewLines(outputLines, outputStream.toString()); if (newLines.size() > 0) { for (String line : newLines) { if (line.contains("Subscribed to 'topology/#'")) { sleep(2000); // Send complete topology event log.info("Publishing complete topology event..."); CompleteTopologyEvent completeTopologyEvent = new CompleteTopologyEvent(topology); publishEvent(completeTopologyEvent); log.info("Complete topology event published"); // Publish member initialized event log.info("Publishing member initialized event..."); MemberInitializedEvent memberInitializedEvent = new MemberInitializedEvent( SERVICE_NAME, CLUSTER_ID, CLUSTER_INSTANCE_ID, MEMBER_ID, NETWORK_PARTITION_ID, PARTITION_ID, INSTANCE_ID ); publishEvent(memberInitializedEvent); log.info("Member initialized event published"); } if (line.contains("Published event to thrift stream")) { startupTestCompleted = true; } if (line.contains("Couldn't publish health statistics to CEP. Thrift Receiver offline.")) { failDetected = true; log.info("Fail detected in the stopped cep server."); } } } sleep(1000); } } }); startupTestThread.start(); while (!instanceStarted || !instanceActivated || !startupTestCompleted || !thriftTestCompletedinServerOne || !thriftTestCompletedinServerTwo) { // wait until the instance activated event is received. // this will assert whether instance got activated within timeout period; no need for explicit assertions sleep(2000); } thriftTestServer.stop(); startupTestCompleted = false; thriftTestCompletedinServerTwo = false; while (!startupTestCompleted || !failDetected || !thriftTestCompletedinServerTwo) { // wait until PCA publishes health stats to second thrift server sleep(2000); } thriftTestCompletedinServerOne = false; try { thriftTestServer.start(cepPort); subscribeToThriftDatabridge(); } catch (DataBridgeException e) { e.printStackTrace(); } while (!thriftTestCompletedinServerOne) { // wait until PCA publishes health stats to started node sleep(2000); } }
Example #7
Source File: ThriftTestServer.java From attic-stratos with Apache License 2.0 | 4 votes |
public void startTestServer() throws DataBridgeException, InterruptedException { ThriftTestServer thriftTestServer = new ThriftTestServer(); thriftTestServer.start(7611); Thread.sleep(100000000); thriftTestServer.stop(); }
Example #8
Source File: ThriftTestServer.java From attic-stratos with Apache License 2.0 | 4 votes |
public void stopAndStartDuration(int port, long stopAfterTimeMilliSeconds, long startAfterTimeMS) throws SocketException, DataBridgeException { restarterThread = new RestarterThread(port, stopAfterTimeMilliSeconds, startAfterTimeMS); Thread thread = new Thread(restarterThread); thread.start(); }
Example #9
Source File: ThriftTestServer.java From attic-stratos with Apache License 2.0 | 4 votes |
public void startTestServer() throws DataBridgeException, InterruptedException { ThriftTestServer thriftTestServer = new ThriftTestServer(); thriftTestServer.start(7611); Thread.sleep(100000000); thriftTestServer.stop(); }
Example #10
Source File: ThriftTestServer.java From attic-stratos with Apache License 2.0 | 4 votes |
public void stopAndStartDuration(int port, long stopAfterTimeMilliSeconds, long startAfterTimeMS) throws SocketException, DataBridgeException { restarterThread = new RestarterThread(port, stopAfterTimeMilliSeconds, startAfterTimeMS); Thread thread = new Thread(restarterThread); thread.start(); }
Example #11
Source File: CEPHAModeTestCase.java From product-private-paas with Apache License 2.0 | 4 votes |
@Test(timeOut = STARTUP_TIMEOUT, description = "Test PCA initialization, activation, health stat publishing in " + "CEP HA mode", groups = {"smoke"}) public void testPythonCartridgeAgent() { startCommunicatorThread(); subscribeToThriftDatabridge(); subscribeToSecondThriftDatabridge(); Thread startupTestThread = new Thread(new Runnable() { @Override public void run() { while (!eventReceiverInitialized) { sleep(2000); } List<String> outputLines = new ArrayList<String>(); while (!outputStream.isClosed()) { List<String> newLines = getNewLines(outputLines, outputStream.toString()); if (newLines.size() > 0) { for (String line : newLines) { if (line.contains("Subscribed to 'topology/#'")) { sleep(2000); // Send complete topology event log.info("Publishing complete topology event..."); CompleteTopologyEvent completeTopologyEvent = new CompleteTopologyEvent(topology); publishEvent(completeTopologyEvent); log.info("Complete topology event published"); // Publish member initialized event log.info("Publishing member initialized event..."); MemberInitializedEvent memberInitializedEvent = new MemberInitializedEvent( SERVICE_NAME, CLUSTER_ID, CLUSTER_INSTANCE_ID, MEMBER_ID, NETWORK_PARTITION_ID, PARTITION_ID, INSTANCE_ID ); publishEvent(memberInitializedEvent); log.info("Member initialized event published"); } if (line.contains("Published event to thrift stream")) { startupTestCompleted = true; } if (line.contains("Couldn't publish health statistics to CEP. Thrift Receiver offline.")) { failDetected = true; log.info("Fail detected in the stopped cep server."); } } } sleep(1000); } } }); startupTestThread.start(); while (!instanceStarted || !instanceActivated || !startupTestCompleted || !thriftTestCompletedinServerOne || !thriftTestCompletedinServerTwo) { // wait until the instance activated event is received. // this will assert whether instance got activated within timeout period; no need for explicit assertions sleep(2000); } thriftTestServer.stop(); startupTestCompleted = false; thriftTestCompletedinServerTwo = false; while (!startupTestCompleted || !failDetected || !thriftTestCompletedinServerTwo) { // wait until PCA publishes health stats to second thrift server sleep(2000); } thriftTestCompletedinServerOne = false; try { thriftTestServer.start(cepPort); subscribeToThriftDatabridge(); } catch (DataBridgeException e) { e.printStackTrace(); } while (!thriftTestCompletedinServerOne) { // wait until PCA publishes health stats to started node sleep(2000); } }
Example #12
Source File: ThriftTestServer.java From product-private-paas with Apache License 2.0 | 4 votes |
public void startTestServer() throws DataBridgeException, InterruptedException { ThriftTestServer thriftTestServer = new ThriftTestServer(); thriftTestServer.start(7611); Thread.sleep(100000000); thriftTestServer.stop(); }
Example #13
Source File: ThriftTestServer.java From product-private-paas with Apache License 2.0 | 4 votes |
public void stopAndStartDuration(int port, long stopAfterTimeMilliSeconds, long startAfterTimeMS) throws SocketException, DataBridgeException { restarterThread = new RestarterThread(port, stopAfterTimeMilliSeconds, startAfterTimeMS); Thread thread = new Thread(restarterThread); thread.start(); }