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 2008/02/04 20:55:52 UTC

svn commit: r618404 [4/4] - in /jakarta/jmeter/trunk: ./ src/protocol/http/org/apache/jmeter/protocol/http/control/ src/protocol/http/org/apache/jmeter/protocol/http/control/gui/ src/protocol/http/org/apache/jmeter/protocol/http/parser/ src/protocol/ht...

Modified: jakarta/jmeter/trunk/test/src/org/apache/jmeter/testbeans/gui/TestFieldStringEditor.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/test/src/org/apache/jmeter/testbeans/gui/TestFieldStringEditor.java?rev=618404&r1=618403&r2=618404&view=diff
==============================================================================
--- jakarta/jmeter/trunk/test/src/org/apache/jmeter/testbeans/gui/TestFieldStringEditor.java (original)
+++ jakarta/jmeter/trunk/test/src/org/apache/jmeter/testbeans/gui/TestFieldStringEditor.java Mon Feb  4 11:55:48 2008
@@ -1,50 +1,50 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jmeter.testbeans.gui;
-
-
-public class TestFieldStringEditor extends junit.framework.TestCase {
-		public TestFieldStringEditor(String name) {
-			super(name);
-		}
-
-		private void testSetGet(ComboStringEditor e, Object value) throws Exception {
-			e.setValue(value);
-			assertEquals(value, e.getValue());
-		}
-
-		private void testSetGetAsText(ComboStringEditor e, String text) throws Exception {
-			e.setAsText(text);
-			assertEquals(text, e.getAsText());
-		}
-
-		public void testSetGet() throws Exception {
-			ComboStringEditor e = new ComboStringEditor();
-
-			testSetGet(e, "any string");
-			testSetGet(e, "");
-			testSetGet(e, "${var}");
-		}
-
-		public void testSetGetAsText() throws Exception {
-			ComboStringEditor e = new ComboStringEditor();
-
-			testSetGetAsText(e, "any string");
-			testSetGetAsText(e, "");
-			testSetGetAsText(e, "${var}");
-		}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jmeter.testbeans.gui;
+
+
+public class TestFieldStringEditor extends junit.framework.TestCase {
+		public TestFieldStringEditor(String name) {
+			super(name);
+		}
+
+		private void testSetGet(ComboStringEditor e, Object value) throws Exception {
+			e.setValue(value);
+			assertEquals(value, e.getValue());
+		}
+
+		private void testSetGetAsText(ComboStringEditor e, String text) throws Exception {
+			e.setAsText(text);
+			assertEquals(text, e.getAsText());
+		}
+
+		public void testSetGet() throws Exception {
+			ComboStringEditor e = new ComboStringEditor();
+
+			testSetGet(e, "any string");
+			testSetGet(e, "");
+			testSetGet(e, "${var}");
+		}
+
+		public void testSetGetAsText() throws Exception {
+			ComboStringEditor e = new ComboStringEditor();
+
+			testSetGetAsText(e, "any string");
+			testSetGetAsText(e, "");
+			testSetGetAsText(e, "${var}");
+		}
 }

Propchange: jakarta/jmeter/trunk/test/src/org/apache/jmeter/testbeans/gui/TestFieldStringEditor.java
------------------------------------------------------------------------------
    svn:eol-style = native

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=618404&r1=618403&r2=618404&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 Mon Feb  4 11:55:48 2008
@@ -1,59 +1,59 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * 
- */
-
-package org.apache.jmeter.threads;
-
-import org.apache.jmeter.config.ConfigTestElement;
-import org.apache.jmeter.control.GenericController;
-import org.apache.jmeter.samplers.AbstractSampler;
-import org.apache.jmeter.samplers.SampleResult;
-import org.apache.jorphan.collections.ListedHashTree;
-
-public class TestTestCompiler extends junit.framework.TestCase {
-		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();
-
-			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;
-			}
-
-			public Object clone() {
-				return new TestSampler();
-			}
-		}
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ */
+
+package org.apache.jmeter.threads;
+
+import org.apache.jmeter.config.ConfigTestElement;
+import org.apache.jmeter.control.GenericController;
+import org.apache.jmeter.samplers.AbstractSampler;
+import org.apache.jmeter.samplers.SampleResult;
+import org.apache.jorphan.collections.ListedHashTree;
+
+public class TestTestCompiler extends junit.framework.TestCase {
+		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();
+
+			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;
+			}
+
+			public Object clone() {
+				return new TestSampler();
+			}
+		}
+}

Propchange: jakarta/jmeter/trunk/test/src/org/apache/jmeter/threads/TestTestCompiler.java
------------------------------------------------------------------------------
    svn:eol-style = native

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=618404&r1=618403&r2=618404&view=diff
==============================================================================
--- jakarta/jmeter/trunk/test/src/org/apache/jorphan/TestFunctorUsers.java (original)
+++ jakarta/jmeter/trunk/test/src/org/apache/jorphan/TestFunctorUsers.java Mon Feb  4 11:55:48 2008
@@ -1,67 +1,67 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * 
- */
-
-package org.apache.jorphan;
-
-import org.apache.jmeter.config.gui.ArgumentsPanel;
-import org.apache.jmeter.junit.JMeterTestCase;
-import org.apache.jmeter.protocol.http.gui.HTTPArgumentsPanel;
-import org.apache.jmeter.protocol.ldap.config.gui.LDAPArgumentsPanel;
-import org.apache.jmeter.visualizers.StatGraphVisualizer;
-import org.apache.jmeter.visualizers.StatVisualizer;
-import org.apache.jmeter.visualizers.SummaryReport;
-import org.apache.jmeter.visualizers.TableVisualizer;
-
-/*
- * Unit tests for classes that use Functors
- * 
- */
-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());
-	}
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ */
+
+package org.apache.jorphan;
+
+import org.apache.jmeter.config.gui.ArgumentsPanel;
+import org.apache.jmeter.junit.JMeterTestCase;
+import org.apache.jmeter.protocol.http.gui.HTTPArgumentsPanel;
+import org.apache.jmeter.protocol.ldap.config.gui.LDAPArgumentsPanel;
+import org.apache.jmeter.visualizers.StatGraphVisualizer;
+import org.apache.jmeter.visualizers.StatVisualizer;
+import org.apache.jmeter.visualizers.SummaryReport;
+import org.apache.jmeter.visualizers.TableVisualizer;
+
+/*
+ * Unit tests for classes that use Functors
+ * 
+ */
+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());
+	}
+}

Propchange: jakarta/jmeter/trunk/test/src/org/apache/jorphan/TestFunctorUsers.java
------------------------------------------------------------------------------
    svn:eol-style = native

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=618404&r1=618403&r2=618404&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 Mon Feb  4 11:55:48 2008
@@ -1,175 +1,175 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * 
- */
-
-package org.apache.jorphan.collections;
-
-import java.util.Arrays;
-import java.util.Collection;
-
-import junit.framework.TestCase;
-
-import org.apache.jorphan.logging.LoggingManager;
-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());
-		}
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ */
+
+package org.apache.jorphan.collections;
+
+import java.util.Arrays;
+import java.util.Collection;
+
+import junit.framework.TestCase;
+
+import org.apache.jorphan.logging.LoggingManager;
+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());
+		}
+
+}

Propchange: jakarta/jmeter/trunk/test/src/org/apache/jorphan/collections/PackageTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



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