package com.perforce.maven.scm.provider.p4.cli;
import java.io.File;
import org.codehaus.plexus.util.Os;
import org.codehaus.plexus.util.cli.CommandLineException;
import org.codehaus.plexus.util.cli.Commandline;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import com.perforce.maven.scm.provider.p4.AbstractPlexusTestCase;
import com.perforce.maven.scm.provider.p4.P4ScmTestUtils;
public class MvnCommandTest
extends AbstractPlexusTestCase
{
@Test
@Ignore //this only works if this provider installed on local repo. Need to move it to IT
public void testClientDiscovery()
throws CommandLineException
{
//test against this project SCM Url
Commandline cl = new Commandline();
cl.setExecutable( this.getMvn() );
cl.setWorkingDirectory( new File( getBasedir() ) );
cl.createArg().setLine( "scm:status" );
StringBufferStreamConsumer stdout = new StringBufferStreamConsumer();
StringBufferStreamConsumer stderr = new StringBufferStreamConsumer();
P4ScmTestUtils.executeCommandLine( cl, stdout, stderr );
Assert.assertFalse( "Current client is not discoverable.", stdout.getOutput().toString().contains( "client -d" ) );
Assert.assertFalse( "Current client is not discoverable.", stdout.getOutput().toString().contains( "-MavenSCM-" ) );
cl.setWorkingDirectory( new File( getBasedir() ).getParentFile() );
stdout = new StringBufferStreamConsumer();
stderr = new StringBufferStreamConsumer();
P4ScmTestUtils.executeCommandLine( cl, stdout, stderr );
Assert.assertFalse( "Current client is not discoverable.", stdout.getOutput().toString().contains( "client -d" ) );
Assert.assertFalse( "Current client is not discoverable.", stdout.getOutput().toString().contains( "-MavenSCM-" ) );
}
private String getMvn()
{
String mvn = "mvn";
if ( Os.isFamily( "windows" ) )
{
mvn += ".bat";
}
return mvn;
}
}
# |
Change |
User |
Description |
Committed |
|
#2
|
19967 |
jkovisto |
Pull over numerous changes from @dantran's branch from change 16716. |
|
|
#1
|
10055 |
Matt Attaway |
Pull over numerous changes from @dantran's branch. |
|
|
//guest/dantran/p4maven/p4maven-provider/src/test/java/com/perforce/maven/scm/provider/p4/cli/MvnCommandTest.java |
#2
|
9537 |
dantran |
disable last test, since it cannt not at junit test, need to move to IT |
|
|
#1
|
9536 |
dantran |
Add current client discovery test |
|
|