You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juddi.apache.org by al...@apache.org on 2014/02/22 15:06:53 UTC
git commit: JUDDI-860 adding test cases
Repository: juddi
Updated Branches:
refs/heads/master f2bd20216 -> c11d3d877
JUDDI-860 adding test cases
Project: http://git-wip-us.apache.org/repos/asf/juddi/repo
Commit: http://git-wip-us.apache.org/repos/asf/juddi/commit/c11d3d87
Tree: http://git-wip-us.apache.org/repos/asf/juddi/tree/c11d3d87
Diff: http://git-wip-us.apache.org/repos/asf/juddi/diff/c11d3d87
Branch: refs/heads/master
Commit: c11d3d877889da4a2f7711fa80656524c7f74f9d
Parents: f2bd202
Author: alex <sp...@gmail.com>
Authored: Sat Feb 22 09:06:28 2014 -0500
Committer: alex <sp...@gmail.com>
Committed: Sat Feb 22 09:06:28 2014 -0500
----------------------------------------------------------------------
.../v3/client/config/CryptoConfigTest.java | 43 -------
.../v3/client/config/MisconfigurationTests.java | 44 +++++++
.../v3/client/cryptor/CryptoConfigTest.java | 45 ++++++++
.../src/test/resources/META-INF/configtests.xml | 115 +++++++++++++++++++
4 files changed, 204 insertions(+), 43 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/juddi/blob/c11d3d87/juddi-client/src/test/java/org/apache/juddi/v3/client/config/CryptoConfigTest.java
----------------------------------------------------------------------
diff --git a/juddi-client/src/test/java/org/apache/juddi/v3/client/config/CryptoConfigTest.java b/juddi-client/src/test/java/org/apache/juddi/v3/client/config/CryptoConfigTest.java
deleted file mode 100644
index c38bef5..0000000
--- a/juddi-client/src/test/java/org/apache/juddi/v3/client/config/CryptoConfigTest.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2013 The Apache Software Foundation.
- *
- * Licensed 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.juddi.v3.client.config;
-
-import org.apache.juddi.v3.client.cryptor.CryptorFactory;
-import org.junit.Assert;
-import org.junit.Test;
-
-/**
- *
- * @author <a href="mailto:alexoree@apache.org">Alex O'Ree</a>
- */
-public class CryptoConfigTest {
-
- @Test()
- public void EncryptedCredentialsAES128Test() throws Exception {
- UDDIClient clerkManager = new UDDIClient("META-INF/uddi3-enc-aes128.xml");
- // Now you create a reference to the UDDI API
- UDDIClerk c = clerkManager.getClerk("default");
- UDDIClerk c2 = clerkManager.getClerk("medroot");
- Assert.assertNotSame(c.getPassword(), c2.getPassword());
- Assert.assertEquals("root", CryptorFactory.getCryptor(c.getCryptoProvider()).decrypt(c.getRawPassword()));
- Assert.assertEquals("root", c.getPassword());
-
- Assert.assertEquals("password", CryptorFactory.getCryptor(c2.getCryptoProvider()).decrypt(c2.getRawPassword()));
- Assert.assertEquals("password", c2.getPassword());
-
-
- }
-}
http://git-wip-us.apache.org/repos/asf/juddi/blob/c11d3d87/juddi-client/src/test/java/org/apache/juddi/v3/client/config/MisconfigurationTests.java
----------------------------------------------------------------------
diff --git a/juddi-client/src/test/java/org/apache/juddi/v3/client/config/MisconfigurationTests.java b/juddi-client/src/test/java/org/apache/juddi/v3/client/config/MisconfigurationTests.java
new file mode 100644
index 0000000..5b41f3c
--- /dev/null
+++ b/juddi-client/src/test/java/org/apache/juddi/v3/client/config/MisconfigurationTests.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2014 The Apache Software Foundation.
+ *
+ * Licensed 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.juddi.v3.client.config;
+
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.juddi.v3.client.transport.Transport;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ *
+ * @author Alex O'Ree
+ */
+public class MisconfigurationTests {
+
+ @Test(expected = ConfigurationException.class)
+ public void TestMissingClerk() throws ConfigurationException{
+ UDDIClient client = new UDDIClient("META-INF/configtests.xml");
+ UDDIClerk clerk = client.getClerk("missingClerk");
+ Assert.fail("this should have thrown an exception");
+ }
+
+ @Test(expected = ConfigurationException.class)
+ public void TestMissingTransportClass() throws ConfigurationException{
+ UDDIClient client = new UDDIClient("META-INF/configtests.xml");
+ UDDIClerk clerk = client.getClerk("missingTransport");
+ Transport transport = client.getTransport("missingTransport");
+ Assert.fail("this should have thrown an exception");
+ }
+}
http://git-wip-us.apache.org/repos/asf/juddi/blob/c11d3d87/juddi-client/src/test/java/org/apache/juddi/v3/client/cryptor/CryptoConfigTest.java
----------------------------------------------------------------------
diff --git a/juddi-client/src/test/java/org/apache/juddi/v3/client/cryptor/CryptoConfigTest.java b/juddi-client/src/test/java/org/apache/juddi/v3/client/cryptor/CryptoConfigTest.java
new file mode 100644
index 0000000..5f0dc74
--- /dev/null
+++ b/juddi-client/src/test/java/org/apache/juddi/v3/client/cryptor/CryptoConfigTest.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2013 The Apache Software Foundation.
+ *
+ * Licensed 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.juddi.v3.client.cryptor;
+
+import org.apache.juddi.v3.client.config.UDDIClerk;
+import org.apache.juddi.v3.client.config.UDDIClient;
+import org.apache.juddi.v3.client.cryptor.CryptorFactory;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ *
+ * @author <a href="mailto:alexoree@apache.org">Alex O'Ree</a>
+ */
+public class CryptoConfigTest {
+
+ @Test()
+ public void EncryptedCredentialsAES128Test() throws Exception {
+ UDDIClient clerkManager = new UDDIClient("META-INF/uddi3-enc-aes128.xml");
+ // Now you create a reference to the UDDI API
+ UDDIClerk c = clerkManager.getClerk("default");
+ UDDIClerk c2 = clerkManager.getClerk("medroot");
+ Assert.assertNotSame(c.getPassword(), c2.getPassword());
+ Assert.assertEquals("root", CryptorFactory.getCryptor(c.getCryptoProvider()).decrypt(c.getRawPassword()));
+ Assert.assertEquals("root", c.getPassword());
+
+ Assert.assertEquals("password", CryptorFactory.getCryptor(c2.getCryptoProvider()).decrypt(c2.getRawPassword()));
+ Assert.assertEquals("password", c2.getPassword());
+
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/juddi/blob/c11d3d87/juddi-client/src/test/resources/META-INF/configtests.xml
----------------------------------------------------------------------
diff --git a/juddi-client/src/test/resources/META-INF/configtests.xml b/juddi-client/src/test/resources/META-INF/configtests.xml
new file mode 100644
index 0000000..6e7dd3a
--- /dev/null
+++ b/juddi-client/src/test/resources/META-INF/configtests.xml
@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<uddi xmlns="urn:juddi-apache-org:v3_client" xsi:schemaLocation="classpath:/xsd/uddi-client.xsd">
+ <reloadDelay>5000</reloadDelay>
+ <client name="test-client">
+ <nodes>
+ <node isHomeJUDDI="true" >
+ <!-- required 'default' node -->
+ <name>default</name>
+ <description>Main jUDDI node</description>
+ <properties>
+ <property name="serverName" value="localhost" />
+ <property name="serverPort" value="8880" />
+ </properties>
+ <!-- JAX-WS Transport -->
+ <proxyTransport>org.apache.juddi.v3.client.transport.JAXWSTransport</proxyTransport>
+ <custodyTransferUrl>http://${serverName}:${serverPort}/juddiv3/services/custody-transfer?wsdl</custodyTransferUrl>
+ <inquiryUrl>http://${serverName}:${serverPort}/juddiv3/services/inquiry?wsdl</inquiryUrl>
+ <inquiryRESTUrl>http://${serverName}:${serverPort}/juddiv3/services/inquiryRest</inquiryRESTUrl>
+ <publishUrl>http://${serverName}:${serverPort}/juddiv3/services/publish?wsdl</publishUrl>
+ <securityUrl>http://${serverName}:${serverPort}/juddiv3/services/security?wsdl</securityUrl>
+ <subscriptionUrl>http://${serverName}:${serverPort}/juddiv3/services/subscription?wsdl</subscriptionUrl>
+ <subscriptionListenerUrl>http://${serverName}:${serverPort}/juddiv3/services/subscription-listener?wsdl</subscriptionListenerUrl>
+ <juddiApiUrl>http://${serverName}:${serverPort}/juddiv3/services/juddi-api?wsdl</juddiApiUrl>
+
+ </node>
+ <node >
+ <!-- required 'default' node -->
+ <name>missingTransport</name>
+ <description>Main jUDDI node</description>
+ <properties>
+ <property name="serverName" value="localhost" />
+ <property name="serverPort" value="8880" />
+ </properties>
+ <!-- JAX-WS Transport -->
+ <custodyTransferUrl>http://${serverName}:${serverPort}/juddiv3/services/custody-transfer?wsdl</custodyTransferUrl>
+ <inquiryUrl>http://${serverName}:${serverPort}/juddiv3/services/inquiry?wsdl</inquiryUrl>
+ <inquiryRESTUrl>http://${serverName}:${serverPort}/juddiv3/services/inquiryRest</inquiryRESTUrl>
+ <publishUrl>http://${serverName}:${serverPort}/juddiv3/services/publish?wsdl</publishUrl>
+ <securityUrl>http://${serverName}:${serverPort}/juddiv3/services/security?wsdl</securityUrl>
+ <subscriptionUrl>http://${serverName}:${serverPort}/juddiv3/services/subscription?wsdl</subscriptionUrl>
+ <subscriptionListenerUrl>http://${serverName}:${serverPort}/juddiv3/services/subscription-listener?wsdl</subscriptionListenerUrl>
+ <juddiApiUrl>http://${serverName}:${serverPort}/juddiv3/services/juddi-api?wsdl</juddiApiUrl>
+
+ </node>
+ <node >
+ <!-- required 'default' node -->
+ <name>missingClerk</name>
+ <description>Main jUDDI node</description>
+ <properties>
+ <property name="serverName" value="localhost" />
+ <property name="serverPort" value="8880" />
+ </properties>
+ <!-- JAX-WS Transport -->
+ <custodyTransferUrl>http://${serverName}:${serverPort}/juddiv3/services/custody-transfer?wsdl</custodyTransferUrl>
+ <inquiryUrl>http://${serverName}:${serverPort}/juddiv3/services/inquiry?wsdl</inquiryUrl>
+ <inquiryRESTUrl>http://${serverName}:${serverPort}/juddiv3/services/inquiryRest</inquiryRESTUrl>
+ <publishUrl>http://${serverName}:${serverPort}/juddiv3/services/publish?wsdl</publishUrl>
+ <securityUrl>http://${serverName}:${serverPort}/juddiv3/services/security?wsdl</securityUrl>
+ <subscriptionUrl>http://${serverName}:${serverPort}/juddiv3/services/subscription?wsdl</subscriptionUrl>
+ <subscriptionListenerUrl>http://${serverName}:${serverPort}/juddiv3/services/subscription-listener?wsdl</subscriptionListenerUrl>
+ <juddiApiUrl>http://${serverName}:${serverPort}/juddiv3/services/juddi-api?wsdl</juddiApiUrl>
+
+ </node>
+ </nodes>
+
+ <clerks registerOnStartup="false" >
+ <clerk name="default" node="default" publisher="userjoe" password="******" ></clerk>
+ <clerk name="missingTransport" node="missingTransport" publisher="userjoe" password="******" ></clerk>
+ </clerks>
+ <signature>
+ <!-- signing stuff -->
+ <signingKeyStorePath>keystore.jks</signingKeyStorePath>
+ <signingKeyStoreType>JKS</signingKeyStoreType>
+ <signingKeyStoreFilePassword
+ isPasswordEncrypted="false"
+ cryptoProvider="org.apache.juddi.v3.client.crypto.AES128Cryptor">password</signingKeyStoreFilePassword>
+ <signingKeyPassword
+ isPasswordEncrypted="false"
+ cryptoProvider="org.apache.juddi.v3.client.crypto.AES128Cryptor">password</signingKeyPassword>
+ <signingKeyAlias>my special key</signingKeyAlias>
+
+ <canonicalizationMethod>http://www.w3.org/2001/10/xml-exc-c14n#</canonicalizationMethod>
+ <signatureMethod>http://www.w3.org/2000/09/xmldsig#rsa-sha1</signatureMethod>
+ <XML_DIGSIG_NS>http://www.w3.org/2000/09/xmldsig#</XML_DIGSIG_NS>
+
+ <!-- validation stuff
+ Used whenever someone views an entity that is signed and validation is required -->
+ <!-- if this doesn't exist or is incorrect, the client will atempt to load the standard jdk trust store-->
+ <trustStorePath>truststore.jks</trustStorePath>
+ <trustStoreType>JKS</trustStoreType>
+ <trustStorePassword
+ isPasswordEncrypted="false"
+ cryptoProvider="org.apache.juddi.v3.client.crypto.AES128Cryptor">password</trustStorePassword>
+
+ <checkTimestamps>true</checkTimestamps>
+ <checkTrust>true</checkTrust>
+ <checkRevocationCRL>true</checkRevocationCRL>
+ <keyInfoInclusionSubjectDN>false</keyInfoInclusionSubjectDN>
+ <keyInfoInclusionSerial>false</keyInfoInclusionSerial>
+ <keyInfoInclusionBase64PublicKey>true</keyInfoInclusionBase64PublicKey>
+ <digestMethod>http://www.w3.org/2000/09/xmldsig#sha1</digestMethod>
+ </signature>
+ <subscriptionCallbacks>
+ <keyDomain>uddi:somebusiness</keyDomain>
+ <listenUrl>http://MyHostname:4444/callback</listenUrl>
+ <autoRegisterBindingTemplate>false</autoRegisterBindingTemplate>
+ <autoRegisterBusinessServiceKey>uddi:somebusiness:someservicekey</autoRegisterBusinessServiceKey>
+ <signatureBehavior>DoNothing</signatureBehavior>
+ <!--valid values are AbortIfSigned,Sign,DoNothing,SignOnlyIfParentIsntSigned, default is DoNothing-->
+ </subscriptionCallbacks>
+ <XtoWsdl>
+ <IgnoreSSLErrors>false</IgnoreSSLErrors>
+ </XtoWsdl>
+ </client>
+</uddi>
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@juddi.apache.org
For additional commands, e-mail: commits-help@juddi.apache.org