1 4 package com.tc.object.config; 5 6 import com.tc.config.schema.builder.DSOApplicationConfigBuilder; 7 import com.tc.util.concurrent.NoExceptionLinkedQueue; 8 9 import junit.framework.TestCase; 10 11 public class ConfigVisitorTest extends TestCase { 12 public void testDSOApplicationConfigVisitor() throws Throwable { 13 14 ConfigVisitor visitor = new ConfigVisitor(); 15 TestDSOApplicationConfig cfg = new TestDSOApplicationConfig(); 16 visitor.visitDSOApplicationConfig(cfg, Target.class); 17 Object [] args = (Object []) Target.visitCalls.poll(0); 18 assertNotNull(args); 19 assertSame(visitor, args[0]); 20 assertSame(cfg, args[1]); 21 22 visitor.visitDSOApplicationConfig(cfg, Target.class); 23 assertNull(Target.visitCalls.poll(0)); 24 } 25 26 private static final class TestDSOApplicationConfig implements DSOApplicationConfig { 27 public void addRoot(String rootName, String rootFieldName) { 28 return; 29 } 30 31 public void writeTo(DSOApplicationConfigBuilder builder) { 32 return; 33 } 34 35 public void addIncludePattern(String classPattern) { 36 return; 37 } 38 39 public void addWriteAutolock(String methodPattern) { 40 return; 41 } 42 43 public void addReadAutolock(String methodPattern) { 44 return; 45 } 46 47 public void addIncludePattern(String classname, boolean b) { 48 return; 49 } 50 } 51 52 private static final class Target { 53 public static NoExceptionLinkedQueue visitCalls = new NoExceptionLinkedQueue(); 54 public static void visitDSOApplicationConfig(ConfigVisitor visitor, DSOApplicationConfig config) { 55 visitCalls.put(new Object [] {visitor, config}); 56 } 57 } 58 59 } 60 | Popular Tags |