Author: dvaleri Date: Mon Feb 6 20:11:30 2012 New Revision: 1241144 URL: http://svn.apache.org/viewvc?rev=1241144&view=rev Log: [CAMEL-4987] Push of initial Spring Test integration code for TestNG.
Added: camel/trunk/components/camel-testng/src/main/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTests.java (with props) camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsDisableJmxInheritedOverrideTest.java (with props) camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsDisableJmxInheritedTest.java (with props) camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsDisableJmxTest.java (with props) camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsExcludeRoutesTest.java (with props) camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsLazyLoadTypeConvertersInheritedOverrideTest.java (with props) camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsLazyLoadTypeConvertersInheritedTest.java (with props) camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsLazyLoadTypeConvertersTest.java (with props) camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsMockEndpointsTest.java (with props) camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsPlainTest.java (with props) camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsProvidesBreakpointInherritedTest.java (with props) camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsProvidesBreakpointTest.java (with props) camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsShutdownTimeoutInheritedOverrideTest.java (with props) camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsShutdownTimeoutInheritedTest.java (with props) camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsShutdownTimeoutTest.java (with props) camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsUseAdviceWithTest.java (with props) camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/TestRouteBuilder.java (with props) camel/trunk/components/camel-testng/src/test/resources/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsPlainTest-context.xml (with props) Modified: camel/trunk/components/camel-testng/pom.xml camel/trunk/components/camel-testng/src/main/java/org/apache/camel/testng/CamelSpringTestSupport.java Modified: camel/trunk/components/camel-testng/pom.xml URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-testng/pom.xml?rev=1241144&r1=1241143&r2=1241144&view=diff ============================================================================== --- camel/trunk/components/camel-testng/pom.xml (original) +++ camel/trunk/components/camel-testng/pom.xml Mon Feb 6 20:11:30 2012 @@ -46,6 +46,10 @@ <artifactId>camel-spring</artifactId> </dependency> <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-test-spring</artifactId> + </dependency> + <dependency> <groupId>org.testng</groupId> <artifactId>testng</artifactId> </dependency> @@ -56,6 +60,11 @@ <artifactId>slf4j-log4j12</artifactId> <scope>test</scope> </dependency> + + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-test</artifactId> + </dependency> </dependencies> Added: camel/trunk/components/camel-testng/src/main/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTests.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-testng/src/main/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTests.java?rev=1241144&view=auto ============================================================================== --- camel/trunk/components/camel-testng/src/main/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTests.java (added) +++ camel/trunk/components/camel-testng/src/main/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTests.java Mon Feb 6 20:11:30 2012 @@ -0,0 +1,133 @@ +/** + * 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.testng; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +import org.apache.camel.test.spring.CamelSpringTestContextLoader; +import org.apache.camel.test.spring.CamelSpringTestContextLoaderTestExecutionListener; +import org.apache.camel.test.spring.DisableJmxTestExecutionListener; +import org.apache.camel.test.spring.StopWatchTestExecutionListener; + +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.test.context.ContextLoader; +import org.springframework.test.context.TestContextManager; +import org.springframework.test.context.TestExecutionListeners; +import org.springframework.test.context.support.DependencyInjectionTestExecutionListener; +import org.springframework.test.context.support.DirtiesContextTestExecutionListener; +import org.springframework.test.context.testng.AbstractTestNGSpringContextTests; +import org.springframework.test.context.transaction.TransactionalTestExecutionListener; + +import org.testng.IHookCallBack; +import org.testng.IHookable; +import org.testng.ITestResult; +import org.testng.annotations.AfterClass; +import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.BeforeMethod; + +/** + * Bridges Camel testing capabilities from {@link CamelSpringTestSupport} into + * Spring Test driven classes. This class is based on {@link AbstractTestNGSpringContextTests} + * but must re-implement much of the logic due to a lack of extensibility in + * {@code AbstractTestNGSpringContextTests}. Specifically the need to inject a different default + * {@link ContextLoader} implementation and to prepend {@link TestExecutionListeners} to the list + * defined on {@code AbstractTestNGSpringContextTests}. + */ +@TestExecutionListeners( + listeners = { + CamelSpringTestContextLoaderTestExecutionListener.class, + DependencyInjectionTestExecutionListener.class, + DirtiesContextTestExecutionListener.class, + TransactionalTestExecutionListener.class, + DisableJmxTestExecutionListener.class, + StopWatchTestExecutionListener.class}) +public abstract class AbstractCamelTestNGSpringContextTests + implements IHookable, ApplicationContextAware { + + protected ApplicationContext applicationContext; + + private final TestContextManager testContextManager; + + private Throwable testException; + + /** + * Construct a new AbstractTestNGSpringContextTests instance and initialize + * the internal {@link TestContextManager} for the current test. + */ + public AbstractCamelTestNGSpringContextTests() { + this.testContextManager = new TestContextManager(getClass(), getDefaultContextLoaderClassName(getClass())); + } + + /** + * Set the {@link ApplicationContext} to be used by this test instance, + * provided via {@link ApplicationContextAware} semantics. + * + * @param applicationContext the applicationContext to set + */ + public final void setApplicationContext(ApplicationContext applicationContext) { + this.applicationContext = applicationContext; + } + + /** + * Returns the specialized loader for tight integration between Camel testing features + * and the application context initialization. + * + * @return Returns the class name for {@link CamelSpringTestContextLoader} + */ + protected String getDefaultContextLoaderClassName(Class<?> clazz) { + return CamelSpringTestContextLoader.class.getName(); + } + + @BeforeClass(alwaysRun = true) + protected void springTestContextPrepareTestInstance() throws Exception { + this.testContextManager.beforeTestClass(); + this.testContextManager.prepareTestInstance(this); + } + + @BeforeMethod(alwaysRun = true) + protected void springTestContextBeforeTestMethod(Method testMethod) throws Exception { + this.testContextManager.beforeTestMethod(this, testMethod); + } + + public void run(IHookCallBack callBack, ITestResult testResult) { + callBack.runTestMethod(testResult); + + Throwable testResultException = testResult.getThrowable(); + if (testResultException instanceof InvocationTargetException) { + testResultException = ((InvocationTargetException)testResultException).getCause(); + } + this.testException = testResultException; + } + + @AfterMethod(alwaysRun = true) + protected void springTestContextAfterTestMethod(Method testMethod) throws Exception { + try { + this.testContextManager.afterTestMethod(this, testMethod, this.testException); + } finally { + this.testException = null; + } + } + + @AfterClass(alwaysRun = true) + protected void springTestContextAfterTestClass() throws Exception { + this.testContextManager.afterTestClass(); + } +} + Propchange: camel/trunk/components/camel-testng/src/main/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTests.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: camel/trunk/components/camel-testng/src/main/java/org/apache/camel/testng/CamelSpringTestSupport.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-testng/src/main/java/org/apache/camel/testng/CamelSpringTestSupport.java?rev=1241144&r1=1241143&r2=1241144&view=diff ============================================================================== --- camel/trunk/components/camel-testng/src/main/java/org/apache/camel/testng/CamelSpringTestSupport.java (original) +++ camel/trunk/components/camel-testng/src/main/java/org/apache/camel/testng/CamelSpringTestSupport.java Mon Feb 6 20:11:30 2012 @@ -17,18 +17,14 @@ package org.apache.camel.testng; import java.util.Arrays; -import java.util.Collections; import java.util.HashSet; import java.util.List; -import java.util.Set; import org.apache.camel.CamelContext; import org.apache.camel.Route; -import org.apache.camel.impl.DefaultPackageScanClassResolver; -import org.apache.camel.impl.scan.AssignableToPackageScanFilter; -import org.apache.camel.impl.scan.InvertingPackageScanFilter; import org.apache.camel.spring.CamelBeanPostProcessor; import org.apache.camel.spring.SpringCamelContext; +import org.apache.camel.test.ExcludingPackageScanClassResolver; import org.apache.camel.util.CastUtils; import org.springframework.beans.factory.support.RootBeanDefinition; import org.springframework.context.ApplicationContext; @@ -105,15 +101,6 @@ public abstract class CamelSpringTestSup } } - private static class ExcludingPackageScanClassResolver extends DefaultPackageScanClassResolver { - - public void setExcludedClasses(Set<Class<?>> excludedClasses) { - Set<Class<?>> parents = excludedClasses == null ? Collections.<Class<?>>emptySet() : excludedClasses; - addFilter(new InvertingPackageScanFilter(new AssignableToPackageScanFilter(parents))); - } - - } - /** * Create a parent context that initializes a * {@link org.apache.camel.spi.PackageScanClassResolver} to exclude a set of given classes from Added: camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsDisableJmxInheritedOverrideTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsDisableJmxInheritedOverrideTest.java?rev=1241144&view=auto ============================================================================== --- camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsDisableJmxInheritedOverrideTest.java (added) +++ camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsDisableJmxInheritedOverrideTest.java Mon Feb 6 20:11:30 2012 @@ -0,0 +1,33 @@ +/** + * 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.testng; + +import org.apache.camel.management.DefaultManagementStrategy; +import org.apache.camel.test.spring.DisableJmx; + +import org.testng.annotations.Test; +import static org.testng.Assert.assertEquals; + +@DisableJmx +public class AbstractCamelTestNGSpringContextTestsDisableJmxInheritedOverrideTest + extends AbstractCamelTestNGSpringContextTestsDisableJmxTest { + + @Test + public void testJmx() throws Exception { + assertEquals(DefaultManagementStrategy.class, camelContext.getManagementStrategy().getClass()); + } +} Propchange: camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsDisableJmxInheritedOverrideTest.java ------------------------------------------------------------------------------ svn:eol-style = native Added: camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsDisableJmxInheritedTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsDisableJmxInheritedTest.java?rev=1241144&view=auto ============================================================================== --- camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsDisableJmxInheritedTest.java (added) +++ camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsDisableJmxInheritedTest.java Mon Feb 6 20:11:30 2012 @@ -0,0 +1,21 @@ +/** + * 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.testng; + +public class AbstractCamelTestNGSpringContextTestsDisableJmxInheritedTest + extends AbstractCamelTestNGSpringContextTestsDisableJmxTest { +} Propchange: camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsDisableJmxInheritedTest.java ------------------------------------------------------------------------------ svn:eol-style = native Added: camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsDisableJmxTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsDisableJmxTest.java?rev=1241144&view=auto ============================================================================== --- camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsDisableJmxTest.java (added) +++ camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsDisableJmxTest.java Mon Feb 6 20:11:30 2012 @@ -0,0 +1,33 @@ +/** + * 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.testng; + +import org.apache.camel.management.ManagedManagementStrategy; +import org.apache.camel.test.spring.DisableJmx; +import org.testng.annotations.Test; +import static org.testng.Assert.assertEquals; + +@DisableJmx(false) +public class AbstractCamelTestNGSpringContextTestsDisableJmxTest + extends AbstractCamelTestNGSpringContextTestsPlainTest { + + @Test + @Override + public void testJmx() throws Exception { + assertEquals(ManagedManagementStrategy.class, camelContext.getManagementStrategy().getClass()); + } +} Propchange: camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsDisableJmxTest.java ------------------------------------------------------------------------------ svn:eol-style = native Added: camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsExcludeRoutesTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsExcludeRoutesTest.java?rev=1241144&view=auto ============================================================================== --- camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsExcludeRoutesTest.java (added) +++ camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsExcludeRoutesTest.java Mon Feb 6 20:11:30 2012 @@ -0,0 +1,31 @@ +/** + * 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.testng; + +import org.apache.camel.test.spring.ExcludeRoutes; + +import static org.testng.Assert.assertNull; + +@ExcludeRoutes(TestRouteBuilder.class) +public class AbstractCamelTestNGSpringContextTestsExcludeRoutesTest + extends AbstractCamelTestNGSpringContextTestsPlainTest { + + @Override + public void testExcludedRoute() { + assertNull(camelContext.getRoute("excludedRoute")); + } +} Propchange: camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsExcludeRoutesTest.java ------------------------------------------------------------------------------ svn:eol-style = native Added: camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsLazyLoadTypeConvertersInheritedOverrideTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsLazyLoadTypeConvertersInheritedOverrideTest.java?rev=1241144&view=auto ============================================================================== --- camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsLazyLoadTypeConvertersInheritedOverrideTest.java (added) +++ camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsLazyLoadTypeConvertersInheritedOverrideTest.java Mon Feb 6 20:11:30 2012 @@ -0,0 +1,34 @@ +/** + * 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.testng; + +import org.apache.camel.test.spring.LazyLoadTypeConverters; + +import org.testng.annotations.Test; +import static org.testng.Assert.assertTrue; + +@LazyLoadTypeConverters(true) +public class AbstractCamelTestNGSpringContextTestsLazyLoadTypeConvertersInheritedOverrideTest + extends AbstractCamelTestNGSpringContextTestsLazyLoadTypeConvertersInheritedTest { + + @Test + @Override + public void testLazyLoadTypeConverters() { + assertTrue(camelContext.isLazyLoadTypeConverters()); + assertTrue(camelContext2.isLazyLoadTypeConverters()); + } +} Propchange: camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsLazyLoadTypeConvertersInheritedOverrideTest.java ------------------------------------------------------------------------------ svn:eol-style = native Added: camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsLazyLoadTypeConvertersInheritedTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsLazyLoadTypeConvertersInheritedTest.java?rev=1241144&view=auto ============================================================================== --- camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsLazyLoadTypeConvertersInheritedTest.java (added) +++ camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsLazyLoadTypeConvertersInheritedTest.java Mon Feb 6 20:11:30 2012 @@ -0,0 +1,21 @@ +/** + * 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.testng; + +public class AbstractCamelTestNGSpringContextTestsLazyLoadTypeConvertersInheritedTest + extends AbstractCamelTestNGSpringContextTestsLazyLoadTypeConvertersTest { +} Propchange: camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsLazyLoadTypeConvertersInheritedTest.java ------------------------------------------------------------------------------ svn:eol-style = native Added: camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsLazyLoadTypeConvertersTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsLazyLoadTypeConvertersTest.java?rev=1241144&view=auto ============================================================================== --- camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsLazyLoadTypeConvertersTest.java (added) +++ camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsLazyLoadTypeConvertersTest.java Mon Feb 6 20:11:30 2012 @@ -0,0 +1,34 @@ +/** + * 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.testng; + +import org.apache.camel.test.spring.LazyLoadTypeConverters; + +import org.testng.annotations.Test; +import static org.testng.Assert.assertFalse; + +@LazyLoadTypeConverters(false) +public class AbstractCamelTestNGSpringContextTestsLazyLoadTypeConvertersTest + extends AbstractCamelTestNGSpringContextTestsPlainTest { + + @Test + @Override + public void testLazyLoadTypeConverters() { + assertFalse(camelContext.isLazyLoadTypeConverters()); + assertFalse(camelContext2.isLazyLoadTypeConverters()); + } +} Propchange: camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsLazyLoadTypeConvertersTest.java ------------------------------------------------------------------------------ svn:eol-style = native Added: camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsMockEndpointsTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsMockEndpointsTest.java?rev=1241144&view=auto ============================================================================== --- camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsMockEndpointsTest.java (added) +++ camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsMockEndpointsTest.java Mon Feb 6 20:11:30 2012 @@ -0,0 +1,39 @@ +/** + * 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.testng; + +import org.apache.camel.EndpointInject; +import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.test.spring.MockEndpoints; + +import org.testng.annotations.Test; + +@MockEndpoints("log:*") +public class AbstractCamelTestNGSpringContextTestsMockEndpointsTest + extends AbstractCamelTestNGSpringContextTestsPlainTest { + + @EndpointInject(uri = "mock:log:org.apache.camel.test.junit4.spring", context = "camelContext2") + protected MockEndpoint mockLog; + + @Test + @Override + public void testPositive() throws Exception { + mockLog.expectedBodiesReceived("Hell David"); + + super.testPositive(); + } +} Propchange: camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsMockEndpointsTest.java ------------------------------------------------------------------------------ svn:eol-style = native Added: camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsPlainTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsPlainTest.java?rev=1241144&view=auto ============================================================================== --- camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsPlainTest.java (added) +++ camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsPlainTest.java Mon Feb 6 20:11:30 2012 @@ -0,0 +1,121 @@ +/** + * 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.testng; + +import java.util.concurrent.TimeUnit; + + +import org.apache.camel.CamelContext; +import org.apache.camel.EndpointInject; +import org.apache.camel.Produce; +import org.apache.camel.ProducerTemplate; +import org.apache.camel.ServiceStatus; +import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.management.DefaultManagementStrategy; +import org.apache.camel.test.spring.StopWatchTestExecutionListener; +import org.apache.camel.util.StopWatch; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.annotation.DirtiesContext; +import org.springframework.test.context.ContextConfiguration; + +import org.testng.annotations.Test; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNotNull; +import static org.testng.Assert.assertNull; +import static org.testng.Assert.assertTrue; + + +@ContextConfiguration +//Put here to prevent Spring context caching across tests since some tests inherit from this test and +//therefore use the same Spring context. +@DirtiesContext +public class AbstractCamelTestNGSpringContextTestsPlainTest + extends AbstractCamelTestNGSpringContextTests { + + @Autowired + protected CamelContext camelContext; + + @Autowired + protected CamelContext camelContext2; + + @EndpointInject(uri = "mock:a", context = "camelContext") + protected MockEndpoint mockA; + + @EndpointInject(uri = "mock:b", context = "camelContext") + protected MockEndpoint mockB; + + @EndpointInject(uri = "mock:c", context = "camelContext2") + protected MockEndpoint mockC; + + @Produce(uri = "direct:start", context = "camelContext") + protected ProducerTemplate start; + + @Produce(uri = "direct:start2", context = "camelContext2") + protected ProducerTemplate start2; + + @Test + public void testPositive() throws Exception { + assertEquals(ServiceStatus.Started, camelContext.getStatus()); + assertEquals(ServiceStatus.Started, camelContext2.getStatus()); + + mockA.expectedBodiesReceived("David"); + mockB.expectedBodiesReceived("Hello David"); + mockC.expectedBodiesReceived("David"); + + start.sendBody("David"); + start2.sendBody("David"); + + MockEndpoint.assertIsSatisfied(camelContext); + } + + @Test + public void testJmx() throws Exception { + assertEquals(DefaultManagementStrategy.class, camelContext.getManagementStrategy().getClass()); + } + + @Test + public void testShutdownTimeout() throws Exception { + assertEquals(10, camelContext.getShutdownStrategy().getTimeout()); + assertEquals(TimeUnit.SECONDS, camelContext.getShutdownStrategy().getTimeUnit()); + } + + @Test + public void testStopwatch() { + StopWatch stopWatch = StopWatchTestExecutionListener.getStopWatch(); + + assertNotNull(stopWatch); + assertTrue(stopWatch.taken() < 100); + } + + @Test + public void testExcludedRoute() { + assertNotNull(camelContext.getRoute("excludedRoute")); + } + + @Test + public void testProvidesBreakpoint() { + assertNull(camelContext.getDebugger()); + assertNull(camelContext2.getDebugger()); + } + + @Test + public void testLazyLoadTypeConverters() { + assertTrue(camelContext.isLazyLoadTypeConverters()); + assertTrue(camelContext2.isLazyLoadTypeConverters()); + } +} Propchange: camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsPlainTest.java ------------------------------------------------------------------------------ svn:eol-style = native Added: camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsProvidesBreakpointInherritedTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsProvidesBreakpointInherritedTest.java?rev=1241144&view=auto ============================================================================== --- camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsProvidesBreakpointInherritedTest.java (added) +++ camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsProvidesBreakpointInherritedTest.java Mon Feb 6 20:11:30 2012 @@ -0,0 +1,22 @@ +/** + * 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.testng; + +public class AbstractCamelTestNGSpringContextTestsProvidesBreakpointInherritedTest + extends AbstractCamelTestNGSpringContextTestsProvidesBreakpointTest { + +} Propchange: camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsProvidesBreakpointInherritedTest.java ------------------------------------------------------------------------------ svn:eol-style = native Added: camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsProvidesBreakpointTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsProvidesBreakpointTest.java?rev=1241144&view=auto ============================================================================== --- camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsProvidesBreakpointTest.java (added) +++ camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsProvidesBreakpointTest.java Mon Feb 6 20:11:30 2012 @@ -0,0 +1,68 @@ +/** + * 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.testng; + +import org.apache.camel.Exchange; +import org.apache.camel.Processor; +import org.apache.camel.impl.BreakpointSupport; +import org.apache.camel.model.ProcessorDefinition; +import org.apache.camel.spi.Breakpoint; +import org.apache.camel.test.spring.ProvidesBreakpoint; + +import org.testng.annotations.Test; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNotNull; +import static org.testng.Assert.assertTrue; + +public class AbstractCamelTestNGSpringContextTestsProvidesBreakpointTest + extends AbstractCamelTestNGSpringContextTestsPlainTest { + + @ProvidesBreakpoint + public static Breakpoint createBreakpoint() { + return new TestBreakpoint(); + } + + @Test + @Override + public void testProvidesBreakpoint() { + assertNotNull(camelContext.getDebugger()); + assertNotNull(camelContext2.getDebugger()); + + start.sendBody("David"); + + assertNotNull(camelContext.getDebugger()); + assertNotNull(camelContext.getDebugger().getBreakpoints()); + assertEquals(1, camelContext.getDebugger().getBreakpoints().size()); + + assertTrue(camelContext.getDebugger().getBreakpoints().get(0) instanceof TestBreakpoint); + assertTrue(((TestBreakpoint) camelContext.getDebugger().getBreakpoints().get(0)).isBreakpointHit()); + } + + private static final class TestBreakpoint extends BreakpointSupport { + + private boolean breakpointHit; + + @Override + public void beforeProcess(Exchange exchange, Processor processor, ProcessorDefinition<?> definition) { + breakpointHit = true; + } + + public boolean isBreakpointHit() { + return breakpointHit; + } + } +} Propchange: camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsProvidesBreakpointTest.java ------------------------------------------------------------------------------ svn:eol-style = native Added: camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsShutdownTimeoutInheritedOverrideTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsShutdownTimeoutInheritedOverrideTest.java?rev=1241144&view=auto ============================================================================== --- camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsShutdownTimeoutInheritedOverrideTest.java (added) +++ camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsShutdownTimeoutInheritedOverrideTest.java Mon Feb 6 20:11:30 2012 @@ -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.testng; + +import java.util.concurrent.TimeUnit; + +import org.apache.camel.test.spring.ShutdownTimeout; + +import org.testng.annotations.Test; +import static org.testng.Assert.assertEquals; + + +@ShutdownTimeout +public class AbstractCamelTestNGSpringContextTestsShutdownTimeoutInheritedOverrideTest + extends AbstractCamelTestNGSpringContextTestsShutdownTimeoutTest { + + @Test + @Override + public void testShutdownTimeout() throws Exception { + assertEquals(10, camelContext.getShutdownStrategy().getTimeout()); + assertEquals(TimeUnit.SECONDS, camelContext.getShutdownStrategy().getTimeUnit()); + } +} Propchange: camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsShutdownTimeoutInheritedOverrideTest.java ------------------------------------------------------------------------------ svn:eol-style = native Added: camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsShutdownTimeoutInheritedTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsShutdownTimeoutInheritedTest.java?rev=1241144&view=auto ============================================================================== --- camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsShutdownTimeoutInheritedTest.java (added) +++ camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsShutdownTimeoutInheritedTest.java Mon Feb 6 20:11:30 2012 @@ -0,0 +1,22 @@ +/** + * 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.testng; + +public class AbstractCamelTestNGSpringContextTestsShutdownTimeoutInheritedTest + extends AbstractCamelTestNGSpringContextTestsShutdownTimeoutTest { + +} Propchange: camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsShutdownTimeoutInheritedTest.java ------------------------------------------------------------------------------ svn:eol-style = native Added: camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsShutdownTimeoutTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsShutdownTimeoutTest.java?rev=1241144&view=auto ============================================================================== --- camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsShutdownTimeoutTest.java (added) +++ camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsShutdownTimeoutTest.java Mon Feb 6 20:11:30 2012 @@ -0,0 +1,36 @@ +/** + * 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.testng; + +import java.util.concurrent.TimeUnit; + +import org.apache.camel.test.spring.ShutdownTimeout; + +import org.testng.annotations.Test; +import static org.testng.Assert.assertEquals; + +@ShutdownTimeout(value = 11, timeUnit = TimeUnit.MILLISECONDS) +public class AbstractCamelTestNGSpringContextTestsShutdownTimeoutTest + extends AbstractCamelTestNGSpringContextTestsPlainTest { + + @Test + @Override + public void testShutdownTimeout() throws Exception { + assertEquals(11, camelContext.getShutdownStrategy().getTimeout()); + assertEquals(TimeUnit.MILLISECONDS, camelContext.getShutdownStrategy().getTimeUnit()); + } +} Propchange: camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsShutdownTimeoutTest.java ------------------------------------------------------------------------------ svn:eol-style = native Added: camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsUseAdviceWithTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsUseAdviceWithTest.java?rev=1241144&view=auto ============================================================================== --- camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsUseAdviceWithTest.java (added) +++ camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsUseAdviceWithTest.java Mon Feb 6 20:11:30 2012 @@ -0,0 +1,49 @@ +/** + * 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.testng; + +import org.apache.camel.ServiceStatus; +import org.apache.camel.test.spring.UseAdviceWith; + +import org.testng.annotations.BeforeClass; +import org.testng.annotations.BeforeMethod; +import static org.testng.Assert.assertEquals; + +@UseAdviceWith +public class AbstractCamelTestNGSpringContextTestsUseAdviceWithTest + extends AbstractCamelTestNGSpringContextTestsPlainTest { + + protected static boolean checked; + + @BeforeClass + public static void setup() { + checked = false; + } + + @BeforeMethod + public void testContextStarted() throws Exception { + if (!checked) { + assertEquals(ServiceStatus.Stopped, camelContext.getStatus()); + camelContext.start(); + camelContext2.start(); + + Thread.sleep(2000); + + checked = true; + } + } +} Propchange: camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsUseAdviceWithTest.java ------------------------------------------------------------------------------ svn:eol-style = native Added: camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/TestRouteBuilder.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/TestRouteBuilder.java?rev=1241144&view=auto ============================================================================== --- camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/TestRouteBuilder.java (added) +++ camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/TestRouteBuilder.java Mon Feb 6 20:11:30 2012 @@ -0,0 +1,30 @@ +/** + * 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.testng; + +import org.apache.camel.builder.RouteBuilder; + +public class TestRouteBuilder extends RouteBuilder { + + @Override + public void configure() throws Exception { + + from("direct:z") + .routeId("excludedRoute") + .to("log:org.apache.camel.test.junit4.spring"); + } +} Propchange: camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/TestRouteBuilder.java ------------------------------------------------------------------------------ svn:eol-style = native Added: camel/trunk/components/camel-testng/src/test/resources/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsPlainTest-context.xml URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-testng/src/test/resources/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsPlainTest-context.xml?rev=1241144&view=auto ============================================================================== --- camel/trunk/components/camel-testng/src/test/resources/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsPlainTest-context.xml (added) +++ camel/trunk/components/camel-testng/src/test/resources/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsPlainTest-context.xml Mon Feb 6 20:11:30 2012 @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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. +--> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:camel="http://camel.apache.org/schema/spring" + xsi:schemaLocation=" + http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd "> + + <camelContext id="camelContext" xmlns="http://camel.apache.org/schema/spring" + trace="true" autoStartup="true"> + <packageScan> + <package>org.apache.camel.testng</package> + </packageScan> + <route> + <from uri="direct:start" /> + <to uri="mock:a" /> + <transform> + <simple>Hello ${body}</simple> + </transform> + <to uri="mock:b" /> + </route> + </camelContext> + + <camelContext id="camelContext2" xmlns="http://camel.apache.org/schema/spring" + trace="true" autoStartup="true"> + <route> + <from uri="direct:start2" /> + <to uri="mock:c" /> + <transform> + <simple>Hello ${body}</simple> + </transform> + <to uri="log:org.apache.camel.test.junit4.spring" /> + </route> + </camelContext> + +</beans> \ No newline at end of file Propchange: camel/trunk/components/camel-testng/src/test/resources/org/apache/camel/testng/AbstractCamelTestNGSpringContextTestsPlainTest-context.xml ------------------------------------------------------------------------------ svn:eol-style = native