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 2015/01/19 03:36:30 UTC
juddi git commit: JUDDI-913 fixed and tested
Repository: juddi
Updated Branches:
refs/heads/master ba85baa1c -> 2ba82c8ea
JUDDI-913 fixed and tested
Project: http://git-wip-us.apache.org/repos/asf/juddi/repo
Commit: http://git-wip-us.apache.org/repos/asf/juddi/commit/2ba82c8e
Tree: http://git-wip-us.apache.org/repos/asf/juddi/tree/2ba82c8e
Diff: http://git-wip-us.apache.org/repos/asf/juddi/diff/2ba82c8e
Branch: refs/heads/master
Commit: 2ba82c8ea43ed7e405dda8f4e3894d109ab89ca8
Parents: ba85baa
Author: Alex <al...@apache.org>
Authored: Sun Jan 18 21:36:07 2015 -0500
Committer: Alex <al...@apache.org>
Committed: Sun Jan 18 21:36:07 2015 -0500
----------------------------------------------------------------------
.../juddi/api/impl/UDDIPublicationImpl.java | 57 +++++--
.../apache/juddi/mapping/MappingApiToModel.java | 10 +-
.../apache/juddi/mapping/MappingModelToApi.java | 4 +-
.../apache/juddi/model/PublisherAssertion.java | 9 +-
.../java/org/apache/juddi/model/Signature.java | 33 ++--
.../impl/API_060_PublisherAssertionTest.java | 170 +++++++++++++------
6 files changed, 199 insertions(+), 84 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/juddi/blob/2ba82c8e/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 a62e1c6..0139497 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
@@ -25,6 +25,7 @@ import java.util.List;
import javax.jws.WebService;
import javax.persistence.EntityManager;
import javax.persistence.EntityTransaction;
+import javax.persistence.Query;
import javax.xml.bind.JAXB;
import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.DatatypeFactory;
@@ -43,9 +44,9 @@ import org.apache.juddi.model.BindingTemplate;
import org.apache.juddi.model.BusinessEntity;
import org.apache.juddi.model.BusinessService;
import org.apache.juddi.model.ChangeRecord;
+import org.apache.juddi.model.Signature;
import org.apache.juddi.model.Tmodel;
import org.apache.juddi.model.UddiEntityPublisher;
-import org.apache.juddi.query.DeletePublisherAssertionByBusinessQuery;
import org.apache.juddi.query.FetchBusinessEntitiesQuery;
import org.apache.juddi.query.FetchTModelsQuery;
import org.apache.juddi.query.FindBusinessByPublisherQuery;
@@ -156,6 +157,9 @@ public class UDDIPublicationImpl extends AuthenticatedService implements UDDIPub
if (publisher.isOwner(existingPubAssertion.getBusinessEntityByToKey())) {
existingPubAssertion.setToCheck("true");
}
+ //it's also possible that the signatures have changed
+ removeExistingPublisherAssertionSignatures(existingPubAssertion.getBusinessEntityByFromKey().getEntityKey(), existingPubAssertion.getBusinessEntityByToKey().getEntityKey(), em);
+ savePushliserAssertionSignatures(existingPubAssertion.getBusinessEntityByFromKey().getEntityKey(), existingPubAssertion.getBusinessEntityByToKey().getEntityKey(), modelPubAssertion.getSignatures(), em);
em.merge(existingPubAssertion);
persistNewAssertion = false;
@@ -164,6 +168,7 @@ public class UDDIPublicationImpl extends AuthenticatedService implements UDDIPub
// 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).
+ removeExistingPublisherAssertionSignatures(existingPubAssertion.getBusinessEntityByFromKey().getEntityKey(), existingPubAssertion.getBusinessEntityByToKey().getEntityKey(), em);
em.remove(existingPubAssertion);
changes.add(getChangeRecord_deletePublisherAssertion(apiPubAssertion, node, true, true, System.currentTimeMillis()));
}
@@ -185,6 +190,8 @@ public class UDDIPublicationImpl extends AuthenticatedService implements UDDIPub
modelPubAssertion.setToCheck("true");
}
modelPubAssertion.setModified(new Date());
+ savePushliserAssertionSignatures(modelPubAssertion.getBusinessEntityByFromKey().getEntityKey(), modelPubAssertion.getBusinessEntityByToKey().getEntityKey(), modelPubAssertion.getSignatures(), em);
+
em.persist(modelPubAssertion);
changes.add(getChangeRecord_NewAssertion(apiPubAssertion, modelPubAssertion, node));
@@ -359,9 +366,15 @@ public class UDDIPublicationImpl extends AuthenticatedService implements UDDIPub
}
if ("false".equalsIgnoreCase(existingPubAssertion.getToCheck())
&& "false".equalsIgnoreCase(existingPubAssertion.getFromCheck())) {
+ logger.info("Publisher assertion updated database via replication");
+ removeExistingPublisherAssertionSignatures(existingPubAssertion.getBusinessEntityByFromKey().getEntityKey(), existingPubAssertion.getBusinessEntityByToKey().getEntityKey(), em);
em.remove(existingPubAssertion);
} else {
existingPubAssertion.setModified(new Date());
+ logger.info("Publisher assertion updated database via replication");
+ removeExistingPublisherAssertionSignatures(existingPubAssertion.getBusinessEntityByFromKey().getEntityKey(), existingPubAssertion.getBusinessEntityByToKey().getEntityKey(), em);
+ savePushliserAssertionSignatures(existingPubAssertion.getBusinessEntityByFromKey().getEntityKey(),
+ existingPubAssertion.getBusinessEntityByToKey().getEntityKey(), modelPubAssertion.getSignatures(), em);
em.persist(existingPubAssertion);
}
@@ -419,11 +432,15 @@ public class UDDIPublicationImpl extends AuthenticatedService implements UDDIPub
}
if ("false".equalsIgnoreCase(existingPubAssertion.getToCheck())
&& "false".equalsIgnoreCase(existingPubAssertion.getFromCheck())) {
- logger.info("!!!Deletion of publisher assertion from database via replication");
+ logger.info("Deletion of publisher assertion from database via replication");
+ removeExistingPublisherAssertionSignatures(existingPubAssertion.getBusinessEntityByFromKey().getEntityKey(), existingPubAssertion.getBusinessEntityByToKey().getEntityKey(), em);
em.remove(existingPubAssertion);
} else {
existingPubAssertion.setModified(new Date());
- logger.info("!!!Publisher assertion update database via replication");
+ logger.info("Publisher assertion updated database via replication");
+ removeExistingPublisherAssertionSignatures(existingPubAssertion.getBusinessEntityByFromKey().getEntityKey(), existingPubAssertion.getBusinessEntityByToKey().getEntityKey(), em);
+ savePushliserAssertionSignatures(existingPubAssertion.getBusinessEntityByFromKey().getEntityKey(),
+ existingPubAssertion.getBusinessEntityByToKey().getEntityKey(), modelPubAssertion.getSignatures(), em);
em.persist(existingPubAssertion);
}
@@ -927,7 +944,7 @@ public class UDDIPublicationImpl extends AuthenticatedService implements UDDIPub
List<ChangeRecord> changes = new ArrayList<ChangeRecord>();
for (org.uddi.api_v3.TModel apiTModel : apiTModelList) {
- // Object obj=em.find( org.apache.juddi.model.Tmodel.class, apiTModel.getTModelKey());
+ // Object obj=em.find( org.apache.juddi.model.Tmodel.class, apiTModel.getTModelKey());
//just making changes to an existing tModel, no worries
org.apache.juddi.model.Tmodel modelTModel = new org.apache.juddi.model.Tmodel();
@@ -940,14 +957,14 @@ public class UDDIPublicationImpl extends AuthenticatedService implements UDDIPub
result.getTModel().add(apiTModel);
changes.add(getChangeRecord(modelTModel, apiTModel, node));
/*
- //TODO JUDDI-915
- if (obj != null) {
+ //TODO JUDDI-915
+ if (obj != null) {
- changes.add(getChangeRecord(modelTModel, apiTModel, node));
- } else {
- //special case for replication, must setup a new data conditional change record
- changes.add(getChangeRecordConditional(modelTModel, apiTModel, node));
- }*/
+ changes.add(getChangeRecord(modelTModel, apiTModel, node));
+ } else {
+ //special case for replication, must setup a new data conditional change record
+ changes.add(getChangeRecordConditional(modelTModel, apiTModel, node));
+ }*/
}
@@ -1574,4 +1591,22 @@ public class UDDIPublicationImpl extends AuthenticatedService implements UDDIPub
return cr;
}
+ private void removeExistingPublisherAssertionSignatures(String from, String to, EntityManager em) {
+ Query createQuery = em.createQuery("delete from Signature pa where pa.publisherAssertionFromKey=:from and pa.publisherAssertionToKey=:to");
+ createQuery.setParameter("from", from);
+ createQuery.setParameter("to", to);
+ createQuery.executeUpdate();
+ }
+
+ private void savePushliserAssertionSignatures(String from, String to, List<Signature> signatures, EntityManager em) {
+ if (signatures == null) {
+ return;
+ }
+ for (Signature s : signatures) {
+ s.setPublisherAssertionFromKey(from);
+ s.setPublisherAssertionToKey(to);
+ em.persist(s);
+ }
+ }
+
}
http://git-wip-us.apache.org/repos/asf/juddi/blob/2ba82c8e/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 0648a02..1dd95a4 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
@@ -1004,10 +1004,14 @@ public class MappingApiToModel {
}
if (!apiPubAssertion.getSignature().isEmpty())
{
- /* modelPubAssertion.setSignatures(mapApiSignaturesToModelSignatures(apiPubAssertion.getSignature()));
+ modelPubAssertion.setSignatures(mapApiSignaturesToModelSignatures(apiPubAssertion.getSignature()));
for (Signature s : modelPubAssertion.getSignatures())
- s.setPublisherAssertion(modelPubAssertion);
- */
+ { s.setPublisherAssertionFromKey(modelPubAssertion.getBusinessEntityByFromKey().getEntityKey());
+ s.setPublisherAssertionToKey(modelPubAssertion.getBusinessEntityByToKey().getEntityKey());
+
+ }
+
+
}
}
http://git-wip-us.apache.org/repos/asf/juddi/blob/2ba82c8e/juddi-core/src/main/java/org/apache/juddi/mapping/MappingModelToApi.java
----------------------------------------------------------------------
diff --git a/juddi-core/src/main/java/org/apache/juddi/mapping/MappingModelToApi.java b/juddi-core/src/main/java/org/apache/juddi/mapping/MappingModelToApi.java
index 98d3ec9..f622097 100644
--- a/juddi-core/src/main/java/org/apache/juddi/mapping/MappingModelToApi.java
+++ b/juddi-core/src/main/java/org/apache/juddi/mapping/MappingModelToApi.java
@@ -1018,11 +1018,11 @@ public class MappingModelToApi {
keyedRef.setKeyName(modelPublisherAssertion.getKeyName());
keyedRef.setKeyValue(modelPublisherAssertion.getKeyValue());
- /* if (modelPublisherAssertion.getSignatures()!=null &&
+ if (modelPublisherAssertion.getSignatures()!=null &&
!modelPublisherAssertion.getSignatures().isEmpty())
{
mapSignature(modelPublisherAssertion.getSignatures(), apiPublisherAssertion.getSignature());
- }*/
+ }
apiPublisherAssertion.setKeyedReference(keyedRef);
}
http://git-wip-us.apache.org/repos/asf/juddi/blob/2ba82c8e/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 3f9d592..c00269d 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
@@ -28,7 +28,6 @@ import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
-import javax.persistence.OrderBy;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
@@ -95,6 +94,8 @@ public class PublisherAssertion implements java.io.Serializable {
public void setId(PublisherAssertionId id) {
this.id = id;
}
+
+
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "to_key", nullable = false, insertable = false, updatable = false)
@@ -170,13 +171,15 @@ public class PublisherAssertion implements java.io.Serializable {
return (this.id.equals(rhs.id));
}
- /*
+
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
public List<Signature> getSignatures() {
+ if (signatures==null)
+ signatures=new ArrayList<Signature>();
return signatures;
}
public void setSignatures(List<Signature> signatures) {
this.signatures = signatures;
- }*/
+ }
}
http://git-wip-us.apache.org/repos/asf/juddi/blob/2ba82c8e/juddi-core/src/main/java/org/apache/juddi/model/Signature.java
----------------------------------------------------------------------
diff --git a/juddi-core/src/main/java/org/apache/juddi/model/Signature.java b/juddi-core/src/main/java/org/apache/juddi/model/Signature.java
index 3b36265..856014a 100644
--- a/juddi-core/src/main/java/org/apache/juddi/model/Signature.java
+++ b/juddi-core/src/main/java/org/apache/juddi/model/Signature.java
@@ -24,7 +24,6 @@ import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
-import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
@@ -50,7 +49,8 @@ public class Signature implements java.io.Serializable {
private ReplicationConfiguration replConfig;
private Tmodel tmodel;
private String xmlID;
- private PublisherAssertion assertion;
+ private String assertionFromKey;
+ private String assertionToKey;
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
@@ -72,18 +72,23 @@ public class Signature implements java.io.Serializable {
this.bindingTemplate = bindingTemplate;
}
- /*@ManyToOne
- @JoinColumns({
- @JoinColumn(name = "fromKey", nullable = true),
- @JoinColumn(name = "toKey", nullable = true)
- })
- public PublisherAssertion getPublisherAssertion() {
- return assertion;
- }
-
- public void setPublisherAssertion(PublisherAssertion item) {
- this.assertion = item;
- }*/
+
+
+ @Column(nullable = true, length = 255, name = "passertionfrom")
+ public String getPublisherAssertionFromKey() {
+ return assertionFromKey;
+ }
+
+ public void setPublisherAssertionFromKey(String item) {
+ this.assertionFromKey = item;
+ }
+ @Column(nullable = true, length = 255, name = "passertionto")
+ public String getPublisherAssertionToKey() {
+ return assertionFromKey;
+ }
+ public void setPublisherAssertionToKey(String item) {
+ this.assertionToKey = item;
+ }
@ManyToOne
http://git-wip-us.apache.org/repos/asf/juddi/blob/2ba82c8e/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 e11148f..7ff6e80 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,11 +17,13 @@ package org.apache.juddi.api.impl;
/**
* @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>
* @author <a href="mailto:kstam@apache.org">Kurt T Stam</a>
- * * @author <a href="mailto:kstam@apache.org">Kurt T Stam</a>
+ * @author <a href="mailto:alexoree@apache.org">Alex O'Ree</a>
*/
import java.rmi.RemoteException;
+import java.security.cert.CertificateException;
import java.util.ArrayList;
import java.util.List;
+import java.util.concurrent.atomic.AtomicReference;
import javax.xml.bind.JAXB;
import javax.xml.ws.Holder;
@@ -31,6 +33,7 @@ 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.client.cryptor.DigSigUtil;
import org.apache.juddi.v3.tck.TckBusiness;
import org.apache.juddi.v3.tck.TckFindEntity;
import org.apache.juddi.v3.tck.TckPublisher;
@@ -41,6 +44,7 @@ import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.uddi.api_v3.AddPublisherAssertions;
import org.uddi.api_v3.AssertionStatusItem;
import org.uddi.api_v3.CompletionStatus;
import org.uddi.api_v3.DeletePublisherAssertions;
@@ -75,7 +79,7 @@ public class API_060_PublisherAssertionTest {
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);
+ tckTModel.saveTmodels(root);
} catch (RemoteException e) {
logger.error(e.getMessage(), e);
Assert.fail("Could not obtain authInfo token." + e.getMessage());
@@ -209,58 +213,55 @@ public class API_060_PublisherAssertionTest {
//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>>();
+ 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);
+ List<PublisherAssertion> before = pub.getPublisherAssertions(authInfoJoe);
Assert.assertNotNull(before);
Assert.assertTrue(before.isEmpty());
- System.out.println(before.size());
+ 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());
+ 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());
+ 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 = new Holder<List<PublisherAssertion>>();
x.value = new ArrayList<PublisherAssertion>();
logger.info("Clearing all publisher assertions....");
pub.setPublisherAssertions(authInfoJoe, x);
@@ -269,7 +270,7 @@ public class API_060_PublisherAssertionTest {
JAXB.marshal(x.value.get(i), System.out);
}
- logger.info("Fetch all publisher assertions....there should be none");
+ 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++) {
@@ -323,82 +324,82 @@ public class API_060_PublisherAssertionTest {
//create 1/2 PA
//use Set with a new PA
//confirm first PA is gone and the new PA exists
- try {
-
+ 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>>();
+ 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);
+ List<PublisherAssertion> before = pub.getPublisherAssertions(authInfoJoe);
Assert.assertNotNull(before);
-
- System.out.println(before.size());
+
+ System.out.println(before.size());
for (int i = 0; i < before.size(); i++) {
JAXB.marshal(before.get(i), System.out);
- }Assert.assertTrue(before.isEmpty());
-
+ }
+ Assert.assertTrue(before.isEmpty());
+
before = pub.getPublisherAssertions(authInfoSam);
Assert.assertNotNull(before);
-
- System.out.println(before.size());
+
+ System.out.println(before.size());
for (int i = 0; i < before.size(); i++) {
JAXB.marshal(before.get(i), System.out);
- }Assert.assertTrue(before.isEmpty());
-
+ }
+ Assert.assertTrue(before.isEmpty());
+
before = pub.getPublisherAssertions(authInfoMary);
Assert.assertNotNull(before);
-
- System.out.println(before.size());
+
+ System.out.println(before.size());
for (int i = 0; i < before.size(); i++) {
JAXB.marshal(before.get(i), System.out);
- }Assert.assertTrue(before.isEmpty());
-
+ }
+ 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());
+ 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 = 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);
@@ -407,7 +408,7 @@ public class API_060_PublisherAssertionTest {
JAXB.marshal(x.value.get(i), System.out);
}
- logger.info("Fetch all publisher assertions....there should be 1");
+ 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++) {
@@ -418,7 +419,7 @@ public class API_060_PublisherAssertionTest {
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);
@@ -429,6 +430,73 @@ public class API_060_PublisherAssertionTest {
tckTModel.deleteSamSyndicatorTmodel(authInfoSam);
tckTModel.deleteMaryPublisherTmodel(authInfoMary);
}
-
+
+ }
+ DigSigUtil ds;
+
+ void SetCertStoreSettigns() {
+ ds.put(DigSigUtil.SIGNATURE_KEYSTORE_FILE, "./src/test/resources/keystore.jks");
+ ds.put(DigSigUtil.SIGNATURE_KEYSTORE_FILETYPE, "JKS");
+ ds.put(DigSigUtil.SIGNATURE_KEYSTORE_FILE_PASSWORD, "Test");
+ ds.put(DigSigUtil.SIGNATURE_KEYSTORE_KEY_ALIAS, "Test");
+ ds.put(DigSigUtil.TRUSTSTORE_FILE, "./src/test/resources/truststore.jks");
+ ds.put(DigSigUtil.TRUSTSTORE_FILETYPE, "JKS");
+ ds.put(DigSigUtil.TRUSTSTORE_FILE_PASSWORD, "Test");
+ }
+
+ void Default() throws CertificateException {
+ ds = new DigSigUtil();
+ SetCertStoreSettigns();
+ ds.put(DigSigUtil.SIGNATURE_OPTION_CERT_INCLUSION_BASE64, "true");
+ }
+
+ @Test
+ public void testPublisherAssertionSignatures() throws Exception {
+ try {
+ Default();
+ tckTModel.saveJoePublisherTmodel(authInfoJoe);
+ tckTModel.saveSamSyndicatorTmodel(authInfoSam);
+ tckBusiness.saveJoePublisherBusiness(authInfoJoe);
+ tckBusiness.saveSamSyndicatorBusiness(authInfoSam);
+ AddPublisherAssertions ap = new AddPublisherAssertions();
+ ap.setAuthInfo(authInfoJoe);
+
+ PublisherAssertion paIn = (PublisherAssertion) EntityCreator.buildFromDoc(TckPublisherAssertion.JOE_ASSERT_XML, "org.uddi.api_v3");
+ paIn = ds.signUddiEntity(paIn);
+
+ ap.getPublisherAssertion().add(paIn);
+ Assert.assertFalse(paIn.getSignature().isEmpty());
+ pub.addPublisherAssertions(ap);
+
+ List<PublisherAssertion> onehalfPA = tckAssertion.saveJoePublisherPublisherAssertion(authInfoJoe);
+
+
+ Assert.assertNotNull(onehalfPA);
+ Assert.assertFalse(onehalfPA.get(0).getSignature().isEmpty());
+ Assert.assertFalse(onehalfPA.isEmpty());
+
+ Assert.assertNotNull(onehalfPA);
+ Assert.assertFalse(onehalfPA.get(0).getSignature().isEmpty());
+ Assert.assertFalse(onehalfPA.isEmpty());
+ Assert.assertEquals(paIn.getSignature().size(),onehalfPA.get(0).getSignature().size());
+ Assert.assertEquals(paIn.getSignature().get(0).getId(),onehalfPA.get(0).getSignature().get(0).getId());
+ Assert.assertEquals(paIn.getSignature().get(0).getKeyInfo().getId(),onehalfPA.get(0).getSignature().get(0).getKeyInfo().getId());
+ Assert.assertEquals(paIn.getSignature().get(0).getKeyInfo().getContent().size(),onehalfPA.get(0).getSignature().get(0).getKeyInfo().getContent().size());
+
+ Assert.assertEquals(paIn.getSignature().get(0).getSignedInfo().getCanonicalizationMethod().getAlgorithm(),onehalfPA.get(0).getSignature().get(0).getSignedInfo().getCanonicalizationMethod().getAlgorithm());
+ Assert.assertEquals(paIn.getSignature().get(0).getSignedInfo().getId(),onehalfPA.get(0).getSignature().get(0).getSignedInfo().getId());
+ Assert.assertEquals(paIn.getSignature().get(0).getSignedInfo().getReference().size(),onehalfPA.get(0).getSignature().get(0).getSignedInfo().getReference().size());
+ AtomicReference<String> outmsg=new AtomicReference<String>();
+ boolean success=ds.verifySignedUddiEntity(onehalfPA.get(0), outmsg);
+ Assert.assertTrue(outmsg.get(), success);
+
+ //
+ } finally {
+ //tckAssertion.deleteJoePublisherPublisherAssertion(authInfoJoe);
+ tckBusiness.deleteJoePublisherBusiness(authInfoJoe);
+ tckBusiness.deleteSamSyndicatorBusiness(authInfoSam);
+ tckTModel.deleteJoePublisherTmodel(authInfoJoe);
+ tckTModel.deleteSamSyndicatorTmodel(authInfoSam);
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@juddi.apache.org
For additional commands, e-mail: commits-help@juddi.apache.org