Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -221,5 +221,10 @@
<version>1.10.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.jenkins.configuration-as-code</groupId>
<artifactId>test-harness</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package org.jenkinsci.plugins.workflow.libs;

import io.jenkins.plugins.casc.misc.ConfiguredWithCode;
import io.jenkins.plugins.casc.misc.JenkinsConfiguredWithCodeRule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.RuleChain;
import org.jvnet.hudson.test.LoggerRule;

import java.util.logging.Level;
import java.util.logging.Logger;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.collection.IsIn.in;
import static org.hamcrest.core.IsNot.not;

public class JCasCGlobalLibrariesTest {

public JenkinsConfiguredWithCodeRule j = new JenkinsConfiguredWithCodeRule();
public LoggerRule logging = new LoggerRule();

@Rule
public RuleChain chain = RuleChain.outerRule(logging.record(Logger.getLogger("io.jenkins.plugins.casc.BaseConfigurator"), Level.INFO)
.capture(2048))
.around(j);

@Test
@ConfiguredWithCode("JCasCGlobalLibrariesTest.yml")
public void isBaseConfiguratorComplainingAboutOwner() {
//WARNING i.j.p.casc.BaseConfigurator#createAttribute: Can't handle class jenkins.plugins.git.GitSCMSource#owner: type is abstract but not Describable.
assertThat("Can't handle class jenkins.plugins.git.GitSCMSource#owner: type is abstract but not Describable.",
not(in(logging.getMessages())
));
}
}
15 changes: 15 additions & 0 deletions src/test/resources/JCasCGlobalLibrariesTest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
unclassified:
globalLibraries:
libraries:
- defaultVersion: "dev"
includeInChangesets: false
name: "cloudbees-shared-library"
retriever:
modernSCM:
clone: true
scm:
git:
credentialsId:
remote:
traits:
- "gitBranchDiscovery"