You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by dv...@apache.org on 2012/03/01 16:59:56 UTC
svn commit: r1295642 - in /camel/trunk/components/camel-testng: ./
src/main/java/org/apache/camel/testng/ src/test/java/org/apache/camel/testng/
src/test/resources/org/apache/camel/testng/
Author: dvaleri
Date: Thu Mar 1 15:59:55 2012
New Revision: 1295642
URL: http://svn.apache.org/viewvc?rev=1295642&view=rev
Log:
[CAMEL-4987] Integrate Spring Test with Camel test support 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=1295642&r1=1295641&r2=1295642&view=diff
==============================================================================
--- camel/trunk/components/camel-testng/pom.xml (original)
+++ camel/trunk/components/camel-testng/pom.xml Thu Mar 1 15:59:55 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>
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=1295642&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 Thu Mar 1 15:59:55 2012
@@ -0,0 +1,73 @@
+/**
+ * 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.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.test.context.ContextConfiguration;
+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.IHookable;
+
+/**
+ * Bridges Camel testing capabilities from {@link CamelSpringTestSupport} into
+ * Spring Test driven classes. This class is based on {@link AbstractTestNGSpringContextTests}
+ * but must also declare a {@link ContextConfiguration} to enable the custom context loader needed
+ * to support some of the Camel testing capabilities.
+ */
+@TestExecutionListeners(
+ listeners = {
+ CamelSpringTestContextLoaderTestExecutionListener.class,
+ DependencyInjectionTestExecutionListener.class,
+ DirtiesContextTestExecutionListener.class,
+ TransactionalTestExecutionListener.class,
+ DisableJmxTestExecutionListener.class,
+ StopWatchTestExecutionListener.class},
+ inheritListeners = false)
+@ContextConfiguration(loader = AbstractCamelTestNGSpringContextTests.TestNGCamelSpringTestContextLoader.class)
+public abstract class AbstractCamelTestNGSpringContextTests extends AbstractTestNGSpringContextTests
+ implements IHookable {
+
+ public static final class TestNGCamelSpringTestContextLoader extends CamelSpringTestContextLoader {
+
+ /**
+ * Since {@link AbstractTestNGSpringContextTests} declares the test context as private and
+ * we cannot control its instantiation, we need to use {@link ContextConfiguration} on
+ * {@link AbstractCamelTestNGSpringContextTests}. Unfortunately, this also tries to load
+ * the a context resource based on the default naming convention. We don't want to require
+ * end users to always have a resource for their tests' abstract parent so we override
+ * the behavior here to prevent that from happening.
+ */
+ @Override
+ protected String[] generateDefaultLocations(Class<?> clazz) {
+ if (clazz == AbstractCamelTestNGSpringContextTests.class) {
+ return new String[0];
+ } else {
+ return super.generateDefaultLocations(clazz);
+ }
+ }
+
+ }
+}
+
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=1295642&r1=1295641&r2=1295642&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 Thu Mar 1 15:59:55 2012
@@ -17,17 +17,13 @@
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.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;
@@ -104,15 +100,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=1295642&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 Thu Mar 1 15:59:55 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=1295642&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 Thu Mar 1 15:59:55 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=1295642&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 Thu Mar 1 15:59:55 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=1295642&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 Thu Mar 1 15:59:55 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=1295642&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 Thu Mar 1 15:59:55 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=1295642&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 Thu Mar 1 15:59:55 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=1295642&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 Thu Mar 1 15:59:55 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=1295642&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 Thu Mar 1 15:59:55 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=1295642&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 Thu Mar 1 15:59:55 2012
@@ -0,0 +1,126 @@
+/**
+ * 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 testAppContextInject() {
+ assertNotNull(applicationContext);
+ }
+
+ @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=1295642&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 Thu Mar 1 15:59:55 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=1295642&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 Thu Mar 1 15:59:55 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=1295642&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 Thu Mar 1 15:59:55 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=1295642&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 Thu Mar 1 15:59:55 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=1295642&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 Thu Mar 1 15:59:55 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=1295642&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 Thu Mar 1 15:59:55 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=1295642&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 Thu Mar 1 15:59:55 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=1295642&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 Thu Mar 1 15:59:55 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