Search in sources :

Example 1 with OnOffStates

use of alma.ADMINTEST1.OnOffStates in project ACS by ACS-Community.

the class NCPublisherTest method testPublisherSendingEvents.

/**
	 * This test creates one Publisher to a channel and send events.
	 */
public void testPublisherSendingEvents() throws Exception {
    // Creating a new Publisher
    int numEvents = 1000;
    publisher = new NCPublisher<statusBlockEvent1>("testingChannel", services, Helper.getNamingServiceInitial(getContainerServices()));
    assertTrue(publisher != null);
    // Sending numEvents;
    while (publisher.count.get() < numEvents) {
        // Constructing the event
        OnOffStates onOff = OnOffStates.ON;
        statusBlockEvent1 event = null;
        event = new statusBlockEvent1(onOff, "testingEvent", 0, (int) publisher.count.get(), numEvents, false, 100);
        // Publishing the event
        publisher.publishEvent(event);
        // simulates the period
        Thread.sleep((int) event.period);
    }
}
Also used : ADMINTEST1.statusBlockEvent1(alma.ADMINTEST1.statusBlockEvent1) OnOffStates(alma.ADMINTEST1.OnOffStates)

Aggregations

OnOffStates (alma.ADMINTEST1.OnOffStates)1 ADMINTEST1.statusBlockEvent1 (alma.ADMINTEST1.statusBlockEvent1)1