Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Hudson » Plugin - Grinder patch(Patch to make grinder reports work)
Plugin - Grinder patch [message #1151890] Wed, 23 October 2013 13:24 Go to next message
Damian Dragowski is currently offline Damian Dragowski
Messages: 2
Registered: October 2013
Junior Member
Conversion problem.


diff --git a/src/main/java/hudson/plugins/grinder/ResultReader.java b/src/main/java/hudson/plugins/grinder/ResultReader.java
index a5b5943..5d086a1 100644
--- a/src/main/java/hudson/plugins/grinder/ResultReader.java
+++ b/src/main/java/hudson/plugins/grinder/ResultReader.java
@@ -72,7 +72,8 @@ public class ResultReader {
    }
 
    private Test readTest(String testLine, boolean isTotals, boolean hasTPS) {
-      Scanner scanner = new Scanner(testLine).useDelimiter("\\s{2,}").useLocale(Locale.ENGLISH);
+      Scanner scanner = new Scanner(testLine).useDelimiter("\\s{2,}");
+      hudsonConsoleWriter.println(testLine);
       String id = scanner.next();
       int testCount = scanner.nextInt();
       int errorCount = scanner.nextInt();
@@ -91,9 +92,17 @@ public class ResultReader {
             scanner.next(); // reported as '?' in log
          }
          int respErrorCount = scanner.nextInt();
-         double resolveHostMeanTime = scanner.nextDouble();
+         double resolveHostMeanTime = 0.0;
+         if (scanner.hasNextDouble()) {
+             resolveHostMeanTime = scanner.nextDouble();
+         } else {
+             hudsonConsoleWriter.println(scanner.next());
+         }
          double establishConnMeanTime = scanner.nextDouble();
-         double firstByteMeanTime = Double.valueOf(scanner.next().replaceAll("[)]",""));
+         double firstByteMeanTime = 0.0;
+         if ( scanner.hasNextDouble()) {
+             firstByteMeanTime = scanner.nextDouble();
+         }
          String name = isTotals ? "" : scanner.next().replaceAll("\"", "");
 
          return new Test(
Re: Plugin - Grinder patch [message #1152788 is a reply to message #1151890] Thu, 24 October 2013 03:07 Go to previous messageGo to next message
Damian Dragowski is currently offline Damian Dragowski
Messages: 2
Registered: October 2013
Junior Member
Sometimes grinder log char "-" in oposite to expected value so I made better patch above:

diff --git a/src/main/java/hudson/plugins/grinder/ResultReader.java b/src/main/java/hudson/plugins/grinder/ResultReader.java
index a5b5943..7cf9a5e 100644
--- a/src/main/java/hudson/plugins/grinder/ResultReader.java
+++ b/src/main/java/hudson/plugins/grinder/ResultReader.java
@@ -72,7 +72,8 @@ public class ResultReader {
    }
 
    private Test readTest(String testLine, boolean isTotals, boolean hasTPS) {
-      Scanner scanner = new Scanner(testLine).useDelimiter("\\s{2,}").useLocale(Locale.ENGLISH);
+      Scanner scanner = new Scanner(testLine).useDelimiter("\\s{2,}");
+      hudsonConsoleWriter.println(testLine);
       String id = scanner.next();
       int testCount = scanner.nextInt();
       int errorCount = scanner.nextInt();
@@ -91,9 +92,22 @@ public class ResultReader {
             scanner.next(); // reported as '?' in log
          }
          int respErrorCount = scanner.nextInt();
-         double resolveHostMeanTime = scanner.nextDouble();
-         double establishConnMeanTime = scanner.nextDouble();
-         double firstByteMeanTime = Double.valueOf(scanner.next().replaceAll("[)]",""));
+         double resolveHostMeanTime = 0.0;
+         if (scanner.hasNextDouble()) {
+             resolveHostMeanTime = scanner.nextDouble();
+         } else {
+             hudsonConsoleWriter.println(scanner.next());
+         }
+         String eCMT = scanner.next();
+         hudsonConsoleWriter.println(eCMT);
+         eCMT = eCMT.replaceAll(",", ".").replaceAll("-","0");
+         double establishConnMeanTime = Double.valueOf(eCMT);
+         double firstByteMeanTime = 0.0;
+         if ( scanner.hasNextDouble()) {
+             firstByteMeanTime = scanner.nextDouble();
+         } else {
+             scanner.next();
+         }
          String name = isTotals ? "" : scanner.next().replaceAll("\"", "");
 
          return new Test(
Re: Plugin - Grinder patch [message #1154014 is a reply to message #1152788] Thu, 24 October 2013 21:03 Go to previous message
Winston Prakash is currently offline Winston Prakash
Messages: 408
Registered: August 2011
Location: Fremont, CA USA
Senior Member
Hi Damian, thanks for the patch. Is it possible to provide the patch as a pull request to https://github.com/hudson3-plugins/grinder-plugin ?. If that is inconvenient for you, I can manually apply the patch.

Winston Prakash
Eclipse Hudson team
Previous Topic:hudson-remoting-3.0.1.jar not being found by mavin
Next Topic:Duplicate checkout using SVN and multiconfiguration project
Goto Forum:
  


Current Time: Fri Aug 29 10:13:15 EDT 2014

Powered by FUDForum. Page generated in 0.04291 seconds