|
30 | 30 | import hudson.model.Result; |
31 | 31 | import hudson.plugins.git.BranchSpec; |
32 | 32 | import hudson.plugins.git.GitSCM; |
33 | | -import hudson.plugins.git.SubmoduleConfig; |
34 | 33 | import hudson.plugins.git.UserRemoteConfig; |
35 | | -import hudson.plugins.git.extensions.GitSCMExtension; |
36 | | -import hudson.slaves.WorkspaceList; |
37 | | -import hudson.scm.SubversionSCM; |
38 | 34 | import hudson.scm.ChangeLogSet; |
| 35 | +import hudson.scm.SubversionSCM; |
| 36 | +import hudson.slaves.WorkspaceList; |
39 | 37 | import java.util.Collection; |
40 | 38 | import java.util.Collections; |
41 | 39 | import java.util.Iterator; |
|
45 | 43 | import jenkins.plugins.git.GitSampleRepoRule; |
46 | 44 | import jenkins.scm.impl.subversion.SubversionSCMSource; |
47 | 45 | import jenkins.scm.impl.subversion.SubversionSampleRepoRule; |
| 46 | +import static org.hamcrest.MatcherAssert.assertThat; |
| 47 | +import static org.hamcrest.Matchers.is; |
| 48 | +import static org.hamcrest.Matchers.nullValue; |
48 | 49 | import org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition; |
49 | 50 | import org.jenkinsci.plugins.workflow.cps.GlobalVariable; |
50 | 51 | import org.jenkinsci.plugins.workflow.cps.global.GrapeTest; |
51 | 52 | import org.jenkinsci.plugins.workflow.cps.global.UserDefinedGlobalVariable; |
52 | 53 | import org.jenkinsci.plugins.workflow.cps.replay.ReplayAction; |
53 | 54 | import org.jenkinsci.plugins.workflow.job.WorkflowJob; |
54 | 55 | import org.jenkinsci.plugins.workflow.job.WorkflowRun; |
55 | | -import static org.junit.Assert.*; |
| 56 | +import static org.junit.Assert.assertEquals; |
| 57 | +import static org.junit.Assert.assertNotNull; |
56 | 58 | import org.junit.ClassRule; |
57 | | -import org.junit.Test; |
58 | 59 | import org.junit.Rule; |
| 60 | +import org.junit.Test; |
59 | 61 | import org.jvnet.hudson.test.BuildWatcher; |
60 | 62 | import org.jvnet.hudson.test.Issue; |
61 | 63 | import org.jvnet.hudson.test.JenkinsRule; |
62 | 64 | import org.jvnet.hudson.test.TestExtension; |
| 65 | +import org.jvnet.hudson.test.WithoutJenkins; |
63 | 66 | import org.jvnet.hudson.test.recipes.LocalData; |
64 | 67 |
|
65 | | -import static org.hamcrest.Matchers.nullValue; |
66 | | - |
67 | 68 | public class LibraryAdderTest { |
68 | 69 |
|
69 | 70 | @ClassRule public static BuildWatcher buildWatcher = new BuildWatcher(); |
@@ -103,7 +104,7 @@ public class LibraryAdderTest { |
103 | 104 | new SCMRetriever( |
104 | 105 | new GitSCM(Collections.singletonList(new UserRemoteConfig(sampleRepo.fileUrl(), null, null, null)), |
105 | 106 | Collections.singletonList(new BranchSpec("${library.stuff.version}")), |
106 | | - false, Collections.<SubmoduleConfig>emptyList(), null, null, Collections.<GitSCMExtension>emptyList()))); |
| 107 | + null, null, Collections.emptyList()))); |
107 | 108 | stuff.setDefaultVersion("master"); |
108 | 109 | stuff.setImplicit(true); |
109 | 110 | GlobalLibraries.get().setLibraries(Collections.singletonList(stuff)); |
@@ -472,4 +473,12 @@ public void correctLibraryDirectoryUsedWhenResumingOldBuild() throws Exception { |
472 | 473 | r.assertLogContains("called Foo", b); |
473 | 474 | } |
474 | 475 |
|
| 476 | + @Issue("JENKINS-68544") |
| 477 | + @WithoutJenkins |
| 478 | + @Test public void className() { |
| 479 | + assertThat(LibraryAdder.LoadedLibraries.className("/path/to/lib/src/some/pkg/Type.groovy", "/path/to/lib/src"), is("some.pkg.Type")); |
| 480 | + assertThat(LibraryAdder.LoadedLibraries.className("C:\\path\\to\\lib\\src\\some\\pkg\\Type.groovy", "C:\\path\\to\\lib\\src"), is("some.pkg.Type")); |
| 481 | + assertThat(LibraryAdder.LoadedLibraries.className("C:\\path\\to\\Extra\\lib\\src\\some\\pkg\\Type.groovy", "C:\\path\\to\\Extra\\lib\\src"), is("some.pkg.Type")); |
| 482 | + } |
| 483 | + |
475 | 484 | } |
0 commit comments