You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by kw...@apache.org on 2013/12/02 18:35:05 UTC

svn commit: r1547121 - /manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/test/java/org/apache/manifoldcf/crawler/tests/ManifoldCFInstance.java

Author: kwright
Date: Mon Dec  2 17:35:05 2013
New Revision: 1547121

URL: http://svn.apache.org/r1547121
Log:
Allow MCFInstance to support multiple instances with multiple processID's

Modified:
    manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/test/java/org/apache/manifoldcf/crawler/tests/ManifoldCFInstance.java

Modified: manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/test/java/org/apache/manifoldcf/crawler/tests/ManifoldCFInstance.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/test/java/org/apache/manifoldcf/crawler/tests/ManifoldCFInstance.java?rev=1547121&r1=1547120&r2=1547121&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/test/java/org/apache/manifoldcf/crawler/tests/ManifoldCFInstance.java (original)
+++ manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/test/java/org/apache/manifoldcf/crawler/tests/ManifoldCFInstance.java Mon Dec  2 17:35:05 2013
@@ -57,39 +57,57 @@ import org.apache.http.entity.ContentTyp
 /** Tests that run the "agents daemon" should be derived from this */
 public class ManifoldCFInstance
 {
-  protected boolean webapps = true;
-  protected boolean singleWar = false;
-  protected int testPort = 8346;
+  protected final boolean webapps;
+  protected final boolean singleWar;
+  protected final int testPort;
+  protected final String processID;
   
   protected DaemonThread daemonThread = null;
   protected Server server = null;
 
   public ManifoldCFInstance()
   {
+    this(ManifoldCF.getProcessID(), 8346, false, true);
   }
   
+  public ManifoldCFInstance(String processID)
+  {
+    this(processID, 8346, false, true);
+  }
+
   public ManifoldCFInstance(boolean singleWar)
   {
-    this(8346,singleWar,true);
+    this(ManifoldCF.getProcessID(), 8346, singleWar, true);
+  }
+  
+  public ManifoldCFInstance(String processID, boolean singleWar)
+  {
+    this(processID, 8346, singleWar, true);
   }
 
   public ManifoldCFInstance(boolean singleWar, boolean webapps)
   {
-    this(8346,singleWar,webapps);
+    this(ManifoldCF.getProcessID(), 8346, singleWar, webapps);
+  }
+
+  public ManifoldCFInstance(String processID, boolean singleWar, boolean webapps)
+  {
+    this(processID, 8346, singleWar, webapps);
   }
   
-  public ManifoldCFInstance(int testPort)
+  public ManifoldCFInstance(String processID, int testPort)
   {
-    this(testPort,false,true);
+    this(processID, testPort, false, true);
   }
 
-  public ManifoldCFInstance(int testPort, boolean singleWar)
+  public ManifoldCFInstance(String processID, int testPort, boolean singleWar)
   {
-    this(testPort,singleWar,true);
+    this(processID, testPort, singleWar, true);
   }
 
-  public ManifoldCFInstance(int testPort, boolean singleWar, boolean webapps)
+  public ManifoldCFInstance(String processID, int testPort, boolean singleWar, boolean webapps)
   {
+    this.processID = processID;
     this.webapps = webapps;
     this.testPort = testPort;
     this.singleWar = singleWar;
@@ -578,7 +596,7 @@ public class ManifoldCFInstance
       IThreadContext tc = ThreadContextFactory.make();
       AgentsDaemon.clearAgentsShutdownSignal(tc);
 
-      daemonThread = new DaemonThread();
+      daemonThread = new DaemonThread(processID);
       daemonThread.start();
     }
   }
@@ -709,16 +727,17 @@ public class ManifoldCFInstance
   
   protected static class DaemonThread extends Thread
   {
+    protected final String processID;
     protected Exception daemonException = null;
     
-    public DaemonThread()
+    public DaemonThread(String processID)
     {
+      this.processID = processID;
       setName("Daemon thread");
     }
     
     public void run()
     {
-      String processID = ManifoldCF.getProcessID();
       IThreadContext tc = ThreadContextFactory.make();
       // Now, start the server, and then wait for the shutdown signal.  On shutdown, we have to actually do the cleanup,
       // because the JVM isn't going away.