@Before public void setUp() throws Exception { persistenceService = PersistenceServiceProvider.getPersistenceService(); trackingService = ContextTrackingProvider.getTrackingService(); HumanTaskServerService.getInstance().initTaskServer(); MessageServerSingleton.getInstance().start(); consumer = MessageFactory.createMessageConsumer("IncomingCall"); this.coreServicesMap = new HashMap(); createRemoteNode(); client = HumanTaskServerService.getInstance().initTaskClient(); }
@Test public void genericEmergencyProcedureTest() throws HornetQException, InterruptedException, IOException, ClassNotFoundException { asynchProcedureStartWorker = new MessageConsumerWorker( "asyncProcedureStartCoreServer", new MessageConsumerWorkerHandler<AsyncProcedureStartMessage>() { @Override public void handleMessage(AsyncProcedureStartMessage message) { System.out.println( ">>>>>>>>>>>Creating a new Procedure = " + message.getProcedureName()); try { ProceduresMGMTService.getInstance() .newRequestedProcedure( message.getEmergencyId(), message.getProcedureName(), message.getParameters()); } catch (IOException ex) { Logger.getLogger(GenericEmergencyProcedureTest.class.getName()) .log(Level.SEVERE, null, ex); } } }); asynchProcedureStartWorker.start(); MessageProducer producer = MessageFactory.createMessageProducer(); Call initialCall = new Call(1, 2, new Date()); producer.sendMessage(initialCall); producer.stop(); Call call = (Call) consumer.receiveMessage(); assertNotNull(call); GenericEmergencyProcedureImpl.getInstance().newPhoneCall(call); Thread.sleep(5000); doOperatorTask(); // QUERY TO SEE THAT WE HAVE AN EMERGENCY ATTACHED TO THE CALL Thread.sleep(2000); doControlTask(); Thread.sleep(6000); // I should have one task here, that has been created by the specific procedure started doGarageTask(); Thread.sleep(3000); // I can asume that all the procedures are ended, we need to delegate this to the external // component AllProceduresEndedEvent allProceduresEndedEvent = new AllProceduresEndedEvent(null, new ArrayList<String>()); GenericEmergencyProcedureImpl.getInstance() .allProceduresEnededNotification(allProceduresEndedEvent); // We should see the report in the console Thread.sleep(10000); }