Esempio n. 1
0
    for i in range(len(suppliers)):
        print datetime.datetime.now(), " ===  %d: %d exceptions caught" % (
            i, num_exceptions_thrown[i])
        print datetime.datetime.now(), " ===  %d: %d events dropped" % (
            i, num_events_dropped[i])
        print datetime.datetime.now(), " ===  %d: %d events sent" % (
            i, num_events_sent[i])
        print datetime.datetime.now(), " ===  %d: Transitions: %s" % (
            i, str(transitions[i]))


#------------------------------------------------------------------------------

#create suppliers
g = Supplier(channel_name)
g.set_autoreconnect(autoreconnect)
#g_autorec = Supplier(channel_name)
#g_autorec.set_autoreconnect(True)

#create data to send
h = acsnc.EventDescription("no name", 17L, 17L)

publish_all_data([g], num_events, h)

for idx in range(len(transitions)):
    n_transitions = len(transitions[idx])
    if autoreconnect:
        if ns_restarted:
            if n_transitions != 0 and n_transitions != 2:
                print datetime.datetime.now(
                ), "===  %d: Wrong number of transitions. We expected 0 or 2 but was %d" % (
        print curr_t," ===  Published events at iteration %d" % (i)

    for i in range(len(suppliers)):
        print datetime.datetime.now()," ===  %d: %d exceptions caught" % (i,num_exceptions_thrown[i])
        print datetime.datetime.now()," ===  %d: %d events dropped" % (i,num_events_dropped[i])
        print datetime.datetime.now()," ===  %d: %d events sent" % (i,num_events_sent[i])
        print datetime.datetime.now()," ===  %d: Transitions: %s" % (i,str(transitions[i]))
        
            


#------------------------------------------------------------------------------

#create suppliers
g = Supplier(channel_name)
g.set_autoreconnect(autoreconnect)
#g_autorec = Supplier(channel_name)
#g_autorec.set_autoreconnect(True)

#create data to send
h = acsnc.EventDescription("no name",
                           17L,
                           17L)

publish_all_data([g], num_events, h)

for idx in range(len(transitions)):
    n_transitions = len(transitions[idx])
    if autoreconnect:
        if ns_restarted:
            if n_transitions != 0 and n_transitions != 2:
Esempio n. 3
0
#-----------------------------------------------------------------------------
# Wait 10 seconds to ensure the Notify Service is restarted
lm("==========================  Restart the Notify Service and wait some time to allow consumers reconnecting again"
   )
call(["acspyExecNotifyService.sh", "NotifyEventChannelFactory", "RESTART"])
sleep(15)
lm("==========================  At this point the Notify Service should have been restarted and all consumers reconnected"
   )

#------------------------------------------------------------------------------
# Create a supplier and send events
n_events = 20
lm("==========================  Create a supplier and send %d events" %
   (n_events))
s = Supplier(channel_name)
s.set_autoreconnect(True)
h = acsnc.EventDescription("no name", 17L, 17L)
send_events(s, h, n_events)

#------------------------------------------------------------------------------
# Wait and check the number of events received
lm("==========================  Events sent. Wait 5 seconds")
sleep(5)
assert_n_events_received((n_events * num_consumers), n_events_received)

#------------------------------------------------------------------------------
# Suspend consumers
lm("==========================  Suspend consumers")
for c in consumers:
    c.suspend()