Author: ltheussl
Date: Tue Apr 11 23:10:38 2006
New Revision: 393396

URL: http://svn.apache.org/viewcvs?rev=393396&view=rev
Log:
PR: MPJAR-19
Add tests for jar manifest creation.

Added:
    maven/maven-1/plugins/trunk/jar/src/main/
    maven/maven-1/plugins/trunk/jar/src/main/org/
    maven/maven-1/plugins/trunk/jar/src/main/org/apache/
    maven/maven-1/plugins/trunk/jar/src/main/org/apache/maven/
    maven/maven-1/plugins/trunk/jar/src/main/org/apache/maven/jar/
    maven/maven-1/plugins/trunk/jar/src/main/org/apache/maven/jar/JarUtils.java 
  (with props)
    maven/maven-1/plugins/trunk/jar/src/main/org/apache/maven/jar/package.html  
 (with props)
    maven/maven-1/plugins/trunk/jar/src/plugin-test/test-manifest/
    maven/maven-1/plugins/trunk/jar/src/plugin-test/test-manifest/maven.xml   
(with props)
    
maven/maven-1/plugins/trunk/jar/src/plugin-test/test-manifest/project.properties
   (with props)
    maven/maven-1/plugins/trunk/jar/src/plugin-test/test-manifest/project.xml   
(with props)
    maven/maven-1/plugins/trunk/jar/src/test/
    maven/maven-1/plugins/trunk/jar/src/test/org/
    maven/maven-1/plugins/trunk/jar/src/test/org/apache/
    maven/maven-1/plugins/trunk/jar/src/test/org/apache/maven/
    maven/maven-1/plugins/trunk/jar/src/test/org/apache/maven/jar/
    
maven/maven-1/plugins/trunk/jar/src/test/org/apache/maven/jar/JarUtilsTest.java 
  (with props)
    maven/maven-1/plugins/trunk/jar/src/test/org/apache/maven/jar/package.html  
 (with props)
    maven/maven-1/plugins/trunk/jar/src/test/resources/
    maven/maven-1/plugins/trunk/jar/src/test/resources/MANIFEST.MF
Modified:
    maven/maven-1/plugins/trunk/jar/project.xml
    maven/maven-1/plugins/trunk/jar/xdocs/changes.xml

Modified: maven/maven-1/plugins/trunk/jar/project.xml
URL: 
http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/jar/project.xml?rev=393396&r1=393395&r2=393396&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/jar/project.xml (original)
+++ maven/maven-1/plugins/trunk/jar/project.xml Tue Apr 11 23:10:38 2006
@@ -74,4 +74,13 @@
       <version>1.4</version>
     </dependency>
   </dependencies>
+  <build>
+    <unitTest>
+      <resources>
+        <resource>
+          <directory>src/test/resources</directory>
+        </resource>
+      </resources>
+    </unitTest>
+  </build>
 </project>

Added: 
maven/maven-1/plugins/trunk/jar/src/main/org/apache/maven/jar/JarUtils.java
URL: 
http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/jar/src/main/org/apache/maven/jar/JarUtils.java?rev=393396&view=auto
==============================================================================
--- maven/maven-1/plugins/trunk/jar/src/main/org/apache/maven/jar/JarUtils.java 
(added)
+++ maven/maven-1/plugins/trunk/jar/src/main/org/apache/maven/jar/JarUtils.java 
Tue Apr 11 23:10:38 2006
@@ -0,0 +1,211 @@
+package org.apache.maven.jar;
+
+/* ====================================================================
+ *   Copyright 2006 The Apache Software Foundation.
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ * ====================================================================
+ */
+
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import java.util.Iterator;
+import java.util.Map;
+import java.util.jar.Attributes;
+import java.util.jar.JarFile;
+import java.util.jar.Manifest;
+
+
+/**
+ * Utility class for maven-jar-plugin. Currently only used for
+ * testing the manifest created by Maven's jar:jar goal.
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">Lukas Theussl</a>
+ * @version $Id$
+ */
+public class JarUtils
+{
+
+    /** The manifest. */
+    private Manifest manifest;
+
+    /** The Map of manifest entries. */
+    private Map manifestEntries;
+
+    /** The main Attributes of the manifest. */
+    private Attributes mainAttributes;
+
+    /** The section Attributes of the manifest. */
+    private Attributes sectionAttributes;
+
+
+    /**
+     * Extracts the manifest from the given jar file.
+     * The manifest entries can then be retrieved via
+     * getManifestEntries() and getMainAttributes().
+     *
+     * @param theJarFile The jar file to extract the manifest from.
+     * @throws IOException If there is an error opening the jar file.
+     */
+    public void extractManifestFromJar( File theJarFile ) throws IOException
+    {
+        JarFile jarfile = new JarFile( theJarFile );
+        this.manifest = jarfile.getManifest();
+        extractManifestEntries();
+    }
+
+    /**
+     * Extracts the manifest from a given file.
+     * The manifest entries can then be retrieved via
+     * getManifestEntries() and getMainAttributes().
+     *
+     * @param manifestFile The manifest file.
+     * @throws IOException If there is an error opening the file.
+     */
+    public void extractManifestFromFile( File manifestFile ) throws IOException
+    {
+        InputStream fis = new FileInputStream( manifestFile );
+        this.manifest = new Manifest( fis );
+        extractManifestEntries();
+    }
+
+    /**
+     * Sets the manifest.
+     *
+     * @param mf The new manifest.
+     */
+    public void setManifest( Manifest mf )
+    {
+      this.manifest = mf;
+    }
+
+    /**
+     * Gets the manifest.
+     *
+     * @return The manifest.
+     */
+    public Manifest getManifest()
+    {
+      return manifest;
+    }
+
+    /**
+     * Returns a Map of manifest entries.
+     *
+     * @return Map of manifest entries.
+     */
+    public Map getManifestEntries()
+    {
+        return manifestEntries;
+    }
+
+    /**
+     * Returns the main attributes of the manifest as Attributes.
+     *
+     * @return The main attributes.
+     */
+    public Attributes getMainAttributes()
+    {
+        return mainAttributes;
+    }
+
+    /**
+     * Checks if the current manifest contains a section with the given key.
+     *
+     * @param key The section name.
+     * @return true if the manifest contains a section with the given key.
+     */
+    public boolean containsSection( String key )
+    {
+        return manifestEntries.containsKey( key );
+    }
+
+    /**
+     * Returns the value of the main attribute key.
+     *
+     * @param key The attribute name.
+     * @return The attribute value, null if the attribute is not found.
+     */
+    public String getMainAttribute( String key )
+    {
+        return mainAttributes.getValue( key );
+    }
+
+    /**
+     * Checks if the current manifest contains a main attribute
+     * with the given key.
+     *
+     * @param key The main attribute name.
+     * @return true if the manifest contains a main attribute
+     * with the given key.
+     */
+    public boolean containsMainAttribute( String key )
+    {
+        boolean contains = false;
+        if ( getMainAttribute( key ) != null )
+        {
+            contains = true;
+        }
+        return contains;
+    }
+
+    /**
+     * Returns the value of the section attribute key.
+     *
+     * @param key The attribute name.
+     * @return The attribute value, null if the attribute is not found.
+     */
+    public String getSectionAttribute( String key )
+    {
+        return sectionAttributes.getValue( key );
+    }
+
+    /**
+     * Checks if the current manifest contains a section attribute
+     * with the given key.
+     *
+     * @param key The section attribute name.
+     * @return true if the manifest contains a  section attribute
+     * with the given key.
+     */
+    public boolean containsSectionAttribute( String key )
+    {
+        boolean contains = false;
+        if ( getSectionAttribute( key ) != null )
+        {
+            contains = true;
+        }
+        return contains;
+    }
+
+    /**
+     * Extracts the manifest entries, main attributes and section attributes.
+     */
+    private void extractManifestEntries()
+    {
+        this.manifestEntries = manifest.getEntries();
+        this.mainAttributes = manifest.getMainAttributes();
+
+        for (Iterator it = manifestEntries.keySet().iterator(); it.hasNext(); )
+        {
+            String entryName = (String) it.next();
+            this.sectionAttributes =
+                (Attributes) manifestEntries.get( entryName );
+        }
+    }
+
+}

Propchange: 
maven/maven-1/plugins/trunk/jar/src/main/org/apache/maven/jar/JarUtils.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/maven-1/plugins/trunk/jar/src/main/org/apache/maven/jar/JarUtils.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: 
maven/maven-1/plugins/trunk/jar/src/main/org/apache/maven/jar/package.html
URL: 
http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/jar/src/main/org/apache/maven/jar/package.html?rev=393396&view=auto
==============================================================================
--- maven/maven-1/plugins/trunk/jar/src/main/org/apache/maven/jar/package.html 
(added)
+++ maven/maven-1/plugins/trunk/jar/src/main/org/apache/maven/jar/package.html 
Tue Apr 11 23:10:38 2006
@@ -0,0 +1,11 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+  <head>
+    <title>org.apache.maven.jar</title>
+  </head>
+  <body>
+    <p>
+      Contains utility classes for the jar plugin.
+    </p>
+  </body>
+</html>

Propchange: 
maven/maven-1/plugins/trunk/jar/src/main/org/apache/maven/jar/package.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/maven-1/plugins/trunk/jar/src/main/org/apache/maven/jar/package.html
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/maven-1/plugins/trunk/jar/src/plugin-test/test-manifest/maven.xml
URL: 
http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/jar/src/plugin-test/test-manifest/maven.xml?rev=393396&view=auto
==============================================================================
--- maven/maven-1/plugins/trunk/jar/src/plugin-test/test-manifest/maven.xml 
(added)
+++ maven/maven-1/plugins/trunk/jar/src/plugin-test/test-manifest/maven.xml Tue 
Apr 11 23:10:38 2006
@@ -0,0 +1,152 @@
+<!-- 
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ -->
+
+<project xmlns:ant="jelly:ant"
+         xmlns:u="jelly:util"
+         xmlns:j="jelly:core"
+         xmlns:assert="assert">
+
+  <goal name="testPlugin" prereqs="clean,jar:jar">
+     <u:file name="${maven.build.dir}/${maven.jar.final.name}" var="jarfile"/>
+     <j:new var="testBean" className="org.apache.maven.jar.TestManifest"/>
+
+     <j:set var="true" value="true"/>
+
+     <j:invoke var="success" on="${testBean}" method="extractManifestFromJar" 
exceptionVar="exc">
+       <j:arg value="${jarfile}" type="java.io.File"/>
+     </j:invoke>
+     <j:if test="${exc != null}">
+       <ant:fail>${exc}</ant:fail>
+     </j:if>
+
+     <j:invoke var="success" on="${testBean}" method="containsSection">
+       <j:arg value="org/apache/maven" type="java.lang.String"/>
+     </j:invoke>
+     <assert:assertEquals
+        expected="${true}"
+        value="${success}"
+        msg=" Didn't find section 'org/apache/maven' in manifest!"/>
+
+     <j:invoke var="value" on="${testBean}" method="getMainAttribute">
+       <j:arg value="Maven-Version" type="java.lang.String"/>
+     </j:invoke>
+     <assert:assertEquals
+        expected="${maven.application.version}"
+        value="${value}"
+        msg=" for Maven-Version attribute."/>
+
+     <j:invoke var="value" on="${testBean}" method="getMainAttribute">
+       <j:arg value="Built-By" type="java.lang.String"/>
+     </j:invoke>
+     <assert:assertEquals
+        expected="${user.name}"
+        value="${value}"
+        msg=" for Built-By attribute."/>
+
+     <j:invoke var="success" on="${testBean}" method="containsMainAttribute">
+       <j:arg value="Built-By" type="java.lang.String"/>
+     </j:invoke>
+     <assert:assertEquals
+        expected="${true}"
+        value="${success}"
+        msg=" Didn't find 'Built-By' attribute in manifest!"/>
+
+     <j:invoke var="success" on="${testBean}" method="containsMainAttribute">
+       <j:arg value="Created-By" type="java.lang.String"/>
+     </j:invoke>
+     <assert:assertEquals
+        expected="${true}"
+        value="${success}"
+        msg=" Didn't find 'Created-By' attribute in manifest!"/>
+
+     <j:invoke var="success" on="${testBean}" method="containsMainAttribute">
+       <j:arg value="Ant-Version" type="java.lang.String"/>
+     </j:invoke>
+     <assert:assertEquals
+        expected="${true}"
+        value="${success}"
+        msg=" Didn't find 'Ant-Version' attribute in manifest!"/>
+
+     <j:invoke var="success" on="${testBean}" method="containsMainAttribute">
+       <j:arg value="Manifest-Version" type="java.lang.String"/>
+     </j:invoke>
+     <assert:assertEquals
+        expected="${true}"
+        value="${success}"
+        msg=" Didn't find 'Manifest-Version' attribute in manifest!"/>
+
+
+     <j:invoke var="success" on="${testBean}" 
method="containsSectionAttribute">
+       <j:arg value="Specification-Title" type="java.lang.String"/>
+     </j:invoke>
+     <assert:assertEquals
+        expected="${true}"
+        value="${success}"
+        msg=" Didn't find 'Specification-Title' attribute in manifest!"/>
+
+     <j:invoke var="success" on="${testBean}" 
method="containsSectionAttribute">
+       <j:arg value="Implementation-Title" type="java.lang.String"/>
+     </j:invoke>
+     <assert:assertEquals
+        expected="${true}"
+        value="${success}"
+        msg=" Didn't find 'Implementation-Title' attribute in manifest!"/>
+
+     <j:invoke var="success" on="${testBean}" 
method="containsSectionAttribute">
+       <j:arg value="Specification-Version" type="java.lang.String"/>
+     </j:invoke>
+     <assert:assertEquals
+        expected="${true}"
+        value="${success}"
+        msg=" Didn't find 'Specification-Version' attribute in manifest!"/>
+
+     <j:invoke var="success" on="${testBean}" 
method="containsSectionAttribute">
+       <j:arg value="Specification-Vendor" type="java.lang.String"/>
+     </j:invoke>
+     <assert:assertEquals
+        expected="${true}"
+        value="${success}"
+        msg=" Didn't find 'Specification-Vendor' attribute in manifest!"/>
+
+     <j:invoke var="success" on="${testBean}" 
method="containsSectionAttribute">
+       <j:arg value="Extension-name" type="java.lang.String"/>
+     </j:invoke>
+     <assert:assertEquals
+        expected="${true}"
+        value="${success}"
+        msg=" Didn't find 'Extension-name' attribute in manifest!"/>
+
+     <j:invoke var="success" on="${testBean}" 
method="containsSectionAttribute">
+       <j:arg value="Implementation-Version" type="java.lang.String"/>
+     </j:invoke>
+     <assert:assertEquals
+        expected="${true}"
+        value="${success}"
+        msg=" Didn't find 'Implementation-Version' attribute in manifest!"/>
+
+     <j:invoke var="success" on="${testBean}" 
method="containsSectionAttribute">
+       <j:arg value="Implementation-Vendor" type="java.lang.String"/>
+     </j:invoke>
+     <assert:assertEquals
+        expected="${true}"
+        value="${success}"
+        msg=" Didn't find 'Implementation-Vendor' attribute in manifest!"/>
+
+  </goal>
+
+</project>
\ No newline at end of file

Propchange: 
maven/maven-1/plugins/trunk/jar/src/plugin-test/test-manifest/maven.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/maven-1/plugins/trunk/jar/src/plugin-test/test-manifest/maven.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: 
maven/maven-1/plugins/trunk/jar/src/plugin-test/test-manifest/project.properties
URL: 
http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/jar/src/plugin-test/test-manifest/project.properties?rev=393396&view=auto
==============================================================================
--- 
maven/maven-1/plugins/trunk/jar/src/plugin-test/test-manifest/project.properties
 (added)
+++ 
maven/maven-1/plugins/trunk/jar/src/plugin-test/test-manifest/project.properties
 Tue Apr 11 23:10:38 2006
@@ -0,0 +1,16 @@
+# -------------------------------------------------------------------
+# Copyright 2006 The Apache Software Foundation.
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+#      http://www.apache.org/licenses/LICENSE-2.0
+#  
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# -------------------------------------------------------------------
+

Propchange: 
maven/maven-1/plugins/trunk/jar/src/plugin-test/test-manifest/project.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/maven-1/plugins/trunk/jar/src/plugin-test/test-manifest/project.properties
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/maven-1/plugins/trunk/jar/src/plugin-test/test-manifest/project.xml
URL: 
http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/jar/src/plugin-test/test-manifest/project.xml?rev=393396&view=auto
==============================================================================
--- maven/maven-1/plugins/trunk/jar/src/plugin-test/test-manifest/project.xml 
(added)
+++ maven/maven-1/plugins/trunk/jar/src/plugin-test/test-manifest/project.xml 
Tue Apr 11 23:10:38 2006
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 
+/*
+ * Copyright 2006The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ -->
+
+<project xmlns="http://maven.apache.org/POM/3.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+    xsi:schemaLocation="http://maven.apache.org/POM/3.0.0 
http://maven.apache.org/maven-v3_0_0.xsd";>
+
+  <pomVersion>3</pomVersion>
+  <id>test-manifest</id>
+  <groupId>maven</groupId>
+  <name>Maven Jar Plugin Manifest Test</name>
+  <currentVersion>1.0</currentVersion>
+  <organization>
+    <name>Apache Software Foundation</name>
+    <url>http://www.apache.org/</url>
+    <logo>http://maven.apache.org/images/apache-maven-project.png</logo>
+  </organization>
+
+  <inceptionYear>2006</inceptionYear>
+  <package>org.apache.maven</package>
+  <logo>http://maven.apache.org/images/maven.jpg</logo>
+  <description>A project to test manifest files created by the jar:jar 
goal</description>
+  <shortDescription>Testing manifests created by the jar 
plugin</shortDescription>
+  <url>http://maven.apache.org/maven-1.x/plugins/jar/</url>
+
+  <repository>
+    
<connection>scm:svn:http://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk/jar/</connection>
+    
<url>http://svn.apache.org/viewcvs.cgi/maven/maven-1/plugins/trunk/jar/</url>
+  </repository>
+
+  <build>
+    <defaultGoal>testPlugin</defaultGoal>
+    <sourceDirectory>src/main/java</sourceDirectory>
+  </build>
+
+</project>

Propchange: 
maven/maven-1/plugins/trunk/jar/src/plugin-test/test-manifest/project.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/maven-1/plugins/trunk/jar/src/plugin-test/test-manifest/project.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: 
maven/maven-1/plugins/trunk/jar/src/test/org/apache/maven/jar/JarUtilsTest.java
URL: 
http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/jar/src/test/org/apache/maven/jar/JarUtilsTest.java?rev=393396&view=auto
==============================================================================
--- 
maven/maven-1/plugins/trunk/jar/src/test/org/apache/maven/jar/JarUtilsTest.java 
(added)
+++ 
maven/maven-1/plugins/trunk/jar/src/test/org/apache/maven/jar/JarUtilsTest.java 
Tue Apr 11 23:10:38 2006
@@ -0,0 +1,71 @@
+package org.apache.maven.jar;
+
+/* ====================================================================
+ *   Copyright 2006 The Apache Software Foundation.
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ * ====================================================================
+ */
+
+import java.io.File;
+import java.io.IOException;
+
+import junit.framework.TestCase;
+
+/**
+ * JarUtils Test class.
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">Lukas Theussl</a>
+ * @version $Id$
+ */
+public class JarUtilsTest extends TestCase
+{
+
+    /**  Tests the manifest entries. */
+    public void testManifestEntries()
+    {
+        JarUtils jarUtils = new JarUtils();
+        File manifestFile =
+            new File( System.getProperty( "basedir"), 
"src/test/resources/MANIFEST.MF" );
+
+        try
+        {
+            jarUtils.extractManifestFromFile( manifestFile );
+        }
+        catch (IOException e)
+        {
+            e.printStackTrace();
+            fail( "Could not open manifest file!" );
+        }
+
+        assertEquals( jarUtils.getMainAttribute( "Manifest-Version" ), "1.0" );
+        assertEquals( jarUtils.getMainAttribute( "Ant-Version" ), "Apache Ant 
1.6.5" );
+        assertEquals( jarUtils.getMainAttribute( "Created-By" ), "1.4.2_10-b03 
(Sun Microsystems Inc.)" );
+        assertEquals( jarUtils.getMainAttribute( "Built-By" ), "me" );
+        assertEquals( jarUtils.getMainAttribute( "Maven-Version" ), 
"1.1-beta-3-SNAPSHOT" );
+
+        assertEquals( jarUtils.getSectionAttribute( "Extension-name" ), 
"org.apache.maven" );
+        assertEquals( jarUtils.getSectionAttribute( "Specification-Title" ), 
"Create jar files" );
+        assertEquals( jarUtils.getSectionAttribute( "Specification-Vendor" ), 
"Apache Software Foundation" );
+        assertEquals( jarUtils.getSectionAttribute( "Specification-Version" ), 
"1.8" );
+        assertEquals( jarUtils.getSectionAttribute( "Implementation-Title" ), 
"org.apache.maven" );
+        assertEquals( jarUtils.getSectionAttribute( "Implementation-Vendor" ), 
"Apache Software Foundation" );
+        assertEquals( jarUtils.getSectionAttribute( "Implementation-Version" 
), "1.8-SNAPSHOT" );
+
+        assertTrue( jarUtils.containsSection( "org/apache/maven" ) );
+        assertTrue( jarUtils.containsMainAttribute( "Maven-Version" ) );
+        assertTrue( jarUtils.containsSectionAttribute( "Specification-Version" 
) );
+
+    }
+
+}

Propchange: 
maven/maven-1/plugins/trunk/jar/src/test/org/apache/maven/jar/JarUtilsTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/maven-1/plugins/trunk/jar/src/test/org/apache/maven/jar/JarUtilsTest.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: 
maven/maven-1/plugins/trunk/jar/src/test/org/apache/maven/jar/package.html
URL: 
http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/jar/src/test/org/apache/maven/jar/package.html?rev=393396&view=auto
==============================================================================
--- maven/maven-1/plugins/trunk/jar/src/test/org/apache/maven/jar/package.html 
(added)
+++ maven/maven-1/plugins/trunk/jar/src/test/org/apache/maven/jar/package.html 
Tue Apr 11 23:10:38 2006
@@ -0,0 +1,11 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+  <head>
+    <title>org.apache.maven.jar</title>
+  </head>
+  <body>
+    <p>
+      Test classes for org.apache.maven.jar.
+    </p>
+  </body>
+</html>

Propchange: 
maven/maven-1/plugins/trunk/jar/src/test/org/apache/maven/jar/package.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/maven-1/plugins/trunk/jar/src/test/org/apache/maven/jar/package.html
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/maven-1/plugins/trunk/jar/src/test/resources/MANIFEST.MF
URL: 
http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/jar/src/test/resources/MANIFEST.MF?rev=393396&view=auto
==============================================================================
--- maven/maven-1/plugins/trunk/jar/src/test/resources/MANIFEST.MF (added)
+++ maven/maven-1/plugins/trunk/jar/src/test/resources/MANIFEST.MF Tue Apr 11 
23:10:38 2006
@@ -0,0 +1,15 @@
+Manifest-Version: 1.0
+Ant-Version: Apache Ant 1.6.5
+Created-By: 1.4.2_10-b03 (Sun Microsystems Inc.)
+Built-By: me
+Maven-Version: 1.1-beta-3-SNAPSHOT
+
+Name: org/apache/maven
+Extension-name: org.apache.maven
+Specification-Title: Create jar files
+Specification-Vendor: Apache Software Foundation
+Specification-Version: 1.8
+Implementation-Title: org.apache.maven
+Implementation-Vendor: Apache Software Foundation
+Implementation-Version: 1.8-SNAPSHOT
+

Modified: maven/maven-1/plugins/trunk/jar/xdocs/changes.xml
URL: 
http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/jar/xdocs/changes.xml?rev=393396&r1=393395&r2=393396&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/jar/xdocs/changes.xml (original)
+++ maven/maven-1/plugins/trunk/jar/xdocs/changes.xml Tue Apr 11 23:10:38 2006
@@ -25,6 +25,7 @@
   </properties>
   <body>
     <release version="1.8-SNAPSHOT" date="In SVN">
+      <action dev="ltheussl" type="add" issue="MPJAR-19">Add tests for jar 
manifest creation.</action>
       <action dev="ltheussl" type="fix" issue="MPJAR-46">Using 
<code>maven.jar.manifest.classpath.add=true</code> from maven console gives 
huge Class-Path.</action>
       <action dev="ltheussl" type="add" issue="MPJAR-15" due-to="Matt 
Finn">Include <code>Implementation-Vendor-Id</code> attribute for dependencies 
in manifest.</action>
       <action dev="ltheussl" type="add" issue="MPJAR-39">Support 
specificationVersion in manifest.</action>


Reply via email to