public void testSendComplex() throws Throwable { UMOConnector c = ConnectorFactory.getConnectorByProtocol(getProtocol()); assertNotNull(c); UMOMessageDispatcher dispatcher = c.getDispatcher("ANY"); UMOEndpoint endpoint = new MuleEndpoint( "test", new MuleEndpointURI(getSendReceiveComplexEndpoint1()), c, null, UMOEndpoint.ENDPOINT_TYPE_SENDER, 0, null); UMOEvent event = getTestEvent(new Person("Ross", "Mason"), endpoint); UMOMessage result = dispatcher.send(event); assertNull(result); // lets get our newly added person result = dispatcher.receive(new MuleEndpointURI(getSendReceiveComplexEndpoint2()), 0); assertNotNull(result); assertTrue(result.getPayload() instanceof Person); assertEquals("Ross", ((Person) result.getPayload()).getFirstName()); assertEquals("Mason", ((Person) result.getPayload()).getLastName()); }
public void testReceive() throws Throwable { UMOConnector c = ConnectorFactory.getConnectorByProtocol(getProtocol()); assertNotNull(c); UMOMessageDispatcher dispatcher = c.getDispatcher("ANY"); UMOMessage result = dispatcher.receive(new MuleEndpointURI(getReceiveEndpoint()), 0); assertNotNull(result); assertNotNull(result.getPayload()); assertTrue(result.getPayload().toString().length() > 0); }
public void testReceiveComplex() throws Throwable { UMOConnector c = ConnectorFactory.getConnectorByProtocol(getProtocol()); assertNotNull(c); UMOMessageDispatcher dispatcher = c.getDispatcher("ANY"); UMOMessage result = dispatcher.receive(new MuleEndpointURI(getReceiveComplexEndpoint()), 0); assertNotNull(result); assertTrue(result.getPayload() instanceof Person); assertEquals("Fred", ((Person) result.getPayload()).getFirstName()); assertEquals("Flintstone", ((Person) result.getPayload()).getLastName()); }
public void testReceiveComplexCollection() throws Throwable { UMOConnector c = ConnectorFactory.getConnectorByProtocol(getProtocol()); assertNotNull(c); UMOMessageDispatcher dispatcher = c.getDispatcher("ANY"); UMOMessage result = dispatcher.receive(new MuleEndpointURI(getReceiveComplexCollectionEndpoint()), 0); assertNotNull(result); assertTrue(result.getPayload() instanceof Person[]); assertEquals(3, ((Person[]) result.getPayload()).length); }
public void testException() throws Throwable { UMOConnector c = ConnectorFactory.getConnectorByProtocol(getProtocol()); assertNotNull(c); UMOMessageDispatcher dispatcher = c.getDispatcher("ANY"); UMOEndpoint endpoint = new MuleEndpoint( "test", new MuleEndpointURI(getTestExceptionEndpoint()), c, null, UMOEndpoint.ENDPOINT_TYPE_SENDER, 0, null); UMOEvent event = getTestEvent(new Person("Nodet", "Guillaume"), endpoint); try { dispatcher.send(event); fail("An Fault should have been raised"); } catch (Exception f) { // This is ok } }