You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2019/06/11 17:29:30 UTC

[maven-shared-utils] branch master updated: [MSHARED-826] Require Java 7

This is an automated email from the ASF dual-hosted git repository.

rfscholte pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-shared-utils.git


The following commit(s) were added to refs/heads/master by this push:
     new ba67166  [MSHARED-826] Require Java 7
ba67166 is described below

commit ba671665b40bd088f27d7824776255d9a2f01b4e
Author: Maarten Mulders <mt...@users.noreply.github.com>
AuthorDate: Tue Jun 11 19:29:25 2019 +0200

    [MSHARED-826] Require Java 7
---
 pom.xml                                            | 10 ++++++-
 .../java/org/apache/maven/shared/utils/OsTest.java | 33 ----------------------
 2 files changed, 9 insertions(+), 34 deletions(-)

diff --git a/pom.xml b/pom.xml
index 171f2f9..01763d9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
   <parent>
     <groupId>org.apache.maven.shared</groupId>
     <artifactId>maven-shared-components</artifactId>
-    <version>32</version>
+    <version>33</version>
     <relativePath>../../pom/maven/maven-shared-components/pom.xml</relativePath>
   </parent>
 
@@ -63,6 +63,7 @@
   <properties>
     <checkstyle.violation.ignore>RedundantThrows,NewlineAtEndOfFile,ParameterNumber,MethodLength,FileLength,ModifierOrder</checkstyle.violation.ignore>
 
+    <javaVersion>7</javaVersion>
     <mavenVersion>3.0</mavenVersion>
   </properties>
 
@@ -144,6 +145,13 @@
           </excludes>
         </configuration>
       </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <reuseForks>false</reuseForks>
+        </configuration>
+      </plugin>
     </plugins>
   </build>
 
diff --git a/src/test/java/org/apache/maven/shared/utils/OsTest.java b/src/test/java/org/apache/maven/shared/utils/OsTest.java
index 051a930..d5ea683 100644
--- a/src/test/java/org/apache/maven/shared/utils/OsTest.java
+++ b/src/test/java/org/apache/maven/shared/utils/OsTest.java
@@ -24,8 +24,6 @@ import org.junit.Before;
 import org.junit.After;
 import org.junit.Assert;
 
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
 import java.util.Set;
 
 import static org.hamcrest.CoreMatchers.*;
@@ -40,65 +38,34 @@ public class OsTest
     extends Assert
 {
     private String origOsName;
-    private String origOsFamily;
     private String origOsArch;
     private String origOsVersion;
 
 
     @Before
     public void setUp()
-        throws Exception
     {
         origOsName = System.getProperty( "os.name" );
         origOsArch = System.getProperty( "os.arch" );
         origOsVersion = System.getProperty( "os.version" );
-        origOsFamily = Os.OS_FAMILY;
 
         // and now set some special settings ;)
         System.setProperty( "os.name"   , "os/2" );
         System.setProperty( "os.arch"   , "i386" );
         System.setProperty( "os.version", "2.1.32" );
-
-        // blow away the originally loaded values
-        setStaticOsField( "OS_NAME", "os/2" );
-        setStaticOsField( "OS_FAMILY", "os/2" );
-        setStaticOsField( "OS_ARCH", "i386" );
-        setStaticOsField( "OS_VERSION", "2.1.32" );
     }
 
     @After
     public void tearDown()
-        throws Exception
     {
         // set the original OS settings again
         System.setProperty( "os.name"   , origOsName );
         System.setProperty( "os.arch"   , origOsArch );
         System.setProperty( "os.version", origOsVersion );
-
-        // restore the originally loaded values
-        setStaticOsField( "OS_NAME", origOsName );
-        setStaticOsField( "OS_ARCH", origOsArch );
-        setStaticOsField( "OS_VERSION", origOsVersion );
-        setStaticOsField( "OS_FAMILY", origOsFamily );
-    }
-
-    private void setStaticOsField( String variableName, Object value )
-        throws NoSuchFieldException, IllegalAccessException
-    {
-        Field field = Os.class.getField( variableName );
-
-        Field modifiersField = Field.class.getDeclaredField( "modifiers" );
-        modifiersField.setAccessible( true );
-        modifiersField.setInt( field, field.getModifiers() & ~Modifier.FINAL );
-
-        field.setAccessible( true );
-        field.set( null, value );
     }
 
-
     @Test
     public void testConstructor()
-        throws Exception
     {
         Os os  = new Os();
         os.eval();