org.apache.aries.unittest.fixture
Class ArchiveFixture.ZipFixture

java.lang.Object
  extended by org.apache.aries.unittest.fixture.ArchiveFixture.AbstractFixture
      extended by org.apache.aries.unittest.fixture.ArchiveFixture.ZipFixture
All Implemented Interfaces:
ArchiveFixture.Fixture
Direct Known Subclasses:
ArchiveFixture.JarFixture
Enclosing class:
ArchiveFixture

public static class ArchiveFixture.ZipFixture
extends ArchiveFixture.AbstractFixture

Base fixture for any kind of zip archive. Zip archives can contain any number of child archives given by an archive type and a path. The order in which these child archives are added is important because it will be the order in which they are added to the zip.


Nested Class Summary
protected static class ArchiveFixture.ZipFixture.ChildFixture
           
 
Field Summary
protected  byte[] bytes
           
protected  List<ArchiveFixture.ZipFixture.ChildFixture> children
           
 
Constructor Summary
protected ArchiveFixture.ZipFixture(ArchiveFixture.ZipFixture parent)
           
 
Method Summary
 ArchiveFixture.ZipFixture binary(String path, InputStream input)
          Create a binary file with the content from the input stream
 ArchiveFixture.ZipFixture binary(String path, String resourcePath)
          Create a binary file that is populated from content on the classloader
 ArchiveFixture.FileFixture file(String path)
          Create an empty file fixture at the given path.
 ArchiveFixture.ZipFixture file(String path, String content)
          Create a complete child file fixture at the given path and with the content.
 ArchiveFixture.ZipFixture jar(String path)
          Create a child jar fixture at the given path.
 ArchiveFixture.ManifestFixture manifest()
          Create a manifest fixture at the given path.
protected  void writeAllEntries(ZipOutputStream zout)
          Add all entries to the ZipOutputStream
 void writeOut(OutputStream out)
          Write the physical representation of the fixture to the given OutputStream
 ArchiveFixture.ZipFixture zip(String path)
          Create a child zip fixture at the given target.
 
Methods inherited from class org.apache.aries.unittest.fixture.ArchiveFixture.AbstractFixture
end
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

children

protected List<ArchiveFixture.ZipFixture.ChildFixture> children

bytes

protected byte[] bytes
Constructor Detail

ArchiveFixture.ZipFixture

protected ArchiveFixture.ZipFixture(ArchiveFixture.ZipFixture parent)
Method Detail

zip

public ArchiveFixture.ZipFixture zip(String path)
Create a child zip fixture at the given target.

Parameters:
path -
Returns:

jar

public ArchiveFixture.ZipFixture jar(String path)
Create a child jar fixture at the given path.

Parameters:
path -
Returns:

file

public ArchiveFixture.ZipFixture file(String path,
                                      String content)
Create a complete child file fixture at the given path and with the content. Note: this will return the current zip fixture and not the file fixture.

Parameters:
path -
content -
Returns:

file

public ArchiveFixture.FileFixture file(String path)
Create an empty file fixture at the given path.

Parameters:
path -
Returns:

binary

public ArchiveFixture.ZipFixture binary(String path,
                                        InputStream input)
                                 throws IOException
Create a binary file with the content from the input stream

Parameters:
path -
input -
Returns:
Throws:
IOException

binary

public ArchiveFixture.ZipFixture binary(String path,
                                        String resourcePath)
                                 throws IOException
Create a binary file that is populated from content on the classloader

Parameters:
path -
resourcePath - Path that the resource can be found in the current classloader
Returns:
Throws:
IOException

manifest

public ArchiveFixture.ManifestFixture manifest()
Create a manifest fixture at the given path.

Returns:

writeAllEntries

protected void writeAllEntries(ZipOutputStream zout)
                        throws IOException
Add all entries to the ZipOutputStream

Parameters:
zout -
Throws:
IOException

writeOut

public void writeOut(OutputStream out)
              throws IOException
Description copied from interface: ArchiveFixture.Fixture
Write the physical representation of the fixture to the given OutputStream

Throws:
IOException


Copyright © 2009-2011 The Apache Software Foundation. All Rights Reserved.