01: /*
02: * Copyright (C) The MX4J Contributors.
03: * All rights reserved.
04: *
05: * This software is distributed under the terms of the MX4J License version 1.0.
06: * See the terms of the MX4J License in the documentation provided with this software.
07: */
08:
09: package test.javax.management.compliance.serialization;
10:
11: import java.io.Serializable;
12: import java.lang.reflect.Modifier;
13:
14: import test.javax.management.compliance.JMXComplianceTestCase;
15: import test.javax.management.compliance.serialization.support.SerializationVerifier;
16:
17: /**
18: * @version $Revision: 1.4 $
19: */
20: public class JMXSerializationTest extends JMXComplianceTestCase {
21: public JMXSerializationTest(String s) {
22: super (s);
23: }
24:
25: protected boolean skipClassName(String className) {
26: // Skip some classes, not required for compliance
27: if (className
28: .equals("javax.management.MBeanServerPermissionCollection")
29: || className.equals("javax.management.loading.MLet")
30: || className
31: .equals("javax.management.loading.PrivateMLet")
32: || className
33: .equals("javax.management.timer.TimerAlarmClockNotification"))
34: return true;
35: return false;
36: }
37:
38: protected boolean skipClass(Class cls) {
39: if (cls.isInterface()
40: || !Serializable.class.isAssignableFrom(cls)
41: || Modifier.isAbstract(cls.getModifiers()))
42: return true;
43: return false;
44: }
45:
46: protected void checkCompliance(String name) throws Exception {
47: ClassLoader jmxriLoader = createJMXRIWithTestsClassLoader();
48: ClassLoader mx4jLoader = createMX4JWithTestsClassLoader();
49:
50: SerializationVerifier verifier = new SerializationVerifier(
51: "test.javax.management.compliance.serialization.support.Instantiator",
52: "test.javax.management.compliance.serialization.support.Comparator");
53: verifier.verifySerialization(name, jmxriLoader, mx4jLoader);
54: }
55: }
|