You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ga...@apache.org on 2015/12/08 16:18:03 UTC

[20/50] [abbrv] stratos git commit: PCA Live Test - Improved agent log display by removing duplicate log entries

PCA Live Test - Improved agent log display by removing duplicate log entries


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

Branch: refs/heads/master
Commit: 7d357546009ee633fa3a5006232f5392dfaf0abb
Parents: d191218
Author: Chamila de Alwis <ch...@apache.org>
Authored: Fri Nov 27 18:05:09 2015 +0530
Committer: Chamila de Alwis <ch...@apache.org>
Committed: Mon Nov 30 19:13:56 2015 +0530

----------------------------------------------------------------------
 .../integration/tests/PythonAgentIntegrationTest.java    | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/7d357546/products/python-cartridge-agent/modules/integration/test-integration/src/test/java/org/apache/stratos/python/cartridge/agent/integration/tests/PythonAgentIntegrationTest.java
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/modules/integration/test-integration/src/test/java/org/apache/stratos/python/cartridge/agent/integration/tests/PythonAgentIntegrationTest.java b/products/python-cartridge-agent/modules/integration/test-integration/src/test/java/org/apache/stratos/python/cartridge/agent/integration/tests/PythonAgentIntegrationTest.java
index 08042b7..7f436f6 100644
--- a/products/python-cartridge-agent/modules/integration/test-integration/src/test/java/org/apache/stratos/python/cartridge/agent/integration/tests/PythonAgentIntegrationTest.java
+++ b/products/python-cartridge-agent/modules/integration/test-integration/src/test/java/org/apache/stratos/python/cartridge/agent/integration/tests/PythonAgentIntegrationTest.java
@@ -311,7 +311,7 @@ public abstract class PythonAgentIntegrationTest {
         Thread communicatorThread = new Thread(new Runnable() {
             @Override
             public void run() {
-                List<String> outputLines = new ArrayList<String>();
+                List<String> outputLines = new ArrayList<>();
                 while (!outputStream.isClosed()) {
                     List<String> newLines = getNewLines(outputLines, outputStream.toString());
                     if (newLines.size() > 0) {
@@ -544,12 +544,13 @@ public abstract class PythonAgentIntegrationTest {
      * @return new lines printed by Python agent process
      */
     protected List<String> getNewLines(List<String> currentOutputLines, String output) {
-        List<String> newLines = new ArrayList<String>();
+        List<String> newLines = new ArrayList<>();
 
         if (StringUtils.isNotBlank(output)) {
-            String[] lines = output.split(NEW_LINE);
-            for (String line : lines) {
-                if (!currentOutputLines.contains(line)) {
+            List<String> lines = Arrays.asList(output.split(NEW_LINE));
+            if (lines.size() > 0) {
+                int readStartIndex = (currentOutputLines.size() > 0) ? currentOutputLines.size() - 1 : 0;
+                for (String line : lines.subList(readStartIndex , lines.size() - 1)) {
                     currentOutputLines.add(line);
                     newLines.add(line);
                 }