diff --git a/src/main/java/hudson/plugins/performance/parsers/AbstractParser.java b/src/main/java/hudson/plugins/performance/parsers/AbstractParser.java index 127c45a1..5a7a7704 100644 --- a/src/main/java/hudson/plugins/performance/parsers/AbstractParser.java +++ b/src/main/java/hudson/plugins/performance/parsers/AbstractParser.java @@ -51,7 +51,7 @@ public abstract class AbstractParser extends PerformanceReportParser { private static final Cache CACHE = CacheBuilder.newBuilder().maximumSize(1000).softValues().build(); protected boolean isNumberDateFormat = false; - protected SimpleDateFormat format; + protected transient SimpleDateFormat format; protected static final String[] DATE_FORMATS = new String[]{ "yyyy/MM/dd HH:mm:ss.SSS", "yyyy-MM-dd HH:mm:ss.SSS", "yyyy-MM-dd HH:mm:ss,SSS", "yyyy/mm/dd HH:mm:ss" diff --git a/src/test/java/hudson/plugins/performance/PerformancePublisherTest.java b/src/test/java/hudson/plugins/performance/PerformancePublisherTest.java index 9e93911d..3d9d5137 100644 --- a/src/test/java/hudson/plugins/performance/PerformancePublisherTest.java +++ b/src/test/java/hudson/plugins/performance/PerformancePublisherTest.java @@ -92,6 +92,25 @@ public boolean perform(AbstractBuild build, } } + @Test + public void testBuildWithFormattedTimeStamp() throws Exception { + final FreeStyleProject p = jenkinsRule.createFreeStyleProject(); + p.getBuildersList().add(new TestBuilder() { + @Override + public boolean perform(AbstractBuild build, + Launcher launcher, BuildListener listener) + throws InterruptedException, IOException { + build.getWorkspace().child("test.csv").copyFrom( + getClass().getResource("/JMeterPublisher_formatted_timeStamp.csv")); + return true; + } + }); + p.getPublishersList().add(new PerformancePublisher("test.csv")); + + FreeStyleBuild b = jenkinsRule.assertBuildStatus(Result.SUCCESS, p.scheduleBuild2(0).get()); + b.save(); + } + @Test public void testStandardResultsXML() throws Exception { FreeStyleProject p = jenkinsRule.createFreeStyleProject(); diff --git a/src/test/resources/JMeterPublisher_formatted_timeStamp.csv b/src/test/resources/JMeterPublisher_formatted_timeStamp.csv new file mode 100644 index 00000000..390a10cd --- /dev/null +++ b/src/test/resources/JMeterPublisher_formatted_timeStamp.csv @@ -0,0 +1,4 @@ +timeStamp,elapsed,label,responseCode,responseMessage,threadName,dataType,success,bytes +2014-02-24 07:42:21.256,1300,GET /ordermgmt/login - Login Page,501,FAIL,Thread Group 1-1,text,false,3478 +2014-02-24 07:42:21.257,2000,GET /ordermgmt/pre-logout,200,OK,Thread Group 1-1,text,true,19714 +2014-02-24 07:42:21.258,1000,GET /ordermgmt/pre-logout,200,OK,Thread Group 1-1,text,true,19714 \ No newline at end of file