1 17 package org.apache.excalibur.source.test; 18 19 import java.io.File ; 20 21 import junit.framework.TestCase; 22 23 import org.apache.avalon.framework.context.DefaultContext; 24 import org.apache.avalon.framework.logger.ConsoleLogger; 25 import org.apache.avalon.framework.logger.Logger; 26 import org.apache.avalon.framework.service.DefaultServiceManager; 27 import org.apache.avalon.framework.service.DefaultServiceSelector; 28 import org.apache.excalibur.source.SourceFactory; 29 import org.apache.excalibur.source.impl.ResourceSourceFactory; 30 import org.apache.excalibur.source.impl.SourceResolverImpl; 31 32 35 public class SourceResolverImplTestCase extends TestCase 36 { 37 38 public SourceResolverImplTestCase( ) 39 { 40 this( "source" ); 41 } 42 43 public SourceResolverImplTestCase( String name ) 44 { 45 super( name ); 46 } 47 48 public void testResolver() throws Exception 49 { 50 Logger logger = new ConsoleLogger( ConsoleLogger.LEVEL_DEBUG ); 51 52 56 final SourceResolverImpl resolver = new SourceResolverImpl(); 57 resolver.enableLogging( logger ); 58 59 66 final DefaultContext context = new DefaultContext(); 67 context.put( "context-root", new File ( System.getProperty( "user.dir" ) ) ); 68 resolver.contextualize( context ); 69 70 75 final ResourceSourceFactory factory = new ResourceSourceFactory(); 76 factory.enableLogging( logger.getChildLogger( "factory" ) ); 77 78 83 final DefaultServiceSelector selector = new DefaultServiceSelector(); 84 selector.put( "resource", factory ); 85 86 final DefaultServiceManager manager = new DefaultServiceManager(); 87 manager.put( SourceFactory.ROLE + "Selector", selector ); 88 89 resolver.service( manager ); 90 91 92 logger.debug( "resolver created - but is this correct ?" ); 93 94 98 logger.debug( "help me - need to setup a handler" ); 99 100 104 logger.debug( "help me - need to test source creation" ); 105 106 110 logger.debug( "help me - need to test source resolution" ); 111 112 assertTrue( true ); 113 } 114 115 } 116 | Popular Tags |