Exemple #1
0
        public virtual void TestExistingManifest()
        {
            FilePath dir = new FilePath(Runtime.GetProperty("test.build.dir", "target/test-dir"
                                                            ), typeof(TestJarFinder).FullName + "-testExistingManifest");

            Delete(dir);
            dir.Mkdirs();
            FilePath metaInfDir = new FilePath(dir, "META-INF");

            metaInfDir.Mkdirs();
            FilePath     manifestFile = new FilePath(metaInfDir, "MANIFEST.MF");
            Manifest     manifest     = new Manifest();
            OutputStream os           = new FileOutputStream(manifestFile);

            manifest.Write(os);
            os.Close();
            FilePath   propsFile = new FilePath(dir, "props.properties");
            TextWriter writer    = new FileWriter(propsFile);

            new Properties().Store(writer, string.Empty);
            writer.Close();
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            JarOutputStream       zos  = new JarOutputStream(baos);

            JarFinder.JarDir(dir, string.Empty, zos);
            JarInputStream jis = new JarInputStream(new ByteArrayInputStream(baos.ToByteArray
                                                                                 ()));

            NUnit.Framework.Assert.IsNotNull(jis.GetManifest());
            jis.Close();
        }
Exemple #2
0
        public virtual void TestJar()
        {
            //picking a class that is for sure in a JAR in the classpath
            string jar = JarFinder.GetJar(typeof(LogFactory));

            Assert.True(new FilePath(jar).Exists());
        }
Exemple #3
0
        public virtual void TestExpandedClasspath()
        {
            //picking a class that is for sure in a directory in the classpath
            //in this case the JAR is created on the fly
            string jar = JarFinder.GetJar(typeof(TestJarFinder));

            Assert.True(new FilePath(jar).Exists());
        }