package org.jenkinsci.plugins.p4.client; import hudson.model.Cause; import hudson.model.FreeStyleBuild; import hudson.model.FreeStyleProject; import hudson.model.Result; import org.jenkinsci.plugins.p4.DefaultEnvironment; import org.jenkinsci.plugins.p4.PerforceScm; import org.jenkinsci.plugins.p4.SampleServerRule; import org.jenkinsci.plugins.p4.populate.AutoCleanImpl; import org.jenkinsci.plugins.p4.populate.Populate; import org.jenkinsci.plugins.p4.publish.PublishNotifier; import org.jenkinsci.plugins.p4.publish.SubmitImpl; import org.jenkinsci.plugins.p4.workspace.ManualWorkspaceImpl; import org.jenkinsci.plugins.p4.workspace.WorkspaceSpec; import org.junit.Before; import org.junit.ClassRule; import org.junit.Rule; import org.junit.Test; import org.jvnet.hudson.test.JenkinsRule; import java.util.List; import java.util.logging.Logger; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; public class PublishTest extends DefaultEnvironment { private static Logger logger = Logger.getLogger(FreeStyleTest.class.getName()); private static final String P4ROOT = "tmp-PublishTest-p4root"; @ClassRule public static JenkinsRule jenkins = new JenkinsRule(); @Rule public SampleServerRule p4d = new SampleServerRule(P4ROOT, VERSION); @Before public void buildCredentials() throws Exception { createCredentials("jenkins", "jenkins", p4d); } @Test public void testPublishWithPurge() throws Exception { FreeStyleProject project = jenkins.createFreeStyleProject("Publish-purge"); // Create workspace String client = "manual.ws"; String stream = null; String line = "LOCAL"; String view = "//depot/Data/... //" + client + "/..."; WorkspaceSpec spec = new WorkspaceSpec(true, true, false, false, false, false, stream, line, view); ManualWorkspaceImpl workspace = new ManualWorkspaceImpl("none", true, client, spec); // Populate with P4 scm Populate populate = new AutoCleanImpl(); PerforceScm scm = new PerforceScm(CREDENTIAL, workspace, populate); project.setScm(scm); // Create artifact files project.getBuildersList().add(new CreateArtifact("artifact.1", "content")); project.getBuildersList().add(new CreateArtifact("artifact.2", "content")); // Submit artifacts SubmitImpl submit = new SubmitImpl("publish", true, true, true, "3"); PublishNotifier publish = new PublishNotifier(CREDENTIAL, workspace, submit); project.getPublishersList().add(publish); project.save(); // Start build Cause.UserIdCause cause = new Cause.UserIdCause(); FreeStyleBuild build = project.scheduleBuild2(0, cause).get(); assertEquals(Result.SUCCESS, build.getResult()); List<String> log = build.getLog(LOG_LIMIT); assertTrue(log.contains("P4 Task: syncing files at change: 18")); assertTrue(log.contains("p4 reopen -c41 -t+S3 //manual.ws/...")); assertTrue(log.contains("... submitting files")); assertTrue(log.contains("p4 describe -s 41")); } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#15 | 29235 | Paul Allen |
Merge pull request #163 from skumar7322/master Added test case for PR160. |
||
#14 | 28967 | Paul Allen | Avoid local test failures by setting P4IGNORE. | ||
#13 | 26673 | Paul Allen |
Code cleanup - remove calls to Deprecated methods - Deprecated classes like AbstractStepImpl, AbstractStepDescriptorImpl and AbstractSynchronousStepExecution for P4TaggingStep |
||
#12 | 26094 | Paul Allen |
Merge pull request #105 from jenkinsci/publishFilter Publish path filter for reconcile JENKINS-56501 |
||
#11 | 25668 | Paul Allen |
Merge pull request #94 from lystor/bug-56414 JENKINS-56414: Support of Reconcile with Modtime in P4Publish |
||
#10 | 24939 | Paul Allen |
Escape unsupported XML low ascii characters with a '?'. JENKINS-52661 JENKINS-54841 |
||
#9 | 24805 | Paul Allen |
Tidy up connection methods. Cache TagAction calls to getTicket() when adding P4_TICKET to the Environment. JENKINS-54222 |
||
#8 | 24487 | Paul Allen | Perforce Connection Refactor. | ||
#7 | 23821 | Paul Allen |
Raise Submit errors in Publish step. JENKINS-49825 |
||
#6 | 23819 | Paul Allen | Cleanup test cases to use Credential ID. | ||
#5 | 21936 | Paul Allen |
Refactor tests for 17.1 release. Removed pseudo web server on FreeStyleTest |
||
#4 | 21794 | Paul Allen |
Merge pull request #39 from Dohbedoh/JENKINS-34825 Jenkins 34825 |
||
#3 | 21758 | Paul Allen |
Merge pull request #38 from jenkinsci/dev scm-api 2.0.2 updates |
||
#2 | 21171 | Paul Allen |
Jenkinsfile basic test. Moved Workflow tests out of Connection test class. |
||
#1 | 20980 | Paul Allen |
Functional test upgrade. Switched to RSH pipe for Perforce connection and upgraded to 15.1 P4D binaries. Made use of ClassRule for Jenkins (faster startup) and a Rule for Perforce with separate roots (to allow for parallel test runs). |