本文整理汇总了Java中hudson.model.Fingerprint.RangeSet方法的典型用法代码示例。如果您正苦于以下问题:Java Fingerprint.RangeSet方法的具体用法?Java Fingerprint.RangeSet怎么用?Java Fingerprint.RangeSet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hudson.model.Fingerprint
的用法示例。
在下文中一共展示了Fingerprint.RangeSet方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateFingerprint
import hudson.model.Fingerprint; //导入方法依赖的package包/类
/**
* Adds the current run to the fingerprint's usages.
*
* @param workspaceId the workspace's id
* @throws IOException if fingerprint load operation fails,
* or if no fingerprint is found for the given workspace id
*/
private void updateFingerprint(String workspaceId) throws IOException {
Fingerprint f = Jenkins.getActiveInstance()._getFingerprint(workspaceId);
if (f == null) {
throw new AbortException("Couldn't find any Fingerprint for: " + workspaceId);
}
Fingerprint.RangeSet set = f.getUsages().get(run.getParent().getFullName());
if (set == null || !set.includes(run.getNumber())) {
f.addFor(run);
f.save();
}
}
示例2: getUsages
import hudson.model.Fingerprint; //导入方法依赖的package包/类
@Exported(visibility = 999)
public Hashtable<String, RangeSet> getUsages() {
Hashtable<String, RangeSet> res = new Hashtable<String, RangeSet>(fingerprint.getUsages().size());
for (Map.Entry<String, Fingerprint.RangeSet> set : fingerprint.getUsages().entrySet()) {
res.put(set.getKey(), new RangeSet(set.getValue()));
}
return res;
}
示例3: testTrackingOfCredential
import hudson.model.Fingerprint; //导入方法依赖的package包/类
@Test
public void testTrackingOfCredential() throws Exception {
P4BaseCredentials credential = new P4PasswordImpl(
CredentialsScope.GLOBAL, "testTrackingOfCredential", "desc:passwd", p4d.getRshPort(),
null, "jenkins", "0", "0", null, "jenkins");
SystemCredentialsProvider.getInstance().getCredentials().add(credential);
Fingerprint fingerprint = CredentialsProvider.getFingerprintOf(credential);
assertThat("No fingerprint created until first use", fingerprint, nullValue());
FreeStyleProject job = jenkins.createFreeStyleProject("testTrackingOfCredential");
Workspace workspace = new StaticWorkspaceImpl("none", false, defaultClient());
Populate populate = new AutoCleanImpl();
PerforceScm scm = new PerforceScm(credential.getId(), workspace, populate);
job.setScm(scm);
job.save();
jenkins.assertBuildStatusSuccess(job.scheduleBuild2(0));
fingerprint = CredentialsProvider.getFingerprintOf(credential);
assertThat(fingerprint, notNullValue());
assertThat(fingerprint.getJobs(), hasItem(is(job.getFullName())));
Fingerprint.RangeSet rangeSet = fingerprint.getRangeSet(job);
assertThat(rangeSet, notNullValue());
assertThat(rangeSet.includes(job.getLastBuild().getNumber()), is(true));
}
示例4: RangeSet
import hudson.model.Fingerprint; //导入方法依赖的package包/类
public RangeSet(@Nonnull Fingerprint.RangeSet ref) {
ranges = new ArrayList<Range>(ref.getRanges().size());
for (Fingerprint.Range range : ref.getRanges()) {
ranges.add(new Range(range.getStart(), range.getEnd()));
}
}
示例5: theSecretBuildWrapperTracksUsage
import hudson.model.Fingerprint; //导入方法依赖的package包/类
@Test
public void theSecretBuildWrapperTracksUsage() throws Exception {
SystemCredentialsProvider.getInstance().setDomainCredentialsMap(
Collections.singletonMap(Domain.global(), Collections.<Credentials>emptyList()));
for (CredentialsStore s : CredentialsProvider.lookupStores(Jenkins.getInstance())) {
if (s.getProvider() instanceof SystemCredentialsProvider.ProviderImpl) {
store = s;
break;
}
}
assertThat("The system credentials provider is enabled", store, notNullValue());
UsernamePasswordCredentialsImpl credentials = new UsernamePasswordCredentialsImpl(CredentialsScope.GLOBAL, "secret-id", "test credentials", "bob",
"secret");
store.addCredentials(Domain.global(), credentials);
Fingerprint fingerprint = CredentialsProvider.getFingerprintOf(credentials);
assertThat("No fingerprint created until first use", fingerprint, nullValue());
JenkinsRule.WebClient wc = r.createWebClient();
HtmlPage page = wc.goTo("credentials/store/system/domain/_/credentials/secret-id");
assertThat("Have usage tracking reported", page.getElementById("usage"), notNullValue());
assertThat("No fingerprint created until first use", page.getElementById("usage-missing"), notNullValue());
assertThat("No fingerprint created until first use", page.getElementById("usage-present"), nullValue());
FreeStyleProject job = r.createFreeStyleProject();
// add a parameter
job.addProperty(new ParametersDefinitionProperty(
new CredentialsParameterDefinition(
"SECRET",
"The secret",
"secret-id",
Credentials.class.getName(),
false
)));
r.assertBuildStatusSuccess((Future) job.scheduleBuild2(0,
new ParametersAction(new CredentialsParameterValue("SECRET", "secret-id", "The secret", true))));
fingerprint = CredentialsProvider.getFingerprintOf(credentials);
assertThat("A job that does nothing does not use parameterized credentials", fingerprint, nullValue());
page = wc.goTo("credentials/store/system/domain/_/credentials/secret-id");
assertThat("Have usage tracking reported", page.getElementById("usage"), notNullValue());
assertThat("No fingerprint created until first use", page.getElementById("usage-missing"), notNullValue());
assertThat("No fingerprint created until first use", page.getElementById("usage-present"), nullValue());
// check that the wrapper works as expected
job.getBuildWrappersList().add(new SecretBuildWrapper(Collections.<Binding<?>>singletonList(new UsernamePasswordBinding("AUTH", credentials.getId()))));
r.assertBuildStatusSuccess((Future) job.scheduleBuild2(0, new ParametersAction(new CredentialsParameterValue("SECRET", "secret-id", "The secret", true))));
fingerprint = CredentialsProvider.getFingerprintOf(credentials);
assertThat(fingerprint, notNullValue());
assertThat(fingerprint.getJobs(), hasItem(is(job.getFullName())));
Fingerprint.RangeSet rangeSet = fingerprint.getRangeSet(job);
assertThat(rangeSet, notNullValue());
assertThat(rangeSet.includes(job.getLastBuild().getNumber()), is(true));
page = wc.goTo("credentials/store/system/domain/_/credentials/secret-id");
assertThat(page.getElementById("usage-missing"), nullValue());
assertThat(page.getElementById("usage-present"), notNullValue());
assertThat(page.getAnchorByText(job.getFullDisplayName()), notNullValue());
// check the API
WebResponse response = wc.goTo(
"credentials/store/system/domain/_/credentials/secret-id/api/xml?depth=1&xpath=*/fingerprint/usage",
"application/xml").getWebResponse();
assertThat(response.getContentAsString(), CompareMatcher.isSimilarTo("<usage>"
+ "<name>"+ Util.xmlEscape(job.getFullName())+"</name>"
+ "<ranges>"
+ "<range>"
+ "<end>"+(job.getLastBuild().getNumber()+1)+"</end>"
+ "<start>" + job.getLastBuild().getNumber()+"</start>"
+ "</range>"
+ "</ranges>"
+ "</usage>").ignoreWhitespace().ignoreComments());
}