maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bentm...@apache.org
Subject svn commit: r1063553 - in /maven/plugins/trunk/maven-ear-plugin/src: main/java/org/apache/maven/plugin/ear/util/ test/java/org/apache/maven/plugin/ear/util/
Date Wed, 26 Jan 2011 01:23:57 GMT
Author: bentmann
Date: Wed Jan 26 01:23:57 2011
New Revision: 1063553

URL: http://svn.apache.org/viewvc?rev=1063553&view=rev
Log:
o Added license headers

Modified:
    maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/util/InvalidJavaEEVersion.java
    maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/util/JavaEEVersion.java
    maven/plugins/trunk/maven-ear-plugin/src/test/java/org/apache/maven/plugin/ear/util/JavaEEVersionTest.java

Modified: maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/util/InvalidJavaEEVersion.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/util/InvalidJavaEEVersion.java?rev=1063553&r1=1063552&r2=1063553&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/util/InvalidJavaEEVersion.java
(original)
+++ maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/util/InvalidJavaEEVersion.java
Wed Jan 26 01:23:57 2011
@@ -1,22 +1,41 @@
-package org.apache.maven.plugin.ear.util;
-
-import org.apache.maven.plugin.MojoExecutionException;
-
-/**
- * @author Stephane Nicoll
- */
-public class InvalidJavaEEVersion extends MojoExecutionException {
-
-    private final String invalidVersion;
-
-    public InvalidJavaEEVersion( String message, String invalidVersion )
-    {
-        super( message );
-        this.invalidVersion = invalidVersion;
-    }
-
-    public String getInvalidVersion()
-    {
-        return invalidVersion;
-    }
-}
+package org.apache.maven.plugin.ear.util;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 org.apache.maven.plugin.MojoExecutionException;
+
+/**
+ * @author Stephane Nicoll
+ */
+public class InvalidJavaEEVersion extends MojoExecutionException {
+
+    private final String invalidVersion;
+
+    public InvalidJavaEEVersion( String message, String invalidVersion )
+    {
+        super( message );
+        this.invalidVersion = invalidVersion;
+    }
+
+    public String getInvalidVersion()
+    {
+        return invalidVersion;
+    }
+}

Modified: maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/util/JavaEEVersion.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/util/JavaEEVersion.java?rev=1063553&r1=1063552&r2=1063553&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/util/JavaEEVersion.java
(original)
+++ maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/util/JavaEEVersion.java
Wed Jan 26 01:23:57 2011
@@ -1,164 +1,183 @@
-package org.apache.maven.plugin.ear.util;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Represents the supported JavaEE version.
- *
- * @author Stephane Nicoll
- */
-public class JavaEEVersion
-    implements Comparable
-{
-
-    private static final String VERSION_1_3 = "1.3";
-
-    private static final String VERSION_1_4 = "1.4";
-
-    private static final String VERSION_5 = "5";
-
-    private static final String VERSION_6 = "6";
-
-    private static final Map versionsMap = new HashMap();
-
-
-    /**
-     * Represents the J2EE 1.3 version.
-     */
-    public static final JavaEEVersion OneDotThree = new JavaEEVersion( new Integer( 0 ),
VERSION_1_3 );
-
-    /**
-     * Represents the J2EE 1.4 version.
-     */
-    public static final JavaEEVersion OneDotFour = new JavaEEVersion( new Integer( 1 ), VERSION_1_4
);
-
-    /**
-     * Represents the JavaEE 5 version.
-     */
-    public static final JavaEEVersion Five = new JavaEEVersion( new Integer( 2 ), VERSION_5
);
-
-    /**
-     * Represents the JavaEE 7 version.
-     */
-    public static final JavaEEVersion Six = new JavaEEVersion( new Integer( 3 ), VERSION_6
);
-
-
-    private final Integer index;
-
-    private final String version;
-
-    private JavaEEVersion( Integer index, String version )
-    {
-        this.index = index;
-        this.version = version;
-        versionsMap.put( version, this );
-    }
-
-    public static JavaEEVersion getJavaEEVersion( String version )
-        throws InvalidJavaEEVersion
-    {
-        if ( !isValid( version ) )
-        {
-            throw new InvalidJavaEEVersion( "Invalid version [" + version + "]", version
);
-        }
-        return (JavaEEVersion) versionsMap.get( version );
-    }
-
-    /**
-     * Returns the version as a string.
-     *
-     * @return the version string
-     */
-    public String getVersion()
-    {
-        return version;
-    }
-
-    /**
-     * Specifies if this version is greater or equal to the specified version.
-     *
-     * @param version the version to check
-     * @return true if this version is greater or equal to <tt>version</tt>
-     */
-    public boolean ge( JavaEEVersion version )
-    {
-        return this.compareTo( version ) >= 0;
-    }
-
-    /**
-     * Specifies if this version is greater than the specified version.
-     *
-     * @param version the version to check
-     * @return true if this version is greater to <tt>version</tt>
-     */
-    public boolean gt( JavaEEVersion version )
-    {
-        return this.compareTo( version ) > 0;
-    }
-
-    /**
-     * Specifies if this version is equal to the specified version.
-     *
-     * @param version the version to check
-     * @return true if this version is equal to <tt>version</tt>
-     */
-    public boolean eq( JavaEEVersion version )
-    {
-        return this.compareTo( version ) == 0;
-    }
-
-    /**
-     * Specifies if this version is less or equal to the specified version.
-     *
-     * @param version the version to check
-     * @return true if this version is less or equal to <tt>version</tt>
-     */
-    public boolean le( JavaEEVersion version )
-    {
-        return this.compareTo( version ) <= 0;
-    }
-
-
-    /**
-     * Specifies if this version is less than the specified version.
-     *
-     * @param version the version to check
-     * @return true if this version is less or equal to <tt>version</tt>
-     */
-    public boolean lt( JavaEEVersion version )
-    {
-        return this.compareTo( version ) < 0;
-    }
-
-    /**
-     * Checks if the specified version string is valid.
-     *
-     * @param version the version string to check
-     * @return <tt>true</tt> if the version is valid
-     */
-    private static boolean isValid( String version )
-    {
-        if ( version == null )
-        {
-            throw new IllegalArgumentException( "version could not be null." );
-        }
-        return VERSION_1_3.equals( version ) || VERSION_1_4.equals( version ) || VERSION_5.equals(
version ) ||
-            VERSION_6.equals( version );
-    }
-
-    public int compareTo( Object other )
-    {
-        if ( other == null )
-        {
-            throw new IllegalArgumentException( "other object to compare to could not be
null." );
-        }
-        if ( !( other instanceof JavaEEVersion ) )
-        {
-            throw new IllegalArgumentException(
-                "other object to compare must be a JavaEEVersion but was [" + other.getClass().getName()
+ "]" );
-        }
-        final JavaEEVersion otherVersion = (JavaEEVersion) other;
-        return index.compareTo( otherVersion.index );
-    }
-}
+package org.apache.maven.plugin.ear.util;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.util.HashMap;
+import java.util.Map;
+
+/**
+ * Represents the supported JavaEE version.
+ *
+ * @author Stephane Nicoll
+ */
+public class JavaEEVersion
+    implements Comparable
+{
+
+    private static final String VERSION_1_3 = "1.3";
+
+    private static final String VERSION_1_4 = "1.4";
+
+    private static final String VERSION_5 = "5";
+
+    private static final String VERSION_6 = "6";
+
+    private static final Map versionsMap = new HashMap();
+
+
+    /**
+     * Represents the J2EE 1.3 version.
+     */
+    public static final JavaEEVersion OneDotThree = new JavaEEVersion( new Integer( 0 ),
VERSION_1_3 );
+
+    /**
+     * Represents the J2EE 1.4 version.
+     */
+    public static final JavaEEVersion OneDotFour = new JavaEEVersion( new Integer( 1 ), VERSION_1_4
);
+
+    /**
+     * Represents the JavaEE 5 version.
+     */
+    public static final JavaEEVersion Five = new JavaEEVersion( new Integer( 2 ), VERSION_5
);
+
+    /**
+     * Represents the JavaEE 7 version.
+     */
+    public static final JavaEEVersion Six = new JavaEEVersion( new Integer( 3 ), VERSION_6
);
+
+
+    private final Integer index;
+
+    private final String version;
+
+    private JavaEEVersion( Integer index, String version )
+    {
+        this.index = index;
+        this.version = version;
+        versionsMap.put( version, this );
+    }
+
+    public static JavaEEVersion getJavaEEVersion( String version )
+        throws InvalidJavaEEVersion
+    {
+        if ( !isValid( version ) )
+        {
+            throw new InvalidJavaEEVersion( "Invalid version [" + version + "]", version
);
+        }
+        return (JavaEEVersion) versionsMap.get( version );
+    }
+
+    /**
+     * Returns the version as a string.
+     *
+     * @return the version string
+     */
+    public String getVersion()
+    {
+        return version;
+    }
+
+    /**
+     * Specifies if this version is greater or equal to the specified version.
+     *
+     * @param version the version to check
+     * @return true if this version is greater or equal to <tt>version</tt>
+     */
+    public boolean ge( JavaEEVersion version )
+    {
+        return this.compareTo( version ) >= 0;
+    }
+
+    /**
+     * Specifies if this version is greater than the specified version.
+     *
+     * @param version the version to check
+     * @return true if this version is greater to <tt>version</tt>
+     */
+    public boolean gt( JavaEEVersion version )
+    {
+        return this.compareTo( version ) > 0;
+    }
+
+    /**
+     * Specifies if this version is equal to the specified version.
+     *
+     * @param version the version to check
+     * @return true if this version is equal to <tt>version</tt>
+     */
+    public boolean eq( JavaEEVersion version )
+    {
+        return this.compareTo( version ) == 0;
+    }
+
+    /**
+     * Specifies if this version is less or equal to the specified version.
+     *
+     * @param version the version to check
+     * @return true if this version is less or equal to <tt>version</tt>
+     */
+    public boolean le( JavaEEVersion version )
+    {
+        return this.compareTo( version ) <= 0;
+    }
+
+
+    /**
+     * Specifies if this version is less than the specified version.
+     *
+     * @param version the version to check
+     * @return true if this version is less or equal to <tt>version</tt>
+     */
+    public boolean lt( JavaEEVersion version )
+    {
+        return this.compareTo( version ) < 0;
+    }
+
+    /**
+     * Checks if the specified version string is valid.
+     *
+     * @param version the version string to check
+     * @return <tt>true</tt> if the version is valid
+     */
+    private static boolean isValid( String version )
+    {
+        if ( version == null )
+        {
+            throw new IllegalArgumentException( "version could not be null." );
+        }
+        return VERSION_1_3.equals( version ) || VERSION_1_4.equals( version ) || VERSION_5.equals(
version ) ||
+            VERSION_6.equals( version );
+    }
+
+    public int compareTo( Object other )
+    {
+        if ( other == null )
+        {
+            throw new IllegalArgumentException( "other object to compare to could not be
null." );
+        }
+        if ( !( other instanceof JavaEEVersion ) )
+        {
+            throw new IllegalArgumentException(
+                "other object to compare must be a JavaEEVersion but was [" + other.getClass().getName()
+ "]" );
+        }
+        final JavaEEVersion otherVersion = (JavaEEVersion) other;
+        return index.compareTo( otherVersion.index );
+    }
+}

Modified: maven/plugins/trunk/maven-ear-plugin/src/test/java/org/apache/maven/plugin/ear/util/JavaEEVersionTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/test/java/org/apache/maven/plugin/ear/util/JavaEEVersionTest.java?rev=1063553&r1=1063552&r2=1063553&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ear-plugin/src/test/java/org/apache/maven/plugin/ear/util/JavaEEVersionTest.java
(original)
+++ maven/plugins/trunk/maven-ear-plugin/src/test/java/org/apache/maven/plugin/ear/util/JavaEEVersionTest.java
Wed Jan 26 01:23:57 2011
@@ -1,131 +1,150 @@
-package org.apache.maven.plugin.ear.util;
-
-import junit.framework.TestCase;
-
-/**
- * @author Stephane Nicoll
- */
-public class JavaEEVersionTest
-    extends TestCase
-{
-
-    public void testGtSameVersion()
-    {
-        assertFalse( JavaEEVersion.Five.gt( JavaEEVersion.Five ) );
-    }
-
-    public void testGtNextVersion()
-    {
-        assertFalse( JavaEEVersion.Five.gt( JavaEEVersion.Six ) );
-    }
-
-    public void testGtPreviousVersion()
-    {
-        assertTrue( JavaEEVersion.Five.gt( JavaEEVersion.OneDotFour ) );
-    }
-
-    public void testGeSameVersion()
-    {
-        assertTrue( JavaEEVersion.Five.ge( JavaEEVersion.Five ) );
-    }
-
-    public void testGePreviousVersion()
-    {
-        assertTrue( JavaEEVersion.Five.ge( JavaEEVersion.OneDotFour ) );
-    }
-
-    public void testGeNextVersion()
-    {
-        assertFalse( JavaEEVersion.Five.ge( JavaEEVersion.Six ) );
-    }
-
-    public void testLtSameVersion()
-    {
-        assertFalse( JavaEEVersion.Five.lt( JavaEEVersion.Five ) );
-    }
-
-    public void testLtPreviousVersion()
-    {
-        assertFalse( JavaEEVersion.Five.lt( JavaEEVersion.OneDotFour ) );
-    }
-
-    public void testLtNextVersion()
-    {
-        assertTrue( JavaEEVersion.Five.lt( JavaEEVersion.Six ) );
-    }
-
-    public void testLeSameVersion()
-    {
-        assertTrue( JavaEEVersion.Five.le( JavaEEVersion.Five ) );
-    }
-
-    public void testLePreviousVersion()
-    {
-        assertFalse( JavaEEVersion.Five.le( JavaEEVersion.OneDotFour ) );
-    }
-
-    public void testLeNextVersion()
-    {
-        assertTrue( JavaEEVersion.Five.le( JavaEEVersion.Six ) );
-    }
-
-    public void testEqSameVersion()
-    {
-        assertTrue( JavaEEVersion.Five.eq( JavaEEVersion.Five ) );
-    }
-
-    public void testEqAnotherVersion()
-    {
-        assertFalse( JavaEEVersion.Five.eq( JavaEEVersion.OneDotThree ) );
-    }
-
-    public void testGetVersion()
-    {
-        assertEquals( "5", JavaEEVersion.Five.getVersion() );
-    }
-
-    public void testGetJavaEEVersionValid()
-    {
-        try
-        {
-            assertEquals( JavaEEVersion.Six, JavaEEVersion.getJavaEEVersion( "6" ) );
-        }
-        catch ( InvalidJavaEEVersion invalidJavaEEVersion )
-        {
-            fail( "No exception should have been thrown but got [" + invalidJavaEEVersion.getMessage()
+ "]" );
-        }
-    }
-
-    public void testGetJavaEEVersionInvalid()
-    {
-        try
-        {
-            JavaEEVersion.getJavaEEVersion( "2.4" );
-            fail( "Should have failed to get an invalid version." );
-        }
-        catch ( InvalidJavaEEVersion e )
-        {
-            //OK
-        }
-    }
-
-    public void testGetJavaEEVersionNull()
-    {
-        try
-        {
-            JavaEEVersion.getJavaEEVersion( null );
-            fail( "Should have failed to get a 'null' version." );
-        }
-        catch ( InvalidJavaEEVersion e )
-        {
-            fail( "Should have failed with an illegal argument exception instead." );
-        }
-        catch ( IllegalArgumentException e )
-        {
-            // OK
-        }
-
-    }
-
-
-}
+package org.apache.maven.plugin.ear.util;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 junit.framework.TestCase;
+
+/**
+ * @author Stephane Nicoll
+ */
+public class JavaEEVersionTest
+    extends TestCase
+{
+
+    public void testGtSameVersion()
+    {
+        assertFalse( JavaEEVersion.Five.gt( JavaEEVersion.Five ) );
+    }
+
+    public void testGtNextVersion()
+    {
+        assertFalse( JavaEEVersion.Five.gt( JavaEEVersion.Six ) );
+    }
+
+    public void testGtPreviousVersion()
+    {
+        assertTrue( JavaEEVersion.Five.gt( JavaEEVersion.OneDotFour ) );
+    }
+
+    public void testGeSameVersion()
+    {
+        assertTrue( JavaEEVersion.Five.ge( JavaEEVersion.Five ) );
+    }
+
+    public void testGePreviousVersion()
+    {
+        assertTrue( JavaEEVersion.Five.ge( JavaEEVersion.OneDotFour ) );
+    }
+
+    public void testGeNextVersion()
+    {
+        assertFalse( JavaEEVersion.Five.ge( JavaEEVersion.Six ) );
+    }
+
+    public void testLtSameVersion()
+    {
+        assertFalse( JavaEEVersion.Five.lt( JavaEEVersion.Five ) );
+    }
+
+    public void testLtPreviousVersion()
+    {
+        assertFalse( JavaEEVersion.Five.lt( JavaEEVersion.OneDotFour ) );
+    }
+
+    public void testLtNextVersion()
+    {
+        assertTrue( JavaEEVersion.Five.lt( JavaEEVersion.Six ) );
+    }
+
+    public void testLeSameVersion()
+    {
+        assertTrue( JavaEEVersion.Five.le( JavaEEVersion.Five ) );
+    }
+
+    public void testLePreviousVersion()
+    {
+        assertFalse( JavaEEVersion.Five.le( JavaEEVersion.OneDotFour ) );
+    }
+
+    public void testLeNextVersion()
+    {
+        assertTrue( JavaEEVersion.Five.le( JavaEEVersion.Six ) );
+    }
+
+    public void testEqSameVersion()
+    {
+        assertTrue( JavaEEVersion.Five.eq( JavaEEVersion.Five ) );
+    }
+
+    public void testEqAnotherVersion()
+    {
+        assertFalse( JavaEEVersion.Five.eq( JavaEEVersion.OneDotThree ) );
+    }
+
+    public void testGetVersion()
+    {
+        assertEquals( "5", JavaEEVersion.Five.getVersion() );
+    }
+
+    public void testGetJavaEEVersionValid()
+    {
+        try
+        {
+            assertEquals( JavaEEVersion.Six, JavaEEVersion.getJavaEEVersion( "6" ) );
+        }
+        catch ( InvalidJavaEEVersion invalidJavaEEVersion )
+        {
+            fail( "No exception should have been thrown but got [" + invalidJavaEEVersion.getMessage()
+ "]" );
+        }
+    }
+
+    public void testGetJavaEEVersionInvalid()
+    {
+        try
+        {
+            JavaEEVersion.getJavaEEVersion( "2.4" );
+            fail( "Should have failed to get an invalid version." );
+        }
+        catch ( InvalidJavaEEVersion e )
+        {
+            //OK
+        }
+    }
+
+    public void testGetJavaEEVersionNull()
+    {
+        try
+        {
+            JavaEEVersion.getJavaEEVersion( null );
+            fail( "Should have failed to get a 'null' version." );
+        }
+        catch ( InvalidJavaEEVersion e )
+        {
+            fail( "Should have failed with an illegal argument exception instead." );
+        }
+        catch ( IllegalArgumentException e )
+        {
+            // OK
+        }
+
+    }
+
+
+}



Mime
View raw message