Repository: juddi Updated Branches: refs/heads/master 2bf444ca1 -> e9520847f
JUDDI-906 addition tests for replication config. JUDDI-241 juddi api adminDeleteTModel for permission/node check. Log output reduced due to turning off schema validation for the juddi api endpoint Project: http://git-wip-us.apache.org/repos/asf/juddi/repo Commit: http://git-wip-us.apache.org/repos/asf/juddi/commit/e9520847 Tree: http://git-wip-us.apache.org/repos/asf/juddi/tree/e9520847 Diff: http://git-wip-us.apache.org/repos/asf/juddi/diff/e9520847 Branch: refs/heads/master Commit: e9520847f063fb1d4416948f3e9afb9ea1db940b Parents: 2bf444c Author: Alex <[email protected]> Authored: Sun Jan 11 08:30:11 2015 -0500 Committer: Alex <[email protected]> Committed: Sun Jan 11 08:30:11 2015 -0500 ---------------------------------------------------------------------- .../org/apache/juddi/api/impl/JUDDIApiImpl.java | 61 +++-- .../juddi/validation/ValidatePublish.java | 12 +- .../src/main/resources/messages.properties | 1 + juddiv3-war/JAX-WS/CXF/WEB-INF/beans.xml | 2 +- .../java/org/apache/juddi/v3/tck/TckCommon.java | 12 +- .../java/org/apache/juddi/v3/tck/TckTModel.java | 2 +- .../tck/JUDDI_300_MultiNodeIntegrationTest.java | 231 ++++++++++++++++--- ...I_170_ValueSetValidationIntegrationTest.java | 7 +- 8 files changed, 250 insertions(+), 78 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/juddi/blob/e9520847/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 8bdf19f..db08195 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 @@ -198,9 +198,10 @@ public class JUDDIApiImpl extends AuthenticatedService implements JUDDIApiPortTy /** * Deletes publisher(s) from the persistence layer. This method is - * specific to jUDDI. Administrative privilege required. Also removes all - * registered business entities of the user and marks all created tModels as "deleted" - * but not does not remove the tModel from persistence. All subscriptions are also destroyed + * specific to jUDDI. Administrative privilege required. Also removes + * all registered business entities of the user and marks all created + * tModels as "deleted" but not does not remove the tModel from + * persistence. All subscriptions are also destroyed * * @param body * @throws DispositionReportFaultMessage @@ -406,7 +407,10 @@ public class JUDDIApiImpl extends AuthenticatedService implements JUDDIApiPortTy * tModel will no longer be able to use the tModel if jUDDI Option * Enforce referential Integrity is enabled.<br> * Required permission, you must be am administrator - * {@link Property#JUDDI_ENFORCE_REFERENTIAL_INTEGRITY} + * {@link Property#JUDDI_ENFORCE_REFERENTIAL_INTEGRITY}. In addition, + * tModels that are owned by another node via replication cannot be deleted using + * this method and will throw an exception + * * @param body * @throws DispositionReportFaultMessage @@ -427,9 +431,15 @@ public class JUDDIApiImpl extends AuthenticatedService implements JUDDIApiPortTy //TODO if referiental integrity is turned on, check to see if this is referenced anywhere and prevent the delete List<String> entityKeyList = body.getTModelKey(); for (String entityKey : entityKeyList) { - Object obj = em.find(org.apache.juddi.model.Tmodel.class, entityKey); + org.apache.juddi.model.Tmodel obj = em.find(org.apache.juddi.model.Tmodel.class, entityKey); + + if (obj == null) { + throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.TModelNotFound", entityKey)); + } + if (!obj.getNodeId().equals(node)) + throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.TModelNodeOwner", entityKey + " this node " + node + " owning node " + obj.getNodeId())); em.remove(obj); - ChangeRecord cr =UDDIPublicationImpl.getChangeRecord_deleteTModelDelete(entityKey, node); + ChangeRecord cr = UDDIPublicationImpl.getChangeRecord_deleteTModelDelete(entityKey, node); ReplicationNotifier.Enqueue(cr); } @@ -1198,19 +1208,18 @@ public class JUDDIApiImpl extends AuthenticatedService implements JUDDIApiPortTy if (!((Publisher) requestor).isAdmin()) { throw new UserMismatchException(new ErrorMessage("errors.AdminReqd")); } - + for (int i = 0; i < values.size(); i++) { //impersonate the user AuthToken authToken = sec.getAuthToken(values.get(i).getPublisherID()); - + SaveBusiness stm = new SaveBusiness(); - + stm.setAuthInfo(authToken.getAuthInfo()); stm.getBusinessEntity().addAll(values.get(i).getBusinessEntity()); pub.saveBusiness(stm); } - tx.commit(); long procTime = System.currentTimeMillis() - startTime; serviceCounter.update(JUDDIQuery.ADMIN_SAVE_BUSINESS, @@ -1230,7 +1239,7 @@ public class JUDDIApiImpl extends AuthenticatedService implements JUDDIApiPortTy DispositionReport r = new DispositionReport(); return r; - + } @Override @@ -1244,7 +1253,7 @@ public class JUDDIApiImpl extends AuthenticatedService implements JUDDIApiPortTy if (!((Publisher) requestor).isAdmin()) { throw new UserMismatchException(new ErrorMessage("errors.AdminReqd")); } - + for (int i = 0; i < values.size(); i++) { //impersonate the user AuthToken authToken = sec.getAuthToken(values.get(i).getPublisherID()); @@ -1436,9 +1445,9 @@ public class JUDDIApiImpl extends AuthenticatedService implements JUDDIApiPortTy throw drfm; } catch (Exception ex) { //possible that there is no config to return - logger.warn("Error caught, is there a replication config is avaiable? Returning a default config (no replication): " + ex.getMessage()); + logger.warn("Error caught, is there a replication config is avaiable? Returning a default config (no replication): " + ex.getMessage()); logger.debug("Error caught, is there a replication config is avaiable? Returning a default config (no replication): ", ex); - + r.setCommunicationGraph(new CommunicationGraph()); Operator op = new Operator(); op.setOperatorNodeID(node); @@ -1452,7 +1461,7 @@ public class JUDDIApiImpl extends AuthenticatedService implements JUDDIApiPortTy r.getOperator().add(op); r.getCommunicationGraph().getNode().add(node); r.getCommunicationGraph().getControlledMessage().add("*"); - long procTime = System.currentTimeMillis() - startTime; + long procTime = System.currentTimeMillis() - startTime; r.setSerialNumber(0); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddkkmmZ"); r.setTimeOfConfigurationUpdate(sdf.format(new Date())); @@ -1465,7 +1474,7 @@ public class JUDDIApiImpl extends AuthenticatedService implements JUDDIApiPortTy BusinessEntity rootbiz = em.find(BusinessEntity.class, AppConfig.getConfiguration().getString(Property.JUDDI_NODE_ROOT_BUSINESS)); if (rootbiz != null) { - + for (int i = 0; i < rootbiz.getContacts().size(); i++) { Contact c = new Contact(); MappingModelToApi.mapContact(rootbiz.getContacts().get(i), c); @@ -1479,7 +1488,7 @@ public class JUDDIApiImpl extends AuthenticatedService implements JUDDIApiPortTy } catch (Exception ex1) { logger.warn("unexpected error", ex1); } - if (r.getRegistryContact().getContact()==null){ + if (r.getRegistryContact().getContact() == null) { r.getRegistryContact().setContact(new Contact()); r.getRegistryContact().getContact().getPersonName().add(new PersonName("Unknown", null)); } @@ -1495,7 +1504,7 @@ public class JUDDIApiImpl extends AuthenticatedService implements JUDDIApiPortTy r.setMaximumTimeToGetChanges(BigInteger.ONE); r.setMaximumTimeToSyncRegistry(BigInteger.ONE); - // JAXB.marshal(r, System.out); + // JAXB.marshal(r, System.out); return r; } @@ -1538,16 +1547,18 @@ public class JUDDIApiImpl extends AuthenticatedService implements JUDDIApiPortTy /** * {@inheritDoc } + * * @param body * @return item history or null if not found * @throws DispositionReportFaultMessage - * @throws RemoteException + * @throws RemoteException */ @Override public GetEntityHistoryMessageResponse getEntityHistory(GetEntityHistoryMessageRequest body) throws DispositionReportFaultMessage, RemoteException { long startTime = System.currentTimeMillis(); - if (body==null) + if (body == null) { throw new InvalidValueException(new ErrorMessage("errors.NullInput")); + } EntityManager em = PersistenceManager.getEntityManager(); EntityTransaction tx = em.getTransaction(); try { @@ -1556,21 +1567,23 @@ public class JUDDIApiImpl extends AuthenticatedService implements JUDDIApiPortTy if (!((Publisher) requestor).isAdmin()) { throw new UserMismatchException(new ErrorMessage("errors.AdminReqd")); } - if (body.getMaxRecords()<=0) + if (body.getMaxRecords() <= 0) { body.setMaxRecords(20); - if (body.getOffset() < 0) + } + if (body.getOffset() < 0) { body.setOffset(0); + } Query createQuery = em.createQuery("select m from ChangeRecord m where m.entityKey = :key order by m.id DESC"); createQuery.setMaxResults((int) body.getMaxRecords()); createQuery.setParameter("key", body.getEntityKey()); - createQuery.setFirstResult((int)body.getOffset()); + createQuery.setFirstResult((int) body.getOffset()); List<ChangeRecord> resultList = createQuery.getResultList(); GetEntityHistoryMessageResponse res = new GetEntityHistoryMessageResponse(); res.setChangeRecords(new ChangeRecords()); for (ChangeRecord cr : resultList) { res.getChangeRecords().getChangeRecord().add(MappingModelToApi.mapChangeRecord(cr)); } - + tx.rollback(); long procTime = System.currentTimeMillis() - startTime; serviceCounter.update(JUDDIQuery.ADMIN_GET_HISTORY, http://git-wip-us.apache.org/repos/asf/juddi/blob/e9520847/juddi-core/src/main/java/org/apache/juddi/validation/ValidatePublish.java ---------------------------------------------------------------------- diff --git a/juddi-core/src/main/java/org/apache/juddi/validation/ValidatePublish.java b/juddi-core/src/main/java/org/apache/juddi/validation/ValidatePublish.java index dd0271f..8c18b7b 100644 --- a/juddi-core/src/main/java/org/apache/juddi/validation/ValidatePublish.java +++ b/juddi-core/src/main/java/org/apache/juddi/validation/ValidatePublish.java @@ -1671,15 +1671,9 @@ public class ValidatePublish extends ValidateUDDIApi { if (!inserted) { throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.DuplicateKey", entityKey)); } - - Object obj = em.find(org.apache.juddi.model.Tmodel.class, entityKey); - if (obj == null) { - throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.TModelNotFound", entityKey)); - } - - //if (!publisher.isOwner((UddiEntity) obj)) { - // throw new UserMismatchException(new ErrorMessage("errors.usermismatch.InvalidOwner", entityKey)); - //} + + //removed a check for checking if the entity exists which was moved to the juddi api class + //why? because we were looking up the same object twice in the database and its just not efficient } } //////////////////////////////////////////////////////////////////// http://git-wip-us.apache.org/repos/asf/juddi/blob/e9520847/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 5b7addb..8848cfd 100644 --- a/juddi-core/src/main/resources/messages.properties +++ b/juddi-core/src/main/resources/messages.properties @@ -85,6 +85,7 @@ errors.invalidkey.BusinessNotFound=The business entity was not found for the giv errors.invalidkey.ServiceNotFound=The business service was not found for the given key errors.invalidkey.BindingTemplateNotFound=The binding template was not found for the given key errors.invalidkey.TModelNotFound=The technical model was not found for the given key +errors.invalidkey.TModelNodeOwner=You've attempted to delete a tModel that is not owned by this node. Access the owning node to delete. errors.invalidkey.ParentServiceNotFound=The business service parent was not found for the given key errors.invalidkey.ParentBusinessNotFound=The business entity parent was not found for the given key errors.invalidkey.ServiceKeyNotProvidedWithProjection=Attempting to project a service when the service key was not provided. The non-owning businessEntity cannot generate a key for a projected service http://git-wip-us.apache.org/repos/asf/juddi/blob/e9520847/juddiv3-war/JAX-WS/CXF/WEB-INF/beans.xml ---------------------------------------------------------------------- diff --git a/juddiv3-war/JAX-WS/CXF/WEB-INF/beans.xml b/juddiv3-war/JAX-WS/CXF/WEB-INF/beans.xml index 8e1c130..b7c1e09 100644 --- a/juddiv3-war/JAX-WS/CXF/WEB-INF/beans.xml +++ b/juddiv3-war/JAX-WS/CXF/WEB-INF/beans.xml @@ -105,7 +105,7 @@ <jaxws:endpoint id="juddi-api" implementor="org.apache.juddi.api.impl.JUDDIApiImpl" address="/juddi-api"> <jaxws:properties> - <entry key="schema-validation-enabled" value="true"/> + <entry key="schema-validation-enabled" value="false"/> </jaxws:properties> </jaxws:endpoint> http://git-wip-us.apache.org/repos/asf/juddi/blob/e9520847/uddi-tck-base/src/main/java/org/apache/juddi/v3/tck/TckCommon.java ---------------------------------------------------------------------- diff --git a/uddi-tck-base/src/main/java/org/apache/juddi/v3/tck/TckCommon.java b/uddi-tck-base/src/main/java/org/apache/juddi/v3/tck/TckCommon.java index ce8d05c..54a11a9 100644 --- a/uddi-tck-base/src/main/java/org/apache/juddi/v3/tck/TckCommon.java +++ b/uddi-tck-base/src/main/java/org/apache/juddi/v3/tck/TckCommon.java @@ -326,12 +326,12 @@ public class TckCommon { } public static void PrintMarker() { - System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>> FAILURE MARKER <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"); - System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>> FAILURE MARKER <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"); - System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>> FAILURE MARKER <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"); - System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>> FAILURE MARKER <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"); - System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>> FAILURE MARKER <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"); - System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>> FAILURE MARKER <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"); + System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>> MARKER <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"); + System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>> MARKER <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"); + System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>> MARKER <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"); + System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>> MARKER <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"); + System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>> MARKER <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"); + System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>> MARKER <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"); } } http://git-wip-us.apache.org/repos/asf/juddi/blob/e9520847/uddi-tck-base/src/main/java/org/apache/juddi/v3/tck/TckTModel.java ---------------------------------------------------------------------- diff --git a/uddi-tck-base/src/main/java/org/apache/juddi/v3/tck/TckTModel.java b/uddi-tck-base/src/main/java/org/apache/juddi/v3/tck/TckTModel.java index 812953d..a689cf0 100644 --- a/uddi-tck-base/src/main/java/org/apache/juddi/v3/tck/TckTModel.java +++ b/uddi-tck-base/src/main/java/org/apache/juddi/v3/tck/TckTModel.java @@ -155,7 +155,7 @@ public class TckTModel { } catch (Exception e) { logger.error(e.getMessage(), e); - Assert.fail("No exception should be thrown"); + Assert.fail("No exception should be thrown" + e.getMessage()); } } else { http://git-wip-us.apache.org/repos/asf/juddi/blob/e9520847/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 dda189e..34c36f3 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 @@ -42,12 +42,16 @@ import org.uddi.api_v3.BusinessEntity; import org.uddi.api_v3.BusinessService; import org.uddi.api_v3.BusinessServices; import org.uddi.api_v3.Contact; +import org.uddi.api_v3.DeleteTModel; import org.uddi.api_v3.GetBusinessDetail; import org.uddi.api_v3.GetOperationalInfo; +import org.uddi.api_v3.GetTModelDetail; import org.uddi.api_v3.Name; import org.uddi.api_v3.OperationalInfos; import org.uddi.api_v3.PersonName; import org.uddi.api_v3.SaveBusiness; +import org.uddi.api_v3.TModel; +import org.uddi.api_v3.TModelDetail; import org.uddi.custody_v3.KeyBag; import org.uddi.custody_v3.TransferEntities; import org.uddi.custody_v3.TransferToken; @@ -85,10 +89,16 @@ public class JUDDI_300_MultiNodeIntegrationTest { private static UDDICustodyTransferPortType custodySam; private static UDDICustodyTransferPortType custodyMary; private static UDDIPublicationPortType publishMary; + private static UDDIPublicationPortType publishSam; private static UDDIInquiryPortType inquiryMary; private static UDDIInquiryPortType inquirySam; private static UDDIReplicationPortType replicationMary; private static UDDIReplicationPortType replicationSam; + static TckBusiness maryBizNode1; + static TckTModel maryTModelNode1; + + static TckBusiness samBizNode2; + static TckTModel samTModelNode2; static final String CFG_node1_MARY = "uddiv3"; static final String CFG_node2_SAM = "uddiv3-2"; @@ -136,6 +146,12 @@ public class JUDDI_300_MultiNodeIntegrationTest { juddiApiServiceNode2 = node2.getJUDDIApiService(); custodySam = node2.getUDDICustodyTransferService(); inquirySam = node2.getUDDIInquiryService(); + publishSam = node2.getUDDIPublishService(); + + samBizNode2 = new TckBusiness(publishSam, inquirySam); + samTModelNode2 = new TckTModel(publishSam, inquirySam); + maryBizNode1 = new TckBusiness(publishMary, inquiryMary); + maryTModelNode1 = new TckTModel(publishMary, inquiryMary); if (!TckPublisher.isUDDIAuthMode()) { TckSecurity.setCredentials((BindingProvider) juddiApiServiceNode1, TckPublisher.getRootPublisherId(), TckPublisher.getRootPassword()); @@ -148,6 +164,7 @@ public class JUDDI_300_MultiNodeIntegrationTest { TckSecurity.setCredentials((BindingProvider) custodySam, TckPublisher.getSamPublisherId(), TckPublisher.getSamPassword()); TckSecurity.setCredentials((BindingProvider) inquirySam, TckPublisher.getSamPublisherId(), TckPublisher.getSamPassword()); TckSecurity.setCredentials((BindingProvider) replicationSam, TckPublisher.getSamPublisherId(), TckPublisher.getSamPassword()); + TckSecurity.setCredentials((BindingProvider) publishSam, TckPublisher.getSamPublisherId(), TckPublisher.getSamPassword()); } } @@ -255,7 +272,9 @@ public class JUDDI_300_MultiNodeIntegrationTest { replicationNode1.getRegistryContact().getContact().getPersonName().add(new PersonName("unknown", null)); } - JAXB.marshal(replicationNode1, System.out); + if (TckCommon.isDebug()) { + JAXB.marshal(replicationNode1, System.out); + } logger.info("Setting replication config on Node 1..."); juddiApiServiceNode1.setReplicationNodes(rootNode1Token, replicationNode1); logger.info("Setting replication config on Node 2..."); @@ -268,10 +287,6 @@ public class JUDDI_300_MultiNodeIntegrationTest { } } - public void testUnsetReplicationConfig() throws Exception { - - } - /** * transfer business from mary/node1 to sam/node2, then delete * @@ -402,9 +417,11 @@ public class JUDDI_300_MultiNodeIntegrationTest { Assert.assertNotNull(afterNode1); Assert.assertNotNull(afterNode2); - JAXB.marshal(afterNode1, System.out); - JAXB.marshal(afterNode2, System.out); + if (TckCommon.isDebug()) { + JAXB.marshal(afterNode1, System.out); + JAXB.marshal(afterNode2, System.out); + } //confirm we're replicated correctly Assert.assertEquals(afterNode1.getOperationalInfo().get(0).getAuthorizedName(), afterNode2.getOperationalInfo().get(0).getAuthorizedName()); Assert.assertEquals(afterNode1.getOperationalInfo().get(0).getEntityKey(), afterNode2.getOperationalInfo().get(0).getEntityKey()); @@ -415,57 +432,134 @@ public class JUDDI_300_MultiNodeIntegrationTest { Assert.assertEquals(afterNode1.getOperationalInfo().get(0).getAuthorizedName(), TckPublisher.getSamPublisherId()); Assert.assertNotEquals(beforeNode1.getOperationalInfo().get(0).getNodeID(), afterNode1.getOperationalInfo().get(0).getNodeID()); - testUnsetReplicationConfig(); - } - @Ignore + /** + * covers business, tmodels and publisher assertions + * + * @throws Exception + */ @Test - public void testReplicationPublisherAssertionAdd() throws Exception { - } - @Ignore - @Test - public void testReplicationPublisherAssertionDelete() throws Exception { - } + public void testReplicationTModelBusinessPublisherAssertionAddDelete() throws Exception { + Assume.assumeTrue(TckPublisher.isReplicationEnabled()); + Assume.assumeTrue(TckPublisher.isJUDDI()); + try { + TckCommon.PrintMarker(); + TckCommon.PrintMarker(); + TckCommon.PrintMarker(); + logger.info("testReplicationTModelBusinessPublisherAssertionAddDelete"); + + restTmodels(); + + TModel saveMaryPublisherTmodel = maryTModelNode1.saveMaryPublisherTmodel(maryTokenNode1); + + BusinessEntity saveMaryPublisherBusiness = maryBizNode1.saveMaryPublisherBusiness(maryTokenNode1); + + // TModel saveSamSyndicatorTmodel = samTModelNode2.saveSamSyndicatorTmodel(samTokenNode2); + BusinessEntity saveSamSyndicatorBusiness = samBizNode2.saveSamSyndicatorBusiness(samTokenNode2); + + getReplicationStatus();//block until synched + + //confirm mary's tmodel is on the other node + GetTModelDetail findTModel = new GetTModelDetail(); + findTModel.setAuthInfo(samTokenNode2); + findTModel.getTModelKey().add(TckTModel.MARY_PUBLISHER_TMODEL_KEY); + TModelDetail tModelDetail = inquirySam.getTModelDetail(findTModel); + Assert.assertNotNull(tModelDetail); + Assert.assertNotNull(tModelDetail.getTModel()); + Assert.assertTrue(tModelDetail.getTModel().size() == 1); + Assert.assertTrue(tModelDetail.getTModel().get(0).getTModelKey().equals(TckTModel.MARY_PUBLISHER_TMODEL_KEY)); + + GetBusinessDetail gbd = new GetBusinessDetail(); + gbd.setAuthInfo(samTokenNode2); + gbd.getBusinessKey().add(TckBusiness.MARY_BUSINESS_KEY); + BusinessDetail businessDetail = inquirySam.getBusinessDetail(gbd); + Assert.assertNotNull(businessDetail); + Assert.assertNotNull(businessDetail.getBusinessEntity()); + Assert.assertTrue(businessDetail.getBusinessEntity().get(0).getBusinessKey().equals(TckBusiness.MARY_BUSINESS_KEY)); + + //setup a publisher assertion + + //clean up + maryBizNode1.deleteMaryPublisherBusiness(maryTokenNode1); + maryTModelNode1.deleteMaryPublisherTmodel(maryTokenNode1); + + //getReplicationStatus();//block until synched + int timeout = TckPublisher.getSubscriptionTimeout(); + businessDetail = null; + while (timeout > 0) { + logger.info("Waiting for the update..."); + try { + businessDetail = inquirySam.getBusinessDetail(gbd); + + } catch (Exception ex) { + logger.warn(ex.getMessage()); + businessDetail = null; + break; + } + timeout--; + Thread.sleep(1000); - @Ignore - @Test - public void testReplicationTModelAdd() throws Exception { - } + } + //check node2 for delete biz, should be gone - @Ignore - @Test - public void testReplicationTModelDelete() throws Exception { - } + if (businessDetail != null) { + Assert.fail(TckBusiness.MARY_BUSINESS_KEY + " wasn't deleted on node 2"); + } - @Ignore - @Test - public void testReplicationBusinessAdd() throws Exception { + tModelDetail = inquirySam.getTModelDetail(findTModel); + Assert.assertNotNull(tModelDetail); + Assert.assertNotNull(tModelDetail.getTModel()); + Assert.assertNotNull(tModelDetail.getTModel().get(0)); + Assert.assertEquals(tModelDetail.getTModel().get(0).getTModelKey(), TckTModel.MARY_PUBLISHER_TMODEL_KEY); + Assert.assertEquals(tModelDetail.getTModel().get(0).isDeleted(), true); + + TckCommon.PrintMarker(); + TckCommon.PrintMarker(); + TckCommon.PrintMarker(); + } finally { + + samBizNode2.deleteSamSyndicatorBusiness(samTokenNode2); + restTmodels(); + + } + //check node2 for a "hidden" tmodel should be accessible via getDetails } - @Ignore @Test - public void testReplicationBusinessDelete() throws Exception { + public void testReplicationPublisherAssertionSet() throws Exception { + Assume.assumeTrue(TckPublisher.isReplicationEnabled()); + Assume.assumeTrue(TckPublisher.isJUDDI()); + logger.info("testReplicationPublisherAssertionSet"); } - - @Ignore + @Test public void testReplicationServiceAdd() throws Exception { + Assume.assumeTrue(TckPublisher.isReplicationEnabled()); + Assume.assumeTrue(TckPublisher.isJUDDI()); + logger.info("testReplicationServiceAdd"); } - @Ignore @Test public void testReplicationServiceDelete() throws Exception { + Assume.assumeTrue(TckPublisher.isReplicationEnabled()); + Assume.assumeTrue(TckPublisher.isJUDDI()); + logger.info("testReplicationServiceDelete"); } - @Ignore + @Test public void testReplicationBindingAdd() throws Exception { + Assume.assumeTrue(TckPublisher.isReplicationEnabled()); + Assume.assumeTrue(TckPublisher.isJUDDI()); + logger.info("testReplicationBindingAdd"); } - - @Ignore + @Test public void testReplicationBindingDelete() throws Exception { + Assume.assumeTrue(TckPublisher.isReplicationEnabled()); + Assume.assumeTrue(TckPublisher.isJUDDI()); + logger.info("testReplicationBindingDelete"); } /** @@ -474,8 +568,9 @@ public class JUDDI_300_MultiNodeIntegrationTest { * @throws Exception */ private void getReplicationStatus() throws Exception { - logger.info("Getting replication status....Mary's node..."); + logger.info("Getting replication status....Mary's node1..."); waitUntilSynched(replicationMary); + logger.info("Getting replication status....Sam's node2..."); waitUntilSynched(replicationSam); } @@ -503,4 +598,68 @@ public class JUDDI_300_MultiNodeIntegrationTest { } + private void restTmodels() { + TckCommon.PrintMarker(); + logger.info("resting tmodels"); + DeleteTModel dtm = new DeleteTModel(); + dtm.setAuthInfo(rootNode1Token); + dtm.getTModelKey().add(TckTModel.MARY_PUBLISHER_TMODEL_KEY); + try { + juddiApiServiceNode1.adminDeleteTModel(dtm); + logger.info("Node1 mary deleted"); + } catch (Exception ex) { + logger.info("unable to delete tmodel " + ex.getMessage()); + } + + dtm = new DeleteTModel(); + dtm.setAuthInfo(rootNode1Token); + dtm.getTModelKey().add(TckTModel.JOE_PUBLISHER_TMODEL_KEY); + try { + juddiApiServiceNode1.adminDeleteTModel(dtm); + logger.info("Node1 joe deleted"); + } catch (Exception ex) { + logger.info("unable to delete tmodel " + ex.getMessage()); + } + + dtm = new DeleteTModel(); + dtm.setAuthInfo(rootNode1Token); + dtm.getTModelKey().add(TckTModel.SAM_SYNDICATOR_TMODEL_KEY); + try { + juddiApiServiceNode1.adminDeleteTModel(dtm); + logger.info("Node1 sam deleted"); + } catch (Exception ex) { + logger.info("unable to delete tmodel " + ex.getMessage()); + } + + dtm = new DeleteTModel(); + dtm.setAuthInfo(rootNode2Token); + dtm.getTModelKey().add(TckTModel.MARY_PUBLISHER_TMODEL_KEY); + try { + juddiApiServiceNode2.adminDeleteTModel(dtm); + logger.info("Node2 mary deleted"); + } catch (Exception ex) { + logger.info("unable to delete tmodel " + ex.getMessage()); + } + + dtm = new DeleteTModel(); + dtm.setAuthInfo(rootNode2Token); + dtm.getTModelKey().add(TckTModel.JOE_PUBLISHER_TMODEL_KEY); + try { + juddiApiServiceNode2.adminDeleteTModel(dtm); + logger.info("Node2 joe deleted"); + } catch (Exception ex) { + logger.info("unable to delete tmodel " + ex.getMessage()); + } + + dtm = new DeleteTModel(); + dtm.setAuthInfo(rootNode2Token); + dtm.getTModelKey().add(TckTModel.SAM_SYNDICATOR_TMODEL_KEY); + try { + juddiApiServiceNode2.adminDeleteTModel(dtm); + logger.info("Node2 sam deleted"); + } catch (Exception ex) { + logger.info("unable to delete tmodel " + ex.getMessage()); + } + } + } http://git-wip-us.apache.org/repos/asf/juddi/blob/e9520847/uddi-tck/src/test/java/org/apache/juddi/v3/tck/UDDI_170_ValueSetValidationIntegrationTest.java ---------------------------------------------------------------------- diff --git a/uddi-tck/src/test/java/org/apache/juddi/v3/tck/UDDI_170_ValueSetValidationIntegrationTest.java b/uddi-tck/src/test/java/org/apache/juddi/v3/tck/UDDI_170_ValueSetValidationIntegrationTest.java index a6fc23b..a376ac4 100644 --- a/uddi-tck/src/test/java/org/apache/juddi/v3/tck/UDDI_170_ValueSetValidationIntegrationTest.java +++ b/uddi-tck/src/test/java/org/apache/juddi/v3/tck/UDDI_170_ValueSetValidationIntegrationTest.java @@ -85,6 +85,7 @@ public class UDDI_170_ValueSetValidationIntegrationTest implements UDDIValueSetV private static String authInfoMary = null; private static UDDIClient manager; private static boolean VALID = true; + static TckTModel maryTmodel=null; @BeforeClass public static void startRegistry() throws ConfigurationException { @@ -116,10 +117,12 @@ public class UDDI_170_ValueSetValidationIntegrationTest implements UDDIValueSetV security = transport.getUDDISecurityService(); authInfoMary = TckSecurity.getAuthToken(security, TckPublisher.getMaryPublisherId(), TckPublisher.getMaryPassword()); if (!TckPublisher.isUDDIAuthMode()) { - TckSecurity.setCredentials((BindingProvider) inquiry, TckPublisher.getJoePublisherId(), TckPublisher.getJoePassword()); + TckSecurity.setCredentials((BindingProvider) inquiry, TckPublisher.getMaryPublisherId(), TckPublisher.getMaryPassword()); TckSecurity.setCredentials((BindingProvider) publicationMary, TckPublisher.getMaryPublisherId(), TckPublisher.getMaryPassword()); } + maryTmodel = new TckTModel(publicationMary, inquiry); + maryTmodel.saveMaryPublisherTmodel(authInfoMary); } catch (Exception e) { logger.error(e.getMessage(), e); Assert.fail("Could not obtain authInfo token."); @@ -132,6 +135,7 @@ public class UDDI_170_ValueSetValidationIntegrationTest implements UDDIValueSetV if (!TckPublisher.isEnabled()) { return; } + maryTmodel.deleteMaryPublisherTmodel(authInfoMary); manager.stop(); } final static String VSV_KEY = "uddi:juddi.apache.org:node1"; @@ -858,6 +862,7 @@ public class UDDI_170_ValueSetValidationIntegrationTest implements UDDIValueSetV Assume.assumeTrue(TckPublisher.isEnabled()); Assume.assumeTrue(TckPublisher.isValueSetAPIEnabled()); System.out.println("ReplacedByValid6DifferentOwners"); + BusinessEntity tm = new BusinessEntity(); tm.setBusinessKey(TckTModel.MARY_KEY_PREFIX + "testbiz"); tm.getName().add(new Name("My old business", "en")); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
