UmundoETLProtocolAdapter implements ETLProtocolAdapter { @Override public void sendMMIEvent(final Object ch, final Mmi mmi) throws IOException { final LifeCycleEvent evt = mmi.getLifeCycleEvent(); LifeCycleEvents.LifeCycleResponse response = createResponse(evt); final LifeCycleEvents.LifeCycleEvent.LifeCycleEventType type = getEventType(evt); final LifeCycleEvents.LifeCycleEvent event = LifeCycleEvents.LifeCycleEvent.newBuilder() .setType(type) .setRequestID(evt.getRequestId()) .setSource(sourceUrl) .setTarget(evt.getTarget()) .setExtension(LifeCycleEvents.LifeCycleResponse.response, response) .build(); if (LOGGER.isDebugEnabled()) { LOGGER.debug("sending " + evt); } publisher.sendObject("LifeCycleEvent", event); } UmundoETLProtocolAdapter(); void setChannel(final String name); void setSourceUrl(final String name); @Override void start(); @Override boolean isStarted(); @Override void addMMIEventListener(final MMIEventListener listener); @Override void removeMMIEventListener(final MMIEventListener listener); @Override void sendMMIEvent(final Object ch, final Mmi mmi); @Override void stop();  }
@Test(timeout = 5000) public void testSendMMIEvent() throws Exception { final Mmi mmi = new Mmi(); final PrepareResponse response = new PrepareResponse(); mmi.setLifeCycleEvent(response); final String requestId = "requestId1"; final String source = "source1"; final String target = "target1"; final String context = "context1"; response.setRequestId(requestId); response.setSource(source); response.setTarget(target); response.setContext(context); final UmundoETLProtocolAdapter adapter = new UmundoETLProtocolAdapter(); adapter.start(); Thread.sleep(1000); adapter.sendMMIEvent("desktop", mmi); receiver.waitReceivedObject(); final Object object = receiver.getReceivedObject(); adapter.stop(); }