Skip to content

Commit

Permalink
[MRELEASE-1075] Move CVS-based tests to Subversion or Git
Browse files Browse the repository at this point in the history
This closes #90
  • Loading branch information
michael-o committed Jan 1, 2022
1 parent 0193b31 commit ac76d69
Show file tree
Hide file tree
Showing 18 changed files with 102 additions and 103 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public void testGetUrlFromProjectDevConnection()
{
ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder();
builder.setScmSourceUrl( "scm:svn:https://localhost/tmp/repo" );

MavenProject project = createProject( "1.0-SNAPSHOT" );

phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), Collections.singletonList( project ) );
Expand All @@ -120,7 +120,7 @@ public void testGetInvalidUrl()
throws Exception
{
ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder();
builder.setScmSourceUrl( "scm:cvs:" );
builder.setScmSourceUrl( "scm:svn:" );

MavenProject project = createProject( "1.0-SNAPSHOT" );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ public void testPrompterException()

// MRELEASE-110
@Test
public void testCvsTag()
public void testSvnTag()
throws Exception
{
// prepare
Expand All @@ -301,25 +301,25 @@ public void testCvsTag()
ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder();
builder.setInteractive( false );
builder.addReleaseVersion( "groupId:artifactId", "1.0" );
builder.setScmSourceUrl( "scm:cvs:pserver:anoncvs@localhost:/tmp/scm-repo:module" );
builder.setScmSourceUrl( "scm:svn:svn://localhost/repo" );

// execute
phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects );

// verify
assertEquals( "Check tag", "artifactId-1_0", ReleaseUtils.buildReleaseDescriptor( builder ).getScmReleaseLabel() );
assertEquals( "Check tag", "artifactId-1.0", ReleaseUtils.buildReleaseDescriptor( builder ).getScmReleaseLabel() );

// prepare
builder = new ReleaseDescriptorBuilder();
builder.setInteractive( false );
builder.addReleaseVersion( "groupId:artifactId", "1.0" );
builder.setScmSourceUrl( "scm:cvs:pserver:anoncvs@localhost:/tmp/scm-repo:module" );
builder.setScmSourceUrl( "scm:svn:svn://localhost/repo" );

// execute
phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects );

// verify
assertEquals( "Check tag", "artifactId-1_0", ReleaseUtils.buildReleaseDescriptor( builder ).getScmReleaseLabel() );
assertEquals( "Check tag", "artifactId-1.0", ReleaseUtils.buildReleaseDescriptor( builder ).getScmReleaseLabel() );

// never use prompter
verifyNoMoreInteractions( mockPrompter );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,12 @@ protected void unmapNextVersion( ReleaseDescriptorBuilder config, String project
}

@Test
public void testRewriteBasicPomWithCvs()
public void testRewriteBasicPomWithGit()
throws Exception
{

List<MavenProject> reactorProjects = createReactorProjects( "basic-pom-with-cvs" );
ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, "basic-pom-with-cvs" );
List<MavenProject> reactorProjects = createReactorProjects( "basic-pom-with-git" );
ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, "basic-pom-with-git" );
mapNextVersion( builder, "groupId:artifactId" );

phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects );
Expand Down Expand Up @@ -270,11 +270,11 @@ public void testRewriteBasicPomWithTagBaseAndVaryingScmUrls()
}

@Test
public void testRewriteBasicPomWithCvsFromTag()
public void testRewriteBasicPomWithGitFromTag()
throws Exception
{
List<MavenProject> reactorProjects = createReactorProjects( "basic-pom-with-cvs-from-tag" );
ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, "basic-pom-with-cvs-from-tag" );
List<MavenProject> reactorProjects = createReactorProjects( "basic-pom-with-git-from-tag" );
ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, "basic-pom-with-git-from-tag" );
mapNextVersion( builder, "groupId:artifactId" );

phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ protected String getRoleHint()
{
return "rewrite-poms-for-development";
}

@Override
protected Path getWorkingDirectory( String workingDir )
{
Expand Down Expand Up @@ -252,18 +252,18 @@ protected ReleaseDescriptorBuilder createConfigurationForWithParentNextVersion(
}

@Test
public void testRewriteBasicPomWithCvs()
public void testRewriteBasicPomWithGit()
throws Exception
{

List<MavenProject> reactorProjects = createReactorProjects( "basic-pom-with-cvs" );
ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, "basic-pom-with-cvs" );
List<MavenProject> reactorProjects = createReactorProjects( "basic-pom-with-git" );
ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, "basic-pom-with-git" );
mapNextVersion( builder, "groupId:artifactId" );

Scm scm = new Scm();
scm.setConnection( "${scm.base}:pserver:anoncvs@localhost:/tmp/scm-repo:module" );
scm.setDeveloperConnection( "${scm.base}:ext:${username}@localhost:/tmp/scm-repo:module" );
scm.setUrl( "${baseUrl}/module" );
scm.setConnection( "${scm.base}:git://localhost/repo" );
scm.setDeveloperConnection( "${scm.base}:git+ssh://${username}@localhost/tmp/repo" );
scm.setUrl( "${baseUrl}/repo" );
builder.addOriginalScmInfo( "groupId:artifactId", scm );

phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects );
Expand All @@ -272,18 +272,18 @@ public void testRewriteBasicPomWithCvs()
}

@Test
public void testRewriteBasicPomWithCvsFromTag()
public void testRewriteBasicPomWithGitFromTag()
throws Exception
{

List<MavenProject> reactorProjects = createReactorProjects( "basic-pom-with-cvs-from-tag" );
ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, "basic-pom-with-cvs-from-tag" );
List<MavenProject> reactorProjects = createReactorProjects( "basic-pom-with-git-from-tag" );
ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, "basic-pom-with-git-from-tag" );
mapNextVersion( builder, "groupId:artifactId" );

Scm scm = new Scm();
scm.setConnection( "scm:cvs:pserver:anoncvs@localhost:/tmp/scm-repo:module" );
scm.setDeveloperConnection( "scm:cvs:ext:${username}@localhost:/tmp/scm-repo:module" );
scm.setUrl( "http://localhost/viewcvs.cgi/module" );
scm.setConnection( "scm:git:git://localhost/repo" );
scm.setDeveloperConnection( "scm:git:git+ssh://${username}@localhost/tmp/repo" );
scm.setUrl( "http://localhost/viewgit.cgi/repo" );
scm.setTag( "original-label" );
builder.addOriginalScmInfo( "groupId:artifactId", scm );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ protected String getRoleHint()
{
return "rewrite-poms-for-release";
}

@Override
protected Path getWorkingDirectory( String workingDir )
{
Expand Down Expand Up @@ -213,12 +213,12 @@ protected void unmapNextVersion( ReleaseDescriptorBuilder config, String project
}

@Test
public void testRewriteBasicPomWithCvs()
public void testRewriteBasicPomWithGit()
throws Exception
{

List<MavenProject> reactorProjects = createReactorProjects( "basic-pom-with-cvs" );
ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, "basic-pom-with-cvs" );
List<MavenProject> reactorProjects = createReactorProjects( "basic-pom-with-git" );
ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, "basic-pom-with-git" );
mapNextVersion( builder, "groupId:artifactId" );

phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects );
Expand Down Expand Up @@ -270,11 +270,11 @@ public void testRewriteBasicPomWithTagBaseAndVaryingScmUrls()
}

@Test
public void testRewriteBasicPomWithCvsFromTag()
public void testRewriteBasicPomWithGitFromTag()
throws Exception
{
List<MavenProject> reactorProjects = createReactorProjects( "basic-pom-with-cvs-from-tag" );
ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, "basic-pom-with-cvs-from-tag" );
List<MavenProject> reactorProjects = createReactorProjects( "basic-pom-with-git-from-tag" );
ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, "basic-pom-with-git-from-tag" );
mapNextVersion( builder, "groupId:artifactId" );

phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ public class DefaultScmRepositoryConfiguratorTest
{
private ScmRepositoryConfigurator scmRepositoryConfigurator;

private static final int CVS_PORT = 2401;

@Override
protected void setUp()
throws Exception
Expand All @@ -59,8 +57,8 @@ public void testGetConfiguredRepository()

ScmRepository repository = scmRepositoryConfigurator.getConfiguredRepository( ReleaseUtils.buildReleaseDescriptor( builder ), null );

assertEquals( "check provider", "cvs", repository.getProvider() );
assertEquals( "check username", "anoncvs", repository.getProviderRepository().getUser() );
assertEquals( "check provider", "svn", repository.getProvider() );
assertNull( "check username", repository.getProviderRepository().getUser() );
assertNull( "check password", repository.getProviderRepository().getPassword() );
}

Expand Down Expand Up @@ -93,22 +91,22 @@ public void testGetConfiguredRepositoryWithHost()
{
Settings settings = new Settings();
Server server = new Server();
server.setId( "localhost:" + CVS_PORT );
server.setId( "localhost" );
server.setUsername( "settings-username" );
server.setPassword( "settings-password" );
server.setPrivateKey( "settings-private-key" );
server.setPassphrase( "settings-passphrase" );
settings.addServer( server );

ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder();
builder.setScmSourceUrl( "scm:cvs:pserver:anoncvs@localhost:/home/cvs:module" );
builder.setScmSourceUrl( "scm:svn:http://localhost/repo" );

ScmRepository repository = scmRepositoryConfigurator.getConfiguredRepository( ReleaseUtils.buildReleaseDescriptor( builder ), settings );

ScmProviderRepositoryWithHost providerRepository =
(ScmProviderRepositoryWithHost) repository.getProviderRepository();
assertEquals( "check host", "localhost", providerRepository.getHost() );
assertEquals( "check port", CVS_PORT, providerRepository.getPort() );
assertEquals( "check port", 0, providerRepository.getPort() );
assertEquals( "check username", "settings-username", providerRepository.getUser() );
assertEquals( "check password", "settings-password", providerRepository.getPassword() );
assertEquals( "check private key", "settings-private-key", providerRepository.getPrivateKey() );
Expand Down Expand Up @@ -179,7 +177,7 @@ public void testGetConfiguredRepositoryInvalidScmUrlParameters()
throws NoSuchScmProviderException
{
ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder();
builder.setScmSourceUrl( "scm:cvs:" );
builder.setScmSourceUrl( "scm:svn:" );

try
{
Expand All @@ -201,13 +199,13 @@ public void testGetRepositoryProvider()
ScmRepository repository = scmRepositoryConfigurator.getConfiguredRepository( ReleaseUtils.buildReleaseDescriptor( builder ), null );

ScmProvider provider = scmRepositoryConfigurator.getRepositoryProvider( repository );
assertEquals( "Check SCM provider", "cvs", provider.getScmType() );
assertEquals( "Check SCM provider", "svn", provider.getScmType() );
}

private static ReleaseDescriptorBuilder createReleaseDescriptorBuilder()
{
ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder();
builder.setScmSourceUrl( "scm:cvs:pserver:anoncvs@localhost:/home/cvs:module" );
builder.setScmSourceUrl( "scm:svn:http://localhost/repo" );
return builder;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
</prerequisites>

<scm>
<connection>${scm.base}:pserver:anoncvs@localhost:/tmp/scm-repo:module</connection>
<developerConnection>${scm.base}:ext:${username}@localhost:/tmp/scm-repo:module</developerConnection>
<url>${baseUrl}/module</url>
<connection>${scm.base}:git://localhost/repo</connection>
<developerConnection>${scm.base}:git+ssh://${username}@localhost/tmp/repo</developerConnection>
<url>${baseUrl}/repo</url>
<tag>release-label</tag>
</scm>
<properties>
<scm.base>scm:cvs</scm.base>
<baseUrl>http://localhost/viewcvs.cgi</baseUrl>
<scm.base>scm:git</scm.base>
<baseUrl>http://localhost/viewgit.cgi</baseUrl>
</properties>
</project>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
</prerequisites>

<scm>
<connection>${scm.base}:pserver:anoncvs@localhost:/tmp/scm-repo:module</connection>
<developerConnection>${scm.base}:ext:${username}@localhost:/tmp/scm-repo:module</developerConnection>
<url>${baseUrl}/module</url>
<connection>${scm.base}:git://localhost/repo</connection>
<developerConnection>${scm.base}:git+ssh://${username}@localhost/tmp/repo</developerConnection>
<url>${baseUrl}/repo</url>
<tag>original-tag</tag>
</scm>
<properties>
<scm.base>scm:cvs</scm.base>
<baseUrl>http://localhost/viewcvs.cgi</baseUrl>
<scm.base>scm:git</scm.base>
<baseUrl>http://localhost/viewgit.cgi</baseUrl>
</properties>
</project>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
</prerequisites>

<scm>
<connection>scm:cvs:pserver:anoncvs@localhost:/tmp/scm-repo:module</connection>
<developerConnection>scm:cvs:ext:${username}@localhost:/tmp/scm-repo:module</developerConnection>
<url>http://localhost/viewcvs.cgi/module</url>
<connection>scm:git:git://localhost/repo</connection>
<developerConnection>scm:git:git+ssh://${username}@localhost/tmp/repo</developerConnection>
<url>http://localhost/viewgit.cgi/repo</url>
<tag>release-label</tag>
</scm>
</project>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
</prerequisites>

<scm>
<connection>scm:cvs:pserver:anoncvs@localhost:/tmp/scm-repo:module</connection>
<developerConnection>scm:cvs:ext:${username}@localhost:/tmp/scm-repo:module</developerConnection>
<url>http://localhost/viewcvs.cgi/module</url>
<connection>scm:git:git://localhost/repo</connection>
<developerConnection>scm:git:git+ssh://${username}@localhost/tmp/repo</developerConnection>
<url>http://localhost/viewgit.cgi/repo</url>
</scm>
</project>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
</prerequisites>

<scm>
<connection>scm:cvs:pserver:anoncvs@localhost:/tmp/scm-repo:module</connection>
<developerConnection>scm:cvs:ext:${username}@localhost:/tmp/scm-repo:module</developerConnection>
<url>http://localhost/viewcvs.cgi/module</url>
<connection>scm:git:git://localhost/repo</connection>
<developerConnection>scm:git:git+ssh://${username}@localhost/tmp/repo</developerConnection>
<url>http://localhost/viewgit.cgi/repo</url>
<tag>original-label</tag>
</scm>
</project>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
</prerequisites>

<scm>
<connection>scm:cvs:pserver:anoncvs@localhost:/tmp/scm-repo:module</connection>
<developerConnection>scm:cvs:ext:${username}@localhost:/tmp/scm-repo:module</developerConnection>
<url>http://localhost/viewcvs.cgi/module</url>
<connection>scm:git:git://localhost/repo</connection>
<developerConnection>scm:git:git+ssh://${username}@localhost/tmp/repo</developerConnection>
<url>http://localhost/viewgit.cgi/repo</url>
<tag>release-label</tag>
</scm>
</project>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@
</prerequisites>

<scm>
<connection>${scm.base}:pserver:anoncvs@localhost:/tmp/scm-repo:module</connection>
<developerConnection>${scm.base}:ext:${username}@localhost:/tmp/scm-repo:module</developerConnection>
<url>${baseUrl}/module</url>
<connection>${scm.base}:git://localhost/repo</connection>
<developerConnection>${scm.base}:git+ssh://${username}@localhost/tmp/repo</developerConnection>
<url>${baseUrl}/repo</url>
<tag>HEAD</tag>
</scm>
<properties>
<scm.base>scm:cvs</scm.base>
<baseUrl>http://localhost/viewcvs.cgi</baseUrl>
<scm.base>scm:git</scm.base>
<baseUrl>http://localhost/viewgit.cgi</baseUrl>
</properties>
</project>
</project>
Loading

0 comments on commit ac76d69

Please sign in to comment.