[jboss-cvs] JBossAS SVN: r74288 - in projects/vfs/tags: 2.0.0.Beta15 and 3 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sun Jun 8 09:22:35 EDT 2008
Author: alesj
Date: 2008-06-08 09:22:34 -0400 (Sun, 08 Jun 2008)
New Revision: 74288
Added:
projects/vfs/tags/2.0.0.Beta15/
projects/vfs/tags/2.0.0.Beta15/pom.xml
projects/vfs/tags/2.0.0.Beta15/release-pom.xml
projects/vfs/tags/2.0.0.Beta15/src/main/java/org/jboss/virtual/plugins/context/zip/ZipStreamWrapper.java
projects/vfs/tags/2.0.0.Beta15/src/test/java/org/jboss/test/virtual/test/JARVFSContextUnitTestCase.java
projects/vfs/tags/2.0.0.Beta15/src/test/java/org/jboss/test/virtual/test/ZipEntryVFSContextUnitTestCase.java
projects/vfs/tags/2.0.0.Beta15/src/test/resources/vfs/context/jar/nested.jar
Removed:
projects/vfs/tags/2.0.0.Beta15/pom.xml
projects/vfs/tags/2.0.0.Beta15/src/main/java/org/jboss/virtual/plugins/context/zip/ZipStreamWrapper.java
projects/vfs/tags/2.0.0.Beta15/src/test/java/org/jboss/test/virtual/test/JARVFSContextUnitTestCase.java
projects/vfs/tags/2.0.0.Beta15/src/test/java/org/jboss/test/virtual/test/ZipEntryVFSContextUnitTestCase.java
Log:
[maven-release-plugin] copy for tag 2.0.0.Beta15
Copied: projects/vfs/tags/2.0.0.Beta15 (from rev 74283, projects/vfs/trunk)
Deleted: projects/vfs/tags/2.0.0.Beta15/pom.xml
===================================================================
--- projects/vfs/trunk/pom.xml 2008-06-08 11:44:00 UTC (rev 74283)
+++ projects/vfs/tags/2.0.0.Beta15/pom.xml 2008-06-08 13:22:34 UTC (rev 74288)
@@ -1,121 +0,0 @@
-<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">
- <parent>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-parent</artifactId>
- <version>4-beta-2</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-vfs</artifactId>
- <packaging>jar</packaging>
- <version>2.0.0-SNAPSHOT</version>
- <name>JBoss VFS</name>
- <url>http://www.jboss.org</url>
- <description>A VFS library</description>
- <scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossas/projects/vfs/trunk</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/vfs/trunk</developerConnection>
- <url>https://svn.jboss.org/repos/jbossas/projects/vfs/trunk</url>
- </scm>
- <licenses>
- <license>
- <name>lgpl</name>
- <url>http://repository.jboss.org/licenses/lgpl.txt</url>
- </license>
- </licenses>
- <organization>
- <name>JBoss, A division of Red Hat, Inc</name>
- <url>http://www.jboss.org</url>
- </organization>
-
- <properties>
- <version.jboss.common.core>2.2.5.GA</version.jboss.common.core>
- <version.jboss.logging>2.0.5.GA</version.jboss.logging>
- <version.jboss.test>1.1.0.GA</version.jboss.test>
- <version.junit>4.4</version.junit>
- </properties>
-
- <build>
- <sourceDirectory>src/main/java</sourceDirectory>
- <testSourceDirectory>src/test/java</testSourceDirectory>
- <finalName>${artifactId}</finalName>
- <testResources>
- <testResource>
- <directory>src/test/resources</directory>
- </testResource>
- </testResources>
- <plugins>
-
- <!-- define how we want compilation to take place
- here, we accept most of the defaults but say that we want the
- optimization flag set, and define the source and target to be 1.5,
- these setting will be inherited by child projects -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>2.0</version>
- <configuration>
- <debug>true</debug>
- <source>1.5</source>
- <target>1.5</target>
- </configuration>
- </plugin>
- <!-- define that we wish to create src jars -->
- <plugin>
- <artifactId>maven-source-plugin</artifactId>
- <inherited>true</inherited>
- <executions>
- <execution>
- <goals>
- <goal>jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.3.1</version>
- <configuration>
- <forkMode>always</forkMode> <!-- required to correctly run the PojoServer tests -->
- <useSystemClassLoader>true</useSystemClassLoader>
- <redirectTestOutputToFile>true</redirectTestOutputToFile>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-release-plugin</artifactId>
- <version>2.0-beta-7</version>
- <configuration>
- <tagBase>https://svn.jboss.org/repos/jbossas/projects/vfs/tags</tagBase>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <dependencies>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-common-core</artifactId>
- <version>${version.jboss.common.core}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging-spi</artifactId>
- <version>${version.jboss.logging}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.test</groupId>
- <artifactId>jboss-test</artifactId>
- <version>${version.jboss.test}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>${version.junit}</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
-</project>
Copied: projects/vfs/tags/2.0.0.Beta15/pom.xml (from rev 74287, projects/vfs/trunk/pom.xml)
===================================================================
--- projects/vfs/tags/2.0.0.Beta15/pom.xml (rev 0)
+++ projects/vfs/tags/2.0.0.Beta15/pom.xml 2008-06-08 13:22:34 UTC (rev 74288)
@@ -0,0 +1,121 @@
+<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">
+ <parent>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-parent</artifactId>
+ <version>4-beta-2</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-vfs</artifactId>
+ <packaging>jar</packaging>
+ <version>2.0.0.Beta15</version>
+ <name>JBoss VFS</name>
+ <url>http://www.jboss.org</url>
+ <description>A VFS library</description>
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossas/projects/vfs/tags/2.0.0.Beta15</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/vfs/tags/2.0.0.Beta15</developerConnection>
+ <url>https://svn.jboss.org/repos/jbossas/projects/vfs/tags/2.0.0.Beta15</url>
+ </scm>
+ <licenses>
+ <license>
+ <name>lgpl</name>
+ <url>http://repository.jboss.org/licenses/lgpl.txt</url>
+ </license>
+ </licenses>
+ <organization>
+ <name>JBoss, A division of Red Hat, Inc</name>
+ <url>http://www.jboss.org</url>
+ </organization>
+
+ <properties>
+ <version.jboss.common.core>2.2.5.GA</version.jboss.common.core>
+ <version.jboss.logging>2.0.5.GA</version.jboss.logging>
+ <version.jboss.test>1.1.0.GA</version.jboss.test>
+ <version.junit>4.4</version.junit>
+ </properties>
+
+ <build>
+ <sourceDirectory>src/main/java</sourceDirectory>
+ <testSourceDirectory>src/test/java</testSourceDirectory>
+ <finalName>${artifactId}</finalName>
+ <testResources>
+ <testResource>
+ <directory>src/test/resources</directory>
+ </testResource>
+ </testResources>
+ <plugins>
+
+ <!-- define how we want compilation to take place
+ here, we accept most of the defaults but say that we want the
+ optimization flag set, and define the source and target to be 1.5,
+ these setting will be inherited by child projects -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.0</version>
+ <configuration>
+ <debug>true</debug>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ <!-- define that we wish to create src jars -->
+ <plugin>
+ <artifactId>maven-source-plugin</artifactId>
+ <inherited>true</inherited>
+ <executions>
+ <execution>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.3.1</version>
+ <configuration>
+ <forkMode>always</forkMode> <!-- required to correctly run the PojoServer tests -->
+ <useSystemClassLoader>true</useSystemClassLoader>
+ <redirectTestOutputToFile>true</redirectTestOutputToFile>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-release-plugin</artifactId>
+ <version>2.0-beta-7</version>
+ <configuration>
+ <tagBase>https://svn.jboss.org/repos/jbossas/projects/vfs/tags</tagBase>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-common-core</artifactId>
+ <version>${version.jboss.common.core}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-spi</artifactId>
+ <version>${version.jboss.logging}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.test</groupId>
+ <artifactId>jboss-test</artifactId>
+ <version>${version.jboss.test}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${version.junit}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
Copied: projects/vfs/tags/2.0.0.Beta15/release-pom.xml (from rev 74287, projects/vfs/trunk/release-pom.xml)
===================================================================
--- projects/vfs/tags/2.0.0.Beta15/release-pom.xml (rev 0)
+++ projects/vfs/tags/2.0.0.Beta15/release-pom.xml 2008-06-08 13:22:34 UTC (rev 74288)
@@ -0,0 +1,266 @@
+<?xml version="1.0" encoding="UTF-8"?><project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-vfs</artifactId>
+ <name>JBoss VFS</name>
+ <version>2.0.0.Beta15</version>
+ <description>A VFS library</description>
+ <url>http://www.jboss.org</url>
+ <issueManagement>
+ <system>jira</system>
+ <url>http://jira.jboss.com/</url>
+ </issueManagement>
+ <licenses>
+ <license>
+ <name>lgpl</name>
+ <url>http://repository.jboss.org/licenses/lgpl.txt</url>
+ </license>
+ </licenses>
+ <scm>
+ <connection>https://svn.jboss.org/repos/jbossas/projects/vfs/tags/2.0.0.Beta15</connection>
+ <developerConnection>https://svn.jboss.org/repos/jbossas/projects/vfs/tags/2.0.0.Beta15</developerConnection>
+ <url>https://svn.jboss.org/repos/jbossas/projects/vfs/tags/2.0.0.Beta15</url>
+ </scm>
+ <organization>
+ <name>JBoss, A division of Red Hat, Inc</name>
+ <url>http://www.jboss.org</url>
+ </organization>
+ <build>
+ <sourceDirectory>src/main/java</sourceDirectory>
+ <scriptSourceDirectory>src/main/scripts</scriptSourceDirectory>
+ <testSourceDirectory>src/test/java</testSourceDirectory>
+ <outputDirectory>target/classes</outputDirectory>
+ <testOutputDirectory>target/test-classes</testOutputDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ </resource>
+ </resources>
+ <testResources>
+ <testResource>
+ <directory>src/test/resources</directory>
+ </testResource>
+ </testResources>
+ <directory>target</directory>
+ <finalName>jboss-vfs</finalName>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.0</version>
+ <configuration>
+ <debug>true</debug>
+ <source>1.5</source>
+ <target>1.5</target>
+ <showDeprecation>true</showDeprecation>
+ <showWarnings>true</showWarnings>
+ <optimize>true</optimize>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-source-plugin</artifactId>
+ <version>2.0.3</version>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ <execution>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ <inherited>true</inherited>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.3.1</version>
+ <configuration>
+ <forkMode>always</forkMode>
+ <useSystemClassLoader>true</useSystemClassLoader>
+ <redirectTestOutputToFile>true</redirectTestOutputToFile>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-release-plugin</artifactId>
+ <version>2.0-beta-7</version>
+ <configuration>
+ <tagBase>https://svn.jboss.org/repos/jbossas/projects/vfs/tags</tagBase>
+ <generateReleasePoms>true</generateReleasePoms>
+ <useReleaseProfile>false</useReleaseProfile>
+ <arguments>-Prelease</arguments>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <repositories>
+ <repository>
+ <snapshots />
+ <id>snapshots.jboss.org</id>
+ <url>http://snapshots.jboss.org/maven2</url>
+ </repository>
+ <repository>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ <id>repository.jboss.org</id>
+ <url>http://repository.jboss.org/maven2</url>
+ </repository>
+ <repository>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ <id>central</id>
+ <name>Maven Repository Switchboard</name>
+ <url>http://repo1.maven.org/maven2</url>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ <id>repository.jboss.org</id>
+ <url>http://repository.jboss.org/maven2</url>
+ </pluginRepository>
+ <pluginRepository>
+ <snapshots />
+ <id>snapshots.jboss.org</id>
+ <url>http://snapshots.jboss.org/maven2</url>
+ </pluginRepository>
+ <pluginRepository>
+ <releases>
+ <updatePolicy>never</updatePolicy>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ <id>central</id>
+ <name>Maven Plugin Repository</name>
+ <url>http://repo1.maven.org/maven2</url>
+ </pluginRepository>
+ </pluginRepositories>
+ <dependencies>
+ <dependency>
+ <groupId>apache-log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.14</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>jboss.profiler.jvmti</groupId>
+ <artifactId>jboss-profiler-jvmti</artifactId>
+ <version>1.0.0.CR5</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.4</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant</artifactId>
+ <version>1.7.0</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant-junit</artifactId>
+ <version>1.7.0</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant-launcher</artifactId>
+ <version>1.7.0</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-common-core</artifactId>
+ <version>2.2.5.GA</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-server-manager</artifactId>
+ <version>0.1.0.GA</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-log4j</artifactId>
+ <version>2.0.5.GA</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-spi</artifactId>
+ <version>2.0.5.GA</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.test</groupId>
+ <artifactId>jboss-test</artifactId>
+ <version>1.1.0.GA</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <reporting>
+ <outputDirectory>target/site</outputDirectory>
+ <plugins>
+ <plugin>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <links>
+ <link>http://java.sun.com/j2se/1.5.0/docs/api</link>
+ </links>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-project-info-reports-plugin</artifactId>
+ <version>2.0.1</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-report-plugin</artifactId>
+ <version>2.3</version>
+ <reportSets>
+ <reportSet>
+ <reports>
+ <report>report-only</report>
+ </reports>
+ </reportSet>
+ </reportSets>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>taglist-maven-plugin</artifactId>
+ <version>2.0</version>
+ </plugin>
+ </plugins>
+ </reporting>
+ <distributionManagement>
+ <repository>
+ <id>repository.jboss.org</id>
+ <url>file:///projects/repository/maven2</url>
+ </repository>
+ <snapshotRepository>
+ <id>snapshots.jboss.org</id>
+ <name>JBoss Snapshot Repository</name>
+ <url>dav:https://snapshots.jboss.org/maven2</url>
+ </snapshotRepository>
+ </distributionManagement>
+ <properties>
+ <maven.repository.root>/projects/repository/maven2</maven.repository.root>
+ <version.junit>4.4</version.junit>
+ <jboss.repository.root>/projects/repository/jboss</jboss.repository.root>
+ <version.jboss.logging>2.0.5.GA</version.jboss.logging>
+ <version.jboss.test>1.1.0.GA</version.jboss.test>
+ <version.jboss.common.core>2.2.5.GA</version.jboss.common.core>
+ </properties>
+</project>
\ No newline at end of file
Deleted: projects/vfs/tags/2.0.0.Beta15/src/main/java/org/jboss/virtual/plugins/context/zip/ZipStreamWrapper.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/ZipStreamWrapper.java 2008-06-08 11:44:00 UTC (rev 74283)
+++ projects/vfs/tags/2.0.0.Beta15/src/main/java/org/jboss/virtual/plugins/context/zip/ZipStreamWrapper.java 2008-06-08 13:22:34 UTC (rev 74288)
@@ -1,163 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.virtual.plugins.context.zip;
-
-import java.io.*;
-import java.util.Enumeration;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-
-/**
- * ZipStreamWrapper - for abstracted access to in-memory zip file
- *
- * @author <a href="strukelj at parsek.net">Marko Strukelj</a>
- * @version $Revision: 1.0 $
- */
-class ZipStreamWrapper extends ZipWrapper
-{
- /** Raw zip archive loaded in memory */
- private byte [] zipBytes;
-
- /** Name */
- private String name;
-
- /**
- * ZipStreamWrapper is not aware of actual zip source so it can not detect
- * if it's been modified, like ZipFileWrapper does.
- *
- * @param zipStream
- * @param lastModified passed by zip stream provider - constant value
- * @throws IOException
- */
- ZipStreamWrapper(InputStream zipStream, String name, long lastModified) throws IOException
- {
- // read the contents into memory buffer
- ByteArrayOutputStream bout = new ByteArrayOutputStream();
- ZipEntryContext.copyStreamAndClose(zipStream, bout);
- zipBytes = bout.toByteArray();
-
- // TODO - delegate file meta info operations to parent?
- this.name = name;
- this.lastModified = lastModified;
- }
-
- boolean exists()
- {
- return true;
- }
-
- long getLastModified()
- {
- return lastModified;
- }
-
- String getName()
- {
- return name;
- }
-
- long getSize()
- {
- return zipBytes.length;
- }
-
- InputStream openStream(ZipEntry ent) throws IOException
- {
- ZipInputStream zis = new ZipInputStream(new ByteArrayInputStream(zipBytes));
-
- // first find the entry
- ZipEntry entry = zis.getNextEntry();
- while(entry != null)
- {
- if(entry.getName().equals(ent.getName()))
- break;
- entry = zis.getNextEntry();
- }
- if(entry == null)
- throw new IOException("Failed to find nested jar entry: " + ent.getName() + " in zip stream: " + this.name);
-
-
- // then read it
- return new SizeLimitedInputStream(zis, (int) ent.getSize());
- }
-
- InputStream getRootAsStream() throws FileNotFoundException
- {
- return new ByteArrayInputStream(zipBytes);
- }
-
- void acquire() throws IOException
- {
- }
-
- Enumeration<? extends ZipEntry> entries() throws IOException
- {
- return new ZipStreamEnumeration(new ZipInputStream(new ByteArrayInputStream(zipBytes)));
- }
-
-
- void close()
- {
- zipBytes = null;
- }
-
- public String toString()
- {
- return super.toString() + " - " + name;
- }
-
-
-
- class ZipStreamEnumeration implements Enumeration
- {
- private ZipInputStream zis;
-
- private ZipEntry entry;
-
- ZipStreamEnumeration(ZipInputStream zis) throws IOException
- {
- this.zis = zis;
- entry = zis.getNextEntry();
- }
-
- public boolean hasMoreElements()
- {
- return entry != null;
- }
-
- public Object nextElement()
- {
- Object ret = entry;
- try
- {
- entry = zis.getNextEntry();
- }
- catch (IOException ex)
- {
- throw new RuntimeException("Failed to retrieve next entry from zip stream", ex);
- }
-
- return ret;
- }
- }
-
-}
Copied: projects/vfs/tags/2.0.0.Beta15/src/main/java/org/jboss/virtual/plugins/context/zip/ZipStreamWrapper.java (from rev 74285, projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/ZipStreamWrapper.java)
===================================================================
--- projects/vfs/tags/2.0.0.Beta15/src/main/java/org/jboss/virtual/plugins/context/zip/ZipStreamWrapper.java (rev 0)
+++ projects/vfs/tags/2.0.0.Beta15/src/main/java/org/jboss/virtual/plugins/context/zip/ZipStreamWrapper.java 2008-06-08 13:22:34 UTC (rev 74288)
@@ -0,0 +1,162 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.virtual.plugins.context.zip;
+
+import java.io.*;
+import java.util.Enumeration;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+
+/**
+ * ZipStreamWrapper - for abstracted access to in-memory zip file
+ *
+ * @author <a href="strukelj at parsek.net">Marko Strukelj</a>
+ * @version $Revision: 1.0 $
+ */
+class ZipStreamWrapper extends ZipWrapper
+{
+ /** Raw zip archive loaded in memory */
+ private byte [] zipBytes;
+
+ /** Name */
+ private String name;
+
+ /**
+ * ZipStreamWrapper is not aware of actual zip source so it can not detect
+ * if it's been modified, like ZipFileWrapper does.
+ *
+ * @param zipStream
+ * @param lastModified passed by zip stream provider - constant value
+ * @throws IOException
+ */
+ ZipStreamWrapper(InputStream zipStream, String name, long lastModified) throws IOException
+ {
+ // read the contents into memory buffer
+ ByteArrayOutputStream bout = new ByteArrayOutputStream();
+ ZipEntryContext.copyStreamAndClose(zipStream, bout);
+ zipBytes = bout.toByteArray();
+
+ // TODO - delegate file meta info operations to parent?
+ this.name = name;
+ this.lastModified = lastModified;
+ }
+
+ boolean exists()
+ {
+ return true;
+ }
+
+ long getLastModified()
+ {
+ return lastModified;
+ }
+
+ String getName()
+ {
+ return name;
+ }
+
+ long getSize()
+ {
+ return zipBytes.length;
+ }
+
+ InputStream openStream(ZipEntry ent) throws IOException
+ {
+ ZipInputStream zis = new ZipInputStream(new ByteArrayInputStream(zipBytes));
+
+ // first find the entry
+ ZipEntry entry = zis.getNextEntry();
+ while(entry != null)
+ {
+ if(entry.getName().equals(ent.getName()))
+ break;
+ entry = zis.getNextEntry();
+ }
+ if(entry == null)
+ throw new IOException("Failed to find nested jar entry: " + ent.getName() + " in zip stream: " + this.name);
+
+
+ // then read it
+ return new SizeLimitedInputStream(zis, (int) ent.getSize());
+ }
+
+ InputStream getRootAsStream() throws FileNotFoundException
+ {
+ return new ByteArrayInputStream(zipBytes);
+ }
+
+ void acquire() throws IOException
+ {
+ }
+
+ Enumeration<? extends ZipEntry> entries() throws IOException
+ {
+ return new ZipStreamEnumeration(new ZipInputStream(new ByteArrayInputStream(zipBytes)));
+ }
+
+ void close()
+ {
+ zipBytes = null;
+ }
+
+ public String toString()
+ {
+ return super.toString() + " - " + name;
+ }
+
+ /**
+ * Zip stream enumeration.
+ */
+ class ZipStreamEnumeration implements Enumeration<ZipEntry>
+ {
+ private ZipInputStream zis;
+
+ private ZipEntry entry;
+
+ ZipStreamEnumeration(ZipInputStream zis) throws IOException
+ {
+ this.zis = zis;
+ entry = zis.getNextEntry();
+ }
+
+ public boolean hasMoreElements()
+ {
+ return entry != null;
+ }
+
+ public ZipEntry nextElement()
+ {
+ ZipEntry ret = entry;
+ try
+ {
+ entry = zis.getNextEntry();
+ }
+ catch (IOException ex)
+ {
+ throw new RuntimeException("Failed to retrieve next entry from zip stream", ex);
+ }
+
+ return ret;
+ }
+ }
+}
Deleted: projects/vfs/tags/2.0.0.Beta15/src/test/java/org/jboss/test/virtual/test/JARVFSContextUnitTestCase.java
===================================================================
--- projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/JARVFSContextUnitTestCase.java 2008-06-08 11:44:00 UTC (rev 74283)
+++ projects/vfs/tags/2.0.0.Beta15/src/test/java/org/jboss/test/virtual/test/JARVFSContextUnitTestCase.java 2008-06-08 13:22:34 UTC (rev 74288)
@@ -1,115 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.test.virtual.test;
-
-import java.net.URL;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.plugins.context.file.FileSystemContext;
-import org.jboss.virtual.plugins.context.jar.JarContext;
-import org.jboss.virtual.plugins.context.jar.JarUtils;
-import org.jboss.virtual.spi.VFSContext;
-
-/**
- * JARVFSContextUnitTestCase.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public class JARVFSContextUnitTestCase extends AbstractVFSContextTest
-{
- public JARVFSContextUnitTestCase(String name)
- {
- super(name);
- }
-
- public static Test suite()
- {
- VFS.init();
- System.out.println("java.protocol.handler.pkgs: " + System.getProperty("java.protocol.handler.pkgs"));
- return new TestSuite(JARVFSContextUnitTestCase.class);
- }
-
- protected VFSContext getVFSContext(String name) throws Exception
- {
- URL url = getResource("/vfs/context/jar/" + name + ".jar");
- url = JarUtils.createJarURL(url);
- return new JarContext(url);
- }
-
- protected VFSContext getParentVFSContext() throws Exception
- {
- URL url = getResource("/vfs/context/jar/");
- return new FileSystemContext(url);
- }
-
- protected String getSuffix()
- {
- return ".jar";
- }
-
- /**
- * Was having problems with a jar entry as root of VFS.
- *
- * @throws Exception
- */
- public void testJarEntryAsRoot() throws Exception
- {
- URL url = getResource("/vfs/context/jar/simple.jar");
- URL entry = new URL("jar:" + url.toString() + "!/child");
- //entry.openStream().close();
- JarContext context = new JarContext(entry);
- assertEquals("child", context.getRoot().getName());
-
- url = getResource("/vfs/test/outer.jar");
- entry = new URL("jar:" + url.toString() + "!/jar2.jar ");
- //entry.openStream().close();
- context = new JarContext(entry);
- assertEquals("jar2.jar", context.getRoot().getName());
- }
-
- /**
- * Was having problems with a jar entry as root of VFS.
- * A JarEntry that is the root of the VFS should have a VFS Path of ""
- *
- * @throws Exception
- */
- public void testPathIsEmptryForJarEntryAsRoot() throws Exception
- {
- URL url = getResource("/vfs/context/jar/simple.jar");
- URL entry = new URL("jar:" + url.toString() + "!/child");
- //entry.openStream().close();
- JarContext context = new JarContext(entry);
- assertEquals("child", context.getRoot().getName());
- assertEquals("", context.getRoot().getPathName());
-
- url = getResource("/vfs/test/outer.jar");
- entry = new URL("jar:" + url.toString() + "!/jar2.jar ");
- //entry.openStream().close();
- context = new JarContext(entry);
- assertEquals("jar2.jar", context.getRoot().getName());
- assertEquals("", context.getRoot().getPathName());
- }
-
-}
Copied: projects/vfs/tags/2.0.0.Beta15/src/test/java/org/jboss/test/virtual/test/JARVFSContextUnitTestCase.java (from rev 74286, projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/JARVFSContextUnitTestCase.java)
===================================================================
--- projects/vfs/tags/2.0.0.Beta15/src/test/java/org/jboss/test/virtual/test/JARVFSContextUnitTestCase.java (rev 0)
+++ projects/vfs/tags/2.0.0.Beta15/src/test/java/org/jboss/test/virtual/test/JARVFSContextUnitTestCase.java 2008-06-08 13:22:34 UTC (rev 74288)
@@ -0,0 +1,156 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.virtual.test;
+
+import java.io.InputStream;
+import java.net.URL;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.plugins.context.file.FileSystemContext;
+import org.jboss.virtual.plugins.context.jar.JarContext;
+import org.jboss.virtual.plugins.context.jar.JarUtils;
+import org.jboss.virtual.spi.VFSContext;
+import org.jboss.virtual.spi.VirtualFileHandler;
+
+/**
+ * JARVFSContextUnitTestCase.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class JARVFSContextUnitTestCase extends AbstractVFSContextTest
+{
+ public JARVFSContextUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ VFS.init();
+ System.out.println("java.protocol.handler.pkgs: " + System.getProperty("java.protocol.handler.pkgs"));
+ return new TestSuite(JARVFSContextUnitTestCase.class);
+ }
+
+ protected VFSContext getVFSContext(String name) throws Exception
+ {
+ URL url = getResource("/vfs/context/jar/" + name + ".jar");
+ url = JarUtils.createJarURL(url);
+ return new JarContext(url);
+ }
+
+ protected VFSContext getParentVFSContext() throws Exception
+ {
+ URL url = getResource("/vfs/context/jar/");
+ return new FileSystemContext(url);
+ }
+
+ protected VFSContext createVSFContext(URL url) throws Exception
+ {
+ if (url.toExternalForm().startsWith("jar") == false)
+ url = JarUtils.createJarURL(url);
+ return new JarContext(url);
+ }
+
+ protected String getSuffix()
+ {
+ return ".jar";
+ }
+
+ /**
+ * Was having problems with a jar entry as root of VFS.
+ *
+ * @throws Exception
+ */
+ public void testJarEntryAsRoot() throws Exception
+ {
+ URL url = getResource("/vfs/context/jar/simple.jar");
+ URL entry = new URL("jar:" + url.toString() + "!/child");
+ //entry.openStream().close();
+ VFSContext context = createVSFContext(entry);
+ assertEquals("child", context.getRoot().getName());
+
+ url = getResource("/vfs/test/outer.jar");
+ entry = new URL("jar:" + url.toString() + "!/jar2.jar ");
+ //entry.openStream().close();
+ context = createVSFContext(entry);
+ assertEquals("jar2.jar", context.getRoot().getName());
+ }
+
+ /**
+ * Was having problems with a jar entry as root of VFS.
+ * A JarEntry that is the root of the VFS should have a VFS Path of ""
+ *
+ * @throws Exception
+ */
+ public void testPathIsEmptryForJarEntryAsRoot() throws Exception
+ {
+ URL url = getResource("/vfs/context/jar/simple.jar");
+ URL entry = new URL("jar:" + url.toString() + "!/child");
+ //entry.openStream().close();
+ VFSContext context = createVSFContext(entry);
+ assertEquals("child", context.getRoot().getName());
+ assertEquals("", context.getRoot().getPathName());
+
+ url = getResource("/vfs/test/outer.jar");
+ entry = new URL("jar:" + url.toString() + "!/jar2.jar ");
+ //entry.openStream().close();
+ context = createVSFContext(entry);
+ assertEquals("jar2.jar", context.getRoot().getName());
+ assertEquals("", context.getRoot().getPathName());
+ }
+
+
+ /**
+ * Handler representing a directory must return a zero length stream
+ *
+ * @throws Exception for any error
+ */
+ public void testDirectoryZipEntryOpenStream() throws Exception
+ {
+ URL url = getResource("/vfs/context/jar/complex.jar");
+ VFSContext ctx = createVSFContext(url);
+
+ VirtualFileHandler sub = ctx.getRoot().getChild("subfolder");
+ InputStream is = sub.openStream();
+ assertTrue("input stream closed", is.read() == -1);
+ }
+
+ /**
+ * There was a problem with noCopy inner jars returning empty streams
+ *
+ * @throws Exception for any error
+ */
+ public void testInnerJarFileEntryOpenStream() throws Exception
+ {
+ URL url = getResource("/vfs/context/jar/nested.jar");
+ VFSContext ctx = createVSFContext(url);
+
+ VirtualFileHandler nested = ctx.getRoot().getChild("complex.jar");
+ VirtualFileHandler target = nested.getChild("META-INF/MANIFEST.MF");
+
+ InputStream is = target.openStream();
+ assertFalse("input stream closed", is.read() == -1);
+ }
+}
Deleted: projects/vfs/tags/2.0.0.Beta15/src/test/java/org/jboss/test/virtual/test/ZipEntryVFSContextUnitTestCase.java
===================================================================
--- projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/ZipEntryVFSContextUnitTestCase.java 2008-06-08 11:44:00 UTC (rev 74283)
+++ projects/vfs/tags/2.0.0.Beta15/src/test/java/org/jboss/test/virtual/test/ZipEntryVFSContextUnitTestCase.java 2008-06-08 13:22:34 UTC (rev 74288)
@@ -1,193 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.test.virtual.test;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.URL;
-
-import junit.framework.Test;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.plugins.context.file.FileSystemContext;
-import org.jboss.virtual.plugins.context.jar.JarUtils;
-import org.jboss.virtual.plugins.context.zip.ZipEntryContext;
-import org.jboss.virtual.spi.VFSContext;
-import org.jboss.virtual.spi.VirtualFileHandler;
-
-/**
- * ZipEntryVFSContextUnitTestCase.
- *
- * @author <a href="strukelj at parsek.net">Marko Strukelj</a>
- * @version $Revision: 1.0 $
- */
-public class ZipEntryVFSContextUnitTestCase extends JARVFSContextUnitTestCase
-{
- public ZipEntryVFSContextUnitTestCase(String name)
- {
- super(name);
- }
-
- public static Test suite()
- {
- VFS.init();
- System.out.println("java.protocol.handler.pkgs: " + System.getProperty("java.protocol.handler.pkgs"));
- return suite(ZipEntryVFSContextUnitTestCase.class);
- }
-
- protected VFSContext getVFSContext(String name) throws Exception
- {
- URL url = getResource("/vfs/context/jar/" + name + ".jar");
- url = JarUtils.createJarURL(url);
- return new ZipEntryContext(url);
- }
-
- /**
- * Analog to the same test in {@link JARVFSContextUnitTestCase}
- *
- * @throws Exception
- */
- public void testJarEntryAsRoot() throws Exception
- {
- URL url = getResource("/vfs/context/jar/simple.jar");
- URL entry = new URL("jar:" + url.toString() + "!/child");
- //entry.openStream().close();
- ZipEntryContext context = new ZipEntryContext(entry);
- assertEquals("child", context.getRoot().getName());
-
- url = getResource("/vfs/test/outer.jar");
- entry = new URL("jar:" + url.toString() + "!/jar2.jar ");
- //entry.openStream().close();
- context = new ZipEntryContext(entry);
- assertEquals("jar2.jar", context.getRoot().getName());
- }
-
- /**
- * Analog to the same test in {@link JARVFSContextUnitTestCase}
- *
- * @throws Exception for any error
- */
- public void testPathIsEmptryForJarEntryAsRoot() throws Exception
- {
- URL url = getResource("/vfs/context/jar/simple.jar");
- URL entry = new URL("jar:" + url.toString() + "!/child");
- //entry.openStream().close();
- ZipEntryContext context = new ZipEntryContext(entry);
- assertEquals("child", context.getRoot().getName());
- assertEquals("", context.getRoot().getPathName());
-
- url = getResource("/vfs/test/outer.jar");
- entry = new URL("jar:" + url.toString() + "!/jar2.jar ");
- //entry.openStream().close();
- context = new ZipEntryContext(entry);
- assertEquals("jar2.jar", context.getRoot().getName());
- assertEquals("", context.getRoot().getPathName());
- }
-
- /**
- * Test detection of underlying jar file removal through exists()
- *
- * @throws Exception for any error
- */
- public void testRootExists() throws Exception
- {
- URL url = getResource("/vfs/test/outer.jar");
- File tmpJar = File.createTempFile("vfstest", ".jar");
-
- InputStream is = url.openStream();
- OutputStream os = new FileOutputStream(tmpJar);
-
- byte [] buff = new byte[65536];
- int count = is.read(buff);
- while(count != -1)
- {
- os.write(buff, 0, count);
- count = is.read(buff);
- }
- os.close();
-
- // use noReaper so that the underlying file is not locked
- // when we try to delete it
- String jarUrl = tmpJar.toURL().toString() + "?noReaper=true";
- ZipEntryContext context = new ZipEntryContext(new URL(jarUrl));
- assertTrue("context.getRoot().exists()", context.getRoot().exists());
-
- boolean isDeleted = tmpJar.delete();
- assertTrue("delete tmp file: " + tmpJar, isDeleted);
-
- assertFalse("context.getRoot().exists()", context.getRoot().exists());
- }
-
- /**
- * Test for proper handling when file appears to be an archive but
- * trying to handle it produces an exception. Proper behaviour
- * is to ignore exception and treat the file as non-archive.
- *
- * @throws Exception for any error
- */
- public void testNotAnArchive() throws Exception
- {
- URL url = getResource("/vfs/context/jar/");
- FileSystemContext ctx = new FileSystemContext(url);
-
- // check that vfszip is active
- VirtualFileHandler handler = ctx.getRoot().getChild("archive.jar");
- assertTrue("is vfszip", "vfszip".equals(handler.toURL().getProtocol()));
- assertFalse("is leaf", handler.isLeaf());
-
- handler = ctx.getRoot().getChild("notanarchive.jar");
- assertTrue("is leaf", handler.isLeaf());
- }
-
- /**
- * Handler representing a directory must return a zero length stream
- *
- * @throws Exception for any error
- */
- public void testDirectoryZipEntryOpenStream() throws Exception
- {
- URL url = getResource("/vfs/context/jar/complex.jar");
- ZipEntryContext ctx = new ZipEntryContext(url);
-
- VirtualFileHandler sub = ctx.getRoot().getChild("subfolder");
- InputStream is = sub.openStream();
- assertTrue("input stream closed", is.read() == -1);
- }
-
- /**
- * There was a problem with noCopy inner jars returning empty streams
- *
- * @throws Exception for any error
- */
- public void testInnerJarFileEntryOpenStream() throws Exception
- {
- URL url = getResource("/vfs/context/jar/nested.jar");
- ZipEntryContext ctx = new ZipEntryContext(url);
-
- VirtualFileHandler nested = ctx.getRoot().getChild("complex.jar");
- VirtualFileHandler target = nested.getChild("META-INF/MANIFEST.MF");
-
- InputStream is = target.openStream();
- assertFalse("input stream closed", is.read() == -1);
- }
-}
\ No newline at end of file
Copied: projects/vfs/tags/2.0.0.Beta15/src/test/java/org/jboss/test/virtual/test/ZipEntryVFSContextUnitTestCase.java (from rev 74286, projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/ZipEntryVFSContextUnitTestCase.java)
===================================================================
--- projects/vfs/tags/2.0.0.Beta15/src/test/java/org/jboss/test/virtual/test/ZipEntryVFSContextUnitTestCase.java (rev 0)
+++ projects/vfs/tags/2.0.0.Beta15/src/test/java/org/jboss/test/virtual/test/ZipEntryVFSContextUnitTestCase.java 2008-06-08 13:22:34 UTC (rev 74288)
@@ -0,0 +1,124 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.virtual.test;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+
+import junit.framework.Test;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.plugins.context.file.FileSystemContext;
+import org.jboss.virtual.plugins.context.jar.JarUtils;
+import org.jboss.virtual.plugins.context.zip.ZipEntryContext;
+import org.jboss.virtual.spi.VFSContext;
+import org.jboss.virtual.spi.VirtualFileHandler;
+
+/**
+ * ZipEntryVFSContextUnitTestCase.
+ *
+ * @author <a href="strukelj at parsek.net">Marko Strukelj</a>
+ * @version $Revision: 1.0 $
+ */
+public class ZipEntryVFSContextUnitTestCase extends JARVFSContextUnitTestCase
+{
+ public ZipEntryVFSContextUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ VFS.init();
+ System.out.println("java.protocol.handler.pkgs: " + System.getProperty("java.protocol.handler.pkgs"));
+ return suite(ZipEntryVFSContextUnitTestCase.class);
+ }
+
+ protected VFSContext getVFSContext(String name) throws Exception
+ {
+ URL url = getResource("/vfs/context/jar/" + name + ".jar");
+ url = JarUtils.createJarURL(url);
+ return new ZipEntryContext(url);
+ }
+
+ protected VFSContext createVSFContext(URL url) throws Exception
+ {
+ return new ZipEntryContext(url);
+ }
+
+ /**
+ * Test detection of underlying jar file removal through exists()
+ *
+ * @throws Exception for any error
+ */
+ public void testRootExists() throws Exception
+ {
+ URL url = getResource("/vfs/test/outer.jar");
+ File tmpJar = File.createTempFile("vfstest", ".jar");
+
+ InputStream is = url.openStream();
+ OutputStream os = new FileOutputStream(tmpJar);
+
+ byte [] buff = new byte[65536];
+ int count = is.read(buff);
+ while(count != -1)
+ {
+ os.write(buff, 0, count);
+ count = is.read(buff);
+ }
+ os.close();
+
+ // use noReaper so that the underlying file is not locked
+ // when we try to delete it
+ String jarUrl = tmpJar.toURL().toString() + "?noReaper=true";
+ ZipEntryContext context = new ZipEntryContext(new URL(jarUrl));
+ assertTrue("context.getRoot().exists()", context.getRoot().exists());
+
+ boolean isDeleted = tmpJar.delete();
+ assertTrue("delete tmp file: " + tmpJar, isDeleted);
+
+ assertFalse("context.getRoot().exists()", context.getRoot().exists());
+ }
+
+ /**
+ * Test for proper handling when file appears to be an archive but
+ * trying to handle it produces an exception. Proper behaviour
+ * is to ignore exception and treat the file as non-archive.
+ *
+ * @throws Exception for any error
+ */
+ public void testNotAnArchive() throws Exception
+ {
+ URL url = getResource("/vfs/context/jar/");
+ FileSystemContext ctx = new FileSystemContext(url);
+
+ // check that vfszip is active
+ VirtualFileHandler handler = ctx.getRoot().getChild("archive.jar");
+ assertTrue("is vfszip", "vfszip".equals(handler.toURL().getProtocol()));
+ assertFalse("is leaf", handler.isLeaf());
+
+ handler = ctx.getRoot().getChild("notanarchive.jar");
+ assertTrue("is leaf", handler.isLeaf());
+ }
+}
\ No newline at end of file
Copied: projects/vfs/tags/2.0.0.Beta15/src/test/resources/vfs/context/jar/nested.jar (from rev 74284, projects/vfs/trunk/src/test/resources/vfs/context/jar/nested.jar)
===================================================================
(Binary files differ)
More information about the jboss-cvs-commits
mailing list