forked from eficode/ClearCaseUCMPlugin
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
685f3c3
commit 457c671
Showing
3 changed files
with
115 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
src/test/java/net/praqma/hudson/test/integration/child/ActivityTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
package net.praqma.hudson.test.integration.child; | ||
|
||
import java.io.File; | ||
import java.util.List; | ||
|
||
import org.junit.ClassRule; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.jvnet.hudson.test.JenkinsRule; | ||
|
||
import hudson.model.AbstractBuild; | ||
import hudson.model.User; | ||
import hudson.model.Result; | ||
import net.praqma.clearcase.Environment; | ||
import net.praqma.clearcase.exceptions.ClearCaseException; | ||
import net.praqma.clearcase.exceptions.UCMEntityNotFoundException; | ||
import net.praqma.clearcase.exceptions.UnableToCreateEntityException; | ||
import net.praqma.clearcase.exceptions.UnableToGetEntityException; | ||
import net.praqma.clearcase.exceptions.UnableToInitializeEntityException; | ||
import net.praqma.clearcase.ucm.entities.Activity; | ||
import net.praqma.clearcase.ucm.entities.Baseline; | ||
import net.praqma.clearcase.ucm.entities.Stream; | ||
import net.praqma.clearcase.ucm.entities.Baseline.LabelBehaviour; | ||
import net.praqma.clearcase.ucm.entities.Project.PromotionLevel; | ||
import net.praqma.clearcase.ucm.view.UCMView; | ||
import net.praqma.clearcase.util.ExceptionUtils; | ||
import net.praqma.hudson.test.CCUCMRule; | ||
import net.praqma.util.debug.Logger; | ||
|
||
import net.praqma.clearcase.test.annotations.ClearCaseUniqueVobName; | ||
import net.praqma.clearcase.test.junit.ClearCaseRule; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
public class ActivityTest { | ||
|
||
@ClassRule | ||
public static CCUCMRule jenkins = new CCUCMRule(); | ||
|
||
@Rule | ||
public static ClearCaseRule ccenv = new ClearCaseRule( "ccucm" ); | ||
|
||
private static Logger logger = Logger.getLogger(); | ||
|
||
public AbstractBuild<?, ?> initiateBuild( String projectName, boolean recommend, boolean tag, boolean description, boolean fail ) throws Exception { | ||
return jenkins.initiateBuild( projectName, "child", "_System@" + ccenv.getPVob(), "one_int@" + ccenv.getPVob(), recommend, tag, description, fail, true ); | ||
} | ||
|
||
@Test | ||
@ClearCaseUniqueVobName( name = "activity-chglg" ) | ||
public void activityInChangelog() throws Exception { | ||
|
||
Baseline baseline = getNewBaseline(); | ||
|
||
AbstractBuild<?, ?> build = initiateBuild( "activity-" + ccenv.getVobName(), false, false, false, false ); | ||
|
||
List<User> users = jenkins.getActivityUsers( build ); | ||
|
||
logger.debug( "Checking USERS" ); | ||
for( User user : users ) { | ||
logger.debug( "Checking \"" + user.getDisplayName() + "\"" ); | ||
assertNotNull( user.getDisplayName() ); | ||
assertFalse( user.getDisplayName().matches( "^\\s*$" ) ); | ||
} | ||
} | ||
|
||
protected Baseline getNewBaseline() throws ClearCaseException { | ||
/**/ | ||
String viewtag = ccenv.getVobName() + "_one_dev"; | ||
System.out.println( "VIEW: " + ccenv.context.views.get( viewtag ) ); | ||
File path = new File( ccenv.context.mvfs + "/" + ccenv.getVobName() + "_one_dev/" + ccenv.getVobName() ); | ||
|
||
System.out.println( "PATH: " + path ); | ||
|
||
Stream stream = Stream.get( "one_dev", ccenv.getPVob() ); | ||
Activity activity = Activity.create( "ccucm-activity", stream, ccenv.getPVob(), true, "ccucm activity", null, path ); | ||
UCMView.setActivity( activity, path, null, null ); | ||
|
||
try { | ||
ccenv.addNewElement( ccenv.context.components.get( "Model" ), path, "test2.txt" ); | ||
} catch( ClearCaseException e ) { | ||
ExceptionUtils.print( e, System.out, true ); | ||
} | ||
return Baseline.create( "baseline-for-test", ccenv.context.components.get( "_System" ), path, LabelBehaviour.FULL, false ); | ||
} | ||
|
||
} |