From: <mk...@us...> - 2007-08-27 16:03:02
|
Revision: 18 http://components4oaw.svn.sourceforge.net/components4oaw/?rev=18&view=rev Author: mklink Date: 2007-08-25 11:17:01 -0700 (Sat, 25 Aug 2007) Log Message: ----------- Moved package and added test Modified Paths: -------------- trunk/jar/pom.xml trunk/jar/src/main/java/net/components4oaw/jar/JarCompress.java trunk/jar/src/main/java/net/components4oaw/jar/JarExtract.java trunk/jar/src/test/java/net/components4oaw/jar/JarExtractTest.java Added Paths: ----------- trunk/jar/pom.xml.releaseBackup trunk/jar/src/test/resources/output/ trunk/jar/src/test/resources/output/META-INF/ trunk/jar/src/test/resources/output/META-INF/MANIFEST.MF Modified: trunk/jar/pom.xml =================================================================== --- trunk/jar/pom.xml 2007-08-25 18:16:38 UTC (rev 17) +++ trunk/jar/pom.xml 2007-08-25 18:17:01 UTC (rev 18) @@ -29,6 +29,7 @@ <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.1</version> + <scope>test</scope> </dependency> </dependencies> Added: trunk/jar/pom.xml.releaseBackup =================================================================== --- trunk/jar/pom.xml.releaseBackup (rev 0) +++ trunk/jar/pom.xml.releaseBackup 2007-08-25 18:17:01 UTC (rev 18) @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="UTF-8"?> +<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> + <artifactId>components4oaw-parent</artifactId> + <groupId>net.components4oaw</groupId> + <version>1.0.0</version> + <relativePath>../components4oaw-parent</relativePath> + </parent> + <modelVersion>4.0.0</modelVersion> + <groupId>net.components4oaw</groupId> + <artifactId>jar</artifactId> + <name>jar</name> + + <url>/${artifactId}</url> + + <version>1.0.1-SNAPSHOT</version> + <description> + Extract and compress jar files with this component + </description> + + + <dependencies> + <dependency> + <groupId>org.fornax.openarchitectureware</groupId> + <artifactId>oaw-core</artifactId> + <version>4.1.2</version> + <type>pom</type> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.1</version> + </dependency> + </dependencies> + + <reporting> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + <configuration> + <sourcepath>${compileSourceRoots}</sourcepath> + <aggregate>true</aggregate> + <windowtitle> + components4oaw: + ${project.groupId}:${project.artifactId}:${project.version} + </windowtitle> + </configuration> + </plugin> + </plugins> + </reporting> +</project> + Modified: trunk/jar/src/main/java/net/components4oaw/jar/JarCompress.java =================================================================== --- trunk/jar/src/main/java/net/components4oaw/jar/JarCompress.java 2007-08-25 18:16:38 UTC (rev 17) +++ trunk/jar/src/main/java/net/components4oaw/jar/JarCompress.java 2007-08-25 18:17:01 UTC (rev 18) @@ -16,7 +16,11 @@ import org.openarchitectureware.workflow.issues.Issues; import org.openarchitectureware.workflow.lib.AbstractWorkflowComponent; import org.openarchitectureware.workflow.monitor.ProgressMonitor; - +/** + * Compress the contents of a specified directory into a jar file. + * @author MarkusK + * + */ public class JarCompress extends AbstractWorkflowComponent { private String inputDir; @@ -27,6 +31,14 @@ } + public String getInputDir() { + return inputDir; + } + + public String getOutputFile() { + return outputFile; + } + public void invoke(WorkflowContext arg0, ProgressMonitor arg1, Issues arg2) { System.out.println("Invoking JarCompress Component."); URI inputDirURI = new File(inputDir).toURI(); @@ -87,18 +99,10 @@ return result; } - public String getInputDir() { - return inputDir; - } - public void setInputDir(String inputDir) { this.inputDir = inputDir; } - public String getOutputFile() { - return outputFile; - } - public void setOutputFile(String outputFile) { this.outputFile = outputFile; } Modified: trunk/jar/src/main/java/net/components4oaw/jar/JarExtract.java =================================================================== --- trunk/jar/src/main/java/net/components4oaw/jar/JarExtract.java 2007-08-25 18:16:38 UTC (rev 17) +++ trunk/jar/src/main/java/net/components4oaw/jar/JarExtract.java 2007-08-25 18:17:01 UTC (rev 18) @@ -5,7 +5,6 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; -import java.net.URISyntaxException; import java.util.Enumeration; import java.util.jar.JarEntry; import java.util.jar.JarFile; @@ -16,7 +15,11 @@ import org.openarchitectureware.workflow.lib.AbstractWorkflowComponent; import org.openarchitectureware.workflow.monitor.ProgressMonitor; -public class JarExtract extends AbstractWorkflowComponent { +/** + * Extract the contents of a jar file to a specified directory. + * @author MarkusK + * + */public class JarExtract extends AbstractWorkflowComponent{ private String inputFile; private String outputDir; @@ -26,19 +29,6 @@ } - public void invoke(WorkflowContext arg0, ProgressMonitor arg1, Issues arg2) { - System.out.println("Invoking JarExtract Component."); - System.out.println("OutputDir = " + getOutputDir()); - System.out.println("InputFile = " + getInputFile()); - - try { - extract(); - } catch (IOException ex) { - ex.printStackTrace(System.err); - } - - } - public void extract() throws IOException, ZipException { JarFile jar = new JarFile(getInputFile()); for (Enumeration<JarEntry> entries = jar.entries(); entries @@ -67,14 +57,27 @@ return inputFile; } + public String getOutputDir() { + return outputDir; + } + + public void invoke(WorkflowContext arg0, ProgressMonitor arg1, Issues arg2) { + System.out.println("Invoking JarExtract Component."); + System.out.println("OutputDir = " + getOutputDir()); + System.out.println("InputFile = " + getInputFile()); + + try { + extract(); + } catch (IOException ex) { + ex.printStackTrace(System.err); + } + + } + public void setInputFile(String inputFile) { this.inputFile = inputFile; } - public String getOutputDir() { - return outputDir; - } - public void setOutputDir(String outputDir) { this.outputDir = outputDir; } Modified: trunk/jar/src/test/java/net/components4oaw/jar/JarExtractTest.java =================================================================== --- trunk/jar/src/test/java/net/components4oaw/jar/JarExtractTest.java 2007-08-25 18:16:38 UTC (rev 17) +++ trunk/jar/src/test/java/net/components4oaw/jar/JarExtractTest.java 2007-08-25 18:17:01 UTC (rev 18) @@ -37,25 +37,25 @@ } /** - * Test that a NullpointerException is thrown when no input file is - * delivered. + * Test that the extract method delivers a ZipException when the input file + * does not exist at all. * * @throws IOException */ - @Test(expected = NullPointerException.class) - public void testExtractNoParam() throws IOException, URISyntaxException { + @Test(expected = ZipException.class) + public void testExtractInvalidFile() throws IOException { + extract.setInputFile("testjar/Invalid.jar"); extract.extract(); } /** - * Test that the extract method delivers a ZipException when the input file - * does not exist at all. + * Test that a NullpointerException is thrown when no input file is + * delivered. * * @throws IOException */ - @Test(expected = ZipException.class) - public void testExtractInvalidFile() throws IOException { - extract.setInputFile("testjar/Invalid.jar"); + @Test(expected = NullPointerException.class) + public void testExtractNoParam() throws IOException, URISyntaxException { extract.extract(); } Added: trunk/jar/src/test/resources/output/META-INF/MANIFEST.MF =================================================================== --- trunk/jar/src/test/resources/output/META-INF/MANIFEST.MF (rev 0) +++ trunk/jar/src/test/resources/output/META-INF/MANIFEST.MF 2007-08-25 18:17:01 UTC (rev 18) @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Created-By: 1.5.0_12 (Sun Microsystems Inc.) + Property changes on: trunk/jar/src/test/resources/output/META-INF/MANIFEST.MF ___________________________________________________________________ Name: svn:mime-type + text/plain This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |