Package org.mule.tck.testmodels.fruit

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


    public void testExplicitMethodMatchSetArrayFail() throws Exception
    {
        try
        {
            LegacyEntryPointResolverSet resolver = new LegacyEntryPointResolverSet();
            resolver.invoke(new FruitBowl(), getTestEventContext(new Fruit[]{new Apple(), new Orange()}));
            fail("Test should have failed because the arguments were not wrapped properly: ");
        }
        catch (MuleException e)
        {
            //expected
View Full Code Here


    public void testExplicitMethodMatchSetArrayPass() throws Exception
    {
        try
        {
            LegacyEntryPointResolverSet resolver = new LegacyEntryPointResolverSet();
            resolver.invoke(new FruitBowl(), getTestEventContext(new Object[]{new Fruit[]{new Apple(), new Orange()}}));
        }
        catch (MuleException e)
        {
            fail("Test should have passed: " + e);
        }
View Full Code Here

    {
        try
        {
            LegacyEntryPointResolverSet resolver = new LegacyEntryPointResolverSet();
            resolver.addEntryPointResolver(new ArrayEntryPointResolver());
            resolver.invoke(new FruitBowl(), getTestEventContext(new Fruit[]{new Apple(), new Orange()}));
        }
        catch (MuleException e)
        {
            fail("Test should have passed: " + e);
        }
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

        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

        // make sure that both test properties are set here
        if (properties.get("test1") == null || properties.get("test2") == null)
        {
            throw new Exception("Both properties should be set before the factory method is called");
        }
        return new Orange();
    }
View Full Code Here

    @Test
    public void testExplicitMethodMatchSetArrayFail() throws Exception
    {
        ReflectionEntryPointResolver resolver = new ReflectionEntryPointResolver();
        InvocationResult result = resolver.invoke(new FruitBowl(), getTestEventContext(new Fruit[]{new Apple(), new Orange()}));
        assertEquals("Test should have failed because the arguments were not wrapped properly: ",
                result.getState(), InvocationResult.State.FAILED);
    }
View Full Code Here

    @Test
    public void testExplicitMethodMatchSetArrayPass() throws Exception
    {
        ReflectionEntryPointResolver resolver = new ReflectionEntryPointResolver();
        InvocationResult result = resolver.invoke(new FruitBowl(), getTestEventContext(new Object[]{new Fruit[]{new Apple(), new Orange()}}));
        assertEquals(result.getState(), InvocationResult.State.SUCCESSFUL);
    }
View Full Code Here

    @Test
    public void testBeanPropertiesOnAProxy() throws Exception
    {
        OrangeInterface o = (OrangeInterface)Proxy.newProxyInstance(getClass().getClassLoader(),
                new Class[]{OrangeInterface.class}, new OrangeInvocationHandler(new Orange()));

        BeanUtils.populateWithoutFail(o, map, true);

        assertNotNull(o);
        assertEquals("Juicy!", o.getBrand());
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.