evenisse2003/08/06 03:42:44
Modified:src/test/java/org/apache/maven/jelly/tags/maven
DependencyResolverTest.java
Log:
Backward code to the previous version. Now, we don't use digester in maven test
classes. I think we can remove the dependency in Maven pom.
Revision ChangesPath
1.6 +36 -118
maven/src/test/java/org/apache/maven/jelly/tags/maven/DependencyResolverTest.java
Index: DependencyResolverTest.java
===
RCS file:
/home/cvs/maven/src/test/java/org/apache/maven/jelly/tags/maven/DependencyResolverTest.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- DependencyResolverTest.java 27 Jul 2003 23:34:00 - 1.5
+++ DependencyResolverTest.java 6 Aug 2003 10:42:44 - 1.6
@@ -56,123 +56,69 @@
*
*/
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-import org.apache.commons.digester.Digester;
-import org.apache.maven.project.Dependency;
-import org.apache.maven.project.Project;
-import org.xml.sax.SAXException;
-
import junit.framework.TestCase;
+import org.apache.maven.project.Project;
+
/**
* @author a href=[EMAIL PROTECTED]Ben Walding/a
* @version $Id$
*/
-public class DependencyResolverTest extends TestCase
-{
-protected InputStream getResource(String resource) throws IOException
-{
-String baseDir = System.getProperty(basedir);
-File f = new File(baseDir + /src/test/dependency-resolver/ + resource);
-return new FileInputStream(f);
-}
-
-public void testSimple1() throws Exception
-{
-InputStream is = getResource(test-simple1.xml);
-List projects = getProjects(is);
-testSimple1Source(new GraphDependencyResolver(), projects);
-testSimple1Binary(new GraphDependencyResolver(), projects);
-testSimple1Source(new WerkzDependencyResolver(), projects);
-testSimple1Binary(new WerkzDependencyResolver(), projects);
-}
-
-public void testSimple2() throws Exception
-{
-InputStream is = getResource(test-simple2.xml);
-List projects = getProjects(is);
+public class DependencyResolverTest extends TestCase {
+
+
+public void testSimple1() throws Exception {
+List projects = DependencyResolverTestData.getTestSimple1();
+testSimple1(new GraphDependencyResolver(), projects);
+testSimple1(new WerkzDependencyResolver(), projects);
+}
+
+public void testSimple2() throws Exception {
+List projects = DependencyResolverTestData.getTestSimple2();
testSimple2(new GraphDependencyResolver(), projects);
testSimple2(new WerkzDependencyResolver(), projects);
}
-public void testSimple3() throws Exception
-{
-InputStream is = getResource(test-simple3.xml);
-List projects = getProjects(is);
+public void testSimple3() throws Exception {
+List projects = DependencyResolverTestData.getTestSimple3();
testSimple3(new GraphDependencyResolver(), projects);
testSimple3(new WerkzDependencyResolver(), projects);
}
-public void testComplex() throws Exception
-{
-InputStream is = getResource(test-complex.xml);
-List projects = getProjects(is);
+public void testComplex() throws Exception {
+List projects = DependencyResolverTestData.getTestComplex();
testComplex(new GraphDependencyResolver(), projects);
testComplex(new WerkzDependencyResolver(), projects);
}
-public void testCycle() throws Exception
-{
-InputStream is = getResource(test-cycle.xml);
-List projects = getProjects(is);
+public void testCycle() throws Exception {
+List projects = DependencyResolverTestData.getTestCycle();
testCycle(new GraphDependencyResolver(), projects);
testCycle(new WerkzDependencyResolver(), projects);
}
-public void testCycle(DependencyResolverInterface dri, List projects) throws
Exception
-{
+public void testCycle(DependencyResolverInterface dri, List projects) throws
Exception {
DependencyResolver dr = new DependencyResolver(dri);
dr.setProjects(projects);
-try
-{
+try {
dr.getSortedDependencies(true);
fail(Shouldn't be able to resolve cycles);
-}
-catch (Exception e)
-{
+} catch (Exception e) {
//Success
}
-try
-