1 package org.sapia.magnet.domain.test; 2 3 import junit.framework.TestCase; 4 import junit.textui.TestRunner; 5 6 import org.sapia.magnet.domain.Exclude; 7 import org.sapia.magnet.domain.Include; 8 import org.sapia.magnet.domain.Path; 9 import org.sapia.magnet.domain.FileProtocolHandler; 10 import org.sapia.magnet.domain.HttpProtocolHandler; 11 12 22 public class ProtocolHandlerTest extends TestCase { 23 24 public static void main(String [] args) { 25 TestRunner.run(ProtocolHandlerTest.class); 26 } 27 28 public ProtocolHandlerTest(String aName) { 29 super(aName); 30 } 31 32 public void testBasicPath() throws Exception { 33 FileProtocolHandler aHandler = new FileProtocolHandler(); 34 Path aPath = new Path(); 35 aPath.setDirectory(System.getProperty("user.dir")); 36 aPath.addInclude(new Include("**/*")); 37 aPath.addExclude(new Exclude("**/bin/*")); 38 39 System.out.println("INCLUDES: " + aHandler.resolveResources(aPath, Path.SORTING_ASCENDING)); 40 } 41 42 public void testBasicHttpPath() throws Exception { 43 HttpProtocolHandler aHandler = new HttpProtocolHandler(); 44 Path aPath = new Path(); 45 aPath.setProtocol(Path.PROTOCOL_HTTP); 46 aPath.setHost("192.168.0.130:8200"); 47 aPath.setDirectory("/sapia/codebase"); 48 aPath.addInclude(new Include("interafces.jar")); 49 aPath.addInclude(new Include("implAplha.jar")); 50 aPath.addExclude(new Exclude("*.jar")); 51 52 System.out.println("INCLUDES: " + aHandler.resolveResources(aPath, Path.SORTING_DESCENDING)); 53 } 54 } | Popular Tags |