You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juddi.apache.org by al...@apache.org on 2014/12/09 04:13:30 UTC

[09/28] juddi git commit: JUDDI-241 Adding additional changes required by replication api. Not all tests pass on juddi api

JUDDI-241 Adding additional changes required by replication api. Not all tests pass on juddi api


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

Branch: refs/heads/master
Commit: 455149a9edbfa54679c5d789001c784e9bb464ea
Parents: 8b95902
Author: alexoree <al...@apache.org>
Authored: Fri Nov 14 18:12:31 2014 -0500
Committer: alexoree <al...@apache.org>
Committed: Fri Nov 14 18:12:31 2014 -0500

----------------------------------------------------------------------
 .../org/apache/juddi/api/impl/JUDDIApiImpl.java |   13 +-
 .../juddi/api/impl/UDDIReplicationImpl.java     |   48 +-
 .../juddi/api/impl/UDDIServiceCounter.java      |   14 +-
 .../juddi/api/impl/UDDISubscriptionImpl.java    |    2 +-
 .../apache/juddi/mapping/MappingApiToModel.java |   17 +-
 .../apache/juddi/mapping/MappingModelToApi.java | 2159 +++++++++---------
 .../apache/juddi/validation/ValidateClerk.java  |    5 +-
 .../juddi/validation/ValidatePublish.java       |    1 -
 .../juddi/validation/ValidateReplication.java   |    4 +
 .../src/main/resources/messages.properties      |    1 +
 ..._RMISubscriptionListenerIntegrationTest.java |    1 -
 .../juddi/api/impl/API_160_ReplicationTest.java |  266 +++
 .../replication/ReplicationNotifierTest.java    |   75 +
 juddi-tomcat/build.xml                          |   52 +
 .../root_BusinessEntity.xml                     |  668 ++++++
 .../juddi_install_data_node2/root_Publisher.xml |   21 +
 .../root_tModelKeyGen.xml                       |   40 +
 juddi-tomcat/pom.xml                            |    1 +
 18 files changed, 2286 insertions(+), 1102 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/juddi/blob/455149a9/juddi-core/src/main/java/org/apache/juddi/api/impl/JUDDIApiImpl.java
----------------------------------------------------------------------
diff --git a/juddi-core/src/main/java/org/apache/juddi/api/impl/JUDDIApiImpl.java b/juddi-core/src/main/java/org/apache/juddi/api/impl/JUDDIApiImpl.java
index de98fa0..a4ef416 100644
--- a/juddi-core/src/main/java/org/apache/juddi/api/impl/JUDDIApiImpl.java
+++ b/juddi-core/src/main/java/org/apache/juddi/api/impl/JUDDIApiImpl.java
@@ -69,6 +69,7 @@ import org.apache.juddi.config.Property;
 import org.apache.juddi.mapping.MappingApiToModel;
 import org.apache.juddi.mapping.MappingModelToApi;
 import org.apache.juddi.model.ClientSubscriptionInfo;
+import org.apache.juddi.model.Node;
 import org.apache.juddi.model.Publisher;
 import org.apache.juddi.model.ReplicationConfiguration;
 import org.apache.juddi.model.SubscriptionMatch;
@@ -86,6 +87,7 @@ import org.apache.juddi.validation.ValidateClientSubscriptionInfo;
 import org.apache.juddi.validation.ValidateNode;
 import org.apache.juddi.validation.ValidatePublish;
 import org.apache.juddi.validation.ValidatePublisher;
+import org.apache.juddi.validation.ValidateReplication;
 import org.apache.juddi.validation.ValidateSubscription;
 import org.uddi.api_v3.AuthToken;
 import org.uddi.api_v3.BusinessInfo;
@@ -675,8 +677,11 @@ public class JUDDIApiImpl extends AuthenticatedService implements JUDDIApiPortTy
                                 MappingApiToModel.mapClerk(apiClerk, modelClerk);
                                 org.apache.juddi.model.Node node = em.find(org.apache.juddi.model.Node.class, apiClerk.getNode().getName());
                                 if (node==null)
-                                        MappingApiToModel.mapNode(apiClerk.getNode(), node);
-
+                                {
+                                        //it doesn't exist yet
+                                        node = new Node();
+                                }
+                                MappingApiToModel.mapNode(apiClerk.getNode(), node);
                                 modelClerk.setNode(node);
                                 Object existingUddiEntity = em.find(modelClerk.getClass(), modelClerk.getClerkName());
                                 if (existingUddiEntity != null) {
@@ -983,7 +988,7 @@ public class JUDDIApiImpl extends AuthenticatedService implements JUDDIApiPortTy
                         if (existingUddiEntity
                              != null) {
 
-                                //TODO cascade delete all clerks tied to this node
+                                //TODO cascade delete all clerks tied to this node, confirm that it works
                                 em.remove(existingUddiEntity);
                                 found = true;
                         }
@@ -1260,8 +1265,8 @@ public class JUDDIApiImpl extends AuthenticatedService implements JUDDIApiPortTy
                         if (!((Publisher) publisher).isAdmin()) {
                                 throw new UserMismatchException(new ErrorMessage("errors.AdminReqd"));
                         }
+                        new ValidateReplication(publisher).validateSetReplicationNodes(replicationConfiguration);
 
-                        //TODO validate inbound request
                         org.apache.juddi.model.ReplicationConfiguration model = new ReplicationConfiguration();
                         MappingApiToModel.mapReplicationConfiguration(replicationConfiguration, model, em);
                         em.persist(model);

http://git-wip-us.apache.org/repos/asf/juddi/blob/455149a9/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIReplicationImpl.java
----------------------------------------------------------------------
diff --git a/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIReplicationImpl.java b/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIReplicationImpl.java
index 5f97703..e2fe3fd 100644
--- a/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIReplicationImpl.java
+++ b/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIReplicationImpl.java
@@ -463,9 +463,8 @@ public class UDDIReplicationImpl extends AuthenticatedService implements UDDIRep
                                 if (!Excluded(changesAlreadySeen, r)) {
                                         ret.add(r);
                                 }
-                                
+
                         }
-                        
 
                         tx.rollback();
                         long procTime = System.currentTimeMillis() - startTime;
@@ -582,6 +581,7 @@ public class UDDIReplicationImpl extends AuthenticatedService implements UDDIRep
          * @param body
          * @throws DispositionReportFaultMessage
          */
+        @Override
         public void transferCustody(TransferCustody body)
              throws DispositionReportFaultMessage {
                 long startTime = System.currentTimeMillis();
@@ -593,13 +593,43 @@ public class UDDIReplicationImpl extends AuthenticatedService implements UDDIRep
                 EntityManager em = PersistenceManager.getEntityManager();
                 //EntityTransaction tx = em.getTransaction();
 
-                //The custodial node must verify that it has granted permission to transfer the entities identified and that this permission is still valid.  This operation is comprised of two steps:
-                //1.       Verification that the transferToken was issued by it, that it has not expired, that it represents the authority to transfer no more and no less than those entities identified by the businessKey and tModelKey elements and that all these entities are still valid and not yet transferred. The transferToken is invalidated if any of these conditions are not met.
-                //2.       If the conditions above are met, the custodial node will prevent any further changes to the entities identified by the businessKey and tModelKey elements identified. The entity will remain in this state until the replication stream indicates it has been successfully processed via the replication stream. 
-                //Upon successful verification of the custody transfer request by the custodial node, an empty message is returned by it indicating the success of the request and acknowledging the custody transfer. 
-                //Following the issue of the empty message, the custodial node will submit into the replication stream a changeRecordNewData providing in the operationalInfo, the nodeID accepting custody of the datum and the authorizedName of the publisher accepting ownership. The acknowledgmentRequested attribute of this change record MUST be set to "true".
-                //TODO enqueue Replication message
-                //Finally, the custodial node invalidates the transferToken in order to prevent additional calls of the transfer_entities API.
+                /**
+                 * The custodial node must verify that it has granted permission
+                 * to transfer the entities identified and that this permission
+                 * is still valid. This operation is comprised of two steps: 
+                 * 
+                 * 1.
+                 * Verification that the transferToken was issued by it, that it
+                 * has not expired, that it represents the authority to transfer
+                 * no more and no less than those entities identified by the
+                 * businessKey and tModelKey elements and that all these
+                 * entities are still valid and not yet transferred. The
+                 * transferToken is invalidated if any of these conditions are
+                 * not met. 
+                 * 
+                 * 2. If the conditions above are met, the custodial
+                 * node will prevent any further changes to the entities
+                 * identified by the businessKey and tModelKey elements
+                 * identified. The entity will remain in this state until the
+                 * replication stream indicates it has been successfully
+                 * processed via the replication stream. Upon successful
+                 * verification of the custody transfer request by the custodial
+                 * node, an empty message is returned by it indicating the
+                 * success of the request and acknowledging the custody
+                 * transfer. Following the issue of the empty message, the
+                 * custodial node will submit into the replication stream a
+                 * changeRecordNewData providing in the operationalInfo, the
+                 * nodeID accepting custody of the datum and the authorizedName
+                 * of the publisher accepting ownership. The
+                 * acknowledgmentRequested attribute of this change record MUST
+                 * be set to "true".
+                 *
+                 * TODO enqueue Replication message 
+                 * 
+                 * Finally, the custodial node
+                 * invalidates the transferToken in order to prevent additional
+                 * calls of the transfer_entities API.
+                 */
                 DiscardTransferToken dtt = new DiscardTransferToken();
                 dtt.setKeyBag(body.getKeyBag());
                 dtt.setTransferToken(body.getTransferToken());

http://git-wip-us.apache.org/repos/asf/juddi/blob/455149a9/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIServiceCounter.java
----------------------------------------------------------------------
diff --git a/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIServiceCounter.java b/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIServiceCounter.java
index b8c387b..42813a9 100644
--- a/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIServiceCounter.java
+++ b/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIServiceCounter.java
@@ -206,7 +206,7 @@ public class UDDIServiceCounter implements DynamicMBean, Serializable {
         }        
     }
     
-    //@Override, this is jdk1.6 style, please uncomment when we go 1.6
+    @Override
     public Object getAttribute(String attribute)
             throws AttributeNotFoundException, MBeanException,
             ReflectionException {
@@ -228,15 +228,14 @@ public class UDDIServiceCounter implements DynamicMBean, Serializable {
         return null;
     }
 
-    //@Override, this is jdk1.6 style, please uncomment when we go 1.6
+    @Override
     public void setAttribute(Attribute attribute)
             throws AttributeNotFoundException, InvalidAttributeValueException,
             MBeanException, ReflectionException {
-        // TODO Auto-generated method stub
         
     }
 
-    //@Override, this is jdk1.6 style, please uncomment when we go 1.6
+    @Override
     public AttributeList getAttributes(String[] attributes) {
         AttributeList attributeList = new AttributeList();
 
@@ -267,13 +266,12 @@ public class UDDIServiceCounter implements DynamicMBean, Serializable {
         return attributeList;
     }
 
-    //@Override, this is jdk1.6 style, please uncomment when we go 1.6
+    @Override
     public AttributeList setAttributes(AttributeList attributes) {
-        // TODO Auto-generated method stub
         return null;
     }
 
-    //@Override, this is jdk1.6 style, please uncomment when we go 1.6
+    @Override
     public Object invoke(String actionName, Object[] params, String[] signature)
             throws MBeanException, ReflectionException {
         if (actionName.equalsIgnoreCase(RESET_COUNTER)) {
@@ -284,7 +282,7 @@ public class UDDIServiceCounter implements DynamicMBean, Serializable {
         }
     }
 
-    //@Override, this is jdk1.6 style, please uncomment when we go 1.6
+    @Override
     public MBeanInfo getMBeanInfo() {
         // the extra 3 added are for totalApiQueries, faultApiQueries, and
         // successfulApiQueries

http://git-wip-us.apache.org/repos/asf/juddi/blob/455149a9/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDISubscriptionImpl.java
----------------------------------------------------------------------
diff --git a/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDISubscriptionImpl.java b/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDISubscriptionImpl.java
index 3c24102..ac5d19e 100644
--- a/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDISubscriptionImpl.java
+++ b/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDISubscriptionImpl.java
@@ -723,7 +723,7 @@ public class UDDISubscriptionImpl extends AuthenticatedService implements UDDISu
 			}
 			if (subscriptionFilter.getGetAssertionStatusReport() != null) {
 				// The coverage period doesn't apply here (basically because publisher assertions don't keep operational info).
-				
+				// TODO, JUDDI-873 edit they do now, rewrite this query
 				GetAssertionStatusReport getAssertionStatusReport = subscriptionFilter.getGetAssertionStatusReport();
 				
 				List<AssertionStatusItem> assertionList = PublicationHelper.getAssertionStatusItemList(publisher, getAssertionStatusReport.getCompletionStatus(), em);

http://git-wip-us.apache.org/repos/asf/juddi/blob/455149a9/juddi-core/src/main/java/org/apache/juddi/mapping/MappingApiToModel.java
----------------------------------------------------------------------
diff --git a/juddi-core/src/main/java/org/apache/juddi/mapping/MappingApiToModel.java b/juddi-core/src/main/java/org/apache/juddi/mapping/MappingApiToModel.java
index a271d7e..7297311 100644
--- a/juddi-core/src/main/java/org/apache/juddi/mapping/MappingApiToModel.java
+++ b/juddi-core/src/main/java/org/apache/juddi/mapping/MappingApiToModel.java
@@ -1411,7 +1411,9 @@ public class MappingApiToModel {
         }
 
         public static void mapReplicationConfiguration(ReplicationConfiguration replicationConfiguration, org.apache.juddi.model.ReplicationConfiguration model, EntityManager em) throws DispositionReportFaultMessage {
-
+                if (replicationConfiguration == null) {
+                        throw new ValueNotAllowedException(new ErrorMessage("errors.replication.configNull"));
+                }
                 model.setMaximumTimeToGetChanges(replicationConfiguration.getMaximumTimeToGetChanges());
                 model.setMaximumTimeToSyncRegistry(replicationConfiguration.getMaximumTimeToSyncRegistry());
                 model.setSerialNumber(null);
@@ -1420,7 +1422,9 @@ public class MappingApiToModel {
                 //2002 03 04 1859Z
                 SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddkkmmZ");
                 model.setTimeOfConfigurationUpdate(sdf.format(new Date()));
-                model.setContact(mapContact(replicationConfiguration.getRegistryContact().getContact()));
+                if (replicationConfiguration.getRegistryContact() != null) {
+                        model.setContact(mapContact(replicationConfiguration.getRegistryContact().getContact()));
+                }
                 model.setCommunicationGraph(mapCommunicationGraph(replicationConfiguration.getCommunicationGraph(), em));
                 model.setOperator(mapOperators(replicationConfiguration.getOperator()));
                 if (replicationConfiguration.getSignature() != null) {
@@ -1470,16 +1474,22 @@ public class MappingApiToModel {
                         }
                         model.getNode().add(find);
                 }
-                if (communicationGraph.getEdge() != null) {
+                if (communicationGraph.getEdge() != null && !communicationGraph.getEdge().isEmpty()) {
                         List<Edge> ret = new ArrayList<Edge>();
                         for (int i = 0; i < communicationGraph.getEdge().size(); i++) {
                                 Edge e = new Edge();
                                 e.setCommunicationGraph(model);
+                                if (communicationGraph.getEdge().get(i).getMessageReceiver() == null) {
+                                        throw new ValueNotAllowedException(new ErrorMessage("errors.replication.configNodeNotFound", communicationGraph.getEdge().get(i).getMessageReceiver()));
+                                }
                                 Node find = em.find(org.apache.juddi.model.Node.class, communicationGraph.getEdge().get(i).getMessageReceiver());
                                 if (find == null) {
                                         throw new ValueNotAllowedException(new ErrorMessage("errors.replication.configNodeNotFound", communicationGraph.getEdge().get(i).getMessageReceiver()));
                                 }
                                 e.setMessageReceiver(find);
+                                if (communicationGraph.getEdge().get(i).getMessageSender() == null) {
+                                        throw new ValueNotAllowedException(new ErrorMessage("errors.replication.configNodeNotFound", communicationGraph.getEdge().get(i).getMessageReceiver()));
+                                }
                                 find = em.find(org.apache.juddi.model.Node.class, communicationGraph.getEdge().get(i).getMessageSender());
                                 if (find == null) {
                                         throw new ValueNotAllowedException(new ErrorMessage("errors.replication.configNodeNotFound", communicationGraph.getEdge().get(i).getMessageSender()));
@@ -1540,7 +1550,6 @@ public class MappingApiToModel {
                         if (!api.get(i).getKeyInfo().isEmpty()) {
                                 op.setKeyInfo(new ArrayList<KeyInfo>());
                                 for (int k = 0; k < api.get(i).getKeyInfo().size(); k++) {
-                                        //TODO api.get(i).getKeyInfo().get(k)
                                         org.apache.juddi.model.KeyInfo modelKeyInfo = new KeyInfo();
                                         modelKeyInfo.setXmlID(api.get(i).getKeyInfo().get(i).getId());
                                         modelKeyInfo.setKeyDataValue(new ArrayList<KeyDataValue>());


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@juddi.apache.org
For additional commands, e-mail: commits-help@juddi.apache.org