You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juddi.apache.org by ks...@apache.org on 2013/03/11 18:39:43 UTC
svn commit: r1455249 [1/2] - in /juddi/trunk: juddi-core-openjpa/src/test/
juddi-core/ juddi-core/src/main/resources/
juddi-core/src/main/resources/persistence/ juddi-core/src/test/
juddi-core/src/test/java/ juddi-core/src/test/java/org/ juddi-core/src...
Author: kstam
Date: Mon Mar 11 17:39:42 2013
New Revision: 1455249
URL: http://svn.apache.org/r1455249
Log:
JUDDI-563 moving the tests back into juddi-core.
Added:
juddi/trunk/juddi-core/src/test/
juddi/trunk/juddi-core/src/test/java/
juddi/trunk/juddi-core/src/test/java/org/
juddi/trunk/juddi-core/src/test/java/org/apache/
juddi/trunk/juddi-core/src/test/java/org/apache/juddi/
juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/
juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/
juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_010_PublisherTest.java
juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_020_TmodelTest.java
juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_030_BusinessEntityTest.java
juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_040_BusinessServiceTest.java
juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_050_BindingTemplateTest.java
juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_060_PublisherAssertionTest.java
juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_070_FindEntityTest.java
juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_080_SubscriptionTest.java
juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_090_SubscriptionListenerIntegrationTest.java
juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_091_RMISubscriptionListenerIntegrationTest.java
juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_100_ClientSubscriptionInfoTest.java
juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/package.html
juddi/trunk/juddi-core/src/test/java/org/apache/juddi/auth/
juddi/trunk/juddi-core/src/test/java/org/apache/juddi/auth/AuthenticatorTest.java
juddi/trunk/juddi-core/src/test/java/org/apache/juddi/config/
juddi/trunk/juddi-core/src/test/java/org/apache/juddi/config/ApplicationConfigurationTest.java
juddi/trunk/juddi-core/src/test/java/org/apache/juddi/keygen/
juddi/trunk/juddi-core/src/test/java/org/apache/juddi/keygen/KeyGeneratorTest.java
juddi/trunk/juddi-core/src/test/java/org/apache/juddi/rmi/
juddi/trunk/juddi-core/src/test/java/org/apache/juddi/rmi/JNDIRegistrationTest.java
juddi/trunk/juddi-core/src/test/java/org/apache/juddi/subscription/
juddi/trunk/juddi-core/src/test/java/org/apache/juddi/subscription/SubscriptionNotifierTest.java
juddi/trunk/juddi-core/src/test/java/org/apache/juddi/subscription/notify/
juddi/trunk/juddi-core/src/test/java/org/apache/juddi/subscription/notify/NotifierTest.java
juddi/trunk/juddi-core/src/test/java/org/apache/juddi/util/
juddi/trunk/juddi-core/src/test/java/org/apache/juddi/util/JPAUtil.java
juddi/trunk/juddi-core/src/test/resources/
juddi/trunk/juddi-core/src/test/resources/META-INF/
juddi/trunk/juddi-core/src/test/resources/META-INF/orm.xml
juddi/trunk/juddi-core/src/test/resources/META-INF/persistence.xml
juddi/trunk/juddi-core/src/test/resources/juddi-users-encrypted.xml
juddi/trunk/juddi-core/src/test/resources/juddi-users.xml
juddi/trunk/juddi-core/src/test/resources/juddiv3.properties
juddi/trunk/juddi-core/src/test/resources/log4j.xml
Removed:
juddi/trunk/juddi-core/src/main/resources/juddi-orm.xml
juddi/trunk/juddi-core/src/main/resources/persistence/
Modified:
juddi/trunk/juddi-core-openjpa/src/test/ (props changed)
juddi/trunk/juddi-core/pom.xml
Propchange: juddi/trunk/juddi-core-openjpa/src/test/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Mar 11 17:39:42 2013
@@ -0,0 +1 @@
+java
Modified: juddi/trunk/juddi-core/pom.xml
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-core/pom.xml?rev=1455249&r1=1455248&r2=1455249&view=diff
==============================================================================
--- juddi/trunk/juddi-core/pom.xml (original)
+++ juddi/trunk/juddi-core/pom.xml Mon Mar 11 17:39:42 2013
@@ -25,6 +25,7 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3</version>
+ <!--
<configuration>
<excludes>
<exclude>**/persistence</exclude>
@@ -34,6 +35,7 @@
<exclude>**/juddi-orm.xml</exclude>
</excludes>
</configuration>
+ -->
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
@@ -63,45 +65,9 @@
<version>1.3</version>
<executions>
<execution>
- <id>initialize-meta-inf</id>
- <phase>initialize</phase>
- <configuration>
- <tasks>
- <echo>PERSISTENCE=${persistence}</echo>
- <delete dir="src/main/java/META-INF" />
- <delete dir="src/main/resources/META-INF" />
- <mkdir dir="src/main/java/META-INF" />
- <copy
- file="src/main/resources/persistence/${persistence}-persistence.xml"
- tofile="src/main/java/META-INF/persistence.xml" overwrite="true" />
- <mkdir dir="src/main/resources/META-INF" />
- <copy
- file="src/main/resources/persistence/${persistence}-persistence.xml"
- tofile="src/main/resources/META-INF/persistence.xml" overwrite="true" />
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- <execution>
- <id>remove-meta-inf</id>
- <phase>deploy</phase>
- <configuration>
- <tasks>
- <delete dir="src/main/java/META-INF" />
- <delete dir="src/main/resources/META-INF" />
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- <execution>
<phase>generate-resources</phase>
<configuration>
<tasks>
- <echo>PERSISTENCE = ${persistence}</echo>
<copy file="src/main/resources/version/Release.java.template"
tofile="src/main/java/org/apache/juddi/config/Release.java"
overwrite="true">
@@ -110,7 +76,6 @@
</filterset>
</copy>
<delete dir="juddi-derby-test-db" />
- <mkdir dir="src/main/java/META-INF" />
</tasks>
</configuration>
<goals>
@@ -254,27 +219,6 @@
</componentProperties>
</configuration>
</plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <version>1.3</version>
- <executions>
- <execution>
- <id>init-orm</id>
- <phase>generate-resources</phase>
- <configuration>
- <tasks>
- <mkdir dir="src/main/resources/META-INF" />
- <copy file="src/main/resources/juddi-orm.xml" tofile="src/main/resources/META-INF/orm.xml"
- overwrite="true" />
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
</plugins>
<pluginManagement>
<plugins>
Added: juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_010_PublisherTest.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_010_PublisherTest.java?rev=1455249&view=auto
==============================================================================
--- juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_010_PublisherTest.java (added)
+++ juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_010_PublisherTest.java Mon Mar 11 17:39:42 2013
@@ -0,0 +1,236 @@
+/*
+ * 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.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+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.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 Log logger = LogFactory.getLog(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.getJoePublisherId())) {
+ saveJoePublisher();
+ deleteJoePublisher();
+ }
+ }
+
+ @Test
+ public void testSamSyndicator() {
+ //We can only test this if the publisher is not there already.
+ if (!isExistPublisher(TckPublisher.getSamPublisherId())) {
+ 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.getJoePublisherId())) {
+ savePublisher(TckPublisher.getJoePublisherId(), TckPublisher.JOE_PUBLISHER_XML);
+ return true;
+ } else {
+ return false;
+ }
+ }
+ /**
+ * Persists Mary Publisher to the database.
+ * @return - true if the published did not exist already,
+ * - false in all other cases.
+ */
+ public boolean saveMaryPublisher() {
+ if (!isExistPublisher(TckPublisher.getMaryPublisherId())) {
+ savePublisher(TckPublisher.getMaryPublisherId(), TckPublisher.MARY_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.getJoePublisherId());
+ }
+ /**
+ * Persists Sam Syndicator to the database.
+ * @return publisherId
+ */
+ public String saveSamSyndicator() {
+ if (!isExistPublisher(TckPublisher.getSamPublisherId())) {
+ savePublisher(TckPublisher.getSamPublisherId(), TckPublisher.SAM_SYNDICATOR_XML);
+ }
+ return TckPublisher.getSamPublisherId();
+ }
+ /**
+ * Removes Sam Syndicator from the database, this will fail if there
+ * are child objects attached; think Services etc.
+ */
+ public void deleteSamSyndicator() {
+ deletePublisher(TckPublisher.getSamPublisherId());
+ }
+
+
+ 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.getJoePublisherId(), TckPublisher.getJoePassword());
+ }
+
+ protected String authInfoSam() throws RemoteException, DispositionReportFaultMessage {
+ return TckSecurity.getAuthToken(security, TckPublisher.getSamPublisherId(), TckPublisher.getSamPassword());
+ }
+
+}
Added: juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_020_TmodelTest.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_020_TmodelTest.java?rev=1455249&view=auto
==============================================================================
--- juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_020_TmodelTest.java (added)
+++ juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_020_TmodelTest.java Mon Mar 11 17:39:42 2013
@@ -0,0 +1,100 @@
+/*
+ * 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.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+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.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.uddi.api_v3.TModelDetail;
+import org.uddi.api_v3.TModelInfo;
+import org.uddi.api_v3.TModelList;
+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 Log logger = LogFactory.getLog(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.getJoePublisherId(), TckPublisher.getJoePassword());
+ authInfoSam = TckSecurity.getAuthToken(security, TckPublisher.getSamPublisherId(), TckPublisher.getSamPassword());
+ } 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);
+
+ //Now if we use a finder it should be found.
+ TModelList tModelList = tckTModel.findJoeTModelDetail();
+ Assert.assertNotNull(tModelList.getTModelInfos());
+
+ tckTModel.deleteJoePublisherTmodel(authInfoJoe);
+
+ //Even if it deleted you should still be able to access it through a getTModelDetail
+ TModelDetail detail = tckTModel.getJoePublisherTmodel(authInfoJoe);
+ Assert.assertNotNull(detail.getTModel());
+
+ //However if we use a finder it should not be found.
+ TModelList tModelList2 = tckTModel.findJoeTModelDetail();
+ Assert.assertNull(tModelList2.getTModelInfos());
+
+ //Make sure none of the found key generators is Joe's key generator
+ TModelList tModelList3 = tckTModel.findJoeTModelDetailByCategoryBag();
+ for (TModelInfo tModelInfo : tModelList3.getTModelInfos().getTModelInfo()) {
+ Assert.assertFalse("uddi:uddi.joepublisher.com:keygenerator".equals(tModelInfo.getTModelKey()));
+ }
+ }
+
+ @Test
+ public void testSamSyndicatorTmodelTest() {
+ tckTModel.saveSamSyndicatorTmodel(authInfoSam);
+ tckTModel.deleteSamSyndicatorTmodel(authInfoSam);
+ }
+
+}
Added: juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_030_BusinessEntityTest.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_030_BusinessEntityTest.java?rev=1455249&view=auto
==============================================================================
--- juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_030_BusinessEntityTest.java (added)
+++ juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_030_BusinessEntityTest.java Mon Mar 11 17:39:42 2013
@@ -0,0 +1,91 @@
+/*
+ * 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.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+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.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 Log logger = LogFactory.getLog(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.getJoePublisherId(), TckPublisher.getJoePassword());
+ authInfoSam = TckSecurity.getAuthToken(security, TckPublisher.getSamPublisherId(), TckPublisher.getSamPassword());
+ } 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: juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_040_BusinessServiceTest.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_040_BusinessServiceTest.java?rev=1455249&view=auto
==============================================================================
--- juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_040_BusinessServiceTest.java (added)
+++ juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_040_BusinessServiceTest.java Mon Mar 11 17:39:42 2013
@@ -0,0 +1,231 @@
+/*
+ * 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 java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.juddi.Registry;
+import org.apache.juddi.config.PersistenceManager;
+import org.apache.juddi.query.util.DynamicQuery;
+import org.apache.juddi.v3.tck.Property;
+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.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+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 Log logger = LogFactory.getLog(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 TckFindEntity tckFindEntity = new TckFindEntity(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.getJoePublisherId(), TckPublisher.getJoePassword());
+ authInfoSam = TckSecurity.getAuthToken(security, TckPublisher.getSamPublisherId(), TckPublisher.getSamPassword());
+ } 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);
+ }
+ }
+ /**
+ * 5.2.16.3 paragraph 4
+ * Data contained within businessEntity structures can be rearranged with
+ * this API call. This can be done by redefining parent container relationships
+ * for other registered information. For instance, if a new businessEntity
+ * is saved with information about a businessService that is registered
+ * already as part of a different businessEntity, this results in the
+ * businessService being moved from its current container to the new businessEntity.
+ * This condition occurs when the businessKey of the businessService being
+ * saved matches the businessKey of the businessEntity being saved.
+ * An attempt to delete or move a businessService in this manner by
+ * a party who is not the publisher of the businessService MUST be
+ * rejected with an error E_userMismatch.
+ */
+ @Test
+ public void joepublisherMoveBusinessService() {
+ try {
+ tckTModel.saveJoePublisherTmodel(authInfoJoe);
+ tckBusiness.saveJoePublisherBusiness(authInfoJoe);
+ tckBusinessService.saveJoePublisherService(authInfoJoe);
+ tckBusiness.checkServicesBusinessOne(1);
+ tckBusiness.saveJoePublisherBusiness3(authInfoJoe);
+ //check that this business has no services
+ tckBusiness.checkServicesBusinessThree(0);
+ //Now move the service from one to three
+ tckBusiness.saveJoePublisherBusiness1to3(authInfoJoe);
+ tckBusiness.checkServicesBusinessOne(0);
+ tckBusiness.checkServicesBusinessThree(1);
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail(e.getMessage());
+ } finally {
+ tckBusinessService.deleteJoePublisherService(authInfoJoe);
+ tckBusiness.deleteJoePublisherBusiness3(authInfoJoe);
+ tckBusiness.deleteJoePublisherBusiness(authInfoJoe);
+ tckTModel.deleteJoePublisherTmodel(authInfoJoe);
+ }
+ }
+
+ @Test @Ignore
+ public void combineCategoryBagsFindServices() {
+ try {
+ tckTModel.saveJoePublisherTmodel(authInfoJoe);
+ tckBusiness.saveCombineCatBagsPublisherBusiness(authInfoJoe);
+
+ PersistenceManager pm = new PersistenceManager();
+ EntityManager em = pm.getEntityManager();
+
+ String sql = "select bs.entityKey from BusinessService bs ," +
+ " ServiceCategoryBag ServiceCategory_ , " +
+ "KeyedReference KeyedRefere_0 , KeyedReference KeyedRefere_1 " +
+ "where ( bs.entityKey = ServiceCategory_.businessService.entityKey and " +
+ " ( ServiceCategory_.id = KeyedRefere_0.categoryBag.id ))";
+ String sql3 = "select bs.entityKey from BusinessService bs UNION select bs.entityKey from BusinessService bs";
+
+ String sql2 = "select bs.entityKey, categoryBag.id from BusinessService bs, " +
+ " BindingTemplate bt, " +
+ " BindingCategoryBag categoryBag ," +
+ "KeyedReference KeyedRefere_0, KeyedReference KeyedRefere_1 " +
+ "where categoryBag.id = bt.categoryBag.id and " +
+ "bt.businessService.entityKey = bs.entityKey and " +
+ "( (KeyedRefere_0.categoryBag.id=categoryBag.id and KeyedRefere_0.tmodelKeyRef = 'uddi:uddi.joepublisher.com:tmodel01' and KeyedRefere_0.keyValue = 'value-z') or " +
+ "(KeyedRefere_1.categoryBag.id=categoryBag.id and KeyedRefere_1.tmodelKeyRef = 'uddi:uddi.joepublisher.com:tmodel02' and KeyedRefere_1.keyValue = 'value-x') ) " +
+ " group by bs.entityKey, categoryBag.id ";
+
+ String sql1 = "select bs.entityKey from BusinessService bs ," +
+ " BindingTemplate bt, ServiceCategoryBag ServiceCategory_ , " +
+ " BindingCategoryBag BindingCategory_ , " +
+ "KeyedReference KeyedRefere_0, KeyedReference KeyedRefere_1 " +
+ "where ( ((bt.businessService.entityKey = bs.entityKey and bt.entityKey = BindingCategory_.bindingTemplate.entityKey and " +
+ " BindingCategory_.id = KeyedRefere_0.categoryBag.id) AND (bs.entityKey = ServiceCategory_.businessService.entityKey and ServiceCategory_.id = KeyedRefere_0.categoryBag.id)" +
+ ") and KeyedRefere_0.categoryBag.id = KeyedRefere_1.categoryBag.id and ( " +
+ "(KeyedRefere_0.tmodelKeyRef = 'uddi:uddi.joepublisher.com:tmodel01' and KeyedRefere_0.keyValue = 'value-z') and " +
+ "(KeyedRefere_1.tmodelKeyRef = 'uddi:uddi.joepublisher.com:tmodel02' and KeyedRefere_1.keyValue = 'value-x') ) ) ";
+ Query qry = em.createQuery(sql2);
+ List result = qry.getResultList();
+ System.out.println(result);
+
+ //tckFindEntity.findService_CombinedCatBag();
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail(e.getMessage());
+ }
+ }
+
+ @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: juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_050_BindingTemplateTest.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_050_BindingTemplateTest.java?rev=1455249&view=auto
==============================================================================
--- juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_050_BindingTemplateTest.java (added)
+++ juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_050_BindingTemplateTest.java Mon Mar 11 17:39:42 2013
@@ -0,0 +1,112 @@
+/*
+ * 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.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+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.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 Log logger = LogFactory.getLog(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 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.getJoePublisherId(), TckPublisher.getJoePassword());
+ } 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);
+ }
+ }
+
+ @Test
+ public void testSearchBinding() {
+ try {
+ tckTModel.saveJoePublisherTmodel(authInfoJoe);
+ tckBusiness.saveJoePublisherBusiness(authInfoJoe);
+ tckBusinessService.saveJoePublisherService(authInfoJoe);
+
+ tckFindEntity.findServiceDetail("uddi:uddi.joepublisher.com:serviceone");
+ tckBindingTemplate.deleteBinding(authInfoJoe, "uddi:uddi.joepublisher.com:bindingone");
+ String serviceKey = tckFindEntity.findService();
+ tckFindEntity.findServiceDetail(serviceKey);
+
+ tckBindingTemplate.saveJoePublisherBinding(authInfoJoe);
+
+ serviceKey = tckFindEntity.findService();
+ tckFindEntity.findServiceDetail(serviceKey);
+
+ tckBindingTemplate.deleteJoePublisherBinding(authInfoJoe);
+
+ tckFindEntity.findService();
+ tckFindEntity.findServiceDetail(serviceKey);
+ } finally {
+ tckBusinessService.deleteJoePublisherService(authInfoJoe);
+ tckBusiness.deleteJoePublisherBusiness(authInfoJoe);
+ tckTModel.deleteJoePublisherTmodel(authInfoJoe);
+ }
+ }
+}
Added: juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_060_PublisherAssertionTest.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_060_PublisherAssertionTest.java?rev=1455249&view=auto
==============================================================================
--- juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_060_PublisherAssertionTest.java (added)
+++ juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_060_PublisherAssertionTest.java Mon Mar 11 17:39:42 2013
@@ -0,0 +1,155 @@
+/*
+ * 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.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.juddi.Registry;
+import org.apache.juddi.v3.tck.TckBusiness;
+import org.apache.juddi.v3.tck.TckFindEntity;
+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.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 Log logger = LogFactory.getLog(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 TckFindEntity tckFindEntity = new TckFindEntity(new UDDIInquiryImpl());
+ private static String authInfoJoe = null;
+ private static String authInfoSam = null;
+ private static String authInfoMary = 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.getJoePublisherId(), TckPublisher.getJoePassword());
+ authInfoSam = TckSecurity.getAuthToken(security, TckPublisher.getSamPublisherId(), TckPublisher.getSamPassword());
+ authInfoMary = TckSecurity.getAuthToken(security, TckPublisher.getMaryPublisherId(), TckPublisher.getMaryPassword());
+ } 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);
+ }
+ }
+ /**
+ * This test should find no publisher assertions because we only save them
+ * from the joe publisher side.
+ */
+ @Test
+ public void testFindNoAssertions() {
+ try {
+ tckTModel.saveJoePublisherTmodel(authInfoJoe);
+ tckTModel.saveSamSyndicatorTmodel(authInfoSam);
+ tckTModel.saveMaryPublisherTmodel(authInfoMary);
+ tckBusiness.saveJoePublisherBusiness(authInfoJoe);
+ tckBusiness.saveSamSyndicatorBusiness(authInfoSam);
+ tckBusiness.saveMaryPublisherBusiness(authInfoMary);
+ tckAssertion.saveJoePublisherPublisherAssertion(authInfoJoe);
+ tckAssertion.saveJoePublisherPublisherAssertion2(authInfoJoe);
+
+ tckFindEntity.findRelatedBusiness_sortByName(true);
+ tckFindEntity.findRelatedBusinessToKey(true);
+ tckFindEntity.findRelatedBusinessFromKey(true);
+
+ tckAssertion.deleteJoePublisherPublisherAssertion(authInfoJoe);
+ tckAssertion.deleteJoePublisherPublisherAssertion2(authInfoJoe);
+ } finally {
+ tckBusiness.deleteJoePublisherBusiness(authInfoJoe);
+ tckBusiness.deleteMaryPublisherBusiness(authInfoMary);
+ tckBusiness.deleteSamSyndicatorBusiness(authInfoSam);
+ tckTModel.deleteJoePublisherTmodel(authInfoJoe);
+ tckTModel.deleteSamSyndicatorTmodel(authInfoSam);
+ tckTModel.deleteMaryPublisherTmodel(authInfoMary);
+ }
+ }
+
+ /**
+ * This test should find 2 publisher assertions.
+ */
+ @Test
+ public void testFindAssertions() {
+ try {
+ tckTModel.saveJoePublisherTmodel(authInfoJoe);
+ tckTModel.saveSamSyndicatorTmodel(authInfoSam);
+ tckTModel.saveMaryPublisherTmodel(authInfoMary);
+ tckBusiness.saveJoePublisherBusiness(authInfoJoe);
+ tckBusiness.saveSamSyndicatorBusiness(authInfoSam);
+ tckBusiness.saveMaryPublisherBusiness(authInfoMary);
+ tckAssertion.saveJoePublisherPublisherAssertion(authInfoJoe);
+ tckAssertion.saveJoePublisherPublisherAssertion2(authInfoJoe);
+ tckAssertion.saveSamPublisherPublisherAssertion(authInfoSam);
+ tckAssertion.saveMaryPublisherPublisherAssertion(authInfoMary);
+
+ tckFindEntity.findRelatedBusiness_sortByName(false);
+ tckFindEntity.findRelatedBusinessToKey(false);
+ tckFindEntity.findRelatedBusinessFromKey(false);
+
+ tckAssertion.deleteJoePublisherPublisherAssertion(authInfoJoe);
+ tckAssertion.deleteJoePublisherPublisherAssertion2(authInfoJoe);
+
+ } finally {
+ tckBusiness.deleteJoePublisherBusiness(authInfoJoe);
+ tckBusiness.deleteMaryPublisherBusiness(authInfoMary);
+ tckBusiness.deleteSamSyndicatorBusiness(authInfoSam);
+ tckTModel.deleteJoePublisherTmodel(authInfoJoe);
+ tckTModel.deleteSamSyndicatorTmodel(authInfoSam);
+ tckTModel.deleteMaryPublisherTmodel(authInfoMary);
+ }
+ }
+}
Added: juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_070_FindEntityTest.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_070_FindEntityTest.java?rev=1455249&view=auto
==============================================================================
--- juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_070_FindEntityTest.java (added)
+++ juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_070_FindEntityTest.java Mon Mar 11 17:39:42 2013
@@ -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.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+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.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 Log logger = LogFactory.getLog(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.getJoePublisherId(), TckPublisher.getJoePassword());
+ } 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: juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_080_SubscriptionTest.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_080_SubscriptionTest.java?rev=1455249&view=auto
==============================================================================
--- juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_080_SubscriptionTest.java (added)
+++ juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_080_SubscriptionTest.java Mon Mar 11 17:39:42 2013
@@ -0,0 +1,155 @@
+/*
+ * 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.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+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.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 Log logger = LogFactory.getLog(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.getJoePublisherId(), TckPublisher.getJoePassword());
+
+ api010.saveSamSyndicator();
+ authInfoSam = TckSecurity.getAuthToken(new UDDISecurityImpl(), TckPublisher.getSamPublisherId(), TckPublisher.getSamPassword());
+
+ } 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: juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_090_SubscriptionListenerIntegrationTest.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_090_SubscriptionListenerIntegrationTest.java?rev=1455249&view=auto
==============================================================================
--- juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_090_SubscriptionListenerIntegrationTest.java (added)
+++ juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_090_SubscriptionListenerIntegrationTest.java Mon Mar 11 17:39:42 2013
@@ -0,0 +1,129 @@
+package org.apache.juddi.api.impl;
+
+/*
+ * 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.
+ */
+import javax.xml.ws.Endpoint;
+
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+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.TckSubscriptionListener;
+import org.apache.juddi.v3.tck.TckTModel;
+import org.apache.juddi.v3.tck.UDDISubscriptionListenerImpl;
+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:tcunning@apache.org">Tom Cunningham</a>
+ */
+public class API_090_SubscriptionListenerIntegrationTest
+{
+ private static Log logger = LogFactory.getLog(API_090_SubscriptionListenerIntegrationTest.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 TckSubscriptionListener tckSubscriptionListener = new TckSubscriptionListener(new UDDISubscriptionImpl(), new UDDIPublicationImpl());
+ private static Endpoint endPoint;
+ private static String authInfoJoe = null;
+
+
+ @AfterClass
+ public static void stopManager() throws ConfigurationException {
+ //manager.stop();
+ //shutting down the TCK SubscriptionListener
+ endPoint.stop();
+
+ Registry.stop();
+ }
+
+ @BeforeClass
+ public static void startManager() throws ConfigurationException {
+ Registry.start();
+ try {
+ //bring up the TCK SubscriptionListener
+ endPoint = Endpoint.publish("http://localhost:12345/tcksubscriptionlistener", new UDDISubscriptionListenerImpl());
+
+ //manager = new UDDIClerkManager();
+ //manager.start();
+
+ logger.debug("Getting auth tokens..");
+
+
+ api010.saveJoePublisher();
+ UDDISecurityPortType security = new UDDISecurityImpl();
+ authInfoJoe = TckSecurity.getAuthToken(security, TckPublisher.getJoePublisherId(), TckPublisher.getJoePassword());
+ Assert.assertNotNull(authInfoJoe);
+
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ Assert.fail("Could not obtain authInfo token.");
+ }
+ }
+
+ @Test
+ public void joePublisher() {
+ try {
+ tckTModel.saveJoePublisherTmodel(authInfoJoe);
+ tckBusiness.saveJoePublisherBusiness(authInfoJoe);
+ tckBusinessService.saveJoePublisherService(authInfoJoe);
+ //Saving the Listener Service
+ tckSubscriptionListener.saveService(authInfoJoe);
+ //Saving the Subscription
+ tckSubscriptionListener.saveNotifierSubscription(authInfoJoe);
+ //Changing the service we subscribed to "JoePublisherService"
+ tckBusinessService.updateJoePublisherService(authInfoJoe, "foo");
+ //tckSubscriptionListener.changeSubscribedObject(authInfoJoe);
+
+ //waiting up to 100 seconds for the listener to notice the change.
+ String test="";
+ for (int i=0; i<200; i++) {
+ Thread.sleep(500);
+ System.out.print(".");
+ if (UDDISubscriptionListenerImpl.notificationCount > 0) {
+ break;
+ } else {
+ System.out.print(test);
+ }
+ }
+ if (UDDISubscriptionListenerImpl.notificationCount == 0) {
+ Assert.fail("No Notification was sent");
+ }
+ if (!UDDISubscriptionListenerImpl.notifcationMap.get(0).contains("<name xml:lang=\"en\">Service One</name>")) {
+ Assert.fail("Notification does not contain the correct service");
+ }
+
+ } catch (Exception e) {
+ e.printStackTrace();
+
+ Assert.fail();
+ } finally {
+
+ tckSubscriptionListener.deleteNotifierSubscription(authInfoJoe);
+ tckBusinessService.deleteJoePublisherService(authInfoJoe);
+ tckBusiness.deleteJoePublisherBusiness(authInfoJoe);
+ tckTModel.deleteJoePublisherTmodel(authInfoJoe);
+ }
+ }
+
+}
Added: juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_091_RMISubscriptionListenerIntegrationTest.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_091_RMISubscriptionListenerIntegrationTest.java?rev=1455249&view=auto
==============================================================================
--- juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_091_RMISubscriptionListenerIntegrationTest.java (added)
+++ juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_091_RMISubscriptionListenerIntegrationTest.java Mon Mar 11 17:39:42 2013
@@ -0,0 +1,153 @@
+package org.apache.juddi.api.impl;
+
+/*
+ * 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.
+ */
+import java.net.URI;
+import java.rmi.AccessException;
+import java.rmi.NotBoundException;
+import java.rmi.RemoteException;
+import java.rmi.registry.LocateRegistry;
+import java.rmi.registry.Registry;
+
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+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.TckSubscriptionListenerRMI;
+import org.apache.juddi.v3.tck.TckTModel;
+import org.apache.juddi.v3.tck.UDDISubscriptionListenerImpl;
+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:tcunning@apache.org">Tom Cunningham</a>
+ */
+public class API_091_RMISubscriptionListenerIntegrationTest
+{
+
+ private static Log logger = LogFactory.getLog(API_090_SubscriptionListenerIntegrationTest.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 TckSubscriptionListenerRMI tckSubscriptionListenerRMI = new TckSubscriptionListenerRMI(new UDDISubscriptionImpl(), new UDDIPublicationImpl());
+
+ private static String authInfoJoe = null;
+ //private static UDDIClerkManager manager;
+ private static UDDISubscriptionListenerImpl rmiSubscriptionListenerService = null;
+ private static Registry registry;
+ private static String path = null;
+
+ @AfterClass
+ public static void stopManager() throws ConfigurationException, AccessException, RemoteException, NotBoundException {
+ //manager.stop();
+ //shutting down the TCK SubscriptionListener
+ registry.unbind(path);
+ org.apache.juddi.Registry.stop();
+ }
+
+ @BeforeClass
+ public static void startManager() throws ConfigurationException {
+ org.apache.juddi.Registry.start();
+ try {
+ //bring up the RMISubscriptionListener
+ URI rmiEndPoint = new URI("rmi://localhost:9876/tck/rmisubscriptionlistener");
+ registry = LocateRegistry.createRegistry(rmiEndPoint.getPort());
+ path = rmiEndPoint.getPath();
+
+ //starting the service
+ rmiSubscriptionListenerService = new UDDISubscriptionListenerImpl(0);
+ //binding to the RMI Registry
+ registry.bind(path,rmiSubscriptionListenerService);
+
+ //double check that the service is bound in the local Registry
+ Registry registry2 = LocateRegistry.getRegistry(rmiEndPoint.getHost(), rmiEndPoint.getPort());
+ registry2.lookup(rmiEndPoint.getPath());
+
+
+ } catch (Exception e2) {
+ // TODO Auto-generated catch block
+ e2.printStackTrace();
+ Assert.fail();
+ }
+
+ //manager = new UDDIClerkManager();
+ //manager.start();
+
+ logger.debug("Getting auth tokens..");
+ try {
+
+ api010.saveJoePublisher();
+ UDDISecurityPortType security = new UDDISecurityImpl();
+ authInfoJoe = TckSecurity.getAuthToken(security, TckPublisher.getJoePublisherId(), TckPublisher.getJoePassword());
+ Assert.assertNotNull(authInfoJoe);
+
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ Assert.fail("Could not obtain authInfo token.");
+ }
+ }
+
+ @Test
+ public void joePublisher() {
+ try {
+ tckTModel.saveJoePublisherTmodel(authInfoJoe);
+ tckBusiness.saveJoePublisherBusiness(authInfoJoe);
+ tckBusinessService.saveJoePublisherService(authInfoJoe);
+ //Saving the Listener Service
+ tckSubscriptionListenerRMI.saveService(authInfoJoe);
+ //Saving the Subscription
+ tckSubscriptionListenerRMI.saveNotifierSubscription(authInfoJoe);
+ //Changing the service we subscribed to "JoePublisherService"
+ tckBusinessService.updateJoePublisherService(authInfoJoe, "foo");
+
+ //waiting up to 100 seconds for the listener to notice the change.
+ String test="";
+ for (int i=0; i<200; i++) {
+ Thread.sleep(500);
+ System.out.print(".");
+ if (UDDISubscriptionListenerImpl.notificationCount > 0) {
+ break;
+ } else {
+ System.out.print(test);
+ }
+ }
+ if (UDDISubscriptionListenerImpl.notificationCount == 0) {
+ Assert.fail("No Notification was sent");
+ }
+ if (!UDDISubscriptionListenerImpl.notifcationMap.get(0).contains("<name xml:lang=\"en\">Service One</name>")) {
+ Assert.fail("Notification does not contain the correct service");
+ }
+
+ } catch (Exception e) {
+ e.printStackTrace();
+
+ Assert.fail();
+ } finally {
+
+ tckSubscriptionListenerRMI.deleteNotifierSubscription(authInfoJoe);
+ tckBusinessService.deleteJoePublisherService(authInfoJoe);
+ tckBusiness.deleteJoePublisherBusiness(authInfoJoe);
+ tckTModel.deleteJoePublisherTmodel(authInfoJoe);
+ }
+ }
+
+}
Added: juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_100_ClientSubscriptionInfoTest.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_100_ClientSubscriptionInfoTest.java?rev=1455249&view=auto
==============================================================================
--- juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_100_ClientSubscriptionInfoTest.java (added)
+++ juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_100_ClientSubscriptionInfoTest.java Mon Mar 11 17:39:42 2013
@@ -0,0 +1,167 @@
+/*
+ * 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.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+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.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 Log logger = LogFactory.getLog(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.getJoePublisherId(), TckPublisher.getJoePassword());
+ } 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: juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/package.html
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/package.html?rev=1455249&view=auto
==============================================================================
--- juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/package.html (added)
+++ juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/package.html Mon Mar 11 17:39:42 2013
@@ -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: juddi/trunk/juddi-core/src/test/java/org/apache/juddi/auth/AuthenticatorTest.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-core/src/test/java/org/apache/juddi/auth/AuthenticatorTest.java?rev=1455249&view=auto
==============================================================================
--- juddi/trunk/juddi-core/src/test/java/org/apache/juddi/auth/AuthenticatorTest.java (added)
+++ juddi/trunk/juddi-core/src/test/java/org/apache/juddi/auth/AuthenticatorTest.java Mon Mar 11 17:39:42 2013
@@ -0,0 +1,175 @@
+/*
+ * 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.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+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.junit.Assert;
+import org.junit.Test;
+
+/**
+ * @author <a href="mailto:kstam@apache.org">Kurt T Stam</a>
+ */
+public class AuthenticatorTest
+{
+ private Log logger = LogFactory.getLog(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");
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@juddi.apache.org
For additional commands, e-mail: commits-help@juddi.apache.org