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

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

commit c073d79df65cbed07e10eb856879ebf277310078
Author: Fabiano C. de Oliveira <fabcipri...@yaho.com.br>
AuthorDate: Sat Nov 17 16:55:29 2018 -0200

    test case for windows
---
 .../maven/model/building/DefaultModelBuilder.java  |  4 +-
 .../building/FileModelSourceWindowsOnlyTest.java   | 59 ++++++++++++++++++++++
 .../maven/model/building/OnlyOnWindowsRunner.java  | 46 +++++++++++++++++
 3 files changed, 107 insertions(+), 2 deletions(-)

diff --git 
a/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
 
b/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
index dee8956..8714611 100644
--- 
a/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
+++ 
b/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
@@ -852,11 +852,11 @@ public class DefaultModelBuilder
                 File pomFile = parentData.getModel().getPomFile();
                 if ( pomFile != null )
                 {
-                    FileModelSource pomFileModel = new FileModelSource( 
pomFile );
+                    FileModelSource pomSource = new FileModelSource( pomFile );
                     ModelSource expectedParentSource = getParentPomFile( 
childModel, childSource );
 
                     if ( expectedParentSource == null || ( 
expectedParentSource instanceof ModelSource2
-                        && !pomFileModel.equals(  expectedParentSource ) ) )
+                        && !pomSource.equals(  expectedParentSource ) ) )
                     {
                         parentData = readParentExternally( childModel, 
request, problems );
                     }
diff --git 
a/maven-model-builder/src/test/java/org/apache/maven/model/building/FileModelSourceWindowsOnlyTest.java
 
b/maven-model-builder/src/test/java/org/apache/maven/model/building/FileModelSourceWindowsOnlyTest.java
new file mode 100644
index 0000000..9592cc2
--- /dev/null
+++ 
b/maven-model-builder/src/test/java/org/apache/maven/model/building/FileModelSourceWindowsOnlyTest.java
@@ -0,0 +1,59 @@
+package org.apache.maven.model.building;
+
+/*
+ * 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.io.File;
+import java.net.URI;
+import junit.framework.TestCase;
+import static junit.framework.TestCase.assertTrue;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+import org.junit.runner.RunWith;
+
+/**
+ *
+ * @author fabiano
+ */
+@RunWith(value=OnlyOnWindowsRunner.class)
+public class FileModelSourceWindowsOnlyTest {
+
+    @Rule
+    public TemporaryFolder folder = new TemporaryFolder();
+
+    public FileModelSourceWindowsOnlyTest() {
+    }
+
+    /**
+     * Test case for MNG-6261 windows case insensitive folder.
+     */
+    @Test
+    public void testCaseInsensitiveWindowsPath()
+            throws Exception {
+        File upperCaseFolder = folder.newFolder("TESTE");
+        String absolutePath = upperCaseFolder.getAbsolutePath();
+        File lowerCaseFolder = new File(absolutePath.toLowerCase());
+        
+        FileModelSource upperCaseFolderSouce = new 
FileModelSource(upperCaseFolder);
+        FileModelSource lowerCaseFolderSouce = new 
FileModelSource(lowerCaseFolder);
+
+        assertTrue(upperCaseFolderSouce.equals(lowerCaseFolderSouce));
+    }
+
+}
diff --git 
a/maven-model-builder/src/test/java/org/apache/maven/model/building/OnlyOnWindowsRunner.java
 
b/maven-model-builder/src/test/java/org/apache/maven/model/building/OnlyOnWindowsRunner.java
new file mode 100644
index 0000000..11f186d
--- /dev/null
+++ 
b/maven-model-builder/src/test/java/org/apache/maven/model/building/OnlyOnWindowsRunner.java
@@ -0,0 +1,46 @@
+package org.apache.maven.model.building;
+
+import org.apache.commons.lang3.SystemUtils;
+import org.junit.internal.runners.JUnit4ClassRunner;
+import org.junit.runner.notification.RunNotifier;
+import org.junit.runners.BlockJUnit4ClassRunner;
+import org.junit.runners.model.InitializationError;
+
+/*
+ * 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.
+ */
+
+/**
+ *
+ * @author Fabiano
+ */
+public class OnlyOnWindowsRunner extends BlockJUnit4ClassRunner 
+{
+    
+    public OnlyOnWindowsRunner(Class klass) throws InitializationError 
+    {
+        super(klass);
+    }
+    
+    @Override
+    public void run(RunNotifier notifier) {
+        if (SystemUtils.IS_OS_WINDOWS) {
+            super.run(notifier);            
+        }
+    }    
+}

Reply via email to