@Test public void testRun() { try { SLAManagerMessageGenerator generator = new SLAManagerMessageGenerator( "guest", "guest", "192.168.3.16:5673", "paas-slam.monitoring.f28d4719-5f98-4c87-9365-6be602da9a4a.DavidgpTestApp.violationNotified"); Thread genThread = new Thread(generator); genThread.setDaemon(true); genThread.start(); System.out.println("run"); SlaManagerListener instance = new SlaManagerListener( "guest", "guest", "192.168.3.16:5673", "paas-slam.monitoring.f28d4719-5f98-4c87-9365-6be602da9a4a.DavidgpTestApp.violationNotified"); instance.setEventAssessor(new ThresholdEventAssessor()); Thread instThread = new Thread(instance); instThread.start(); instance.printQueueAndTopicInformation(); Thread.sleep(60000); instance.stopListening(); } catch (InterruptedException ex) { ex.printStackTrace(); fail("An interrupted exception was thrown"); } catch (JMSException ex) { ex.printStackTrace(); fail("An JMS exception was thrown"); } catch (NamingException ex) { ex.printStackTrace(); fail("An naming exception was thrown"); } }
@Override public void run() { try { while (running) { Message message = consumer.receive(1000); if (message instanceof TextMessage) { TextMessage textMessage = (TextMessage) message; ViolationMessage violation = (ViolationMessage) converter.fromXML(textMessage.getText()); EventData data = EventDataConverter.convertEventData(violation); eventAssessor.assessEvent(data); } try { Thread.sleep(1000); } catch (InterruptedException ex) { Logger.getLogger(SlaManagerListener.class.getName()).log(Level.SEVERE, null, ex); } } if (consumer != null) { consumer.close(); } close(); } catch (JMSException ex) { ex.printStackTrace(); } }
SlaManagerListener extends ActiveMQBase implements Runnable, EventListener { @Override public void run() { try { while (running) { Message message = consumer.receive(1000); if (message instanceof TextMessage) { TextMessage textMessage = (TextMessage) message; ViolationMessage violation = (ViolationMessage) converter.fromXML(textMessage.getText()); EventData data = EventDataConverter.convertEventData(violation); eventAssessor.assessEvent(data); } try { Thread.sleep(1000); } catch (InterruptedException ex) { Logger.getLogger(SlaManagerListener.class.getName()).log(Level.SEVERE, null, ex); } } if (consumer != null) { consumer.close(); } close(); } catch (JMSException ex) { ex.printStackTrace(); } } }
SlaManagerListener extends ActiveMQBase implements Runnable, EventListener { @Override public void run() { try { while (running) { Message message = consumer.receive(1000); if (message instanceof TextMessage) { TextMessage textMessage = (TextMessage) message; ViolationMessage violation = (ViolationMessage) converter.fromXML(textMessage.getText()); EventData data = EventDataConverter.convertEventData(violation); eventAssessor.assessEvent(data); } try { Thread.sleep(1000); } catch (InterruptedException ex) { Logger.getLogger(SlaManagerListener.class.getName()).log(Level.SEVERE, null, ex); } } if (consumer != null) { consumer.close(); } close(); } catch (JMSException ex) { ex.printStackTrace(); } } SlaManagerListener();  SlaManagerListener(String user, String password, String url, String topicName);  SlaManagerListener(String queueName); }
SlaManagerListener extends ActiveMQBase implements Runnable, EventListener { @Override public void run() { try { while (running) { Message message = consumer.receive(1000); if (message instanceof TextMessage) { TextMessage textMessage = (TextMessage) message; ViolationMessage violation = (ViolationMessage) converter.fromXML(textMessage.getText()); EventData data = EventDataConverter.convertEventData(violation); eventAssessor.assessEvent(data); } try { Thread.sleep(1000); } catch (InterruptedException ex) { Logger.getLogger(SlaManagerListener.class.getName()).log(Level.SEVERE, null, ex); } } if (consumer != null) { consumer.close(); } close(); } catch (JMSException ex) { ex.printStackTrace(); } } SlaManagerListener();  SlaManagerListener(String user, String password, String url, String topicName);  SlaManagerListener(String queueName); @Override void run(); @Override void setEventAssessor(EventAssessor assessor); @Override EventAssessor getEventAssessor(); @Override void stopListening(); }
SlaManagerListener extends ActiveMQBase implements Runnable, EventListener { @Override public void run() { try { while (running) { Message message = consumer.receive(1000); if (message instanceof TextMessage) { TextMessage textMessage = (TextMessage) message; ViolationMessage violation = (ViolationMessage) converter.fromXML(textMessage.getText()); EventData data = EventDataConverter.convertEventData(violation); eventAssessor.assessEvent(data); } try { Thread.sleep(1000); } catch (InterruptedException ex) { Logger.getLogger(SlaManagerListener.class.getName()).log(Level.SEVERE, null, ex); } } if (consumer != null) { consumer.close(); } close(); } catch (JMSException ex) { ex.printStackTrace(); } } SlaManagerListener();  SlaManagerListener(String user, String password, String url, String topicName);  SlaManagerListener(String queueName); @Override void run(); @Override void setEventAssessor(EventAssessor assessor); @Override EventAssessor getEventAssessor(); @Override void stopListening();  }