jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1527197 - in /jmeter/trunk/test/src/org/apache/jmeter/protocol/http: control/gui/TestHttpTestSampleGui.java sampler/PackageTest.java
Date Sat, 28 Sep 2013 14:38:45 GMT
Author: pmouawad
Date: Sat Sep 28 14:38:44 2013
New Revision: 1527197

URL: http://svn.apache.org/r1527197
Log:
Fix test failure

Modified:
    jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/gui/TestHttpTestSampleGui.java
    jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/PackageTest.java

Modified: jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/gui/TestHttpTestSampleGui.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/gui/TestHttpTestSampleGui.java?rev=1527197&r1=1527196&r2=1527197&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/gui/TestHttpTestSampleGui.java
(original)
+++ jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/gui/TestHttpTestSampleGui.java
Sat Sep 28 14:38:44 2013
@@ -18,12 +18,18 @@
 
 package org.apache.jmeter.protocol.http.control.gui;
 
+import java.awt.GraphicsEnvironment;
+
 import junit.framework.TestCase;
 
 import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase;
+import org.apache.jorphan.logging.LoggingManager;
+import org.apache.log.Logger;
 
 public class TestHttpTestSampleGui extends TestCase {
-        private HttpTestSampleGui gui;
+    private static final Logger log = LoggingManager.getLoggerForClass();
+
+    private HttpTestSampleGui gui;
 
         public TestHttpTestSampleGui(String name) {
             super(name);
@@ -31,11 +37,21 @@ public class TestHttpTestSampleGui exten
 
         @Override
         public void setUp() {
+        	if(GraphicsEnvironment.isHeadless()) {
+        		System.out.println("Skipping test:"+getClass().getName()+", cannot run in Headless
mode");
+        		log.warn("Skipping test:"+getClass().getName()+", cannot run in Headless mode");
+        		return;
+        	}
             gui = new HttpTestSampleGui();
         }
 
         public void testCloneSampler() throws Exception {
-            HTTPSamplerBase sampler = (HTTPSamplerBase) gui.createTestElement();
+        	if(GraphicsEnvironment.isHeadless()) {
+        		System.out.println("Skipping test:"+getClass().getName()+"#testCloneSampler"+",
cannot run in Headless mode");
+        		log.warn("Skipping test:"+getClass().getName()+"#testCloneSampler"+", cannot run
in Headless mode");
+        		return;
+        	}
+        	HTTPSamplerBase sampler = (HTTPSamplerBase) gui.createTestElement();
             sampler.addArgument("param", "value");
             HTTPSamplerBase clonedSampler = (HTTPSamplerBase) sampler.clone();
             clonedSampler.setRunningVersion(true);

Modified: jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/PackageTest.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/PackageTest.java?rev=1527197&r1=1527196&r2=1527197&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/PackageTest.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/PackageTest.java Sat Sep
28 14:38:44 2013
@@ -21,6 +21,8 @@
  */
 package org.apache.jmeter.protocol.http.sampler;
 
+import java.awt.HeadlessException;
+
 import junit.framework.TestCase;
 
 import org.apache.jmeter.config.Arguments;
@@ -28,15 +30,24 @@ import org.apache.jmeter.config.ConfigTe
 import org.apache.jmeter.protocol.http.config.gui.HttpDefaultsGui;
 import org.apache.jmeter.protocol.http.control.gui.HttpTestSampleGui;
 import org.apache.jmeter.protocol.http.util.HTTPArgument;
+import org.apache.jorphan.logging.LoggingManager;
+import org.apache.log.Logger;
 
 public class PackageTest extends TestCase {
+    private static final Logger log = LoggingManager.getLoggerForClass();
+
     public PackageTest(String arg0) {
         super(arg0);
     }
 
     public void testConfiguring() throws Exception {
-        HTTPSamplerBase sampler = (HTTPSamplerBase) new HttpTestSampleGui().createTestElement();
-        configure(sampler);
+    	try {
+	        HTTPSamplerBase sampler = (HTTPSamplerBase) new HttpTestSampleGui().createTestElement();
+	        configure(sampler);
+    	} catch (HeadlessException e) {
+            System.out.println("o.a.j.junit.JMeterTest Error running testConfiguring due
to Headless mode, "+e.toString());
+            log.warn("o.a.j.junit.JMeterTest Error running testConfiguring due to Headless
mode, "+e.toString());
+    	}
     }
 
     private void configure(HTTPSamplerBase sampler) throws Exception {



Mime
View raw message