You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juddi.apache.org by tc...@apache.org on 2010/06/09 18:44:43 UTC
svn commit: r953077 - in /webservices/juddi/trunk: juddi-core-openjpa/
juddi-core-openjpa/src/ juddi-core-openjpa/src/test/
juddi-core-openjpa/src/test/java/ juddi-core-openjpa/src/test/java/org/
juddi-core-openjpa/src/test/java/org/apache/ juddi-core-...
Author: tcunning
Date: Wed Jun 9 16:44:42 2010
New Revision: 953077
URL: http://svn.apache.org/viewvc?rev=953077&view=rev
Log:
JUDDI-401
Remove the tests from juddi-core and add then to juddi-core-openjpa so
we can test both against hibernate and enhanced openjpa
Added:
webservices/juddi/trunk/juddi-core-openjpa/src/
webservices/juddi/trunk/juddi-core-openjpa/src/test/
webservices/juddi/trunk/juddi-core-openjpa/src/test/java/
webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/
webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/
webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/
webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/api/
webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/api/impl/
webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/api/impl/API_010_PublisherTest.java
webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/api/impl/API_020_TmodelTest.java
webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/api/impl/API_030_BusinessEntityTest.java
webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/api/impl/API_040_BusinessServiceTest.java
webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/api/impl/API_050_BindingTemplateTest.java
webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/api/impl/API_060_PublisherAssertionTest.java
webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/api/impl/API_070_FindEntityTest.java
webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/api/impl/API_080_SubscriptionTest.java
webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/api/impl/API_100_ClientSubscriptionInfoTest.java
webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/api/impl/package.html
webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/auth/
webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/auth/AuthenticatorTest.java
webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/config/
webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/config/ApplicationConfigurationTest.java
webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/rmi/
webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/rmi/JNDIRegistrationTest.java
webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/subscription/
webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/subscription/SubscriptionNotifierTest.java
webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/util/
webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/util/JPAUtil.java
Removed:
webservices/juddi/trunk/juddi-core-openjpa/assembly.xml
webservices/juddi/trunk/juddi-core/src/test/
Modified:
webservices/juddi/trunk/juddi-core-openjpa/build.xml
webservices/juddi/trunk/juddi-core-openjpa/pom.xml
webservices/juddi/trunk/juddi-core/pom.xml
Modified: webservices/juddi/trunk/juddi-core-openjpa/build.xml
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/juddi-core-openjpa/build.xml?rev=953077&r1=953076&r2=953077&view=diff
==============================================================================
--- webservices/juddi/trunk/juddi-core-openjpa/build.xml (original)
+++ webservices/juddi/trunk/juddi-core-openjpa/build.xml Wed Jun 9 16:44:42 2010
@@ -10,7 +10,7 @@
</target>
<target name="copy-resources" depends="unzip-jar">
- <copy file="${juddi.core.dir}/src/main/resources/persistence/openjpa-persistence.xml"
+ <copy file="${juddi.core.dir}/src/main/resources/persistence/${persistence}-persistence.xml"
tofile="${basedir}/target/classes/META-INF/persistence.xml"
overwrite="true"/>
</target>
Modified: webservices/juddi/trunk/juddi-core-openjpa/pom.xml
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/juddi-core-openjpa/pom.xml?rev=953077&r1=953076&r2=953077&view=diff
==============================================================================
--- webservices/juddi/trunk/juddi-core-openjpa/pom.xml (original)
+++ webservices/juddi/trunk/juddi-core-openjpa/pom.xml Wed Jun 9 16:44:42 2010
@@ -58,42 +58,6 @@
</configuration>
</plugin>
<plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>openjpa-maven-plugin</artifactId>
- <version>1.0</version>
- <executions>
- <execution>
- <id>enhancer</id>
- <phase>process-classes</phase>
- <configuration>
- <classes>
- ${project.build.outputDirectory}/org/apache/juddi/model/
- </classes>
- <toolProperties>
- <property>
- <name>addDefaultConstructor</name>
- <value>true</value>
- </property>
- <property>
- <name>enforcePropertyRestrictions</name>
- <value>true</value>
- </property>
- </toolProperties>
- </configuration>
- <goals>
- <goal>enhance</goal>
- </goals>
- </execution>
- </executions>
- <dependencies>
- <dependency>
- <groupId>org.apache.openjpa</groupId>
- <artifactId>openjpa</artifactId>
- <version>1.2.2</version>
- </dependency>
- </dependencies>
- </plugin>
- <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.3</version>
@@ -116,7 +80,7 @@
</goals>
</execution>
</executions>
- </plugin>
+ </plugin>
<!--
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -141,17 +105,178 @@
</plugins>
</build>
<dependencies>
- <dependency>
- <groupId>org.apache.openjpa</groupId>
- <artifactId>openjpa</artifactId>
- <version>1.2.2</version>
- </dependency>
+ <dependency>
+ <groupId>org.apache.juddi</groupId>
+ <artifactId>uddi-ws</artifactId>
+ <version>${project.parent.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.juddi</groupId>
+ <artifactId>juddi-client</artifactId>
+ <version>${project.parent.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.persistence</groupId>
+ <artifactId>persistence-api</artifactId>
+ <version>1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>1.3</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-configuration</groupId>
+ <artifactId>commons-configuration</artifactId>
+ <version>1.5</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.3</version>
+ </dependency>
+ <dependency>
+ <!-- not sure why maven does not figure this out by itself -->
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ <version>3.2.1</version>
+ </dependency>
<dependency>
<groupId>org.apache.juddi</groupId>
<artifactId>juddi-core</artifactId>
<version>${project.parent.version}</version>
<scope>provided</scope>
</dependency>
-
+ <dependency>
+ <groupId>org.apache.juddi</groupId>
+ <artifactId>uddi-tck-base</artifactId>
+ <version>${project.parent.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockejb</groupId>
+ <artifactId>mockejb</artifactId>
+ <version>0.6-beta2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>cglib</groupId>
+ <artifactId>cglib-nodep</artifactId>
+ <version>2.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ <version>10.4.2.0</version>
+ <scope>test</scope>
+ </dependency>
+
</dependencies>
+ <profiles>
+ <profile>
+ <id>hibernate</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ <property>
+ <name>persistence</name>
+ <value>hibernate</value>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate</artifactId>
+ <version>3.2.5.ga</version>
+ <exclusions>
+ <exclusion>
+ <groupId>cglib</groupId>
+ <artifactId>cglib</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-entitymanager</artifactId>
+ <version>3.3.1.ga</version>
+ <exclusions>
+ <exclusion>
+ <groupId>cglib</groupId>
+ <artifactId>cglib</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>cglib</groupId>
+ <artifactId>cglib-nodep</artifactId>
+ <version>2.1_3</version>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>openjpa</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ <property>
+ <name>persistence</name>
+ <value>openjpa</value>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.openjpa</groupId>
+ <artifactId>openjpa</artifactId>
+ <version>1.2.2</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>openjpa-maven-plugin</artifactId>
+ <version>1.0</version>
+ <executions>
+ <execution>
+ <id>enhancer</id>
+ <phase>process-classes</phase>
+ <configuration>
+ <classes>
+ ${project.build.outputDirectory}/org/apache/juddi/model/
+ </classes>
+ <toolProperties>
+ <property>
+ <name>addDefaultConstructor</name>
+ <value>true</value>
+ </property>
+ <property>
+ <name>enforcePropertyRestrictions</name>
+ <value>true</value>
+ </property>
+ </toolProperties>
+ </configuration>
+ <goals>
+ <goal>enhance</goal>
+ </goals>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.openjpa</groupId>
+ <artifactId>openjpa</artifactId>
+ <version>1.2.2</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
</project>
Added: webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/api/impl/API_010_PublisherTest.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/api/impl/API_010_PublisherTest.java?rev=953077&view=auto
==============================================================================
--- webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/api/impl/API_010_PublisherTest.java (added)
+++ webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/api/impl/API_010_PublisherTest.java Wed Jun 9 16:44:42 2010
@@ -0,0 +1,222 @@
+/*
+ * Copyright 2001-2009 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.api.impl;
+
+import static junit.framework.Assert.assertEquals;
+
+import java.rmi.RemoteException;
+import java.util.List;
+
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.juddi.Registry;
+import org.apache.juddi.api_v3.DeletePublisher;
+import org.apache.juddi.api_v3.GetPublisherDetail;
+import org.apache.juddi.api_v3.Publisher;
+import org.apache.juddi.api_v3.PublisherDetail;
+import org.apache.juddi.api_v3.SavePublisher;
+import org.apache.juddi.config.AppConfig;
+import org.apache.juddi.config.Property;
+import org.apache.juddi.jaxb.EntityCreator;
+import org.apache.juddi.v3.error.InvalidKeyPassedException;
+import org.apache.juddi.v3.tck.TckPublisher;
+import org.apache.juddi.v3.tck.TckSecurity;
+import org.apache.log4j.Logger;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.uddi.v3_service.DispositionReportFaultMessage;
+import org.uddi.v3_service.UDDISecurityPortType;
+
+/**
+ * This test is jUDDI specific, as the publisher methods are an extension
+ * to the UDDI api.
+ * @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>
+ * @author <a href="mailto:kstam@apache.org">Kurt T Stam</a>
+ */
+public class API_010_PublisherTest {
+
+ private static Logger logger = Logger.getLogger(API_010_PublisherTest.class);
+
+ private JUDDIApiImpl publisher = new JUDDIApiImpl();
+ private UDDISecurityPortType security = new UDDISecurityImpl();
+ private static String authInfo = null;
+
+ @BeforeClass
+ public static void startRegistry() throws ConfigurationException {
+ Registry.start();
+ }
+
+ @AfterClass
+ public static void stopRegistry() throws ConfigurationException {
+ Registry.stop();
+ }
+
+ @Test
+ public void testJoePublisher() {
+ //We can only test this if the publisher is not there already.
+ //If it already there is probably has foreign key relationships.
+ //This test should really only run on an empty database. Seed
+ //data will be added if the root publisher is missing.
+ if (!isExistPublisher(TckPublisher.JOE_PUBLISHER_ID)) {
+ saveJoePublisher();
+ deleteJoePublisher();
+ }
+ }
+
+ @Test
+ public void testSamSyndicator() {
+ //We can only test this if the publisher is not there already.
+ if (!isExistPublisher(TckPublisher.SAM_SYNDICATOR_ID)) {
+ saveSamSyndicator();
+ deleteSamSyndicator();
+ }
+ }
+ /**
+ * Persists Joe Publisher to the database.
+ * @return - true if the published did not exist already,
+ * - false in all other cases.
+ */
+ public boolean saveJoePublisher() {
+ if (!isExistPublisher(TckPublisher.JOE_PUBLISHER_ID)) {
+ savePublisher(TckPublisher.JOE_PUBLISHER_ID, TckPublisher.JOE_PUBLISHER_XML);
+ return true;
+ } else {
+ return false;
+ }
+ }
+ /**
+ * Removes Joe Publisher from the database, this will fail if there
+ * are child objects attached; think Services etc.
+ */
+ public void deleteJoePublisher() {
+ deletePublisher(TckPublisher.JOE_PUBLISHER_ID);
+ }
+ /**
+ * Persists Sam Syndicator to the database.
+ * @return publisherId
+ */
+ public String saveSamSyndicator() {
+ if (!isExistPublisher(TckPublisher.SAM_SYNDICATOR_ID)) {
+ savePublisher(TckPublisher.SAM_SYNDICATOR_ID, TckPublisher.SAM_SYNDICATOR_XML);
+ }
+ return TckPublisher.SAM_SYNDICATOR_ID;
+ }
+ /**
+ * Removes Sam Syndicator from the database, this will fail if there
+ * are child objects attached; think Services etc.
+ */
+ public void deleteSamSyndicator() {
+ deletePublisher(TckPublisher.SAM_SYNDICATOR_ID);
+ }
+
+
+ private void savePublisher(String publisherId, String publisherXML) {
+ try {
+ String rootPublisherStr = AppConfig.getConfiguration().getString(Property.JUDDI_ROOT_PUBLISHER);
+ authInfo = TckSecurity.getAuthToken(security, rootPublisherStr, "");
+ logger.debug("Saving new publisher: " + publisherXML);
+ SavePublisher sp = new SavePublisher();
+ sp.setAuthInfo(authInfo);
+ Publisher pubIn = (Publisher)EntityCreator.buildFromDoc(publisherXML, "org.apache.juddi.api_v3");
+ sp.getPublisher().add(pubIn);
+ publisher.savePublisher(sp);
+
+ // Now get the entity and check the values
+ GetPublisherDetail gp = new GetPublisherDetail();
+ gp.getPublisherId().add(publisherId);
+ gp.setAuthInfo(authInfo);
+ PublisherDetail pd = publisher.getPublisherDetail(gp);
+ List<Publisher> pubOutList = pd.getPublisher();
+ Publisher pubOut = pubOutList.get(0);
+
+ assertEquals(pubIn.getAuthorizedName(), pubOut.getAuthorizedName());
+ assertEquals(pubIn.getPublisherName(), pubOut.getPublisherName());
+ assertEquals(pubIn.getEmailAddress(), pubOut.getEmailAddress());
+ assertEquals(pubIn.getIsAdmin(), pubOut.getIsAdmin());
+ assertEquals(pubIn.getIsEnabled(), pubOut.getIsEnabled());
+ assertEquals(pubIn.getMaxBindingsPerService(), pubOut.getMaxBindingsPerService());
+ assertEquals(pubIn.getMaxBusinesses(), pubOut.getMaxBusinesses());
+ assertEquals(pubIn.getMaxServicePerBusiness(), pubOut.getMaxServicePerBusiness());
+ assertEquals(pubIn.getMaxTModels(), pubOut.getMaxTModels());
+
+ logger.debug("Querying for publisher: " + publisherXML);
+ //Querying for this publisher to make sure it's really gone
+ //We're expecting a invalid Key exception at this point.
+ PublisherDetail pdBeforeDelete =null;
+ try {
+ pdBeforeDelete = publisher.getPublisherDetail(gp);
+ Assert.assertNotNull(pdBeforeDelete);
+ } catch (InvalidKeyPassedException e) {
+ Assert.fail("We expected to find publisher " + publisherXML);
+ }
+
+ } catch(Exception e) {
+ logger.error(e.getMessage(), e);
+ Assert.fail("No exception should be thrown");
+ }
+ }
+
+ private void deletePublisher(String publisherId) {
+ try {
+ String rootPublisherStr = AppConfig.getConfiguration().getString(Property.JUDDI_ROOT_PUBLISHER);
+ authInfo = TckSecurity.getAuthToken(security, rootPublisherStr, "");
+ logger.debug("Delete publisher: " + publisherId);
+ //Now deleting this publisher
+ DeletePublisher dp = new DeletePublisher();
+ dp.setAuthInfo(authInfo);
+ dp.getPublisherId().add(publisherId);
+ publisher.deletePublisher(dp);
+
+ logger.info("Querying for publisher: " + publisherId + " after deletion.");
+ //Querying for this publisher to make sure it's really gone
+ //We're expecting a invalid Key exception at this point.
+ GetPublisherDetail gp = new GetPublisherDetail();
+ gp.getPublisherId().add(publisherId);
+ gp.setAuthInfo(authInfo);
+ PublisherDetail pdAfterDelete =null;
+ try {
+ pdAfterDelete = publisher.getPublisherDetail(gp);
+ Assert.fail("We did not expect to find this publisher anymore.");
+ } catch (InvalidKeyPassedException e) {
+ Assert.assertNull(pdAfterDelete);
+ }
+
+ } catch(Exception e) {
+ logger.error(e.getMessage(), e);
+ Assert.fail("No exception should be thrown");
+ }
+ }
+
+ private boolean isExistPublisher(String publisherId) {
+ GetPublisherDetail gp = new GetPublisherDetail();
+ gp.getPublisherId().add(publisherId);
+ try {
+ publisher.getPublisherDetail(gp);
+ return true;
+ } catch (Exception e) {
+ return false;
+ }
+ }
+
+ protected String authInfoJoe() throws RemoteException, DispositionReportFaultMessage {
+ return TckSecurity.getAuthToken(security, TckPublisher.JOE_PUBLISHER_ID, TckPublisher.JOE_PUBLISHER_CRED);
+ }
+
+ protected String authInfoSam() throws RemoteException, DispositionReportFaultMessage {
+ return TckSecurity.getAuthToken(security, TckPublisher.SAM_SYNDICATOR_ID, TckPublisher.SAM_SYNDICATOR_CRED);
+ }
+
+}
Added: webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/api/impl/API_020_TmodelTest.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/api/impl/API_020_TmodelTest.java?rev=953077&view=auto
==============================================================================
--- webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/api/impl/API_020_TmodelTest.java (added)
+++ webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/api/impl/API_020_TmodelTest.java Wed Jun 9 16:44:42 2010
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2001-2009 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.api.impl;
+
+import java.rmi.RemoteException;
+
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.juddi.Registry;
+import org.apache.juddi.v3.tck.TckPublisher;
+import org.apache.juddi.v3.tck.TckSecurity;
+import org.apache.juddi.v3.tck.TckTModel;
+import org.apache.log4j.Logger;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.uddi.v3_service.DispositionReportFaultMessage;
+import org.uddi.v3_service.UDDISecurityPortType;
+
+/**
+ * @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>
+ * @author <a href="mailto:kstam@apache.org">Kurt T Stam</a>
+ */
+public class API_020_TmodelTest {
+
+ private static TckTModel tckTModel = new TckTModel(new UDDIPublicationImpl(), new UDDIInquiryImpl());
+ private static Logger logger = Logger.getLogger(API_020_TmodelTest.class);
+ private static API_010_PublisherTest api010 = new API_010_PublisherTest();
+ private static String authInfoJoe = null;
+ private static String authInfoSam = null;
+
+ @BeforeClass
+ public static void setup() throws ConfigurationException, RemoteException {
+ Registry.start();
+ logger.debug("Getting auth tokens..");
+ try {
+ api010.saveJoePublisher();
+ api010.saveSamSyndicator();
+ UDDISecurityPortType security = new UDDISecurityImpl();
+ authInfoJoe = TckSecurity.getAuthToken(security, TckPublisher.JOE_PUBLISHER_ID, TckPublisher.JOE_PUBLISHER_CRED);
+ authInfoSam = TckSecurity.getAuthToken(security, TckPublisher.SAM_SYNDICATOR_ID, TckPublisher.SAM_SYNDICATOR_CRED);
+ } catch (DispositionReportFaultMessage e) {
+ logger.error(e.getMessage(), e);
+ Assert.fail("Could not obtain authInfo token.");
+ }
+ }
+
+ @AfterClass
+ public static void stopRegistry() throws ConfigurationException {
+ Registry.stop();
+ }
+
+ @Test
+ public void testJoePublisherTmodel() {
+ tckTModel.saveJoePublisherTmodel(authInfoJoe);
+ tckTModel.deleteJoePublisherTmodel(authInfoJoe);
+ }
+
+ @Test
+ public void testSamSyndicatorTmodelTest() {
+ tckTModel.saveSamSyndicatorTmodel(authInfoSam);
+ tckTModel.deleteSamSyndicatorTmodel(authInfoSam);
+ }
+
+}
Added: webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/api/impl/API_030_BusinessEntityTest.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/api/impl/API_030_BusinessEntityTest.java?rev=953077&view=auto
==============================================================================
--- webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/api/impl/API_030_BusinessEntityTest.java (added)
+++ webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/api/impl/API_030_BusinessEntityTest.java Wed Jun 9 16:44:42 2010
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2001-2009 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.api.impl;
+
+import java.rmi.RemoteException;
+
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.juddi.Registry;
+import org.apache.juddi.v3.tck.TckBusiness;
+import org.apache.juddi.v3.tck.TckPublisher;
+import org.apache.juddi.v3.tck.TckSecurity;
+import org.apache.juddi.v3.tck.TckTModel;
+import org.apache.log4j.Logger;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.uddi.v3_service.UDDISecurityPortType;
+
+/**
+ * @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>
+ * @author <a href="mailto:kstam@apache.org">Kurt T Stam</a>
+ */
+public class API_030_BusinessEntityTest {
+
+ private static Logger logger = Logger.getLogger(API_030_BusinessEntityTest.class);
+
+ private static API_010_PublisherTest api010 = new API_010_PublisherTest();
+ private static TckTModel tckTModel = new TckTModel(new UDDIPublicationImpl(), new UDDIInquiryImpl());
+ private static TckBusiness tckBusiness = new TckBusiness(new UDDIPublicationImpl(), new UDDIInquiryImpl());
+ private static String authInfoJoe = null;
+ private static String authInfoSam = null;
+
+ @BeforeClass
+ public static void setup() throws ConfigurationException {
+ Registry.start();
+ logger.debug("Getting auth token..");
+ try {
+ api010.saveJoePublisher();
+ api010.saveSamSyndicator();
+ UDDISecurityPortType security = new UDDISecurityImpl();
+ authInfoJoe = TckSecurity.getAuthToken(security, TckPublisher.JOE_PUBLISHER_ID, TckPublisher.JOE_PUBLISHER_CRED);
+ authInfoSam = TckSecurity.getAuthToken(security, TckPublisher.SAM_SYNDICATOR_ID, TckPublisher.SAM_SYNDICATOR_CRED);
+ } catch (RemoteException e) {
+ logger.error(e.getMessage(), e);
+ Assert.fail("Could not obtain authInfo token.");
+ }
+ }
+
+ @AfterClass
+ public static void stopRegistry() throws ConfigurationException {
+ Registry.stop();
+ }
+
+ @Test
+ public void testJoePublisherBusinessEntity() {
+ try {
+ tckTModel.saveJoePublisherTmodel(authInfoJoe);
+ tckBusiness.saveJoePublisherBusiness(authInfoJoe);
+ tckBusiness.deleteJoePublisherBusiness(authInfoJoe);
+ } finally {
+ tckTModel.deleteJoePublisherTmodel(authInfoJoe);
+ }
+ }
+
+ @Test
+ public void testSamSyndicatorBusiness() {
+ try {
+ tckTModel.saveSamSyndicatorTmodel(authInfoSam);
+ tckBusiness.saveSamSyndicatorBusiness(authInfoSam);
+ tckBusiness.deleteSamSyndicatorBusiness(authInfoSam);
+ } finally {
+ tckTModel.deleteSamSyndicatorTmodel(authInfoSam);
+ }
+ }
+
+
+}
Added: webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/api/impl/API_040_BusinessServiceTest.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/api/impl/API_040_BusinessServiceTest.java?rev=953077&view=auto
==============================================================================
--- webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/api/impl/API_040_BusinessServiceTest.java (added)
+++ webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/api/impl/API_040_BusinessServiceTest.java Wed Jun 9 16:44:42 2010
@@ -0,0 +1,139 @@
+/*
+ * Copyright 2001-2009 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.api.impl;
+
+import java.rmi.RemoteException;
+
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.juddi.Registry;
+import org.apache.juddi.v3.tck.TckBusiness;
+import org.apache.juddi.v3.tck.TckBusinessService;
+import org.apache.juddi.v3.tck.TckPublisher;
+import org.apache.juddi.v3.tck.TckSecurity;
+import org.apache.juddi.v3.tck.TckTModel;
+import org.apache.log4j.Logger;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.uddi.v3_service.UDDISecurityPortType;
+
+/**
+ * @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>
+ * @author <a href="mailto:kstam@apache.org">Kurt T Stam</a>
+ */
+public class API_040_BusinessServiceTest
+{
+
+ private static Logger logger = Logger.getLogger(API_040_BusinessServiceTest.class);
+
+ private static API_010_PublisherTest api010 = new API_010_PublisherTest();
+ private static TckTModel tckTModel = new TckTModel(new UDDIPublicationImpl(), new UDDIInquiryImpl());
+ private static TckBusiness tckBusiness = new TckBusiness(new UDDIPublicationImpl(), new UDDIInquiryImpl());
+ private static TckBusinessService tckBusinessService = new TckBusinessService(new UDDIPublicationImpl(), new UDDIInquiryImpl());
+
+ private static String authInfoJoe = null;
+ private static String authInfoSam = null;
+
+ @BeforeClass
+ public static void setup() throws ConfigurationException {
+ Registry.start();
+ logger.debug("Getting auth tokens..");
+ try {
+ api010.saveJoePublisher();
+ api010.saveSamSyndicator();
+ UDDISecurityPortType security = new UDDISecurityImpl();
+ authInfoJoe = TckSecurity.getAuthToken(security, TckPublisher.JOE_PUBLISHER_ID, TckPublisher.JOE_PUBLISHER_CRED);
+ authInfoSam = TckSecurity.getAuthToken(security, TckPublisher.SAM_SYNDICATOR_ID, TckPublisher.SAM_SYNDICATOR_CRED);
+ } catch (RemoteException e) {
+ logger.error(e.getMessage(), e);
+ Assert.fail("Could not obtain authInfo token.");
+ }
+ }
+
+ @AfterClass
+ public static void stopRegistry() throws ConfigurationException {
+ Registry.stop();
+ }
+
+ @Test
+ public void joepublisher() {
+ try {
+ tckTModel.saveJoePublisherTmodel(authInfoJoe);
+ tckBusiness.saveJoePublisherBusiness(authInfoJoe);
+ tckBusinessService.saveJoePublisherService(authInfoJoe);
+ tckBusinessService.deleteJoePublisherService(authInfoJoe);
+ } finally {
+ tckBusiness.deleteJoePublisherBusiness(authInfoJoe);
+ tckTModel.deleteJoePublisherTmodel(authInfoJoe);
+ }
+ }
+
+ @Test
+ public void joepublisher2Services() {
+ try {
+ tckTModel.saveJoePublisherTmodel(authInfoJoe);
+ tckBusiness.saveJoePublisherBusiness(authInfoJoe);
+ tckBusinessService.saveJoePublisherService(authInfoJoe);
+ tckBusinessService.saveJoePublisherService2(authInfoJoe);
+ tckBusinessService.deleteJoePublisherService(authInfoJoe);
+ tckBusinessService.deleteJoePublisherService2(authInfoJoe);
+ } finally {
+ tckBusiness.deleteJoePublisherBusiness(authInfoJoe);
+ tckTModel.deleteJoePublisherTmodel(authInfoJoe);
+ }
+ }
+
+ @Test
+ public void joepublisher2UpdateBusiness() {
+ try {
+ tckTModel.saveJoePublisherTmodel(authInfoJoe);
+ tckBusiness.saveJoePublisherBusiness(authInfoJoe);
+ tckBusinessService.saveJoePublisherService(authInfoJoe);
+ tckBusinessService.saveJoePublisherService2(authInfoJoe);
+ tckBusiness.updateJoePublisherBusiness(authInfoJoe);
+ tckBusinessService.deleteJoePublisherService(authInfoJoe);
+ tckBusinessService.deleteJoePublisherService2(authInfoJoe);
+ } finally {
+ tckBusiness.deleteJoePublisherBusiness(authInfoJoe);
+ tckTModel.deleteJoePublisherTmodel(authInfoJoe);
+ }
+ }
+
+ @Test
+ public void samsyndicator() {
+ try {
+ // For sam's service projection, joe's information must be loaded
+ tckTModel.saveJoePublisherTmodel(authInfoJoe);
+ tckBusiness.saveJoePublisherBusiness(authInfoJoe);
+ tckBusinessService.saveJoePublisherService(authInfoJoe);
+
+ tckTModel.saveSamSyndicatorTmodel(authInfoSam);
+ tckBusiness.saveSamSyndicatorBusinessWithProjection(authInfoSam);
+ tckBusinessService.saveSamSyndicatorService(authInfoSam);
+ tckBusinessService.deleteSamSyndicatorService(authInfoSam);
+ } finally {
+ tckBusiness.deleteSamSyndicatorBusiness(authInfoSam);
+ tckTModel.deleteSamSyndicatorTmodel(authInfoSam);
+
+ tckBusinessService.deleteJoePublisherService(authInfoJoe);
+ tckBusiness.deleteJoePublisherBusiness(authInfoJoe);
+ tckTModel.deleteJoePublisherTmodel(authInfoJoe);
+ }
+ }
+
+
+
+}
Added: webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/api/impl/API_050_BindingTemplateTest.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/api/impl/API_050_BindingTemplateTest.java?rev=953077&view=auto
==============================================================================
--- webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/api/impl/API_050_BindingTemplateTest.java (added)
+++ webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/api/impl/API_050_BindingTemplateTest.java Wed Jun 9 16:44:42 2010
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2001-2009 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.api.impl;
+
+import java.rmi.RemoteException;
+
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.juddi.Registry;
+import org.apache.juddi.v3.tck.TckBindingTemplate;
+import org.apache.juddi.v3.tck.TckBusiness;
+import org.apache.juddi.v3.tck.TckBusinessService;
+import org.apache.juddi.v3.tck.TckPublisher;
+import org.apache.juddi.v3.tck.TckSecurity;
+import org.apache.juddi.v3.tck.TckTModel;
+import org.apache.log4j.Logger;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>
+ * @author <a href="mailto:kstam@apache.org">Kurt T Stam</a>
+ */
+public class API_050_BindingTemplateTest
+{
+
+ private static Logger logger = Logger.getLogger(API_050_BindingTemplateTest.class);
+
+ private static API_010_PublisherTest api010 = new API_010_PublisherTest();
+ private static TckTModel tckTModel = new TckTModel(new UDDIPublicationImpl(), new UDDIInquiryImpl());
+ private static TckBusiness tckBusiness = new TckBusiness(new UDDIPublicationImpl(), new UDDIInquiryImpl());
+ private static TckBusinessService tckBusinessService = new TckBusinessService(new UDDIPublicationImpl(), new UDDIInquiryImpl());
+ private static TckBindingTemplate tckBindingTemplate = new TckBindingTemplate(new UDDIPublicationImpl(), new UDDIInquiryImpl());
+
+
+ private static String authInfoJoe = null;
+
+ @BeforeClass
+ public static void setup() throws ConfigurationException {
+ Registry.start();
+ logger.debug("Getting auth token..");
+ try {
+ api010.saveJoePublisher();
+ authInfoJoe = TckSecurity.getAuthToken(new UDDISecurityImpl(), TckPublisher.JOE_PUBLISHER_ID, TckPublisher.JOE_PUBLISHER_CRED);
+ } catch (RemoteException e) {
+ logger.error(e.getMessage(), e);
+ Assert.fail("Could not obtain authInfo token.");
+ }
+ }
+
+ @AfterClass
+ public static void stopRegistry() throws ConfigurationException {
+ Registry.stop();
+ }
+
+ @Test
+ public void joepublisher() {
+ try {
+ tckTModel.saveJoePublisherTmodel(authInfoJoe);
+ tckBusiness.saveJoePublisherBusiness(authInfoJoe);
+ tckBusinessService.saveJoePublisherService(authInfoJoe);
+ tckBindingTemplate.saveJoePublisherBinding(authInfoJoe);
+ tckBindingTemplate.deleteJoePublisherBinding(authInfoJoe);
+ } finally {
+ tckBusinessService.deleteJoePublisherService(authInfoJoe);
+ tckBusiness.deleteJoePublisherBusiness(authInfoJoe);
+ tckTModel.deleteJoePublisherTmodel(authInfoJoe);
+ }
+ }
+}
Added: webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/api/impl/API_060_PublisherAssertionTest.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/api/impl/API_060_PublisherAssertionTest.java?rev=953077&view=auto
==============================================================================
--- webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/api/impl/API_060_PublisherAssertionTest.java (added)
+++ webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/api/impl/API_060_PublisherAssertionTest.java Wed Jun 9 16:44:42 2010
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2001-2009 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.api.impl;
+
+/**
+ * @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>
+ * @author <a href="mailto:kstam@apache.org">Kurt T Stam</a>
+ */
+import java.rmi.RemoteException;
+
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.juddi.Registry;
+import org.apache.juddi.v3.tck.TckBusiness;
+import org.apache.juddi.v3.tck.TckPublisher;
+import org.apache.juddi.v3.tck.TckPublisherAssertion;
+import org.apache.juddi.v3.tck.TckSecurity;
+import org.apache.juddi.v3.tck.TckTModel;
+import org.apache.log4j.Logger;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.uddi.v3_service.UDDISecurityPortType;
+
+public class API_060_PublisherAssertionTest {
+
+ private static Logger logger = Logger.getLogger(API_060_PublisherAssertionTest.class);
+
+ private static API_010_PublisherTest api010 = new API_010_PublisherTest();
+ private static TckTModel tckTModel = new TckTModel(new UDDIPublicationImpl(), new UDDIInquiryImpl());
+ private static TckBusiness tckBusiness = new TckBusiness(new UDDIPublicationImpl(), new UDDIInquiryImpl());
+ private static TckPublisherAssertion tckAssertion = new TckPublisherAssertion(new UDDIPublicationImpl());
+ private static String authInfoJoe = null;
+ private static String authInfoSam = null;
+
+ @BeforeClass
+ public static void setup() throws ConfigurationException {
+ Registry.start();
+ logger.debug("Getting auth token..");
+ try {
+ api010.saveJoePublisher();
+ api010.saveSamSyndicator();
+ UDDISecurityPortType security = new UDDISecurityImpl();
+ authInfoJoe = TckSecurity.getAuthToken(security, TckPublisher.JOE_PUBLISHER_ID, TckPublisher.JOE_PUBLISHER_CRED);
+ authInfoSam = TckSecurity.getAuthToken(security, TckPublisher.SAM_SYNDICATOR_ID, TckPublisher.SAM_SYNDICATOR_CRED);
+ } catch (RemoteException e) {
+ logger.error(e.getMessage(), e);
+ Assert.fail("Could not obtain authInfo token.");
+ }
+ }
+
+ @AfterClass
+ public static void stopRegistry() throws ConfigurationException {
+ Registry.stop();
+ }
+
+ @Test
+ public void testJoepublisherToSamSyndicator() {
+ try {
+ tckTModel.saveJoePublisherTmodel(authInfoJoe);
+ tckTModel.saveSamSyndicatorTmodel(authInfoSam);
+ tckBusiness.saveJoePublisherBusiness(authInfoJoe);
+ tckBusiness.saveSamSyndicatorBusiness(authInfoSam);
+ tckAssertion.saveJoePublisherPublisherAssertion(authInfoJoe);
+ tckAssertion.deleteJoePublisherPublisherAssertion(authInfoJoe);
+ } finally {
+ tckBusiness.deleteJoePublisherBusiness(authInfoJoe);
+ tckBusiness.deleteSamSyndicatorBusiness(authInfoSam);
+ tckTModel.deleteJoePublisherTmodel(authInfoJoe);
+ tckTModel.deleteSamSyndicatorTmodel(authInfoSam);
+ }
+ }
+}
Added: webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/api/impl/API_070_FindEntityTest.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/api/impl/API_070_FindEntityTest.java?rev=953077&view=auto
==============================================================================
--- webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/api/impl/API_070_FindEntityTest.java (added)
+++ webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/api/impl/API_070_FindEntityTest.java Wed Jun 9 16:44:42 2010
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2001-2009 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.api.impl;
+
+import java.rmi.RemoteException;
+
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.juddi.Registry;
+import org.apache.juddi.v3.tck.TckBindingTemplate;
+import org.apache.juddi.v3.tck.TckBusiness;
+import org.apache.juddi.v3.tck.TckBusinessService;
+import org.apache.juddi.v3.tck.TckFindEntity;
+import org.apache.juddi.v3.tck.TckPublisher;
+import org.apache.juddi.v3.tck.TckSecurity;
+import org.apache.juddi.v3.tck.TckTModel;
+import org.apache.log4j.Logger;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>
+ * @author <a href="mailto:kstam@apache.org">Kurt T Stam</a>
+ */
+public class API_070_FindEntityTest
+{
+
+ private static Logger logger = Logger.getLogger(API_070_FindEntityTest.class);
+
+ private static API_010_PublisherTest api010 = new API_010_PublisherTest();
+ private static TckTModel tckTModel = new TckTModel(new UDDIPublicationImpl(), new UDDIInquiryImpl());
+ private static TckBusiness tckBusiness = new TckBusiness(new UDDIPublicationImpl(), new UDDIInquiryImpl());
+ private static TckBusinessService tckBusinessService = new TckBusinessService(new UDDIPublicationImpl(), new UDDIInquiryImpl());
+ private static TckBindingTemplate tckBindingTemplate = new TckBindingTemplate(new UDDIPublicationImpl(), new UDDIInquiryImpl());
+ private static TckFindEntity tckFindEntity = new TckFindEntity(new UDDIInquiryImpl());
+
+ private static String authInfoJoe = null;
+
+ @BeforeClass
+ public static void setup() throws ConfigurationException {
+ Registry.start();
+ logger.debug("Getting auth token..");
+ try {
+ api010.saveJoePublisher();
+ authInfoJoe = TckSecurity.getAuthToken(new UDDISecurityImpl(), TckPublisher.JOE_PUBLISHER_ID, TckPublisher.JOE_PUBLISHER_CRED);
+ } catch (RemoteException e) {
+ logger.error(e.getMessage(), e);
+ Assert.fail("Could not obtain authInfo token.");
+ }
+ }
+
+ @AfterClass
+ public static void stopRegistry() throws ConfigurationException {
+ Registry.stop();
+ }
+
+ @Test
+ public void findEntities() {
+ try {
+ tckTModel.saveJoePublisherTmodel(authInfoJoe);
+ tckBusiness.saveJoePublisherBusiness(authInfoJoe);
+ tckBusinessService.saveJoePublisherService(authInfoJoe);
+ tckBindingTemplate.saveJoePublisherBinding(authInfoJoe);
+ tckFindEntity.findBusiness();
+ tckFindEntity.findService();
+ tckFindEntity.findBinding();
+ tckFindEntity.findTModel();
+ tckFindEntity.findAllBusiness();
+ tckFindEntity.getNonExitingBusiness();
+ } finally {
+ tckBindingTemplate.deleteJoePublisherBinding(authInfoJoe);
+ tckBusinessService.deleteJoePublisherService(authInfoJoe);
+ tckBusiness.deleteJoePublisherBusiness(authInfoJoe);
+ tckTModel.deleteJoePublisherTmodel(authInfoJoe);
+ }
+
+ }
+
+
+
+}
Added: webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/api/impl/API_080_SubscriptionTest.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/api/impl/API_080_SubscriptionTest.java?rev=953077&view=auto
==============================================================================
--- webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/api/impl/API_080_SubscriptionTest.java (added)
+++ webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/api/impl/API_080_SubscriptionTest.java Wed Jun 9 16:44:42 2010
@@ -0,0 +1,154 @@
+/*
+ * Copyright 2001-2009 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.api.impl;
+
+import java.rmi.RemoteException;
+
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.juddi.Registry;
+import org.apache.juddi.v3.tck.TckBindingTemplate;
+import org.apache.juddi.v3.tck.TckBusiness;
+import org.apache.juddi.v3.tck.TckBusinessService;
+import org.apache.juddi.v3.tck.TckPublisher;
+import org.apache.juddi.v3.tck.TckSecurity;
+import org.apache.juddi.v3.tck.TckSubscription;
+import org.apache.juddi.v3.tck.TckTModel;
+import org.apache.log4j.Logger;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>
+ * @author <a href="mailto:kstam@apache.org">Kurt T Stam</a>
+ */
+public class API_080_SubscriptionTest
+{
+ private static Logger logger = Logger.getLogger(API_080_SubscriptionTest.class);
+
+ private static API_010_PublisherTest api010 = new API_010_PublisherTest();
+ private static TckTModel tckTModel = new TckTModel(new UDDIPublicationImpl(), new UDDIInquiryImpl());
+ private static TckBusiness tckBusiness = new TckBusiness(new UDDIPublicationImpl(), new UDDIInquiryImpl());
+ private static TckBusinessService tckBusinessService = new TckBusinessService(new UDDIPublicationImpl(), new UDDIInquiryImpl());
+ private static TckBindingTemplate tckBindingTemplate = new TckBindingTemplate(new UDDIPublicationImpl(), new UDDIInquiryImpl());
+ private static TckSubscription tckSubscription = new TckSubscription(new UDDISubscriptionImpl(), new UDDISecurityImpl());
+
+ private static String authInfoJoe = null;
+ private static String authInfoSam = null;
+
+ @BeforeClass
+ public static void setup() throws ConfigurationException {
+ Registry.start();
+ logger.debug("Getting auth token..");
+ try {
+ api010.saveJoePublisher();
+ authInfoJoe = TckSecurity.getAuthToken(new UDDISecurityImpl(), TckPublisher.JOE_PUBLISHER_ID, TckPublisher.JOE_PUBLISHER_CRED);
+
+ api010.saveSamSyndicator();
+ authInfoSam = TckSecurity.getAuthToken(new UDDISecurityImpl(), TckPublisher.SAM_SYNDICATOR_ID, TckPublisher.SAM_SYNDICATOR_CRED);
+
+ } catch (RemoteException e) {
+ logger.error(e.getMessage(), e);
+ Assert.fail("Could not obtain authInfo token.");
+ }
+ }
+
+ @AfterClass
+ public static void stopRegistry() throws ConfigurationException {
+ Registry.stop();
+ }
+
+ @Test
+ public void joePublisher() {
+ try {
+ tckTModel.saveJoePublisherTmodel(authInfoJoe);
+ tckBusiness.saveJoePublisherBusiness(authInfoJoe);
+ tckBusinessService.saveJoePublisherService(authInfoJoe);
+ tckBindingTemplate.saveJoePublisherBinding(authInfoJoe);
+ tckSubscription.saveJoePublisherSubscription(authInfoJoe);
+ tckSubscription.getJoePublisherSubscriptionResults(authInfoJoe);
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail();
+ } catch (Throwable t) {
+ t.printStackTrace();
+ Assert.fail();
+ }
+ finally {
+ tckSubscription.deleteJoePublisherSubscription(authInfoJoe);
+ tckBindingTemplate.deleteJoePublisherBinding(authInfoJoe);
+ tckBusinessService.deleteJoePublisherService(authInfoJoe);
+ tckBusiness.deleteJoePublisherBusiness(authInfoJoe);
+ tckTModel.deleteJoePublisherTmodel(authInfoJoe);
+ }
+
+ }
+
+ @Test
+ public void samSyndicator() {
+ try {
+ tckTModel.saveSamSyndicatorTmodel(authInfoSam);
+ tckBusiness.saveSamSyndicatorBusiness(authInfoSam);
+ tckBusinessService.saveSamSyndicatorService(authInfoSam);
+ tckSubscription.saveSamSyndicatorSubscription(authInfoSam);
+ tckSubscription.getSamSyndicatorSubscriptionResults(authInfoSam);
+ }
+ finally {
+ tckSubscription.deleteSamSyndicatorSubscription(authInfoSam);
+ tckBusinessService.deleteSamSyndicatorService(authInfoSam);
+ tckBusiness.deleteSamSyndicatorBusiness(authInfoSam);
+ tckTModel.deleteSamSyndicatorTmodel(authInfoSam);
+ }
+
+ }
+
+ @Test
+ public void samSyndicatorWithChunkingOnFind() {
+ try {
+ tckTModel.saveSamSyndicatorTmodel(authInfoSam);
+ tckBusiness.saveSamSyndicatorBusiness(authInfoSam);
+ tckBusinessService.saveSamSyndicatorService(authInfoSam);
+ tckSubscription.saveSamSyndicatorSubscriptionWithChunkingOnFind(authInfoSam);
+ tckSubscription.getSamSyndicatorSubscriptionResultsWithChunkingOnFind(authInfoSam);
+ }
+ finally {
+ tckSubscription.deleteSamSyndicatorSubscriptionWithChunkingOnFind(authInfoSam);
+ tckBusinessService.deleteSamSyndicatorService(authInfoSam);
+ tckBusiness.deleteSamSyndicatorBusiness(authInfoSam);
+ tckTModel.deleteSamSyndicatorTmodel(authInfoSam);
+ }
+
+ }
+
+ @Test
+ public void samSyndicatorWithChunkingOnGet() {
+ try {
+ tckTModel.saveSamSyndicatorTmodel(authInfoSam);
+ tckBusiness.saveSamSyndicatorBusiness(authInfoSam);
+ tckBusinessService.saveSamSyndicatorService(authInfoSam);
+ tckSubscription.saveSamSyndicatorSubscriptionWithChunkingOnGet(authInfoSam);
+ tckSubscription.getSamSyndicatorSubscriptionResultsWithChunkingOnGet(authInfoSam);
+ }
+ finally {
+ tckSubscription.deleteSamSyndicatorSubscriptionWithChunkingOnGet(authInfoSam);
+ tckBusinessService.deleteSamSyndicatorService(authInfoSam);
+ tckBusiness.deleteSamSyndicatorBusiness(authInfoSam);
+ tckTModel.deleteSamSyndicatorTmodel(authInfoSam);
+ }
+
+ }
+
+}
Added: webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/api/impl/API_100_ClientSubscriptionInfoTest.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/api/impl/API_100_ClientSubscriptionInfoTest.java?rev=953077&view=auto
==============================================================================
--- webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/api/impl/API_100_ClientSubscriptionInfoTest.java (added)
+++ webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/api/impl/API_100_ClientSubscriptionInfoTest.java Wed Jun 9 16:44:42 2010
@@ -0,0 +1,166 @@
+/*
+ * Copyright 2001-2009 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.api.impl;
+
+import java.rmi.RemoteException;
+
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.juddi.Registry;
+import org.apache.juddi.api_v3.Clerk;
+import org.apache.juddi.api_v3.ClerkDetail;
+import org.apache.juddi.api_v3.ClientSubscriptionInfo;
+import org.apache.juddi.api_v3.ClientSubscriptionInfoDetail;
+import org.apache.juddi.api_v3.DeleteClientSubscriptionInfo;
+import org.apache.juddi.api_v3.GetClientSubscriptionInfoDetail;
+import org.apache.juddi.api_v3.Node;
+import org.apache.juddi.api_v3.NodeDetail;
+import org.apache.juddi.api_v3.SaveClerk;
+import org.apache.juddi.api_v3.SaveClientSubscriptionInfo;
+import org.apache.juddi.api_v3.SaveNode;
+import org.apache.juddi.v3.error.InvalidKeyPassedException;
+import org.apache.juddi.v3.tck.TckPublisher;
+import org.apache.juddi.v3.tck.TckSecurity;
+import org.apache.log4j.Logger;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.uddi.v3_service.DispositionReportFaultMessage;
+import org.uddi.v3_service.UDDISecurityPortType;
+
+/**
+ * @author <a href="mailto:kstam@apache.org">Kurt T Stam</a>
+ */
+public class API_100_ClientSubscriptionInfoTest {
+
+ private JUDDIApiImpl publisher = new JUDDIApiImpl();
+ private static Logger logger = Logger.getLogger(API_100_ClientSubscriptionInfoTest.class);
+ private static API_010_PublisherTest api010 = new API_010_PublisherTest();
+ private static String authInfoJoe = null;
+
+ @BeforeClass
+ public static void setup() throws ConfigurationException, RemoteException {
+ Registry.start();
+ logger.debug("Getting auth tokens..");
+ try {
+ api010.saveJoePublisher();
+ UDDISecurityPortType security = new UDDISecurityImpl();
+ authInfoJoe = TckSecurity.getAuthToken(security, TckPublisher.JOE_PUBLISHER_ID, TckPublisher.JOE_PUBLISHER_CRED);
+ } catch (DispositionReportFaultMessage e) {
+ logger.error(e.getMessage(), e);
+ Assert.fail("Could not obtain authInfo token.");
+ }
+ }
+
+ @AfterClass
+ public static void stopRegistry() throws ConfigurationException {
+ Registry.stop();
+ }
+
+ @Test
+ public void addClientSubscriptionInfo() {
+ ClientSubscriptionInfo clientSubscriptionInfo = new ClientSubscriptionInfo();
+
+ Node node = new Node();
+ node.setSecurityUrl("http://localhost:8080/services/securityUrl");
+ node.setCustodyTransferUrl("http://localhost:8080/services/securityUrl");
+ node.setDescription("description");
+ node.setInquiryUrl("http://localhost:8080/services/securityUrl");
+ node.setPublishUrl("http://localhost:8080/services/securityUrl");
+ node.setProxyTransport("class");
+ node.setSubscriptionUrl("http://localhost:8080/services/securityUrl");
+ node.setName("default");
+ node.setManagerName("defaultManager");
+ SaveNode saveNode = new SaveNode();
+ saveNode.setAuthInfo(authInfoJoe);
+ saveNode.getNode().add(node);
+
+ Clerk clerk = new Clerk();
+ clerk.setName("clerkName");
+ clerk.setPublisher("root");
+ clerk.setNode(node);
+ SaveClerk saveClerk = new SaveClerk();
+ saveClerk.setAuthInfo(authInfoJoe);
+ saveClerk.getClerk().add(clerk);
+
+ clientSubscriptionInfo.setFromClerk(clerk);
+
+ Node node2 = new Node();
+ node2.setSecurityUrl("http://localhost:8080/services/securityUrl2");
+ node2.setCustodyTransferUrl("https://localhost:8080/services/securityUrl2");
+ node2.setDescription("description2");
+ node2.setInquiryUrl("http://localhost:8080/services/securityUrl2");
+ node2.setPublishUrl("http://localhost:8080/services/securityUrl2");
+ node2.setProxyTransport("class2");
+ node2.setSubscriptionUrl("http://localhost:8080/services/securityUrl2");
+ node2.setName("default2");
+ node2.setManagerName("default2Manager");
+ saveNode.getNode().add(node2);
+
+ Clerk clerk2 = new Clerk();
+ clerk2.setName("clerkName2");
+ clerk2.setPublisher("root");
+ clerk2.setNode(node2);
+ saveClerk.getClerk().add(clerk2);
+
+ clientSubscriptionInfo.setFromClerk(clerk);
+
+ clientSubscriptionInfo.setSubscriptionKey("mykey");
+
+ SaveClientSubscriptionInfo saveClientSubscriptionInfo = new SaveClientSubscriptionInfo();
+ saveClientSubscriptionInfo.setAuthInfo(authInfoJoe);
+ saveClientSubscriptionInfo.getClientSubscriptionInfo().add(clientSubscriptionInfo);
+
+ ClientSubscriptionInfo clientSubscriptionInfo2 = new ClientSubscriptionInfo();
+ clientSubscriptionInfo2.setSubscriptionKey("mykey2");
+ clientSubscriptionInfo2.setFromClerk(clerk2);
+ saveClientSubscriptionInfo.getClientSubscriptionInfo().add(clientSubscriptionInfo2);
+
+ try {
+
+ NodeDetail nodeDetail = publisher.saveNode(saveNode);
+ ClerkDetail clerkDetail = publisher.saveClerk(saveClerk);
+ Assert.assertEquals(2,nodeDetail.getNode().size());
+ Assert.assertEquals(2,clerkDetail.getClerk().size());
+
+ ClientSubscriptionInfoDetail detail = publisher.saveClientSubscriptionInfo(saveClientSubscriptionInfo);
+ Assert.assertEquals("mykey", detail.getClientSubscriptionInfo().get(0).getSubscriptionKey());
+
+ GetClientSubscriptionInfoDetail getDetail = new GetClientSubscriptionInfoDetail();
+ getDetail.setAuthInfo(authInfoJoe);
+ getDetail.getClientSubscriptionKey().add("mykey");
+
+ ClientSubscriptionInfoDetail detail2 = publisher.getClientSubscriptionInfoDetail(getDetail);
+ Assert.assertEquals("mykey", detail2.getClientSubscriptionInfo().get(0).getSubscriptionKey());
+
+ DeleteClientSubscriptionInfo deleteInfo = new DeleteClientSubscriptionInfo();
+ deleteInfo.setAuthInfo(authInfoJoe);
+ deleteInfo.getSubscriptionKey().add("mykey");
+ publisher.deleteClientSubscriptionInfo(deleteInfo);
+
+ try {
+ @SuppressWarnings("unused")
+ ClientSubscriptionInfoDetail detail3 = publisher.getClientSubscriptionInfoDetail(getDetail);
+ Assert.fail("We're expecting an InvalidKeyPassedException");
+ } catch (Exception e) {
+ Assert.assertEquals(InvalidKeyPassedException.class, e.getClass());
+ }
+ } catch(Exception e) {
+ logger.error(e.getMessage(), e);
+ Assert.fail("No exception should be thrown");
+ }
+ }
+
+}
Added: webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/api/impl/package.html
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/api/impl/package.html?rev=953077&view=auto
==============================================================================
--- webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/api/impl/package.html (added)
+++ webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/api/impl/package.html Wed Jun 9 16:44:42 2010
@@ -0,0 +1,16 @@
+<html>
+<body>
+<p>Unit tests to test the api implementation. Theses tests go all the way down into
+the persistence layer. By default they are using an embedded Java-based database
+called Derby. </p>
+
+<p>The order in which the tests are run is irrelevant however some tests are more basic
+then others. For example, you will need to have a Publisher, before you can persist
+a Business, and you need to have a Business before you can persist a Service. So it
+makes sense to test persisting a Publisher first.</p>
+
+<p>By default JUnit executes tests in alphabetical order, so to control test execution order we
+use the JUDDI_###_ prefix.
+</p>
+</body>
+</html>
\ No newline at end of file
Added: webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/auth/AuthenticatorTest.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/auth/AuthenticatorTest.java?rev=953077&view=auto
==============================================================================
--- webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/auth/AuthenticatorTest.java (added)
+++ webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/auth/AuthenticatorTest.java Wed Jun 9 16:44:42 2010
@@ -0,0 +1,174 @@
+/*
+ * Copyright 2001-2009 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.auth;
+
+import java.io.IOException;
+import java.io.StringWriter;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+
+import org.apache.juddi.api.impl.API_010_PublisherTest;
+import org.apache.juddi.cryptor.Cryptor;
+import org.apache.juddi.cryptor.CryptorFactory;
+import org.apache.juddi.v3.auth.Authenticator;
+import org.apache.juddi.v3.auth.CryptedXMLDocAuthenticator;
+import org.apache.juddi.v3.auth.JUDDIAuthenticator;
+import org.apache.juddi.v3.auth.JuddiUsers;
+import org.apache.juddi.v3.auth.User;
+import org.apache.juddi.v3.auth.XMLDocAuthenticator;
+import org.apache.juddi.v3.error.AuthenticationException;
+import org.apache.juddi.v3.error.FatalErrorException;
+import org.apache.juddi.v3.error.UnknownUserException;
+import org.apache.log4j.Logger;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * @author <a href="mailto:kstam@apache.org">Kurt T Stam</a>
+ */
+public class AuthenticatorTest
+{
+ private Logger logger = Logger.getLogger(this.getClass());
+ /**
+ * The DefaultAuthenticator is basically a pass-through.
+ * @throws ConfigurationException
+ */
+ @Test
+ public void testDefaultAuthenticator()
+ {
+ Authenticator auth = new JUDDIAuthenticator();
+ try {
+ API_010_PublisherTest api010 = new API_010_PublisherTest();
+ api010.saveJoePublisher();
+ api010.saveSamSyndicator();
+
+ auth.authenticate("joepublisher","password");
+ auth.authenticate("ssyndicator","badpass");
+
+ } catch (Exception e) {
+ logger.error(e.getMessage(),e);
+ Assert.fail("unexpected");
+ }
+ }
+ @Test
+ public void testCreateJuddiUsers() throws Exception
+ {
+ try {
+ JuddiUsers juddiUsers = new JuddiUsers();
+ juddiUsers.getUser().add(new User("anou_mana","password"));
+ juddiUsers.getUser().add(new User("bozo","clown"));
+ juddiUsers.getUser().add(new User("sviens","password"));
+
+ StringWriter writer = new StringWriter();
+ JAXBContext context = JAXBContext.newInstance(juddiUsers.getClass());
+ Marshaller marshaller = context.createMarshaller();
+ marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
+ marshaller.marshal(juddiUsers, writer);
+ logger.info("\n" + writer.toString());
+ } catch (Exception e) {
+ logger.error(e.getMessage(),e);
+ Assert.fail("unexpected");
+ }
+ }
+ /**
+ * The credentials will be read from the juddi-users.xml in the test/resources directory
+ * of this module. We're expecting the following authentication requests to succeed.
+ */
+ @Test
+ public void testXMLDocAuthenticator()
+ {
+ try {
+ Authenticator auth = new XMLDocAuthenticator();
+ auth.authenticate("anou_mana","password");
+ auth.authenticate("bozo","clown");
+ auth.authenticate("sviens","password");
+ } catch (Exception e) {
+ logger.error(e.getMessage(),e);
+ Assert.fail("unexpected");
+ }
+ }
+ /**
+ * The credentials will be read from the juddi-users.xml in the test/resources directory
+ * of this module. We're expecting the following authentication request to fail due
+ * to a bad password.
+ *
+ * @throws AuthenticationException
+ * @throws FatalErrorException
+ * @throws IOException
+ * @throws JAXBException
+ */
+ @Test(expected=UnknownUserException.class)
+ public void testBadXMLDocAuthenticator() throws Exception
+ {
+ Authenticator auth = new XMLDocAuthenticator();
+ auth.authenticate("anou_mana","badpass");
+ }
+ @Test
+ public void testCreateJuddiUsersEncrypted() throws Exception
+ {
+ try {
+ Cryptor cryptor = (Cryptor) CryptorFactory.getCryptor();
+ JuddiUsers juddiUsers = new JuddiUsers();
+ juddiUsers.getUser().add(new User("anou_mana",cryptor.encrypt("password")));
+ juddiUsers.getUser().add(new User("bozo",cryptor.encrypt("clown")));
+ juddiUsers.getUser().add(new User("sviens",cryptor.encrypt("password")));
+
+ StringWriter writer = new StringWriter();
+ JAXBContext context = JAXBContext.newInstance(juddiUsers.getClass());
+ Marshaller marshaller = context.createMarshaller();
+ marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
+ marshaller.marshal(juddiUsers, writer);
+ logger.info("\n" + writer.toString());
+ } catch (Exception e) {
+ logger.error(e.getMessage(),e);
+ Assert.fail("unexpected");
+ }
+ }
+ /**
+ * The credentials will be read from the juddi-users.xml in the test/resources directory
+ * of this module. We're expecting the following authentication requests to succeed.
+ */
+ @Test
+ public void testCryptedXMLDocAuthenticator()
+ {
+ try {
+ Authenticator auth = new CryptedXMLDocAuthenticator();
+ auth.authenticate("anou_mana","password");
+ auth.authenticate("bozo","clown");
+ auth.authenticate("sviens","password");
+ } catch (Exception e) {
+ logger.error(e.getMessage(),e);
+ Assert.fail("unexpected");
+ }
+ }
+ /**
+ * The credentials will be read from the juddi-users-encrypted.xml in the test/resources directory
+ * of this module. We're expecting the following authentication request to fail due
+ * to a bad password.
+ *
+ * @throws AuthenticationException
+ * @throws FatalErrorException
+ * @throws IOException
+ * @throws JAXBException
+ */
+ @Test(expected=UnknownUserException.class)
+ public void testBadCryptedXMLDocAuthenticator() throws Exception
+ {
+ Authenticator auth = new CryptedXMLDocAuthenticator();
+ auth.authenticate("anou_mana","badpass");
+ }
+}
Added: webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/config/ApplicationConfigurationTest.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/config/ApplicationConfigurationTest.java?rev=953077&view=auto
==============================================================================
--- webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/config/ApplicationConfigurationTest.java (added)
+++ webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/config/ApplicationConfigurationTest.java Wed Jun 9 16:44:42 2010
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2001-2009 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.config;
+
+import org.apache.commons.configuration.ConfigurationException;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * @author <a href="mailto:kstam@apache.org">Kurt T Stam</a>
+ */
+public class ApplicationConfigurationTest
+{
+ @Test
+ public void readPropertyFromFile() throws ConfigurationException
+ {
+ try {
+ long refreshDelay = AppConfig.getConfiguration().getLong(Property.JUDDI_CONFIGURATION_RELOAD_DELAY);
+ System.out.println("refreshDelay=" + refreshDelay);
+ Assert.assertEquals(2000l, refreshDelay);
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail();
+ }
+ }
+
+ @Test
+ public void readNonExistingProperty() throws ConfigurationException
+ {
+ long defaultValue = 3000l;
+ try {
+ long nonexisting = AppConfig.getConfiguration().getLong("nonexisting.property",defaultValue);
+ System.out.println("nonexisting=" + nonexisting);
+ Assert.assertEquals(3000l, nonexisting);
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail();
+ }
+ }
+
+}
Added: webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/rmi/JNDIRegistrationTest.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/rmi/JNDIRegistrationTest.java?rev=953077&view=auto
==============================================================================
--- webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/rmi/JNDIRegistrationTest.java (added)
+++ webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/rmi/JNDIRegistrationTest.java Wed Jun 9 16:44:42 2010
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2001-2010 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.rmi;
+
+import org.apache.commons.configuration.ConfigurationException;
+import org.junit.Assert;
+import org.junit.Test;
+import org.mockejb.jndi.MockContextFactory;
+
+/**
+ * @author <a href="mailto:kstam@apache.org">Kurt T Stam</a>
+ */
+public class JNDIRegistrationTest
+{
+ @Test
+ public void registerToJNDI_AnonymousPort() throws ConfigurationException
+ {
+ try {
+ MockContextFactory.setAsInitial();
+ //register all jUDDI services, under an anonymous port
+ JNDIRegistration.getInstance().register(0);
+ JNDIRegistration.getInstance().unregister();
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail();
+ }
+ }
+
+ @Test
+ public void registerToJNDI_UserDefinedPort() throws ConfigurationException
+ {
+ try {
+ MockContextFactory.setAsInitial();
+ //register all jUDDI services, under an use defined port
+ JNDIRegistration.getInstance().register(34567);
+ JNDIRegistration.getInstance().unregister();
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail();
+ }
+ }
+
+
+}
Added: webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/subscription/SubscriptionNotifierTest.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/subscription/SubscriptionNotifierTest.java?rev=953077&view=auto
==============================================================================
--- webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/subscription/SubscriptionNotifierTest.java (added)
+++ webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/subscription/SubscriptionNotifierTest.java Wed Jun 9 16:44:42 2010
@@ -0,0 +1,114 @@
+/*
+ * Copyright 2001-2009 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.subscription;
+
+import java.net.MalformedURLException;
+import java.rmi.RemoteException;
+import java.util.Collection;
+import java.util.Date;
+
+import javax.xml.datatype.DatatypeConfigurationException;
+
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.juddi.api.impl.API_010_PublisherTest;
+import org.apache.juddi.api.impl.UDDIInquiryImpl;
+import org.apache.juddi.api.impl.UDDIPublicationImpl;
+import org.apache.juddi.api.impl.UDDISecurityImpl;
+import org.apache.juddi.api.impl.UDDISubscriptionImpl;
+import org.apache.juddi.model.Subscription;
+import org.apache.juddi.model.UddiEntityPublisher;
+import org.apache.juddi.subscription.SubscriptionNotifier;
+import org.apache.juddi.v3.tck.TckBindingTemplate;
+import org.apache.juddi.v3.tck.TckBusiness;
+import org.apache.juddi.v3.tck.TckBusinessService;
+import org.apache.juddi.v3.tck.TckPublisher;
+import org.apache.juddi.v3.tck.TckSecurity;
+import org.apache.juddi.v3.tck.TckSubscription;
+import org.apache.juddi.v3.tck.TckTModel;
+import org.apache.log4j.Logger;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.uddi.sub_v3.GetSubscriptionResults;
+import org.uddi.sub_v3.SubscriptionResultsList;
+import org.uddi.v3_service.DispositionReportFaultMessage;
+
+/**
+ * @author <a href="mailto:kstam@apache.org">Kurt T Stam</a>
+ */
+public class SubscriptionNotifierTest
+{
+ private static Logger logger = Logger.getLogger(SubscriptionNotifierTest.class);
+ private static API_010_PublisherTest api010 = new API_010_PublisherTest();
+ private static TckTModel tckTModel = new TckTModel(new UDDIPublicationImpl(), new UDDIInquiryImpl());
+ private static TckBusiness tckBusiness = new TckBusiness(new UDDIPublicationImpl(), new UDDIInquiryImpl());
+ private static TckBusinessService tckBusinessService = new TckBusinessService(new UDDIPublicationImpl(), new UDDIInquiryImpl());
+ private static TckBindingTemplate tckBindingTemplate = new TckBindingTemplate(new UDDIPublicationImpl(), new UDDIInquiryImpl());
+ private static TckSubscription tckSubscription = new TckSubscription(new UDDISubscriptionImpl(), new UDDISecurityImpl());
+
+ private static String authInfoJoe = null;
+
+ @BeforeClass
+ public static void setup() {
+ logger.debug("Getting auth token..");
+ try {
+ api010.saveJoePublisher();
+ authInfoJoe = TckSecurity.getAuthToken(new UDDISecurityImpl(), TckPublisher.JOE_PUBLISHER_ID, TckPublisher.JOE_PUBLISHER_CRED);
+ tckTModel.saveJoePublisherTmodel(authInfoJoe);
+ tckBusiness.saveJoePublisherBusiness(authInfoJoe);
+ tckBusinessService.saveJoePublisherService(authInfoJoe);
+ tckBindingTemplate.saveJoePublisherBinding(authInfoJoe);
+ tckSubscription.saveJoePublisherSubscription(authInfoJoe);
+ //tckSubscription.getJoePublisherSubscriptionResults(authInfoJoe);
+ } catch (RemoteException e) {
+ logger.error(e.getMessage(), e);
+ Assert.fail("Could not obtain authInfo token.");
+ }
+ }
+ @Test
+ public void testGetSubscriptionResults()
+ throws ConfigurationException, MalformedURLException, DispositionReportFaultMessage, DatatypeConfigurationException
+ {
+ SubscriptionNotifier notifier = new SubscriptionNotifier();
+ notifier.cancel();
+ Collection<Subscription> subscriptions = notifier.getAllAsyncSubscriptions();
+ Assert.assertEquals(1, subscriptions.size());
+ Subscription subscription = subscriptions.iterator().next();
+ GetSubscriptionResults getSubscriptionResults = notifier.buildGetSubscriptionResults(subscription, new Date());
+ getSubscriptionResults.setSubscriptionKey(subscription.getSubscriptionKey());
+ UddiEntityPublisher publisher = new UddiEntityPublisher();
+ publisher.setAuthorizedName(subscription.getAuthorizedName());
+ SubscriptionResultsList resultList = notifier.getSubscriptionImpl().getSubscriptionResults(getSubscriptionResults, publisher);
+ //We're expecting a changed service (since it was added in the
+ Assert.assertNotNull(resultList.getServiceList());
+ //We should detect these changes.
+ boolean hasChanges = notifier.resultListContainsChanges(resultList);
+ Assert.assertTrue(hasChanges);
+ System.out.print(resultList);
+ notifier.notify(getSubscriptionResults,resultList);
+ }
+
+
+ @AfterClass
+ public static void teardown() {
+ tckSubscription.deleteJoePublisherSubscription(authInfoJoe);
+ tckBindingTemplate.deleteJoePublisherBinding(authInfoJoe);
+ tckBusinessService.deleteJoePublisherService(authInfoJoe);
+ tckBusiness.deleteJoePublisherBusiness(authInfoJoe);
+ tckTModel.deleteJoePublisherTmodel(authInfoJoe);
+ }
+
+}
Added: webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/util/JPAUtil.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/util/JPAUtil.java?rev=953077&view=auto
==============================================================================
--- webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/util/JPAUtil.java (added)
+++ webservices/juddi/trunk/juddi-core-openjpa/src/test/java/org/apache/juddi/util/JPAUtil.java Wed Jun 9 16:44:42 2010
@@ -0,0 +1,156 @@
+/*
+ * Copyright 2001-2008 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.util;
+
+import javax.persistence.EntityTransaction;
+import javax.persistence.EntityManager;
+
+import javax.persistence.Query;
+import java.util.List;
+
+import org.apache.juddi.config.PersistenceManager;
+
+
+/**
+ * @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>
+ *
+ * Example use:
+ public void test() {
+ Object object = JPAUtil.getEntity(Tmodel.class, "uddi:juddi.apache.org:joepublisher:kEYGENERATOR");
+ System.out.println("object=" + object);
+ }
+ */
+public class JPAUtil {
+ //TODO Comment from Code Review: This class does not seem to be in use. Do we need it?
+
+ public static void persistEntity(Object uddiEntity, Object entityKey) {
+ EntityManager em = PersistenceManager.getEntityManager();
+ EntityTransaction tx = em.getTransaction();
+ try {
+ tx.begin();
+
+ Object existingUddiEntity = em.find(uddiEntity.getClass(), entityKey);
+ if (existingUddiEntity != null)
+ em.remove(existingUddiEntity);
+
+ em.persist(uddiEntity);
+
+ tx.commit();
+ } finally {
+ if (tx.isActive()) {
+ tx.rollback();
+ }
+ em.close();
+ }
+ }
+
+ public static Object getEntity(Class<?> entityClass, Object entityKey) {
+ EntityManager em = PersistenceManager.getEntityManager();
+ EntityTransaction tx = em.getTransaction();
+ try {
+ tx.begin();
+
+ Object obj = em.find(entityClass, entityKey);
+
+ tx.commit();
+ return obj;
+ } finally {
+ if (tx.isActive()) {
+ tx.rollback();
+ }
+ em.close();
+ }
+ }
+
+ public static void deleteEntity(Class<?> entityClass, Object entityKey) {
+ EntityManager em = PersistenceManager.getEntityManager();
+ EntityTransaction tx = em.getTransaction();
+ try {
+ tx.begin();
+
+ Object obj = em.find(entityClass, entityKey);
+ em.remove(obj);
+
+ tx.commit();
+ } finally {
+ if (tx.isActive()) {
+ tx.rollback();
+ }
+ em.close();
+ }
+ }
+
+ public static List<?> runQuery(String qry, int maxRows, int listHead) {
+ EntityManager em = PersistenceManager.getEntityManager();
+ EntityTransaction tx = em.getTransaction();
+ try {
+ tx.begin();
+ Query q = em.createQuery(qry);
+ q.setMaxResults(maxRows);
+ q.setFirstResult(listHead);
+ List<?> ret = q.getResultList();
+ tx.commit();
+ return ret;
+ } finally {
+ if (tx.isActive()) {
+ tx.rollback();
+ }
+ em.close();
+ }
+
+ }
+
+ public static void runUpdateQuery(String qry) {
+ EntityManager em = PersistenceManager.getEntityManager();
+ EntityTransaction tx = em.getTransaction();
+ try {
+ tx.begin();
+
+ Query q = em.createQuery(qry);
+ q.executeUpdate();
+
+ tx.commit();
+ } finally {
+ if (tx.isActive()) {
+ tx.rollback();
+ }
+ em.close();
+ }
+ }
+
+ public static void removeAuthTokens() {
+
+ EntityManager em = PersistenceManager.getEntityManager();
+ EntityTransaction tx = em.getTransaction();
+ try {
+ tx.begin();
+
+ Query qry = em.createQuery("delete from AuthToken");
+ qry.executeUpdate();
+
+ tx.commit();
+ } finally {
+ if (tx.isActive()) {
+ tx.rollback();
+ }
+ em.close();
+ }
+
+ }
+
+}
Modified: webservices/juddi/trunk/juddi-core/pom.xml
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/juddi-core/pom.xml?rev=953077&r1=953076&r2=953077&view=diff
==============================================================================
--- webservices/juddi/trunk/juddi-core/pom.xml (original)
+++ webservices/juddi/trunk/juddi-core/pom.xml Wed Jun 9 16:44:42 2010
@@ -346,42 +346,6 @@
</includes>
</configuration>
</plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>openjpa-maven-plugin</artifactId>
- <version>1.0</version>
- <executions>
- <execution>
- <id>enhancer</id>
- <phase>process-classes</phase>
- <configuration>
- <classes>
- ${project.build.outputDirectory}/org/apache/juddi/model/
- </classes>
- <toolProperties>
- <property>
- <name>addDefaultConstructor</name>
- <value>true</value>
- </property>
- <property>
- <name>enforcePropertyRestrictions</name>
- <value>true</value>
- </property>
- </toolProperties>
- </configuration>
- <goals>
- <goal>enhance</goal>
- </goals>
- </execution>
- </executions>
- <dependencies>
- <dependency>
- <groupId>org.apache.openjpa</groupId>
- <artifactId>openjpa</artifactId>
- <version>1.2.2</version>
- </dependency>
- </dependencies>
- </plugin>
</plugins>
</build>
</profile>
---------------------------------------------------------------------
To unsubscribe, e-mail: juddi-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: juddi-cvs-help@ws.apache.org