You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by im...@apache.org on 2015/02/13 07:00:21 UTC

stratos git commit: Updating logs in PCA live test

Repository: stratos
Updated Branches:
  refs/heads/master 3f04de2db -> ed2d2cca1


Updating logs in PCA live test


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/ed2d2cca
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/ed2d2cca
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/ed2d2cca

Branch: refs/heads/master
Commit: ed2d2cca1dbc5d4bb8d6a55ee24af04927f24934
Parents: 3f04de2
Author: Imesh Gunaratne <im...@apache.org>
Authored: Fri Feb 13 11:30:12 2015 +0530
Committer: Imesh Gunaratne <im...@apache.org>
Committed: Fri Feb 13 11:30:12 2015 +0530

----------------------------------------------------------------------
 .../test/PythonCartridgeAgentTest.java          | 21 ++++++++++----------
 1 file changed, 10 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/ed2d2cca/components/org.apache.stratos.python.cartridge.agent/src/test/java/org/apache/stratos/python.cartridge.agent/test/PythonCartridgeAgentTest.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.python.cartridge.agent/src/test/java/org/apache/stratos/python.cartridge.agent/test/PythonCartridgeAgentTest.java b/components/org.apache.stratos.python.cartridge.agent/src/test/java/org/apache/stratos/python.cartridge.agent/test/PythonCartridgeAgentTest.java
index a83d821..e62221a 100644
--- a/components/org.apache.stratos.python.cartridge.agent/src/test/java/org/apache/stratos/python.cartridge.agent/test/PythonCartridgeAgentTest.java
+++ b/components/org.apache.stratos.python.cartridge.agent/src/test/java/org/apache/stratos/python.cartridge.agent/test/PythonCartridgeAgentTest.java
@@ -45,10 +45,7 @@ import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.IOException;
 import java.net.ServerSocket;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
-import java.util.UUID;
+import java.util.*;
 import java.util.concurrent.ExecutorService;
 
 import static junit.framework.Assert.assertTrue;
@@ -71,27 +68,29 @@ public class PythonCartridgeAgentTest {
     private static final String SERVICE_NAME = "php";
 
     private static List<ServerSocket> serverSocketList;
-    private static List<Executor> executorList;
+    private static Map<String, Executor> executorList;
 
     @BeforeClass
     public static void setUp() {
         // Set jndi.properties.dir system property for initializing event publishers and receivers
         System.setProperty("jndi.properties.dir", getResourcesFolderPath());
         serverSocketList = new ArrayList<ServerSocket>();
-        executorList = new ArrayList<Executor>();
+        executorList = new HashMap<String, Executor>();
     }
 
     @AfterClass
     public static void tearDown() {
-        for (Executor executor : executorList) {
+        for (Map.Entry<String, Executor> entry : executorList.entrySet()) {
             try {
+                String commandText = entry.getKey();
+                Executor executor = entry.getValue();
                 ExecuteWatchdog watchdog = executor.getWatchdog();
                 if (watchdog != null) {
-                    log.info("Terminating agent process");
+                    log.info("Terminating process: " + commandText);
                     watchdog.destroyProcess();
                 }
-                if (executor.getWorkingDirectory() != null) {
-                    File workingDirectory = executor.getWorkingDirectory();
+                File workingDirectory = executor.getWorkingDirectory();
+                if (workingDirectory != null) {
                     log.info("Cleaning working directory: " + workingDirectory.getAbsolutePath());
                     FileUtils.deleteDirectory(workingDirectory);
                 }
@@ -356,7 +355,7 @@ public class PythonCartridgeAgentTest {
                     log.error("Agent process failed", e);
                 }
             });
-            executorList.add(exec);
+            executorList.put(commandText, exec);
             return outputStream;
         } catch (Exception e) {
             log.error(outputStream.toString(), e);