You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by st...@apache.org on 2012/08/29 21:18:46 UTC
svn commit: r1378688 - in /maven/shared/trunk/maven-shared-utils/src:
main/java/org/apache/maven/shared/utils/
test/java/org/apache/maven/shared/utils/
Author: struberg
Date: Wed Aug 29 19:18:45 2012
New Revision: 1378688
URL: http://svn.apache.org/viewvc?rev=1378688&view=rev
Log:
MSHARED-236 move PathTool and PropertyUtils from sandbox to proper
Added:
maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/PathTool.java
- copied, changed from r1378653, maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-commons-bridge/src/main/java/org/codehaus/plexus/util/PathTool.java
maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/PropertyUtils.java
- copied, changed from r1378653, maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-commons-bridge/src/main/java/org/codehaus/plexus/util/PropertyUtils.java
maven/shared/trunk/maven-shared-utils/src/test/java/org/apache/maven/shared/utils/PathToolTest.java
- copied, changed from r1378653, maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-tck/src/test/java/org/codehaus/plexus/util/PathToolTest.java
maven/shared/trunk/maven-shared-utils/src/test/java/org/apache/maven/shared/utils/PropertyUtilsTest.java
- copied, changed from r1378653, maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-tck/src/test/java/org/codehaus/plexus/util/PropertyUtilsTest.java
Copied: maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/PathTool.java (from r1378653, maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-commons-bridge/src/main/java/org/codehaus/plexus/util/PathTool.java)
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/PathTool.java?p2=maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/PathTool.java&p1=maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-commons-bridge/src/main/java/org/codehaus/plexus/util/PathTool.java&r1=1378653&r2=1378688&rev=1378688&view=diff
==============================================================================
--- maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-commons-bridge/src/main/java/org/codehaus/plexus/util/PathTool.java (original)
+++ maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/PathTool.java Wed Aug 29 19:18:45 2012
@@ -1,4 +1,4 @@
-package org.codehaus.plexus.util;
+package org.apache.maven.shared.utils;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
Copied: maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/PropertyUtils.java (from r1378653, maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-commons-bridge/src/main/java/org/codehaus/plexus/util/PropertyUtils.java)
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/PropertyUtils.java?p2=maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/PropertyUtils.java&p1=maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-commons-bridge/src/main/java/org/codehaus/plexus/util/PropertyUtils.java&r1=1378653&r2=1378688&rev=1378688&view=diff
==============================================================================
--- maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-commons-bridge/src/main/java/org/codehaus/plexus/util/PropertyUtils.java (original)
+++ maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/PropertyUtils.java Wed Aug 29 19:18:45 2012
@@ -1,4 +1,4 @@
-package org.codehaus.plexus.util;
+package org.apache.maven.shared.utils;
/*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -19,7 +19,8 @@ package org.codehaus.plexus.util;
* under the License.
*/
-import org.apache.commons.io.IOUtils;
+
+import org.apache.maven.shared.utils.io.IOUtil;
import java.io.FileInputStream;
import java.io.IOException;
@@ -84,9 +85,9 @@ public class PropertyUtils
}
finally
{
- IOUtils.closeQuietly( is );
+ IOUtil.close( is );
}
return null;
}
-}
\ No newline at end of file
+}
Copied: maven/shared/trunk/maven-shared-utils/src/test/java/org/apache/maven/shared/utils/PathToolTest.java (from r1378653, maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-tck/src/test/java/org/codehaus/plexus/util/PathToolTest.java)
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-shared-utils/src/test/java/org/apache/maven/shared/utils/PathToolTest.java?p2=maven/shared/trunk/maven-shared-utils/src/test/java/org/apache/maven/shared/utils/PathToolTest.java&p1=maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-tck/src/test/java/org/codehaus/plexus/util/PathToolTest.java&r1=1378653&r2=1378688&rev=1378688&view=diff
==============================================================================
--- maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-tck/src/test/java/org/codehaus/plexus/util/PathToolTest.java (original)
+++ maven/shared/trunk/maven-shared-utils/src/test/java/org/apache/maven/shared/utils/PathToolTest.java Wed Aug 29 19:18:45 2012
@@ -1,4 +1,4 @@
-package org.codehaus.plexus.util;
+package org.apache.maven.shared.utils;
/*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -19,7 +19,6 @@ package org.codehaus.plexus.util;
* under the License.
*/
-import org.apache.maven.tck.FixPlexusBugs;
import org.hamcrest.CoreMatchers;
import org.junit.Rule;
import org.junit.Test;
@@ -42,9 +41,6 @@ public class PathToolTest extends Assert
{
@Rule
- public FixPlexusBugs fixPlexusBugs = new FixPlexusBugs();
-
- @Rule
public TemporaryFolder tempFolder = new TemporaryFolder();
@Test
Copied: maven/shared/trunk/maven-shared-utils/src/test/java/org/apache/maven/shared/utils/PropertyUtilsTest.java (from r1378653, maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-tck/src/test/java/org/codehaus/plexus/util/PropertyUtilsTest.java)
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-shared-utils/src/test/java/org/apache/maven/shared/utils/PropertyUtilsTest.java?p2=maven/shared/trunk/maven-shared-utils/src/test/java/org/apache/maven/shared/utils/PropertyUtilsTest.java&p1=maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-tck/src/test/java/org/codehaus/plexus/util/PropertyUtilsTest.java&r1=1378653&r2=1378688&rev=1378688&view=diff
==============================================================================
--- maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-tck/src/test/java/org/codehaus/plexus/util/PropertyUtilsTest.java (original)
+++ maven/shared/trunk/maven-shared-utils/src/test/java/org/apache/maven/shared/utils/PropertyUtilsTest.java Wed Aug 29 19:18:45 2012
@@ -1,4 +1,4 @@
-package org.codehaus.plexus.util;
+package org.apache.maven.shared.utils;
/*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -19,14 +19,9 @@ package org.codehaus.plexus.util;
* under the License.
*/
-import org.apache.maven.tck.FixPlexusBugs;
-import org.apache.maven.tck.ReproducesPlexusBug;
import org.junit.Rule;
import org.junit.Test;
-import org.junit.rules.MethodRule;
import org.junit.rules.TemporaryFolder;
-import org.junit.runners.model.FrameworkMethod;
-import org.junit.runners.model.Statement;
import java.io.ByteArrayInputStream;
import java.io.File;
@@ -39,16 +34,11 @@ import java.lang.annotation.Target;
import java.net.URL;
import java.util.Properties;
-import static org.apache.maven.tck.TckMatchers.hasDefaultConstructor;
-import static org.apache.maven.tck.TckMatchers.isFinalClass;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.assertThat;
public class PropertyUtilsTest
{
- @Rule
- public FixPlexusBugs fixPlexusBugs = new FixPlexusBugs();
-
@Retention( RetentionPolicy.RUNTIME )
@Target( ElementType.METHOD )
@interface NeedsTemporaryFolder
@@ -56,31 +46,11 @@ public class PropertyUtilsTest
}
@Rule
- public MethodRule folderProvider = new MethodRule()
- {
- // keep the tests fast and only interface with the filesystem if needed
- public Statement apply( Statement base, FrameworkMethod method, Object target )
- {
- if ( method.getAnnotation( NeedsTemporaryFolder.class ) == null )
- {
- return base;
- }
- folder = new TemporaryFolder();
- return folder.apply( base, method, target );
- }
- };
-
- public TemporaryFolder folder;
+ public TemporaryFolder tempFolder = new TemporaryFolder();
- @Test
- public void isNotUtilityClass()
- throws Exception
- {
- assertThat( PropertyUtils.class, allOf( hasDefaultConstructor(), not( isFinalClass() ) ) );
- }
@Test
- @ReproducesPlexusBug( "Should return null on error like url and file do" )
+ // @ReproducesPlexusBug( "Should return null on error like url and file do" )
public void loadNullInputStream()
throws Exception
{
@@ -113,7 +83,7 @@ public class PropertyUtilsTest
public void loadEmptyFile()
throws Exception
{
- assertThat( PropertyUtils.loadProperties( folder.newFile( "empty" ) ), is( new Properties() ) );
+ assertThat( PropertyUtils.loadProperties( tempFolder.newFile( "empty" ) ), is( new Properties() ) );
}
@Test
@@ -121,7 +91,7 @@ public class PropertyUtilsTest
public void loadEmptyURL()
throws Exception
{
- assertThat( PropertyUtils.loadProperties( folder.newFile( "empty" ).toURI().toURL() ), is( new Properties() ) );
+ assertThat( PropertyUtils.loadProperties( tempFolder.newFile( "empty" ).toURI().toURL() ), is( new Properties() ) );
}
@Test
@@ -139,7 +109,7 @@ public class PropertyUtilsTest
public void loadValidFile()
throws Exception
{
- File valid = folder.newFile( "valid" );
+ File valid = tempFolder.newFile( "valid" );
Properties value = new Properties();
value.setProperty( "a", "b" );
value.store( new FileOutputStream( valid ), "a test" );
@@ -151,7 +121,7 @@ public class PropertyUtilsTest
public void loadValidURL()
throws Exception
{
- File valid = folder.newFile( "valid" );
+ File valid = tempFolder.newFile( "valid" );
Properties value = new Properties();
value.setProperty( "a", "b" );
value.store( new FileOutputStream( valid ), "a test" );