}
public void testPushAny() throws Exception
{
// setup test data
AnyMessage _event = new AnyMessage();
Any _any = getORB().create_any();
PropertySeqHelper.insert(_any, new Property[] {
new Property("operation", toAny(DRINKING_COFFEE_ID)),
new Property("name", toAny("alphonse")), new Property("minutes", toAny(10)) });
_event.setAny(_any);
final CountDownLatch _hasReceived = new CountDownLatch(1);
// setup mock
MockCoffee _mockCoffee = new MockCoffee()
{
public void drinking_coffee(String name, int minutes)
{
super.drinking_coffee(name, minutes);
assertEquals("alphonse", name);
assertEquals(10, minutes);
_hasReceived.countDown();
}
};
_mockCoffee.drinking_coffee_expect = 1;
// setup and connect consumer
final Coffee _coffee = _mockCoffee._this(getClientORB());
MockTypedPushConsumer _mockConsumer = new MockTypedPushConsumer()
{
public org.omg.CORBA.Object get_typed_consumer()
{
return _coffee;
}
};
TypedPushConsumer _consumer = _mockConsumer._this(getClientORB());
proxyPushSupplier_.connect_typed_push_consumer(_consumer);
// run test
objectUnderTest_.getMessageConsumer().queueMessage(_event.getHandle());
assertTrue(_hasReceived.await(5000, TimeUnit.MILLISECONDS));
// verify results
_mockCoffee.verify();