|
31 | 31 | import hudson.model.queue.QueueTaskFuture;
|
32 | 32 | import hudson.plugins.git.BranchSpec;
|
33 | 33 | import hudson.plugins.git.GitSCM;
|
34 |
| -import hudson.plugins.git.SubmoduleConfig; |
35 | 34 | import hudson.plugins.git.UserRemoteConfig;
|
36 |
| -import hudson.plugins.git.extensions.GitSCMExtension; |
37 |
| -import hudson.slaves.WorkspaceList; |
38 |
| -import hudson.scm.SubversionSCM; |
39 | 35 | import hudson.scm.ChangeLogSet;
|
40 |
| - |
| 36 | +import hudson.scm.SubversionSCM; |
| 37 | +import hudson.slaves.WorkspaceList; |
41 | 38 | import java.time.ZonedDateTime;
|
42 | 39 | import java.util.Collection;
|
43 | 40 | import java.util.Collections;
|
|
48 | 45 | import jenkins.plugins.git.GitSampleRepoRule;
|
49 | 46 | import jenkins.scm.impl.subversion.SubversionSCMSource;
|
50 | 47 | import jenkins.scm.impl.subversion.SubversionSampleRepoRule;
|
| 48 | +import static org.hamcrest.MatcherAssert.assertThat; |
| 49 | +import static org.hamcrest.Matchers.is; |
| 50 | +import static org.hamcrest.Matchers.nullValue; |
51 | 51 | import org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition;
|
52 | 52 | import org.jenkinsci.plugins.workflow.cps.GlobalVariable;
|
53 | 53 | import org.jenkinsci.plugins.workflow.cps.global.GrapeTest;
|
54 | 54 | import org.jenkinsci.plugins.workflow.cps.global.UserDefinedGlobalVariable;
|
55 | 55 | import org.jenkinsci.plugins.workflow.cps.replay.ReplayAction;
|
56 | 56 | import org.jenkinsci.plugins.workflow.job.WorkflowJob;
|
57 | 57 | import org.jenkinsci.plugins.workflow.job.WorkflowRun;
|
58 |
| -import static org.junit.Assert.*; |
| 58 | +import static org.junit.Assert.assertEquals; |
| 59 | +import static org.junit.Assert.assertNotNull; |
59 | 60 | import org.junit.ClassRule;
|
60 |
| -import org.junit.Test; |
61 | 61 | import org.junit.Rule;
|
| 62 | +import org.junit.Test; |
62 | 63 | import org.jvnet.hudson.test.BuildWatcher;
|
63 | 64 | import org.jvnet.hudson.test.Issue;
|
64 | 65 | import org.jvnet.hudson.test.JenkinsRule;
|
65 | 66 | import org.jvnet.hudson.test.TestExtension;
|
| 67 | +import org.jvnet.hudson.test.WithoutJenkins; |
66 | 68 | import org.jvnet.hudson.test.recipes.LocalData;
|
67 | 69 |
|
68 |
| -import static org.hamcrest.Matchers.nullValue; |
69 |
| - |
70 | 70 | public class LibraryAdderTest {
|
71 | 71 |
|
72 | 72 | @ClassRule public static BuildWatcher buildWatcher = new BuildWatcher();
|
@@ -106,7 +106,7 @@ public class LibraryAdderTest {
|
106 | 106 | new SCMRetriever(
|
107 | 107 | new GitSCM(Collections.singletonList(new UserRemoteConfig(sampleRepo.fileUrl(), null, null, null)),
|
108 | 108 | Collections.singletonList(new BranchSpec("${library.stuff.version}")),
|
109 |
| - false, Collections.<SubmoduleConfig>emptyList(), null, null, Collections.<GitSCMExtension>emptyList()))); |
| 109 | + null, null, Collections.emptyList()))); |
110 | 110 | stuff.setDefaultVersion("master");
|
111 | 111 | stuff.setImplicit(true);
|
112 | 112 | GlobalLibraries.get().setLibraries(Collections.singletonList(stuff));
|
@@ -512,4 +512,13 @@ public void parallelBuildsDontInterfereWithExpiredCache() throws Throwable {
|
512 | 512 | r.assertLogContains("is due for a refresh after", r1);
|
513 | 513 | r.assertLogContains("Library library@master is cached. Copying from home.", r2);
|
514 | 514 | }
|
| 515 | + |
| 516 | + @Issue("JENKINS-68544") |
| 517 | + @WithoutJenkins |
| 518 | + @Test public void className() { |
| 519 | + assertThat(LibraryAdder.LoadedLibraries.className("/path/to/lib/src/some/pkg/Type.groovy", "/path/to/lib/src"), is("some.pkg.Type")); |
| 520 | + assertThat(LibraryAdder.LoadedLibraries.className("C:\\path\\to\\lib\\src\\some\\pkg\\Type.groovy", "C:\\path\\to\\lib\\src"), is("some.pkg.Type")); |
| 521 | + assertThat(LibraryAdder.LoadedLibraries.className("C:\\path\\to\\Extra\\lib\\src\\some\\pkg\\Type.groovy", "C:\\path\\to\\Extra\\lib\\src"), is("some.pkg.Type")); |
| 522 | + } |
| 523 | + |
515 | 524 | }
|
0 commit comments