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

michaelo pushed a commit to branch wagon-scm-git
in repository https://gitbox.apache.org/repos/asf/maven-wagon.git

commit ca60e842b5d7f25d95663e0d6e629c69e503fc07
Author: Ilya Basin <basini...@gmail.com>
AuthorDate: Wed Feb 21 11:52:26 2018 +0300

    [WAGON-501] Add ScmGitExeWagonTest
    
    This closes #45
---
 wagon-providers/wagon-scm/pom.xml                  |   6 ++
 .../providers/scm/AbstractScmGitWagonTest.java     |  66 ++++++++++++++++++
 .../wagon/providers/scm/ScmGitExeWagonTest.java    |  75 +++++++++++++++++++++
 .../test/resources/test-repo-git/.gitattributes    |   6 ++
 .../src/test/resources/test-repo-git/HEAD          |   1 +
 .../src/test/resources/test-repo-git/config        |   8 +++
 .../src/test/resources/test-repo-git/description   |   1 +
 .../src/test/resources/test-repo-git/info/exclude  |   6 ++
 .../resources/test-repo-git/objects/.gitignore     |   0
 .../3a/67db9b159d7130f6fb7bf6588f9c2619fecafe      | Bin 0 -> 185 bytes
 .../e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391      | Bin 0 -> 18 bytes
 .../eb/e0326d9241016f3133fdf9672970ca178c640c      | Bin 0 -> 52 bytes
 .../test/resources/test-repo-git/refs/.gitignore   |   0
 .../test/resources/test-repo-git/refs/heads/master |   1 +
 14 files changed, 170 insertions(+)

diff --git a/wagon-providers/wagon-scm/pom.xml 
b/wagon-providers/wagon-scm/pom.xml
index 08894e0..ee41116 100644
--- a/wagon-providers/wagon-scm/pom.xml
+++ b/wagon-providers/wagon-scm/pom.xml
@@ -61,6 +61,12 @@ under the License.
     </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>
       <version>${mavenScmVersion}</version>
       <scope>test</scope>
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 0000000..707273c
--- /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 0000000..2cb2d84
--- /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 0000000..396883b
--- /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 0000000..cb43805
--- /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 0000000..ad4d134
--- /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 0000000..498b267
--- /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 0000000..a5196d1
--- /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 0000000..e69de29
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 0000000..48201e6
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 0000000..0b464ce
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 0000000..6859511
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 0000000..e69de29
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 0000000..af33d1e
--- /dev/null
+++ 
b/wagon-providers/wagon-scm/src/test/resources/test-repo-git/refs/heads/master
@@ -0,0 +1 @@
+3a67db9b159d7130f6fb7bf6588f9c2619fecafe

-- 
To stop receiving notification emails like this one, please contact
micha...@apache.org.

Reply via email to