On Sat, Jan 28, 2012 at 2:44 PM, Hadrian Zbarcea <hzbar...@gmail.com> wrote:
> I will look into the reason for failure. On the fact that it does the same
> you are wrong. You totally missed the nature of the test. Previously the
> trigger was not firing at the right times after a restart. I am working on
> fixes and improvements in the quartz component now. I will add some details
> to make it clearer what's being tested.
>

Cool.

Btw check this FAQ how to stop a route from a route
http://camel.apache.org/how-can-i-stop-a-route-from-a-route.html

> Cheers,
> Hadrian
>
>
>
> On 01/28/2012 04:24 AM, Claus Ibsen wrote:
>>
>> The test keeps failing occasionally on CI servers.
>>
>> The test does the same.
>> Restart the route, and checks that when the route is stopped, that
>> quartz, does not emit new messages.
>>
>>
>>
>> On Fri, Jan 27, 2012 at 9:11 PM, Hadrian Zbarcea<hzbar...@gmail.com>
>>  wrote:
>>>
>>> I have no idea what prompted this change, but it removed important tests.
>>> It
>>> would help to ask next time.
>>>
>>> Hadrian
>>>
>>>
>>>
>>>
>>> On 01/27/2012 03:10 AM, davscl...@apache.org wrote:
>>>>
>>>>
>>>> Author: davsclaus
>>>> Date: Fri Jan 27 08:10:06 2012
>>>> New Revision: 1236567
>>>>
>>>> URL: http://svn.apache.org/viewvc?rev=1236567&view=rev
>>>> Log:
>>>> Fixed test
>>>>
>>>> Modified:
>>>>
>>>>
>>>> camel/trunk/components/camel-quartz/src/test/java/org/apache/camel/component/quartz/QuartzRouteRestartTest.java
>>>>
>>>> Modified:
>>>>
>>>> camel/trunk/components/camel-quartz/src/test/java/org/apache/camel/component/quartz/QuartzRouteRestartTest.java
>>>> URL:
>>>>
>>>> http://svn.apache.org/viewvc/camel/trunk/components/camel-quartz/src/test/java/org/apache/camel/component/quartz/QuartzRouteRestartTest.java?rev=1236567&r1=1236566&r2=1236567&view=diff
>>>>
>>>>
>>>> ==============================================================================
>>>> ---
>>>>
>>>> camel/trunk/components/camel-quartz/src/test/java/org/apache/camel/component/quartz/QuartzRouteRestartTest.java
>>>> (original)
>>>> +++
>>>>
>>>> camel/trunk/components/camel-quartz/src/test/java/org/apache/camel/component/quartz/QuartzRouteRestartTest.java
>>>> Fri Jan 27 08:10:06 2012
>>>> @@ -16,11 +16,6 @@
>>>>   */
>>>>  package org.apache.camel.component.quartz;
>>>>
>>>> -import java.util.Calendar;
>>>> -import java.util.Date;
>>>> -
>>>> -import org.apache.camel.Exchange;
>>>> -import org.apache.camel.Processor;
>>>>  import org.apache.camel.builder.RouteBuilder;
>>>>  import org.apache.camel.component.mock.MockEndpoint;
>>>>  import org.apache.camel.test.junit4.CamelTestSupport;
>>>> @@ -34,10 +29,25 @@ public class QuartzRouteRestartTest exte
>>>>      @Test
>>>>      public void testQuartzCronRoute() throws Exception {
>>>>          MockEndpoint mock = getMockEndpoint("mock:result");
>>>> -        mock.setResultWaitTime(15000);
>>>> -        mock.expectedMinimumMessageCount(3);
>>>> -        mock.message(0).arrives().between(6, 9).seconds().beforeNext();
>>>> -        mock.message(2).arrives().between(3,
>>>> 5).seconds().afterPrevious();
>>>> +        mock.expectedMinimumMessageCount(2);
>>>> +
>>>> +        assertMockEndpointsSatisfied();
>>>> +
>>>> +        // restart route
>>>> +        context().stopRoute("trigger");
>>>> +        mock.reset();
>>>> +        mock.expectedMessageCount(0);
>>>> +
>>>> +        // wait a bit
>>>> +        Thread.sleep(2000);
>>>> +
>>>> +        assertMockEndpointsSatisfied();
>>>> +
>>>> +        // start route, and we got messages again
>>>> +        mock.reset();
>>>> +        mock.expectedMessageCount(1);
>>>> +
>>>> +        context().startRoute("trigger");
>>>>
>>>>          assertMockEndpointsSatisfied();
>>>>      }
>>>> @@ -46,35 +56,10 @@ public class QuartzRouteRestartTest exte
>>>>      protected RouteBuilder createRouteBuilder() {
>>>>          return new RouteBuilder() {
>>>>              public void configure() {
>>>> -                // START SNIPPET: e1
>>>> -
>>>>
>>>>  from("quartz://groupName/timerName?cron=0/4+*+*+*+*+?").routeId("trigger")
>>>> -                    .setBody(bean(CurrentTime.class))
>>>> -                    // .to("log:QUARTZ")
>>>> -                    .to("seda:control");
>>>> -
>>>> -                from("seda:control").routeId("control")
>>>> -                    // .to("log:CONTROL")
>>>> -                    .to("mock:result")
>>>> -                    .process(new Processor() {
>>>> -                        private boolean done;
>>>> -                        @Override
>>>> -                        public void process(Exchange exchange) throws
>>>> Exception {
>>>> -                            if (!done) {
>>>> -                                done = true;
>>>> -
>>>>  exchange.getContext().stopRoute("trigger");
>>>> -                                Thread.sleep(5000);
>>>> -
>>>>  exchange.getContext().startRoute("trigger");
>>>> -                            }
>>>> -                        }
>>>> -                    });
>>>> -                // END SNIPPET: e1
>>>> +
>>>>
>>>>  from("quartz://groupName/timerName?cron=0/1+*+*+*+*+?").routeId("trigger")
>>>> +                    .to("mock:result");
>>>>              }
>>>>          };
>>>>      }
>>>>
>>>> -    public static class CurrentTime {
>>>> -        public Date get() {
>>>> -            return Calendar.getInstance().getTime();
>>>> -        }
>>>> -    }
>>>>  }
>>>>
>>>>
>>>
>>> --
>>> Hadrian Zbarcea
>>> Principal Software Architect
>>> Talend, Inc
>>> http://coders.talend.com/
>>> http://camelbot.blogspot.com/
>>
>>
>>
>>
>
> --
> Hadrian Zbarcea
> Principal Software Architect
> Talend, Inc
> http://coders.talend.com/
> http://camelbot.blogspot.com/



-- 
Claus Ibsen
-----------------
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Reply via email to