Package org.mule.tck.testmodels.fruit

Examples of org.mule.tck.testmodels.fruit.Orange


    {
        jsonString = "{\"apple\":{\"bitten\":true,\"washed\":false},\"orange\":{\"brand\":\""
            +  getBrandOfOrange(Locale.JAPAN)
            + "\",\"segments\":8,\"radius\":3.45,\"listProperties\":null,\"mapProperties\":null,\"arrayProperties\":null}}";

        jsonObject = new FruitCollection(new Apple(true), null, new Orange(8, 3.45, getBrandOfOrange(Locale.JAPAN)));
    }
View Full Code Here


    public void testWriteReadPayload() throws Exception
    {
        // Create orange to send over the wire
        Properties messageProerties = new Properties();
        messageProerties.put("key1", "val1");
        Orange inOrange = new Orange();
        inOrange.setBrand("Walmart");
        inOrange.setMapProperties(messageProerties);

        Object outObject = readWrite(inOrange);

        // Test deserialized Fruit
        // TODO This wire-format wraps desrialized payloads in a message. See
View Full Code Here

        Session session = mock(Session.class);
        when(session.createObjectMessage()).thenReturn(new ActiveMQObjectMessage());

        // Creates a test Map containing a serializable object
        Map data = new HashMap();
        data.put("orange", new Orange());

        Message message = JmsMessageUtils.toMessage(data, session);
        assertTrue(message instanceof ObjectMessage);

        ObjectMessage objectMessage = (ObjectMessage) message;
        Map values = (Map) objectMessage.getObject();
        assertEquals(new Orange(), values.get("orange"));
    }
View Full Code Here

        Map p = new HashMap();
        p.put("Key1", "Value1");
        p.put("Key2", new byte[]{1,2,3});
        p.put("Key3", new Double(99.999));
        p.put("Key4", new Orange());

        AbstractJmsTransformer trans = new SessionEnabledObjectToJMSMessage(session);
        trans.setReturnDataType(DataTypeFactory.create(ObjectMessage.class));
        initialiseObject(trans);
        Object result2 = trans.transform(p);
        assertTrue("Transformed object should be a ObjectMessage", result2 instanceof ObjectMessage);

        ObjectMessage oMsg = (ObjectMessage) result2;
        AbstractJmsTransformer trans2 = createObject(JMSMessageToObject.class);
        trans2.setReturnDataType(DataTypeFactory.create(Map.class));
        Object result = trans2.transform(oMsg);
        assertTrue("Transformed object should be a Map", result instanceof Map);

        Map m = (Map)result;
        assertEquals("Value1", m.get("Key1"));
        assertTrue(Arrays.equals(new byte[]{1,2,3}, (byte[])m.get("Key2")));
        assertEquals(new Double(99.999), m.get("Key3"));
        assertEquals(new Orange(), m.get("Key4"));

    }
View Full Code Here

        splitter.setListener(listener);
        splitter.setMuleContext(muleContext);

        Apple apple = new Apple();
        Banana banana = new Banana();
        Orange orange = new Orange();
        FruitBowl fruitBowl = new FruitBowl();
        fruitBowl.addFruit(apple);
        fruitBowl.addFruit(banana);
        fruitBowl.addFruit(orange);
View Full Code Here

        return "<fruit><orange name=\"Juicy\"><segments>14</segments><radius>5.43</radius></orange></fruit>";
    }

    public Object getResultData()
    {
        return new Orange(14, 5.43, "Juicy");
    }
View Full Code Here

    public void testWriteReadPayload() throws Exception
    {
        // Create orange to send over the wire
        Properties messageProerties = new Properties();
        messageProerties.put("key1", "val1");
        Orange inOrange = new Orange();
        inOrange.setBrand("Walmart");
        inOrange.setMapProperties(messageProerties);

        try
        {
            readWrite(inOrange);
            fail("Expected exception: MuleMessageWireFormat does not support other types");
View Full Code Here

    public void testWriteReadPayload() throws Exception
    {
        // Create orange to send over the wire
        Properties messageProerties = new Properties();
        messageProerties.put("key1", "val1");
        Orange inOrange = new Orange();
        inOrange.setBrand("Walmart");
        inOrange.setMapProperties(messageProerties);

        Object outObject = readWrite(inOrange);

        // Test deserialized Fruit
        assertTrue(outObject instanceof Orange);
View Full Code Here

        assertEquals(Apple.class, component.getObjectFactory().getObjectClass());
        assertEquals(Apple.class, component.getObjectType());

        try
        {
            component = new SimpleCallableJavaComponent(new Orange());
        }
        catch (Exception e)
        {
            assertSame(DefaultMuleException.class, e.getClass());
        }
View Full Code Here

            setReturnDataType(DataTypeFactory.create(Orange.class));
        }

        protected Object doTransform(Object src, String encoding) throws TransformerException
        {
            return new Orange();
        }
View Full Code Here

TOP

Related Classes of org.mule.tck.testmodels.fruit.Orange

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.