01: /*
02: * All content copyright (c) 2003-2007 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.object.bytecode;
05:
06: import com.tc.asm.ClassReader;
07: import com.tc.asm.ClassVisitor;
08: import com.tc.asm.ClassWriter;
09: import com.tc.asm.util.CheckClassAdapter;
10: import com.tc.object.tools.BootJar;
11: import com.tc.test.TCTestCase;
12: import com.tc.util.runtime.Vm;
13:
14: import java.io.IOException;
15: import java.io.PrintWriter;
16: import java.io.StringWriter;
17: import java.util.Date;
18:
19: public class JavaUtilConcurrentLinkedBlockingQueueIteratorClassAdapterTest
20: extends TCTestCase {
21:
22: public JavaUtilConcurrentLinkedBlockingQueueIteratorClassAdapterTest() {
23: if (Vm.isJDK14()) {
24: disableAllUntil(new Date(Long.MAX_VALUE));
25: }
26: }
27:
28: public void testClasAdapter() throws IOException {
29: String res = BootJar
30: .classNameToFileName("java.util.concurrent.LinkedBlockingQueue$Itr");
31: ClassReader cr = new ClassReader(getClass().getClassLoader()
32: .getResourceAsStream(res));
33: ClassWriter cw = new ClassWriter(cr, ClassWriter.COMPUTE_MAXS);
34: ClassVisitor cv = new JavaUtilConcurrentLinkedBlockingQueueIteratorClassAdapter(
35: new CheckClassAdapter(cw));
36: cr.accept(cv, ClassReader.SKIP_FRAMES);
37:
38: StringWriter sw = new StringWriter();
39: PrintWriter pw = new PrintWriter(sw);
40: CheckClassAdapter.verify(new ClassReader(cw.toByteArray()),
41: false, pw);
42: assertTrue(sw.toString(), sw.toString().length() == 0);
43: }
44:
45: }
|