camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1234885 - in /camel/trunk: components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/ tooling/archetypes/camel-archetype-blueprint/src/main/resources-filtered/META-INF/maven/ tooling/archetypes/camel-archetype-blueprint...
Date Mon, 23 Jan 2012 16:28:43 GMT
Author: davsclaus
Date: Mon Jan 23 16:28:43 2012
New Revision: 1234885

URL: http://svn.apache.org/viewvc?rev=1234885&view=rev
Log:
CAMEL-4914: Improved blueprint archetype for using camel-test-blueprint.

Modified:
    camel/trunk/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintTestSupport.java
    camel/trunk/tooling/archetypes/camel-archetype-blueprint/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml
    camel/trunk/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/ReadMe.txt
    camel/trunk/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/pom.xml
    camel/trunk/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/src/main/resources/OSGI-INF/blueprint/blueprint.xml
    camel/trunk/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/src/test/java/RouteTest.java
    camel/trunk/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/src/test/resources/log4j.properties

Modified: camel/trunk/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintTestSupport.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintTestSupport.java?rev=1234885&r1=1234884&r2=1234885&view=diff
==============================================================================
--- camel/trunk/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintTestSupport.java
(original)
+++ camel/trunk/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintTestSupport.java
Mon Jan 23 16:28:43 2012
@@ -39,6 +39,7 @@ import de.kalpatec.pojosr.framework.laun
 import de.kalpatec.pojosr.framework.launch.PojoServiceRegistryFactory;
 import org.apache.camel.CamelContext;
 import org.apache.camel.test.CamelTestSupport;
+import org.apache.camel.util.FileUtil;
 import org.apache.camel.util.IOHelper;
 import org.apache.camel.util.ObjectHelper;
 import org.ops4j.pax.swissbox.tinybundles.core.TinyBundle;
@@ -114,6 +115,8 @@ public abstract class CamelBlueprintTest
             Iterator<Object> it = ObjectHelper.createIterator(descriptor);
             while (it.hasNext()) {
                 String s = (String) it.next();
+                // remove leading / to be able to load resource from the classpath
+                s = FileUtil.stripLeadingSeparator(s);
                 URL url = ObjectHelper.loadResourceAsURL(s);
                 if (url == null) {
                     throw new FileNotFoundException("Resource " + s + " not found in classpath");

Modified: camel/trunk/tooling/archetypes/camel-archetype-blueprint/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml
URL: http://svn.apache.org/viewvc/camel/trunk/tooling/archetypes/camel-archetype-blueprint/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml?rev=1234885&r1=1234884&r2=1234885&view=diff
==============================================================================
--- camel/trunk/tooling/archetypes/camel-archetype-blueprint/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml
(original)
+++ camel/trunk/tooling/archetypes/camel-archetype-blueprint/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml
Mon Jan 23 16:28:43 2012
@@ -57,6 +57,12 @@
       </includes>
     </fileSet>
     <fileSet filtered="true" encoding="UTF-8">
+      <directory>src/test/resources</directory>
+      <includes>
+        <include>**/*</include>
+      </includes>
+    </fileSet>
+    <fileSet filtered="true" encoding="UTF-8">
       <directory></directory>
       <includes>
         <include>ReadMe.txt</include>

Modified: camel/trunk/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/ReadMe.txt
URL: http://svn.apache.org/viewvc/camel/trunk/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/ReadMe.txt?rev=1234885&r1=1234884&r2=1234885&view=diff
==============================================================================
--- camel/trunk/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/ReadMe.txt
(original)
+++ camel/trunk/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/ReadMe.txt
Mon Jan 23 16:28:43 2012
@@ -1,6 +1,10 @@
 Camel Router Project for Blueprint (OSGi)
 =========================================
 
+To build this example use
+
+    mvn install
+
 To deploy the example in OSGi. For example using Apache ServiceMix
 or Apache Karaf. You will run the following command from its shell:
 

Modified: camel/trunk/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/pom.xml?rev=1234885&r1=1234884&r2=1234885&view=diff
==============================================================================
--- camel/trunk/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/pom.xml
(original)
+++ camel/trunk/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/pom.xml
Mon Jan 23 16:28:43 2012
@@ -60,6 +60,11 @@
       <version>${slf4j-version}</version>
     </dependency>
     <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>jcl-over-slf4j</artifactId>
+      <version>${slf4j-version}</version>
+    </dependency>
+    <dependency>
       <groupId>log4j</groupId>
       <artifactId>log4j</artifactId>
       <version>${log4j-version}</version>
@@ -94,6 +99,15 @@
           </instructions>
         </configuration>
       </plugin>
+
+      <!-- must use fork mode pertest for unit testing with camel-test-blueprint -->
+      <plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <forkMode>pertest</forkMode>
+        </configuration>
+      </plugin>
+
     </plugins>
 
   </build>

Modified: camel/trunk/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/src/main/resources/OSGI-INF/blueprint/blueprint.xml
URL: http://svn.apache.org/viewvc/camel/trunk/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/src/main/resources/OSGI-INF/blueprint/blueprint.xml?rev=1234885&r1=1234884&r2=1234885&view=diff
==============================================================================
--- camel/trunk/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/src/main/resources/OSGI-INF/blueprint/blueprint.xml
(original)
+++ camel/trunk/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/src/main/resources/OSGI-INF/blueprint/blueprint.xml
Mon Jan 23 16:28:43 2012
@@ -29,12 +29,12 @@
 
   <camelContext id="blueprintContext" trace="false" xmlns="http://camel.apache.org/schema/blueprint">
     <route id="timerToLog">
-      <from uri="direct:start"/>
+      <from uri="timer:foo?period=5000"/>
       <setBody>
           <method ref="helloBean" method="hello"/>
       </setBody>
       <log message="The message contains ${body}"/>
-      <to uri="mock:a" />
+      <to uri="mock:result"/>
     </route>
   </camelContext>
 

Modified: camel/trunk/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/src/test/java/RouteTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/src/test/java/RouteTest.java?rev=1234885&r1=1234884&r2=1234885&view=diff
==============================================================================
--- camel/trunk/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/src/test/java/RouteTest.java
(original)
+++ camel/trunk/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/src/test/java/RouteTest.java
Mon Jan 23 16:28:43 2012
@@ -16,10 +16,6 @@
  */
 package ${package};
 
-import java.net.URL;
-import java.util.Collection;
-import java.util.Collections;
-
 import org.apache.camel.test.blueprint.CamelBlueprintTestSupport;
 
 import org.junit.Test;
@@ -27,19 +23,17 @@ import org.junit.Test;
 public class RouteTest extends CamelBlueprintTestSupport {
 	
     @Override
-    protected Collection<URL> getBlueprintDescriptors() {
-        return Collections.singleton(getClass().getResource("/OSGI-INF/blueprint/blueprint.xml"));
+    protected String getBlueprintDescriptor() {
+        return "/OSGI-INF/blueprint/blueprint.xml";
     }
 
     @Test
-    public void testDebugger() throws Exception {
-        // set mock expectations
-        getMockEndpoint("mock:a").expectedMessageCount(1);
-
-        // send a message
-        template.sendBody("direct:start", "World");
+    public void testRoute() throws Exception {
+        // the route is timer based, so every 5th second a message is send
+        // we should then expect at least one message
+        getMockEndpoint("mock:result").expectedMinimumMessageCount(1);
 
-        // assert mocks
+        // assert expectations
         assertMockEndpointsSatisfied();
     }
 

Modified: camel/trunk/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/camel/trunk/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/src/test/resources/log4j.properties?rev=1234885&r1=1234884&r2=1234885&view=diff
==============================================================================
--- camel/trunk/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/src/test/resources/log4j.properties
(original)
+++ camel/trunk/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/src/test/resources/log4j.properties
Mon Jan 23 16:28:43 2012
@@ -18,11 +18,9 @@
 #
 # The logging properties used for testing
 #
-log4j.rootLogger=INFO, out
+log4j.rootLogger=INFO, file
 
-log4j.logger.org.springframework=WARN
 #log4j.logger.org.apache.camel=DEBUG
-#log4j.logger.org.apache.camel.test.junit4=DEBUG
 
 # CONSOLE appender not used by default
 log4j.appender.out=org.apache.log4j.ConsoleAppender



Mime
View raw message