camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r627805 - in /activemq/camel/trunk/components/camel-testng: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/camel/ src/main/java/org/apache/camel/testng/ src/main/resources/ src/test/ s...
Date Thu, 14 Feb 2008 17:15:40 GMT
Author: jstrachan
Date: Thu Feb 14 09:15:20 2008
New Revision: 627805

URL: http://svn.apache.org/viewvc?rev=627805&view=rev
Log:
added an experimental cut of a simple TestNG based system for integration testing using Camel,
Spring and TestNG using properties on a per test instance to overload stuff in the spring.xml
to avoid XML overload

Added:
    activemq/camel/trunk/components/camel-testng/
    activemq/camel/trunk/components/camel-testng/pom.xml   (with props)
    activemq/camel/trunk/components/camel-testng/src/
    activemq/camel/trunk/components/camel-testng/src/main/
    activemq/camel/trunk/components/camel-testng/src/main/java/
    activemq/camel/trunk/components/camel-testng/src/main/java/org/
    activemq/camel/trunk/components/camel-testng/src/main/java/org/apache/
    activemq/camel/trunk/components/camel-testng/src/main/java/org/apache/camel/
    activemq/camel/trunk/components/camel-testng/src/main/java/org/apache/camel/testng/
    activemq/camel/trunk/components/camel-testng/src/main/java/org/apache/camel/testng/SpringRunner.java
  (with props)
    activemq/camel/trunk/components/camel-testng/src/main/resources/
    activemq/camel/trunk/components/camel-testng/src/test/
    activemq/camel/trunk/components/camel-testng/src/test/data/
    activemq/camel/trunk/components/camel-testng/src/test/data/bar/
    activemq/camel/trunk/components/camel-testng/src/test/data/bar/input1/
    activemq/camel/trunk/components/camel-testng/src/test/data/bar/input1/0001.xml   (with
props)
    activemq/camel/trunk/components/camel-testng/src/test/data/foo/
    activemq/camel/trunk/components/camel-testng/src/test/data/foo/input1/
    activemq/camel/trunk/components/camel-testng/src/test/data/foo/input1/0001.xml   (with
props)
    activemq/camel/trunk/components/camel-testng/src/test/data/foo/input1/0002.xml   (with
props)
    activemq/camel/trunk/components/camel-testng/src/test/java/
    activemq/camel/trunk/components/camel-testng/src/test/java/org/
    activemq/camel/trunk/components/camel-testng/src/test/java/org/apache/
    activemq/camel/trunk/components/camel-testng/src/test/java/org/apache/camel/
    activemq/camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/
    activemq/camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/DummyBean.java
  (with props)
    activemq/camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/SpringParameterTest.java
  (with props)
    activemq/camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/example/
    activemq/camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/example/MyTest.java
  (with props)
    activemq/camel/trunk/components/camel-testng/src/test/resources/
    activemq/camel/trunk/components/camel-testng/src/test/resources/log4j.properties   (with
props)
    activemq/camel/trunk/components/camel-testng/src/test/resources/org/
    activemq/camel/trunk/components/camel-testng/src/test/resources/org/apache/
    activemq/camel/trunk/components/camel-testng/src/test/resources/org/apache/camel/
    activemq/camel/trunk/components/camel-testng/src/test/resources/org/apache/camel/testng/
    activemq/camel/trunk/components/camel-testng/src/test/resources/org/apache/camel/testng/example/
    activemq/camel/trunk/components/camel-testng/src/test/resources/org/apache/camel/testng/example/spring.xml
  (with props)
    activemq/camel/trunk/components/camel-testng/src/test/resources/spring.xml   (with props)

Added: activemq/camel/trunk/components/camel-testng/pom.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-testng/pom.xml?rev=627805&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-testng/pom.xml (added)
+++ activemq/camel/trunk/components/camel-testng/pom.xml Thu Feb 14 09:15:20 2008
@@ -0,0 +1,209 @@
+<?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.
+-->
+
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0">
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.camel</groupId>
+    <artifactId>camel-parent</artifactId>
+    <version>1.3-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>camel-testng</artifactId>
+  <packaging>bundle</packaging>
+  <name>Camel :: TestNG</name>
+  <description>Camel TestNG support</description>
+
+  <properties>
+    <camel.osgi.export.pkg>org.apache.camel.testng*</camel.osgi.export.pkg>
+  </properties>
+
+  <dependencies>
+
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-spring</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.testng</groupId>
+      <artifactId>testng</artifactId>
+      <classifier>jdk15</classifier>
+    </dependency>
+    <dependency>
+      <groupId>org.hamcrest</groupId>
+      <artifactId>hamcrest-library</artifactId>
+    </dependency>
+
+    <!-- testing -->
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-core</artifactId>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>commons-logging</groupId>
+      <artifactId>commons-logging</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>log4j</groupId>
+      <artifactId>log4j</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+    <!-- for testNG reports -->
+    <dependency>
+      <groupId>org.uncommons.reportng</groupId>
+      <artifactId>reportng</artifactId>
+      <version>0.9.2</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>velocity</groupId>
+      <artifactId>velocity-dep</artifactId>
+      <version>1.4</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+
+  <build>
+    <plugins>
+
+      <plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <version>2.4.1</version>
+        <configuration>
+          <properties>
+            <property>
+              <name>-d</name>
+              <value>target/test-output</value>
+            </property>
+            <property>
+              <name>listener</name>
+              <value>
+                org.uncommons.reportng.HTMLReporter,org.uncommons.reportng.JUnitXMLReporter,org.testng.reporters.SuiteHTMLReporter
+              </value>
+            </property>
+          </properties>
+          <systemProperties>
+            <property>
+              <name>org.uncommons.reportng.title</name>
+              <value>My Test Suite</value>
+            </property>
+          </systemProperties>
+
+          <!--
+                    <suiteXmlFiles>
+                      <suiteXmlFile>testng.xml</suiteXmlFile>
+                    </suiteXmlFiles>
+          -->
+
+          <!--
+                    <childDelegation>false</childDelegation>
+                    <useFile>true</useFile>
+          -->
+        </configuration>
+      </plugin>
+
+      <!--
+            <plugin>
+              <groupId>com.sun.tools.jxc.maven2</groupId>
+              <artifactId>maven-jaxb-schemagen-plugin</artifactId>
+            </plugin>
+      -->
+
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-clean-plugin</artifactId>
+        <configuration>
+          <filesets>
+            <fileset>
+              <directory>${basedir}/activemq-data</directory>
+            </fileset>
+          </filesets>
+        </configuration>
+      </plugin>
+
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-antrun-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>test</id>
+            <phase>test</phase>
+            <configuration>
+              <tasks>
+                <mkdir dir="${basedir}/target/junit"/>
+                <mkdir dir="${basedir}/target/junit2"/>
+
+                <junitreport todir="${basedir}/target/junit">
+                  <fileset dir="${basedir}/target/surefire-reports/xml">
+                    <include name="*.xml"/>
+                  </fileset>
+                  <report format="frames" todir="${basedir}/target/junit2"/>
+                  <!--<report format="noframes" todir=""/>-->
+                </junitreport>
+              </tasks>
+            </configuration>
+            <goals>
+              <goal>run</goal>
+            </goals>
+          </execution>
+        </executions>
+        <dependencies>
+          <dependency>
+            <groupId>org.apache.ant</groupId>
+            <artifactId>ant-junit</artifactId>
+            <version>1.7.0</version>
+          </dependency>
+          <dependency>
+            <groupId>org.apache.ant</groupId>
+            <artifactId>ant-trax</artifactId>
+            <version>1.7.0</version>
+          </dependency>
+        </dependencies>
+      </plugin>
+
+    </plugins>
+  </build>
+
+
+  <reporting>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-report-plugin</artifactId>
+      </plugin>
+    </plugins>
+  </reporting>
+</project>

Propchange: activemq/camel/trunk/components/camel-testng/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/camel/trunk/components/camel-testng/src/main/java/org/apache/camel/testng/SpringRunner.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-testng/src/main/java/org/apache/camel/testng/SpringRunner.java?rev=627805&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-testng/src/main/java/org/apache/camel/testng/SpringRunner.java
(added)
+++ activemq/camel/trunk/components/camel-testng/src/main/java/org/apache/camel/testng/SpringRunner.java
Thu Feb 14 09:15:20 2008
@@ -0,0 +1,85 @@
+/**
+ *
+ * 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.Map;
+import java.util.Properties;
+import java.util.Set;
+
+import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.testng.annotations.AfterTest;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+import org.apache.camel.spring.SpringCamelContext;
+
+/**
+ * A helper base class for running Camel based test cases using TestNG which makes it easy
to overload
+ * system properties before the spring application context is initialised; to allow a single
spring XML to be reused
+ * with some properties being overloaded.
+ *
+ * @version $Revision: 1.1 $
+ */
+public class SpringRunner {
+    private Properties oldSystemProperties;
+    private AbstractXmlApplicationContext applicationContext;
+    private SpringCamelContext camelContext;
+
+    protected void assertApplicationContextStarts(String applicationContextLocations, Properties
properties) throws Exception {
+        // lets overload the system properties
+        Set<Map.Entry<Object, Object>> entries = properties.entrySet();
+        for (Map.Entry<Object, Object> entry : entries) {
+            System.setProperty(entry.getKey().toString(), entry.getValue().toString());
+        }
+
+        // now lets load the context
+        applicationContext = new ClassPathXmlApplicationContext(applicationContextLocations);
+        applicationContext.start();
+
+        camelContext = SpringCamelContext.springCamelContext(applicationContext);
+    }
+
+    protected SpringCamelContext getCamelContext() {
+        return camelContext;
+    }
+
+    /**
+     * Creates a properties object with the given key and value 
+     */
+    protected Properties createProperties(String name, String value) {
+        Properties properties = new Properties();
+        properties.setProperty(name, value);
+        return properties;
+    }
+
+    @BeforeTest
+    protected void setUp() {
+        oldSystemProperties = new Properties(System.getProperties());
+        System.out.println("Setup!");
+    }
+
+    @AfterTest
+    protected void tearDown() {
+        if (applicationContext != null) {
+            applicationContext.close();
+        }
+        System.setProperties(oldSystemProperties);
+        System.out.println("Tearning down!");
+    }
+}
\ No newline at end of file

Propchange: activemq/camel/trunk/components/camel-testng/src/main/java/org/apache/camel/testng/SpringRunner.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/camel/trunk/components/camel-testng/src/test/data/bar/input1/0001.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-testng/src/test/data/bar/input1/0001.xml?rev=627805&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-testng/src/test/data/bar/input1/0001.xml (added)
+++ activemq/camel/trunk/components/camel-testng/src/test/data/bar/input1/0001.xml Thu Feb
14 09:15:20 2008
@@ -0,0 +1,18 @@
+<?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.
+-->
+<message id="0001">Message 0001</message>

Propchange: activemq/camel/trunk/components/camel-testng/src/test/data/bar/input1/0001.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/camel/trunk/components/camel-testng/src/test/data/foo/input1/0001.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-testng/src/test/data/foo/input1/0001.xml?rev=627805&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-testng/src/test/data/foo/input1/0001.xml (added)
+++ activemq/camel/trunk/components/camel-testng/src/test/data/foo/input1/0001.xml Thu Feb
14 09:15:20 2008
@@ -0,0 +1,18 @@
+<?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.
+-->
+<message id="0001">Message 0001</message>

Propchange: activemq/camel/trunk/components/camel-testng/src/test/data/foo/input1/0001.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/camel/trunk/components/camel-testng/src/test/data/foo/input1/0002.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-testng/src/test/data/foo/input1/0002.xml?rev=627805&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-testng/src/test/data/foo/input1/0002.xml (added)
+++ activemq/camel/trunk/components/camel-testng/src/test/data/foo/input1/0002.xml Thu Feb
14 09:15:20 2008
@@ -0,0 +1,18 @@
+<?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.
+-->
+<message id="0002">Message 0002</message>

Propchange: activemq/camel/trunk/components/camel-testng/src/test/data/foo/input1/0002.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/DummyBean.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/DummyBean.java?rev=627805&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/DummyBean.java
(added)
+++ activemq/camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/DummyBean.java
Thu Feb 14 09:15:20 2008
@@ -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.springframework.beans.factory.InitializingBean;
+
+/**
+ * @version $Revision: 1.1 $
+ */
+public class DummyBean implements InitializingBean {
+    private String message;
+
+    public String getMessage() {
+        return message;
+    }
+
+    public void setMessage(String message) {
+        this.message = message;
+    }
+
+    public void afterPropertiesSet() throws Exception {
+        System.out.println("DummyBean says " + message);
+    }
+}

Propchange: activemq/camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/DummyBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/SpringParameterTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/SpringParameterTest.java?rev=627805&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/SpringParameterTest.java
(added)
+++ activemq/camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/SpringParameterTest.java
Thu Feb 14 09:15:20 2008
@@ -0,0 +1,43 @@
+/**
+ *
+ * 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.Properties;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/**
+ * @version $Revision: 1.1 $
+ */
+public class SpringParameterTest extends SpringRunner {
+    @DataProvider(name = "appContextAndProperties")
+    public Object[][] createData() {
+
+        return new Object[][]{{
+                "spring.xml", createProperties("foo", "param1")
+        }, {
+                "spring.xml", createProperties("foo", "param2")
+        }};
+    }
+
+    @Test(dataProvider = "appContextAndProperties")
+    public void assertApplicationContextStarts(String applicationContextLocations, Properties
properties) throws Exception {
+        super.assertApplicationContextStarts(applicationContextLocations, properties);
+    }
+}
\ No newline at end of file

Propchange: activemq/camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/SpringParameterTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/example/MyTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/example/MyTest.java?rev=627805&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/example/MyTest.java
(added)
+++ activemq/camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/example/MyTest.java
Thu Feb 14 09:15:20 2008
@@ -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.example;
+
+import java.util.Properties;
+
+import org.apache.camel.testng.SpringRunner;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.testng.annotations.Test;
+
+/**
+ * @version $Revision: 1.1 $
+ */
+@Test(groups = {"routing"})
+public class MyTest extends SpringRunner {
+    private String appContextLocation = " org/apache/camel/testng/example/spring.xml";
+
+    public void useCaseFoo() throws Exception {
+        assertApplicationContextStarts(appContextLocation, createProperties("useCase", "foo/input1"));
+        assertExpectedCount(2);
+    }
+
+    public void useCaseBar() throws Exception {
+        assertApplicationContextStarts(appContextLocation, createProperties("useCase", "bar/input1"));
+        assertExpectedCount(1);
+    }
+
+    protected void assertExpectedCount(int expectedCount) throws InterruptedException {
+        MockEndpoint endpoint = getCamelContext().getEndpoint("mock:results", MockEndpoint.class);
+        endpoint.expectedMessageCount(expectedCount);
+        endpoint.assertIsSatisfied();
+    }
+
+}

Propchange: activemq/camel/trunk/components/camel-testng/src/test/java/org/apache/camel/testng/example/MyTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/camel/trunk/components/camel-testng/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-testng/src/test/resources/log4j.properties?rev=627805&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-testng/src/test/resources/log4j.properties (added)
+++ activemq/camel/trunk/components/camel-testng/src/test/resources/log4j.properties Thu Feb
14 09:15:20 2008
@@ -0,0 +1,54 @@
+## ------------------------------------------------------------------------
+## 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.
+## ------------------------------------------------------------------------
+
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+#
+# The logging properties used during tests..
+#
+log4j.rootLogger=INFO, stdout
+
+log4j.logger.org.apache.camel=DEBUG
+log4j.logger.org.apache.activemq.spring=WARN
+
+# CONSOLE appender not used by default
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+
+# File appender
+log4j.appender.out=org.apache.log4j.FileAppender
+log4j.appender.out.layout=org.apache.log4j.PatternLayout
+log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+log4j.appender.out.file=target/camel-test.log
+log4j.appender.out.append=true
+

Propchange: activemq/camel/trunk/components/camel-testng/src/test/resources/log4j.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/camel/trunk/components/camel-testng/src/test/resources/org/apache/camel/testng/example/spring.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-testng/src/test/resources/org/apache/camel/testng/example/spring.xml?rev=627805&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-testng/src/test/resources/org/apache/camel/testng/example/spring.xml
(added)
+++ activemq/camel/trunk/components/camel-testng/src/test/resources/org/apache/camel/testng/example/spring.xml
Thu Feb 14 09:15:20 2008
@@ -0,0 +1,38 @@
+<?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"
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+       http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd
+    ">
+
+  <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
+
+  <camelContext xmlns="http://activemq.apache.org/camel/schema/spring">
+    <endpoint id="input1" uri="file://src/test/data/${useCase}?noop=true"/>
+
+    <route>
+      <from ref="input1"/>
+      <to uri="mock:results"/>
+    </route>
+
+  </camelContext>
+
+
+</beans>

Propchange: activemq/camel/trunk/components/camel-testng/src/test/resources/org/apache/camel/testng/example/spring.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/camel/trunk/components/camel-testng/src/test/resources/spring.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-testng/src/test/resources/spring.xml?rev=627805&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-testng/src/test/resources/spring.xml (added)
+++ activemq/camel/trunk/components/camel-testng/src/test/resources/spring.xml Thu Feb 14
09:15:20 2008
@@ -0,0 +1,34 @@
+<?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"
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+       http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd
+    ">
+
+  <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
+
+  <camelContext xmlns="http://activemq.apache.org/camel/schema/spring">
+  </camelContext>
+
+  <bean id="foo" class="org.apache.camel.testng.DummyBean">
+    <property name="message" value="${foo}"/>
+  </bean>
+
+</beans>

Propchange: activemq/camel/trunk/components/camel-testng/src/test/resources/spring.xml
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message