Even better, avoid commenting out code. Prefer to either fix the code and remove the unnecessary code or, if you don't have the time, raise a jira pointing at that code and provide your explanations there. Otherwise odds are the commented code will stay there unfixed forever.
Thanks Hadrian On Jan 27, 2011, at 10:28 AM, Claus Ibsen wrote: > Hi > > It would be great to avoid commit to trunk while a VOTE is in progress. > It makes it much easier if a showstopper is spotted to have the fix > commited and re-do a release. > > We frankly dont want to reo-do a release where new features or > improvements have been committed to trunk. > Hence why the commits have been so quiet lately. > > The VOTE would hopefully pass tomorrow and hadrian promoting the > artifcats. When that's done, then we are free to commit all we want. > > Also try to avoid commiting code where you have commented out source > code, without indicating why you do that, eg > you have /* ... */ in there > > > On Thu, Jan 27, 2011 at 4:21 PM, <aka...@apache.org> wrote: >> Author: akarpe >> Date: Thu Jan 27 15:21:27 2011 >> New Revision: 1064154 >> >> URL: http://svn.apache.org/viewvc?rev=1064154&view=rev >> Log: >> CAMEL-3575 Fixed issues in allowing ScheduledRoutePolicy to handle >> more than one action (start, stop, resume, pause) >> >> Added: >> >> camel/trunk/components/camel-quartz/src/main/java/org/apache/camel/routepolicy/quartz/ScheduledJobState.java >> >> camel/trunk/components/camel-quartz/src/test/java/org/apache/camel/routepolicy/quartz/SimpleScheduledCombinedRoutePolicyTest.java >> Modified: >> >> camel/trunk/components/camel-quartz/src/main/java/org/apache/camel/routepolicy/quartz/ScheduledJob.java >> >> camel/trunk/components/camel-quartz/src/main/java/org/apache/camel/routepolicy/quartz/ScheduledRoutePolicy.java >> >> Modified: >> camel/trunk/components/camel-quartz/src/main/java/org/apache/camel/routepolicy/quartz/ScheduledJob.java >> URL: >> http://svn.apache.org/viewvc/camel/trunk/components/camel-quartz/src/main/java/org/apache/camel/routepolicy/quartz/ScheduledJob.java?rev=1064154&r1=1064153&r2=1064154&view=diff >> ============================================================================== >> --- >> camel/trunk/components/camel-quartz/src/main/java/org/apache/camel/routepolicy/quartz/ScheduledJob.java >> (original) >> +++ >> camel/trunk/components/camel-quartz/src/main/java/org/apache/camel/routepolicy/quartz/ScheduledJob.java >> Thu Jan 27 15:21:27 2011 >> @@ -41,8 +41,11 @@ public class ScheduledJob implements Job >> throw new JobExecutionException("Failed to obtain scheduler >> context for job " + jobExecutionContext.getJobDetail().getName()); >> } >> >> - Action storedAction = (Action) >> schedulerContext.get(SCHEDULED_ACTION); >> - storedRoute = (Route) schedulerContext.get(SCHEDULED_ROUTE); >> +/* Action storedAction = (Action) >> schedulerContext.get(SCHEDULED_ACTION); >> + storedRoute = (Route) schedulerContext.get(SCHEDULED_ROUTE);*/ >> + ScheduledJobState state = (ScheduledJobState) >> schedulerContext.get(jobExecutionContext.getJobDetail().getName()); >> + Action storedAction = state.getAction(); >> + storedRoute = state.getRoute(); >> >> ScheduledRoutePolicy policy = (ScheduledRoutePolicy) >> storedRoute.getRouteContext().getRoutePolicy(); >> try { >> >> Added: >> camel/trunk/components/camel-quartz/src/main/java/org/apache/camel/routepolicy/quartz/ScheduledJobState.java >> URL: >> http://svn.apache.org/viewvc/camel/trunk/components/camel-quartz/src/main/java/org/apache/camel/routepolicy/quartz/ScheduledJobState.java?rev=1064154&view=auto >> ============================================================================== >> --- >> camel/trunk/components/camel-quartz/src/main/java/org/apache/camel/routepolicy/quartz/ScheduledJobState.java >> (added) >> +++ >> camel/trunk/components/camel-quartz/src/main/java/org/apache/camel/routepolicy/quartz/ScheduledJobState.java >> Thu Jan 27 15:21:27 2011 >> @@ -0,0 +1,37 @@ >> +/** >> + * Licensed to the Apache Software Foundation (ASF) under one or more >> + * contributor license agreements. See the NOTICE file distributed with >> + * this work for additional information regarding copyright ownership. >> + * The ASF licenses this file to You under the Apache License, Version 2.0 >> + * (the "License"); you may not use this file except in compliance with >> + * the License. You may obtain a copy of the License at >> + * >> + * http://www.apache.org/licenses/LICENSE-2.0 >> + * >> + * Unless required by applicable law or agreed to in writing, software >> + * distributed under the License is distributed on an "AS IS" BASIS, >> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. >> + * See the License for the specific language governing permissions and >> + * limitations under the License. >> + */ >> +package org.apache.camel.routepolicy.quartz; >> + >> +import org.apache.camel.Route; >> + >> +public class ScheduledJobState { >> + private final ScheduledRoutePolicyConstants.Action action; >> + private final Route route; >> + >> + public ScheduledJobState(ScheduledRoutePolicyConstants.Action action, >> Route route) { >> + this.action = action; >> + this.route = route; >> + } >> + >> + public ScheduledRoutePolicyConstants.Action getAction() { >> + return action; >> + } >> + >> + public Route getRoute() { >> + return route; >> + } >> +} >> >> Modified: >> camel/trunk/components/camel-quartz/src/main/java/org/apache/camel/routepolicy/quartz/ScheduledRoutePolicy.java >> URL: >> http://svn.apache.org/viewvc/camel/trunk/components/camel-quartz/src/main/java/org/apache/camel/routepolicy/quartz/ScheduledRoutePolicy.java?rev=1064154&r1=1064153&r2=1064154&view=diff >> ============================================================================== >> --- >> camel/trunk/components/camel-quartz/src/main/java/org/apache/camel/routepolicy/quartz/ScheduledRoutePolicy.java >> (original) >> +++ >> camel/trunk/components/camel-quartz/src/main/java/org/apache/camel/routepolicy/quartz/ScheduledRoutePolicy.java >> Thu Jan 27 15:21:27 2011 >> @@ -78,7 +78,7 @@ public abstract class ScheduledRoutePoli >> Trigger trigger = createTrigger(action, route); >> updateScheduledRouteDetails(action, jobDetail, trigger); >> >> - loadCallbackDataIntoSchedulerContext(action, route); >> + loadCallbackDataIntoSchedulerContext(jobDetail, action, route); >> getScheduler().scheduleJob(jobDetail, trigger); >> >> if (LOG.isDebugEnabled()) { >> @@ -153,9 +153,10 @@ public abstract class ScheduledRoutePoli >> } >> } >> >> - protected void loadCallbackDataIntoSchedulerContext(Action action, >> Route route) throws SchedulerException { >> - getScheduler().getContext().put(SCHEDULED_ACTION, action); >> - getScheduler().getContext().put(SCHEDULED_ROUTE, route); >> + protected void loadCallbackDataIntoSchedulerContext(JobDetail >> jobDetail, Action action, Route route) throws SchedulerException { >> +/* getScheduler().getContext().put(SCHEDULED_ACTION, action); >> + getScheduler().getContext().put(SCHEDULED_ROUTE, route);*/ >> + getScheduler().getContext().put(jobDetail.getName(), new >> ScheduledJobState(action, route)); >> } >> >> public String retrieveTriggerName(Action action) { >> >> Added: >> camel/trunk/components/camel-quartz/src/test/java/org/apache/camel/routepolicy/quartz/SimpleScheduledCombinedRoutePolicyTest.java >> URL: >> http://svn.apache.org/viewvc/camel/trunk/components/camel-quartz/src/test/java/org/apache/camel/routepolicy/quartz/SimpleScheduledCombinedRoutePolicyTest.java?rev=1064154&view=auto >> ============================================================================== >> --- >> camel/trunk/components/camel-quartz/src/test/java/org/apache/camel/routepolicy/quartz/SimpleScheduledCombinedRoutePolicyTest.java >> (added) >> +++ >> camel/trunk/components/camel-quartz/src/test/java/org/apache/camel/routepolicy/quartz/SimpleScheduledCombinedRoutePolicyTest.java >> Thu Jan 27 15:21:27 2011 >> @@ -0,0 +1,93 @@ >> +/** >> + * Licensed to the Apache Software Foundation (ASF) under one or more >> + * contributor license agreements. See the NOTICE file distributed with >> + * this work for additional information regarding copyright ownership. >> + * The ASF licenses this file to You under the Apache License, Version 2.0 >> + * (the "License"); you may not use this file except in compliance with >> + * the License. You may obtain a copy of the License at >> + * >> + * http://www.apache.org/licenses/LICENSE-2.0 >> + * >> + * Unless required by applicable law or agreed to in writing, software >> + * distributed under the License is distributed on an "AS IS" BASIS, >> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. >> + * See the License for the specific language governing permissions and >> + * limitations under the License. >> + */ >> +package org.apache.camel.routepolicy.quartz; >> + >> +import java.util.Date; >> +import java.util.concurrent.TimeUnit; >> + >> +import org.apache.camel.CamelExecutionException; >> +import org.apache.camel.ServiceStatus; >> +import org.apache.camel.builder.RouteBuilder; >> +import org.apache.camel.component.mock.MockEndpoint; >> +import org.apache.camel.component.quartz.QuartzComponent; >> +import org.apache.camel.test.junit4.CamelTestSupport; >> +import org.apache.camel.util.ServiceHelper; >> +import org.apache.commons.logging.Log; >> +import org.apache.commons.logging.LogFactory; >> +import org.junit.Test; >> + >> +/** >> + * @version $Revision: 882486 $ >> + */ >> +public class SimpleScheduledCombinedRoutePolicyTest extends >> CamelTestSupport { >> + private static final transient Log LOG = >> LogFactory.getLog(SimpleScheduledCombinedRoutePolicyTest.class); >> + >> + /* (non-Javadoc) >> + * @see org.apache.camel.test.junit4.CamelTestSupport#s;etUp() >> + */ >> + @Override >> + public void setUp() throws Exception { >> + super.setUp(); >> + } >> + >> + /* (non-Javadoc) >> + * @see >> org.apache.camel.test.junit4.CamelTestSupport#isUseRouteBuilder() >> + */ >> + @Override >> + public boolean isUseRouteBuilder() { >> + return false; >> + } >> + >> + @Test >> + public void testScheduledStartAndStopRoutePolicy() throws Exception { >> + MockEndpoint success = (MockEndpoint) >> context.getEndpoint("mock:success"); >> + >> + success.expectedMessageCount(1); >> + >> + context.getComponent("quartz", >> QuartzComponent.class).setPropertiesFile("org/apache/camel/routepolicy/quartz/myquartz.properties"); >> + context.getComponent("quartz", QuartzComponent.class).start(); >> + context.addRoutes(new RouteBuilder() { >> + public void configure() { >> + SimpleScheduledRoutePolicy policy = new >> SimpleScheduledRoutePolicy(); >> + long startTime = System.currentTimeMillis() + 3000L; >> + long stopTime = System.currentTimeMillis() + 8000L; >> + policy.setRouteStartDate(new Date(startTime)); >> + policy.setRouteStartRepeatCount(1); >> + policy.setRouteStartRepeatInterval(3000); >> + policy.setRouteStopDate(new Date(stopTime)); >> + policy.setRouteStopRepeatCount(1); >> + policy.setRouteStopRepeatInterval(3000); >> + >> + from("direct:start") >> + .routeId("test") >> + .routePolicy(policy) >> + .to("mock:success"); >> + } >> + }); >> + context.start(); >> + >> + Thread.sleep(5000); >> + assertTrue(context.getRouteStatus("test") == ServiceStatus.Started); >> + template.sendBody("direct:start", "Ready or not, Here, I come"); >> + Thread.sleep(5000); >> + assertTrue(context.getRouteStatus("test") == ServiceStatus.Stopped); >> + >> + context.getComponent("quartz", QuartzComponent.class).stop(); >> + success.assertIsSatisfied(); >> + } >> + >> +} >> >> >> > > > > -- > Claus Ibsen > ----------------- > FuseSource > Email: cib...@fusesource.com > Web: http://fusesource.com > Twitter: davsclaus > Blog: http://davsclaus.blogspot.com/ > Author of Camel in Action: http://www.manning.com/ibsen/