You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by se...@apache.org on 2009/05/10 20:19:30 UTC

svn commit: r773382 [6/6] - in /jakarta/jmeter/trunk/test/src/org/apache: jmeter/engine/ jmeter/engine/util/ jmeter/extractor/ jmeter/functions/ jmeter/gui/action/ jmeter/gui/util/ jmeter/junit/ jmeter/junit/stubs/ jmeter/monitor/model/ jmeter/monitor/...

Modified: jakarta/jmeter/trunk/test/src/org/apache/jmeter/testelement/property/PackageTest.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/test/src/org/apache/jmeter/testelement/property/PackageTest.java?rev=773382&r1=773381&r2=773382&view=diff
==============================================================================
--- jakarta/jmeter/trunk/test/src/org/apache/jmeter/testelement/property/PackageTest.java (original)
+++ jakarta/jmeter/trunk/test/src/org/apache/jmeter/testelement/property/PackageTest.java Sun May 10 18:19:28 2009
@@ -27,293 +27,293 @@
  */
 public class PackageTest extends TestCase {
 
-	public PackageTest(String name) {
-		super(name);
-	}
-
-	public void testStringProperty() throws Exception {
-		StringProperty prop = new StringProperty("name", "value");
-		prop.setRunningVersion(true);
-		prop.setObjectValue("new Value");
-		assertEquals("new Value", prop.getStringValue());
-		prop.recoverRunningVersion(null);
-		assertEquals("value", prop.getStringValue());
-		prop.setObjectValue("new Value");
-		prop.setObjectValue("2nd Value");
-		assertEquals("2nd Value", prop.getStringValue());
-		prop.recoverRunningVersion(null);
-		assertEquals("value", prop.getStringValue());
-	}
-
-	public void testElementProperty() throws Exception {
-		LoginConfig config = new LoginConfig();
-		config.setUsername("username");
-		config.setPassword("password");
-		TestElementProperty prop = new TestElementProperty("name", config);
-		prop.setRunningVersion(true);
-		config = new LoginConfig();
-		config.setUsername("user2");
-		config.setPassword("pass2");
-		prop.setObjectValue(config);
-		assertEquals("user2=pass2", prop.getStringValue());
-		prop.recoverRunningVersion(null);
-		assertEquals("username=password", prop.getStringValue());
-		config = new LoginConfig();
-		config.setUsername("user2");
-		config.setPassword("pass2");
-		prop.setObjectValue(config);
-		config = new LoginConfig();
-		config.setUsername("user3");
-		config.setPassword("pass3");
-		prop.setObjectValue(config);
-		assertEquals("user3=pass3", prop.getStringValue());
-		prop.recoverRunningVersion(null);
-		assertEquals("username=password", prop.getStringValue());
-	}
-
-	private void checkEquals(JMeterProperty jp1, JMeterProperty jp2) {
-		assertEquals(jp1, jp2);
-		assertEquals(jp2, jp1);
-		assertEquals(jp1, jp1);
-		assertEquals(jp2, jp2);
-		assertEquals(jp1.hashCode(), jp2.hashCode());
-
-	}
-
-	private void checkNotEquals(JMeterProperty jp1, JMeterProperty jp2) {
-		assertEquals(jp1, jp1);
-		assertEquals(jp2, jp2);
-		assertFalse(jp1.equals(jp2));
-		assertFalse(jp2.equals(jp1));
-		// Not an absolute requirement:
-		if (jp1.hashCode() == jp2.hashCode()) {
-			System.out.println("Expected different hashCodes for " + jp1.getClass().getName());
-
-		}
-
-	}
-
-	public void testBooleanEquality() throws Exception {
-		BooleanProperty jpn1 = new BooleanProperty();
-		BooleanProperty jpn2 = new BooleanProperty();
-		BooleanProperty jp1 = new BooleanProperty("name1", true);
-		BooleanProperty jp2 = new BooleanProperty("name1", true);
-		BooleanProperty jp3 = new BooleanProperty("name2", true);
-		BooleanProperty jp4 = new BooleanProperty("name2", false);
-		checkEquals(jpn1, jpn2);
-		checkNotEquals(jpn1, jp1);
-		checkNotEquals(jpn1, jp2);
-		checkEquals(jp1, jp2);
-		checkNotEquals(jp1, jp3);
-		checkNotEquals(jp2, jp3);
-		checkNotEquals(jp3, jp4);
-	}
-
-	public void testDoubleEquality() throws Exception {
-		DoubleProperty jpn1 = new DoubleProperty();
-		DoubleProperty jpn2 = new DoubleProperty();
-		DoubleProperty jp1 = new DoubleProperty("name1", 123.4);
-		DoubleProperty jp2 = new DoubleProperty("name1", 123.4);
-		DoubleProperty jp3 = new DoubleProperty("name2", -123.4);
-		DoubleProperty jp4 = new DoubleProperty("name2", 123.4);
-		DoubleProperty jp5 = new DoubleProperty("name2", Double.NEGATIVE_INFINITY);
-		DoubleProperty jp6 = new DoubleProperty("name2", Double.NEGATIVE_INFINITY);
-		DoubleProperty jp7 = new DoubleProperty("name2", Double.POSITIVE_INFINITY);
-		DoubleProperty jp8 = new DoubleProperty("name2", Double.POSITIVE_INFINITY);
-		DoubleProperty jp9 = new DoubleProperty("name2", Double.NaN);
-		DoubleProperty jp10 = new DoubleProperty("name2", Double.NaN);
-		DoubleProperty jp11 = new DoubleProperty("name1", Double.NaN);
-		DoubleProperty jp12 = new DoubleProperty("name1", Double.MIN_VALUE);
-		DoubleProperty jp13 = new DoubleProperty("name2", Double.MIN_VALUE);
-		DoubleProperty jp14 = new DoubleProperty("name2", Double.MIN_VALUE);
-		DoubleProperty jp15 = new DoubleProperty("name1", Double.MAX_VALUE);
-		DoubleProperty jp16 = new DoubleProperty("name2", Double.MAX_VALUE);
-		DoubleProperty jp17 = new DoubleProperty("name2", Double.MAX_VALUE);
-		checkEquals(jpn1, jpn2);
-		checkNotEquals(jpn1, jp1);
-		checkNotEquals(jpn1, jp2);
-		checkEquals(jp1, jp2);
-		checkNotEquals(jp1, jp3);
-		checkNotEquals(jp2, jp3);
-		checkNotEquals(jp3, jp4);
-		checkEquals(jp5, jp6);
-		checkNotEquals(jp3, jp6);
-		checkEquals(jp7, jp8);
-		checkNotEquals(jp4, jp7);
-		checkNotEquals(jp8, jp9);
-		checkEquals(jp9, jp10);
-		checkNotEquals(jp10, jp11);
-		checkNotEquals(jp5, jp10);
-		checkNotEquals(jp12, jp14);
-		checkEquals(jp13, jp14);
-		checkNotEquals(jp15, jp16);
-		checkEquals(jp16, jp17);
-	}
-
-	public void testFloatEquality() throws Exception {
-		FloatProperty jp1 = new FloatProperty("name1", 123.4f);
-		FloatProperty jp2 = new FloatProperty("name1", 123.4f);
-		FloatProperty jp3 = new FloatProperty("name2", -123.4f);
-		FloatProperty jp4 = new FloatProperty("name2", 123.4f);
-		FloatProperty jp5 = new FloatProperty("name2", Float.NEGATIVE_INFINITY);
-		FloatProperty jp6 = new FloatProperty("name2", Float.NEGATIVE_INFINITY);
-		FloatProperty jp7 = new FloatProperty("name2", Float.POSITIVE_INFINITY);
-		FloatProperty jp8 = new FloatProperty("name2", Float.POSITIVE_INFINITY);
-		FloatProperty jp9 = new FloatProperty("name2", Float.NaN);
-		FloatProperty jp10 = new FloatProperty("name2", Float.NaN);
-		FloatProperty jp11 = new FloatProperty("name1", Float.NaN);
-		FloatProperty jp12 = new FloatProperty("name1", Float.MIN_VALUE);
-		FloatProperty jp13 = new FloatProperty("name2", Float.MIN_VALUE);
-		FloatProperty jp14 = new FloatProperty("name2", Float.MIN_VALUE);
-		FloatProperty jp15 = new FloatProperty("name1", Float.MAX_VALUE);
-		FloatProperty jp16 = new FloatProperty("name2", Float.MAX_VALUE);
-		FloatProperty jp17 = new FloatProperty("name2", Float.MAX_VALUE);
-		checkEquals(jp1, jp2);
-		checkNotEquals(jp1, jp3);
-		checkNotEquals(jp2, jp3);
-		checkNotEquals(jp3, jp4);
-		checkEquals(jp5, jp6);
-		checkNotEquals(jp3, jp6);
-		checkEquals(jp7, jp8);
-		checkNotEquals(jp4, jp7);
-		checkNotEquals(jp8, jp9);
-		checkEquals(jp9, jp10);
-		checkNotEquals(jp10, jp11);
-		checkNotEquals(jp5, jp10);
-		checkNotEquals(jp12, jp14);
-		checkEquals(jp13, jp14);
-		checkNotEquals(jp15, jp16);
-		checkEquals(jp16, jp17);
-	}
-
-	public void testIntegerEquality() throws Exception {
-		IntegerProperty jp1 = new IntegerProperty("name1", 123);
-		IntegerProperty jp2 = new IntegerProperty("name1", 123);
-		IntegerProperty jp3 = new IntegerProperty("name2", -123);
-		IntegerProperty jp4 = new IntegerProperty("name2", 123);
-		IntegerProperty jp5 = new IntegerProperty("name2", Integer.MIN_VALUE);
-		IntegerProperty jp6 = new IntegerProperty("name2", Integer.MIN_VALUE);
-		IntegerProperty jp7 = new IntegerProperty("name2", Integer.MAX_VALUE);
-		IntegerProperty jp8 = new IntegerProperty("name2", Integer.MAX_VALUE);
-		IntegerProperty jp9 = new IntegerProperty("name1", Integer.MIN_VALUE);
-		IntegerProperty jp10 = new IntegerProperty("name1", Integer.MAX_VALUE);
-		checkEquals(jp1, jp2);
-		checkNotEquals(jp1, jp3);
-		checkNotEquals(jp2, jp3);
-		checkNotEquals(jp3, jp4);
-		checkEquals(jp5, jp6);
-		checkNotEquals(jp3, jp6);
-		checkEquals(jp7, jp8);
-		checkNotEquals(jp4, jp7);
-		checkNotEquals(jp9, jp5);
-		checkNotEquals(jp10, jp7);
-		checkNotEquals(jp9, jp10);
-		try {
-			new IntegerProperty(null);
-			fail("Should have generated an Illegal Argument Exception");
-		} catch (IllegalArgumentException e) {
-		}
-		try {
-			new IntegerProperty(null, 0);
-			fail("Should have generated an Illegal Argument Exception");
-		} catch (IllegalArgumentException e) {
-		}
-	}
-
-	public void testLongEquality() throws Exception {
-		LongProperty jp1 = new LongProperty("name1", 123);
-		LongProperty jp2 = new LongProperty("name1", 123);
-		LongProperty jp3 = new LongProperty("name2", -123);
-		LongProperty jp4 = new LongProperty("name2", 123);
-		LongProperty jp5 = new LongProperty("name2", Long.MIN_VALUE);
-		LongProperty jp6 = new LongProperty("name2", Long.MIN_VALUE);
-		LongProperty jp7 = new LongProperty("name2", Long.MAX_VALUE);
-		LongProperty jp8 = new LongProperty("name2", Long.MAX_VALUE);
-		LongProperty jp9 = new LongProperty("name1", Long.MIN_VALUE);
-		LongProperty jp10 = new LongProperty("name1", Long.MAX_VALUE);
-		checkEquals(jp1, jp2);
-		checkNotEquals(jp1, jp3);
-		checkNotEquals(jp2, jp3);
-		checkNotEquals(jp3, jp4);
-		checkEquals(jp5, jp6);
-		checkNotEquals(jp3, jp6);
-		checkEquals(jp7, jp8);
-		checkNotEquals(jp4, jp7);
-		checkNotEquals(jp9, jp5);
-		checkNotEquals(jp10, jp7);
-		checkNotEquals(jp9, jp10);
-		try {
-			new LongProperty(null, 0L);
-			fail("Should have generated an Illegal Argument Exception");
-		} catch (IllegalArgumentException e) {
-		}
-	}
-
-	public void testMapEquality() throws Exception {
-		try {
-			new MapProperty(null, null);
-			fail("Should have generated an Illegal Argument Exception");
-		} catch (IllegalArgumentException e) {
-		}
-
-	}
-
-	public void testNullEquality() throws Exception {
-		NullProperty jpn1 = new NullProperty();
-		NullProperty jpn2 = new NullProperty();
-		try {
-			new NullProperty(null);
-			fail("Should have generated an Illegal Argument Exception");
-		} catch (IllegalArgumentException e) {
-		}
-		NullProperty jp1 = new NullProperty("name1");
-		NullProperty jp2 = new NullProperty("name1");
-		NullProperty jp3 = new NullProperty("name2");
-		NullProperty jp4 = new NullProperty("name2");
-		checkEquals(jpn1, jpn2);
-		checkNotEquals(jpn1, jp1);
-		checkEquals(jp1, jp2);
-		checkNotEquals(jp1, jp3);
-		checkNotEquals(jp2, jp3);
-		checkEquals(jp3, jp4);
-	}
-
-	public void testStringEquality() throws Exception {
-		StringProperty jpn1 = new StringProperty();
-		StringProperty jpn2 = new StringProperty();
-		StringProperty jp1 = new StringProperty("name1", "value1");
-		StringProperty jp2 = new StringProperty("name1", "value1");
-		StringProperty jp3 = new StringProperty("name2", "value1");
-		StringProperty jp4 = new StringProperty("name2", "value2");
-		StringProperty jp5 = new StringProperty("name1", null);
-		StringProperty jp6 = new StringProperty("name1", null);
-		StringProperty jp7 = new StringProperty("name2", null);
-		checkEquals(jpn1, jpn2);
-		checkNotEquals(jpn1, jp1);
-		checkEquals(jp1, jp2);
-		checkNotEquals(jp1, jp3);
-		checkNotEquals(jp2, jp3);
-		checkNotEquals(jp3, jp4);
-		checkEquals(jp5, jp6);
-		checkNotEquals(jp3, jp5);
-		checkNotEquals(jp6, jp7);
-		try {
-			new StringProperty(null, "");
-			fail("Should have generated an Illegal Argument Exception");
-		} catch (IllegalArgumentException e) {
-		}
-		try {
-			new StringProperty(null, null);
-			fail("Should have generated an Illegal Argument Exception");
-		} catch (IllegalArgumentException e) {
-		}
-
-	}
-	public void testAddingProperties() throws Exception {
-		CollectionProperty coll = new CollectionProperty();
-		coll.addItem("joe");
-		coll.addProperty(new FunctionProperty());
-		assertEquals("joe", coll.get(0).getStringValue());
-		assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", coll.get(1).getClass().getName());
-	}
+    public PackageTest(String name) {
+        super(name);
+    }
+
+    public void testStringProperty() throws Exception {
+        StringProperty prop = new StringProperty("name", "value");
+        prop.setRunningVersion(true);
+        prop.setObjectValue("new Value");
+        assertEquals("new Value", prop.getStringValue());
+        prop.recoverRunningVersion(null);
+        assertEquals("value", prop.getStringValue());
+        prop.setObjectValue("new Value");
+        prop.setObjectValue("2nd Value");
+        assertEquals("2nd Value", prop.getStringValue());
+        prop.recoverRunningVersion(null);
+        assertEquals("value", prop.getStringValue());
+    }
+
+    public void testElementProperty() throws Exception {
+        LoginConfig config = new LoginConfig();
+        config.setUsername("username");
+        config.setPassword("password");
+        TestElementProperty prop = new TestElementProperty("name", config);
+        prop.setRunningVersion(true);
+        config = new LoginConfig();
+        config.setUsername("user2");
+        config.setPassword("pass2");
+        prop.setObjectValue(config);
+        assertEquals("user2=pass2", prop.getStringValue());
+        prop.recoverRunningVersion(null);
+        assertEquals("username=password", prop.getStringValue());
+        config = new LoginConfig();
+        config.setUsername("user2");
+        config.setPassword("pass2");
+        prop.setObjectValue(config);
+        config = new LoginConfig();
+        config.setUsername("user3");
+        config.setPassword("pass3");
+        prop.setObjectValue(config);
+        assertEquals("user3=pass3", prop.getStringValue());
+        prop.recoverRunningVersion(null);
+        assertEquals("username=password", prop.getStringValue());
+    }
+
+    private void checkEquals(JMeterProperty jp1, JMeterProperty jp2) {
+        assertEquals(jp1, jp2);
+        assertEquals(jp2, jp1);
+        assertEquals(jp1, jp1);
+        assertEquals(jp2, jp2);
+        assertEquals(jp1.hashCode(), jp2.hashCode());
+
+    }
+
+    private void checkNotEquals(JMeterProperty jp1, JMeterProperty jp2) {
+        assertEquals(jp1, jp1);
+        assertEquals(jp2, jp2);
+        assertFalse(jp1.equals(jp2));
+        assertFalse(jp2.equals(jp1));
+        // Not an absolute requirement:
+        if (jp1.hashCode() == jp2.hashCode()) {
+            System.out.println("Expected different hashCodes for " + jp1.getClass().getName());
+
+        }
+
+    }
+
+    public void testBooleanEquality() throws Exception {
+        BooleanProperty jpn1 = new BooleanProperty();
+        BooleanProperty jpn2 = new BooleanProperty();
+        BooleanProperty jp1 = new BooleanProperty("name1", true);
+        BooleanProperty jp2 = new BooleanProperty("name1", true);
+        BooleanProperty jp3 = new BooleanProperty("name2", true);
+        BooleanProperty jp4 = new BooleanProperty("name2", false);
+        checkEquals(jpn1, jpn2);
+        checkNotEquals(jpn1, jp1);
+        checkNotEquals(jpn1, jp2);
+        checkEquals(jp1, jp2);
+        checkNotEquals(jp1, jp3);
+        checkNotEquals(jp2, jp3);
+        checkNotEquals(jp3, jp4);
+    }
+
+    public void testDoubleEquality() throws Exception {
+        DoubleProperty jpn1 = new DoubleProperty();
+        DoubleProperty jpn2 = new DoubleProperty();
+        DoubleProperty jp1 = new DoubleProperty("name1", 123.4);
+        DoubleProperty jp2 = new DoubleProperty("name1", 123.4);
+        DoubleProperty jp3 = new DoubleProperty("name2", -123.4);
+        DoubleProperty jp4 = new DoubleProperty("name2", 123.4);
+        DoubleProperty jp5 = new DoubleProperty("name2", Double.NEGATIVE_INFINITY);
+        DoubleProperty jp6 = new DoubleProperty("name2", Double.NEGATIVE_INFINITY);
+        DoubleProperty jp7 = new DoubleProperty("name2", Double.POSITIVE_INFINITY);
+        DoubleProperty jp8 = new DoubleProperty("name2", Double.POSITIVE_INFINITY);
+        DoubleProperty jp9 = new DoubleProperty("name2", Double.NaN);
+        DoubleProperty jp10 = new DoubleProperty("name2", Double.NaN);
+        DoubleProperty jp11 = new DoubleProperty("name1", Double.NaN);
+        DoubleProperty jp12 = new DoubleProperty("name1", Double.MIN_VALUE);
+        DoubleProperty jp13 = new DoubleProperty("name2", Double.MIN_VALUE);
+        DoubleProperty jp14 = new DoubleProperty("name2", Double.MIN_VALUE);
+        DoubleProperty jp15 = new DoubleProperty("name1", Double.MAX_VALUE);
+        DoubleProperty jp16 = new DoubleProperty("name2", Double.MAX_VALUE);
+        DoubleProperty jp17 = new DoubleProperty("name2", Double.MAX_VALUE);
+        checkEquals(jpn1, jpn2);
+        checkNotEquals(jpn1, jp1);
+        checkNotEquals(jpn1, jp2);
+        checkEquals(jp1, jp2);
+        checkNotEquals(jp1, jp3);
+        checkNotEquals(jp2, jp3);
+        checkNotEquals(jp3, jp4);
+        checkEquals(jp5, jp6);
+        checkNotEquals(jp3, jp6);
+        checkEquals(jp7, jp8);
+        checkNotEquals(jp4, jp7);
+        checkNotEquals(jp8, jp9);
+        checkEquals(jp9, jp10);
+        checkNotEquals(jp10, jp11);
+        checkNotEquals(jp5, jp10);
+        checkNotEquals(jp12, jp14);
+        checkEquals(jp13, jp14);
+        checkNotEquals(jp15, jp16);
+        checkEquals(jp16, jp17);
+    }
+
+    public void testFloatEquality() throws Exception {
+        FloatProperty jp1 = new FloatProperty("name1", 123.4f);
+        FloatProperty jp2 = new FloatProperty("name1", 123.4f);
+        FloatProperty jp3 = new FloatProperty("name2", -123.4f);
+        FloatProperty jp4 = new FloatProperty("name2", 123.4f);
+        FloatProperty jp5 = new FloatProperty("name2", Float.NEGATIVE_INFINITY);
+        FloatProperty jp6 = new FloatProperty("name2", Float.NEGATIVE_INFINITY);
+        FloatProperty jp7 = new FloatProperty("name2", Float.POSITIVE_INFINITY);
+        FloatProperty jp8 = new FloatProperty("name2", Float.POSITIVE_INFINITY);
+        FloatProperty jp9 = new FloatProperty("name2", Float.NaN);
+        FloatProperty jp10 = new FloatProperty("name2", Float.NaN);
+        FloatProperty jp11 = new FloatProperty("name1", Float.NaN);
+        FloatProperty jp12 = new FloatProperty("name1", Float.MIN_VALUE);
+        FloatProperty jp13 = new FloatProperty("name2", Float.MIN_VALUE);
+        FloatProperty jp14 = new FloatProperty("name2", Float.MIN_VALUE);
+        FloatProperty jp15 = new FloatProperty("name1", Float.MAX_VALUE);
+        FloatProperty jp16 = new FloatProperty("name2", Float.MAX_VALUE);
+        FloatProperty jp17 = new FloatProperty("name2", Float.MAX_VALUE);
+        checkEquals(jp1, jp2);
+        checkNotEquals(jp1, jp3);
+        checkNotEquals(jp2, jp3);
+        checkNotEquals(jp3, jp4);
+        checkEquals(jp5, jp6);
+        checkNotEquals(jp3, jp6);
+        checkEquals(jp7, jp8);
+        checkNotEquals(jp4, jp7);
+        checkNotEquals(jp8, jp9);
+        checkEquals(jp9, jp10);
+        checkNotEquals(jp10, jp11);
+        checkNotEquals(jp5, jp10);
+        checkNotEquals(jp12, jp14);
+        checkEquals(jp13, jp14);
+        checkNotEquals(jp15, jp16);
+        checkEquals(jp16, jp17);
+    }
+
+    public void testIntegerEquality() throws Exception {
+        IntegerProperty jp1 = new IntegerProperty("name1", 123);
+        IntegerProperty jp2 = new IntegerProperty("name1", 123);
+        IntegerProperty jp3 = new IntegerProperty("name2", -123);
+        IntegerProperty jp4 = new IntegerProperty("name2", 123);
+        IntegerProperty jp5 = new IntegerProperty("name2", Integer.MIN_VALUE);
+        IntegerProperty jp6 = new IntegerProperty("name2", Integer.MIN_VALUE);
+        IntegerProperty jp7 = new IntegerProperty("name2", Integer.MAX_VALUE);
+        IntegerProperty jp8 = new IntegerProperty("name2", Integer.MAX_VALUE);
+        IntegerProperty jp9 = new IntegerProperty("name1", Integer.MIN_VALUE);
+        IntegerProperty jp10 = new IntegerProperty("name1", Integer.MAX_VALUE);
+        checkEquals(jp1, jp2);
+        checkNotEquals(jp1, jp3);
+        checkNotEquals(jp2, jp3);
+        checkNotEquals(jp3, jp4);
+        checkEquals(jp5, jp6);
+        checkNotEquals(jp3, jp6);
+        checkEquals(jp7, jp8);
+        checkNotEquals(jp4, jp7);
+        checkNotEquals(jp9, jp5);
+        checkNotEquals(jp10, jp7);
+        checkNotEquals(jp9, jp10);
+        try {
+            new IntegerProperty(null);
+            fail("Should have generated an Illegal Argument Exception");
+        } catch (IllegalArgumentException e) {
+        }
+        try {
+            new IntegerProperty(null, 0);
+            fail("Should have generated an Illegal Argument Exception");
+        } catch (IllegalArgumentException e) {
+        }
+    }
+
+    public void testLongEquality() throws Exception {
+        LongProperty jp1 = new LongProperty("name1", 123);
+        LongProperty jp2 = new LongProperty("name1", 123);
+        LongProperty jp3 = new LongProperty("name2", -123);
+        LongProperty jp4 = new LongProperty("name2", 123);
+        LongProperty jp5 = new LongProperty("name2", Long.MIN_VALUE);
+        LongProperty jp6 = new LongProperty("name2", Long.MIN_VALUE);
+        LongProperty jp7 = new LongProperty("name2", Long.MAX_VALUE);
+        LongProperty jp8 = new LongProperty("name2", Long.MAX_VALUE);
+        LongProperty jp9 = new LongProperty("name1", Long.MIN_VALUE);
+        LongProperty jp10 = new LongProperty("name1", Long.MAX_VALUE);
+        checkEquals(jp1, jp2);
+        checkNotEquals(jp1, jp3);
+        checkNotEquals(jp2, jp3);
+        checkNotEquals(jp3, jp4);
+        checkEquals(jp5, jp6);
+        checkNotEquals(jp3, jp6);
+        checkEquals(jp7, jp8);
+        checkNotEquals(jp4, jp7);
+        checkNotEquals(jp9, jp5);
+        checkNotEquals(jp10, jp7);
+        checkNotEquals(jp9, jp10);
+        try {
+            new LongProperty(null, 0L);
+            fail("Should have generated an Illegal Argument Exception");
+        } catch (IllegalArgumentException e) {
+        }
+    }
+
+    public void testMapEquality() throws Exception {
+        try {
+            new MapProperty(null, null);
+            fail("Should have generated an Illegal Argument Exception");
+        } catch (IllegalArgumentException e) {
+        }
+
+    }
+
+    public void testNullEquality() throws Exception {
+        NullProperty jpn1 = new NullProperty();
+        NullProperty jpn2 = new NullProperty();
+        try {
+            new NullProperty(null);
+            fail("Should have generated an Illegal Argument Exception");
+        } catch (IllegalArgumentException e) {
+        }
+        NullProperty jp1 = new NullProperty("name1");
+        NullProperty jp2 = new NullProperty("name1");
+        NullProperty jp3 = new NullProperty("name2");
+        NullProperty jp4 = new NullProperty("name2");
+        checkEquals(jpn1, jpn2);
+        checkNotEquals(jpn1, jp1);
+        checkEquals(jp1, jp2);
+        checkNotEquals(jp1, jp3);
+        checkNotEquals(jp2, jp3);
+        checkEquals(jp3, jp4);
+    }
+
+    public void testStringEquality() throws Exception {
+        StringProperty jpn1 = new StringProperty();
+        StringProperty jpn2 = new StringProperty();
+        StringProperty jp1 = new StringProperty("name1", "value1");
+        StringProperty jp2 = new StringProperty("name1", "value1");
+        StringProperty jp3 = new StringProperty("name2", "value1");
+        StringProperty jp4 = new StringProperty("name2", "value2");
+        StringProperty jp5 = new StringProperty("name1", null);
+        StringProperty jp6 = new StringProperty("name1", null);
+        StringProperty jp7 = new StringProperty("name2", null);
+        checkEquals(jpn1, jpn2);
+        checkNotEquals(jpn1, jp1);
+        checkEquals(jp1, jp2);
+        checkNotEquals(jp1, jp3);
+        checkNotEquals(jp2, jp3);
+        checkNotEquals(jp3, jp4);
+        checkEquals(jp5, jp6);
+        checkNotEquals(jp3, jp5);
+        checkNotEquals(jp6, jp7);
+        try {
+            new StringProperty(null, "");
+            fail("Should have generated an Illegal Argument Exception");
+        } catch (IllegalArgumentException e) {
+        }
+        try {
+            new StringProperty(null, null);
+            fail("Should have generated an Illegal Argument Exception");
+        } catch (IllegalArgumentException e) {
+        }
+
+    }
+    public void testAddingProperties() throws Exception {
+        CollectionProperty coll = new CollectionProperty();
+        coll.addItem("joe");
+        coll.addProperty(new FunctionProperty());
+        assertEquals("joe", coll.get(0).getStringValue());
+        assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", coll.get(1).getClass().getName());
+    }
 }

Modified: jakarta/jmeter/trunk/test/src/org/apache/jmeter/threads/TestTestCompiler.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/test/src/org/apache/jmeter/threads/TestTestCompiler.java?rev=773382&r1=773381&r2=773382&view=diff
==============================================================================
--- jakarta/jmeter/trunk/test/src/org/apache/jmeter/threads/TestTestCompiler.java (original)
+++ jakarta/jmeter/trunk/test/src/org/apache/jmeter/threads/TestTestCompiler.java Sun May 10 18:19:28 2009
@@ -25,35 +25,35 @@
 import org.apache.jorphan.collections.ListedHashTree;
 
 public class TestTestCompiler extends junit.framework.TestCase {
-		public TestTestCompiler(String name) {
-			super(name);
-		}
+        public TestTestCompiler(String name) {
+            super(name);
+        }
 
-		public void testConfigGathering() throws Exception {
-			ListedHashTree testing = new ListedHashTree();
-			GenericController controller = new GenericController();
-			ConfigTestElement config1 = new ConfigTestElement();
-			config1.setName("config1");
-			config1.setProperty("test.property", "A test value");
-			TestSampler sampler = new TestSampler();
-			sampler.setName("sampler");
-			testing.add(controller, config1);
-			testing.add(controller, sampler);
-			TestCompiler.initialize();
+        public void testConfigGathering() throws Exception {
+            ListedHashTree testing = new ListedHashTree();
+            GenericController controller = new GenericController();
+            ConfigTestElement config1 = new ConfigTestElement();
+            config1.setName("config1");
+            config1.setProperty("test.property", "A test value");
+            TestSampler sampler = new TestSampler();
+            sampler.setName("sampler");
+            testing.add(controller, config1);
+            testing.add(controller, sampler);
+            TestCompiler.initialize();
 
-			TestCompiler compiler = new TestCompiler(testing, new JMeterVariables());
-			testing.traverse(compiler);
-			sampler = (TestSampler) compiler.configureSampler(sampler).getSampler();
-			assertEquals("A test value", sampler.getPropertyAsString("test.property"));
-		}
+            TestCompiler compiler = new TestCompiler(testing, new JMeterVariables());
+            testing.traverse(compiler);
+            sampler = (TestSampler) compiler.configureSampler(sampler).getSampler();
+            assertEquals("A test value", sampler.getPropertyAsString("test.property"));
+        }
 
-		class TestSampler extends AbstractSampler {
-			public SampleResult sample(org.apache.jmeter.samplers.Entry e) {
-				return null;
-			}
+        class TestSampler extends AbstractSampler {
+            public SampleResult sample(org.apache.jmeter.samplers.Entry e) {
+                return null;
+            }
 
-			public Object clone() {
-				return new TestSampler();
-			}
-		}
+            public Object clone() {
+                return new TestSampler();
+            }
+        }
 }

Modified: jakarta/jmeter/trunk/test/src/org/apache/jmeter/timers/PackageTest.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/test/src/org/apache/jmeter/timers/PackageTest.java?rev=773382&r1=773381&r2=773382&view=diff
==============================================================================
--- jakarta/jmeter/trunk/test/src/org/apache/jmeter/timers/PackageTest.java (original)
+++ jakarta/jmeter/trunk/test/src/org/apache/jmeter/timers/PackageTest.java Sun May 10 18:19:28 2009
@@ -30,13 +30,13 @@
 
 public class PackageTest extends JMeterTestCase {
 
-	private static final Logger log = LoggingManager.getLoggerForClass();
+    private static final Logger log = LoggingManager.getLoggerForClass();
 
     public PackageTest(String arg0) {
-		super(arg0);
-	}
+        super(arg0);
+    }
 
-	public void testTimer1() throws Exception {
+    public void testTimer1() throws Exception {
         ConstantThroughputTimer timer = new ConstantThroughputTimer();
         assertEquals(0,timer.getCalcModeInt());// Assume this thread only
         timer.setThroughput(60.0);// 1 per second
@@ -45,7 +45,7 @@
         Thread.sleep(500);
         long diff=Math.abs(timer.delay()-500);
         assertTrue("Delay is approximately 500",diff<=50);
-	}
+    }
 
     public void testTimer2() throws Exception {
         ConstantThroughputTimer timer = new ConstantThroughputTimer();
@@ -79,11 +79,11 @@
     }
 
     public void testTimerBSH() throws Exception {
-		if (!BeanShellInterpreter.isInterpreterPresent()){
-			final String msg = "BeanShell jar not present, test ignored";
-			log.warn(msg);
-			return;
-		}
+        if (!BeanShellInterpreter.isInterpreterPresent()){
+            final String msg = "BeanShell jar not present, test ignored";
+            log.warn(msg);
+            return;
+        }
         BeanShellTimer timer = new BeanShellTimer();
         long delay;
         

Modified: jakarta/jmeter/trunk/test/src/org/apache/jmeter/util/PackageTest.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/test/src/org/apache/jmeter/util/PackageTest.java?rev=773382&r1=773381&r2=773382&view=diff
==============================================================================
--- jakarta/jmeter/trunk/test/src/org/apache/jmeter/util/PackageTest.java (original)
+++ jakarta/jmeter/trunk/test/src/org/apache/jmeter/util/PackageTest.java Sun May 10 18:19:28 2009
@@ -22,39 +22,39 @@
 
 public class PackageTest extends TestCase {
 
-	public PackageTest() {
-		super();
-	}
-
-	public PackageTest(String arg0) {
-		super(arg0);
-	}
-
-	public void testServer() throws Exception {
-		BeanShellServer bshs = new BeanShellServer(9876, "");
-		assertNotNull(bshs);
-		// Not sure we can test anything else here
-	}
-	public void testSub1() throws Exception {
-		String input = "http://jakarta.apache.org/jmeter/index.html";
-		String pattern = "jakarta.apache.org";
-		String sub = "${server}";
-		assertEquals("http://${server}/jmeter/index.html", StringUtilities.substitute(input, pattern, sub));
-	}
-
-	public void testSub2() throws Exception {
-		String input = "arg1=param1;param1";
-		String pattern = "param1";
-		String sub = "${value}";
-		assertEquals("arg1=${value};${value}", StringUtilities.substitute(input, pattern, sub));
-	}
-
-	public void testSub3() throws Exception {
-		String input = "jakarta.apache.org";
-		String pattern = "jakarta.apache.org";
-		String sub = "${server}";
-		assertEquals("${server}", StringUtilities.substitute(input, pattern, sub));
-	}
+    public PackageTest() {
+        super();
+    }
+
+    public PackageTest(String arg0) {
+        super(arg0);
+    }
+
+    public void testServer() throws Exception {
+        BeanShellServer bshs = new BeanShellServer(9876, "");
+        assertNotNull(bshs);
+        // Not sure we can test anything else here
+    }
+    public void testSub1() throws Exception {
+        String input = "http://jakarta.apache.org/jmeter/index.html";
+        String pattern = "jakarta.apache.org";
+        String sub = "${server}";
+        assertEquals("http://${server}/jmeter/index.html", StringUtilities.substitute(input, pattern, sub));
+    }
+
+    public void testSub2() throws Exception {
+        String input = "arg1=param1;param1";
+        String pattern = "param1";
+        String sub = "${value}";
+        assertEquals("arg1=${value};${value}", StringUtilities.substitute(input, pattern, sub));
+    }
+
+    public void testSub3() throws Exception {
+        String input = "jakarta.apache.org";
+        String pattern = "jakarta.apache.org";
+        String sub = "${server}";
+        assertEquals("${server}", StringUtilities.substitute(input, pattern, sub));
+    }
 
     public void testSub4() throws Exception {
         String input = "//a///b////c";

Modified: jakarta/jmeter/trunk/test/src/org/apache/jmeter/util/TestJMeterUtils.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/test/src/org/apache/jmeter/util/TestJMeterUtils.java?rev=773382&r1=773381&r2=773382&view=diff
==============================================================================
--- jakarta/jmeter/trunk/test/src/org/apache/jmeter/util/TestJMeterUtils.java (original)
+++ jakarta/jmeter/trunk/test/src/org/apache/jmeter/util/TestJMeterUtils.java Sun May 10 18:19:28 2009
@@ -35,6 +35,6 @@
     }
     //TODO add some real tests now that split() has been removed
     public void test1() throws Exception{
-    	
+        
     }
 }

Modified: jakarta/jmeter/trunk/test/src/org/apache/jorphan/TestFunctorUsers.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/test/src/org/apache/jorphan/TestFunctorUsers.java?rev=773382&r1=773381&r2=773382&view=diff
==============================================================================
--- jakarta/jmeter/trunk/test/src/org/apache/jorphan/TestFunctorUsers.java (original)
+++ jakarta/jmeter/trunk/test/src/org/apache/jorphan/TestFunctorUsers.java Sun May 10 18:19:28 2009
@@ -33,35 +33,35 @@
  */
 public class TestFunctorUsers extends JMeterTestCase {
 
-	public TestFunctorUsers(String arg0) {
-		super(arg0);
-	}
-    
-	public void testSummaryReport() throws Exception{
-		assertTrue("SummaryReport Functor",SummaryReport.testFunctors());
-	}
-    
-	public void testTableVisualizer() throws Exception{
-		assertTrue("TableVisualizer Functor",TableVisualizer.testFunctors());
-	}
-    
-	public void testStatGraphVisualizer() throws Exception{
-		assertTrue("StatGraphVisualizer Functor",StatGraphVisualizer.testFunctors());
-	}
-    
-	public void testStatVisualizer() throws Exception{
-		assertTrue("StatVisualizer Functor",StatVisualizer.testFunctors());
-	}
-    
-	public void testArgumentsPanel() throws Exception{
-		assertTrue("ArgumentsPanel Functor",ArgumentsPanel.testFunctors());
-	}
-    
-	public void testHTTPArgumentsPanel() throws Exception{
-		assertTrue("HTTPArgumentsPanel Functor",HTTPArgumentsPanel.testFunctors());
-	}
-    
-	public void testLDAPArgumentsPanel() throws Exception{
-		assertTrue("LDAPArgumentsPanel Functor",LDAPArgumentsPanel.testFunctors());
-	}
+    public TestFunctorUsers(String arg0) {
+        super(arg0);
+    }
+    
+    public void testSummaryReport() throws Exception{
+        assertTrue("SummaryReport Functor",SummaryReport.testFunctors());
+    }
+    
+    public void testTableVisualizer() throws Exception{
+        assertTrue("TableVisualizer Functor",TableVisualizer.testFunctors());
+    }
+    
+    public void testStatGraphVisualizer() throws Exception{
+        assertTrue("StatGraphVisualizer Functor",StatGraphVisualizer.testFunctors());
+    }
+    
+    public void testStatVisualizer() throws Exception{
+        assertTrue("StatVisualizer Functor",StatVisualizer.testFunctors());
+    }
+    
+    public void testArgumentsPanel() throws Exception{
+        assertTrue("ArgumentsPanel Functor",ArgumentsPanel.testFunctors());
+    }
+    
+    public void testHTTPArgumentsPanel() throws Exception{
+        assertTrue("HTTPArgumentsPanel Functor",HTTPArgumentsPanel.testFunctors());
+    }
+    
+    public void testLDAPArgumentsPanel() throws Exception{
+        assertTrue("LDAPArgumentsPanel Functor",LDAPArgumentsPanel.testFunctors());
+    }
 }

Modified: jakarta/jmeter/trunk/test/src/org/apache/jorphan/TestXMLBuffer.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/test/src/org/apache/jorphan/TestXMLBuffer.java?rev=773382&r1=773381&r2=773382&view=diff
==============================================================================
--- jakarta/jmeter/trunk/test/src/org/apache/jorphan/TestXMLBuffer.java (original)
+++ jakarta/jmeter/trunk/test/src/org/apache/jorphan/TestXMLBuffer.java Sun May 10 18:19:28 2009
@@ -23,34 +23,34 @@
 
 public class TestXMLBuffer extends JMeterTestCase {
 
-	public TestXMLBuffer(String arg0) {
-		super(arg0);
-	}
+    public TestXMLBuffer(String arg0) {
+        super(arg0);
+    }
     
-	public void test1() throws Exception{
-		XMLBuffer xb = new XMLBuffer();
-		xb.openTag("start");
-		assertEquals("<start></start>\n",xb.toString());
-	}
-	
-	public void test2() throws Exception{
-		XMLBuffer xb = new XMLBuffer();
-		xb.tag("start","now");
-		assertEquals("<start>now</start>\n",xb.toString());
-	}
-	public void test3() throws Exception{
-		XMLBuffer xb = new XMLBuffer();
-		xb.openTag("abc");
-		xb.closeTag("abc");
-		assertEquals("<abc></abc>\n",xb.toString());
-	}
-	public void test4() throws Exception{
-		XMLBuffer xb = new XMLBuffer();
-		xb.openTag("abc");
-		try {
-			xb.closeTag("abcd");
-			fail("Should have caused IllegalArgumentException");
-		} catch (IllegalArgumentException e) {
-		}
-	}
+    public void test1() throws Exception{
+        XMLBuffer xb = new XMLBuffer();
+        xb.openTag("start");
+        assertEquals("<start></start>\n",xb.toString());
+    }
+    
+    public void test2() throws Exception{
+        XMLBuffer xb = new XMLBuffer();
+        xb.tag("start","now");
+        assertEquals("<start>now</start>\n",xb.toString());
+    }
+    public void test3() throws Exception{
+        XMLBuffer xb = new XMLBuffer();
+        xb.openTag("abc");
+        xb.closeTag("abc");
+        assertEquals("<abc></abc>\n",xb.toString());
+    }
+    public void test4() throws Exception{
+        XMLBuffer xb = new XMLBuffer();
+        xb.openTag("abc");
+        try {
+            xb.closeTag("abcd");
+            fail("Should have caused IllegalArgumentException");
+        } catch (IllegalArgumentException e) {
+        }
+    }
 }

Modified: jakarta/jmeter/trunk/test/src/org/apache/jorphan/collections/PackageTest.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/test/src/org/apache/jorphan/collections/PackageTest.java?rev=773382&r1=773381&r2=773382&view=diff
==============================================================================
--- jakarta/jmeter/trunk/test/src/org/apache/jorphan/collections/PackageTest.java (original)
+++ jakarta/jmeter/trunk/test/src/org/apache/jorphan/collections/PackageTest.java Sun May 10 18:19:28 2009
@@ -27,149 +27,149 @@
 import org.apache.log.Logger;
 
 public class PackageTest extends TestCase {
-		public PackageTest(String name) {
-			super(name);
-		}
-
-		public void testAdd1() throws Exception {
-			Logger log = LoggingManager.getLoggerForClass();
-			Collection treePath = Arrays.asList(new String[] { "1", "2", "3", "4" });
-			HashTree tree = new HashTree();
-			log.debug("treePath = " + treePath);
-			tree.add(treePath, "value");
-			log.debug("Now treePath = " + treePath);
-			log.debug(tree.toString());
-			assertEquals(1, tree.list(treePath).size());
-			assertEquals("value", tree.getArray(treePath)[0]);
-		}
-
-		public void testEqualsAndHashCode1() throws Exception {
-			HashTree tree1 = new HashTree("abcd");
-			HashTree tree2 = new HashTree("abcd");
-			HashTree tree3 = new HashTree("abcde");
-			HashTree tree4 = new HashTree("abcde");
-
-			assertTrue(tree1.equals(tree1));
-			assertTrue(tree1.equals(tree2));
-			assertTrue(tree2.equals(tree1));
-			assertTrue(tree2.equals(tree2));
-			assertTrue(tree1.hashCode() == tree2.hashCode());
-
-			assertTrue(tree3.equals(tree3));
-			assertTrue(tree3.equals(tree4));
-			assertTrue(tree4.equals(tree3));
-			assertTrue(tree4.equals(tree4));
-			assertTrue(tree3.hashCode() == tree4.hashCode());
-
-			assertNotSame(tree1, tree2);
-			assertNotSame(tree1, tree3);
-			assertNotSame(tree1, tree4);
-			assertNotSame(tree2, tree3);
-			assertNotSame(tree2, tree4);
-
-			assertFalse(tree1.equals(tree3));
-			assertFalse(tree1.equals(tree4));
-			assertFalse(tree2.equals(tree3));
-			assertFalse(tree2.equals(tree4));
-
-			assertNotNull(tree1);
-			assertNotNull(tree2);
-
-			tree1.add("abcd", tree3);
-			assertFalse(tree1.equals(tree2));
-			assertFalse(tree2.equals(tree1));// Check reflexive
-			if (tree1.hashCode() == tree2.hashCode()) {
-				// This is not a requirement
-				System.out.println("WARN: unequal HashTrees should not have equal hashCodes");
-			}
-			tree2.add("abcd", tree4);
-			assertTrue(tree1.equals(tree2));
-			assertTrue(tree2.equals(tree1));
-			assertTrue(tree1.hashCode() == tree2.hashCode());
-		}
-
-
-		public void testAddObjectAndTree() throws Exception {
-			ListedHashTree tree = new ListedHashTree("key");
-			ListedHashTree newTree = new ListedHashTree("value");
-			tree.add("key", newTree);
-			assertEquals(tree.list().size(), 1);
-			assertEquals("key", tree.getArray()[0]);
-			assertEquals(1, tree.getTree("key").list().size());
-			assertEquals(0, tree.getTree("key").getTree("value").size());
-			assertEquals(tree.getTree("key").getArray()[0], "value");
-			assertNotNull(tree.getTree("key").get("value"));
-		}
-
-		public void testEqualsAndHashCode2() throws Exception {
-			ListedHashTree tree1 = new ListedHashTree("abcd");
-			ListedHashTree tree2 = new ListedHashTree("abcd");
-			ListedHashTree tree3 = new ListedHashTree("abcde");
-			ListedHashTree tree4 = new ListedHashTree("abcde");
-
-			assertTrue(tree1.equals(tree1));
-			assertTrue(tree1.equals(tree2));
-			assertTrue(tree2.equals(tree1));
-			assertTrue(tree2.equals(tree2));
-			assertTrue(tree1.hashCode() == tree2.hashCode());
-
-			assertTrue(tree3.equals(tree3));
-			assertTrue(tree3.equals(tree4));
-			assertTrue(tree4.equals(tree3));
-			assertTrue(tree4.equals(tree4));
-			assertTrue(tree3.hashCode() == tree4.hashCode());
-
-			assertNotSame(tree1, tree2);
-			assertNotSame(tree1, tree3);
-			assertFalse(tree1.equals(tree3));
-			assertFalse(tree3.equals(tree1));
-			assertFalse(tree1.equals(tree4));
-			assertFalse(tree4.equals(tree1));
-
-			assertFalse(tree2.equals(tree3));
-			assertFalse(tree3.equals(tree2));
-			assertFalse(tree2.equals(tree4));
-			assertFalse(tree4.equals(tree2));
-
-			tree1.add("abcd", tree3);
-			assertFalse(tree1.equals(tree2));
-			assertFalse(tree2.equals(tree1));
-
-			tree2.add("abcd", tree4);
-			assertTrue(tree1.equals(tree2));
-			assertTrue(tree2.equals(tree1));
-			assertTrue(tree1.hashCode() == tree2.hashCode());
-
-			tree1.add("a1");
-			tree1.add("a2");
-			// tree1.add("a3");
-			tree2.add("a2");
-			tree2.add("a1");
-
-			assertFalse(tree1.equals(tree2));
-			assertFalse(tree2.equals(tree1));
-			if (tree1.hashCode() == tree2.hashCode()) {
-				// This is not a requirement
-				System.out.println("WARN: unequal ListedHashTrees should not have equal hashcodes");
-
-			}
-
-			tree4.add("abcdef");
-			assertFalse(tree3.equals(tree4));
-			assertFalse(tree4.equals(tree3));
-		}
-
-
-		public void testSearch() throws Exception {
-			ListedHashTree tree = new ListedHashTree();
-			SearchByClass searcher = new SearchByClass(Integer.class);
-			String one = "one";
-			String two = "two";
-			Integer o = new Integer(1);
-			tree.add(one, o);
-			tree.getTree(one).add(o, two);
-			tree.traverse(searcher);
-			assertEquals(1, searcher.getSearchResults().size());
-		}
+        public PackageTest(String name) {
+            super(name);
+        }
+
+        public void testAdd1() throws Exception {
+            Logger log = LoggingManager.getLoggerForClass();
+            Collection treePath = Arrays.asList(new String[] { "1", "2", "3", "4" });
+            HashTree tree = new HashTree();
+            log.debug("treePath = " + treePath);
+            tree.add(treePath, "value");
+            log.debug("Now treePath = " + treePath);
+            log.debug(tree.toString());
+            assertEquals(1, tree.list(treePath).size());
+            assertEquals("value", tree.getArray(treePath)[0]);
+        }
+
+        public void testEqualsAndHashCode1() throws Exception {
+            HashTree tree1 = new HashTree("abcd");
+            HashTree tree2 = new HashTree("abcd");
+            HashTree tree3 = new HashTree("abcde");
+            HashTree tree4 = new HashTree("abcde");
+
+            assertTrue(tree1.equals(tree1));
+            assertTrue(tree1.equals(tree2));
+            assertTrue(tree2.equals(tree1));
+            assertTrue(tree2.equals(tree2));
+            assertTrue(tree1.hashCode() == tree2.hashCode());
+
+            assertTrue(tree3.equals(tree3));
+            assertTrue(tree3.equals(tree4));
+            assertTrue(tree4.equals(tree3));
+            assertTrue(tree4.equals(tree4));
+            assertTrue(tree3.hashCode() == tree4.hashCode());
+
+            assertNotSame(tree1, tree2);
+            assertNotSame(tree1, tree3);
+            assertNotSame(tree1, tree4);
+            assertNotSame(tree2, tree3);
+            assertNotSame(tree2, tree4);
+
+            assertFalse(tree1.equals(tree3));
+            assertFalse(tree1.equals(tree4));
+            assertFalse(tree2.equals(tree3));
+            assertFalse(tree2.equals(tree4));
+
+            assertNotNull(tree1);
+            assertNotNull(tree2);
+
+            tree1.add("abcd", tree3);
+            assertFalse(tree1.equals(tree2));
+            assertFalse(tree2.equals(tree1));// Check reflexive
+            if (tree1.hashCode() == tree2.hashCode()) {
+                // This is not a requirement
+                System.out.println("WARN: unequal HashTrees should not have equal hashCodes");
+            }
+            tree2.add("abcd", tree4);
+            assertTrue(tree1.equals(tree2));
+            assertTrue(tree2.equals(tree1));
+            assertTrue(tree1.hashCode() == tree2.hashCode());
+        }
+
+
+        public void testAddObjectAndTree() throws Exception {
+            ListedHashTree tree = new ListedHashTree("key");
+            ListedHashTree newTree = new ListedHashTree("value");
+            tree.add("key", newTree);
+            assertEquals(tree.list().size(), 1);
+            assertEquals("key", tree.getArray()[0]);
+            assertEquals(1, tree.getTree("key").list().size());
+            assertEquals(0, tree.getTree("key").getTree("value").size());
+            assertEquals(tree.getTree("key").getArray()[0], "value");
+            assertNotNull(tree.getTree("key").get("value"));
+        }
+
+        public void testEqualsAndHashCode2() throws Exception {
+            ListedHashTree tree1 = new ListedHashTree("abcd");
+            ListedHashTree tree2 = new ListedHashTree("abcd");
+            ListedHashTree tree3 = new ListedHashTree("abcde");
+            ListedHashTree tree4 = new ListedHashTree("abcde");
+
+            assertTrue(tree1.equals(tree1));
+            assertTrue(tree1.equals(tree2));
+            assertTrue(tree2.equals(tree1));
+            assertTrue(tree2.equals(tree2));
+            assertTrue(tree1.hashCode() == tree2.hashCode());
+
+            assertTrue(tree3.equals(tree3));
+            assertTrue(tree3.equals(tree4));
+            assertTrue(tree4.equals(tree3));
+            assertTrue(tree4.equals(tree4));
+            assertTrue(tree3.hashCode() == tree4.hashCode());
+
+            assertNotSame(tree1, tree2);
+            assertNotSame(tree1, tree3);
+            assertFalse(tree1.equals(tree3));
+            assertFalse(tree3.equals(tree1));
+            assertFalse(tree1.equals(tree4));
+            assertFalse(tree4.equals(tree1));
+
+            assertFalse(tree2.equals(tree3));
+            assertFalse(tree3.equals(tree2));
+            assertFalse(tree2.equals(tree4));
+            assertFalse(tree4.equals(tree2));
+
+            tree1.add("abcd", tree3);
+            assertFalse(tree1.equals(tree2));
+            assertFalse(tree2.equals(tree1));
+
+            tree2.add("abcd", tree4);
+            assertTrue(tree1.equals(tree2));
+            assertTrue(tree2.equals(tree1));
+            assertTrue(tree1.hashCode() == tree2.hashCode());
+
+            tree1.add("a1");
+            tree1.add("a2");
+            // tree1.add("a3");
+            tree2.add("a2");
+            tree2.add("a1");
+
+            assertFalse(tree1.equals(tree2));
+            assertFalse(tree2.equals(tree1));
+            if (tree1.hashCode() == tree2.hashCode()) {
+                // This is not a requirement
+                System.out.println("WARN: unequal ListedHashTrees should not have equal hashcodes");
+
+            }
+
+            tree4.add("abcdef");
+            assertFalse(tree3.equals(tree4));
+            assertFalse(tree4.equals(tree3));
+        }
+
+
+        public void testSearch() throws Exception {
+            ListedHashTree tree = new ListedHashTree();
+            SearchByClass searcher = new SearchByClass(Integer.class);
+            String one = "one";
+            String two = "two";
+            Integer o = new Integer(1);
+            tree.add(one, o);
+            tree.getTree(one).add(o, two);
+            tree.traverse(searcher);
+            assertEquals(1, searcher.getSearchResults().size());
+        }
 
 }

Modified: jakarta/jmeter/trunk/test/src/org/apache/jorphan/math/TestStatCalculator.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/test/src/org/apache/jorphan/math/TestStatCalculator.java?rev=773382&r1=773381&r2=773382&view=diff
==============================================================================
--- jakarta/jmeter/trunk/test/src/org/apache/jorphan/math/TestStatCalculator.java (original)
+++ jakarta/jmeter/trunk/test/src/org/apache/jorphan/math/TestStatCalculator.java Sun May 10 18:19:28 2009
@@ -22,55 +22,55 @@
 
 public class TestStatCalculator extends TestCase {
 
-	StatCalculator calc;
+    StatCalculator calc;
 
-	/**
-	 * 
-	 */
-	public TestStatCalculator() {
-		super();
-	}
-
-	/**
-	 * @param arg0
-	 */
-	public TestStatCalculator(String arg0) {
-		super(arg0);
-	}
-
-	public void setUp() {
-		calc = new StatCalculator();
-	}
-
-	public void testPercentagePoint() throws Exception {
-		calc.addValue(10);
-		calc.addValue(9);
-		calc.addValue(5);
-		calc.addValue(6);
-		calc.addValue(1);
-		calc.addValue(3);
-		calc.addValue(8);
-		calc.addValue(2);
-		calc.addValue(7);
-		calc.addValue(4);
-		assertEquals(10, calc.getCount());
-		assertEquals(9, calc.getPercentPoint(0.8999999).intValue());
-	}
-	public void testCalculation() {
-		calc.addValue(18);
-		calc.addValue(10);
-		calc.addValue(9);
-		calc.addValue(11);
-		calc.addValue(28);
-		calc.addValue(3);
-		calc.addValue(30);
-		calc.addValue(15);
-		calc.addValue(15);
-		calc.addValue(21);
-		assertEquals(16, (int) calc.getMean());
-		assertEquals(8.0622577F, (float) calc.getStandardDeviation(), 0F);
-		assertEquals(30, calc.getMax().intValue());
-		assertEquals(3, calc.getMin().intValue());
-		assertEquals(15, calc.getMedian().intValue());
-	}
+    /**
+     * 
+     */
+    public TestStatCalculator() {
+        super();
+    }
+
+    /**
+     * @param arg0
+     */
+    public TestStatCalculator(String arg0) {
+        super(arg0);
+    }
+
+    public void setUp() {
+        calc = new StatCalculator();
+    }
+
+    public void testPercentagePoint() throws Exception {
+        calc.addValue(10);
+        calc.addValue(9);
+        calc.addValue(5);
+        calc.addValue(6);
+        calc.addValue(1);
+        calc.addValue(3);
+        calc.addValue(8);
+        calc.addValue(2);
+        calc.addValue(7);
+        calc.addValue(4);
+        assertEquals(10, calc.getCount());
+        assertEquals(9, calc.getPercentPoint(0.8999999).intValue());
+    }
+    public void testCalculation() {
+        calc.addValue(18);
+        calc.addValue(10);
+        calc.addValue(9);
+        calc.addValue(11);
+        calc.addValue(28);
+        calc.addValue(3);
+        calc.addValue(30);
+        calc.addValue(15);
+        calc.addValue(15);
+        calc.addValue(21);
+        assertEquals(16, (int) calc.getMean());
+        assertEquals(8.0622577F, (float) calc.getStandardDeviation(), 0F);
+        assertEquals(30, calc.getMax().intValue());
+        assertEquals(3, calc.getMin().intValue());
+        assertEquals(15, calc.getMedian().intValue());
+    }
 }

Modified: jakarta/jmeter/trunk/test/src/org/apache/jorphan/reflect/TestFunctor.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/test/src/org/apache/jorphan/reflect/TestFunctor.java?rev=773382&r1=773381&r2=773382&view=diff
==============================================================================
--- jakarta/jmeter/trunk/test/src/org/apache/jorphan/reflect/TestFunctor.java (original)
+++ jakarta/jmeter/trunk/test/src/org/apache/jorphan/reflect/TestFunctor.java Sun May 10 18:19:28 2009
@@ -31,193 +31,193 @@
  */
 public class TestFunctor extends JMeterTestCase {
 
-	interface HasName {
-		String getName();
-	}
-	
-	interface HasString {
-		String getString(String s);
-	}
+    interface HasName {
+        String getName();
+    }
+    
+    interface HasString {
+        String getString(String s);
+    }
 
-	class Test1 implements HasName {
-		private final String name;
-		public Test1(){
-			this("");
-		}
-		public Test1(String s){
-			name=s;
-		}
-		public String getName(){
-			return name;
-		}
-		public String getString(String s){
-			return s;
-		}
-	}
-	class Test1a extends Test1{
-		Test1a(){
-			super("1a");
-		}
-		Test1a(String s){
-			super("1a:"+s);
-		}
-		public String getName(){
-			return super.getName()+".";
-		}
-	}
-	static class Test2 implements HasName, HasString {
-		private final String name;
-		public Test2(){
-			this("");
-		}
-		public Test2(String s){
-			name=s;
-		}
-		public String getName(){
-			return name;
-		}
-		public String getString(String s){
-			return s;
-		}
-	}
-	
-	public TestFunctor(String arg0) {
-		super(arg0);
-	}
-    
-	public void setUp(){
-		LoggingManager.setPriority("FATAL_ERROR",LoggingManager.removePrefix(Functor.class.getName()));		
-	}
+    class Test1 implements HasName {
+        private final String name;
+        public Test1(){
+            this("");
+        }
+        public Test1(String s){
+            name=s;
+        }
+        public String getName(){
+            return name;
+        }
+        public String getString(String s){
+            return s;
+        }
+    }
+    class Test1a extends Test1{
+        Test1a(){
+            super("1a");
+        }
+        Test1a(String s){
+            super("1a:"+s);
+        }
+        public String getName(){
+            return super.getName()+".";
+        }
+    }
+    static class Test2 implements HasName, HasString {
+        private final String name;
+        public Test2(){
+            this("");
+        }
+        public Test2(String s){
+            name=s;
+        }
+        public String getName(){
+            return name;
+        }
+        public String getString(String s){
+            return s;
+        }
+    }
+    
+    public TestFunctor(String arg0) {
+        super(arg0);
+    }
+    
+    public void setUp(){
+        LoggingManager.setPriority("FATAL_ERROR",LoggingManager.removePrefix(Functor.class.getName()));     
+    }
 
-	public void testName() throws Exception{
-		Functor f1 = new Functor("getName");
-		Functor f2 = new Functor("getName");
-		Functor f1a = new Functor("getName");
-		Test1 t1 = new Test1("t1");
-		Test2 t2 = new Test2("t2");
-		Test1a t1a = new Test1a("aa");
-		assertEquals("t1",f1.invoke(t1));
-		//assertEquals("t1",f1.invoke());
-		try {
-		    f1.invoke(t2);
-		    fail("Should have generated error");
-		} catch (JMeterError e){
-			
-		}
-		assertEquals("t2",f2.invoke(t2));
-		//assertEquals("t2",f2.invoke());
-		assertEquals("1a:aa.",f1a.invoke(t1a));
-		//assertEquals("1a:aa.",f1a.invoke());
-		try {
-		    f1a.invoke(t1);// can't call invoke using super class
-		    fail("Should have generated error");
-		} catch (JMeterError e){
-			
-		}
-		// OK (currently) to invoke using sub-class 
-		assertEquals("1a:aa.",f1.invoke(t1a));
-		//assertEquals("1a:aa.",f1.invoke());// N.B. returns different result from before
-	}
-    
-	public void testNameTypes() throws Exception{
-		Functor f = new Functor("getString",new Class[]{String.class});
-		Functor f2 = new Functor("getString");// Args will be provided later
-		Test1 t1 = new Test1("t1");
-		assertEquals("x1",f.invoke(t1,new String[]{"x1"}));
-		try {
-			assertEquals("x1",f.invoke(t1));
-		    fail("Should have generated an Exception");
-		} catch (JMeterError ok){
-		}
-		assertEquals("x2",f2.invoke(t1,new String[]{"x2"}));
-		try {
-			assertEquals("x2",f2.invoke(t1));
-		    fail("Should have generated an Exception");
-		} catch (JMeterError ok){
-		}
-	}
-	public void testObjectName() throws Exception{
-		Test1 t1 = new Test1("t1");
-		Test2 t2 = new Test2("t2");
-		Functor f1 = new Functor(t1,"getName");
-		assertEquals("t1",f1.invoke(t1));
-		assertEquals("t1",f1.invoke(t2)); // should use original object
-	}
-	
-	// Check how Class definition behaves
-	public void testClass() throws Exception{
-		Test1 t1 = new Test1("t1");
-		Test1 t1a = new Test1a("t1a");
-		Test2 t2 = new Test2("t2");
-		Functor f1 = new Functor(HasName.class,"getName");
-		assertEquals("t1",f1.invoke(t1));
-		assertEquals("1a:t1a.",f1.invoke(t1a));
-		assertEquals("t2",f1.invoke(t2));
-		try {
-			f1.invoke();
-			fail("Should have failed");
-		} catch (IllegalStateException ok){
-			
-		}
-		Functor f2 = new Functor(HasString.class,"getString");
-		assertEquals("xyz",f2.invoke(t2,new String[]{"xyz"}));
-		try {
-			f2.invoke(t1,new String[]{"xyz"});
-			fail("Should have failed");
-		} catch (JMeterError ok){
-			
-		}
-		Functor f3 = new Functor(t2,"getString");
-		assertEquals("xyz",f3.invoke(t2,new Object[]{"xyz"}));
-		
-		Properties p = new Properties();
-		p.put("Name","Value");
-		Functor fk = new Functor(Map.Entry.class,"getKey");
-		Functor fv = new Functor(Map.Entry.class,"getValue");
-		Object o = p.entrySet().iterator().next();
-		assertEquals("Name",fk.invoke(o));
-		assertEquals("Value",fv.invoke(o));
-	}
-	
-	public void testBadParameters() throws Exception{
-		try {
-			new Functor(null);
-			fail("should have generated IllegalArgumentException;");
-		} catch (IllegalArgumentException ok){}
-		try {
-			new Functor(null,new Class[]{});
-			fail("should have generated IllegalArgumentException;");
-		} catch (IllegalArgumentException ok){}
-		try {
-			new Functor(null,new Object[]{});
-			fail("should have generated IllegalArgumentException;");
-		} catch (IllegalArgumentException ok){}
-		try {
-			new Functor(String.class,null);
-			fail("should have generated IllegalArgumentException;");
-		} catch (IllegalArgumentException ok){}
-		try {
-			new Functor(new Object(),null);
-			fail("should have generated IllegalArgumentException;");
-		} catch (IllegalArgumentException ok){}
-		try {
-			new Functor(new Object(),null, new Class[]{});
-			fail("should have generated IllegalArgumentException;");
-		} catch (IllegalArgumentException ok){}
-		try {
-			new Functor(new Object(),null, new Object[]{});
-			fail("should have generated IllegalArgumentException;");
-		} catch (IllegalArgumentException ok){}
-	}
-	public void testIllegalState() throws Exception{
-		Functor f = new Functor("method");
-		try {
-			f.invoke();
-			fail("should have generated IllegalStateException;");
-		} catch (IllegalStateException ok){}		
-		try {
-			f.invoke(new Object[]{});
-			fail("should have generated IllegalStateException;");
-		} catch (IllegalStateException ok){}		
-	}
+    public void testName() throws Exception{
+        Functor f1 = new Functor("getName");
+        Functor f2 = new Functor("getName");
+        Functor f1a = new Functor("getName");
+        Test1 t1 = new Test1("t1");
+        Test2 t2 = new Test2("t2");
+        Test1a t1a = new Test1a("aa");
+        assertEquals("t1",f1.invoke(t1));
+        //assertEquals("t1",f1.invoke());
+        try {
+            f1.invoke(t2);
+            fail("Should have generated error");
+        } catch (JMeterError e){
+            
+        }
+        assertEquals("t2",f2.invoke(t2));
+        //assertEquals("t2",f2.invoke());
+        assertEquals("1a:aa.",f1a.invoke(t1a));
+        //assertEquals("1a:aa.",f1a.invoke());
+        try {
+            f1a.invoke(t1);// can't call invoke using super class
+            fail("Should have generated error");
+        } catch (JMeterError e){
+            
+        }
+        // OK (currently) to invoke using sub-class 
+        assertEquals("1a:aa.",f1.invoke(t1a));
+        //assertEquals("1a:aa.",f1.invoke());// N.B. returns different result from before
+    }
+    
+    public void testNameTypes() throws Exception{
+        Functor f = new Functor("getString",new Class[]{String.class});
+        Functor f2 = new Functor("getString");// Args will be provided later
+        Test1 t1 = new Test1("t1");
+        assertEquals("x1",f.invoke(t1,new String[]{"x1"}));
+        try {
+            assertEquals("x1",f.invoke(t1));
+            fail("Should have generated an Exception");
+        } catch (JMeterError ok){
+        }
+        assertEquals("x2",f2.invoke(t1,new String[]{"x2"}));
+        try {
+            assertEquals("x2",f2.invoke(t1));
+            fail("Should have generated an Exception");
+        } catch (JMeterError ok){
+        }
+    }
+    public void testObjectName() throws Exception{
+        Test1 t1 = new Test1("t1");
+        Test2 t2 = new Test2("t2");
+        Functor f1 = new Functor(t1,"getName");
+        assertEquals("t1",f1.invoke(t1));
+        assertEquals("t1",f1.invoke(t2)); // should use original object
+    }
+    
+    // Check how Class definition behaves
+    public void testClass() throws Exception{
+        Test1 t1 = new Test1("t1");
+        Test1 t1a = new Test1a("t1a");
+        Test2 t2 = new Test2("t2");
+        Functor f1 = new Functor(HasName.class,"getName");
+        assertEquals("t1",f1.invoke(t1));
+        assertEquals("1a:t1a.",f1.invoke(t1a));
+        assertEquals("t2",f1.invoke(t2));
+        try {
+            f1.invoke();
+            fail("Should have failed");
+        } catch (IllegalStateException ok){
+            
+        }
+        Functor f2 = new Functor(HasString.class,"getString");
+        assertEquals("xyz",f2.invoke(t2,new String[]{"xyz"}));
+        try {
+            f2.invoke(t1,new String[]{"xyz"});
+            fail("Should have failed");
+        } catch (JMeterError ok){
+            
+        }
+        Functor f3 = new Functor(t2,"getString");
+        assertEquals("xyz",f3.invoke(t2,new Object[]{"xyz"}));
+        
+        Properties p = new Properties();
+        p.put("Name","Value");
+        Functor fk = new Functor(Map.Entry.class,"getKey");
+        Functor fv = new Functor(Map.Entry.class,"getValue");
+        Object o = p.entrySet().iterator().next();
+        assertEquals("Name",fk.invoke(o));
+        assertEquals("Value",fv.invoke(o));
+    }
+    
+    public void testBadParameters() throws Exception{
+        try {
+            new Functor(null);
+            fail("should have generated IllegalArgumentException;");
+        } catch (IllegalArgumentException ok){}
+        try {
+            new Functor(null,new Class[]{});
+            fail("should have generated IllegalArgumentException;");
+        } catch (IllegalArgumentException ok){}
+        try {
+            new Functor(null,new Object[]{});
+            fail("should have generated IllegalArgumentException;");
+        } catch (IllegalArgumentException ok){}
+        try {
+            new Functor(String.class,null);
+            fail("should have generated IllegalArgumentException;");
+        } catch (IllegalArgumentException ok){}
+        try {
+            new Functor(new Object(),null);
+            fail("should have generated IllegalArgumentException;");
+        } catch (IllegalArgumentException ok){}
+        try {
+            new Functor(new Object(),null, new Class[]{});
+            fail("should have generated IllegalArgumentException;");
+        } catch (IllegalArgumentException ok){}
+        try {
+            new Functor(new Object(),null, new Object[]{});
+            fail("should have generated IllegalArgumentException;");
+        } catch (IllegalArgumentException ok){}
+    }
+    public void testIllegalState() throws Exception{
+        Functor f = new Functor("method");
+        try {
+            f.invoke();
+            fail("should have generated IllegalStateException;");
+        } catch (IllegalStateException ok){}        
+        try {
+            f.invoke(new Object[]{});
+            fail("should have generated IllegalStateException;");
+        } catch (IllegalStateException ok){}        
+    }
 }

Modified: jakarta/jmeter/trunk/test/src/org/apache/jorphan/test/AllTests.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/test/src/org/apache/jorphan/test/AllTests.java?rev=773382&r1=773381&r2=773382&view=diff
==============================================================================
--- jakarta/jmeter/trunk/test/src/org/apache/jorphan/test/AllTests.java (original)
+++ jakarta/jmeter/trunk/test/src/org/apache/jorphan/test/AllTests.java Sun May 10 18:19:28 2009
@@ -93,107 +93,107 @@
  * @see UnitTestManager
  */
 public final class AllTests {
-	private static final Logger log = LoggingManager.getLoggerForClass();
+    private static final Logger log = LoggingManager.getLoggerForClass();
 
-	/**
-	 * Private constructor to prevent instantiation.
-	 */
-	private AllTests() {
-	}
-
-	private static void logprop(String prop, boolean show) {
-		String value = System.getProperty(prop);
-		log.info(prop + "=" + value);
-		if (show) {
-			System.out.println(prop + "=" + value);
-		}
-	}
-
-	private static void logprop(String prop) {
-		logprop(prop, false);
-	}
-
-	/**
-	 * Starts a run through all unit tests found in the specified classpaths.
-	 * The first argument should be a list of paths to search. The second
-	 * argument is optional and specifies a properties file used to initialize
-	 * logging. The third argument is also optional, and specifies a class that
-	 * implements the UnitTestManager interface. This provides a means of
-	 * initializing your application with a configuration file prior to the
-	 * start of any unit tests.
-	 * 
-	 * @param args
-	 *            the command line arguments
-	 */
-	public static void main(String[] args) {
-		if (args.length < 1) {
-			System.out.println("You must specify a comma-delimited list of paths to search " + "for unit tests");
-			System.exit(1);
-		}
-		String home=new File(System.getProperty("user.dir")).getParent();
-		System.out.println("Setting JMeterHome: "+home);
-		JMeterUtils.setJMeterHome(home);
-		initializeLogging(args);
-		initializeManager(args);
+    /**
+     * Private constructor to prevent instantiation.
+     */
+    private AllTests() {
+    }
+
+    private static void logprop(String prop, boolean show) {
+        String value = System.getProperty(prop);
+        log.info(prop + "=" + value);
+        if (show) {
+            System.out.println(prop + "=" + value);
+        }
+    }
+
+    private static void logprop(String prop) {
+        logprop(prop, false);
+    }
+
+    /**
+     * Starts a run through all unit tests found in the specified classpaths.
+     * The first argument should be a list of paths to search. The second
+     * argument is optional and specifies a properties file used to initialize
+     * logging. The third argument is also optional, and specifies a class that
+     * implements the UnitTestManager interface. This provides a means of
+     * initializing your application with a configuration file prior to the
+     * start of any unit tests.
+     * 
+     * @param args
+     *            the command line arguments
+     */
+    public static void main(String[] args) {
+        if (args.length < 1) {
+            System.out.println("You must specify a comma-delimited list of paths to search " + "for unit tests");
+            System.exit(1);
+        }
+        String home=new File(System.getProperty("user.dir")).getParent();
+        System.out.println("Setting JMeterHome: "+home);
+        JMeterUtils.setJMeterHome(home);
+        initializeLogging(args);
+        initializeManager(args);
 
-		log.info("JMeterVersion="+JMeterUtils.getJMeterVersion());
-		logprop("java.version", true);
+        log.info("JMeterVersion="+JMeterUtils.getJMeterVersion());
+        logprop("java.version", true);
         logprop("java.vm.name");
-		logprop("java.vendor");
-		logprop("java.home", true);
-		logprop("user.home");
-		logprop("user.dir", true);
-		logprop("os.name", true);
-		logprop("os.version", true);
-		logprop("os.arch");
-		logprop("java.class.version");
-		// logprop("java.class.path");
-		String cp = System.getProperty("java.class.path");
-		String cpe[] = JOrphanUtils.split(cp, java.io.File.pathSeparator);
-		StringBuffer sb = new StringBuffer(3000);
-		sb.append("java.class.path=");
-		for (int i = 0; i < cpe.length; i++) {
-			sb.append("\n");
-			sb.append(cpe[i]);
-			if (new java.io.File(cpe[i]).exists()) {
-				sb.append(" - OK");
-			} else {
-				sb.append(" - ??");
-			}
-		}
-		log.info(sb.toString());
-
-		// ++
-		// GUI tests throw the error
-		// testArgumentCreation(org.apache.jmeter.config.gui.ArgumentsPanel$Test)java.lang.NoClassDefFoundError
-		// at java.lang.Class.forName0(Native Method)
-		// at java.lang.Class.forName(Class.java:141)
-		// at
-		// java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:62)
-		//
-		// Try to find out why this is ...
-
-		System.out.println("+++++++++++");
-		logprop("java.awt.headless", true);
-		logprop("java.awt.graphicsenv", true);
-		//
-		// try {//
-		// Class c = Class.forName(n);
-		// System.out.println("Found class: "+n);
-		// // c.newInstance();
-		// // System.out.println("Instantiated: "+n);
-		// } catch (Exception e1) {
-		// System.out.println("Error finding class "+n+" "+e1);
-		// } catch (java.lang.InternalError e1){
-		// System.out.println("Error finding class "+n+" "+e1);
-		// }
-		//
-		System.out.println("------------");
-		// don't call isHeadless() here, as it has a side effect.
-		// --
-		System.out.println("Creating test suite");
-		TestSuite suite = suite(args[0]);
-		int countTestCases = suite.countTestCases();
+        logprop("java.vendor");
+        logprop("java.home", true);
+        logprop("user.home");
+        logprop("user.dir", true);
+        logprop("os.name", true);
+        logprop("os.version", true);
+        logprop("os.arch");
+        logprop("java.class.version");
+        // logprop("java.class.path");
+        String cp = System.getProperty("java.class.path");
+        String cpe[] = JOrphanUtils.split(cp, java.io.File.pathSeparator);
+        StringBuffer sb = new StringBuffer(3000);
+        sb.append("java.class.path=");
+        for (int i = 0; i < cpe.length; i++) {
+            sb.append("\n");
+            sb.append(cpe[i]);
+            if (new java.io.File(cpe[i]).exists()) {
+                sb.append(" - OK");
+            } else {
+                sb.append(" - ??");
+            }
+        }
+        log.info(sb.toString());
+
+        // ++
+        // GUI tests throw the error
+        // testArgumentCreation(org.apache.jmeter.config.gui.ArgumentsPanel$Test)java.lang.NoClassDefFoundError
+        // at java.lang.Class.forName0(Native Method)
+        // at java.lang.Class.forName(Class.java:141)
+        // at
+        // java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:62)
+        //
+        // Try to find out why this is ...
+
+        System.out.println("+++++++++++");
+        logprop("java.awt.headless", true);
+        logprop("java.awt.graphicsenv", true);
+        //
+        // try {//
+        // Class c = Class.forName(n);
+        // System.out.println("Found class: "+n);
+        // // c.newInstance();
+        // // System.out.println("Instantiated: "+n);
+        // } catch (Exception e1) {
+        // System.out.println("Error finding class "+n+" "+e1);
+        // } catch (java.lang.InternalError e1){
+        // System.out.println("Error finding class "+n+" "+e1);
+        // }
+        //
+        System.out.println("------------");
+        // don't call isHeadless() here, as it has a side effect.
+        // --
+        System.out.println("Creating test suite");
+        TestSuite suite = suite(args[0]);
+        int countTestCases = suite.countTestCases();
         System.out.println("Starting test run, test count = "+countTestCases);
 //        for (int i=0;i<suite.testCount();i++){
 //           Test testAt = suite.testAt(i);
@@ -209,154 +209,154 @@
 //            }                
 //        }
         
-		// Jeremy Arnold: This method used to attempt to write results to
-		// a file, but it had a bug and instead just wrote to System.out.
-		// Since nobody has complained about this behavior, I'm changing
-		// the code to not attempt to write to a file, so it will continue
-		// behaving as it did before. It would be simple to make it write
-		// to a file instead if that is the desired behavior.
-		TestRunner.run(suite);
-		// ++
-		// Recheck settings:
-		//System.out.println("+++++++++++");
-		// System.out.println(e+"="+System.getProperty(e));
-		// System.out.println(g+"="+System.getProperty(g));
-		// System.out.println("Headless?
-		// "+java.awt.GraphicsEnvironment.isHeadless());//JDK 1.4
-		// try {
-		// Class c = Class.forName(n);
-		// System.out.println("Found class: "+n);
-		// c.newInstance();
-		// System.out.println("Instantiated: "+n);
-		// } catch (Exception e1) {
-		// System.out.println("Error with class "+n+" "+e1);
-		// } catch (java.lang.InternalError e1){
-		// System.out.println("Error with class "+n+" "+e1);
-		// }
-		//System.out.println("------------");
-		// --
-		System.exit(0); // this is needed because the test may start the AWT EventQueue thread which is not a daemon.
-	}
-
-	/**
-	 * An overridable method that initializes the logging for the unit test run,
-	 * using the properties file passed in as the second argument.
-	 * 
-	 * @param args
-	 */
-	protected static void initializeLogging(String[] args) {
-		if (args.length >= 2) {
-			Properties props = new Properties();
-			try {
-				System.out.println("Setting up logging props using file: " + args[1]);
-				props.load(new FileInputStream(args[1]));
-				LoggingManager.initializeLogging(props);
-			} catch (FileNotFoundException e) {
-				System.out.println(e.getLocalizedMessage());
-			} catch (IOException e) {
-				System.out.println(e.getLocalizedMessage());
-			}
-		}
-	}
-
-	/**
-	 * An overridable method that that instantiates a UnitTestManager (if one
-	 * was specified in the command-line arguments), and hands it the name of
-	 * the properties file to use to configure the system.
-	 * 
-	 * @param args
-	 */
-	protected static void initializeManager(String[] args) {
-		if (args.length >= 3) {
-			try {
-				System.out.println("Using initializeProperties() from " + args[2]);
-				UnitTestManager um = (UnitTestManager) Class.forName(args[2]).newInstance();
-				System.out.println("Setting up initial properties using: " + args[1]);
-				um.initializeProperties(args[1]);
-			} catch (ClassNotFoundException e) {
-				System.out.println("Couldn't create: " + args[2]);
-				e.printStackTrace();
-			} catch (InstantiationException e) {
-				System.out.println("Couldn't create: " + args[2]);
-				e.printStackTrace();
-			} catch (IllegalAccessException e) {
-				System.out.println("Couldn't create: " + args[2]);
-				e.printStackTrace();
-			}
-		}
-	}
-
-	/*
-	 * Externally callable suite() method for use by JUnit Allows tests to be
-	 * run directly under JUnit, rather than using the startup code in the rest
-	 * of the module. No parameters can be passed in, so it is less flexible.
-	 */
-	public static TestSuite suite() {
-		String args[] = { "../lib/ext", "./jmetertest.properties", "org.apache.jmeter.util.JMeterUtils" };
-
-		initializeManager(args);
-		return suite(args[0]);
-	}
-
-	/**
-	 * A unit test suite for JUnit.
-	 * 
-	 * @return The test suite
-	 */
-	private static TestSuite suite(String searchPaths) {
-		TestSuite suite = new TestSuite("All Tests");
+        // Jeremy Arnold: This method used to attempt to write results to
+        // a file, but it had a bug and instead just wrote to System.out.
+        // Since nobody has complained about this behavior, I'm changing
+        // the code to not attempt to write to a file, so it will continue
+        // behaving as it did before. It would be simple to make it write
+        // to a file instead if that is the desired behavior.
+        TestRunner.run(suite);
+        // ++
+        // Recheck settings:
+        //System.out.println("+++++++++++");
+        // System.out.println(e+"="+System.getProperty(e));
+        // System.out.println(g+"="+System.getProperty(g));
+        // System.out.println("Headless?
+        // "+java.awt.GraphicsEnvironment.isHeadless());//JDK 1.4
+        // try {
+        // Class c = Class.forName(n);
+        // System.out.println("Found class: "+n);
+        // c.newInstance();
+        // System.out.println("Instantiated: "+n);
+        // } catch (Exception e1) {
+        // System.out.println("Error with class "+n+" "+e1);
+        // } catch (java.lang.InternalError e1){
+        // System.out.println("Error with class "+n+" "+e1);
+        // }
+        //System.out.println("------------");
+        // --
+        System.exit(0); // this is needed because the test may start the AWT EventQueue thread which is not a daemon.
+    }
+
+    /**
+     * An overridable method that initializes the logging for the unit test run,
+     * using the properties file passed in as the second argument.
+     * 
+     * @param args
+     */
+    protected static void initializeLogging(String[] args) {
+        if (args.length >= 2) {
+            Properties props = new Properties();
+            try {
+                System.out.println("Setting up logging props using file: " + args[1]);
+                props.load(new FileInputStream(args[1]));
+                LoggingManager.initializeLogging(props);
+            } catch (FileNotFoundException e) {
+                System.out.println(e.getLocalizedMessage());
+            } catch (IOException e) {
+                System.out.println(e.getLocalizedMessage());
+            }
+        }
+    }
+
+    /**
+     * An overridable method that that instantiates a UnitTestManager (if one
+     * was specified in the command-line arguments), and hands it the name of
+     * the properties file to use to configure the system.
+     * 
+     * @param args
+     */
+    protected static void initializeManager(String[] args) {
+        if (args.length >= 3) {
+            try {
+                System.out.println("Using initializeProperties() from " + args[2]);
+                UnitTestManager um = (UnitTestManager) Class.forName(args[2]).newInstance();
+                System.out.println("Setting up initial properties using: " + args[1]);
+                um.initializeProperties(args[1]);
+            } catch (ClassNotFoundException e) {
+                System.out.println("Couldn't create: " + args[2]);
+                e.printStackTrace();
+            } catch (InstantiationException e) {
+                System.out.println("Couldn't create: " + args[2]);
+                e.printStackTrace();
+            } catch (IllegalAccessException e) {
+                System.out.println("Couldn't create: " + args[2]);
+                e.printStackTrace();
+            }
+        }
+    }
+
+    /*
+     * Externally callable suite() method for use by JUnit Allows tests to be
+     * run directly under JUnit, rather than using the startup code in the rest
+     * of the module. No parameters can be passed in, so it is less flexible.
+     */
+    public static TestSuite suite() {
+        String args[] = { "../lib/ext", "./jmetertest.properties", "org.apache.jmeter.util.JMeterUtils" };
+
+        initializeManager(args);
+        return suite(args[0]);
+    }
+
+    /**
+     * A unit test suite for JUnit.
+     * 
+     * @return The test suite
+     */
+    private static TestSuite suite(String searchPaths) {
+        TestSuite suite = new TestSuite("All Tests");
         System.out.println("Scanning "+searchPaths+ " for test cases");
-		int tests=0;
-		int suites=0;
-		try {
+        int tests=0;
+        int suites=0;
+        try {
             log.info("ClassFinder(TestCase)");
-			List classList = ClassFinder.findClassesThatExtend(JOrphanUtils.split(searchPaths, ","),
-					new Class[] { TestCase.class }, true);
-			int sz=classList.size();
+            List classList = ClassFinder.findClassesThatExtend(JOrphanUtils.split(searchPaths, ","),
+                    new Class[] { TestCase.class }, true);
+            int sz=classList.size();
             log.info("ClassFinder(TestCase) found: "+sz+ " TestCase classes");
-			System.out.println("ClassFinder found: "+sz+ " TestCase classes");
-			Iterator classes = classList.iterator();
-			while (classes.hasNext()) {
-				String name = (String) classes.next();
-				try {
-					/*
-					 * TestSuite only finds testXXX() methods, and does not look
-					 * for suite() methods.
-					 * 
-					 * To provide more compatibilty with stand-alone tests,
-					 * where JUnit does look for a suite() method, check for it
-					 * first here.
-					 * 
-					 */
-
-					Class clazz = Class.forName(name);
-					Test t = null;
-					try {
-						Method m = clazz.getMethod("suite", new Class[0]);
-						t = (Test) m.invoke(clazz, null);
-						suites++;
-					} catch (NoSuchMethodException e) {
-					} // this is not an error, the others are
-					// catch (SecurityException e) {}
-					// catch (IllegalAccessException e) {}
-					// catch (IllegalArgumentException e) {}
-					// catch (InvocationTargetException e) {}
-
-					if (t == null) {
-						t = new TestSuite(clazz);
-					}
-
-					tests++;
-					suite.addTest(t);
-				} catch (Exception ex) {
-					System.out.println("Error adding test for class " + name + " " + ex.toString());
-					log.error("error adding test :", ex);
-				}
-			}
-		} catch (IOException e) {
-			log.error("", e);
-		}
-		System.out.println("Created: "+tests+" tests including "+suites+" suites");
-		return suite;
-	}
+            System.out.println("ClassFinder found: "+sz+ " TestCase classes");
+            Iterator classes = classList.iterator();
+            while (classes.hasNext()) {
+                String name = (String) classes.next();
+                try {
+                    /*
+                     * TestSuite only finds testXXX() methods, and does not look
+                     * for suite() methods.
+                     * 
+                     * To provide more compatibilty with stand-alone tests,
+                     * where JUnit does look for a suite() method, check for it
+                     * first here.
+                     * 
+                     */
+
+                    Class clazz = Class.forName(name);
+                    Test t = null;
+                    try {
+                        Method m = clazz.getMethod("suite", new Class[0]);
+                        t = (Test) m.invoke(clazz, null);
+                        suites++;
+                    } catch (NoSuchMethodException e) {
+                    } // this is not an error, the others are
+                    // catch (SecurityException e) {}
+                    // catch (IllegalAccessException e) {}
+                    // catch (IllegalArgumentException e) {}
+                    // catch (InvocationTargetException e) {}
+
+                    if (t == null) {
+                        t = new TestSuite(clazz);
+                    }
+
+                    tests++;
+                    suite.addTest(t);
+                } catch (Exception ex) {
+                    System.out.println("Error adding test for class " + name + " " + ex.toString());
+                    log.error("error adding test :", ex);
+                }
+            }
+        } catch (IOException e) {
+            log.error("", e);
+        }
+        System.out.println("Created: "+tests+" tests including "+suites+" suites");
+        return suite;
+    }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org