maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] asfgit closed pull request #45: [WAGON-501] ScmGitExeWagonTest
Date Mon, 04 Jun 2018 11:02:55 GMT
asfgit closed pull request #45: [WAGON-501] ScmGitExeWagonTest
URL: https://github.com/apache/maven-wagon/pull/45
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/wagon-providers/wagon-scm/pom.xml b/wagon-providers/wagon-scm/pom.xml
index 08894e02..ee41116e 100644
--- a/wagon-providers/wagon-scm/pom.xml
+++ b/wagon-providers/wagon-scm/pom.xml
@@ -59,6 +59,12 @@ under the License.
       <version>${mavenScmVersion}</version>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.maven.scm</groupId>
+      <artifactId>maven-scm-provider-gitexe</artifactId>
+      <version>${mavenScmVersion}</version>
+      <scope>test</scope>
+    </dependency>
     <dependency>
       <groupId>org.apache.maven.scm</groupId>
       <artifactId>maven-scm-provider-svnexe</artifactId>
diff --git a/wagon-providers/wagon-scm/src/main/java/org/apache/maven/wagon/providers/scm/ScmWagon.java
b/wagon-providers/wagon-scm/src/main/java/org/apache/maven/wagon/providers/scm/ScmWagon.java
index 8fbbdeff..c4b08af5 100644
--- a/wagon-providers/wagon-scm/src/main/java/org/apache/maven/wagon/providers/scm/ScmWagon.java
+++ b/wagon-providers/wagon-scm/src/main/java/org/apache/maven/wagon/providers/scm/ScmWagon.java
@@ -508,7 +508,8 @@ private String checkOut( ScmProvider scmProvider, ScmRepository scmRepository,
S
             relPath += p + "/";
 
             File newDir = new File( checkoutDirectory, relPath );
-            if ( !newDir.mkdirs() )
+            newDir.mkdir();
+            if ( !newDir.isDirectory() )
             {
                 throw new TransferFailedException(
                     "Failed to create directory " + newDir.getAbsolutePath() + "; parent
should exist: "
diff --git a/wagon-providers/wagon-scm/src/test/java/org/apache/maven/wagon/providers/scm/AbstractScmGitWagonTest.java
b/wagon-providers/wagon-scm/src/test/java/org/apache/maven/wagon/providers/scm/AbstractScmGitWagonTest.java
new file mode 100644
index 00000000..3085f9ee
--- /dev/null
+++ b/wagon-providers/wagon-scm/src/test/java/org/apache/maven/wagon/providers/scm/AbstractScmGitWagonTest.java
@@ -0,0 +1,66 @@
+package org.apache.maven.wagon.providers.scm;
+
+/*
+ * 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 org.codehaus.plexus.util.FileUtils;
+
+/**
+ * Test for ScmWagon using GIT as underlying SCM
+ */
+public abstract class AbstractScmGitWagonTest
+    extends AbstractScmWagonTest
+{
+    private String repository;
+
+    protected void setUp()
+        throws Exception
+    {
+        super.setUp();
+
+        // copy the repo for the test
+
+        File origRepo = getTestFile( "target/test-classes/test-repo-git" );
+
+        File testRepo = getTestFile( "target/test-classes/test-repo-git-test" );
+
+        FileUtils.deleteDirectory( testRepo );
+
+        FileUtils.copyDirectoryStructure( origRepo, testRepo );
+
+        repository = "scm:git:" + testRepo.toPath().toUri();
+    }
+
+    protected String getScmId()
+    {
+        return "git";
+    }
+
+    protected String getTestRepositoryUrl()
+    {
+        return repository;
+    }
+
+    protected boolean supportsGetIfNewer()
+    {
+        return false;
+    }
+}
diff --git a/wagon-providers/wagon-scm/src/test/java/org/apache/maven/wagon/providers/scm/ScmGitExeWagonTest.java
b/wagon-providers/wagon-scm/src/test/java/org/apache/maven/wagon/providers/scm/ScmGitExeWagonTest.java
new file mode 100644
index 00000000..b334d0b8
--- /dev/null
+++ b/wagon-providers/wagon-scm/src/test/java/org/apache/maven/wagon/providers/scm/ScmGitExeWagonTest.java
@@ -0,0 +1,75 @@
+package org.apache.maven.wagon.providers.scm;
+
+/*
+ * 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.scm.provider.ScmProvider;
+import org.apache.maven.scm.provider.git.gitexe.GitExeScmProvider;
+
+/**
+ * Test for ScmWagon using GIT Exe as underlying SCM
+ */
+public class ScmGitExeWagonTest
+    extends AbstractScmGitWagonTest
+{
+
+    protected ScmProvider getScmProvider()
+    {
+        return new GitExeScmProvider();
+    }
+
+    @Override
+    public void testWagonGetFileList()
+        throws Exception
+    {
+        // remote list unsupported
+        // When a command is unsupported, SCM throws NoSuchCommandScmException.
+        // However, there's no equivalent exception in the Wagon API.
+        // ScmWagon wraps NoSuchCommandScmException with TransferFailedException, which gives
no specific info.
+        // TODO: WagonTestCase should somehow determine whether a command was unsupported
+        // and skip the test using org.junit.Assume
+    }
+
+    @Override
+    public void testWagonGetFileListWhenDirectoryDoesNotExist()
+        throws Exception
+    {
+        // remote list unsupported
+    }
+
+    @Override
+    public void testWagonResourceExists()
+        throws Exception
+    {
+        // remote list unsupported
+    }
+
+    @Override
+    public void testWagonResourceNotExists()
+        throws Exception
+    {
+        // remote list unsupported
+    }
+
+    @Override
+    protected boolean supportsGetIfNewer()
+    {
+        return false;
+    }
+}
diff --git a/wagon-providers/wagon-scm/src/test/resources/test-repo-git/.gitattributes b/wagon-providers/wagon-scm/src/test/resources/test-repo-git/.gitattributes
new file mode 100644
index 00000000..396883b4
--- /dev/null
+++ b/wagon-providers/wagon-scm/src/test/resources/test-repo-git/.gitattributes
@@ -0,0 +1,6 @@
+* binary
+.gitignore text diff
+.gitattributes text diff
+description text diff
+config text diff
+exclude text diff
diff --git a/wagon-providers/wagon-scm/src/test/resources/test-repo-git/HEAD b/wagon-providers/wagon-scm/src/test/resources/test-repo-git/HEAD
new file mode 100644
index 00000000..cb089cd8
--- /dev/null
+++ b/wagon-providers/wagon-scm/src/test/resources/test-repo-git/HEAD
@@ -0,0 +1 @@
+ref: refs/heads/master
diff --git a/wagon-providers/wagon-scm/src/test/resources/test-repo-git/config b/wagon-providers/wagon-scm/src/test/resources/test-repo-git/config
new file mode 100644
index 00000000..ad4d1346
--- /dev/null
+++ b/wagon-providers/wagon-scm/src/test/resources/test-repo-git/config
@@ -0,0 +1,8 @@
+[core]
+	repositoryformatversion = 0
+	filemode = true
+	bare = true
+	ignorecase = false
+	compression = 0
+[gc]
+	auto = 0
diff --git a/wagon-providers/wagon-scm/src/test/resources/test-repo-git/description b/wagon-providers/wagon-scm/src/test/resources/test-repo-git/description
new file mode 100644
index 00000000..498b267a
--- /dev/null
+++ b/wagon-providers/wagon-scm/src/test/resources/test-repo-git/description
@@ -0,0 +1 @@
+Unnamed repository; edit this file 'description' to name the repository.
diff --git a/wagon-providers/wagon-scm/src/test/resources/test-repo-git/info/exclude b/wagon-providers/wagon-scm/src/test/resources/test-repo-git/info/exclude
new file mode 100644
index 00000000..a5196d1b
--- /dev/null
+++ b/wagon-providers/wagon-scm/src/test/resources/test-repo-git/info/exclude
@@ -0,0 +1,6 @@
+# git ls-files --others --exclude-from=.git/info/exclude
+# Lines that start with '#' are comments.
+# For a project mostly in C, the following would be a good set of
+# exclude patterns (uncomment them if you want to use them):
+# *.[oa]
+# *~
diff --git a/wagon-providers/wagon-scm/src/test/resources/test-repo-git/objects/.gitignore
b/wagon-providers/wagon-scm/src/test/resources/test-repo-git/objects/.gitignore
new file mode 100644
index 00000000..e69de29b
diff --git a/wagon-providers/wagon-scm/src/test/resources/test-repo-git/objects/3a/67db9b159d7130f6fb7bf6588f9c2619fecafe
b/wagon-providers/wagon-scm/src/test/resources/test-repo-git/objects/3a/67db9b159d7130f6fb7bf6588f9c2619fecafe
new file mode 100644
index 00000000..48201e64
Binary files /dev/null and b/wagon-providers/wagon-scm/src/test/resources/test-repo-git/objects/3a/67db9b159d7130f6fb7bf6588f9c2619fecafe
differ
diff --git a/wagon-providers/wagon-scm/src/test/resources/test-repo-git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391
b/wagon-providers/wagon-scm/src/test/resources/test-repo-git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391
new file mode 100644
index 00000000..0b464cea
Binary files /dev/null and b/wagon-providers/wagon-scm/src/test/resources/test-repo-git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391
differ
diff --git a/wagon-providers/wagon-scm/src/test/resources/test-repo-git/objects/eb/e0326d9241016f3133fdf9672970ca178c640c
b/wagon-providers/wagon-scm/src/test/resources/test-repo-git/objects/eb/e0326d9241016f3133fdf9672970ca178c640c
new file mode 100644
index 00000000..6859511c
Binary files /dev/null and b/wagon-providers/wagon-scm/src/test/resources/test-repo-git/objects/eb/e0326d9241016f3133fdf9672970ca178c640c
differ
diff --git a/wagon-providers/wagon-scm/src/test/resources/test-repo-git/refs/.gitignore b/wagon-providers/wagon-scm/src/test/resources/test-repo-git/refs/.gitignore
new file mode 100644
index 00000000..e69de29b
diff --git a/wagon-providers/wagon-scm/src/test/resources/test-repo-git/refs/heads/master
b/wagon-providers/wagon-scm/src/test/resources/test-repo-git/refs/heads/master
new file mode 100644
index 00000000..5e55c502
--- /dev/null
+++ b/wagon-providers/wagon-scm/src/test/resources/test-repo-git/refs/heads/master
@@ -0,0 +1 @@
+3a67db9b159d7130f6fb7bf6588f9c2619fecafe


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message