Ejemplo n.º 1
0
  @Test
  public void testEventTrace() {
    KevoreeFactory factory = new DefaultKevoreeFactory();
    ContainerRoot model = factory.createContainerRoot();

    ContainerNode node0 = factory.createContainerNode();
    node0.setName("node0");
    model.addNodes(node0);

    ContainerNode web = factory.createContainerNode();
    web.setName("web");
    model.addNodes(web);
    node0.addHosts(web);

    try {

      ContainerRoot clonedModel = (ContainerRoot) cloner.clone(model);

      EventListenerImpl listener = new EventListenerImpl();
      model.addModelTreeListener(listener);

      ContainerNode newChildNode = factory.createContainerNode();
      newChildNode.setName("toto");
      model.addNodes(newChildNode);
      node0.addHosts(newChildNode);

      listener.traceSequence.applyOn(clonedModel);

    } catch (Exception e) {
      e.printStackTrace();
    }
  }