You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by cs...@apache.org on 2022/05/20 14:56:03 UTC
[maven-scm] 01/01: [SCM-979] De-Junit 3
This is an automated email from the ASF dual-hosted git repository.
cstamas pushed a commit to branch scm-979-dejunit3
in repository https://gitbox.apache.org/repos/asf/maven-scm.git
commit 2040a2e266fb09ecc35dbb19952ff6300a5639f5
Author: Tamas Cservenak <ta...@cservenak.net>
AuthorDate: Fri May 20 16:55:18 2022 +0200
[SCM-979] De-Junit 3
Make all tests junit 4. Please dobule check,
I MAY HAVE MISSED some method named as `testxxx`.
---
.../apache/maven/scm/provider/hg/HgRepoUtils.java | 4 +-
.../hg/command/blame/HgBlameCommandTckTest.java | 2 +
.../hg/command/diff/HgDiffCommandTckTest.java | 4 +
.../scm/provider/local/LocalScmProviderTest.java | 4 +
.../checkout/LocalCheckOutCommandTckTest.java | 5 +
.../command/mkdir/LocalMkdirCommandTckTest.java | 6 +
.../command/update/LocalUpdateCommandTckTest.java | 8 +-
.../local/repository/LocalRepositoryTest.java | 12 +-
.../git/command/diff/GitDiffConsumerTest.java | 15 +-
.../repository/GitScmProviderRepositoryTest.java | 32 ++
.../gitexe/command/add/GitExeAddCommandTest.java | 7 +-
.../gitexe/command/blame/GitBlameConsumerTest.java | 13 +-
.../command/blame/GitExeBlameCommandTckTest.java | 4 +
.../command/changelog/GitChangeLogCommandTest.java | 15 +-
.../changelog/GitChangeLogConsumerTest.java | 15 +-
.../checkin/GitCheckInCommandNoBranchTest.java | 4 +
.../command/checkin/GitCheckInCommandTest.java | 6 +
.../command/checkout/GitCheckOutCommandTest.java | 2 +
.../GitExeCheckOutCommandNoBranchTest.java | 5 +
.../command/diff/GitDiffRawConsumerTest.java | 9 +-
.../gitexe/command/info/GitInfoCommandTckTest.java | 15 +-
.../remoteinfo/GitExeRemoteInfoCommandTckTest.java | 2 +
.../remoteinfo/GitRemoteInfoConsumerTest.java | 8 +-
.../command/remove/GitRemoveCommandTest.java | 4 +
.../command/remove/GitRemoveConsumerTest.java | 19 +-
.../command/status/GitStatusConsumerTest.java | 31 +-
.../git/gitexe/command/tag/GitTagCommandTest.java | 5 +-
.../GitLatestRevisionCommandConsumerTest.java | 9 +-
.../command/update/GitUpdateCommandTest.java | 5 +-
.../maven/scm/provider/git/GitScmTestUtils.java | 4 +-
.../changelog/GitChangeLogCommandTckTest.java | 10 +
.../JGitCheckInCommandCommitterAuthorTckTest.java | 11 +-
.../remoteinfo/JGitRemoteInfoCommandTckTest.java | 2 +
.../scm/provider/svn/SvnCommandUtilsTest.java | 9 +
.../scm/provider/svn/SvnTagBranchUtilsTest.java | 25 ++
.../repository/SvnScmProviderRepositoryTest.java | 29 +-
.../svnexe/command/SvnCommandLineUtilsTest.java | 3 +
.../changelog/SvnChangeLogConsumerTest.java | 23 +-
.../svnexe/command/mkdir/SvnMkdirCommandTest.java | 10 +-
.../remoteinfo/SvnExeRemoteInfoCommandTckTest.java | 2 +
.../remoteinfo/SvnRemoteInfoCommandTest.java | 6 +
.../command/update/SvnUpdateCommandTest.java | 18 ++
.../svn/command/blame/SvnBlameCommandTckTest.java | 2 +
.../svn/command/mkdir/SvnMkdirCommandTckTest.java | 11 +-
maven-scm-test/pom.xml | 1 -
.../apache/maven/scm/PlexusJUnit4TestSupport.java | 323 +++++++++++++++++++++
.../java/org/apache/maven/scm/ScmTckTestCase.java | 12 +-
.../java/org/apache/maven/scm/ScmTestCase.java | 31 +-
.../scm/tck/command/blame/BlameCommandTckTest.java | 5 +
.../tck/command/branch/BranchCommandTckTest.java | 5 +
.../command/changelog/ChangeLogCommandTckTest.java | 5 +
.../tck/command/checkin/CheckInCommandTckTest.java | 8 +
.../command/checkout/CheckOutCommandTckTest.java | 4 +
.../scm/tck/command/diff/DiffCommandTckTest.java | 6 +
.../scm/tck/command/list/ListCommandTckTest.java | 8 +
.../scm/tck/command/mkdir/MkdirCommandTckTest.java | 5 +
.../AbstractRemoteInfoCommandTckTest.java | 2 +
.../tck/command/status/StatusCommandTckTest.java | 7 +
.../scm/tck/command/tag/TagCommandTckTest.java | 5 +
.../scm/tck/command/untag/UntagCommandTckTest.java | 4 +
.../tck/command/update/UpdateCommandTckTest.java | 7 +
61 files changed, 797 insertions(+), 76 deletions(-)
diff --git a/maven-scm-providers/maven-scm-provider-hg/src/test/java/org/apache/maven/scm/provider/hg/HgRepoUtils.java b/maven-scm-providers/maven-scm-provider-hg/src/test/java/org/apache/maven/scm/provider/hg/HgRepoUtils.java
index b3d1aba6e..cc517b467 100644
--- a/maven-scm-providers/maven-scm-provider-hg/src/test/java/org/apache/maven/scm/provider/hg/HgRepoUtils.java
+++ b/maven-scm-providers/maven-scm-provider-hg/src/test/java/org/apache/maven/scm/provider/hg/HgRepoUtils.java
@@ -21,8 +21,8 @@ package org.apache.maven.scm.provider.hg;
import org.apache.maven.scm.ScmFileSet;
import org.apache.maven.scm.ScmResult;
+import org.apache.maven.scm.ScmTestCase;
import org.apache.maven.scm.provider.hg.command.HgCommandConstants;
-import org.codehaus.plexus.PlexusTestCase;
import org.codehaus.plexus.util.FileUtils;
import java.io.File;
@@ -36,7 +36,7 @@ import java.util.List;
* @author <a href="mailto:thurner.rupert@ymono.net">thurner rupert</a>
*/
public class HgRepoUtils
- extends PlexusTestCase
+ extends ScmTestCase
{
public static final String[] filesInTestBranch =
diff --git a/maven-scm-providers/maven-scm-provider-hg/src/test/java/org/apache/maven/scm/provider/hg/command/blame/HgBlameCommandTckTest.java b/maven-scm-providers/maven-scm-provider-hg/src/test/java/org/apache/maven/scm/provider/hg/command/blame/HgBlameCommandTckTest.java
index 5b8a82d8c..a1e5ae5ca 100644
--- a/maven-scm-providers/maven-scm-provider-hg/src/test/java/org/apache/maven/scm/provider/hg/command/blame/HgBlameCommandTckTest.java
+++ b/maven-scm-providers/maven-scm-provider-hg/src/test/java/org/apache/maven/scm/provider/hg/command/blame/HgBlameCommandTckTest.java
@@ -26,6 +26,8 @@ import org.apache.maven.scm.tck.command.blame.BlameCommandTckTest;
import java.util.List;
+import static org.junit.Assert.assertEquals;
+
/**
* @author Evgeny Mandrikov
*/
diff --git a/maven-scm-providers/maven-scm-provider-hg/src/test/java/org/apache/maven/scm/provider/hg/command/diff/HgDiffCommandTckTest.java b/maven-scm-providers/maven-scm-provider-hg/src/test/java/org/apache/maven/scm/provider/hg/command/diff/HgDiffCommandTckTest.java
index ddf23cb57..e671f40f0 100644
--- a/maven-scm-providers/maven-scm-provider-hg/src/test/java/org/apache/maven/scm/provider/hg/command/diff/HgDiffCommandTckTest.java
+++ b/maven-scm-providers/maven-scm-provider-hg/src/test/java/org/apache/maven/scm/provider/hg/command/diff/HgDiffCommandTckTest.java
@@ -34,6 +34,9 @@ import org.apache.maven.scm.provider.ScmProvider;
import org.apache.maven.scm.provider.hg.HgRepoUtils;
import org.apache.maven.scm.repository.ScmRepository;
import org.apache.maven.scm.tck.command.diff.DiffCommandTckTest;
+import org.junit.Test;
+
+import static org.junit.Assert.assertTrue;
public class HgDiffCommandTckTest
extends DiffCommandTckTest
@@ -50,6 +53,7 @@ public class HgDiffCommandTckTest
HgRepoUtils.initRepo();
}
+ @Test
public void testDiffCommand()
throws Exception
{
diff --git a/maven-scm-providers/maven-scm-provider-local/src/test/java/org/apache/maven/scm/provider/local/LocalScmProviderTest.java b/maven-scm-providers/maven-scm-provider-local/src/test/java/org/apache/maven/scm/provider/local/LocalScmProviderTest.java
index 22e167e5c..2ddc4f481 100644
--- a/maven-scm-providers/maven-scm-provider-local/src/test/java/org/apache/maven/scm/provider/local/LocalScmProviderTest.java
+++ b/maven-scm-providers/maven-scm-provider-local/src/test/java/org/apache/maven/scm/provider/local/LocalScmProviderTest.java
@@ -20,6 +20,9 @@ package org.apache.maven.scm.provider.local;
*/
import org.apache.maven.scm.ScmTestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
/**
* @author <a href="mailto:trygvis@inamo.no">Trygve Laugstøl</a>
@@ -28,6 +31,7 @@ import org.apache.maven.scm.ScmTestCase;
public class LocalScmProviderTest
extends ScmTestCase
{
+ @Test
public void testFixModuleName()
{
assertEquals( "my-module", LocalScmProvider.fixModuleName( "my-module" ) );
diff --git a/maven-scm-providers/maven-scm-provider-local/src/test/java/org/apache/maven/scm/provider/local/command/checkout/LocalCheckOutCommandTckTest.java b/maven-scm-providers/maven-scm-provider-local/src/test/java/org/apache/maven/scm/provider/local/command/checkout/LocalCheckOutCommandTckTest.java
index 051553358..abaaf38ef 100644
--- a/maven-scm-providers/maven-scm-provider-local/src/test/java/org/apache/maven/scm/provider/local/command/checkout/LocalCheckOutCommandTckTest.java
+++ b/maven-scm-providers/maven-scm-provider-local/src/test/java/org/apache/maven/scm/provider/local/command/checkout/LocalCheckOutCommandTckTest.java
@@ -31,6 +31,10 @@ import org.apache.maven.scm.provider.local.metadata.io.xpp3.LocalScmMetadataXpp3
import org.apache.maven.scm.tck.command.checkout.CheckOutCommandTckTest;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.IOUtil;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
/**
* @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
@@ -66,6 +70,7 @@ public class LocalCheckOutCommandTckTest
/**
* Tests that the metadata file .maven-scm-local is written correctly
*/
+ @Test
public void testMetadata()
throws Exception
{
diff --git a/maven-scm-providers/maven-scm-provider-local/src/test/java/org/apache/maven/scm/provider/local/command/mkdir/LocalMkdirCommandTckTest.java b/maven-scm-providers/maven-scm-provider-local/src/test/java/org/apache/maven/scm/provider/local/command/mkdir/LocalMkdirCommandTckTest.java
index 306753f3e..085b27283 100644
--- a/maven-scm-providers/maven-scm-provider-local/src/test/java/org/apache/maven/scm/provider/local/command/mkdir/LocalMkdirCommandTckTest.java
+++ b/maven-scm-providers/maven-scm-provider-local/src/test/java/org/apache/maven/scm/provider/local/command/mkdir/LocalMkdirCommandTckTest.java
@@ -25,6 +25,10 @@ import org.apache.maven.scm.ScmFileSet;
import org.apache.maven.scm.command.list.ListScmResult;
import org.apache.maven.scm.command.mkdir.MkdirScmResult;
import org.apache.maven.scm.tck.command.mkdir.MkdirCommandTckTest;
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
/**
* @author <a href="mailto:oching@apache.org">Maria Odea Ching</a>
@@ -61,6 +65,7 @@ public class LocalMkdirCommandTckTest
makeDirectory( workingDirectory, moduleName + "/src/test/resources" );
}
+ @Test
public void testMkdirCommandMkdirUrl()
throws Exception
{
@@ -75,6 +80,7 @@ public class LocalMkdirCommandTckTest
assertTrue( "Directory should have been found.", listResult.isSuccess() );
}
+ @Test
public void testMkdirCommandDirAlreadyAdded()
throws Exception
{
diff --git a/maven-scm-providers/maven-scm-provider-local/src/test/java/org/apache/maven/scm/provider/local/command/update/LocalUpdateCommandTckTest.java b/maven-scm-providers/maven-scm-provider-local/src/test/java/org/apache/maven/scm/provider/local/command/update/LocalUpdateCommandTckTest.java
index 86a547695..b6b15aa0d 100644
--- a/maven-scm-providers/maven-scm-provider-local/src/test/java/org/apache/maven/scm/provider/local/command/update/LocalUpdateCommandTckTest.java
+++ b/maven-scm-providers/maven-scm-provider-local/src/test/java/org/apache/maven/scm/provider/local/command/update/LocalUpdateCommandTckTest.java
@@ -38,6 +38,12 @@ import org.apache.maven.scm.repository.ScmRepository;
import org.apache.maven.scm.tck.command.update.UpdateCommandTckTest;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.IOUtil;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
/**
* @author <a href="mailto:trygvis@inamo.no">Trygve Laugstøl</a>
@@ -64,6 +70,7 @@ public class LocalUpdateCommandTckTest
* Tests that a file that has been deleted from repository after checkout will be removed by scm-local. Local
* additions must not be deleted.
*/
+ @Test
public void testDeletion()
throws Exception
{
@@ -150,7 +157,6 @@ public class LocalUpdateCommandTckTest
}
-
private void makeRepo( File workingDirectory )
throws Exception
{
diff --git a/maven-scm-providers/maven-scm-provider-local/src/test/java/org/apache/maven/scm/provider/local/repository/LocalRepositoryTest.java b/maven-scm-providers/maven-scm-provider-local/src/test/java/org/apache/maven/scm/provider/local/repository/LocalRepositoryTest.java
index 98c2ccac1..e3c8d5a6a 100644
--- a/maven-scm-providers/maven-scm-provider-local/src/test/java/org/apache/maven/scm/provider/local/repository/LocalRepositoryTest.java
+++ b/maven-scm-providers/maven-scm-provider-local/src/test/java/org/apache/maven/scm/provider/local/repository/LocalRepositoryTest.java
@@ -24,6 +24,12 @@ import org.apache.maven.scm.provider.ScmProviderRepository;
import org.apache.maven.scm.repository.ScmRepository;
import org.apache.maven.scm.repository.ScmRepositoryException;
import org.codehaus.plexus.util.FileUtils;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
/**
* @author <a href="mailto:trygvis@inamo.no">Trygve Laugstøl</a>
@@ -40,6 +46,7 @@ public class LocalRepositoryTest
FileUtils.mkdir( getWorkingDirectory().getAbsolutePath() );
}
+ @Test
public void testExistingRepository()
throws Exception
{
@@ -62,6 +69,7 @@ public class LocalRepositoryTest
assertEquals( "test-repo", local.getModule() );
}
+ @Test
public void testMissingRepositoryRoot()
throws Exception
{
@@ -77,6 +85,7 @@ public class LocalRepositoryTest
}
}
+ @Test
public void testNonExistingMissingRepositoryRoot()
throws Exception
{
@@ -92,6 +101,7 @@ public class LocalRepositoryTest
}
}
+ @Test
public void testMissingModule()
throws Exception
{
@@ -118,7 +128,7 @@ public class LocalRepositoryTest
}
}
-
+ @Test
public void testNonExistingModule()
throws Exception
{
diff --git a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/src/test/java/org/apache/maven/scm/provider/git/command/diff/GitDiffConsumerTest.java b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/src/test/java/org/apache/maven/scm/provider/git/command/diff/GitDiffConsumerTest.java
index 9fee581b2..e43222bba 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/src/test/java/org/apache/maven/scm/provider/git/command/diff/GitDiffConsumerTest.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/src/test/java/org/apache/maven/scm/provider/git/command/diff/GitDiffConsumerTest.java
@@ -21,20 +21,25 @@ package org.apache.maven.scm.provider.git.command.diff;
import org.apache.maven.scm.ScmFile;
import org.apache.maven.scm.ScmFileStatus;
+import org.apache.maven.scm.ScmTestCase;
import org.apache.maven.scm.util.ConsumerUtils;
-import org.codehaus.plexus.PlexusTestCase;
+import org.junit.Test;
import java.io.File;
import java.util.List;
import java.util.Map;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
/**
* @author <a href="mailto:struberg@yahoo.de">Mark Struberg</a>
*/
public class GitDiffConsumerTest
- extends PlexusTestCase
+ extends ScmTestCase
{
-
+ @Test
public void testEmptyLogConsumer()
throws Exception
{
@@ -49,6 +54,7 @@ public class GitDiffConsumerTest
assertEquals( 0, changedFiles.size() );
}
+ @Test
public void testLog1Consumer()
throws Exception
{
@@ -62,7 +68,7 @@ public class GitDiffConsumerTest
assertEquals( 1, changedFiles.size() );
- testScmFile( (ScmFile) changedFiles.get( 0 ), "olamy.test", ScmFileStatus.MODIFIED );
+ testScmFile( changedFiles.get( 0 ), "olamy.test", ScmFileStatus.MODIFIED );
Map<String,CharSequence> differences = consumer.getDifferences();
assertNotNull( differences );
@@ -72,6 +78,7 @@ public class GitDiffConsumerTest
assertTrue( readmeDiffs.indexOf( "+new line" ) >= 0 );
}
+ @Test
public void testLog2Consumer()
throws Exception
{
diff --git a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/src/test/java/org/apache/maven/scm/provider/git/repository/GitScmProviderRepositoryTest.java b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/src/test/java/org/apache/maven/scm/provider/git/repository/GitScmProviderRepositoryTest.java
index 2efe7555b..d813c00b1 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/src/test/java/org/apache/maven/scm/provider/git/repository/GitScmProviderRepositoryTest.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/src/test/java/org/apache/maven/scm/provider/git/repository/GitScmProviderRepositoryTest.java
@@ -24,6 +24,13 @@ import org.apache.maven.scm.manager.NoSuchScmProviderException;
import org.apache.maven.scm.manager.ScmManager;
import org.apache.maven.scm.repository.ScmRepository;
import org.apache.maven.scm.repository.ScmRepositoryException;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
/**
* @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
@@ -46,24 +53,28 @@ public class GitScmProviderRepositoryTest
// Testing legal URLs
// ----------------------------------------------------------------------
+ @Test
public void testLegalFileURL()
throws Exception
{
testUrl( "scm:git:file:///tmp/repo", null, "file:///tmp/repo", null, null, null, null, 0, null);
}
+ @Test
public void testLegalFileHomeURL()
throws Exception
{
testUrl( "scm:git:file://~/repo", null, "file://~/repo", null, null, null, null, 0, null);
}
+ @Test
public void testLegalSshHomeURL()
throws Exception
{
testUrl( "scm:git:ssh://~/repo", null, "ssh://~/repo", null, null, null, null, 0, null);
}
+ @Test
public void testLegalLocalhostFileURL()
throws Exception
{
@@ -71,6 +82,7 @@ public class GitScmProviderRepositoryTest
null, null, 0, "somedirectory/tmp/repo");
}
+ @Test
public void testLegalHistnameFileURL()
throws Exception
{
@@ -78,6 +90,7 @@ public class GitScmProviderRepositoryTest
null, null, 0, "my_server/tmp/repo");
}
+ @Test
public void testLegalHttpURL()
throws Exception
{
@@ -85,6 +98,7 @@ public class GitScmProviderRepositoryTest
null, "gitrepos.apache.org", 0, null);
}
+ @Test
public void testLegalHttpURLWithUser()
throws Exception
{
@@ -92,6 +106,7 @@ public class GitScmProviderRepositoryTest
null, "gitrepos.apache.org", 0, null);
}
+ @Test
public void testLegalHttpURLWithUserPassword()
throws Exception
{
@@ -99,6 +114,7 @@ public class GitScmProviderRepositoryTest
null, "user", "password", "gitrepos.apache.org", 0, null);
}
+ @Test
public void testLegalHttpsURL()
throws Exception
{
@@ -106,6 +122,7 @@ public class GitScmProviderRepositoryTest
null, "gitrepos.apache.org", 0, "repos/projectA");
}
+ @Test
public void testLegalFileWindowsURL()
throws Exception
{
@@ -113,6 +130,7 @@ public class GitScmProviderRepositoryTest
testUrl( "scm:git:file://c:\\tmp\\repo", null, "file://c:\\tmp\\repo", null, null, null, null, 0, null);
}
+ @Test
public void testLegalHttpsURLWithUser()
throws Exception
{
@@ -120,6 +138,7 @@ public class GitScmProviderRepositoryTest
null, "gitrepos.apache.org", 0, null);
}
+ @Test
public void testLegalHttpsURLWithUserPassword()
throws Exception
{
@@ -127,6 +146,7 @@ public class GitScmProviderRepositoryTest
null, "user", "password", "gitrepos.apache.org", 0, null);
}
+ @Test
public void testLegalSshURLWithUser()
throws Exception
{
@@ -134,6 +154,7 @@ public class GitScmProviderRepositoryTest
null, "gitrepos.apache.org", 0, null);
}
+ @Test
public void testLegalSshURLWithUserPassword()
throws Exception
{
@@ -141,6 +162,7 @@ public class GitScmProviderRepositoryTest
null, "user", "password", "gitrepos.apache.org", 0, null);
}
+ @Test
public void testLegalGitURL()
throws Exception
{
@@ -148,6 +170,7 @@ public class GitScmProviderRepositoryTest
null, "gitrepos.apache.org", 0, null);
}
+ @Test
public void testGitDevURL()
throws Exception, ScmRepositoryException
{
@@ -155,6 +178,7 @@ public class GitScmProviderRepositoryTest
null, "git@github.com:olamy/scm-git-test-one-module.git", null, "git" , null, "github.com", 0, null);
}
+ @Test
public void testGitDevURLWIthPort()
throws Exception, ScmRepositoryException
{
@@ -163,6 +187,7 @@ public class GitScmProviderRepositoryTest
}
// For SCM-639
+ @Test
public void testGitDevUrlWithNumberedRepoAndNoPort()
throws Exception, ScmRepositoryException
{
@@ -172,6 +197,7 @@ public class GitScmProviderRepositoryTest
// For SCM-629
+ @Test
public void testGitDevUrlWithNumberedRepoAndMinus()
throws Exception, ScmRepositoryException
{
@@ -180,6 +206,7 @@ public class GitScmProviderRepositoryTest
}
// For SCM-707
+ @Test
public void testSpecialCharacters()
throws Exception
{
@@ -193,6 +220,7 @@ public class GitScmProviderRepositoryTest
}
+ @Test
public void testLegalGitPortUrl()
throws Exception
{
@@ -220,6 +248,7 @@ public class GitScmProviderRepositoryTest
}
+ @Test
public void testUsernameWithAtAndPasswordInUrl() throws ScmRepositoryException, Exception{
testUrl( "scm:git:http://username@site.com:password@gitrepos.apache.org:8800/pmgt/trunk",
null, "http://username%40site.com:password@gitrepos.apache.org:8800/pmgt/trunk",
@@ -231,6 +260,7 @@ public class GitScmProviderRepositoryTest
// the following tests are for combined fetch + push URLs
// ----------------------------------------------------------------------
+ @Test
public void testHttpFetchSshPushUrl()
throws Exception
{
@@ -251,6 +281,8 @@ public class GitScmProviderRepositoryTest
//X in fact this url is perfectly valid from a technical perspective
//X it will be interpreted by git as git://file/tmp/git
+ @Test
+ @Ignore
public void nottestIllegalFileUrl()
throws Exception
{
diff --git a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/add/GitExeAddCommandTest.java b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/add/GitExeAddCommandTest.java
index c57c58fb4..3fe0d2414 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/add/GitExeAddCommandTest.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/add/GitExeAddCommandTest.java
@@ -6,6 +6,7 @@ import java.util.List;
import org.apache.maven.scm.ScmTestCase;
import org.codehaus.plexus.util.cli.Commandline;
+import org.junit.Test;
/*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -35,7 +36,8 @@ import org.codehaus.plexus.util.cli.Commandline;
public class GitExeAddCommandTest
extends ScmTestCase
{
-
+
+ @Test
public void testAddCommandSingleFile() throws Exception
{
List<File> files = new ArrayList<File>();
@@ -44,7 +46,8 @@ public class GitExeAddCommandTest
testCommandLine( "scm:git:http://foo.com/git", files, "git add -- myFile.java" );
}
-
+
+ @Test
public void testAddCommandMultipleFiles() throws Exception
{
List<File> files = new ArrayList<File>();
diff --git a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/blame/GitBlameConsumerTest.java b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/blame/GitBlameConsumerTest.java
index a17713813..e3f29a022 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/blame/GitBlameConsumerTest.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/blame/GitBlameConsumerTest.java
@@ -19,10 +19,11 @@ package org.apache.maven.scm.provider.git.gitexe.command.blame;
* under the License.
*/
+import org.apache.maven.scm.ScmTestCase;
import org.apache.maven.scm.command.blame.BlameLine;
import org.apache.maven.scm.util.ConsumerUtils;
-import org.codehaus.plexus.PlexusTestCase;
import org.junit.Assert;
+import org.junit.Test;
import java.io.BufferedReader;
import java.io.File;
@@ -33,14 +34,17 @@ import java.util.Iterator;
import java.util.List;
import java.util.TimeZone;
+import static org.junit.Assert.fail;
+
/**
* Test the {@link GitBlameConsumer} in various different situations.
* Depending on the underlying operating system we might get
* slightly different output from a <pre>git blame</pre> commandline invocation.
*/
public class GitBlameConsumerTest
- extends PlexusTestCase
+ extends ScmTestCase
{
+ @Test
public void testConsumerEasy()
throws Exception
{
@@ -54,6 +58,7 @@ public class GitBlameConsumerTest
Assert.assertNotNull( blameLine.getDate() );
}
+ @Test
public void testConsumer()
throws Exception
{
@@ -71,6 +76,7 @@ public class GitBlameConsumerTest
* Test what happens if a git-blame command got invoked on a
* file which has no content.
*/
+ @Test
public void testConsumerEmptyFile()
throws Exception
{
@@ -83,6 +89,7 @@ public class GitBlameConsumerTest
* Test what happens if a git-blame command got invoked on a
* file which didn't got added to the git repo yet.
*/
+ @Test
public void testConsumerOnNewFile()
throws Exception
{
@@ -98,6 +105,7 @@ public class GitBlameConsumerTest
/**
* Test a case where the committer and author are different persons
*/
+ @Test
public void testConsumerWithDifferentAuthor()
throws Exception
{
@@ -121,6 +129,7 @@ public class GitBlameConsumerTest
* This unit test compares the output of our new parsing with a
* simplified git blame output.
*/
+ @Test
public void testConsumerCompareWithOriginal() throws Exception
{
GitBlameConsumer consumer = consumeFile( "/src/test/resources/git/blame/git-blame-2.out" );
diff --git a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/blame/GitExeBlameCommandTckTest.java b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/blame/GitExeBlameCommandTckTest.java
index eb365fa44..6642b17df 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/blame/GitExeBlameCommandTckTest.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/blame/GitExeBlameCommandTckTest.java
@@ -23,9 +23,12 @@ import org.apache.maven.scm.command.blame.BlameLine;
import org.apache.maven.scm.command.blame.BlameScmResult;
import org.apache.maven.scm.provider.git.GitScmTestUtils;
import org.apache.maven.scm.provider.git.command.blame.GitBlameCommandTckTest;
+import org.junit.Test;
import java.util.List;
+import static org.junit.Assert.assertEquals;
+
/**
* @author Evgeny Mandrikov
*/
@@ -38,6 +41,7 @@ public class GitExeBlameCommandTckTest
return GitScmTestUtils.getScmUrl( getRepositoryRoot(), "git" );
}
+ @Test
public void testBlameCommand()
throws Exception
{
diff --git a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/changelog/GitChangeLogCommandTest.java b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/changelog/GitChangeLogCommandTest.java
index 820e000f6..4fccaf4c2 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/changelog/GitChangeLogCommandTest.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/changelog/GitChangeLogCommandTest.java
@@ -26,6 +26,7 @@ import org.apache.maven.scm.ScmVersion;
import org.apache.maven.scm.provider.git.repository.GitScmProviderRepository;
import org.apache.maven.scm.repository.ScmRepository;
import org.codehaus.plexus.util.cli.Commandline;
+import org.junit.Test;
import java.io.File;
import java.util.Calendar;
@@ -47,6 +48,7 @@ public class GitChangeLogCommandTest
workingDirectory = getTestFile( "target/git-update-command-test" );
}
+ @Test
public void testCommandLineNoDates()
throws Exception
{
@@ -54,6 +56,7 @@ public class GitChangeLogCommandTest
"git whatchanged --format=medium --date=iso --max-count=40 -- ." );
}
+ @Test
public void testCommandLineNoDatesLimitedCount()
throws Exception
{
@@ -61,6 +64,7 @@ public class GitChangeLogCommandTest
"git whatchanged --format=medium --date=iso -- ." );
}
+ @Test
public void testCommandLineWithDates()
throws Exception
{
@@ -71,6 +75,7 @@ public class GitChangeLogCommandTest
"git whatchanged --format=medium \"--since=2003-09-10 00:00:00 +0000\" \"--until=2007-10-10 00:00:00 +0000\" --date=iso -- ." );
}
+ @Test
public void testCommandLineStartDateOnly()
throws Exception
{
@@ -80,6 +85,7 @@ public class GitChangeLogCommandTest
"git whatchanged --format=medium \"--since=2003-09-10 01:01:01 +0000\" --date=iso -- ." );
}
+ @Test
public void testCommandLineDateFormat()
throws Exception
{
@@ -90,6 +96,7 @@ public class GitChangeLogCommandTest
"git whatchanged --format=medium \"--since=2003-09-10 01:01:01 +0000\" \"--until=2005-11-13 23:23:23 +0000\" --date=iso -- ." );
}
+ @Test
public void testCommandLineDateVersionRanges()
throws Exception
{
@@ -99,7 +106,8 @@ public class GitChangeLogCommandTest
testCommandLine( "scm:git:http://foo.com/git", null, startDate, endDate, new ScmRevision( "1" ), new ScmRevision( "10" ),
"git whatchanged --format=medium \"--since=2003-09-10 01:01:01 +0000\" \"--until=2005-11-13 23:23:23 +0000\" --date=iso 1..10 -- ." );
}
-
+
+ @Test
public void testCommandLineEndDateOnly()
throws Exception
{
@@ -110,6 +118,7 @@ public class GitChangeLogCommandTest
"git whatchanged --format=medium \"--until=2003-11-10 00:00:00 +0000\" --date=iso -- ." );
}
+ @Test
public void testCommandLineWithBranchNoDates()
throws Exception
{
@@ -118,6 +127,7 @@ public class GitChangeLogCommandTest
}
+ @Test
public void testCommandLineWithStartVersion()
throws Exception
{
@@ -125,6 +135,7 @@ public class GitChangeLogCommandTest
"git whatchanged --format=medium --date=iso 1.. -- ." );
}
+ @Test
public void testCommandLineWithStartVersionAndEndVersion()
throws Exception
{
@@ -132,6 +143,7 @@ public class GitChangeLogCommandTest
"git whatchanged --format=medium --date=iso 1..10 -- ." );
}
+ @Test
public void testCommandLineWithStartVersionAndEndVersionEquals()
throws Exception
{
@@ -139,6 +151,7 @@ public class GitChangeLogCommandTest
"git whatchanged --format=medium --date=iso 1..1 -- ." );
}
+ @Test
public void testCommandLineWithStartVersionAndEndVersionAndBranch()
throws Exception
{
diff --git a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/changelog/GitChangeLogConsumerTest.java b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/changelog/GitChangeLogConsumerTest.java
index 6231071b1..2bac95785 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/changelog/GitChangeLogConsumerTest.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/changelog/GitChangeLogConsumerTest.java
@@ -22,9 +22,9 @@ package org.apache.maven.scm.provider.git.gitexe.command.changelog;
import org.apache.maven.scm.ChangeFile;
import org.apache.maven.scm.ChangeSet;
import org.apache.maven.scm.ScmFileStatus;
+import org.apache.maven.scm.ScmTestCase;
import org.apache.maven.scm.util.ConsumerUtils;
-import org.codehaus.plexus.PlexusTestCase;
-import org.junit.Assert;
+import org.junit.Test;
import java.io.File;
import java.text.SimpleDateFormat;
@@ -37,13 +37,19 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
/**
* @author <a href="mailto:struberg@yahoo.de">Mark Struberg</a>
*/
public class GitChangeLogConsumerTest
- extends PlexusTestCase
+ extends ScmTestCase
{
+ @Test
public void testConsumer1()
throws Exception
{
@@ -101,6 +107,7 @@ public class GitChangeLogConsumerTest
assertTrue( cf.getRevision() != null && cf.getRevision().length() > 0 );
}
+ @Test
public void testConsumer2()
throws Exception
{
@@ -140,7 +147,7 @@ public class GitChangeLogConsumerTest
summary.get( action ).incrementAndGet();
}
}
- Assert.assertEquals( "Action summary differs from expectations", "{modified=21, added=88, deleted=1}",
+ assertEquals( "Action summary differs from expectations", "{modified=21, added=88, deleted=1}",
summary.toString() );
assertEquals( 8, modifications.size() );
diff --git a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/checkin/GitCheckInCommandNoBranchTest.java b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/checkin/GitCheckInCommandNoBranchTest.java
index 3a30cb62e..c4186475e 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/checkin/GitCheckInCommandNoBranchTest.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/checkin/GitCheckInCommandNoBranchTest.java
@@ -28,9 +28,12 @@ import org.apache.maven.scm.command.checkout.CheckOutScmResult;
import org.apache.maven.scm.provider.git.GitScmTestUtils;
import org.apache.maven.scm.repository.ScmRepository;
import org.codehaus.plexus.util.FileUtils;
+import org.junit.Test;
import java.io.File;
+import static org.junit.Assert.assertEquals;
+
/**
* @author Bertrand Paquet
*/
@@ -48,6 +51,7 @@ public class GitCheckInCommandNoBranchTest
workingDirectory = new File( "target/checkin-nobranch" );
}
+ @Test
public void testCheckinNoBranch()
throws Exception
{
diff --git a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/checkin/GitCheckInCommandTest.java b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/checkin/GitCheckInCommandTest.java
index 07dbfdbd0..c284bc944 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/checkin/GitCheckInCommandTest.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/checkin/GitCheckInCommandTest.java
@@ -32,9 +32,12 @@ import org.apache.maven.scm.provider.git.util.GitUtil;
import org.apache.maven.scm.repository.ScmRepository;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.cli.Commandline;
+import org.junit.Test;
import java.io.File;
+import static org.junit.Assert.assertTrue;
+
/**
* @author <a href="mailto:trygvis@inamo.no">Trygve Laugstøl</a>
*/
@@ -60,6 +63,7 @@ public class GitCheckInCommandTest
messageFileString = "-F " + path;
}
+ @Test
public void testCommandLineWithoutTag()
throws Exception
{
@@ -73,6 +77,7 @@ public class GitCheckInCommandTest
}
}
+ @Test
public void testCommandLineWithUsername()
throws Exception
{
@@ -89,6 +94,7 @@ public class GitCheckInCommandTest
}
// Test reproducing SCM-694
+ @Test
public void testCheckinAfterRename() throws Exception {
File repo = getRepositoryRoot();
File checkedOutRepo = getWorkingCopy();
diff --git a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/checkout/GitCheckOutCommandTest.java b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/checkout/GitCheckOutCommandTest.java
index d4f940985..f3b2129b0 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/checkout/GitCheckOutCommandTest.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/checkout/GitCheckOutCommandTest.java
@@ -25,6 +25,7 @@ import org.apache.maven.scm.manager.ScmManager;
import org.apache.maven.scm.provider.git.repository.GitScmProviderRepository;
import org.apache.maven.scm.repository.ScmRepository;
import org.codehaus.plexus.util.cli.Commandline;
+import org.junit.Test;
import java.io.File;
@@ -53,6 +54,7 @@ public class GitCheckOutCommandTest
//
// ----------------------------------------------------------------------
+ @Test
public void testCommandLineWithBranch()
throws Exception
{
diff --git a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/checkout/GitExeCheckOutCommandNoBranchTest.java b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/checkout/GitExeCheckOutCommandNoBranchTest.java
index 7b02bb873..ce746b3f2 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/checkout/GitExeCheckOutCommandNoBranchTest.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/checkout/GitExeCheckOutCommandNoBranchTest.java
@@ -25,9 +25,12 @@ import org.apache.maven.scm.ScmVersion;
import org.apache.maven.scm.command.checkout.CheckOutScmResult;
import org.apache.maven.scm.repository.ScmRepository;
import org.codehaus.plexus.util.FileUtils;
+import org.junit.Test;
import java.io.File;
+import static org.junit.Assert.assertEquals;
+
/**
* @author Bertrand Paquet
*
@@ -54,6 +57,7 @@ public class GitExeCheckOutCommandNoBranchTest
repo.toPath().toAbsolutePath().toUri().toASCIIString() );
}
+ @Test
public void testCheckoutNoBranch()
throws Exception
{
@@ -66,6 +70,7 @@ public class GitExeCheckOutCommandNoBranchTest
assertEquals( 0, result.getCheckedOutFiles().size() );
}
+ @Test
public void testDoubleCheckoutNoBranch()
throws Exception
{
diff --git a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/diff/GitDiffRawConsumerTest.java b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/diff/GitDiffRawConsumerTest.java
index 40d44adef..12f4924c9 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/diff/GitDiffRawConsumerTest.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/diff/GitDiffRawConsumerTest.java
@@ -6,8 +6,11 @@ import java.io.Reader;
import java.util.List;
import org.apache.maven.scm.ScmFile;
-import org.codehaus.plexus.PlexusTestCase;
+import org.apache.maven.scm.ScmTestCase;
import org.codehaus.plexus.util.ReaderFactory;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
/*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -32,12 +35,12 @@ import org.codehaus.plexus.util.ReaderFactory;
* @author <a href="mailto:struberg@yahoo.de">Mark Struberg</a>
*/
public class GitDiffRawConsumerTest
- extends PlexusTestCase
+ extends ScmTestCase
{
+ @Test
public void testUpToDate()
throws Exception
{
-
GitDiffRawConsumer consumer = buildGitDiffRawConsumer("/src/test/resources/git/diff/git-diff-raw_long.out");
List<ScmFile> changedFiles = consumer.getChangedFiles();
diff --git a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/info/GitInfoCommandTckTest.java b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/info/GitInfoCommandTckTest.java
index 7d853ebfc..ce5a03646 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/info/GitInfoCommandTckTest.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/info/GitInfoCommandTckTest.java
@@ -27,10 +27,14 @@ import org.apache.maven.scm.command.info.InfoScmResult;
import org.apache.maven.scm.provider.ScmProvider;
import org.apache.maven.scm.provider.ScmProviderRepository;
import org.apache.maven.scm.provider.git.GitScmTestUtils;
-import org.codehaus.plexus.PlexusTestCase;
+import org.junit.Test;
import java.io.File;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
/**
* @author Olivier Lamy
*/
@@ -38,6 +42,7 @@ public class GitInfoCommandTckTest
extends ScmTestCase
{
+ @Test
public void testInfoCommand()
throws Exception
{
@@ -53,6 +58,7 @@ public class GitInfoCommandTckTest
//
}
+ @Test
public void testInfoCommandWithShortRevision()
throws Exception
{
@@ -69,6 +75,7 @@ public class GitInfoCommandTckTest
result.getInfoItems().get( 0 ).getRevision() );
}
+ @Test
public void testInfoCommandWithNegativeShortRevision()
throws Exception
{
@@ -85,7 +92,7 @@ public class GitInfoCommandTckTest
result.getInfoItems().get( 0 ).getRevision() );
}
-
+ @Test
public void testInfoCommandWithZeroShortRevision()
throws Exception
{
@@ -104,7 +111,7 @@ public class GitInfoCommandTckTest
protected File getRepositoryRoot()
{
- return PlexusTestCase.getTestFile( "target/scm-test/repository/git/info" );
+ return getTestFile( "target/scm-test/repository/git/info" );
}
public String getScmUrl()
@@ -115,6 +122,6 @@ public class GitInfoCommandTckTest
protected File getWorkingCopy()
{
- return PlexusTestCase.getTestFile( "target/scm-test/git/info" );
+ return getTestFile( "target/scm-test/git/info" );
}
}
diff --git a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/remoteinfo/GitExeRemoteInfoCommandTckTest.java b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/remoteinfo/GitExeRemoteInfoCommandTckTest.java
index 01a28f371..c6d84ea15 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/remoteinfo/GitExeRemoteInfoCommandTckTest.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/remoteinfo/GitExeRemoteInfoCommandTckTest.java
@@ -23,6 +23,8 @@ import org.apache.maven.scm.command.remoteinfo.RemoteInfoScmResult;
import org.apache.maven.scm.provider.git.GitScmTestUtils;
import org.apache.maven.scm.provider.git.command.remoteinfo.AbstractGitRemoteInfoCommandTckTest;
+import static org.junit.Assert.assertEquals;
+
/**
* @author Bertrand Paquet
*/
diff --git a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/remoteinfo/GitRemoteInfoConsumerTest.java b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/remoteinfo/GitRemoteInfoConsumerTest.java
index df02e5325..e21074c9a 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/remoteinfo/GitRemoteInfoConsumerTest.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/remoteinfo/GitRemoteInfoConsumerTest.java
@@ -19,16 +19,20 @@ package org.apache.maven.scm.provider.git.gitexe.command.remoteinfo;
* under the License.
*/
+import org.apache.maven.scm.ScmTestCase;
import org.apache.maven.scm.command.remoteinfo.RemoteInfoScmResult;
-import org.codehaus.plexus.PlexusTestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
/**
* @author Bertrand Paquet
*/
public class GitRemoteInfoConsumerTest
- extends PlexusTestCase
+ extends ScmTestCase
{
+ @Test
public void testConsumerRemoteInfo()
{
GitRemoteInfoConsumer consumer = new GitRemoteInfoConsumer( null );
diff --git a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/remove/GitRemoveCommandTest.java b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/remove/GitRemoveCommandTest.java
index 65c0d8523..eaeb2bac8 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/remove/GitRemoveCommandTest.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/remove/GitRemoveCommandTest.java
@@ -22,6 +22,7 @@ package org.apache.maven.scm.provider.git.gitexe.command.remove;
import org.apache.maven.scm.ScmTestCase;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.cli.Commandline;
+import org.junit.Test;
import java.io.File;
import java.io.IOException;
@@ -34,6 +35,7 @@ public class GitRemoveCommandTest
extends ScmTestCase
{
+ @Test
public void testCommandRemoveWithFile()
throws Exception
{
@@ -49,6 +51,7 @@ public class GitRemoveCommandTest
FileUtils.deleteDirectory( workingDirectory );
}
+ @Test
public void testCommandRemoveWithDirectory()
throws Exception
{
@@ -64,6 +67,7 @@ public class GitRemoveCommandTest
FileUtils.deleteDirectory( workingDirectory );
}
+ @Test
public void testCommandRemoveWithTwoDirectory()
throws Exception
{
diff --git a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/remove/GitRemoveConsumerTest.java b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/remove/GitRemoveConsumerTest.java
index 6b5fd3741..64be3cf3f 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/remove/GitRemoveConsumerTest.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/remove/GitRemoveConsumerTest.java
@@ -21,20 +21,25 @@ package org.apache.maven.scm.provider.git.gitexe.command.remove;
import org.apache.maven.scm.ScmFile;
import org.apache.maven.scm.ScmFileStatus;
+import org.apache.maven.scm.ScmTestCase;
import org.apache.maven.scm.util.ConsumerUtils;
-import org.codehaus.plexus.PlexusTestCase;
+import org.junit.Test;
import java.io.File;
import java.util.List;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
/**
* @author <a href="mailto:struberg@yahoo.de">Mark Struberg</a>
*/
public class GitRemoveConsumerTest
- extends PlexusTestCase
+ extends ScmTestCase
{
-
- public void testConsumerRemovedFile()
+
+ @Test
+ public void testConsumerRemovedFile()
{
GitRemoveConsumer consumer = new GitRemoveConsumer();
@@ -45,7 +50,8 @@ public class GitRemoveConsumerTest
assertNotNull( changedFiles );
assertEquals( 1, changedFiles.size() );
}
-
+
+ @Test
public void testLog1Consumer()
throws Exception
{
@@ -62,7 +68,8 @@ public class GitRemoveConsumerTest
testScmFile( (ScmFile) changedFiles.get( 0 ), "src/main/java/Application.java", ScmFileStatus.DELETED );
testScmFile( (ScmFile) changedFiles.get( 1 ), "src/test/java/Test.java" , ScmFileStatus.DELETED );
}
-
+
+ @Test
public void testEmptyLogConsumer()
throws Exception
{
diff --git a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/status/GitStatusConsumerTest.java b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/status/GitStatusConsumerTest.java
index f206589df..3c12edcec 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/status/GitStatusConsumerTest.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/status/GitStatusConsumerTest.java
@@ -32,13 +32,17 @@ import org.apache.commons.io.FileUtils;
import org.apache.maven.scm.ScmFile;
import org.apache.maven.scm.ScmFileStatus;
import org.apache.maven.scm.ScmFileSet;
-import org.codehaus.plexus.PlexusTestCase;
+import org.apache.maven.scm.ScmTestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
/**
* @author <a href="mailto:struberg@yahoo.de">Mark Struberg</a>
*/
public class GitStatusConsumerTest
- extends PlexusTestCase
+ extends ScmTestCase
{
private List<ScmFile> getChangedFiles( File gitlog )
@@ -95,6 +99,7 @@ public class GitStatusConsumerTest
return consumer.getChangedFiles();
}
+ @Test
public void testConsumerUntrackedFile()
{
List<ScmFile> changedFiles = getChangedFiles( "?? project.xml", null );
@@ -108,6 +113,7 @@ public class GitStatusConsumerTest
assertEquals( 0, changedFiles.size() );
}
+ @Test
public void testConsumerAddedFile()
{
List<ScmFile> changedFiles = getChangedFiles( "A project.xml", null );
@@ -123,6 +129,7 @@ public class GitStatusConsumerTest
assertEquals("test file with spaces and a special \u007f character.xml", changedFiles.get( 0 ).getPath() );
}
+ @Test
public void testConsumerAddedAndModifiedFile()
{
List<ScmFile> changedFiles = getChangedFiles( "AM project.xml", null );
@@ -139,6 +146,7 @@ public class GitStatusConsumerTest
"test file with spaces and a special \u007f character.xml", ScmFileStatus.ADDED );
}
+ @Test
public void testConsumerAddedFileWithDirectoryAndNoFile()
throws IOException
{
@@ -157,6 +165,7 @@ public class GitStatusConsumerTest
FileUtils.deleteDirectory( dir );
}
+ @Test
public void testConsumerAddedFileWithDirectoryAndFile()
throws IOException
{
@@ -181,6 +190,7 @@ public class GitStatusConsumerTest
FileUtils.deleteDirectory( dir );
}
+ @Test
public void testConsumerModifiedFile()
{
List<ScmFile> changedFiles = getChangedFiles( "M project.xml", null );
@@ -196,6 +206,7 @@ public class GitStatusConsumerTest
assertEquals("test file with spaces and a special \u007f character.xml", changedFiles.get( 0 ).getPath() );
}
+ @Test
public void testURI()
throws Exception
{
@@ -204,6 +215,7 @@ public class GitStatusConsumerTest
assertEquals( path, u.getPath() );
}
+ @Test
public void testConsumerWithFileSet()
throws IOException
{
@@ -228,6 +240,7 @@ public class GitStatusConsumerTest
}
// SCM-740
+ @Test
public void testConsumerModifiedFileInComplexDirectorySetup() throws IOException {
File dir = createTempDirectory();
@@ -255,6 +268,7 @@ public class GitStatusConsumerTest
FileUtils.deleteDirectory( dir );
}
+ @Test
public void testConsumerModifiedFileInComplexDirectoryWithSpaces() throws IOException {
File dir = createTempDirectory();
@@ -285,6 +299,7 @@ public class GitStatusConsumerTest
FileUtils.deleteDirectory( dir );
}
+ @Test
public void testConsumerModifiedFileUnstaged()
{
List<ScmFile> changedFiles = getChangedFiles( "M project.xml", null );
@@ -301,6 +316,7 @@ public class GitStatusConsumerTest
ScmFileStatus.MODIFIED );
}
+ @Test
public void testConsumerModifiedFileBothStagedAndUnstaged()
{
List<ScmFile> changedFiles = getChangedFiles( "MM project.xml", null );
@@ -317,6 +333,7 @@ public class GitStatusConsumerTest
ScmFileStatus.MODIFIED );
}
+ @Test
public void testConsumerModifiedFileWithDirectoryAndNoFile()
throws IOException
{
@@ -335,6 +352,7 @@ public class GitStatusConsumerTest
FileUtils.deleteDirectory( dir );
}
+ @Test
public void testConsumerModifiedFileWithDirectoryAndFile()
throws IOException
{
@@ -359,6 +377,7 @@ public class GitStatusConsumerTest
FileUtils.deleteDirectory( dir );
}
+ @Test
public void testConsumerRemovedFile()
{
List<ScmFile> changedFiles = getChangedFiles( "D Capfile", null );
@@ -374,6 +393,7 @@ public class GitStatusConsumerTest
assertEquals( "test file with spaces and a déjà vu character.xml", changedFiles.get( 0 ).getPath() );
}
+ @Test
public void testConsumerRemovedFileUnstaged()
{
List<ScmFile> changedFiles = getChangedFiles( "D Capfile", null );
@@ -389,6 +409,7 @@ public class GitStatusConsumerTest
assertEquals( ScmFileStatus.DELETED, changedFiles.get( 0 ).getStatus() );
}
+ @Test
public void testConsumerRemovedFileWithDirectoryAndNoFile()
throws IOException
{
@@ -409,6 +430,7 @@ public class GitStatusConsumerTest
FileUtils.deleteDirectory( dir );
}
+ @Test
public void testConsumerRemovedFileWithDirectoryAndFile()
throws IOException
{
@@ -431,6 +453,7 @@ public class GitStatusConsumerTest
}
// Test reproducing SCM-694
+ @Test
public void testConsumerRenamedFile()
throws Exception
{
@@ -462,6 +485,7 @@ public class GitStatusConsumerTest
FileUtils.deleteDirectory( dir );
}
+ @Test
public void testLog1Consumer()
throws Exception
{
@@ -475,6 +499,7 @@ public class GitStatusConsumerTest
testScmFile( changedFiles.get( 3 ), "d\u00e9j\u00e0 vu.txt", ScmFileStatus.MODIFIED );
}
+ @Test
public void testEmptyLogConsumer()
throws Exception
{
@@ -483,6 +508,7 @@ public class GitStatusConsumerTest
assertEquals( 0, changedFiles.size() );
}
+ @Test
public void testLog2Consumer()
throws Exception
{
@@ -505,6 +531,7 @@ public class GitStatusConsumerTest
}
// SCM-709
+ @Test
public void testResolvePath()
{
File repositoryRoot = getTestFile( "repo" );
diff --git a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/tag/GitTagCommandTest.java b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/tag/GitTagCommandTest.java
index 6633dc12c..6ee220d45 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/tag/GitTagCommandTest.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/tag/GitTagCommandTest.java
@@ -23,6 +23,7 @@ import org.apache.maven.scm.ScmTestCase;
import org.apache.maven.scm.provider.git.repository.GitScmProviderRepository;
import org.apache.maven.scm.repository.ScmRepository;
import org.codehaus.plexus.util.cli.Commandline;
+import org.junit.Test;
import java.io.File;
@@ -51,13 +52,14 @@ public class GitTagCommandTest
messageFileString = "-F " + path;
}
-
+ @Test
public void testCommandLineTag()
throws Exception
{
testCommandLine( "scm:git:http://foo.com/git/trunk", "my-tag-1", "git tag " + messageFileString + " my-tag-1", false );
}
+ @Test
public void testCommandLineWithUsernameAndTag()
throws Exception
{
@@ -65,6 +67,7 @@ public class GitTagCommandTest
"git tag " + messageFileString + " my-tag-1", false );
}
+ @Test
public void testCommandLineWithUsernameAndTagAndSign()
throws Exception
{
diff --git a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/update/GitLatestRevisionCommandConsumerTest.java b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/update/GitLatestRevisionCommandConsumerTest.java
index 3c7b093df..55fd8edab 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/update/GitLatestRevisionCommandConsumerTest.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/update/GitLatestRevisionCommandConsumerTest.java
@@ -4,8 +4,12 @@ import java.io.BufferedReader;
import java.io.File;
import java.io.Reader;
-import org.codehaus.plexus.PlexusTestCase;
+import org.apache.maven.scm.ScmTestCase;
import org.codehaus.plexus.util.ReaderFactory;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
/*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -32,8 +36,9 @@ import org.codehaus.plexus.util.ReaderFactory;
*
*/
public class GitLatestRevisionCommandConsumerTest
- extends PlexusTestCase
+ extends ScmTestCase
{
+ @Test
public void testUpToDate()
throws Exception
{
diff --git a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/update/GitUpdateCommandTest.java b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/update/GitUpdateCommandTest.java
index 0e2f94f5f..c1f546ccb 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/update/GitUpdateCommandTest.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/update/GitUpdateCommandTest.java
@@ -25,6 +25,7 @@ import org.apache.maven.scm.ScmVersion;
import org.apache.maven.scm.provider.git.repository.GitScmProviderRepository;
import org.apache.maven.scm.repository.ScmRepository;
import org.codehaus.plexus.util.cli.Commandline;
+import org.junit.Test;
import java.io.File;
@@ -35,19 +36,21 @@ import java.io.File;
public class GitUpdateCommandTest
extends ScmTestCase
{
+ @Test
public void testCommandLineNoBranch()
throws Exception
{
testCommandLine( "scm:git:http://foo.com/git", null, "git pull http://foo.com/git" );
}
+ @Test
public void testCommandLineWithBranch()
throws Exception
{
testCommandLine( "scm:git:http://foo.com/git", new ScmBranch( "mybranch" ), "git pull http://foo.com/git mybranch" );
}
-
+ @Test
public void testCommandLineLatestRevision()
throws Exception
{
diff --git a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gittest/src/main/java/org/apache/maven/scm/provider/git/GitScmTestUtils.java b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gittest/src/main/java/org/apache/maven/scm/provider/git/GitScmTestUtils.java
index a924f10f6..d7fc5d877 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gittest/src/main/java/org/apache/maven/scm/provider/git/GitScmTestUtils.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gittest/src/main/java/org/apache/maven/scm/provider/git/GitScmTestUtils.java
@@ -23,9 +23,9 @@ import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
+import org.apache.maven.scm.PlexusJUnit4TestSupport;
import org.junit.Assert;
-import org.codehaus.plexus.PlexusTestCase;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.cli.CommandLineException;
@@ -53,7 +53,7 @@ public final class GitScmTestUtils
throws IOException
{
// Copy the repository to target
- File src = PlexusTestCase.getTestFile( source );
+ File src = PlexusJUnit4TestSupport.getTestFile( source );
FileUtils.deleteDirectory( repository );
diff --git a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gittest/src/main/java/org/apache/maven/scm/provider/git/command/changelog/GitChangeLogCommandTckTest.java b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gittest/src/main/java/org/apache/maven/scm/provider/git/command/changelog/GitChangeLogCommandTckTest.java
index 2ef7a2a5b..6fa3acfa5 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gittest/src/main/java/org/apache/maven/scm/provider/git/command/changelog/GitChangeLogCommandTckTest.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gittest/src/main/java/org/apache/maven/scm/provider/git/command/changelog/GitChangeLogCommandTckTest.java
@@ -29,12 +29,14 @@ import org.apache.maven.scm.provider.ScmProvider;
import org.apache.maven.scm.provider.git.GitScmTestUtils;
import org.apache.maven.scm.repository.ScmRepository;
import org.apache.maven.scm.tck.command.changelog.ChangeLogCommandTckTest;
+import org.junit.Test;
import java.io.File;
import java.util.List;
import static org.hamcrest.CoreMatchers.startsWith;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.assertEquals;
/**
* @author <a href="mailto:struberg@yahoo.de">Mark Struberg</a>
@@ -64,6 +66,7 @@ public abstract class GitChangeLogCommandTckTest
}
}
+ @Test
public void testChangeLogCommandFromHeadAncestorAndHead()
throws Exception
{
@@ -87,6 +90,7 @@ public abstract class GitChangeLogCommandTckTest
assertThat( "bad head commit SHA1 retrieved", logEntries.get( 0 ).getRevision(), startsWith( "464921b" ) );
}
+ @Test
public void testChangeLogCommandFromHeadToHead()
throws Exception
{
@@ -107,6 +111,7 @@ public abstract class GitChangeLogCommandTckTest
0, logEntries.size() );
}
+ @Test
public void testChangeLogCommandFromUndefinedToHead()
throws Exception
{
@@ -125,6 +130,7 @@ public abstract class GitChangeLogCommandTckTest
0, logEntries.size() );
}
+ @Test
public void testChangeLogCommandFromVersionToUndefined()
throws Exception
{
@@ -146,6 +152,7 @@ public abstract class GitChangeLogCommandTckTest
assertThat( "bad commit SHA1 retrieved", logEntries.get( 1 ).getRevision(), startsWith( "db46d63" ) );
}
+ @Test
public void testChangeLogCommandFromVoneToVtwo()
throws Exception
{
@@ -169,6 +176,7 @@ public abstract class GitChangeLogCommandTckTest
assertThat( "bad commit SHA1 retrieved", logEntries.get( 1 ).getRevision(), startsWith( "e3864d9" ) );
}
+ @Test
public void testChangeLogCommandWithStartEndInBadOrder()
throws Exception
{
@@ -189,6 +197,7 @@ public abstract class GitChangeLogCommandTckTest
0, logEntries.size() );
}
+ @Test
public void testChangeLogCommandFromHeadToStartOfRepository()
throws Exception
{
@@ -207,6 +216,7 @@ public abstract class GitChangeLogCommandTckTest
5, logEntries.size() );
}
+ @Test
public void testChangeLogCommandFromVersionToStartOfRepository()
throws Exception
{
diff --git a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-jgit/src/test/java/org/apache/maven/scm/provider/git/jgit/command/checkin/JGitCheckInCommandCommitterAuthorTckTest.java b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-jgit/src/test/java/org/apache/maven/scm/provider/git/jgit/command/checkin/JGitCheckInCommandCommitterAuthorTckTest.java
index b391e91fd..d88f4b580 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-jgit/src/test/java/org/apache/maven/scm/provider/git/jgit/command/checkin/JGitCheckInCommandCommitterAuthorTckTest.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-jgit/src/test/java/org/apache/maven/scm/provider/git/jgit/command/checkin/JGitCheckInCommandCommitterAuthorTckTest.java
@@ -45,6 +45,12 @@ import org.eclipse.jgit.storage.file.FileBasedConfig;
import org.eclipse.jgit.util.FS;
import org.eclipse.jgit.util.FileUtils;
import org.eclipse.jgit.util.SystemReader;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
/**
* @author Dominik Bartholdi (imod)
@@ -54,7 +60,7 @@ public class JGitCheckInCommandCommitterAuthorTckTest
{
@Override
- protected void setUp()
+ public void setUp()
throws Exception
{
super.setUp();
@@ -63,7 +69,7 @@ public class JGitCheckInCommandCommitterAuthorTckTest
}
@Override
- protected void tearDown()
+ public void tearDown()
throws Exception
{
super.tearDown();
@@ -92,6 +98,7 @@ public class JGitCheckInCommandCommitterAuthorTckTest
}
@Override
+ @Test
public void testCheckInCommandTest()
throws Exception
{
diff --git a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-jgit/src/test/java/org/apache/maven/scm/provider/git/jgit/command/remoteinfo/JGitRemoteInfoCommandTckTest.java b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-jgit/src/test/java/org/apache/maven/scm/provider/git/jgit/command/remoteinfo/JGitRemoteInfoCommandTckTest.java
index 03f49221d..714bc8e7b 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-jgit/src/test/java/org/apache/maven/scm/provider/git/jgit/command/remoteinfo/JGitRemoteInfoCommandTckTest.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-jgit/src/test/java/org/apache/maven/scm/provider/git/jgit/command/remoteinfo/JGitRemoteInfoCommandTckTest.java
@@ -29,6 +29,8 @@ import org.apache.maven.scm.provider.git.command.remoteinfo.AbstractGitRemoteInf
import org.apache.maven.scm.provider.git.repository.GitScmProviderRepository;
import org.eclipse.jgit.util.FileUtils;
+import static org.junit.Assert.assertEquals;
+
/**
*
* @author Dominik Bartholdi (imod)
diff --git a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svn-commons/src/test/java/org/apache/maven/scm/provider/svn/SvnCommandUtilsTest.java b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svn-commons/src/test/java/org/apache/maven/scm/provider/svn/SvnCommandUtilsTest.java
index a7b9ba479..005d68fc5 100644
--- a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svn-commons/src/test/java/org/apache/maven/scm/provider/svn/SvnCommandUtilsTest.java
+++ b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svn-commons/src/test/java/org/apache/maven/scm/provider/svn/SvnCommandUtilsTest.java
@@ -20,6 +20,11 @@ package org.apache.maven.scm.provider.svn;
*/
import org.apache.maven.scm.ScmTestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
/**
* @author <a href="mailto:jerome@coffeebreaks.org">Jerome Lacoste</a>
@@ -32,6 +37,7 @@ public class SvnCommandUtilsTest
// appendPath
// ----------------------------------------------------------------------
+ @Test
public void testFixUrlHttpUrlsAreIgnored()
throws Exception
{
@@ -41,6 +47,7 @@ public class SvnCommandUtilsTest
assertEquals( unchanged, SvnCommandUtils.fixUrl( unchanged, "user" ) );
}
+ @Test
public void testFixUrlNPEifNullURL()
throws Exception
{
@@ -55,6 +62,7 @@ public class SvnCommandUtilsTest
}
}
+ @Test
public void testFixUrlSvnSshUrlsUsernameIsAddedWhenUserSpecified()
throws Exception
{
@@ -66,6 +74,7 @@ public class SvnCommandUtilsTest
SvnCommandUtils.fixUrl( "svn+ssh://foo.com/svn/myproject", "user" ) );
}
+ @Test
public void testFixUrlSvnSshUrlsUsernameIsOverridenWhenUserSpecified()
throws Exception
{
diff --git a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svn-commons/src/test/java/org/apache/maven/scm/provider/svn/SvnTagBranchUtilsTest.java b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svn-commons/src/test/java/org/apache/maven/scm/provider/svn/SvnTagBranchUtilsTest.java
index 413c0b0bb..d637f34d9 100644
--- a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svn-commons/src/test/java/org/apache/maven/scm/provider/svn/SvnTagBranchUtilsTest.java
+++ b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svn-commons/src/test/java/org/apache/maven/scm/provider/svn/SvnTagBranchUtilsTest.java
@@ -25,6 +25,11 @@ import org.apache.maven.scm.ScmTag;
import org.apache.maven.scm.ScmTestCase;
import org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository;
import org.apache.maven.scm.repository.ScmRepository;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
/**
* @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
@@ -37,6 +42,7 @@ public class SvnTagBranchUtilsTest
// appendPath
// ----------------------------------------------------------------------
+ @Test
public void testAppendPath()
throws Exception
{
@@ -44,18 +50,21 @@ public class SvnTagBranchUtilsTest
SvnTagBranchUtils.appendPath( "http://foo.com/svn", "myproject/tags/foo" ) );
}
+ @Test
public void testAppendPathNullAddlPath()
throws Exception
{
assertEquals( "http://foo.com/svn", SvnTagBranchUtils.appendPath( "http://foo.com/svn", null ) );
}
+ @Test
public void testAppendPathNullAddlTrailingSlash()
throws Exception
{
assertEquals( "http://foo.com/svn", SvnTagBranchUtils.appendPath( "http://foo.com/svn/", null ) );
}
+ @Test
public void testAppendPathTrailingSlash()
throws Exception
{
@@ -63,6 +72,7 @@ public class SvnTagBranchUtilsTest
SvnTagBranchUtils.appendPath( "http://foo.com/svn/", "myproject/tags/foo" ) );
}
+ @Test
public void testAppendPathLeadingAndTrailingSlash()
throws Exception
{
@@ -74,6 +84,7 @@ public class SvnTagBranchUtilsTest
// resolveTagBase
// ----------------------------------------------------------------------
+ @Test
public void testResolveTagBase()
{
assertEquals( "http://foo.com/svn/myproject/tags",
@@ -86,6 +97,7 @@ public class SvnTagBranchUtilsTest
// getProjectRoot
// ----------------------------------------------------------------------
+ @Test
public void testGetProjectRootTagBranchTrunk()
throws Exception
{
@@ -100,6 +112,7 @@ public class SvnTagBranchUtilsTest
}
}
+ @Test
public void testGetProjectRootNoRootSpecifier()
throws Exception
{
@@ -112,6 +125,7 @@ public class SvnTagBranchUtilsTest
testGetProjectRoot( "scm:svn:http://foo.com/svn/nbranches", "http://foo.com/svn/nbranches" );
}
+ @Test
public void testGetProjectRootLooksLikeRootSpecifier()
throws Exception
{
@@ -123,6 +137,7 @@ public class SvnTagBranchUtilsTest
}
+ @Test
public void testGetProjectRootDoubleProjectRoots()
throws Exception
{
@@ -136,6 +151,7 @@ public class SvnTagBranchUtilsTest
// resolveTagUrl
// ----------------------------------------------------------------------
+ @Test
public void testResolveTagRelative()
throws Exception
{
@@ -150,6 +166,7 @@ public class SvnTagBranchUtilsTest
testResolveTagUrl( "scm:svn:http://foo.com/svn/tags", "my-tag", "http://foo.com/svn/tags/my-tag" );
}
+ @Test
public void testResolveTagAbsolute()
throws Exception
{
@@ -161,6 +178,7 @@ public class SvnTagBranchUtilsTest
}
+ @Test
public void testResolveTagWithSlashes()
throws Exception
{
@@ -172,6 +190,7 @@ public class SvnTagBranchUtilsTest
"http://foo.com/svn/myproject/branches/my-branch" );
}
+ @Test
public void testResolveTagWithTagOverwritingBase()
throws Exception
{
@@ -192,6 +211,7 @@ public class SvnTagBranchUtilsTest
"file://localhost/C:/mydir/myproject/trunk/my-module/target/scm-src/tags/my-tag" );
}
+ @Test
public void testResolveTagWithTagBaseSpecified()
throws Exception
{
@@ -201,6 +221,7 @@ public class SvnTagBranchUtilsTest
"http://foo.com/svn/non-standard/tag/dir/my-tag" );
}
+ @Test
public void testResolveTagLooksLikeOverwriteTagBase()
throws Exception
{
@@ -210,6 +231,7 @@ public class SvnTagBranchUtilsTest
"http://foo.com/svn/tags/metatags/my-tag" );
}
+ @Test
public void testResolveBranchSimple()
throws Exception
{
@@ -229,6 +251,7 @@ public class SvnTagBranchUtilsTest
}
+ @Test
public void testResolveBranchTagBase()
throws Exception
{
@@ -242,6 +265,7 @@ public class SvnTagBranchUtilsTest
// revisionArgument
// ----------------------------------------------------------------------
+ @Test
public void testIsRevisionArgumentSimple()
{
assertTrue( SvnTagBranchUtils.isRevisionSpecifier( new ScmRevision( "12345" ) ) );
@@ -258,6 +282,7 @@ public class SvnTagBranchUtilsTest
}
+ @Test
public void testIsRevisionArgumentRange()
{
assertTrue( SvnTagBranchUtils.isRevisionSpecifier( new ScmRevision( "12345:12345" ) ) );
diff --git a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svn-commons/src/test/java/org/apache/maven/scm/provider/svn/repository/SvnScmProviderRepositoryTest.java b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svn-commons/src/test/java/org/apache/maven/scm/provider/svn/repository/SvnScmProviderRepositoryTest.java
index f34f5a2b8..55692f628 100644
--- a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svn-commons/src/test/java/org/apache/maven/scm/provider/svn/repository/SvnScmProviderRepositoryTest.java
+++ b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svn-commons/src/test/java/org/apache/maven/scm/provider/svn/repository/SvnScmProviderRepositoryTest.java
@@ -23,6 +23,12 @@ import org.apache.maven.scm.ScmTestCase;
import org.apache.maven.scm.manager.ScmManager;
import org.apache.maven.scm.repository.ScmRepository;
import org.apache.maven.scm.repository.ScmRepositoryException;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
/**
* @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
@@ -45,24 +51,28 @@ public class SvnScmProviderRepositoryTest
// Testing legal URLs
// ----------------------------------------------------------------------
+ @Test
public void testLegalFileURL()
throws Exception
{
testUrl( "scm:svn:file:///tmp/repo", "file:///tmp/repo", null, null, null );
}
+ @Test
public void testLegalLocalhostFileURL()
throws Exception
{
testUrl( "scm:svn:file://localhost/tmp/repo", "file://localhost/tmp/repo", null, null, null );
}
+ @Test
public void testLegalHistnameFileURL()
throws Exception
{
testUrl( "scm:svn:file://my_server/tmp/repo", "file://my_server/tmp/repo", null, null, null );
}
+ @Test
public void testLegalHttpURL()
throws Exception
{
@@ -70,6 +80,7 @@ public class SvnScmProviderRepositoryTest
"subversion.tigris.org" );
}
+ @Test
public void testLegalHttpURLWithUser()
throws Exception
{
@@ -77,6 +88,7 @@ public class SvnScmProviderRepositoryTest
"subversion.tigris.org" );
}
+ @Test
public void testLegalHttpURLWithUserPassword()
throws Exception
{
@@ -84,6 +96,7 @@ public class SvnScmProviderRepositoryTest
"password", "subversion.tigris.org" );
}
+ @Test
public void testLegalHttpsURL()
throws Exception
{
@@ -91,6 +104,7 @@ public class SvnScmProviderRepositoryTest
"subversion.tigris.org" );
}
+ @Test
public void testLegalHttpsURLWithUser()
throws Exception
{
@@ -98,6 +112,7 @@ public class SvnScmProviderRepositoryTest
"subversion.tigris.org" );
}
+ @Test
public void testLegalHttpsURLWithUserPassword()
throws Exception
{
@@ -105,6 +120,7 @@ public class SvnScmProviderRepositoryTest
"password", "subversion.tigris.org" );
}
+ @Test
public void testLegalSvnURL()
throws Exception
{
@@ -112,6 +128,7 @@ public class SvnScmProviderRepositoryTest
"subversion.tigris.org" );
}
+ @Test
public void testLegalSvnPlusUsernameURL()
throws Exception
{
@@ -119,6 +136,7 @@ public class SvnScmProviderRepositoryTest
"subversion.tigris.org" );
}
+ @Test
public void testLegalSvnPlusUsernamePasswordURL()
throws Exception
{
@@ -126,6 +144,7 @@ public class SvnScmProviderRepositoryTest
"password", "subversion.tigris.org" );
}
+ @Test
public void testLegalSvnPlusSshURL()
throws Exception
{
@@ -141,6 +160,7 @@ public class SvnScmProviderRepositoryTest
"subversion.tigris.org" );
}*/
+ @Test
public void testLegalSvnPlusSshPlusUsernameURL()
throws Exception
{
@@ -156,6 +176,7 @@ public class SvnScmProviderRepositoryTest
"username@subversion.tigris.org" );
}*/
+ @Test
public void testLegalSvnPortUrl()
throws Exception
{
@@ -174,6 +195,7 @@ public class SvnScmProviderRepositoryTest
// Testing illegal URLs
// ----------------------------------------------------------------------
+ @Test
public void testIllegalFileUrl()
throws Exception
{
@@ -246,18 +268,21 @@ public class SvnScmProviderRepositoryTest
}
}
+ @Test
public void testGetParent()
{
new SvnScmProviderRepository( "http://subversion.tigris.org" );
}
-
+
+ @Test
public void testGetParentDotSlashEndingURL()
{
SvnScmProviderRepository slashDotRepo = new SvnScmProviderRepository( "file://a/b/c/././." );
assertTrue( slashDotRepo.getParent() instanceof SvnScmProviderRepository );
assertEquals( "file://a/b", ( (SvnScmProviderRepository) slashDotRepo.getParent() ).getUrl() );
}
-
+
+ @Test
public void testGetParentSlashEndingURL()
{
SvnScmProviderRepository slashRepo = new SvnScmProviderRepository( "file://a/b/c///" );
diff --git a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/SvnCommandLineUtilsTest.java b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/SvnCommandLineUtilsTest.java
index 37f4f834b..873aabd57 100644
--- a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/SvnCommandLineUtilsTest.java
+++ b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/SvnCommandLineUtilsTest.java
@@ -23,7 +23,9 @@ import org.apache.maven.scm.ScmTestCase;
import org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository;
import org.codehaus.plexus.util.Os;
import org.codehaus.plexus.util.cli.Commandline;
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import java.io.File;
@@ -35,6 +37,7 @@ import java.io.File;
public class SvnCommandLineUtilsTest
extends ScmTestCase
{
+ @Test
public void testCryptPassword()
throws Exception
{
diff --git a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/changelog/SvnChangeLogConsumerTest.java b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/changelog/SvnChangeLogConsumerTest.java
index 081c7bd2f..b6e1dcab9 100644
--- a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/changelog/SvnChangeLogConsumerTest.java
+++ b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/changelog/SvnChangeLogConsumerTest.java
@@ -22,9 +22,10 @@ package org.apache.maven.scm.provider.svn.svnexe.command.changelog;
import org.apache.maven.scm.ChangeFile;
import org.apache.maven.scm.ChangeSet;
import org.apache.maven.scm.ScmFileStatus;
+import org.apache.maven.scm.ScmTestCase;
import org.apache.maven.scm.util.ConsumerUtils;
-import org.codehaus.plexus.PlexusTestCase;
import org.junit.Assert;
+import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -39,19 +40,23 @@ import java.util.Map;
import java.util.TimeZone;
import java.util.concurrent.atomic.AtomicInteger;
+import static junit.framework.TestCase.assertTrue;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
/**
* @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
*
*/
public class SvnChangeLogConsumerTest
- extends PlexusTestCase
+ extends ScmTestCase
{
Logger logger = LoggerFactory.getLogger( getClass() );
SvnChangeLogConsumer consumer;
- protected void setUp()
+ public void setUp()
throws Exception
{
super.setUp();
@@ -61,6 +66,7 @@ public class SvnChangeLogConsumerTest
/**
* Initial modifications should be empty.
*/
+ @Test
public void testGetModifications_Initial()
{
assertTrue( "Initial modifications should be empty", consumer.getModifications().isEmpty() );
@@ -71,6 +77,7 @@ public class SvnChangeLogConsumerTest
*
* @throws Exception if any problem occurs.
*/
+ @Test
public void testConsumeLine_ValidOutput()
throws Exception
{
@@ -106,6 +113,7 @@ public class SvnChangeLogConsumerTest
*
* @throws Exception
*/
+ @Test
public void testConsumeLine_InvalidReason()
throws Exception
{
@@ -127,6 +135,7 @@ public class SvnChangeLogConsumerTest
*
* @throws Exception
*/
+ @Test
public void testConsumeLine_InvalidDate()
throws Exception
{
@@ -154,6 +163,7 @@ public class SvnChangeLogConsumerTest
ConsumerUtils.consumeFile( logFile, consumer );
}
+ @Test
public void testConsumerWithPattern1()
throws Exception
{
@@ -204,6 +214,7 @@ public class SvnChangeLogConsumerTest
}
}
+ @Test
public void testConsumerWithPattern2()
throws Exception
{
@@ -247,7 +258,7 @@ public class SvnChangeLogConsumerTest
Assert.assertTrue( "Unexpected file name: " + fileName, fileName.startsWith( "/maven/scm/trunk" ) );
// files in this log are known not to contain space
- Assert.assertEquals( "Unexpected space found in filename: " + fileName, -1, fileName.indexOf( " " ) );
+ assertEquals( "Unexpected space found in filename: " + fileName, -1, fileName.indexOf( " " ) );
if ( file.getOriginalName() != null )
{
@@ -258,9 +269,9 @@ public class SvnChangeLogConsumerTest
out.append( "==============================" );
}
- Assert.assertEquals( "Unexpected number of file copy records", 1, origFileCounter );
+ assertEquals( "Unexpected number of file copy records", 1, origFileCounter );
- Assert.assertEquals( "Action summary differs from expectations",
+ assertEquals( "Action summary differs from expectations",
"{modified=626, deleted=56, added=310, copied=1}", summary.toString() );
if ( logger.isDebugEnabled() )
diff --git a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/mkdir/SvnMkdirCommandTest.java b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/mkdir/SvnMkdirCommandTest.java
index d8dbc902b..e287844c3 100644
--- a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/mkdir/SvnMkdirCommandTest.java
+++ b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/mkdir/SvnMkdirCommandTest.java
@@ -27,6 +27,9 @@ import org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository;
import org.apache.maven.scm.repository.ScmRepository;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.cli.Commandline;
+import org.junit.Test;
+
+import static org.junit.Assert.assertTrue;
/**
* @author <a href="mailto:oching@apache.org">Maria Odea Ching</a>
@@ -39,7 +42,7 @@ public class SvnMkdirCommandTest
String messageFileString;
- protected void setUp()
+ public void setUp()
throws Exception
{
super.setUp();
@@ -56,7 +59,7 @@ public class SvnMkdirCommandTest
messageFileString = "--file " + path + " --encoding UTF-8";
}
- protected void tearDown()
+ public void tearDown()
throws Exception
{
assertTrue( messageFile.delete() );
@@ -64,6 +67,7 @@ public class SvnMkdirCommandTest
super.tearDown();
}
+ @Test
public void testCommandLineMkdirUrl()
throws Exception
{
@@ -71,6 +75,7 @@ public class SvnMkdirCommandTest
"svn --non-interactive mkdir --parents http://foo.com/svn/trunk/missing@ " + messageFileString, false );
}
+ @Test
public void testCommandLineMkdirUrlWithUsername()
throws Exception
{
@@ -79,6 +84,7 @@ public class SvnMkdirCommandTest
messageFileString, false );
}
+ @Test
public void testCommandLineMkdirLocalPath()
throws Exception
{
diff --git a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/remoteinfo/SvnExeRemoteInfoCommandTckTest.java b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/remoteinfo/SvnExeRemoteInfoCommandTckTest.java
index c06dc879f..117a0070f 100644
--- a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/remoteinfo/SvnExeRemoteInfoCommandTckTest.java
+++ b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/remoteinfo/SvnExeRemoteInfoCommandTckTest.java
@@ -24,6 +24,8 @@ import org.apache.maven.scm.provider.ScmProviderRepository;
import org.apache.maven.scm.provider.svn.command.remoteinfo.AbstractSvnRemoteInfoCommandTckTest;
import org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository;
+import static org.junit.Assert.assertTrue;
+
/**
* @author Bertrand Paquet
*/
diff --git a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/remoteinfo/SvnRemoteInfoCommandTest.java b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/remoteinfo/SvnRemoteInfoCommandTest.java
index 27c15965c..03171c412 100644
--- a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/remoteinfo/SvnRemoteInfoCommandTest.java
+++ b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/remoteinfo/SvnRemoteInfoCommandTest.java
@@ -20,6 +20,10 @@ package org.apache.maven.scm.provider.svn.svnexe.command.remoteinfo;
import org.apache.maven.scm.ScmTestCase;
import org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository;
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
/**
* @author Olivier Lamy
@@ -27,6 +31,7 @@ import org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository;
public class SvnRemoteInfoCommandTest
extends ScmTestCase
{
+ @Test
public void testExist()
throws Exception
{
@@ -37,6 +42,7 @@ public class SvnRemoteInfoCommandTest
assertTrue( svnRemoteInfoCommand.remoteUrlExist( svnScmProviderRepository, null ) );
}
+ @Test
public void testNotExist()
throws Exception
{
diff --git a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/update/SvnUpdateCommandTest.java b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/update/SvnUpdateCommandTest.java
index 5e852c1c3..d4b938a56 100644
--- a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/update/SvnUpdateCommandTest.java
+++ b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/update/SvnUpdateCommandTest.java
@@ -29,9 +29,12 @@ import org.apache.maven.scm.provider.svn.util.SvnUtil;
import org.apache.maven.scm.repository.ScmRepository;
import org.codehaus.plexus.util.Os;
import org.codehaus.plexus.util.cli.Commandline;
+import org.junit.Test;
import java.io.File;
+import static org.junit.Assert.assertTrue;
+
/**
* @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
*
@@ -39,6 +42,7 @@ import java.io.File;
public class SvnUpdateCommandTest
extends ScmTestCase
{
+ @Test
public void testCommandLineWithEmptyTag()
throws Exception
{
@@ -46,6 +50,7 @@ public class SvnUpdateCommandTest
"svn --non-interactive update " + getUpdateTestFile().getAbsolutePath() + "@" );
}
+ @Test
public void testCommandLineWithEmptyBranch()
throws Exception
{
@@ -53,6 +58,7 @@ public class SvnUpdateCommandTest
"svn --non-interactive update " + getUpdateTestFile().getAbsolutePath() + "@" );
}
+ @Test
public void testCommandLineWithEmptyVersion()
throws Exception
{
@@ -60,6 +66,7 @@ public class SvnUpdateCommandTest
"svn --non-interactive update " + getUpdateTestFile().getAbsolutePath() + "@" );
}
+ @Test
public void testCommandLineWithWhitespaceTag()
throws Exception
{
@@ -67,6 +74,7 @@ public class SvnUpdateCommandTest
"svn --non-interactive update " + getUpdateTestFile().getAbsolutePath() + "@" );
}
+ @Test
public void testCommandLineWithWhitespaceBranch()
throws Exception
{
@@ -74,6 +82,7 @@ public class SvnUpdateCommandTest
"svn --non-interactive update " + getUpdateTestFile().getAbsolutePath() + "@" );
}
+ @Test
public void testCommandLineWithWhitespaceRevision()
throws Exception
{
@@ -81,6 +90,7 @@ public class SvnUpdateCommandTest
"svn --non-interactive update " + getUpdateTestFile().getAbsolutePath() + "@" );
}
+ @Test
public void testCommandLineWithoutTag()
throws Exception
{
@@ -88,6 +98,7 @@ public class SvnUpdateCommandTest
"svn --non-interactive update " + getUpdateTestFile().getAbsolutePath() + "@" );
}
+ @Test
public void testCommandLineTag()
throws Exception
{
@@ -96,6 +107,7 @@ public class SvnUpdateCommandTest
getUpdateTestFile().getAbsolutePath() + "@" );
}
+ @Test
public void testCommandLineWithUsernameAndTag()
throws Exception
{
@@ -104,6 +116,7 @@ public class SvnUpdateCommandTest
getUpdateTestFile().getAbsolutePath() + "@" );
}
+ @Test
public void testCommandLineWithCygwinProperty()
throws Exception
{
@@ -124,6 +137,7 @@ public class SvnUpdateCommandTest
}
}
+ @Test
public void testCommandLineWithRelativeURLTag()
throws Exception
{
@@ -132,6 +146,7 @@ public class SvnUpdateCommandTest
getUpdateTestFile().getAbsolutePath() + "@" );
}
+ @Test
public void testCommandLineWithAbsoluteURLTag()
throws Exception
{
@@ -141,6 +156,7 @@ public class SvnUpdateCommandTest
getUpdateTestFile().getAbsolutePath() + "@" );
}
+ @Test
public void testCommandLineWithNonDeterminantBase()
throws Exception
{
@@ -149,6 +165,7 @@ public class SvnUpdateCommandTest
getUpdateTestFile().getAbsolutePath() + "@" );
}
+ @Test
public void testCommandLineWithNonDeterminantBaseTrailingSlash()
throws Exception
{
@@ -157,6 +174,7 @@ public class SvnUpdateCommandTest
getUpdateTestFile().getAbsolutePath() + "@" );
}
+ @Test
public void testCommandLineWithBranchSameAsBase()
throws Exception
{
diff --git a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svntest/src/main/java/org/apache/maven/scm/provider/svn/command/blame/SvnBlameCommandTckTest.java b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svntest/src/main/java/org/apache/maven/scm/provider/svn/command/blame/SvnBlameCommandTckTest.java
index 50665c0a4..6d8a56627 100644
--- a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svntest/src/main/java/org/apache/maven/scm/provider/svn/command/blame/SvnBlameCommandTckTest.java
+++ b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svntest/src/main/java/org/apache/maven/scm/provider/svn/command/blame/SvnBlameCommandTckTest.java
@@ -27,6 +27,8 @@ import org.apache.maven.scm.tck.command.blame.BlameCommandTckTest;
import java.io.File;
import java.util.List;
+import static org.junit.Assert.assertEquals;
+
/**
* @author Evgeny Mandrikov
*/
diff --git a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svntest/src/main/java/org/apache/maven/scm/provider/svn/command/mkdir/SvnMkdirCommandTckTest.java b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svntest/src/main/java/org/apache/maven/scm/provider/svn/command/mkdir/SvnMkdirCommandTckTest.java
index b2821a136..728d16dcf 100644
--- a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svntest/src/main/java/org/apache/maven/scm/provider/svn/command/mkdir/SvnMkdirCommandTckTest.java
+++ b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svntest/src/main/java/org/apache/maven/scm/provider/svn/command/mkdir/SvnMkdirCommandTckTest.java
@@ -26,6 +26,11 @@ import org.apache.maven.scm.command.list.ListScmResult;
import org.apache.maven.scm.command.mkdir.MkdirScmResult;
import org.apache.maven.scm.provider.svn.SvnScmTestUtils;
import org.apache.maven.scm.tck.command.mkdir.MkdirCommandTckTest;
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
/**
* @author <a href="mailto:oching@apache.org">Maria Odea Ching</a>
@@ -47,7 +52,8 @@ public class SvnMkdirCommandTckTest
{
SvnScmTestUtils.initializeRepository( getRepositoryRoot() );
}
-
+
+ @Test
public void testMkdirCommandMkdirUrl()
throws Exception
{
@@ -63,7 +69,8 @@ public class SvnMkdirCommandTckTest
assertTrue( "Directory should have been found.", listResult.isSuccess() );
}
-
+
+ @Test
public void testMkdirCommandDirAlreadyAdded()
throws Exception
{
diff --git a/maven-scm-test/pom.xml b/maven-scm-test/pom.xml
index 4a14ca645..23f6808e2 100644
--- a/maven-scm-test/pom.xml
+++ b/maven-scm-test/pom.xml
@@ -60,7 +60,6 @@
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<classifier>no_aop</classifier>
- <scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
diff --git a/maven-scm-test/src/main/java/org/apache/maven/scm/PlexusJUnit4TestSupport.java b/maven-scm-test/src/main/java/org/apache/maven/scm/PlexusJUnit4TestSupport.java
new file mode 100644
index 000000000..3684085b7
--- /dev/null
+++ b/maven-scm-test/src/main/java/org/apache/maven/scm/PlexusJUnit4TestSupport.java
@@ -0,0 +1,323 @@
+package org.apache.maven.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 java.io.InputStream;
+import java.util.Map;
+
+import com.google.inject.Module;
+import org.codehaus.plexus.ContainerConfiguration;
+import org.codehaus.plexus.DefaultContainerConfiguration;
+import org.codehaus.plexus.DefaultPlexusContainer;
+import org.codehaus.plexus.PlexusConstants;
+import org.codehaus.plexus.PlexusContainer;
+import org.codehaus.plexus.PlexusContainerException;
+import org.codehaus.plexus.configuration.PlexusConfiguration;
+import org.codehaus.plexus.context.Context;
+import org.codehaus.plexus.context.DefaultContext;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.rules.TestName;
+
+import static org.junit.Assert.fail;
+
+/**
+ * Based on PlexusTestCase from org.sonatype.sisu:sisu-inject-plexus.
+ * Note: this class is copied from maven-release.
+ *
+ * @author Robert Scholte
+ */
+public abstract class PlexusJUnit4TestSupport
+{
+ private PlexusContainer container;
+
+ private static String basedir;
+
+ @Rule
+ public TestName testName = new TestName();
+
+ @Before
+ public void setUp()
+ throws Exception
+ {
+ basedir = getBasedir();
+ }
+
+ protected String getName()
+ {
+ return testName.getMethodName();
+ }
+
+ protected void setupContainer()
+ {
+ // ----------------------------------------------------------------------------
+ // Context Setup
+ // ----------------------------------------------------------------------------
+
+ final DefaultContext context = new DefaultContext();
+
+ context.put( "basedir", getBasedir() );
+
+ customizeContext( context );
+
+ final boolean hasPlexusHome = context.contains( "plexus.home" );
+
+ if ( !hasPlexusHome )
+ {
+ final File f = getTestFile( "target/plexus-home" );
+
+ if ( !f.isDirectory() )
+ {
+ f.mkdir();
+ }
+
+ context.put( "plexus.home", f.getAbsolutePath() );
+ }
+
+ // ----------------------------------------------------------------------------
+ // Configuration
+ // ----------------------------------------------------------------------------
+
+ final String config = getCustomConfigurationName();
+
+ final ContainerConfiguration containerConfiguration =
+ new DefaultContainerConfiguration()
+ .setName( "test" )
+ .setContext( context.getContextData() )
+ .setAutoWiring( true )
+ .setClassPathScanning( PlexusConstants.SCANNING_CACHE );
+
+ if ( config != null )
+ {
+ containerConfiguration.setContainerConfiguration( config );
+ }
+ else
+ {
+ final String resource = getConfigurationName( null );
+
+ containerConfiguration.setContainerConfiguration( resource );
+ }
+
+ customizeContainerConfiguration( containerConfiguration );
+
+ try
+ {
+ container = new DefaultPlexusContainer( containerConfiguration, getCustomModules() );
+ }
+ catch ( final PlexusContainerException e )
+ {
+ e.printStackTrace();
+ fail( "Failed to create plexus container." );
+ }
+ }
+
+ /**
+ * Allows test to define custom modules.
+ */
+ protected Module[] getCustomModules()
+ {
+ return new Module[0];
+ }
+
+ /**
+ * Allow custom test case implementations do augment the default container configuration before executing tests.
+ *
+ * @param containerConfiguration
+ */
+ protected void customizeContainerConfiguration( final ContainerConfiguration containerConfiguration )
+ {
+ }
+
+ protected void customizeContext( final Context context )
+ {
+ }
+
+ protected PlexusConfiguration customizeComponentConfiguration()
+ {
+ return null;
+ }
+
+ @After
+ public void tearDown()
+ throws Exception
+ {
+ if ( container != null )
+ {
+ container.dispose();
+
+ container = null;
+ }
+ }
+
+ protected PlexusContainer getContainer()
+ {
+ if ( container == null )
+ {
+ setupContainer();
+ }
+
+ return container;
+ }
+
+ protected InputStream getConfiguration()
+ throws Exception
+ {
+ return getConfiguration( null );
+ }
+
+ @SuppressWarnings( "unused" )
+ protected InputStream getConfiguration( final String subname )
+ throws Exception
+ {
+ return getResourceAsStream( getConfigurationName( subname ) );
+ }
+
+ protected String getCustomConfigurationName()
+ {
+ return null;
+ }
+
+ /**
+ * Allow the retrieval of a container configuration that is based on the name of the test class being run. So if you
+ * have a test class called org.foo.FunTest, then this will produce a resource name of org/foo/FunTest.xml which
+ * would be used to configure the Plexus container before running your test.
+ *
+ * @param subname
+ * @return
+ */
+ protected String getConfigurationName( final String subname )
+ {
+ return getClass().getName().replace( '.', '/' ) + ".xml";
+ }
+
+ protected InputStream getResourceAsStream( final String resource )
+ {
+ return getClass().getResourceAsStream( resource );
+ }
+
+ protected ClassLoader getClassLoader()
+ {
+ return getClass().getClassLoader();
+ }
+
+ // ----------------------------------------------------------------------
+ // Container access
+ // ----------------------------------------------------------------------
+
+ protected Object lookup( final String componentKey )
+ throws Exception
+ {
+ return getContainer().lookup( componentKey );
+ }
+
+ protected Object lookup( final String role, final String roleHint )
+ throws Exception
+ {
+ return getContainer().lookup( role, roleHint );
+ }
+
+ protected <T> T lookup( final Class<T> componentClass )
+ throws Exception
+ {
+ return getContainer().lookup( componentClass );
+ }
+
+ protected <T> T lookup( final Class<T> componentClass, final String roleHint )
+ throws Exception
+ {
+ return getContainer().lookup( componentClass, roleHint );
+ }
+
+ protected <T> Map<String, T> lookupMap( final Class<T> componentClass )
+ throws Exception
+ {
+ return getContainer().lookupMap( componentClass );
+ }
+
+ protected void release( final Object component )
+ throws Exception
+ {
+ getContainer().release( component );
+ }
+
+ // ----------------------------------------------------------------------
+ // Helper methods for sub classes
+ // ----------------------------------------------------------------------
+
+ public static File getTestFile( final String path )
+ {
+ return new File( getBasedir(), path );
+ }
+
+ @SuppressWarnings( "hiding" )
+ public static File getTestFile( final String basedir, final String path )
+ {
+ File basedirFile = new File( basedir );
+
+ if ( !basedirFile.isAbsolute() )
+ {
+ basedirFile = getTestFile( basedir );
+ }
+
+ return new File( basedirFile, path );
+ }
+
+ public static String getTestPath( final String path )
+ {
+ return getTestFile( path ).getAbsolutePath();
+ }
+
+ @SuppressWarnings( "hiding" )
+ public static String getTestPath( final String basedir, final String path )
+ {
+ return getTestFile( basedir, path ).getAbsolutePath();
+ }
+
+ public static String getBasedir()
+ {
+ if ( basedir != null )
+ {
+ return basedir;
+ }
+
+ basedir = System.getProperty( "basedir" );
+
+ if ( basedir == null )
+ {
+ basedir = new File( "" ).getAbsolutePath();
+ }
+
+ return basedir;
+ }
+
+ public String getTestConfiguration()
+ {
+ return getTestConfiguration( getClass() );
+ }
+
+ public static String getTestConfiguration( final Class<?> clazz )
+ {
+ final String s = clazz.getName().replace( '.', '/' );
+
+ return s.substring( 0, s.indexOf( "$" ) ) + ".xml";
+ }
+}
\ No newline at end of file
diff --git a/maven-scm-test/src/main/java/org/apache/maven/scm/ScmTckTestCase.java b/maven-scm-test/src/main/java/org/apache/maven/scm/ScmTckTestCase.java
index 996a4fe29..f9193c336 100644
--- a/maven-scm-test/src/main/java/org/apache/maven/scm/ScmTckTestCase.java
+++ b/maven-scm-test/src/main/java/org/apache/maven/scm/ScmTckTestCase.java
@@ -34,6 +34,9 @@ import org.apache.maven.scm.provider.ScmProvider;
import org.apache.maven.scm.repository.ScmRepository;
import org.codehaus.plexus.util.StringUtils;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
/**
* Base class for all TcK tests.
* <p>
@@ -98,14 +101,14 @@ public abstract class ScmTckTestCase
/**
* {@inheritDoc}
*/
- protected void setUp()
+ public void setUp()
throws Exception
{
super.setUp();
scmRepository = null;
- scmFileNames = new ArrayList<String>( 4 );
+ scmFileNames = new ArrayList<>( 4 );
scmFileNames.add( "/pom.xml" );
scmFileNames.add( "/readme.txt" );
scmFileNames.add( "/src/main/java/Application.java" );
@@ -135,10 +138,9 @@ public abstract class ScmTckTestCase
/**
* Provided to allow removeRepo() to be called.
- * @see junit.framework.TestCase#tearDown()
*/
@Override
- protected void tearDown()
+ public void tearDown()
throws Exception
{
super.tearDown();
@@ -231,7 +233,7 @@ public abstract class ScmTckTestCase
return null;
}
- Map<String, ScmFile> mappedFiles = new TreeMap<String, ScmFile>();
+ Map<String, ScmFile> mappedFiles = new TreeMap<>();
for ( ScmFile scmFile : files )
{
String path = StringUtils.replace( scmFile.getPath(), "\\", "/" );
diff --git a/maven-scm-test/src/main/java/org/apache/maven/scm/ScmTestCase.java b/maven-scm-test/src/main/java/org/apache/maven/scm/ScmTestCase.java
index a447dc803..dd779d39a 100644
--- a/maven-scm-test/src/main/java/org/apache/maven/scm/ScmTestCase.java
+++ b/maven-scm-test/src/main/java/org/apache/maven/scm/ScmTestCase.java
@@ -23,9 +23,7 @@ import org.apache.maven.scm.manager.ScmManager;
import org.apache.maven.scm.repository.ScmRepository;
import org.codehaus.plexus.ContainerConfiguration;
import org.codehaus.plexus.PlexusConstants;
-import org.codehaus.plexus.PlexusTestCase;
import org.codehaus.plexus.util.FileUtils;
-import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.cli.CommandLineUtils;
import org.codehaus.plexus.util.cli.CommandLineUtils.StringStreamConsumer;
@@ -39,6 +37,11 @@ import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
/**
* Base class for all SCM tests. Consumers will typically
* extend this class while tck test would extend ScmTckTestCase.
@@ -50,7 +53,7 @@ import java.util.TimeZone;
*
*/
public abstract class ScmTestCase
- extends PlexusTestCase
+ extends PlexusJUnit4TestSupport
{
protected static final TimeZone GMT_TIME_ZONE = TimeZone.getTimeZone( "GMT" );
@@ -60,7 +63,8 @@ public abstract class ScmTestCase
private SecDispatcher secDispatcher;
- protected void setUp()
+ @Override
+ public void setUp()
throws Exception
{
super.setUp();
@@ -90,7 +94,7 @@ public abstract class ScmTestCase
*/
protected File getRepositoryRoot()
{
- return PlexusTestCase.getTestFile( "target/scm-test/repository" );
+ return PlexusJUnit4TestSupport.getTestFile( "target/scm-test/repository" );
}
/**
@@ -98,7 +102,7 @@ public abstract class ScmTestCase
*/
protected File getRepository()
{
- return PlexusTestCase.getTestFile( "/src/test/repository" );
+ return PlexusJUnit4TestSupport.getTestFile( "/src/test/repository" );
}
/**
@@ -106,7 +110,7 @@ public abstract class ScmTestCase
*/
protected File getWorkingCopy()
{
- return PlexusTestCase.getTestFile( "target/scm-test/working-copy" );
+ return PlexusJUnit4TestSupport.getTestFile( "target/scm-test/working-copy" );
}
/**
@@ -124,7 +128,7 @@ public abstract class ScmTestCase
*/
protected File getAssertionCopy()
{
- return PlexusTestCase.getTestFile( "target/scm-test/assertion-copy" );
+ return PlexusJUnit4TestSupport.getTestFile( "target/scm-test/assertion-copy" );
}
/**
@@ -132,7 +136,7 @@ public abstract class ScmTestCase
*/
protected File getUpdatingCopy()
{
- return PlexusTestCase.getTestFile( "target/scm-test/updating-copy" );
+ return PlexusJUnit4TestSupport.getTestFile( "target/scm-test/updating-copy" );
}
protected ScmManager getScmManager()
@@ -158,7 +162,7 @@ public abstract class ScmTestCase
{
if ( secDispatcher == null )
{
- secDispatcher = (SecDispatcher) lookup( SecDispatcher.class, "mng-4384" );
+ secDispatcher = lookup( SecDispatcher.class, "mng-4384" );
}
return secDispatcher;
@@ -310,15 +314,10 @@ public abstract class ScmTestCase
assertTrue( parent.mkdirs() );
}
- FileWriter writer = new FileWriter( file );
- try
+ try ( FileWriter writer = new FileWriter( file ) )
{
writer.write( contents );
}
- finally
- {
- IOUtil.close( writer );
- }
}
protected void deleteDirectory( File directory )
diff --git a/maven-scm-test/src/main/java/org/apache/maven/scm/tck/command/blame/BlameCommandTckTest.java b/maven-scm-test/src/main/java/org/apache/maven/scm/tck/command/blame/BlameCommandTckTest.java
index 8f7dec899..a25605753 100644
--- a/maven-scm-test/src/main/java/org/apache/maven/scm/tck/command/blame/BlameCommandTckTest.java
+++ b/maven-scm-test/src/main/java/org/apache/maven/scm/tck/command/blame/BlameCommandTckTest.java
@@ -29,10 +29,14 @@ import org.apache.maven.scm.command.checkin.CheckInScmResult;
import org.apache.maven.scm.manager.ScmManager;
import org.apache.maven.scm.provider.ScmProvider;
import org.apache.maven.scm.repository.ScmRepository;
+import org.junit.Test;
import java.util.Date;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
/**
* @author Evgeny Mandrikov
@@ -42,6 +46,7 @@ public abstract class BlameCommandTckTest
{
private static final String COMMIT_MSG = "Second changelog";
+ @Test
public void testBlameCommand()
throws Exception
{
diff --git a/maven-scm-test/src/main/java/org/apache/maven/scm/tck/command/branch/BranchCommandTckTest.java b/maven-scm-test/src/main/java/org/apache/maven/scm/tck/command/branch/BranchCommandTckTest.java
index 280df970f..4e7dea5a4 100644
--- a/maven-scm-test/src/main/java/org/apache/maven/scm/tck/command/branch/BranchCommandTckTest.java
+++ b/maven-scm-test/src/main/java/org/apache/maven/scm/tck/command/branch/BranchCommandTckTest.java
@@ -27,10 +27,14 @@ import org.apache.maven.scm.command.checkin.CheckInScmResult;
import org.apache.maven.scm.command.checkout.CheckOutScmResult;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.IOUtil;
+import org.junit.Test;
import java.io.File;
import java.io.FileWriter;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+
/**
* This test tests the branch command.
*
@@ -46,6 +50,7 @@ public abstract class BranchCommandTckTest
return "test-branch";
}
+ @Test
public void testBranchCommandTest()
throws Exception
{
diff --git a/maven-scm-test/src/main/java/org/apache/maven/scm/tck/command/changelog/ChangeLogCommandTckTest.java b/maven-scm-test/src/main/java/org/apache/maven/scm/tck/command/changelog/ChangeLogCommandTckTest.java
index 1b9ac7ac7..40d6228ff 100644
--- a/maven-scm-test/src/main/java/org/apache/maven/scm/tck/command/changelog/ChangeLogCommandTckTest.java
+++ b/maven-scm-test/src/main/java/org/apache/maven/scm/tck/command/changelog/ChangeLogCommandTckTest.java
@@ -28,9 +28,13 @@ import org.apache.maven.scm.ScmVersion;
import org.apache.maven.scm.command.changelog.ChangeLogScmResult;
import org.apache.maven.scm.command.checkin.CheckInScmResult;
import org.apache.maven.scm.provider.ScmProvider;
+import org.junit.Test;
import java.util.Date;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
/**
* Test Changlog command. <br>
* 1. Get initial log <br>
@@ -46,6 +50,7 @@ public abstract class ChangeLogCommandTckTest
{
private static final String COMMIT_MSG = "Second changelog";
+ @Test
public void testChangeLogCommand()
throws Exception
{
diff --git a/maven-scm-test/src/main/java/org/apache/maven/scm/tck/command/checkin/CheckInCommandTckTest.java b/maven-scm-test/src/main/java/org/apache/maven/scm/tck/command/checkin/CheckInCommandTckTest.java
index 0b053b9f5..ac652c7d3 100644
--- a/maven-scm-test/src/main/java/org/apache/maven/scm/tck/command/checkin/CheckInCommandTckTest.java
+++ b/maven-scm-test/src/main/java/org/apache/maven/scm/tck/command/checkin/CheckInCommandTckTest.java
@@ -28,6 +28,7 @@ import org.apache.maven.scm.command.checkin.CheckInScmResult;
import org.apache.maven.scm.command.checkout.CheckOutScmResult;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.IOUtil;
+import org.junit.Test;
import java.io.File;
import java.io.FileWriter;
@@ -35,6 +36,11 @@ import java.io.PrintWriter;
import java.util.List;
import java.util.Map;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
/**
* This test tests the check out command.
*
@@ -43,6 +49,7 @@ import java.util.Map;
public abstract class CheckInCommandTckTest
extends ScmTckTestCase
{
+ @Test
public void testCheckInCommandTest()
throws Exception
{
@@ -112,6 +119,7 @@ public abstract class CheckInCommandTckTest
assertEquals( "check readme.txt contents", "changed file", FileUtils.fileRead( readmeTxt ) );
}
+ @Test
public void testCheckInCommandPartialFileset()
throws Exception
{
diff --git a/maven-scm-test/src/main/java/org/apache/maven/scm/tck/command/checkout/CheckOutCommandTckTest.java b/maven-scm-test/src/main/java/org/apache/maven/scm/tck/command/checkout/CheckOutCommandTckTest.java
index c4351a662..71f1119a4 100644
--- a/maven-scm-test/src/main/java/org/apache/maven/scm/tck/command/checkout/CheckOutCommandTckTest.java
+++ b/maven-scm-test/src/main/java/org/apache/maven/scm/tck/command/checkout/CheckOutCommandTckTest.java
@@ -27,6 +27,9 @@ import java.util.TreeSet;
import org.apache.maven.scm.ScmFile;
import org.apache.maven.scm.ScmTckTestCase;
import org.apache.maven.scm.command.checkout.CheckOutScmResult;
+import org.junit.Test;
+
+import static org.junit.Assert.fail;
/**
* This test tests the check out command.
@@ -37,6 +40,7 @@ import org.apache.maven.scm.command.checkout.CheckOutScmResult;
public abstract class CheckOutCommandTckTest
extends ScmTckTestCase
{
+ @Test
public void testCheckOutCommandTest()
throws Exception
{
diff --git a/maven-scm-test/src/main/java/org/apache/maven/scm/tck/command/diff/DiffCommandTckTest.java b/maven-scm-test/src/main/java/org/apache/maven/scm/tck/command/diff/DiffCommandTckTest.java
index 62666d765..d70237dff 100644
--- a/maven-scm-test/src/main/java/org/apache/maven/scm/tck/command/diff/DiffCommandTckTest.java
+++ b/maven-scm-test/src/main/java/org/apache/maven/scm/tck/command/diff/DiffCommandTckTest.java
@@ -27,6 +27,7 @@ import org.apache.maven.scm.ScmVersion;
import org.apache.maven.scm.command.diff.DiffScmResult;
import org.apache.maven.scm.provider.ScmProvider;
import org.apache.maven.scm.repository.ScmRepository;
+import org.junit.Test;
import java.io.File;
import java.util.Iterator;
@@ -34,6 +35,10 @@ import java.util.List;
import java.util.Map;
import java.util.TreeSet;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
/**
* This test tests the diff command.
*
@@ -44,6 +49,7 @@ public abstract class DiffCommandTckTest
extends ScmTckTestCase
{
+ @Test
public void testDiffCommand()
throws Exception
{
diff --git a/maven-scm-test/src/main/java/org/apache/maven/scm/tck/command/list/ListCommandTckTest.java b/maven-scm-test/src/main/java/org/apache/maven/scm/tck/command/list/ListCommandTckTest.java
index 1de8dbcb5..63e49008f 100644
--- a/maven-scm-test/src/main/java/org/apache/maven/scm/tck/command/list/ListCommandTckTest.java
+++ b/maven-scm-test/src/main/java/org/apache/maven/scm/tck/command/list/ListCommandTckTest.java
@@ -28,6 +28,11 @@ import org.apache.maven.scm.ScmTckTestCase;
import org.apache.maven.scm.ScmVersion;
import org.apache.maven.scm.command.list.ListScmResult;
import org.apache.maven.scm.provider.ScmProvider;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
/**
* This test tests the list command.
@@ -38,6 +43,7 @@ import org.apache.maven.scm.provider.ScmProvider;
public abstract class ListCommandTckTest
extends ScmTckTestCase
{
+ @Test
public void testListCommandTest()
throws Exception
{
@@ -48,6 +54,7 @@ public abstract class ListCommandTckTest
assertEquals( "The result of the list command doesn't have all the files in SCM: " + files, 3, files.size() );
}
+ @Test
public void testListCommandRecursiveTest()
throws Exception
{
@@ -58,6 +65,7 @@ public abstract class ListCommandTckTest
assertEquals( "The result of the list command doesn't have all the files in SCM: " + files, 10, files.size() );
}
+ @Test
public void testListCommandUnexistantFileTest()
throws Exception
{
diff --git a/maven-scm-test/src/main/java/org/apache/maven/scm/tck/command/mkdir/MkdirCommandTckTest.java b/maven-scm-test/src/main/java/org/apache/maven/scm/tck/command/mkdir/MkdirCommandTckTest.java
index ba8b565f2..2e393ff5d 100644
--- a/maven-scm-test/src/main/java/org/apache/maven/scm/tck/command/mkdir/MkdirCommandTckTest.java
+++ b/maven-scm-test/src/main/java/org/apache/maven/scm/tck/command/mkdir/MkdirCommandTckTest.java
@@ -24,6 +24,10 @@ import java.io.File;
import org.apache.maven.scm.ScmFileSet;
import org.apache.maven.scm.ScmTckTestCase;
import org.apache.maven.scm.command.mkdir.MkdirScmResult;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
/**
* This test tests the mkdir command.
@@ -34,6 +38,7 @@ import org.apache.maven.scm.command.mkdir.MkdirScmResult;
public abstract class MkdirCommandTckTest
extends ScmTckTestCase
{
+ @Test
public void testMkdirCommandMkdirLocal()
throws Exception
{
diff --git a/maven-scm-test/src/main/java/org/apache/maven/scm/tck/command/remoteinfo/AbstractRemoteInfoCommandTckTest.java b/maven-scm-test/src/main/java/org/apache/maven/scm/tck/command/remoteinfo/AbstractRemoteInfoCommandTckTest.java
index e7e8e0bda..56b4edd6e 100644
--- a/maven-scm-test/src/main/java/org/apache/maven/scm/tck/command/remoteinfo/AbstractRemoteInfoCommandTckTest.java
+++ b/maven-scm-test/src/main/java/org/apache/maven/scm/tck/command/remoteinfo/AbstractRemoteInfoCommandTckTest.java
@@ -24,6 +24,7 @@ import org.apache.maven.scm.ScmTckTestCase;
import org.apache.maven.scm.command.remoteinfo.RemoteInfoScmResult;
import org.apache.maven.scm.provider.ScmProvider;
import org.apache.maven.scm.provider.ScmProviderRepository;
+import org.junit.Test;
/**
* This test tests the remote info command.
@@ -43,6 +44,7 @@ public abstract class AbstractRemoteInfoCommandTckTest
protected abstract ScmProviderRepository getScmProviderRepository()
throws Exception;
+ @Test
public void testRemoteInfoCommand()
throws Exception
{
diff --git a/maven-scm-test/src/main/java/org/apache/maven/scm/tck/command/status/StatusCommandTckTest.java b/maven-scm-test/src/main/java/org/apache/maven/scm/tck/command/status/StatusCommandTckTest.java
index 6b07a0c4b..2c338db46 100644
--- a/maven-scm-test/src/main/java/org/apache/maven/scm/tck/command/status/StatusCommandTckTest.java
+++ b/maven-scm-test/src/main/java/org/apache/maven/scm/tck/command/status/StatusCommandTckTest.java
@@ -28,12 +28,18 @@ import org.apache.maven.scm.command.checkin.CheckInScmResult;
import org.apache.maven.scm.command.status.StatusScmResult;
import org.apache.maven.scm.manager.ScmManager;
import org.apache.maven.scm.repository.ScmRepository;
+import org.junit.Test;
import java.io.File;
import java.util.Iterator;
import java.util.List;
import java.util.TreeSet;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
/**
* This test tests the status command.
* <p>
@@ -74,6 +80,7 @@ public abstract class StatusCommandTckTest
}
+ @Test
public void testStatusCommand()
throws Exception
{
diff --git a/maven-scm-test/src/main/java/org/apache/maven/scm/tck/command/tag/TagCommandTckTest.java b/maven-scm-test/src/main/java/org/apache/maven/scm/tck/command/tag/TagCommandTckTest.java
index 566957fde..8eae4f425 100644
--- a/maven-scm-test/src/main/java/org/apache/maven/scm/tck/command/tag/TagCommandTckTest.java
+++ b/maven-scm-test/src/main/java/org/apache/maven/scm/tck/command/tag/TagCommandTckTest.java
@@ -27,10 +27,14 @@ import org.apache.maven.scm.command.checkout.CheckOutScmResult;
import org.apache.maven.scm.command.tag.TagScmResult;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.IOUtil;
+import org.junit.Test;
import java.io.File;
import java.io.FileWriter;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+
/**
* This test tests the tag command.
*
@@ -46,6 +50,7 @@ public abstract class TagCommandTckTest
return "test-tag";
}
+ @Test
public void testTagCommandTest()
throws Exception
{
diff --git a/maven-scm-test/src/main/java/org/apache/maven/scm/tck/command/untag/UntagCommandTckTest.java b/maven-scm-test/src/main/java/org/apache/maven/scm/tck/command/untag/UntagCommandTckTest.java
index 2968cacdb..481ed4c7d 100644
--- a/maven-scm-test/src/main/java/org/apache/maven/scm/tck/command/untag/UntagCommandTckTest.java
+++ b/maven-scm-test/src/main/java/org/apache/maven/scm/tck/command/untag/UntagCommandTckTest.java
@@ -31,6 +31,9 @@ import org.apache.maven.scm.command.tag.TagScmResult;
import org.apache.maven.scm.command.untag.UntagScmResult;
import org.apache.maven.scm.provider.ScmProvider;
import org.apache.maven.scm.repository.ScmRepository;
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
/**
* This test tests the untag command.
@@ -44,6 +47,7 @@ public abstract class UntagCommandTckTest
return "test-untag";
}
+ @Test
public void testUntagCommandTest()
throws Exception
{
diff --git a/maven-scm-test/src/main/java/org/apache/maven/scm/tck/command/update/UpdateCommandTckTest.java b/maven-scm-test/src/main/java/org/apache/maven/scm/tck/command/update/UpdateCommandTckTest.java
index 8020bba4a..6c5c4db1b 100644
--- a/maven-scm-test/src/main/java/org/apache/maven/scm/tck/command/update/UpdateCommandTckTest.java
+++ b/maven-scm-test/src/main/java/org/apache/maven/scm/tck/command/update/UpdateCommandTckTest.java
@@ -36,6 +36,12 @@ import org.apache.maven.scm.command.update.UpdateScmResult;
import org.apache.maven.scm.manager.ScmManager;
import org.apache.maven.scm.repository.ScmRepository;
import org.codehaus.plexus.util.StringUtils;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
/**
* This test tests the update command.
@@ -73,6 +79,7 @@ public abstract class UpdateCommandTckTest
3, committedFiles.size() );
}
+ @Test
public void testUpdateCommand()
throws Exception
{