jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1198863 - /jmeter/trunk/test/src/org/apache/jmeter/testelement/PackageTest.java
Date Mon, 07 Nov 2011 18:40:14 GMT
Author: sebb
Date: Mon Nov  7 18:40:14 2011
New Revision: 1198863

URL: http://svn.apache.org/viewvc?rev=1198863&view=rev
Log:
Better way to disable a test in JUnit 3

Modified:
    jmeter/trunk/test/src/org/apache/jmeter/testelement/PackageTest.java

Modified: jmeter/trunk/test/src/org/apache/jmeter/testelement/PackageTest.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/testelement/PackageTest.java?rev=1198863&r1=1198862&r2=1198863&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/testelement/PackageTest.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/testelement/PackageTest.java Mon Nov  7 18:40:14
2011
@@ -27,6 +27,10 @@ import junit.framework.TestCase;
 import org.apache.jmeter.config.Arguments;
 import org.apache.jmeter.config.ConfigTestElement;
 import org.apache.jmeter.config.LoginConfig;
+import org.apache.jmeter.protocol.http.control.Header;
+import org.apache.jmeter.protocol.http.control.HeaderManager;
+import org.apache.jmeter.sampler.DebugSampler;
+import org.apache.jmeter.testelement.property.CollectionProperty;
 import org.apache.jmeter.testelement.property.NullProperty;
 import org.apache.jmeter.testelement.property.StringProperty;
 import org.apache.jmeter.testelement.property.TestElementProperty;
@@ -35,35 +39,36 @@ public class PackageTest extends TestCas
     public PackageTest(String arg0) {
         super(arg0);
     }
-    
-//    public void testBug50799() throws Exception {
-//        HeaderManager headerManager = new HeaderManager();
-//        headerManager.add(new Header("1stLevelTestHeader", "testValue1"));
-//        HeaderManager headerManager2 = new HeaderManager();
-//        headerManager2.add(new Header("2ndLevelTestHeader", "testValue2"));
-//
-//        DebugSampler debugSampler = new DebugSampler();
-//        debugSampler.addProperty(new StringProperty("name", "DebugSampler_50799"));
-//        debugSampler.setRunningVersion(true);
-//        assertTrue(debugSampler.getProperty("HeaderManager.headers") instanceof NullProperty);
-//        debugSampler.addTestElement(headerManager);
-//        assertFalse(debugSampler.getProperty("HeaderManager.headers") instanceof NullProperty);
-//        assertEquals(debugSampler.getProperty("HeaderManager.headers").getStringValue()
,"[1stLevelTestHeader	testValue1]");
-//
-//        debugSampler.addTestElement(headerManager2);
-//        assertEquals(debugSampler.getProperty("HeaderManager.headers").getStringValue()
,"[1stLevelTestHeader	testValue1, 2ndLevelTestHeader	testValue2]");
-//        assertEquals(2, ((CollectionProperty)debugSampler.getProperty("HeaderManager.headers")).size());
-//        
-//        headerManager.recoverRunningVersion();
-//        headerManager2.recoverRunningVersion();
-//        debugSampler.recoverRunningVersion();
-//
-//        assertEquals(1, headerManager.size());
-//        assertEquals(1, headerManager2.size());
-//        assertEquals(0, ((CollectionProperty)debugSampler.getProperty("HeaderManager.headers")).size());
-//        assertEquals(new Header("1stLevelTestHeader", "testValue1"), headerManager.get(0));
-//        assertEquals(new Header("2ndLevelTestHeader", "testValue2"), headerManager2.get(0));
-//    }
+
+    // Test needs to run in this package in order to give access to AbstractTestElement.addProperty()

+    public void DISABLEDtestBug50799() throws Exception {
+        HeaderManager headerManager = new HeaderManager();
+        headerManager.add(new Header("1stLevelTestHeader", "testValue1"));
+        HeaderManager headerManager2 = new HeaderManager();
+        headerManager2.add(new Header("2ndLevelTestHeader", "testValue2"));
+
+        DebugSampler debugSampler = new DebugSampler();
+        debugSampler.addProperty(new StringProperty("name", "DebugSampler_50799"));
+        debugSampler.setRunningVersion(true);
+        assertTrue(debugSampler.getProperty("HeaderManager.headers") instanceof NullProperty);
+        debugSampler.addTestElement(headerManager);
+        assertFalse(debugSampler.getProperty("HeaderManager.headers") instanceof NullProperty);
+        assertEquals(debugSampler.getProperty("HeaderManager.headers").getStringValue() ,"[1stLevelTestHeader
testValue1]");
+
+        debugSampler.addTestElement(headerManager2);
+        assertEquals(debugSampler.getProperty("HeaderManager.headers").getStringValue() ,"[1stLevelTestHeader
testValue1, 2ndLevelTestHeader	testValue2]");
+        assertEquals(2, ((CollectionProperty)debugSampler.getProperty("HeaderManager.headers")).size());
+        
+        headerManager.recoverRunningVersion();
+        headerManager2.recoverRunningVersion();
+        debugSampler.recoverRunningVersion();
+
+        assertEquals(1, headerManager.size());
+        assertEquals(1, headerManager2.size());
+        assertEquals(0, ((CollectionProperty)debugSampler.getProperty("HeaderManager.headers")).size());
+        assertEquals(new Header("1stLevelTestHeader", "testValue1"), headerManager.get(0));
+        assertEquals(new Header("2ndLevelTestHeader", "testValue2"), headerManager2.get(0));
+    }
 
     public void testRecovery() throws Exception {
         ConfigTestElement config = new ConfigTestElement();



Mime
View raw message