@Test
public void testUpstreamChangesIncludedInChangeLog()
throws Exception
{
AccuRevCommandLine accurev = accurevTckTestUtil.getAccuRevCL();
// UpdatingCopy is a workspace rooted at a substream
String workingStream = accurevTckTestUtil.getWorkingStream();
String subStream = accurevTckTestUtil.getDepotName() + "_sub_stream";
accurev.mkstream( workingStream, subStream );
ScmRepository mainRepository = getScmRepository();
ScmProvider provider = getScmManager().getProviderByRepository( mainRepository );
// Create a workspace at the updating copy location backed by the substream
ScmBranch branch = new ScmBranch( "sub_stream" );
provider.checkOut( mainRepository, new ScmFileSet( getUpdatingCopy() ), branch );
Thread.sleep( 1000 );
ScmFileSet fileSet = new ScmFileSet( getWorkingCopy() );
// Make a timestamp that we know are after initial revision but before the second
Date timeBeforeUpstreamCheckin = new Date(); // Current time
// pause a couple seconds... [SCM-244]
Thread.sleep( 2000 );
// Make a change to the readme.txt and commit the change
ScmTestCase.makeFile( getWorkingCopy(), "/readme.txt", "changed readme.txt" );
ScmTestCase.makeFile( getWorkingCopy(), "/src/test/java/Test.java", "changed Test.java" );
CheckInScmResult checkInResult = provider.checkIn( mainRepository, fileSet, "upstream workspace promote" );
assertTrue( "Unable to checkin changes to the repository", checkInResult.isSuccess() );
Thread.sleep( 2000 );
Date timeBeforeDownstreamCheckin = new Date();
Thread.sleep( 2000 );
ScmFileSet updateFileSet = new ScmFileSet( getUpdatingCopy() );
provider.update( mainRepository, updateFileSet );
ScmTestCase.makeFile( getUpdatingCopy(), "/pom.xml", "changed pom.xml" );
ScmTestCase.makeFile( getUpdatingCopy(), "/src/test/java/Test.java", "changed again Test.java" );
checkInResult = provider.checkIn( mainRepository, updateFileSet, "downstream workspace promote" );
assertTrue( "Unable to checkin changes to the repository", checkInResult.isSuccess() );
Thread.sleep( 2000 );
Date timeBeforeDownstreamPromote = new Date();
List<File> promotedFiles = new ArrayList<File>();
accurev.promoteStream( subStream, "stream promote", promotedFiles );
Thread.sleep( 2000 );
Date timeEnd = new Date();