From a982abf4065e6c0b2452381a1ef8dc0f40a0a962 Mon Sep 17 00:00:00 2001
From: el_kaboing <el_kaboing@localhost>
Date: Fri, 25 Aug 2006 19:13:34 +0000
Subject: [PATCH] Removed the second java thread for starting/stopping OpenDS for the unix platforms.

---
 opends/tests/integration-tests-testng/src/server/org/opends/server/OpenDSIntegrationTests.java |   35 +++++++++++++++++++++--------------
 1 files changed, 21 insertions(+), 14 deletions(-)

diff --git a/opends/tests/integration-tests-testng/src/server/org/opends/server/OpenDSIntegrationTests.java b/opends/tests/integration-tests-testng/src/server/org/opends/server/OpenDSIntegrationTests.java
index 1c138bd..2094263 100644
--- a/opends/tests/integration-tests-testng/src/server/org/opends/server/OpenDSIntegrationTests.java
+++ b/opends/tests/integration-tests-testng/src/server/org/opends/server/OpenDSIntegrationTests.java
@@ -28,6 +28,7 @@
 
 import java.io.*;
 import org.opends.server.OpenDSAdmin;
+import  org.opends.server.tools.StopDS;
 
 /**
  * This class defines a base test case that should be subclassed by all
@@ -106,27 +107,33 @@
 
   public void startOpenDS(String dsee_home, String port) throws Exception
   {
-    dsAdmin = new OpenDSAdmin(dsee_home, port);
+    String osName = new String(System.getProperty("os.name"));
 
-    System.out.println("OpenDS is starting.....");
-    dsAdmin.start();
-    dsAdmin.sleep(20000);
-    System.out.println("OpenDS has started.");
+    if (osName.indexOf("Windows") >= 0)  // For Windows
+    {
+        String exec_cmd = "CMD /C " + dsee_home + "\\bin\\start-ds";
+        Runtime rtime = Runtime.getRuntime();
+        Process child = rtime.exec(exec_cmd);
+        //child.waitFor();
+    }
+    else
+    {
+      System.out.println("OpenDS is starting.....");
+      String exec_cmd = dsee_home + "/bin/start-ds.sh -nodetach";
+      Runtime rtime = Runtime.getRuntime();
+      Process child = rtime.exec(exec_cmd);
+      //child.waitFor();
+      dsAdmin.sleep(30000);
+      System.out.println("OpenDS has started.");
+    }
   }
 
   public void stopOpenDS(String dsee_home, String port) throws Exception
   {
-    if(dsAdmin == null)
-    {
-      dsAdmin = new OpenDSAdmin(dsee_home, port);
-    }
-
+    String myArgs[] = {"-p", port};
     System.out.println("OpenDS is stopping.....");
-    dsAdmin.stopDS();
-    dsAdmin.sleep(20000);
+    org.opends.server.tools.StopDS.stopDS(myArgs);
     System.out.println("OpenDS has stopped.");
-
-    dsAdmin = null;
   }
 
 }

--
Gitblit v1.10.0