Skip to content
Permalink
Browse files
JUDDI-906 more test case enhancements, business, tmodel and publisher…
… assertions save and delete are confirmed replication

JUDDI-913 code is included but comment out due to failing tests (jpa issues)
  • Loading branch information
spyhunter99 committed Jan 13, 2015
1 parent 31c1461 commit b2179ec4b8add7bedb5b34d7f05e7e88f47fcf18
Showing 11 changed files with 392 additions and 158 deletions.
@@ -18,8 +18,6 @@
package org.apache.juddi.api.impl;

import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.Resource;

import javax.persistence.EntityManager;
@@ -73,7 +73,6 @@
import org.uddi.v3_service.DispositionReportFaultMessage;
import org.uddi.v3_service.UDDICustodyTransferPortType;
import org.uddi.v3_service.UDDIReplicationPortType;
import sun.util.BuddhistCalendar;

/**
* This implements the UDDI v3 Custody Transfer API web service
@@ -57,6 +57,7 @@
import org.apache.juddi.replication.ReplicationNotifier;
import org.apache.juddi.v3.error.ErrorMessage;
import org.apache.juddi.v3.error.FatalErrorException;
import org.apache.juddi.v3.error.InvalidValueException;
import org.apache.juddi.validation.ValidatePublish;
import org.uddi.api_v3.AddPublisherAssertions;
import org.uddi.api_v3.AssertionStatusItem;
@@ -154,12 +155,15 @@ public void addPublisherAssertions(AddPublisherAssertions body)
existingPubAssertion.setToCheck("true");
}

em.merge(existingPubAssertion);
persistNewAssertion = false;
changes.add(getChangeRecord_deletePublisherAssertion(apiPubAssertion, node, existingPubAssertion.getToCheck().equalsIgnoreCase("false"), existingPubAssertion.getFromCheck().equalsIgnoreCase("false"), System.currentTimeMillis()));
} else {
// Otherwise, it is a new relationship between these entities. Remove the old one so the new one can be added.
// TODO: the model only seems to allow one assertion per two business (primary key is fromKey and toKey). Spec seems to imply as
// many relationships as desired (the differentiator would be the keyedRef values).
em.remove(existingPubAssertion);
changes.add(getChangeRecord_deletePublisherAssertion(apiPubAssertion, node, true, true, System.currentTimeMillis()));
}
}

@@ -339,6 +343,8 @@ public void deletePublisherAssertions(DeletePublisherAssertions body)

org.apache.juddi.model.PublisherAssertion existingPubAssertion = em.find(org.apache.juddi.model.PublisherAssertion.class,
modelPubAssertion.getId());
if (existingPubAssertion==null)
throw new InvalidValueException(new ErrorMessage("E_assertionNotFound"));

boolean fromkey = publisher.isOwner(em.find(BusinessEntity.class, entity.getFromKey()));
boolean tokey = publisher.isOwner(em.find(BusinessEntity.class, entity.getToKey()));
@@ -356,7 +362,7 @@ public void deletePublisherAssertions(DeletePublisherAssertions body)
em.persist(existingPubAssertion);
}

changes.add(getChangeRecord_deletePublisherAssertion(entity, node, fromkey, tokey, existingPubAssertion.getModified().getTime()));
changes.add(getChangeRecord_deletePublisherAssertion(entity, node, tokey,fromkey, existingPubAssertion.getModified().getTime()));
}

tx.commit();
@@ -398,7 +404,7 @@ protected void deletePublisherAssertion(org.uddi.repl_v3.ChangeRecordDeleteAsser
modelPubAssertion.getId());

if (existingPubAssertion == null) {
throw new FatalErrorException(new ErrorMessage("assertionNotFound"));
throw new FatalErrorException(new ErrorMessage("E_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()));
@@ -410,9 +416,11 @@ protected void deletePublisherAssertion(org.uddi.repl_v3.ChangeRecordDeleteAsser
}
if ("false".equalsIgnoreCase(existingPubAssertion.getToCheck())
&& "false".equalsIgnoreCase(existingPubAssertion.getFromCheck())) {
logger.info("!!!Deletion of publisher assertion from database via replication");
em.remove(existingPubAssertion);
} else {
existingPubAssertion.setModified(new Date());
logger.info("!!!Publisher assertion update database via replication");
em.persist(existingPubAssertion);
}

0 comments on commit b2179ec

Please sign in to comment.