Author: markt
Date: Wed Dec 11 15:54:38 2013
New Revision: 1550179
URL: http://svn.apache.org/r1550179
Log:
Fix failing test be swapping order of host and context properties in object
names.
Add a test that confirms that property order is not significant in ObjectName.
Modified:
tomcat/trunk/test/org/apache/catalina/mbeans/TestRegistration.java
Modified: tomcat/trunk/test/org/apache/catalina/mbeans/TestRegistration.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/mbeans/TestRegistration.java?rev=1550179&r1=1550178&r2=1550179&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/mbeans/TestRegistration.java
(original)
+++ tomcat/trunk/test/org/apache/catalina/mbeans/TestRegistration.java Wed Dec
11 15:54:38 2013
@@ -25,12 +25,14 @@ import java.util.List;
import java.util.Set;
import javax.management.MBeanServer;
+import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+import org.junit.Assert;
import org.junit.Test;
import org.apache.catalina.Context;
@@ -108,22 +110,19 @@ public class TestRegistration extends To
return new String[] {
"Tomcat:j2eeType=WebModule,name=//" + host + context +
",J2EEApplication=none,J2EEServer=none",
- "Tomcat:type=Loader,context=" + context + ",host=" + host,
- "Tomcat:type=Manager,context=" + context + ",host=" + host,
- "Tomcat:type=NamingResources,context=" + context +
- ",host=" + host,
- "Tomcat:type=Valve,context=" + context +
- ",host=" + host + ",name=NonLoginAuthenticator",
- "Tomcat:type=Valve,context=" + context +
- ",host=" + host + ",name=StandardContextValve",
- "Tomcat:type=WebappClassLoader,context=" + context +
- ",host=" + host,
- "Tomcat:type=WebResourceRoot,context=" + context +
- ",host=" + host,
- "Tomcat:type=Realm,realmPath=/realm0,context=" + context +
- ",host=" + host,
- "Tomcat:type=Realm,realmPath=/realm0/realm0,context=" + context +
- ",host=" + host,
+ "Tomcat:type=Loader,host=" + host + ",context=" + context,
+ "Tomcat:type=Manager,host=" + host + ",context=" + context,
+ "Tomcat:type=NamingResources,host=" + host + ",context=" + context,
+ "Tomcat:type=Valve,host=" + host + ",context=" + context +
+ ",name=NonLoginAuthenticator",
+ "Tomcat:type=Valve,host=" + host + ",context=" + context +
+ ",name=StandardContextValve",
+ "Tomcat:type=WebappClassLoader,host=" + host + ",context=" +
context,
+ "Tomcat:type=WebResourceRoot,host=" + host + ",context=" + context,
+ "Tomcat:type=Realm,realmPath=/realm0,host=" + host +
+ ",context=" + context,
+ "Tomcat:type=Realm,realmPath=/realm0/realm0,host=" + host +
+ ",context=" + context
};
}
@@ -249,4 +248,15 @@ public class TestRegistration extends To
assertEquals("Remaining: " + onames, 0, onames.size());
}
+ /**
+ * Confirm that, as far as ObjectName is concerned, the order of the key
+ * properties is not significant.
+ */
+ @Test
+ public void testNames() throws MalformedObjectNameException {
+ ObjectName on1 = new ObjectName("test:foo=a,bar=b");
+ ObjectName on2 = new ObjectName("test:bar=b,foo=a");
+
+ Assert.assertTrue(on1.equals(on2));
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]