[ 
https://issues.apache.org/jira/browse/CAMEL-7599?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14061853#comment-14061853
 ] 

moritz löser edited comment on CAMEL-7599 at 7/15/14 9:00 AM:
--------------------------------------------------------------

I think this is a bug. It should not matter how i acquire an object. The 
methods on the object should just work (as documented in Javadoc).  This is not 
an api question but normal java behavior imho.
But thx for hint how to do it with more boilplate(

// We need to inject the camel context here
                endpoint.setCamelContext(context);
                // Need to call the start to setup right logger processor  
                endpoint.start(); )

I saw similar problems with configureing ftp endpoint and using indempotent 
settings on it. There are other endpoints that worked as documented in javadoc. 
Is there a way to know when an endpoint can be configured with java and when it 
only works with uri (not compile time checked :-()


was (Author: dermoritz):
I think this is a bug. It should not matter how i acquire an object. The 
methods on the object should just work (as documented in Javadoc).  This is not 
an api question but normal java behavior imho.
But how to acquire camel endpoints (or LogEndpoint) to be able to use the 
methods they expose?

I saw similar problems with configureing ftp endpoint and using indempotent 
settings on it. There are other endpoints that worked as documented in javadoc. 
Is there a way to know when an endpoint can be configured with java and when it 
only works with uri (not compile time checked :-()

> LogEndpoint ignores setter (setGroupSize) - set via uri working
> ---------------------------------------------------------------
>
>                 Key: CAMEL-7599
>                 URL: https://issues.apache.org/jira/browse/CAMEL-7599
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.13.1
>         Environment: Eclipse, jUnit, Windows 
>            Reporter: moritz löser
>            Assignee: Willem Jiang
>             Fix For: 2.14.0
>
>
> I just tried to setup a throughput logger with java dsl (not using uri 
> strings) and it seems that setGroupSize and other setters are ignored.
> To reproduce i wrote a test:
> {code:title=EndpointsUtilTest|borderStyle=solid}
> import org.apache.camel.builder.RouteBuilder;
> import org.apache.camel.component.log.LogEndpoint;
> import org.apache.camel.component.mock.MockEndpoint;
> import org.apache.camel.test.junit4.CamelTestSupport;
> import org.junit.Test;
> public class EndpointsUtilTest extends CamelTestSupport {
>     
>         
>     
>     private static final String MOCK_OUT = "mock:out";
>     private static final String DIRECT_IN = "direct:in";
>     @Test
>     public void test() throws InterruptedException {
>         MockEndpoint out = context.getEndpoint(MOCK_OUT, MockEndpoint.class);
>         int expectedCount = 1000;
>         out.expectedMessageCount(expectedCount);
>         for (int i = 0; i < expectedCount; i++) {
>             template.sendBody(DIRECT_IN, "blub");
>         }
>         out.assertIsSatisfied();
>     }
>     @Override
>     protected RouteBuilder createRouteBuilder() throws Exception {
>         return new RouteBuilder() {
>             
>             @Override
>             public void configure() throws Exception {
>                 
> from(DIRECT_IN).to(getTPLogger()).to(getTPLoggerSetter()).to(MOCK_OUT);
>             }
>         };
>     }
>     
>     private LogEndpoint getTPLogger(){
>         LogEndpoint endpoint = 
> context.getEndpoint("log:tplogger?groupSize=10", LogEndpoint.class);
>         
>         return endpoint;
>     }
>     
>     private LogEndpoint getTPLoggerSetter(){
>         LogEndpoint endpoint = context.getEndpoint("log:tploggerSetter", 
> LogEndpoint.class);
>         endpoint.setGroupSize(10);
>         
>         return endpoint;
>     }
>     
> }
> {code}
> Both loggers should produce same output but only the one produced with 
> getTPLogger() is a correct throughput logger. 



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to