Ejemplo n.º 1
0
  /**
   * add clerk + node, try to delete the node
   *
   * @throws Exception
   */
  @Test
  public void testAddClerkNodeThenDelete2() throws Exception {
    SaveClerk sc = new SaveClerk();
    sc.setAuthInfo(authInfoRoot);
    Clerk c = new Clerk();
    c.setName("clerk1" + UUID.randomUUID().toString());

    c.setPassword("pass");
    c.setPublisher("username");
    c.setNode(new Node());
    c.getNode().setName("test_node" + UUID.randomUUID().toString());
    c.getNode().setClientName("test_client");
    c.getNode()
        .setProxyTransport(
            org.apache.juddi.v3.client.transport.JAXWSTransport.class.getCanonicalName());
    c.getNode().setCustodyTransferUrl("http://localhost");
    c.getNode().setDescription("http://localhost");
    c.getNode().setInquiryUrl("http://localhost");
    c.getNode().setPublishUrl("http://localhost");
    c.getNode().setReplicationUrl("http://localhost");
    c.getNode().setSecurityUrl("http://localhost");
    c.getNode().setSubscriptionListenerUrl("http://localhost");
    c.getNode().setSubscriptionUrl("http://localhost");

    sc.getClerk().add(c);
    juddi.saveClerk(sc);

    juddi.deleteNode(new DeleteNode(authInfoRoot, c.getNode().getName()));
    // this should success

    // the clerk should be gone too
    ClerkList allNodes = juddi.getAllClerks(authInfoRoot);
    boolean found = false;
    for (int i = 0; i < allNodes.getClerk().size(); i++) {
      if (allNodes.getClerk().get(i).getName().equals(c.getName())) {
        found = true;
      }
    }
    Assert.assertFalse(found);

    // confirm the node is gone
    NodeList allNodes1 = juddi.getAllNodes(authInfoRoot);
    for (int i = 0; i < allNodes1.getNode().size(); i++) {
      if (allNodes1.getNode().get(i).getName().equals(c.getNode().getName())) {
        Assert.fail("node is still there!");
      }
    }
  }
Ejemplo n.º 2
0
  /**
   * add a clerk and node, delete the clerk, then check that the node is still there it should have
   * been deleted
   *
   * @throws Exception
   */
  @Test
  public void testAddClerkNodeThenDelete() throws Exception {
    SaveClerk sc = new SaveClerk();
    sc.setAuthInfo(authInfoRoot);
    Clerk c = new Clerk();
    c.setName("clerk1");

    c.setPassword("pass");
    c.setPublisher("username");
    c.setNode(new Node());
    c.getNode().setName("test_node");
    c.getNode().setClientName("test_client");
    c.getNode()
        .setProxyTransport(
            org.apache.juddi.v3.client.transport.JAXWSTransport.class.getCanonicalName());
    c.getNode().setCustodyTransferUrl("http://localhost");
    c.getNode().setDescription("http://localhost");
    c.getNode().setInquiryUrl("http://localhost");
    c.getNode().setPublishUrl("http://localhost");
    c.getNode().setReplicationUrl("http://localhost");
    c.getNode().setSecurityUrl("http://localhost");
    c.getNode().setSubscriptionListenerUrl("http://localhost");
    c.getNode().setSubscriptionUrl("http://localhost");

    sc.getClerk().add(c);
    juddi.saveClerk(sc);

    juddi.deleteClerk(new DeleteClerk(authInfoRoot, "clerk1"));

    ClerkList allNodes = juddi.getAllClerks(authInfoRoot);
    boolean found = false;
    for (int i = 0; i < allNodes.getClerk().size(); i++) {
      if (allNodes.getClerk().get(i).getName().equals("clerk1")) {
        found = true;
      }
    }
    Assert.assertFalse(found);

    NodeList allNodes1 = juddi.getAllNodes(authInfoRoot);
    for (int i = 0; i < allNodes1.getNode().size(); i++) {
      if (allNodes1.getNode().get(i).getName().equals("test_node")) {
        return;
      }
    }
    // TODO revise cascade deletes on nodes and clerks
    Assert.fail("node unexpectedly deleted");
  }