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 2006/03/24 15:53:17 UTC

svn commit: r388548 - /jakarta/jmeter/branches/rel-2-1/test/src/org/apache/jmeter/junit/JMeterTest.java

Author: sebb
Date: Fri Mar 24 06:53:17 2006
New Revision: 388548

URL: http://svn.apache.org/viewcvs?rev=388548&view=rev
Log:
Test for missing aliases

Modified:
    jakarta/jmeter/branches/rel-2-1/test/src/org/apache/jmeter/junit/JMeterTest.java

Modified: jakarta/jmeter/branches/rel-2-1/test/src/org/apache/jmeter/junit/JMeterTest.java
URL: http://svn.apache.org/viewcvs/jakarta/jmeter/branches/rel-2-1/test/src/org/apache/jmeter/junit/JMeterTest.java?rev=388548&r1=388547&r2=388548&view=diff
==============================================================================
--- jakarta/jmeter/branches/rel-2-1/test/src/org/apache/jmeter/junit/JMeterTest.java (original)
+++ jakarta/jmeter/branches/rel-2-1/test/src/org/apache/jmeter/junit/JMeterTest.java Fri Mar 24 06:53:17 2006
@@ -1,6 +1,5 @@
-// $Header$
 /*
- * Copyright 2002-2004 The Apache Software Foundation.
+ * Copyright 2002-2004,2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -32,6 +31,7 @@
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
+import java.util.Properties;
 import java.util.Set;
 
 import javax.swing.JComponent;
@@ -75,6 +75,8 @@
 
 	private static Map funcTitles;
 
+    private static Properties nameMap;
+    
 	public JMeterTest(String name) {
 		super(name);
 	}
@@ -143,6 +145,7 @@
 		}
 
 		TestSuite suite = new TestSuite();
+        suite.addTest(new JMeterTest("readAliases"));
 		suite.addTest(new JMeterTest("createTitleSet"));
 		suite.addTest(new JMeterTest("createTagSet"));
 		suite.addTest(suiteGUIComponents());
@@ -390,7 +393,7 @@
 	}
 
 	/*
-	 * Test GUI elements - run the test
+	 * Test GUI elements - run for all components
 	 */
 	public void GUIComponents1() throws Exception {
 		String name = guiItem.getClass().getName();
@@ -408,10 +411,11 @@
 				log.warn("Class has not yet implemented getLabelResource " + name);
 			}
 		}
+        checkElementAlias(guiItem);
 	}
 
 	/*
-	 * Test GUI elements - run the test
+	 * Test GUI elements - not run for TestBeanGui items
 	 */
 	public void GUIComponents2() throws Exception {
 		String name = guiItem.getClass().getName();
@@ -502,9 +506,24 @@
 	public void runTestElement() throws Exception {
 		checkElementCloning(testItem);
 		assertTrue(testItem.getClass().getName() + " must implement Serializable", testItem instanceof Serializable);
+        checkElementAlias(testItem);
 	}
 
-	private static Collection getObjects(Class extendsClass) throws Exception {
+    public void readAliases() throws Exception {
+        nameMap = SaveService.loadProperties();        
+        assertNotNull("nameMap should not be null",nameMap);
+    }
+    
+	private void checkElementAlias(Object item) {
+        String name=item.getClass().getName();
+        boolean contains = nameMap.values().contains(name);
+        if (!contains){
+            //System.out.println(name.substring(name.lastIndexOf('.')+1)+"="+name);
+            fail("nameMap should contain "+name);
+        }
+    }
+
+    private static Collection getObjects(Class extendsClass) throws Exception {
 		String exName = extendsClass.getName();
 		Object myThis = "";
 		Iterator classes = ClassFinder



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