camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anton Sulim (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CAMEL-11178) Default method is invisible during Camel Simple evaluation
Date Thu, 20 Apr 2017 13:24:04 GMT
Anton Sulim created CAMEL-11178:
-----------------------------------

             Summary: Default method is invisible during Camel Simple evaluation
                 Key: CAMEL-11178
                 URL: https://issues.apache.org/jira/browse/CAMEL-11178
             Project: Camel
          Issue Type: Bug
          Components: camel-core
    Affects Versions: 2.16.1
            Reporter: Anton Sulim


Issue can be reproduced with below unit test, I have not found it in tracker. 
Essence: interface A has default method, interface B extends A, default method is invisible
during Simple language evaluation. 

{code:java}
import org.apache.camel.CamelContext;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.impl.DefaultExchange;
import org.junit.Assert;
import org.junit.Test;

public class DefaultMethodIsInvisibleTest {

    public static interface A {
        public default String defaultMethod() {
            return "default method result";
        }
    }

    public static interface B extends A {
    }

    @Test
    public void camelSimpleDoesNotSeeDefaultMethod() throws Exception {
        CamelContext context = new DefaultCamelContext();
        context.addRoutes(new RouteBuilder() {
            public void configure() {
                from("direct:camelSimpleDoesNotSeeDefaultMethod").log("Result of default method
invocation is ${exchangeProperty.myObject.defaultMethod}");
            }
        });
        context.start();

        Exchange incomingExchange = new DefaultExchange(context);
        incomingExchange.setProperty("myObject", new B() {
        });

        Exchange result = context.createProducerTemplate().send("direct:camelSimpleDoesNotSeeDefaultMethod",
incomingExchange);

        Assert.assertNull(result.getException());
    }

}
{code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message