use of alma.ADMINTEST2.statusBlockEvent2 in project ACS by ACS-Community.
the class SimpleSupplierConsumerClient method startReceiving.
public void startReceiving() throws Exception {
statusBlockEvent1 event1 = new statusBlockEvent1();
event1.counter1 = 0;
event1.counter2 = 0;
event1.counter3 = 0;
event1.flipFlop = true;
event1.myString = "myValue";
event1.onOff = OnOffStates.ON;
event1.period = 0.2f;
statusBlockEvent2 event2 = new statusBlockEvent2();
event2.counter1 = 0;
event2.counter2 = 0;
event2.counter3 = 0;
event2.flipFlop = true;
event2.myString = "myValue";
event2.onOff = alma.ADMINTEST2.OnOffStates.ON;
event2.period = 0.2f;
EventDescription ed = new EventDescription();
ed.count = 0;
ed.name = "description";
ed.timestamp = new Date().getTime();
for (int i = 0; i != m_times; i++) {
try {
// publish events of 2 different types
for (int j = 0; j != m_nEvents; j++) {
m_publisher.publishEvent(event1);
m_logger.info("Published event 1");
m_publisher.publishEvent(event2);
m_logger.info("Published event 2");
m_publisher.publishEvent(ed);
m_logger.info("Published event ed");
}
} catch (Exception e) {
m_logger.info("It was impossible to publish the event because an exception was thrown");
}
// Sleep and get events
try {
Thread.sleep(m_interval * 1000);
} catch (InterruptedException e) {
}
/*try {
m_subscriber.startReceivingEvents();
} catch(AcsJIllegalStateEventEx e) {
m_logger.info("AcsJIllegalStateEventEx thrown, perfect :D");
}*/
}
}
use of alma.ADMINTEST2.statusBlockEvent2 in project ACS by ACS-Community.
the class NCSubscriberTest method publish.
/*===================================*/
/* Support methods */
/*===================================*/
private void publish(int nEvents, EventType type) {
IDLEntity event = null;
if (type.equals(EventType.statusBlock1)) {
event = new statusBlockEvent1();
((statusBlockEvent1) event).counter1 = 0;
((statusBlockEvent1) event).counter2 = 0;
((statusBlockEvent1) event).flipFlop = true;
((statusBlockEvent1) event).onOff = alma.ADMINTEST1.OnOffStates.ON;
} else if (type.equals(EventType.statusBlock2)) {
event = new statusBlockEvent2();
((statusBlockEvent2) event).counter1 = 0;
((statusBlockEvent2) event).counter2 = 0;
((statusBlockEvent2) event).flipFlop = true;
((statusBlockEvent2) event).onOff = alma.ADMINTEST2.OnOffStates.ON;
}
try {
for (int i = 0; i != nEvents; i++) m_publisher.publishEvent(event);
} catch (AcsJException e) {
e.printStackTrace();
}
}
Aggregations