01: /*
02: * All content copyright (c) 2003-2007 Terracotta, Inc., except as may otherwise be noted in a separate copyright
03: * notice. All rights reserved.
04: */
05: package com.tcverify;
06:
07: import java.util.Arrays;
08: import java.util.Collection;
09:
10: public class DSOVerifierReplaceSystemLoaderTest extends DSOVerifierTest {
11:
12: protected String getMainClass() {
13: return Client.class.getName();
14: }
15:
16: protected Collection<String> getExtraJvmArgs() {
17: return Arrays
18: .asList(new String[] { "-Djava.system.class.loader="
19: + SystemLoader.class.getName() /*, "-XX:+TraceClassLoading" */});
20: }
21:
22: public static class SystemLoader extends ClassLoader {
23: public SystemLoader(ClassLoader parent) {
24: super (parent);
25: }
26: }
27:
28: public static class Client {
29: public static void main(String[] args) {
30: Class<SystemLoader> expectedType = SystemLoader.class;
31: Class<? extends ClassLoader> actualType = ClassLoader
32: .getSystemClassLoader().getClass();
33:
34: if (expectedType != actualType) {
35: //
36: throw new RuntimeException(
37: "System loader not replaced, expected "
38: + expectedType + ", but was "
39: + actualType);
40: }
41:
42: DSOVerifier.main(args);
43: }
44: }
45:
46: }
|