private CanonicalProcessType buildCPF() {
    CanonicalProcessType cpf = new CanonicalProcessType();

    NetType net = new NetType();

    EventType event = new EventType();
    event.setId("1");
    event.setOriginalID("1");
    event.setName("event");

    TaskType task = new TaskType();
    task.setId("2");
    task.setOriginalID("2");
    task.setName("task");

    EdgeType edge = new EdgeType();
    edge.setId("3");
    edge.setOriginalID("3");
    edge.setSourceId("1");
    edge.setTargetId("2");

    net.getNode().add(event);
    net.getNode().add(task);
    net.getEdge().add(edge);
    cpf.getNet().add(net);

    return cpf;
  }
 /* loop through the list of edges and process each one. */
 private void manipulateEdges(
     CanonicalProcessType cpf, AnnotationsType anf, Map<String, AnnotationData> annotations) {
   GraphicsType annotation;
   for (NetType net : cpf.getNet()) {
     for (EdgeType edge : net.getEdge()) {
       annotation = findGraphicsType(anf, edge.getId());
       if (annotation != null) {
         manipulateEdge(annotation, edge, annotations);
       }
     }
   }
 }
 /* loop through the list of nodes and process each one. */
 private void manipulateShapes(
     CanonicalProcessType cpf, AnnotationsType anf, Map<String, AnnotationData> annotations) {
   GraphicsType annotation;
   for (NetType net : cpf.getNet()) {
     for (NodeType node : net.getNode()) {
       annotation = findGraphicsType(anf, node.getId());
       if (annotation != null) {
         if (node instanceof EventType) {
           manipulateEvent(annotation, node, annotations);
         } else if (node instanceof TaskType) {
           manipulateTask(annotation, node, annotations);
         }
       }
     }
   }
 }
 @Test
 public void test() {
   CanonicalProcessType cpf = yawl2Canonical.getCpf();
   assertTrue(cpf.getResourceType().isEmpty());
 }
  /*
   * (non-Javadoc)
   *
   * @see org.apromore.plugin.deployment.DeploymentPlugin#deployProcess(org.apromore.cpf.CanonicalProcessType, org.apromore.anf.AnnotationsType)
   */
  @Override
  public PluginResult deployProcess(
      final CanonicalProcessType canonicalProcess,
      final AnnotationsType annotation,
      final PluginRequest request)
      throws DeploymentException, PluginPropertyNotFoundException {
    ParameterType<String> userEngineUrl = request.getRequestParameter(yawlEngineUrl);
    ParameterType<String> userUsername = request.getRequestParameter(yawlEngineUsername);
    ParameterType<String> userPassword = request.getRequestParameter(yawlEnginePassword);
    ParameterType<Boolean> doAutoLaunch = request.getRequestParameter(autoLaunch);

    checkProperties(userEngineUrl);

    PluginResultImpl pluginResult = newPluginResult();

    YAWLEngineClient yawlEngineClient =
        engineClientFactory.newInstance(
            userEngineUrl.getValue(), userUsername.getValue(), userPassword.getValue());

    Node connectResponse = yawlEngineClient.connectToYAWL();
    if (connectResponse.getNodeName().equals("failure")) {
      throw new DeploymentException(
          "Could not connect to YAWL engine. Reason: " + connectResponse.getTextContent());
    } else {
      try {
        String sessionHandle = connectResponse.getTextContent();
        if (sessionHandle != null) {
          String yawlSpec = deCanoniseYAWL(canonicalProcess, annotation);
          Node uploadResponse = yawlEngineClient.uploadYAWLSpecification(yawlSpec, sessionHandle);
          if (uploadResponse.getNodeName().equals("failure")) {
            pluginResult.addPluginMessage(
                "Failure deploying process {0}", canonicalProcess.getName());
            if (uploadResponse.getChildNodes().getLength() > 0) {
              Node reasonNode = uploadResponse.getChildNodes().item(0);
              for (int i = 0; i < reasonNode.getChildNodes().getLength(); i++) {
                convertToPluginMessage(pluginResult, reasonNode.getChildNodes().item(i));
              }
            }
          } else {
            if (uploadResponse.getTextContent().isEmpty()) {
              pluginResult.addPluginMessage(
                  "Process {0} successfully deployed.",
                  canonicalProcess.getName(), uploadResponse.getTextContent());
              if (doAutoLaunch.getValue()) {
                doAutoLaunch();
              }
            } else {
              pluginResult.addPluginMessage(
                  "YAWL Engine message: {0}", uploadResponse.getTextContent());
            }
          }
        } else {
          throw new DeploymentException(
              "Could not connect to YAWL engine. Invalid Session Handle returned!");
        }
      } catch (CanoniserException e) {
        throw new DeploymentException("Could not deCanonise to YAWL", e);
      }
    }

    return pluginResult;
  }