Repository: juddi
Updated Branches:
  refs/heads/master c9ec98421 -> 2bf444ca1


JUDDI-904 increasing the TCK auth token time out
JUDDI-241 acting the setPublisherAssertion function to be replication api 
friendly. added a number of unit tests to confirm as expected functionalist. 
reducing log4j output for schema validation


Project: http://git-wip-us.apache.org/repos/asf/juddi/repo
Commit: http://git-wip-us.apache.org/repos/asf/juddi/commit/2bf444ca
Tree: http://git-wip-us.apache.org/repos/asf/juddi/tree/2bf444ca
Diff: http://git-wip-us.apache.org/repos/asf/juddi/diff/2bf444ca

Branch: refs/heads/master
Commit: 2bf444ca145066136b67e0d886ef0903a0f42616
Parents: c9ec984
Author: Alex <[email protected]>
Authored: Sat Jan 10 10:28:00 2015 -0500
Committer: Alex <[email protected]>
Committed: Sat Jan 10 10:28:00 2015 -0500

----------------------------------------------------------------------
 .../juddi/api/impl/UDDIPublicationImpl.java     | 196 +++++--
 .../apache/juddi/model/PublisherAssertion.java  |   6 +
 .../src/main/resources/messages.properties      |   3 +-
 .../impl/API_060_PublisherAssertionTest.java    | 520 ++++++++++++++-----
 .../org/apache/juddi/v3/tck/TckBusiness.java    |  16 +-
 .../juddi/v3/tck/TckPublisherAssertion.java     |  21 +-
 uddi-tck/juddiv3Node1.xml                       |   2 +-
 uddi-tck/log4j.properties                       |   2 +-
 .../tck/JUDDI_300_MultiNodeIntegrationTest.java |  50 +-
 9 files changed, 599 insertions(+), 217 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/juddi/blob/2bf444ca/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIPublicationImpl.java
----------------------------------------------------------------------
diff --git 
a/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIPublicationImpl.java 
b/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIPublicationImpl.java
index 63c77ba..9e7c786 100644
--- 
a/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIPublicationImpl.java
+++ 
b/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIPublicationImpl.java
@@ -88,7 +88,6 @@ import org.uddi.repl_v3.ChangeRecordNewData;
 import org.uddi.repl_v3.ChangeRecordPublisherAssertion;
 import org.uddi.v3_service.DispositionReportFaultMessage;
 import org.uddi.v3_service.UDDIPublicationPortType;
-import sun.util.BuddhistCalendar;
 
 /**
  * This class implements the UDDI Publication Service
@@ -334,27 +333,29 @@ public class UDDIPublicationImpl extends 
AuthenticatedService implements UDDIPub
                         List<org.uddi.api_v3.PublisherAssertion> entityList = 
body.getPublisherAssertion();
                         List<ChangeRecord> changes = new 
ArrayList<ChangeRecord>();
                         for (org.uddi.api_v3.PublisherAssertion entity : 
entityList) {
-                                 org.apache.juddi.model.PublisherAssertion 
modelPubAssertion = new org.apache.juddi.model.PublisherAssertion();
+                                org.apache.juddi.model.PublisherAssertion 
modelPubAssertion = new org.apache.juddi.model.PublisherAssertion();
 
                                 
MappingApiToModel.mapPublisherAssertion(entity, modelPubAssertion);
 
-                                org.apache.juddi.model.PublisherAssertion 
existingPubAssertion = em.find(org.apache.juddi.model.PublisherAssertion.class, 
+                                org.apache.juddi.model.PublisherAssertion 
existingPubAssertion = em.find(org.apache.juddi.model.PublisherAssertion.class,
                                         modelPubAssertion.getId());
-                                
-                                boolean fromkey =  
publisher.isOwner(em.find(BusinessEntity.class, entity.getFromKey()));
-                                boolean tokey =  
publisher.isOwner(em.find(BusinessEntity.class, entity.getToKey()));
-                                if (fromkey)
+
+                                boolean fromkey = 
publisher.isOwner(em.find(BusinessEntity.class, entity.getFromKey()));
+                                boolean tokey = 
publisher.isOwner(em.find(BusinessEntity.class, entity.getToKey()));
+                                if (fromkey) {
                                         
existingPubAssertion.setFromCheck("false");
-                                if (tokey)
+                                }
+                                if (tokey) {
                                         
existingPubAssertion.setToCheck("false");
+                                }
                                 if 
("false".equalsIgnoreCase(existingPubAssertion.getToCheck())
-                                        && 
"false".equalsIgnoreCase(existingPubAssertion.getFromCheck()))
+                                        && 
"false".equalsIgnoreCase(existingPubAssertion.getFromCheck())) {
                                         em.remove(existingPubAssertion);
-                                else {
+                                } else {
                                         existingPubAssertion.setModified(new 
Date());
                                         em.persist(existingPubAssertion);
                                 }
-                                
+
                                 
changes.add(getChangeRecord_deletePublisherAssertion(entity, node, fromkey, 
tokey, existingPubAssertion.getModified().getTime()));
                         }
 
@@ -379,8 +380,9 @@ public class UDDIPublicationImpl extends 
AuthenticatedService implements UDDIPub
 
         /**
          * deletes the referenced object, assuming authorization rules are
-         * already processed and there is already an open transaction. this is 
primarily used
-         * to support replication calls, i.e. another node just changed a PA 
record and let us know
+         * already processed and there is already an open transaction. this is
+         * primarily used to support replication calls, i.e. another node just
+         * changed a PA record and let us know
          *
          * @param entityKey
          * @param em
@@ -395,9 +397,8 @@ public class UDDIPublicationImpl extends 
AuthenticatedService implements UDDIPub
                 org.apache.juddi.model.PublisherAssertion existingPubAssertion 
= em.find(org.apache.juddi.model.PublisherAssertion.class,
                         modelPubAssertion.getId());
 
-                if (existingPubAssertion==null){
-                        log.fatal("Can't delete a Publisher Assertion that 
isn't persisted int the database!");
-                        return;
+                if (existingPubAssertion == null) {
+                        throw new FatalErrorException(new 
ErrorMessage("assertionNotFound"));
                 }
                 boolean fromkey = entity.isFromBusinessCheck();// 
publisher.isOwner(em.find(BusinessEntity.class, entity.getFromKey()));
                 boolean tokey = entity.isToBusinessCheck();//  
publisher.isOwner(em.find(BusinessEntity.class, entity.getToKey()));
@@ -467,10 +468,11 @@ public class UDDIPublicationImpl extends 
AuthenticatedService implements UDDIPub
         protected void deleteService(String key, EntityManager em) throws 
DispositionReportFaultMessage {
                 Object obj = 
em.find(org.apache.juddi.model.BusinessService.class, key);
                 //((org.apache.juddi.model.BusinessService) 
obj).getBusinessEntity().setModifiedIncludingChildren(new Date());
-                if (obj!=null)
+                if (obj != null) {
                         em.remove(obj);
-                else
-                        logger.warn("Unable to remove service with the key '" 
+ key +"', it doesn't exist in the database");
+                } else {
+                        logger.warn("Unable to remove service with the key '" 
+ key + "', it doesn't exist in the database");
+                }
         }
 
         /**
@@ -613,7 +615,7 @@ public class UDDIPublicationImpl extends 
AuthenticatedService implements UDDIPub
 
         /**
          * {@inheritdoc}
-         * 
+         *
          */
         public RegisteredInfo getRegisteredInfo(GetRegisteredInfo body)
                 throws DispositionReportFaultMessage {
@@ -694,7 +696,7 @@ public class UDDIPublicationImpl extends 
AuthenticatedService implements UDDIPub
 
         /**
          * {@inheritdoc}
-         * 
+         *
          */
         public BindingDetail saveBinding(SaveBinding body)
                 throws DispositionReportFaultMessage {
@@ -759,7 +761,7 @@ public class UDDIPublicationImpl extends 
AuthenticatedService implements UDDIPub
 
         /**
          * {@inheritdoc}
-         * 
+         *
          */
         public BusinessDetail saveBusiness(SaveBusiness body)
                 throws DispositionReportFaultMessage {
@@ -830,7 +832,7 @@ public class UDDIPublicationImpl extends 
AuthenticatedService implements UDDIPub
 
         /**
          * {@inheritdoc}
-         * 
+         *
          */
         public ServiceDetail saveService(SaveService body)
                 throws DispositionReportFaultMessage {
@@ -863,7 +865,7 @@ public class UDDIPublicationImpl extends 
AuthenticatedService implements UDDIPub
                                 em.persist(modelBusinessService);
 
                                 
result.getBusinessService().add(apiBusinessService);
-                                
+
                                 validator.validateSaveServiceMax(em, 
modelBusinessService.getBusinessEntity().getEntityKey());
                                 
changes.add(getChangeRecord(modelBusinessService, apiBusinessService, node));
                         }
@@ -892,7 +894,7 @@ public class UDDIPublicationImpl extends 
AuthenticatedService implements UDDIPub
 
         /**
          * {@inheritdoc}
-         * 
+         *
          */
         @Override
         public TModelDetail saveTModel(SaveTModel body)
@@ -951,7 +953,7 @@ public class UDDIPublicationImpl extends 
AuthenticatedService implements UDDIPub
 
         /**
          * {@inheritdoc}
-         * 
+         *
          */
         @Override
         public void setPublisherAssertions(String authInfo,
@@ -961,6 +963,7 @@ public class UDDIPublicationImpl extends 
AuthenticatedService implements UDDIPub
 
                 EntityManager em = PersistenceManager.getEntityManager();
                 EntityTransaction tx = em.getTransaction();
+                List<ChangeRecord> changes = new ArrayList<ChangeRecord>();
                 try {
                         tx.begin();
 
@@ -972,40 +975,81 @@ public class UDDIPublicationImpl extends 
AuthenticatedService implements UDDIPub
                         businessKeysFound = 
FindBusinessByPublisherQuery.select(em, null, publisher, businessKeysFound);
 
                         //TODO this has to be reworked to record what was 
deleted.
-                        // First, wipe out all previous assertions associated 
with this publisher
-                        DeletePublisherAssertionByBusinessQuery.delete(em, 
businessKeysFound);
+                        // First, identify all previous assertions that need 
to be removed
+                        List<org.apache.juddi.model.PublisherAssertion> 
existingAssertions = FindPublisherAssertionByBusinessQuery.select(em, 
businessKeysFound, null);
+
+                        logger.info(">>>> Existing assertions " + 
existingAssertions.size() + ", inbound set " + publisherAssertion.value.size());
+                        List<org.apache.juddi.model.PublisherAssertion> 
deleteMe = diff(publisherAssertion.value, existingAssertions);
+                        logger.info(">>>> DIFF size is " + deleteMe.size());
+                        for (org.apache.juddi.model.PublisherAssertion del : 
deleteMe) {
+                                logger.info(">>>> PROCESSING " + 
del.getBusinessEntityByFromKey().getEntityKey() + " " + 
del.getBusinessEntityByToKey().getEntityKey());
+                                boolean from = false;
+                                if (del.getFromCheck() != null) {
+                                        
del.getFromCheck().equalsIgnoreCase("true");
+                                }
+                                boolean to = false;
+                                if (del.getToCheck() != null) {
+                                        
del.getToCheck().equalsIgnoreCase("true");
+                                }
+                                if 
(publisher.isOwner(del.getBusinessEntityByFromKey())) {
+                                        from = false;
+                                }
+                                if 
(publisher.isOwner(del.getBusinessEntityByToKey())) {
+                                        to = false;
+                                }
+                                PublisherAssertion api = new 
PublisherAssertion();
+                                MappingModelToApi.mapPublisherAssertion(del, 
api);
+
+                                if (!to && !from) {
+                                        logger.info(">>>> DELETE ME " + 
del.getBusinessEntityByFromKey().getEntityKey() + " " + 
del.getBusinessEntityByToKey().getEntityKey());
+                                        em.remove(del);
+                                } else {
+                                        logger.info(">>>> MERGING ME " + 
del.getBusinessEntityByFromKey().getEntityKey() + " " + 
del.getBusinessEntityByToKey().getEntityKey());
+                                        del.setFromCheck(from ? "true" : 
"false");
+                                        del.setToCheck(to ? "true" : "false");
+                                        del.setModified(new Date());
+                                        em.merge(del);
+                                }
+                                
changes.add(getChangeRecord_deletePublisherAssertion(api, node, to, from, 
System.currentTimeMillis()));
+                        }
+                        //DeletePublisherAssertionByBusinessQuery.delete(em, 
businessKeysFound);
 
                         // Slate is clean for all assertions involving this 
publisher, now we simply need to add the new ones (and they will all be "new").
-                        List<org.uddi.api_v3.PublisherAssertion> 
apiPubAssertionList = publisherAssertion.value;
-
-                        List<ChangeRecord> changes = new 
ArrayList<ChangeRecord>();
-                        for (org.uddi.api_v3.PublisherAssertion 
apiPubAssertion : apiPubAssertionList) {
+                        /*List<org.uddi.api_v3.PublisherAssertion> 
apiPubAssertionList = publisherAssertion.value;
 
-                                org.apache.juddi.model.PublisherAssertion 
modelPubAssertion = new org.apache.juddi.model.PublisherAssertion();
+                        
+                         for (org.uddi.api_v3.PublisherAssertion 
apiPubAssertion : apiPubAssertionList) {
 
-                                
MappingApiToModel.mapPublisherAssertion(apiPubAssertion, modelPubAssertion);
+                         org.apache.juddi.model.PublisherAssertion 
modelPubAssertion = new org.apache.juddi.model.PublisherAssertion();
 
-                                org.apache.juddi.model.BusinessEntity beFrom = 
em.find(org.apache.juddi.model.BusinessEntity.class, 
modelPubAssertion.getId().getFromKey());
-                                org.apache.juddi.model.BusinessEntity beTo = 
em.find(org.apache.juddi.model.BusinessEntity.class, 
modelPubAssertion.getId().getToKey());
-                                
modelPubAssertion.setBusinessEntityByFromKey(beFrom);
-                                
modelPubAssertion.setBusinessEntityByToKey(beTo);
+                         
MappingApiToModel.mapPublisherAssertion(apiPubAssertion, modelPubAssertion);
+                                
+                         org.apache.juddi.model.BusinessEntity beFrom = 
em.find(org.apache.juddi.model.BusinessEntity.class, 
modelPubAssertion.getId().getFromKey());
+                         org.apache.juddi.model.BusinessEntity beTo = 
em.find(org.apache.juddi.model.BusinessEntity.class, 
modelPubAssertion.getId().getToKey());
+                         modelPubAssertion.setBusinessEntityByFromKey(beFrom);
+                         modelPubAssertion.setBusinessEntityByToKey(beTo);
 
-                                modelPubAssertion.setFromCheck("false");
-                                modelPubAssertion.setToCheck("false");
+                         modelPubAssertion.setFromCheck("false");
+                         modelPubAssertion.setToCheck("false");
 
-                                if 
(publisher.isOwner(modelPubAssertion.getBusinessEntityByFromKey())) {
-                                        modelPubAssertion.setFromCheck("true");
-                                }
-                                if 
(publisher.isOwner(modelPubAssertion.getBusinessEntityByToKey())) {
-                                        modelPubAssertion.setToCheck("true");
-                                }
-                                em.persist(modelPubAssertion);
-
-                                
changes.add(getChangeRecord_NewAssertion(apiPubAssertion, modelPubAssertion, 
node));
+                         if 
(publisher.isOwner(modelPubAssertion.getBusinessEntityByFromKey())) {
+                         modelPubAssertion.setFromCheck("true");
+                         }
+                         if 
(publisher.isOwner(modelPubAssertion.getBusinessEntityByToKey())) {
+                         modelPubAssertion.setToCheck("true");
+                         }
+                         em.persist(modelPubAssertion);
 
-                        }
+                         
changes.add(getChangeRecord_NewAssertion(apiPubAssertion, modelPubAssertion, 
node));
 
+                         }*/
                         tx.commit();
+                        if (!publisherAssertion.value.isEmpty()) {
+                                AddPublisherAssertions addPublisherAssertions 
= new AddPublisherAssertions();
+                                addPublisherAssertions.setAuthInfo(authInfo);
+                                
addPublisherAssertions.getPublisherAssertion().addAll(publisherAssertion.value);
+                                addPublisherAssertions(addPublisherAssertions);
+                        }
                         for (int i = 0; i < changes.size(); i++) {
                                 ReplicationNotifier.Enqueue(changes.get(i));
                         }
@@ -1266,9 +1310,10 @@ public class UDDIPublicationImpl extends 
AuthenticatedService implements UDDIPub
 
         /**
          * this is for "hiding" a tmodel, not removing it entirely
+         *
          * @param entityKey
          * @param node
-         * @return 
+         * @return
          */
         public static ChangeRecord getChangeRecord_deleteTModelHide(String 
entityKey, String node) {
                 ChangeRecord cr = new ChangeRecord();
@@ -1277,7 +1322,7 @@ public class UDDIPublicationImpl extends 
AuthenticatedService implements UDDIPub
                 cr.setRecordType(ChangeRecord.RecordType.ChangeRecordHide);
                 org.uddi.repl_v3.ChangeRecord crapi = new 
org.uddi.repl_v3.ChangeRecord();
                 crapi.setChangeID(new ChangeRecordIDType(node, -1L));
-                
+
                 crapi.setChangeRecordHide(new ChangeRecordHide());
                 crapi.getChangeRecordHide().setTModelKey(entityKey);
                 
crapi.getChangeRecordHide().setModified(df.newXMLGregorianCalendar(new 
GregorianCalendar()));
@@ -1292,12 +1337,13 @@ public class UDDIPublicationImpl extends 
AuthenticatedService implements UDDIPub
                 }
                 return cr;
         }
-        
+
         /**
          * this is for deleting a tmodel, not hiding it
+         *
          * @param entityKey
          * @param node
-         * @return 
+         * @return
          */
         public static ChangeRecord getChangeRecord_deleteTModelDelete(String 
entityKey, String node) {
                 ChangeRecord cr = new ChangeRecord();
@@ -1306,7 +1352,7 @@ public class UDDIPublicationImpl extends 
AuthenticatedService implements UDDIPub
                 cr.setRecordType(ChangeRecord.RecordType.ChangeRecordHide);
                 org.uddi.repl_v3.ChangeRecord crapi = new 
org.uddi.repl_v3.ChangeRecord();
                 crapi.setChangeID(new ChangeRecordIDType(node, -1L));
-                
+
                 crapi.setChangeRecordDelete(new ChangeRecordDelete());
                 crapi.getChangeRecordDelete().setTModelKey(entityKey);
                 
crapi.getChangeRecordDelete().setModified(df.newXMLGregorianCalendar(new 
GregorianCalendar()));
@@ -1346,11 +1392,11 @@ public class UDDIPublicationImpl extends 
AuthenticatedService implements UDDIPub
 
         public static ChangeRecord getChangeRecord(Tmodel modelBusinessEntity, 
org.uddi.api_v3.TModel apiBusinessEntity, String node) throws 
DispositionReportFaultMessage {
                 ChangeRecord cr = new ChangeRecord();
-                if 
(!apiBusinessEntity.getTModelKey().equals(modelBusinessEntity.getEntityKey()))
+                if 
(!apiBusinessEntity.getTModelKey().equals(modelBusinessEntity.getEntityKey())) {
                         throw new FatalErrorException(new 
ErrorMessage("E_fatalError", "the model and api keys do not match when saving a 
tmodel!"));
+                }
                 cr.setEntityKey(modelBusinessEntity.getEntityKey());
                 cr.setNodeID(node);
-                
 
                 cr.setRecordType(ChangeRecord.RecordType.ChangeRecordNewData);
                 org.uddi.repl_v3.ChangeRecord crapi = new 
org.uddi.repl_v3.ChangeRecord();
@@ -1443,4 +1489,40 @@ public class UDDIPublicationImpl extends 
AuthenticatedService implements UDDIPub
                 return cr;
         }
 
+        /**
+         *
+         * @param value keep these
+         * @param existingAssertions return a list of these that are NOT in
+         * 'value'
+         * @return
+         * @throws DispositionReportFaultMessage
+         */
+        private List<org.apache.juddi.model.PublisherAssertion> 
diff(List<PublisherAssertion> value, 
List<org.apache.juddi.model.PublisherAssertion> existingAssertions) throws 
DispositionReportFaultMessage {
+                List<org.apache.juddi.model.PublisherAssertion> ret = new 
ArrayList<org.apache.juddi.model.PublisherAssertion>();
+                if (value == null || value.isEmpty()) {
+                        return existingAssertions;
+                }
+                if (existingAssertions == null) {
+                        return new 
ArrayList<org.apache.juddi.model.PublisherAssertion>();
+                }
+                for (org.apache.juddi.model.PublisherAssertion model : 
existingAssertions) {
+
+                        boolean found = false;
+                        for (PublisherAssertion paapi : value) {
+                                if 
(model.getBusinessEntityByFromKey().getEntityKey().equalsIgnoreCase(paapi.getFromKey())
+                                        && 
model.getBusinessEntityByToKey().getEntityKey().equalsIgnoreCase(paapi.getToKey())
+                                        && 
model.getKeyName().equals(paapi.getKeyedReference().getKeyName())
+                                        && 
model.getKeyValue().equals(paapi.getKeyedReference().getKeyValue())
+                                        && 
model.getTmodelKey().equalsIgnoreCase(paapi.getKeyedReference().getTModelKey()))
 {
+                                        found = true;
+                                        break;
+                                }
+                        }
+                        if (!found) {
+                                ret.add(model);
+                        }
+                }
+                return ret;
+        }
+
 }

http://git-wip-us.apache.org/repos/asf/juddi/blob/2bf444ca/juddi-core/src/main/java/org/apache/juddi/model/PublisherAssertion.java
----------------------------------------------------------------------
diff --git 
a/juddi-core/src/main/java/org/apache/juddi/model/PublisherAssertion.java 
b/juddi-core/src/main/java/org/apache/juddi/model/PublisherAssertion.java
index 742c252..da07e13 100644
--- a/juddi-core/src/main/java/org/apache/juddi/model/PublisherAssertion.java
+++ b/juddi-core/src/main/java/org/apache/juddi/model/PublisherAssertion.java
@@ -162,4 +162,10 @@ public class PublisherAssertion implements 
java.io.Serializable {
        public void setToCheck(String toCheck) {
                this.toCheck = toCheck;
        }
+        
+        @Override
+        public boolean equals(Object compareto){
+                PublisherAssertion rhs = (PublisherAssertion) compareto;
+                return (this.id.equals(rhs.id));
+        }
 }

http://git-wip-us.apache.org/repos/asf/juddi/blob/2bf444ca/juddi-core/src/main/resources/messages.properties
----------------------------------------------------------------------
diff --git a/juddi-core/src/main/resources/messages.properties 
b/juddi-core/src/main/resources/messages.properties
index c326d56..5b7addb 100644
--- a/juddi-core/src/main/resources/messages.properties
+++ b/juddi-core/src/main/resources/messages.properties
@@ -300,4 +300,5 @@ errors.replication.contactNull=No replication contact was 
present in the message
 errors.deleteNode.InReplicationConfig=The node to be deleted is currently 
referenced in the replication configuration. You must revise the configuration 
before deleting the node, 
 errors.usermismatch.InvalidNode=The user is not authorized to alter the given 
entity. It is not owned by this jUDDI node. Try your request again on the 
authoritative node.
 
-errors.usermismatch.assertion=You have to be either the owner of the 'from' or 
'to' business in order to delete a publisher assertion.
\ No newline at end of file
+errors.usermismatch.assertion=You have to be either the owner of the 'from' or 
'to' business in order to delete a publisher assertion.
+errors.assertionNotFound=The referenced publisher assertion isn't in the 
database!
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/juddi/blob/2bf444ca/juddi-core/src/test/java/org/apache/juddi/api/impl/API_060_PublisherAssertionTest.java
----------------------------------------------------------------------
diff --git 
a/juddi-core/src/test/java/org/apache/juddi/api/impl/API_060_PublisherAssertionTest.java
 
b/juddi-core/src/test/java/org/apache/juddi/api/impl/API_060_PublisherAssertionTest.java
index 50ce739..e11148f 100644
--- 
a/juddi-core/src/test/java/org/apache/juddi/api/impl/API_060_PublisherAssertionTest.java
+++ 
b/juddi-core/src/test/java/org/apache/juddi/api/impl/API_060_PublisherAssertionTest.java
@@ -17,14 +17,20 @@ package org.apache.juddi.api.impl;
 /**
  * @author <a href="mailto:[email protected]";>Jeff Faath</a>
  * @author <a href="mailto:[email protected]";>Kurt T Stam</a>
+ * * @author <a href="mailto:[email protected]";>Kurt T Stam</a>
  */
 import java.rmi.RemoteException;
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.JAXB;
+import javax.xml.ws.Holder;
 
 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.jaxb.EntityCreator;
+import org.apache.juddi.v3.client.UDDIConstants;
 import org.apache.juddi.v3.tck.TckBusiness;
 import org.apache.juddi.v3.tck.TckFindEntity;
 import org.apache.juddi.v3.tck.TckPublisher;
@@ -35,156 +41,394 @@ import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.BeforeClass;
 import org.junit.Test;
+import org.uddi.api_v3.AssertionStatusItem;
+import org.uddi.api_v3.CompletionStatus;
 import org.uddi.api_v3.DeletePublisherAssertions;
+import org.uddi.api_v3.KeyedReference;
 import org.uddi.api_v3.PublisherAssertion;
 import org.uddi.v3_service.DispositionReportFaultMessage;
 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);
-               }
-       }
-        
+
+        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;
+        private static UDDIPublicationImpl pub = new UDDIPublicationImpl();
+
+        @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());
+                        String root = TckSecurity.getAuthToken(security, 
TckPublisher.getUDDIPublisherId(), TckPublisher.getUDDIPassword());
+                         tckTModel.saveTmodels(root);
+                } catch (RemoteException e) {
+                        logger.error(e.getMessage(), e);
+                        Assert.fail("Could not obtain authInfo token." + 
e.getMessage());
+                }
+        }
+
+        @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);
+                }
+        }
+
         /**
-         * covers <a 
href="https://issues.apache.org/jira/browse/JUDDI-908";>JUDDI-908</a>
+         * 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);
+                }
+        }
 
-         * @throws Exception 
+        /**
+         * 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);
+                }
+        }
+
+        /**
+         * covers
+         * <a 
href="https://issues.apache.org/jira/browse/JUDDI-908";>JUDDI-908</a>
+         *
+         * @throws Exception
          */
         @Test(expected = DispositionReportFaultMessage.class)
-        public void deleteAssertionNonowner() throws Exception{
+        public void deleteAssertionNonowner() throws Exception {
                 try {
-                       tckTModel.saveJoePublisherTmodel(authInfoJoe);
-                       tckTModel.saveSamSyndicatorTmodel(authInfoSam);
-                       tckBusiness.saveJoePublisherBusiness(authInfoJoe);
-                       tckBusiness.saveSamSyndicatorBusiness(authInfoSam);
-                       
tckAssertion.saveJoePublisherPublisherAssertion(authInfoJoe);   
-                      
-                       DeletePublisherAssertions dp = new 
DeletePublisherAssertions();
-                       dp.setAuthInfo(authInfoMary);
-                       
-                       PublisherAssertion paIn = 
(PublisherAssertion)EntityCreator.buildFromDoc(TckPublisherAssertion.JOE_ASSERT_XML,
 "org.uddi.api_v3");
-                       dp.getPublisherAssertion().add(paIn);
-                       
+                        tckTModel.saveJoePublisherTmodel(authInfoJoe);
+                        tckTModel.saveSamSyndicatorTmodel(authInfoSam);
+                        tckBusiness.saveJoePublisherBusiness(authInfoJoe);
+                        tckBusiness.saveSamSyndicatorBusiness(authInfoSam);
+                        
tckAssertion.saveJoePublisherPublisherAssertion(authInfoJoe);
+
+                        DeletePublisherAssertions dp = new 
DeletePublisherAssertions();
+                        dp.setAuthInfo(authInfoMary);
+
+                        PublisherAssertion paIn = (PublisherAssertion) 
EntityCreator.buildFromDoc(TckPublisherAssertion.JOE_ASSERT_XML, 
"org.uddi.api_v3");
+                        dp.getPublisherAssertion().add(paIn);
+
                         new 
UDDIPublicationImpl().deletePublisherAssertions(dp);
-                       //
-               } finally {
+                        //
+                } finally {
                         
tckAssertion.deleteJoePublisherPublisherAssertion(authInfoJoe);
-                       tckBusiness.deleteJoePublisherBusiness(authInfoJoe);
-                       tckBusiness.deleteSamSyndicatorBusiness(authInfoSam);
-                       tckTModel.deleteJoePublisherTmodel(authInfoJoe);
-                       tckTModel.deleteSamSyndicatorTmodel(authInfoSam);
-               }
+                        tckBusiness.deleteJoePublisherBusiness(authInfoJoe);
+                        tckBusiness.deleteSamSyndicatorBusiness(authInfoSam);
+                        tckTModel.deleteJoePublisherTmodel(authInfoJoe);
+                        tckTModel.deleteSamSyndicatorTmodel(authInfoSam);
+                }
+        }
+
+        @Test
+        public void testSetPublisherAssertions() throws Exception {
+                //create 1/2 PA
+
+                //use Set with no inputs
+                //confirm all are deleted
+                try {
+                       
+                        tckTModel.saveJoePublisherTmodel(authInfoJoe);
+                        tckTModel.saveSamSyndicatorTmodel(authInfoSam);
+                        tckBusiness.saveJoePublisherBusiness(authInfoJoe);
+                        tckBusiness.saveSamSyndicatorBusiness(authInfoSam);
+                        Holder<List<PublisherAssertion>> x =  new 
Holder<List<PublisherAssertion>>();
+                        x.value = new ArrayList<PublisherAssertion>();
+                        logger.info("Clearing all Joe's publisher 
assertions....");
+                        pub.setPublisherAssertions(authInfoJoe, x);
+                        
+                        logger.info("Clearing all Sam's publisher 
assertions....");
+                        pub.setPublisherAssertions(authInfoSam, x);
+                        
+                        
+                        
+                        logger.info("Confirming we're clear");
+                         List<PublisherAssertion> before = 
pub.getPublisherAssertions(authInfoJoe);
+                        Assert.assertNotNull(before);
+                        Assert.assertTrue(before.isEmpty());
+                         System.out.println(before.size());
+                        for (int i = 0; i < before.size(); i++) {
+                                JAXB.marshal(before.get(i), System.out);
+                        }
+                        
+                        before = pub.getPublisherAssertions(authInfoSam);
+                        Assert.assertNotNull(before);
+                        Assert.assertTrue(before.isEmpty());
+                         System.out.println(before.size());
+                        for (int i = 0; i < before.size(); i++) {
+                                JAXB.marshal(before.get(i), System.out);
+                        }
+                        
+                        List<AssertionStatusItem> assertionStatusReport = 
pub.getAssertionStatusReport(authInfoJoe, null);
+                        Assert.assertTrue(assertionStatusReport.isEmpty());
+                        
+                        assertionStatusReport = 
pub.getAssertionStatusReport(authInfoSam, null);
+                        Assert.assertTrue(assertionStatusReport.isEmpty());
+                        
+                        logger.info("Saving 1/2 publisher assertion....");
+                        List<PublisherAssertion> onehalfPA = 
tckAssertion.saveJoePublisherPublisherAssertion(authInfoJoe);
+
+                        
+                        before = pub.getPublisherAssertions(authInfoJoe);
+                        Assert.assertNotNull(before);
+                        Assert.assertFalse(before.isEmpty());
+                         System.out.println(before.size());
+                        for (int i = 0; i < before.size(); i++) {
+                                JAXB.marshal(before.get(i), System.out);
+                        }
+                        //PublisherAssertion paIn = 
(PublisherAssertion)EntityCreator.buildFromDoc(TckPublisherAssertion.JOE_ASSERT_XML,
 "org.uddi.api_v3");
+                        //dp.getPublisherAssertion().add(paIn);
+                        x =  new Holder<List<PublisherAssertion>>();
+                        x.value = new ArrayList<PublisherAssertion>();
+                        logger.info("Clearing all publisher assertions....");
+                        pub.setPublisherAssertions(authInfoJoe, x);
+                        System.out.println(x.value.size());
+                        for (int i = 0; i < x.value.size(); i++) {
+                                JAXB.marshal(x.value.get(i), System.out);
+                        }
+
+                         logger.info("Fetch all publisher assertions....there 
should be none");
+                        List<PublisherAssertion> publisherAssertions = 
pub.getPublisherAssertions(authInfoJoe);
+                        System.out.println(publisherAssertions.size());
+                        for (int i = 0; i < publisherAssertions.size(); i++) {
+                                JAXB.marshal(publisherAssertions.get(i), 
System.out);
+                        }
+                        Assert.assertNotNull(publisherAssertions);
+                        Assert.assertTrue(publisherAssertions.isEmpty());
+                        //
+                } finally {
+                        
//tckAssertion.deleteJoePublisherPublisherAssertion(authInfoJoe);
+                        tckBusiness.deleteJoePublisherBusiness(authInfoJoe);
+                        tckBusiness.deleteSamSyndicatorBusiness(authInfoSam);
+                        tckTModel.deleteJoePublisherTmodel(authInfoJoe);
+                        tckTModel.deleteSamSyndicatorTmodel(authInfoSam);
+                }
+        }
+
+        @Test
+        public void testSetPublisherAssertions2() throws Exception {
+                //create 1/2 PA
+
+                //use Set with the same 1/2 PA
+                //confirm still present
+                try {
+                        tckTModel.saveJoePublisherTmodel(authInfoJoe);
+                        tckTModel.saveSamSyndicatorTmodel(authInfoSam);
+                        tckBusiness.saveJoePublisherBusiness(authInfoJoe);
+                        tckBusiness.saveSamSyndicatorBusiness(authInfoSam);
+                        List<PublisherAssertion> onehalfPA = 
tckAssertion.saveJoePublisherPublisherAssertion(authInfoJoe);
+
+                        List<PublisherAssertion> before = 
pub.getPublisherAssertions(authInfoJoe);
+                        Assert.assertNotNull(before);
+                        Assert.assertFalse(before.isEmpty());
+
+                        pub.setPublisherAssertions(authInfoJoe, new 
Holder<List<PublisherAssertion>>(onehalfPA));
+                        List<PublisherAssertion> publisherAssertions = 
pub.getPublisherAssertions(authInfoJoe);
+                        Assert.assertNotNull(publisherAssertions);
+                        Assert.assertFalse(publisherAssertions.isEmpty());
+                        //
+                } finally {
+                        
//tckAssertion.deleteJoePublisherPublisherAssertion(authInfoJoe);
+                        tckBusiness.deleteJoePublisherBusiness(authInfoJoe);
+                        tckBusiness.deleteSamSyndicatorBusiness(authInfoSam);
+                        tckTModel.deleteJoePublisherTmodel(authInfoJoe);
+                        tckTModel.deleteSamSyndicatorTmodel(authInfoSam);
+                }
+        }
+
+        @Test
+        public void testSetPublisherAssertions3() throws Exception {
+                //create 1/2 PA
+                //use Set with a new PA
+                //confirm first PA is gone and the new PA exists
+                  try {
+                       
+                        tckTModel.saveJoePublisherTmodel(authInfoJoe);
+                        tckTModel.saveSamSyndicatorTmodel(authInfoSam);
+                        tckTModel.saveMaryPublisherTmodel(authInfoMary);
+                        tckBusiness.saveJoePublisherBusiness(authInfoJoe);
+                        tckBusiness.saveSamSyndicatorBusiness(authInfoSam);
+                        tckBusiness.saveMaryPublisherBusiness(authInfoMary);
+                        Holder<List<PublisherAssertion>> x =  new 
Holder<List<PublisherAssertion>>();
+                        x.value = new ArrayList<PublisherAssertion>();
+                        logger.info("Clearing all Joe's publisher 
assertions....");
+                        pub.setPublisherAssertions(authInfoJoe, x);
+                        
+                        logger.info("Clearing all Sam's publisher 
assertions....");
+                        pub.setPublisherAssertions(authInfoSam, x);
+                        
+                        logger.info("Clearing all Mary's publisher 
assertions....");
+                        pub.setPublisherAssertions(authInfoMary, x);
+                        
+                        
+                        
+                        logger.info("Confirming we're clear");
+                         List<PublisherAssertion> before = 
pub.getPublisherAssertions(authInfoJoe);
+                        Assert.assertNotNull(before);
+                        
+                         System.out.println(before.size());
+                        for (int i = 0; i < before.size(); i++) {
+                                JAXB.marshal(before.get(i), System.out);
+                        }Assert.assertTrue(before.isEmpty());
+                        
+                        before = pub.getPublisherAssertions(authInfoSam);
+                        Assert.assertNotNull(before);
+                        
+                         System.out.println(before.size());
+                        for (int i = 0; i < before.size(); i++) {
+                                JAXB.marshal(before.get(i), System.out);
+                        }Assert.assertTrue(before.isEmpty());
+                        
+                        before = pub.getPublisherAssertions(authInfoMary);
+                        Assert.assertNotNull(before);
+                        
+                         System.out.println(before.size());
+                        for (int i = 0; i < before.size(); i++) {
+                                JAXB.marshal(before.get(i), System.out);
+                        }Assert.assertTrue(before.isEmpty());
+                        
+                        List<AssertionStatusItem> assertionStatusReport = 
pub.getAssertionStatusReport(authInfoJoe, null);
+                        Assert.assertTrue(assertionStatusReport.isEmpty());
+                        
+                        assertionStatusReport = 
pub.getAssertionStatusReport(authInfoSam, null);
+                        Assert.assertTrue(assertionStatusReport.isEmpty());
+                        
+                        assertionStatusReport = 
pub.getAssertionStatusReport(authInfoMary, null);
+                        Assert.assertTrue(assertionStatusReport.isEmpty());
+                        
+                        logger.info("Saving 1/2 publisher assertion....");
+                        List<PublisherAssertion> onehalfPA = 
tckAssertion.saveJoePublisherPublisherAssertion(authInfoJoe);
+
+                        
+                        before = pub.getPublisherAssertions(authInfoJoe);
+                        Assert.assertNotNull(before);
+                        Assert.assertFalse(before.isEmpty());
+                         System.out.println(before.size());
+                        for (int i = 0; i < before.size(); i++) {
+                                JAXB.marshal(before.get(i), System.out);
+                        }
+                        //PublisherAssertion paIn = 
(PublisherAssertion)EntityCreator.buildFromDoc(TckPublisherAssertion.JOE_ASSERT_XML,
 "org.uddi.api_v3");
+                        //dp.getPublisherAssertion().add(paIn);
+                        x =  new Holder<List<PublisherAssertion>>();
+                        x.value = new ArrayList<PublisherAssertion>();
+                        PublisherAssertion pa = new PublisherAssertion();
+                        
+                        pa.setFromKey(TckBusiness.JOE_BUSINESS_KEY);
+                        pa.setToKey(TckBusiness.MARY_BUSINESS_KEY);
+                        pa.setKeyedReference(new 
KeyedReference(UDDIConstants.RELATIONSHIPS, "parent-child", "child"));
+                        
+                        x.value.add(pa);
+                        logger.info("Using set to clear existing and add a new 
publisher assertion....");
+                        pub.setPublisherAssertions(authInfoJoe, x);
+                        System.out.println(x.value.size());
+                        for (int i = 0; i < x.value.size(); i++) {
+                                JAXB.marshal(x.value.get(i), System.out);
+                        }
+
+                         logger.info("Fetch all publisher assertions....there 
should be 1");
+                        List<PublisherAssertion> publisherAssertions = 
pub.getPublisherAssertions(authInfoJoe);
+                        System.out.println(publisherAssertions.size());
+                        for (int i = 0; i < publisherAssertions.size(); i++) {
+                                JAXB.marshal(publisherAssertions.get(i), 
System.out);
+                        }
+                        
Assert.assertEquals(publisherAssertions.get(0).getFromKey(), pa.getFromKey());
+                        
Assert.assertEquals(publisherAssertions.get(0).getToKey(), pa.getToKey());
+                        
Assert.assertEquals(publisherAssertions.get(0).getKeyedReference().getKeyName(),
 pa.getKeyedReference().getKeyName());
+                        
Assert.assertEquals(publisherAssertions.get(0).getKeyedReference().getKeyValue(),
 pa.getKeyedReference().getKeyValue());
+                        
Assert.assertEquals(publisherAssertions.get(0).getKeyedReference().getTModelKey(),
 pa.getKeyedReference().getTModelKey());
+                        
+                        //
+                } finally {
+                        
//tckAssertion.deleteJoePublisherPublisherAssertion(authInfoJoe);
+                        tckBusiness.deleteJoePublisherBusiness(authInfoJoe);
+                        tckBusiness.deleteSamSyndicatorBusiness(authInfoSam);
+                        tckBusiness.deleteMaryPublisherBusiness(authInfoMary);
+                        tckTModel.deleteJoePublisherTmodel(authInfoJoe);
+                        tckTModel.deleteSamSyndicatorTmodel(authInfoSam);
+                        tckTModel.deleteMaryPublisherTmodel(authInfoMary);
+                }
+                  
         }
 }

http://git-wip-us.apache.org/repos/asf/juddi/blob/2bf444ca/uddi-tck-base/src/main/java/org/apache/juddi/v3/tck/TckBusiness.java
----------------------------------------------------------------------
diff --git 
a/uddi-tck-base/src/main/java/org/apache/juddi/v3/tck/TckBusiness.java 
b/uddi-tck-base/src/main/java/org/apache/juddi/v3/tck/TckBusiness.java
index 87e02a3..8710558 100644
--- a/uddi-tck-base/src/main/java/org/apache/juddi/v3/tck/TckBusiness.java
+++ b/uddi-tck-base/src/main/java/org/apache/juddi/v3/tck/TckBusiness.java
@@ -184,7 +184,7 @@ public class TckBusiness {
 
                 } catch (Throwable e) {
                         logger.error(e.getMessage(), e);
-                        Assert.fail("No exception should be thrown");
+                        Assert.fail("No exception should be thrown " + 
e.getMessage());
                 }
         }
 
@@ -204,7 +204,7 @@ public class TckBusiness {
                         }
                 } catch (RemoteException e) {
                         logger.error(e.getMessage(), e);
-                        Assert.fail("No exception should be thrown");
+                        Assert.fail("No exception should be thrown " + 
e.getMessage());
                 }
         }
 
@@ -224,7 +224,7 @@ public class TckBusiness {
                         publication.saveBusiness(sb);
                 } catch (Throwable e) {
                         logger.error(e.getMessage(), e);
-                        Assert.fail("No exception should be thrown");
+                        Assert.fail("No exception should be thrown " + 
e.getMessage());
                 }
         }
 
@@ -240,7 +240,7 @@ public class TckBusiness {
                         assertTrue("Signature invalid!", sigOk);
                 } catch (Throwable e) {
                         logger.error(e.getMessage(), e);
-                        Assert.fail("No exception should be thrown");
+                        Assert.fail("No exception should be thrown " + 
e.getMessage());
                 }
         }
 
@@ -331,7 +331,7 @@ public class TckBusiness {
                         return beOut;
                 } catch (Throwable e) {
                         logger.error(e.getMessage(), e);
-                        Assert.fail("No exception should be thrown");
+                        Assert.fail("No exception should be thrown " + 
e.getMessage());
                 }
                 return null;
 
@@ -372,7 +372,7 @@ public class TckBusiness {
 
                 } catch (Throwable e) {
                         logger.error(e.getMessage(), e);
-                        Assert.fail("No exception should be thrown");
+                        Assert.fail("No exception should be thrown " + 
e.getMessage());
                 }
 
         }
@@ -391,7 +391,7 @@ public class TckBusiness {
 
                 } catch (Exception e) {
                         logger.error(e.getMessage(), e);
-                        Assert.fail("No exception should be thrown");
+                        Assert.fail("No exception should be thrown " + 
e.getMessage());
                 }
         }
 
@@ -405,7 +405,7 @@ public class TckBusiness {
 
                 } catch (Exception e) {
                         logger.error(e.getMessage(), e);
-                        Assert.fail("No exception should be thrown");
+                        Assert.fail("No exception should be thrown " + 
e.getMessage());
                 }
         }
 }

http://git-wip-us.apache.org/repos/asf/juddi/blob/2bf444ca/uddi-tck-base/src/main/java/org/apache/juddi/v3/tck/TckPublisherAssertion.java
----------------------------------------------------------------------
diff --git 
a/uddi-tck-base/src/main/java/org/apache/juddi/v3/tck/TckPublisherAssertion.java
 
b/uddi-tck-base/src/main/java/org/apache/juddi/v3/tck/TckPublisherAssertion.java
index a7726e3..ef2b22d 100644
--- 
a/uddi-tck-base/src/main/java/org/apache/juddi/v3/tck/TckPublisherAssertion.java
+++ 
b/uddi-tck-base/src/main/java/org/apache/juddi/v3/tck/TckPublisherAssertion.java
@@ -46,20 +46,20 @@ public class TckPublisherAssertion
                this.publication = publication;
        }
        
-       public void saveJoePublisherPublisherAssertion(String authInfoJoe) {
-               addPublisherAssertion(authInfoJoe, JOE_ASSERT_XML);
+       public List<PublisherAssertion> 
saveJoePublisherPublisherAssertion(String authInfoJoe) {
+               return addPublisherAssertion(authInfoJoe, JOE_ASSERT_XML);
        }
        
-       public void saveSamPublisherPublisherAssertion(String authInfoSam) {
-               addPublisherAssertion(authInfoSam, SAM_ASSERT_XML);
+       public List<PublisherAssertion> 
saveSamPublisherPublisherAssertion(String authInfoSam) {
+               return addPublisherAssertion(authInfoSam, SAM_ASSERT_XML);
        }
        
-       public void saveMaryPublisherPublisherAssertion(String authInfoMary) {
-               addPublisherAssertion(authInfoMary, MARY_ASSERT_XML);
+       public List<PublisherAssertion> 
saveMaryPublisherPublisherAssertion(String authInfoMary) {
+               return addPublisherAssertion(authInfoMary, MARY_ASSERT_XML);
        }
        
-       public void saveJoePublisherPublisherAssertion2(String authInfoJoe) {
-               addPublisherAssertion(authInfoJoe, JOE_ASSERT2_XML);
+       public List<PublisherAssertion> 
saveJoePublisherPublisherAssertion2(String authInfoJoe) {
+               return addPublisherAssertion(authInfoJoe, JOE_ASSERT2_XML);
        }
        
        public void deleteJoePublisherPublisherAssertion(String authInfoJoe) {
@@ -79,7 +79,7 @@ public class TckPublisherAssertion
        }
 
        
-       public void addPublisherAssertion(String authInfo, String pubassertXML) 
{
+       public List<PublisherAssertion> addPublisherAssertion(String authInfo, 
String pubassertXML) {
                try {
                        AddPublisherAssertions ap = new 
AddPublisherAssertions();
                        ap.setAuthInfo(authInfo);
@@ -103,13 +103,14 @@ public class TckPublisherAssertion
                                assertEquals(keyRefIn.getKeyName(), 
keyRefOut.getKeyName());
                                assertEquals(keyRefIn.getKeyValue(), 
keyRefOut.getKeyValue());
                        }
+                        return paOutList;
                        
                }
                catch(Exception e) {
                        logger.error(e.getMessage(), e);
                        Assert.fail("No exception should be thrown");
                }
-
+                return null;
        }
 
        public void deletePublisherAssertion(String authInfo, String 
pubassertXML) {

http://git-wip-us.apache.org/repos/asf/juddi/blob/2bf444ca/uddi-tck/juddiv3Node1.xml
----------------------------------------------------------------------
diff --git a/uddi-tck/juddiv3Node1.xml b/uddi-tck/juddiv3Node1.xml
index 7415a37..a930b12 100644
--- a/uddi-tck/juddiv3Node1.xml
+++ b/uddi-tck/juddiv3Node1.xml
@@ -144,7 +144,7 @@
                                <!-- Time in minutes to expire tokes after 
inactivity-->
                                <Timeout>15</Timeout>
                                <!-- As of 3.1.5 Duration of time for tokens to 
expire, regardless of inactivity -->
-                               <Expiration>15</Expiration>
+                               <Expiration>60</Expiration>
                        </token>
                </auth>
 

http://git-wip-us.apache.org/repos/asf/juddi/blob/2bf444ca/uddi-tck/log4j.properties
----------------------------------------------------------------------
diff --git a/uddi-tck/log4j.properties b/uddi-tck/log4j.properties
index 32a71c0..186cec1 100644
--- a/uddi-tck/log4j.properties
+++ b/uddi-tck/log4j.properties
@@ -14,7 +14,7 @@ log4j.appender.logfile.MaxBackupIndex=3
 # Pattern to output: date priority [category] - message
 log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
 log4j.appender.logfile.layout.ConversionPattern=%d %p [%c] - %m%n
-
+log4j.logger.org.apache.cxf.wsdl.EndpointReferenceUtils=ERROR
 
 #log4j.category.org.springframework.beans.property 
editors.CustomDateEditor=DEBUG
 

http://git-wip-us.apache.org/repos/asf/juddi/blob/2bf444ca/uddi-tck/src/test/java/org/apache/juddi/v3/tck/JUDDI_300_MultiNodeIntegrationTest.java
----------------------------------------------------------------------
diff --git 
a/uddi-tck/src/test/java/org/apache/juddi/v3/tck/JUDDI_300_MultiNodeIntegrationTest.java
 
b/uddi-tck/src/test/java/org/apache/juddi/v3/tck/JUDDI_300_MultiNodeIntegrationTest.java
index e0fae6d..dda189e 100644
--- 
a/uddi-tck/src/test/java/org/apache/juddi/v3/tck/JUDDI_300_MultiNodeIntegrationTest.java
+++ 
b/uddi-tck/src/test/java/org/apache/juddi/v3/tck/JUDDI_300_MultiNodeIntegrationTest.java
@@ -278,7 +278,6 @@ public class JUDDI_300_MultiNodeIntegrationTest {
          * @throws Exception
          */
         @Test
-        //@Ignore
         public void testMultiNodeBusinessCustodyTransfer() throws Exception {
                 logger.info("testMultiNodeBusinessCustodyTransfer");
                 Assume.assumeTrue(TckPublisher.isReplicationEnabled() && 
TckPublisher.isCustodyTransferEnabled());
@@ -420,6 +419,55 @@ public class JUDDI_300_MultiNodeIntegrationTest {
 
         }
 
+        @Ignore
+        @Test
+        public void testReplicationPublisherAssertionAdd() throws Exception {
+        }
+
+        @Ignore
+        @Test
+        public void testReplicationPublisherAssertionDelete() throws Exception 
{
+        }
+
+        @Ignore
+        @Test
+        public void testReplicationTModelAdd() throws Exception {
+        }
+
+        @Ignore
+        @Test
+        public void testReplicationTModelDelete() throws Exception {
+        }
+
+        @Ignore
+        @Test
+        public void testReplicationBusinessAdd() throws Exception {
+        }
+
+        @Ignore
+        @Test
+        public void testReplicationBusinessDelete() throws Exception {
+        }
+        
+        @Ignore
+        @Test
+        public void testReplicationServiceAdd() throws Exception {
+        }
+
+        @Ignore
+        @Test
+        public void testReplicationServiceDelete() throws Exception {
+        }
+         @Ignore
+        @Test
+        public void testReplicationBindingAdd() throws Exception {
+        }
+        
+        @Ignore
+        @Test
+        public void testReplicationBindingDelete() throws Exception {
+        }
+
         /**
          * this function basically waits until the nodes are done synchronizing
          *


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to