-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">\r
+<project xmlns="http://maven.apache.org/POM/4.0.0"\r
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">\r
\r
<modelVersion>4.0.0</modelVersion>\r
<groupId>jp.sourceforge.stigmata</groupId>\r
<artifactId>digger</artifactId>\r
<packaging>jar</packaging>\r
- <version>1.0.1-SNAPSHOT</version>\r
+ <version>1.1.0-SNAPSHOT</version>\r
<name>digger</name>\r
<description>Dig up class files</description>\r
<url>http://stigmata.sourceforge.jp/digger/</url>\r
<dependency>\r
<groupId>asm</groupId>\r
<artifactId>asm-all</artifactId>\r
- <version>2.2.3</version>\r
+ <version>3.1</version>\r
<scope>compile</scope>\r
</dependency>\r
<dependency>\r
</plugin>\r
</plugins>\r
</reporting>\r
-</project>
\ No newline at end of file
+</project>\r
We can see digger-x.x.x-bin.jar, and digger-x.x.x-src.jar.\r
Both packages mean as followings.\r
\r
- [digger-x.x.x-bin.jar] binary distribution package, contains class\r
+ [digger-x.x.x-bin.zip/tar.gz/tar.bz2] binary distribution package, contains class\r
files and resource files.\r
\r
- [digger-x.x.x-src.jar] source distribution package, contains\r
+ [digger-x.x.x-src.zip/tar.gz/tar.bz2] source distribution package, contains\r
pom.xml, source files, resource files and documents.\r
\r
*Binary download by maven2 \r
<dependencies>\r
:\r
<dependency>\r
- <groupId>jp.sourceforge</groupId>\r
- <artifactId>stigmata</artifactId>\r
- <version>1.2.0</version>\r
+ <groupId>jp.sourceforge.stigmata</groupId>\r
+ <artifactId>digger</artifactId>\r
+ <version>1.0.0</version>\r
</dependency>\r
:\r
</dependencies>\r
The source can be checked out anonymously from Subversion.\r
\r
----\r
-$ svn checkout http://svn.sourceforge.jp/svnroot/stigmata/trunk/ stigmata\r
+$ svn checkout http://svn.sourceforge.jp/svnroot/stigmata/digger/trunk digger\r
----\r
\r
**Web access\r
\r
We can browse the source code from following link.\r
\r
- {{http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi/?root=stigmata}}\r
+ {{http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi/digger/?root=stigmata}}\r
\r
*/
import java.io.File;
+import java.net.URL;
import org.junit.Assert;
import org.junit.Before;
@Test
public void testBasic() throws ClassNotFoundException{
+ Assert.assertEquals(0, context.getClasspathSize());
+
Class<?> classFileEntryClass = context.findClass("jp.sourceforge.stigmata.digger.ClassFileEntry");
Class<?> classpathContextClass = context.findClass("jp.sourceforge.stigmata.digger.ClasspathContext");
Assert.assertNotNull(context.findEntry("jp.sourceforge.stigmata.digger.ClasspathContext"));
}
+ @Test
+ public void testBasic2() throws Exception{
+ context.addClasspath(new File("target/classes").toURI().toURL());
+ Assert.assertEquals(1, context.getClasspathSize());
+ Assert.assertEquals(new File("target/classes").toURI().toURL(), context.getClasspathList()[0]);
+
+ context.clear();
+ Assert.assertEquals(0, context.getClasspathSize());
+ }
+
+ @Test
+ public void testParent() throws Exception{
+ ClasspathContext subContext = new ClasspathContext(context);
+ context.addClasspath(new File("target/classes").toURI().toURL());
+ subContext.addClasspath(new File("target/asm-all-3.1.jar").toURI().toURL());
+
+ Assert.assertEquals(1, context.getClasspathSize());
+ Assert.assertEquals(2, subContext.getClasspathSize());
+
+ URL[] url = subContext.getClasspathList();
+ Assert.assertEquals(new File("target/classes").toURI().toURL(), url[0]);
+ Assert.assertEquals(new File("target/asm-all-3.1.jar").toURI().toURL(), url[1]);
+
+ subContext.clear();
+ Assert.assertEquals(1, subContext.getClasspathSize());
+
+ subContext.clearAll();
+ Assert.assertEquals(0, subContext.getClasspathSize());
+ }
+
+ @Test
+ public void testParent2() throws Exception{
+ ClasspathContext subContext = new ClasspathContext(context);
+ context.addClasspath(new File("target/classes").toURI().toURL());
+ subContext.addClasspath(new File("target/asm-all-3.1.jar").toURI().toURL());
+
+ Assert.assertTrue(context.isIncludeSystemClasses());
+ subContext.setIncludeSystemClasses(false);
+ Assert.assertFalse(context.isIncludeSystemClasses());
+ }
+
@Test(expected=ClassNotFoundException.class)
public void testNotExistedClass() throws Exception{
context.findClass("not.exists.ClassName");
@Test
public void testFindEntryNotSearchSystemClasspath4() throws Exception{
context.addClasspath(new File("target/classes").toURI().toURL());
- context.addClasspath(new File("target/asm-all-2.2.3.jar").toURI().toURL());
+ context.addClasspath(new File("target/asm-all-3.1.jar").toURI().toURL());
context.setIncludeSystemClasses(false);
Assert.assertTrue(context.hasEntry("java.lang.Object"));
@Test
public void testNotSearchSystemClasspath4() throws Exception{
context.addClasspath(new File("target/classes").toURI().toURL());
- context.addClasspath(new File("target/asm-all-2.2.3.jar").toURI().toURL());
+ context.addClasspath(new File("target/asm-all-3.1.jar").toURI().toURL());
context.setIncludeSystemClasses(false);
Assert.assertNotNull(context.findClass("java.lang.Object"));
Assert.assertNotNull(context.findClass("jp.sourceforge.stigmata.digger.ClasspathContext"));
@Test
public void testSubContextNotSearchSystemClasspath4() throws Exception{
context.addClasspath(new File("target/classes").toURI().toURL());
- context.addClasspath(new File("target/asm-all-2.2.3.jar").toURI().toURL());
+ context.addClasspath(new File("target/asm-all-3.1.jar").toURI().toURL());
context.setIncludeSystemClasses(false);
ClasspathContext subContext = new ClasspathContext(context);