KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > javax > management > compliance > serialization > JMXSerializationTest


1 /*
2  * Copyright (C) The MX4J Contributors.
3  * All rights reserved.
4  *
5  * This software is distributed under the terms of the MX4J License version 1.0.
6  * See the terms of the MX4J License in the documentation provided with this software.
7  */

8
9 package test.javax.management.compliance.serialization;
10
11 import java.io.Serializable JavaDoc;
12 import java.lang.reflect.Modifier JavaDoc;
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 {
22    public JMXSerializationTest(String JavaDoc s)
23    {
24       super(s);
25    }
26
27    protected boolean skipClassName(String JavaDoc className)
28    {
29       // Skip some classes, not required for compliance
30
if (className.equals("javax.management.MBeanServerPermissionCollection") ||
31           className.equals("javax.management.loading.MLet") ||
32           className.equals("javax.management.loading.PrivateMLet") ||
33           className.equals("javax.management.timer.TimerAlarmClockNotification"))
34          return true;
35       return false;
36    }
37
38    protected boolean skipClass(Class JavaDoc cls)
39    {
40       if (cls.isInterface() || !Serializable JavaDoc.class.isAssignableFrom(cls) || Modifier.isAbstract(cls.getModifiers())) return true;
41       return false;
42    }
43
44    protected void checkCompliance(String JavaDoc name) throws Exception JavaDoc
45    {
46       ClassLoader JavaDoc jmxriLoader = createJMXRIWithTestsClassLoader();
47       ClassLoader JavaDoc mx4jLoader = createMX4JWithTestsClassLoader();
48
49       SerializationVerifier verifier = new SerializationVerifier("test.javax.management.compliance.serialization.support.Instantiator", "test.javax.management.compliance.serialization.support.Comparator");
50       verifier.verifySerialization(name, jmxriLoader, mx4jLoader);
51    }
52 }
53
Popular Tags