Esempio n. 1
0
  @After
  public void after() {
    // want to wait a few milliseconds to verify calls because everything is asynchronous

    try {
      Thread.sleep(10);
    } catch (InterruptedException e) {
      e.printStackTrace();
    }
  }
  private static void stopXmlRpcWorkflowManager() {
    System.setProperty(
        "java.util.logging.config.file",
        new File("./src/main/resources/logging.properties").getAbsolutePath());

    try {
      System.getProperties().load(new FileInputStream("./src/main/resources/workflow.properties"));
    } catch (Exception e) {
      fail(e.getMessage());
    }
    System.setProperty(
        "workflow.engine.instanceRep.factory",
        "org.apache.oodt.cas.workflow.instrepo.LuceneWorkflowInstanceRepositoryFactory");
    System.setProperty("org.apache.oodt.cas.workflow.instanceRep.lucene.idxPath", luceneCatLoc);

    try {
      System.setProperty(
          "org.apache.oodt.cas.workflow.repo.dirs",
          "file://" + new File("./src/main/resources/examples").getCanonicalPath());
      System.setProperty(
          "org.apache.oodt.cas.workflow.lifecycle.filePath",
          new File("./src/main/resources/examples/workflow-lifecycle.xml").getCanonicalPath());
    } catch (Exception e) {
      fail(e.getMessage());
    }

    try {
      wmgr.shutdown();
    } catch (Exception e) {
      LOG.log(Level.SEVERE, e.getMessage());
      fail(e.getMessage());
    }

    /** Sleep before removing to prevent file not found issues. */
    try {
      Thread.sleep(MILLIS);
    } catch (InterruptedException e) {
      e.printStackTrace();
    }

    if (new File(luceneCatLoc).exists()) {
      // blow away lucene cat
      LOG.log(Level.INFO, "Removing workflow instance repository: [" + luceneCatLoc + "]");
      try {
        FileUtils.deleteDirectory(new File(luceneCatLoc));
      } catch (IOException e) {
        fail(e.getMessage());
      }
    }
  }