Package org.mule.tck.testmodels.fruit

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


public class OgnlExpressionEvaluatorTestCase extends AbstractMuleTestCase
{

    public void testWithExpressions()
    {
        Apple apple = new Apple();
        apple.wash();
        Banana banana = new Banana();
        banana.bite();
        FruitBowl payload = new FruitBowl(apple, banana);
        DefaultMuleMessage msg = new DefaultMuleMessage(payload, muleContext);
        OgnlExpressionEvaluator e = new OgnlExpressionEvaluator();
View Full Code Here


    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)
        {
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

        // those are usually set on the endpoint and copied over to the message
        RequestContext.getEventContext().getMessage().setOutboundProperty(METHOD_PROPERTY_NAME,
                                                                          INVALID_METHOD_NAME);

        Apple apple = new Apple();
        apple.setAppleCleaner(new FruitCleaner()
        {
            public void wash(Fruit fruit)
            {
                // dummy
            }
View Full Code Here

    // TODO MULE-1088: currently fails, therefore disabled
    public void testArrayArgumentResolution() throws Exception
    {
        EntryPointResolverSet resolverSet = new LegacyEntryPointResolverSet();

        Object payload = new Object[]{new Fruit[]{new Apple(), new Banana()}};
        RequestContext.setEvent(getTestEvent(payload));

        FruitBowl bowl = new FruitBowl();
        assertFalse(bowl.hasApple());
        assertFalse(bowl.hasBanana());
View Full Code Here

    /** Test for proper resolution of a method that takes a List as argument. */
    public void testListArgumentResolution() throws Exception
    {
        EntryPointResolverSet resolverSet = new LegacyEntryPointResolverSet();
        Object payload = Arrays.asList(new Fruit[]{new Apple(), new Banana()});
        RequestContext.setEvent(getTestEvent(payload));

        FruitBowl bowl = new FruitBowl();
        assertFalse(bowl.hasApple());
        assertFalse(bowl.hasBanana());
View Full Code Here

    /** Test for proper resolution of an existing method specified as override */
    public void testExplicitOverride() throws Exception
    {
        EntryPointResolverSet resolverSet = new LegacyEntryPointResolverSet();

        Object payload = Arrays.asList(new Fruit[]{new Apple(), new Banana()});
        RequestContext.setEvent(getTestEvent(payload));

        final String methodName = "setFruit";
        final String propertyName = MuleProperties.MULE_METHOD_PROPERTY;
        RequestContext.getEventContext().getMessage().setOutboundProperty(propertyName, methodName);
View Full Code Here

    protected RemoteDispatcherNotification getNotification()
    {
        Map<String, Object> props = new HashMap<String, Object>();
        props.put("key1", "value1");
       
        Apple apple = new Apple();
        apple.wash();
       
        MuleMessage message = new DefaultMuleMessage(apple, props, muleContext);
        RemoteDispatcherNotification notification = new RemoteDispatcherNotification(message,
            RemoteDispatcherNotification.ACTION_SEND, "vm://foo");
        notification.setProperty("foo", "bar");
View Full Code Here

     */
    public void testMethodPropertyParameterAssignableFromPayload() throws Exception
    {
        ExplicitMethodEntryPointResolver resolver = new ExplicitMethodEntryPointResolver();
        resolver.addMethod("wash");
        MuleEventContext ctx = getTestEventContext(new Apple());
        InvocationResult result = resolver.invoke(new TestFruitCleaner(), ctx);
        assertEquals(result.getState(), InvocationResult.State.SUCCESSFUL);
    }
View Full Code Here

TOP

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

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.