Author: ningjiang
Date: Thu May 19 14:23:29 2011
New Revision: 1124826
URL: http://svn.apache.org/viewvc?rev=1124826&view=rev
Log:
Removed the dependency of the camel-core and camel-spring test jars in the
camel-crypto
Modified:
camel/trunk/components/camel-crypto/pom.xml
camel/trunk/components/camel-crypto/src/test/java/org/apache/camel/component/crypto/SignatureTests.java
camel/trunk/components/camel-crypto/src/test/java/org/apache/camel/component/crypto/SpringSignatureTest.java
camel/trunk/components/camel-crypto/src/test/java/org/apache/camel/converter/crypto/CryptoDataFormatTest.java
camel/trunk/components/camel-crypto/src/test/java/org/apache/camel/converter/crypto/SpringCryptoDataFormatTest.java
Modified: camel/trunk/components/camel-crypto/pom.xml
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-crypto/pom.xml?rev=1124826&r1=1124825&r2=1124826&view=diff
==============================================================================
--- camel/trunk/components/camel-crypto/pom.xml (original)
+++ camel/trunk/components/camel-crypto/pom.xml Thu May 19 14:23:29 2011
@@ -57,21 +57,6 @@
<!-- for testing -->
<dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-spring</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- <classifier>tests</classifier>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-core</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- <classifier>tests</classifier>
- </dependency>
-
- <dependency>
<groupId>bouncycastle</groupId>
<artifactId>bcprov-jdk15</artifactId>
<version>${bouncycastle-version}</version>
Modified:
camel/trunk/components/camel-crypto/src/test/java/org/apache/camel/component/crypto/SignatureTests.java
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-crypto/src/test/java/org/apache/camel/component/crypto/SignatureTests.java?rev=1124826&r1=1124825&r2=1124826&view=diff
==============================================================================
---
camel/trunk/components/camel-crypto/src/test/java/org/apache/camel/component/crypto/SignatureTests.java
(original)
+++
camel/trunk/components/camel-crypto/src/test/java/org/apache/camel/component/crypto/SignatureTests.java
Thu May 19 14:23:29 2011
@@ -29,19 +29,21 @@ import java.util.Collections;
import java.util.Map;
import org.apache.camel.CamelContext;
-import org.apache.camel.ContextTestSupport;
import org.apache.camel.Exchange;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.impl.JndiRegistry;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Before;
+import org.junit.Test;
import static
org.apache.camel.component.crypto.DigitalSignatureConstants.KEYSTORE_ALIAS;
import static
org.apache.camel.component.crypto.DigitalSignatureConstants.SIGNATURE_PRIVATE_KEY;
import static
org.apache.camel.component.crypto.DigitalSignatureConstants.SIGNATURE_PUBLIC_KEY_OR_CERT;
-public class SignatureTests extends ContextTestSupport {
+public class SignatureTests extends CamelTestSupport {
private KeyPair keyPair;
private String payload = "Dear Alice, Rest assured it's me, signed Bob";
@@ -136,30 +138,35 @@ public class SignatureTests extends Cont
}};
}
+ @Test
public void testBasicSignatureRoute() throws Exception {
MockEndpoint mock = setupMock();
sendBody("direct:keypair", payload);
assertMockEndpointsSatisfied();
}
+ @Test
public void testSetAlgorithmInRouteDefinition() throws Exception {
MockEndpoint mock = setupMock();
sendBody("direct:algorithm", payload);
assertMockEndpointsSatisfied();
}
+ @Test
public void testSetBufferInRouteDefinition() throws Exception {
MockEndpoint mock = setupMock();
sendBody("direct:buffersize", payload);
assertMockEndpointsSatisfied();
}
+ @Test
public void testSetRandomInRouteDefinition() throws Exception {
MockEndpoint mock = setupMock();
sendBody("direct:random", payload);
assertMockEndpointsSatisfied();
}
+ @Test
public void testSetProviderInRouteDefinition() throws Exception {
if (isJavaVendor("ibm")) {
return;
@@ -170,18 +177,21 @@ public class SignatureTests extends Cont
assertMockEndpointsSatisfied();
}
+ @Test
public void testSetCertificateInRouteDefinition() throws Exception {
MockEndpoint mock = setupMock();
sendBody("direct:certificate", payload);
assertMockEndpointsSatisfied();
}
+ @Test
public void testSetKeystoreInRouteDefinition() throws Exception {
MockEndpoint mock = setupMock();
sendBody("direct:keystore", payload);
assertMockEndpointsSatisfied();
}
+ @Test
public void testSignatureHeaderInRouteDefinition() throws Exception {
MockEndpoint mock = setupMock();
Exchange signed =
getMandatoryEndpoint("direct:signature-header").createExchange();
@@ -192,6 +202,7 @@ public class SignatureTests extends Cont
assertMockEndpointsSatisfied();
}
+ @Test
public void testProvideAliasInHeader() throws Exception {
MockEndpoint mock = setupMock();
@@ -211,6 +222,7 @@ public class SignatureTests extends Cont
assertMockEndpointsSatisfied();
}
+ @Test
public void testProvideKeysInHeader() throws Exception {
MockEndpoint mock = setupMock();
Exchange unsigned =
getMandatoryEndpoint("direct:headerkey-sign").createExchange();
@@ -232,6 +244,7 @@ public class SignatureTests extends Cont
assertMockEndpointsSatisfied();
}
+ @Test
public void testProvideCertificateInHeader() throws Exception {
MockEndpoint mock = setupMock();
Exchange unsigned =
getMandatoryEndpoint("direct:signature-property").createExchange();
@@ -288,8 +301,8 @@ public class SignatureTests extends Cont
}
}
- @Override
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
setUpKeys("DSA");
disableJMX();
super.setUp();
Modified:
camel/trunk/components/camel-crypto/src/test/java/org/apache/camel/component/crypto/SpringSignatureTest.java
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-crypto/src/test/java/org/apache/camel/component/crypto/SpringSignatureTest.java?rev=1124826&r1=1124825&r2=1124826&view=diff
==============================================================================
---
camel/trunk/components/camel-crypto/src/test/java/org/apache/camel/component/crypto/SpringSignatureTest.java
(original)
+++
camel/trunk/components/camel-crypto/src/test/java/org/apache/camel/component/crypto/SpringSignatureTest.java
Thu May 19 14:23:29 2011
@@ -26,8 +26,8 @@ import java.security.cert.Certificate;
import org.apache.camel.CamelContext;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.impl.JndiRegistry;
+import org.apache.camel.spring.SpringCamelContext;
-import static
org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext;
public class SpringSignatureTest extends SignatureTests {
@@ -35,7 +35,7 @@ public class SpringSignatureTest extends
protected CamelContext createCamelContext() throws Exception {
rsaPair = getKeyPair("RSA");
- return createSpringCamelContext(this,
"org/apache/camel/component/crypto/SpringSignatureTests.xml");
+ return
SpringCamelContext.springCamelContext("org/apache/camel/component/crypto/SpringSignatureTests.xml");
}
public static KeyStore keystore() throws Exception {
Modified:
camel/trunk/components/camel-crypto/src/test/java/org/apache/camel/converter/crypto/CryptoDataFormatTest.java
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-crypto/src/test/java/org/apache/camel/converter/crypto/CryptoDataFormatTest.java?rev=1124826&r1=1124825&r2=1124826&view=diff
==============================================================================
---
camel/trunk/components/camel-crypto/src/test/java/org/apache/camel/converter/crypto/CryptoDataFormatTest.java
(original)
+++
camel/trunk/components/camel-crypto/src/test/java/org/apache/camel/converter/crypto/CryptoDataFormatTest.java
Thu May 19 14:23:29 2011
@@ -24,36 +24,43 @@ import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import org.apache.camel.CamelContext;
-import org.apache.camel.ContextTestSupport;
import org.apache.camel.Exchange;
import org.apache.camel.InvalidPayloadException;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
import org.apache.camel.util.ExchangeHelper;
+import org.junit.Test;
-public class CryptoDataFormatTest extends ContextTestSupport {
-
+public class CryptoDataFormatTest extends CamelTestSupport {
+
+ @Test
public void testBasicSymmetric() throws Exception {
doRoundTripEncryptionTests("direct:basic-encryption");
}
+ @Test
public void testSymmetricWithInitVector() throws Exception {
doRoundTripEncryptionTests("direct:init-vector");
}
+ @Test
public void testSymmetricWithInlineInitVector() throws Exception {
doRoundTripEncryptionTests("direct:inline");
}
+ @Test
public void testSymmetricWithHMAC() throws Exception {
doRoundTripEncryptionTests("direct:hmac");
}
+ @Test
public void testSymmetricWithMD5HMAC() throws Exception {
doRoundTripEncryptionTests("direct:hmac-algorithm");
}
+ @Test
public void testKeySuppliedAsHeader() throws Exception {
KeyGenerator generator = KeyGenerator.getInstance("DES");
Key key = generator.generateKey();
Modified:
camel/trunk/components/camel-crypto/src/test/java/org/apache/camel/converter/crypto/SpringCryptoDataFormatTest.java
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-crypto/src/test/java/org/apache/camel/converter/crypto/SpringCryptoDataFormatTest.java?rev=1124826&r1=1124825&r2=1124826&view=diff
==============================================================================
---
camel/trunk/components/camel-crypto/src/test/java/org/apache/camel/converter/crypto/SpringCryptoDataFormatTest.java
(original)
+++
camel/trunk/components/camel-crypto/src/test/java/org/apache/camel/converter/crypto/SpringCryptoDataFormatTest.java
Thu May 19 14:23:29 2011
@@ -22,8 +22,7 @@ import javax.crypto.KeyGenerator;
import org.apache.camel.CamelContext;
import org.apache.camel.builder.RouteBuilder;
-
-import static
org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext;
+import org.apache.camel.spring.SpringCamelContext;
public class SpringCryptoDataFormatTest extends CryptoDataFormatTest {
@@ -37,7 +36,7 @@ public class SpringCryptoDataFormatTest
protected CamelContext createCamelContext() throws Exception {
KeyGenerator generator = KeyGenerator.getInstance("DES");
deskey = generator.generateKey();
- return createSpringCamelContext(this,
"/org/apache/camel/component/crypto/SpringCryptoDataFormatTest.xml");
+ return
SpringCamelContext.springCamelContext("/org/apache/camel/component/crypto/SpringCryptoDataFormatTest.xml");
}
public static Key getDesKey() {