Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Look for the expanded original name when updating the view.
Added test case for Job names with a '/' restricted character.

JENKINS-50393
  • Loading branch information
p4paul committed Mar 28, 2018
1 parent 982b470 commit befa99f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
Expand Up @@ -70,7 +70,7 @@ private ClientView getClientView(WorkspaceSpec workspaceSpec) throws Exception{
int order = 0;
String specString = getExpand().format(workspaceSpec.getView(), false);
for (String line : specString.split("\\n")) {
String origName = getName();
String origName = getExpand().format(getName(), false);
line = line.replace(origName, clientName);

try {
Expand Down
21 changes: 21 additions & 0 deletions src/test/java/org/jenkinsci/plugins/p4/client/WorkspaceTest.java
Expand Up @@ -276,4 +276,25 @@ public void testSyncID() throws Exception {

assertEquals("jenkins-NODE_NAME-bar.ws", workspace.getSyncID());
}

@Test
public void testFolderProject_StreamWs() throws Exception {

String format = "jenkins-${NODE_NAME}-${JOB_NAME}.ws";
String view = "//depot/Data/... //" + format + "/...";
WorkspaceSpec spec = new WorkspaceSpec(view, null);
ManualWorkspaceImpl workspace = new ManualWorkspaceImpl("none", false, format, spec);

Populate populate = new AutoCleanImpl();
PerforceScm scm = new PerforceScm(CREDENTIAL, workspace, populate);

FreeStyleProject project = jenkins.createFreeStyleProject("Folder/test");
project.setScm(scm);
project.save();

FreeStyleBuild build;
Cause.UserIdCause cause = new Cause.UserIdCause();
build = project.scheduleBuild2(0, cause).get();
assertEquals(Result.SUCCESS, build.getResult());
}
}

0 comments on commit befa99f

Please sign in to comment.