1 /* 2 * Copyright (c) 2002-2003 The XDoclet Team. 3 * All rights reserved. 4 */ 5 6 package xdoclet; 7 8 import junit.framework.TestCase; 9 import xdoclet.util.FileUtils; 10 import xdoclet.util.ClasspathManager; 11 12 import java.io.File; 13 import java.io.FileFilter; 14 15 /*** 16 * Test for ClasspathManager and XDoclet. 17 * 18 * @author <a href="mailto:aslak.hellesoy at bekk.no">Aslak Hellesøy</a> 19 * @version $Revision: 1.10 $ 20 */ 21 public class ClasspathManagerTest extends TestCase { 22 23 private XDoclet _xdoclet = new XDoclet(); 24 25 public void setUp() throws Exception { 26 // Set XDoclet's classpath to be only that of the test plugin. 27 28 // This is xdoclet2/core/target/test-classes/.. , or 29 // xdoclet2/core/target 30 File rootDir = FileUtils.getRoot(getClass()).getParentFile(); 31 File pluginDir = new File(rootDir, "testdata/plugin"); 32 File[] jars = pluginDir.listFiles( new ClasspathManager.JarFilter() ); 33 if (jars == null || jars.length == 0) { 34 fail("There were no plugin jars in " + pluginDir.getAbsolutePath()); 35 } 36 if (jars.length > 1) { 37 fail("There were " + jars.length + " plugin jars in " + pluginDir.getAbsolutePath() + " - there should only be one."); 38 } 39 _xdoclet.setClasspath(jars[0].getAbsolutePath()); 40 } 41 42 public void testGetJars() { 43 assertEquals(1, _xdoclet.getClasspathManager().getJars().size()); 44 } 45 }

This page was automatically generated by Maven