You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2009/06/18 07:06:03 UTC
svn commit: r785905 - in /camel/trunk/components/camel-velocity: ./
src/test/java/org/apache/camel/component/velocity/
Author: ningjiang
Date: Thu Jun 18 05:06:03 2009
New Revision: 785905
URL: http://svn.apache.org/viewvc?rev=785905&view=rev
Log:
CAMEL-1712 Upgraded the camel-velocity to JUnit4
Modified:
camel/trunk/components/camel-velocity/pom.xml
camel/trunk/components/camel-velocity/src/test/java/org/apache/camel/component/velocity/VelocityBodyAsDomainObjectTest.java
camel/trunk/components/camel-velocity/src/test/java/org/apache/camel/component/velocity/VelocityConcurrentTest.java
camel/trunk/components/camel-velocity/src/test/java/org/apache/camel/component/velocity/VelocityContentCacheTest.java
camel/trunk/components/camel-velocity/src/test/java/org/apache/camel/component/velocity/VelocityLetterTest.java
camel/trunk/components/camel-velocity/src/test/java/org/apache/camel/component/velocity/VelocitySetHeaderTest.java
camel/trunk/components/camel-velocity/src/test/java/org/apache/camel/component/velocity/VelocitySomeValuesNotInExchangeTest.java
camel/trunk/components/camel-velocity/src/test/java/org/apache/camel/component/velocity/VelocityTest.java
Modified: camel/trunk/components/camel-velocity/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-velocity/pom.xml?rev=785905&r1=785904&r2=785905&view=diff
==============================================================================
--- camel/trunk/components/camel-velocity/pom.xml (original)
+++ camel/trunk/components/camel-velocity/pom.xml Thu Jun 18 05:06:03 2009
@@ -57,14 +57,7 @@
<!-- testing -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-core</artifactId>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-spring</artifactId>
- <type>test-jar</type>
+ <artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Modified: camel/trunk/components/camel-velocity/src/test/java/org/apache/camel/component/velocity/VelocityBodyAsDomainObjectTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-velocity/src/test/java/org/apache/camel/component/velocity/VelocityBodyAsDomainObjectTest.java?rev=785905&r1=785904&r2=785905&view=diff
==============================================================================
--- camel/trunk/components/camel-velocity/src/test/java/org/apache/camel/component/velocity/VelocityBodyAsDomainObjectTest.java (original)
+++ camel/trunk/components/camel-velocity/src/test/java/org/apache/camel/component/velocity/VelocityBodyAsDomainObjectTest.java Thu Jun 18 05:06:03 2009
@@ -16,17 +16,19 @@
*/
package org.apache.camel.component.velocity;
-import org.apache.camel.ContextTestSupport;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
/**
* Unit test with the body as a Domain object.
*
* @version $Revision$
*/
-public class VelocityBodyAsDomainObjectTest extends ContextTestSupport {
+public class VelocityBodyAsDomainObjectTest extends CamelTestSupport {
+ @Test
public void testWithObject() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedMessageCount(1);
Modified: camel/trunk/components/camel-velocity/src/test/java/org/apache/camel/component/velocity/VelocityConcurrentTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-velocity/src/test/java/org/apache/camel/component/velocity/VelocityConcurrentTest.java?rev=785905&r1=785904&r2=785905&view=diff
==============================================================================
--- camel/trunk/components/camel-velocity/src/test/java/org/apache/camel/component/velocity/VelocityConcurrentTest.java (original)
+++ camel/trunk/components/camel-velocity/src/test/java/org/apache/camel/component/velocity/VelocityConcurrentTest.java Thu Jun 18 05:06:03 2009
@@ -20,18 +20,21 @@
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
-import org.apache.camel.ContextTestSupport;
import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
/**
* @version $Revision$
*/
-public class VelocityConcurrentTest extends ContextTestSupport {
+public class VelocityConcurrentTest extends CamelTestSupport {
+ @Test
public void testNoConcurrentProducers() throws Exception {
doSendMessages(1, 1);
}
+ @Test
public void testConcurrentProducers() throws Exception {
doSendMessages(10, 5);
}
Modified: camel/trunk/components/camel-velocity/src/test/java/org/apache/camel/component/velocity/VelocityContentCacheTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-velocity/src/test/java/org/apache/camel/component/velocity/VelocityContentCacheTest.java?rev=785905&r1=785904&r2=785905&view=diff
==============================================================================
--- camel/trunk/components/camel-velocity/src/test/java/org/apache/camel/component/velocity/VelocityContentCacheTest.java (original)
+++ camel/trunk/components/camel-velocity/src/test/java/org/apache/camel/component/velocity/VelocityContentCacheTest.java Thu Jun 18 05:06:03 2009
@@ -16,23 +16,27 @@
*/
package org.apache.camel.component.velocity;
-import org.apache.camel.ContextTestSupport;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Before;
+import org.junit.Test;
/**
* Unit test the cache when reloading .vm files in the classpath
*/
-public class VelocityContentCacheTest extends ContextTestSupport {
+public class VelocityContentCacheTest extends CamelTestSupport {
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
super.setUp();
// create a vm file in the classpath as this is the tricky reloading stuff
template.sendBodyAndHeader("file://target/test-classes/org/apache/camel/component/velocity?fileExist=Override", "Hello $headers.name", Exchange.FILE_NAME, "hello.vm");
}
+ @Test
public void testNotCached() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedBodiesReceived("Hello London");
@@ -50,6 +54,7 @@
mock.assertIsSatisfied();
}
+ @Test
public void testCached() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedBodiesReceived("Hello London");
@@ -68,6 +73,7 @@
mock.assertIsSatisfied();
}
+ @Test
public void testCachedIsDefault() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedBodiesReceived("Hello London");
Modified: camel/trunk/components/camel-velocity/src/test/java/org/apache/camel/component/velocity/VelocityLetterTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-velocity/src/test/java/org/apache/camel/component/velocity/VelocityLetterTest.java?rev=785905&r1=785904&r2=785905&view=diff
==============================================================================
--- camel/trunk/components/camel-velocity/src/test/java/org/apache/camel/component/velocity/VelocityLetterTest.java (original)
+++ camel/trunk/components/camel-velocity/src/test/java/org/apache/camel/component/velocity/VelocityLetterTest.java Thu Jun 18 05:06:03 2009
@@ -16,16 +16,17 @@
*/
package org.apache.camel.component.velocity;
-import org.apache.camel.ContextTestSupport;
import org.apache.camel.Exchange;
import org.apache.camel.Message;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
/**
* Unit test for wiki documentation
*/
-public class VelocityLetterTest extends ContextTestSupport {
+public class VelocityLetterTest extends CamelTestSupport {
// START SNIPPET: e1
private Exchange createLetter() {
@@ -38,6 +39,7 @@
return exchange;
}
+ @Test
public void testVelocityLetter() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedMessageCount(1);
Modified: camel/trunk/components/camel-velocity/src/test/java/org/apache/camel/component/velocity/VelocitySetHeaderTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-velocity/src/test/java/org/apache/camel/component/velocity/VelocitySetHeaderTest.java?rev=785905&r1=785904&r2=785905&view=diff
==============================================================================
--- camel/trunk/components/camel-velocity/src/test/java/org/apache/camel/component/velocity/VelocitySetHeaderTest.java (original)
+++ camel/trunk/components/camel-velocity/src/test/java/org/apache/camel/component/velocity/VelocitySetHeaderTest.java Thu Jun 18 05:06:03 2009
@@ -21,17 +21,20 @@
import org.apache.camel.Message;
import org.apache.camel.Processor;
import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.spring.SpringTestSupport;
+import org.apache.camel.test.junit4.CamelSpringTestSupport;
+import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;
/**
* @version $Revision$
*/
-public class VelocitySetHeaderTest extends SpringTestSupport {
+public class VelocitySetHeaderTest extends CamelSpringTestSupport {
+ @Test
public void testSendingApple() throws Exception {
assertRespondsWith("apple", "I am an apple");
}
+ @Test
public void testSendingOrgane() throws Exception {
assertRespondsWith("orange", "I am an orange");
}
Modified: camel/trunk/components/camel-velocity/src/test/java/org/apache/camel/component/velocity/VelocitySomeValuesNotInExchangeTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-velocity/src/test/java/org/apache/camel/component/velocity/VelocitySomeValuesNotInExchangeTest.java?rev=785905&r1=785904&r2=785905&view=diff
==============================================================================
--- camel/trunk/components/camel-velocity/src/test/java/org/apache/camel/component/velocity/VelocitySomeValuesNotInExchangeTest.java (original)
+++ camel/trunk/components/camel-velocity/src/test/java/org/apache/camel/component/velocity/VelocitySomeValuesNotInExchangeTest.java Thu Jun 18 05:06:03 2009
@@ -19,15 +19,17 @@
import java.util.HashMap;
import java.util.Map;
-import org.apache.camel.ContextTestSupport;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
/**
* Unit test with some variables missing.
*/
-public class VelocitySomeValuesNotInExchangeTest extends ContextTestSupport {
+public class VelocitySomeValuesNotInExchangeTest extends CamelTestSupport {
+ @Test
public void testWithAllValues() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedMessageCount(1);
@@ -42,6 +44,7 @@
assertMockEndpointsSatisfied();
}
+ @Test
public void testWithSomeValues() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedMessageCount(1);
Modified: camel/trunk/components/camel-velocity/src/test/java/org/apache/camel/component/velocity/VelocityTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-velocity/src/test/java/org/apache/camel/component/velocity/VelocityTest.java?rev=785905&r1=785904&r2=785905&view=diff
==============================================================================
--- camel/trunk/components/camel-velocity/src/test/java/org/apache/camel/component/velocity/VelocityTest.java (original)
+++ camel/trunk/components/camel-velocity/src/test/java/org/apache/camel/component/velocity/VelocityTest.java Thu Jun 18 05:06:03 2009
@@ -16,21 +16,24 @@
*/
package org.apache.camel.component.velocity;
-import org.apache.camel.ContextTestSupport;
import org.apache.camel.Exchange;
import org.apache.camel.InvalidPayloadException;
import org.apache.camel.Message;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
/**
* @version $Revision$
*/
-public class VelocityTest extends ContextTestSupport {
+public class VelocityTest extends CamelTestSupport {
+ @Test
public void testReceivesFooResponse() throws Exception {
assertRespondsWith("foo", "<hello>foo</hello>");
}
+ @Test
public void testReceivesBarResponse() throws Exception {
assertRespondsWith("bar", "<hello>bar</hello>");
}