// TODO edges can be listed only once and must be unique // TODO In the absence of a communicationGraph element from the Replication Configuration // Structure, all nodes listed in the node element MAY send any and all messages to any other node // of the registry. // implies that communicationGraph may be null or empty ,despite the xsd @Test public void getReplicationConfigMandatoryItems() throws Exception { ReplicationConfiguration replicationNodes = juddi.getReplicationNodes(authInfoRoot); Assert.assertNotNull(replicationNodes); Assert.assertNotNull(replicationNodes.getCommunicationGraph()); Assert.assertNotNull(replicationNodes.getTimeOfConfigurationUpdate()); Assert.assertNotNull(replicationNodes.getMaximumTimeToGetChanges()); Assert.assertNotNull(replicationNodes.getMaximumTimeToSyncRegistry()); Assert.assertNotNull(replicationNodes.getRegistryContact()); Assert.assertNotNull(replicationNodes.getRegistryContact().getContact()); Assert.assertNotNull(replicationNodes.getRegistryContact().getContact().getPersonName().get(0)); }
@Test public void setReplicationConfig() throws Exception { ReplicationConfiguration r = new ReplicationConfiguration(); Operator op = new Operator(); op.setOperatorNodeID("test_node"); op.setSoapReplicationURL("http://localhost"); op.setOperatorStatus(OperatorStatusType.NORMAL); r.getOperator().add(op); r.setCommunicationGraph(new CommunicationGraph()); r.setRegistryContact(new ReplicationConfiguration.RegistryContact()); r.getRegistryContact().setContact(new Contact()); r.getRegistryContact().getContact().getPersonName().add(new PersonName("test", null)); // r.getCommunicationGraph().getEdge().add(new CommunicationGraph.Edge()); r.getCommunicationGraph().getNode().add("test_node"); JAXB.marshal(r, System.out); DispositionReport setReplicationNodes = juddi.setReplicationNodes(authInfoRoot, r); ReplicationConfiguration replicationNodes = juddi.getReplicationNodes(authInfoRoot); Assert.assertNotNull(replicationNodes.getCommunicationGraph()); Assert.assertNotNull(replicationNodes.getCommunicationGraph().getNode()); Assert.assertEquals("test_node", replicationNodes.getCommunicationGraph().getNode().get(0)); Assert.assertNotNull(replicationNodes.getMaximumTimeToGetChanges()); Assert.assertNotNull(replicationNodes.getMaximumTimeToSyncRegistry()); Assert.assertNotNull(replicationNodes.getTimeOfConfigurationUpdate()); Assert.assertNotNull(replicationNodes.getSerialNumber()); long firstcommit = replicationNodes.getSerialNumber(); r = new ReplicationConfiguration(); r.getOperator().add(op); r.setCommunicationGraph(new CommunicationGraph()); r.setRegistryContact(new ReplicationConfiguration.RegistryContact()); r.getRegistryContact().setContact(new Contact()); r.getRegistryContact().getContact().getPersonName().add(new PersonName("test", null)); // r.getCommunicationGraph().getEdge().add(new CommunicationGraph.Edge()); r.getCommunicationGraph().getNode().add("test_node"); JAXB.marshal(r, System.out); setReplicationNodes = juddi.setReplicationNodes(authInfoRoot, r); replicationNodes = juddi.getReplicationNodes(authInfoRoot); Assert.assertNotNull(replicationNodes.getCommunicationGraph()); Assert.assertNotNull(replicationNodes.getCommunicationGraph().getNode()); Assert.assertEquals("test_node", replicationNodes.getCommunicationGraph().getNode().get(0)); Assert.assertNotNull(replicationNodes.getMaximumTimeToGetChanges()); Assert.assertNotNull(replicationNodes.getMaximumTimeToSyncRegistry()); Assert.assertNotNull(replicationNodes.getTimeOfConfigurationUpdate()); Assert.assertNotNull(replicationNodes.getSerialNumber()); Assert.assertTrue(firstcommit < replicationNodes.getSerialNumber()); }
@Test public void setReplicationConfig2() throws Exception { ReplicationConfiguration r = new ReplicationConfiguration(); Operator op = new Operator(); op.setOperatorNodeID("test_node"); op.setSoapReplicationURL("http://localhost"); op.setOperatorStatus(OperatorStatusType.NORMAL); r.getOperator().add(op); op = new Operator(); op.setOperatorNodeID("test_node2"); op.setSoapReplicationURL("http://localhost"); op.setOperatorStatus(OperatorStatusType.NORMAL); r.getOperator().add(op); r.setCommunicationGraph(new CommunicationGraph()); r.setRegistryContact(new ReplicationConfiguration.RegistryContact()); r.getRegistryContact().setContact(new Contact()); r.getRegistryContact().getContact().getPersonName().add(new PersonName("test", null)); // r.getCommunicationGraph().getEdge().add(new CommunicationGraph.Edge()); r.getCommunicationGraph().getNode().add("test_node"); r.getCommunicationGraph().getNode().add("test_node2"); r.getCommunicationGraph().getControlledMessage().add("doPing"); r.getCommunicationGraph().getEdge().add(new CommunicationGraph.Edge()); r.getCommunicationGraph().getEdge().get(0).setMessageReceiver("test_node"); r.getCommunicationGraph().getEdge().get(0).setMessageSender("test_node2"); r.getCommunicationGraph().getEdge().get(0).getMessage().add("doPing"); r.getCommunicationGraph().getEdge().get(0).getMessageReceiverAlternate().add("test_node2"); DispositionReport setReplicationNodes = juddi.setReplicationNodes(authInfoRoot, r); ReplicationConfiguration replicationNodes = juddi.getReplicationNodes(authInfoRoot); Assert.assertNotNull(replicationNodes.getCommunicationGraph()); Assert.assertNotNull(replicationNodes.getCommunicationGraph().getNode()); Assert.assertEquals("test_node", replicationNodes.getCommunicationGraph().getNode().get(0)); Assert.assertNotNull(replicationNodes.getMaximumTimeToGetChanges()); Assert.assertNotNull(replicationNodes.getMaximumTimeToSyncRegistry()); Assert.assertNotNull(replicationNodes.getTimeOfConfigurationUpdate()); Assert.assertNotNull(replicationNodes.getSerialNumber()); }