本文整理汇总了Java中hudson.model.Cause.UserIdCause类的典型用法代码示例。如果您正苦于以下问题:Java UserIdCause类的具体用法?Java UserIdCause怎么用?Java UserIdCause使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UserIdCause类属于hudson.model.Cause包,在下文中一共展示了UserIdCause类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testFreeStyleProject_buildHead
import hudson.model.Cause.UserIdCause; //导入依赖的package包/类
@Test
public void testFreeStyleProject_buildHead() throws Exception {
FreeStyleProject project = jenkins.createFreeStyleProject("BuildHead");
Workspace workspace = new StaticWorkspaceImpl("none", false, defaultClient());
Populate populate = new AutoCleanImpl();
PerforceScm scm = new PerforceScm(CREDENTIAL, workspace, populate);
project.setScm(scm);
project.save();
FreeStyleBuild build;
UserIdCause cause = new Cause.UserIdCause();
build = project.scheduleBuild2(0, cause).get();
assertEquals(Result.SUCCESS, build.getResult());
List<String> log = build.getLog(LOG_LIMIT);
assertTrue(log.contains("P4 Task: syncing files at change: 40"));
CredentialsDescriptor desc = auth.getDescriptor();
assertNotNull(desc);
assertEquals("Perforce Password Credential", desc.getDisplayName());
P4PasswordImpl.DescriptorImpl impl = (P4PasswordImpl.DescriptorImpl) desc;
FormValidation form = impl.doTestConnection(p4d.getRshPort(), "false", null, null, "jenkins", "jenkins", false);
assertEquals(FormValidation.Kind.OK, form.kind);
}
开发者ID:p4paul,项目名称:p4-jenkins,代码行数:26,代码来源:ConnectionTest.java
示例2: testTPI83
import hudson.model.Cause.UserIdCause; //导入依赖的package包/类
@Test
public void testTPI83() throws Exception {
FreeStyleProject project = jenkins.createFreeStyleProject("TPI83");
Workspace workspace = new StaticWorkspaceImpl("none", false, defaultClient());
Populate populate = new AutoCleanImpl();
PerforceScm scm = new PerforceScm(CREDENTIAL, workspace, populate);
project.setScm(scm);
project.save();
FreeStyleBuild build;
UserIdCause cause = new Cause.UserIdCause();
build = project.scheduleBuild2(0, cause).get();
assertEquals(Result.SUCCESS, build.getResult());
String filename = "[email protected]%#$%^&().txt";
String path = build.getWorkspace() + "/" + filename;
File add = new File(path);
add.createNewFile();
build = project.scheduleBuild2(0, cause).get();
assertEquals(Result.SUCCESS, build.getResult());
}
开发者ID:p4paul,项目名称:p4-jenkins,代码行数:25,代码来源:ConnectionTest.java
示例3: prepareBuildUser
import hudson.model.Cause.UserIdCause; //导入依赖的package包/类
/**
* Return the current build user.
*
* @param causes
* build causes.
* @return user name.
*/
protected static String prepareBuildUser(List<Cause> causes) {
String buildUser = "anonymous";
if (causes != null && causes.size() > 0) {
if (causes.get(0) instanceof UserIdCause) {
buildUser = ((UserIdCause) causes.get(0)).getUserName();
} else if (causes.get(0) instanceof UpstreamCause) {
List<Cause> upstreamCauses = ((UpstreamCause) causes.get(0)).getUpstreamCauses();
prepareBuildUser(upstreamCauses);
}
}
return buildUser;
}
开发者ID:ThoughtsLive,项目名称:jira-steps,代码行数:20,代码来源:JiraStepExecution.java
示例4: prepareBuildUser
import hudson.model.Cause.UserIdCause; //导入依赖的package包/类
/**
* Return the current build user.
*
* @param causes build causes.
* @return user name.
*/
protected static String prepareBuildUser(List<Cause> causes) {
String buildUser = "anonymous";
if (causes != null && causes.size() > 0) {
if (causes.get(0) instanceof UserIdCause) {
buildUser = ((UserIdCause) causes.get(0)).getUserId();
} else if (causes.get(0) instanceof UpstreamCause) {
List<Cause> upstreamCauses = ((UpstreamCause) causes.get(0)).getUpstreamCauses();
prepareBuildUser(upstreamCauses);
}
}
return Util.fixEmpty(buildUser) == null ? "anonymous" : buildUser;
}
开发者ID:jenkinsci,项目名称:jira-steps-plugin,代码行数:19,代码来源:JiraStepExecution.java
示例5: setCulprits
import hudson.model.Cause.UserIdCause; //导入依赖的package包/类
private void setCulprits(Run run) {
List<String> culprits = new ArrayList<>(0);
// Get culprits from the causes of the build
run.getCauses().forEach((cause -> {
switch (cause.getClass().getSimpleName()) {
case "UserIdCause":
if (!culprits.contains(((UserIdCause) cause).getUserName())) {
culprits.add(((UserIdCause) cause).getUserName());
}
break;
}
}));
// Use introspective class to avoid plugins compatibility problems
try {
Method method = run.getClass().getMethod("getChangeSets");
method.setAccessible(true);
((List<ChangeLogSet>) method.invoke(run, new Object[]{})).forEach(cset -> {
for (Object object : ((ChangeLogSet) cset).getItems()) {
ChangeLogSet.Entry change = (ChangeLogSet.Entry) object;
if (!culprits.contains(change.getAuthor().getFullName())) {
culprits.add(change.getAuthor().getFullName());
}
}
});
} catch (SecurityException | IllegalAccessException |
IllegalArgumentException | InvocationTargetException | NoSuchMethodException ex) {
Logger.getLogger(MirrorGateRunListener.class.getName()).log(Level.SEVERE, null, ex);
}
request.setCulprits(culprits);
}
开发者ID:BBVA,项目名称:mirrorgate-jenkins-builds-collector,代码行数:35,代码来源:BuildBuilder.java
示例6: prepareBuildUser
import hudson.model.Cause.UserIdCause; //导入依赖的package包/类
/**
* Return the current build user.
*
* @param causes build causes.
* @return user name.
*/
protected static String prepareBuildUser(List<Cause> causes) {
String buildUser = "anonymous";
if (causes != null && causes.size() > 0) {
if (causes.get(0) instanceof UserIdCause) {
buildUser = ((UserIdCause) causes.get(0)).getUserName();
} else if (causes.get(0) instanceof UpstreamCause) {
List<Cause> upstreamCauses = ((UpstreamCause) causes.get(0)).getUpstreamCauses();
prepareBuildUser(upstreamCauses);
}
}
return buildUser;
}
开发者ID:jenkinsci,项目名称:hubot-steps-plugin,代码行数:19,代码来源:HubotAbstractSynchronousNonBlockingStepExecution.java
示例7: testPinHost_ManualWs
import hudson.model.Cause.UserIdCause; //导入依赖的package包/类
@Test
public void testPinHost_ManualWs() throws Exception {
String client = "manual.ws";
String stream = null;
String line = "LOCAL";
String view = "//depot/Data/... //" + client + "/...";
WorkspaceSpec spec = new WorkspaceSpec(false, false, false, false, false, false, stream, line, view);
FreeStyleProject project = jenkins.createFreeStyleProject("Manual-Head");
ManualWorkspaceImpl workspace = new ManualWorkspaceImpl("none", true, client, spec);
Populate populate = new AutoCleanImpl();
PerforceScm scm = new PerforceScm(CREDENTIAL, workspace, populate);
project.setScm(scm);
project.save();
FreeStyleBuild build;
UserIdCause cause = new Cause.UserIdCause();
build = project.scheduleBuild2(0, cause).get();
assertEquals(Result.SUCCESS, build.getResult());
// Log in with client for next set of tests...
ClientHelper p4 = new ClientHelper(auth, null, "manual.ws", "utf8");
IClient iclient = p4.getClient();
String clienthost = iclient.getHostName();
String hostname = InetAddress.getLocalHost().getHostName();
assertNotNull(clienthost);
assertEquals(hostname, clienthost);
}
开发者ID:p4paul,项目名称:p4-jenkins,代码行数:31,代码来源:ConnectionTest.java
示例8: manualStart
import hudson.model.Cause.UserIdCause; //导入依赖的package包/类
public DynamicBuildFactory manualStart(String userId, String branch) {
UserIdCause userIdCause = mock(UserIdCause.class);
when(userIdCause.getUserId()).thenReturn(userId);
when(build.getCause(UserIdCause.class)).thenReturn(userIdCause);
addBranchParam(branch);
return this;
}
开发者ID:groupon,项目名称:DotCi,代码行数:8,代码来源:DynamicBuildFactory.java
示例9: buildTwoandCheckOrder
import hudson.model.Cause.UserIdCause; //导入依赖的package包/类
/**
* @param sleep
* @param eps
* @param parallel
* @param p
*/
private void buildTwoandCheckOrder(long sleep, double eps, boolean parallel, InheritanceProject p) {
try {
/* Scheduling the builds.
* We need to give the gpp a random parameter, to avoid Jenkins
* from mercilessly killing our duplicated jobs, if two of them
* happen to be simultaneously in the queue.
*/
QueueTaskFuture<InheritanceBuild> f1 = p.scheduleBuild2(
0, new UserIdCause(),
new ParametersAction(
new StringParameterValue("RNG", UUID.randomUUID().toString())
)
);
QueueTaskFuture<InheritanceBuild> f2 = p.scheduleBuild2(
0, new UserIdCause(),
new ParametersAction(
new StringParameterValue("RNG", UUID.randomUUID().toString())
)
);
assertNotNull("First build failed to start, miserably", f1);
assertNotNull("Second build failed to start, miserably", f2);
InheritanceBuild[] builds = { f1.get(), f2.get() };
assertNotNull("First build failed to evaluate", builds[0]);
assertNotNull("Second build failed to evaluate", builds[1]);
checkBuildOrder((long)eps*sleep, parallel, builds);
} catch (Exception ex) {
fail(ex.getMessage());
}
}
开发者ID:i-m-c,项目名称:jenkins-inheritance-plugin,代码行数:38,代码来源:TestInheritanceSanity.java
示例10: testManual_Modtime
import hudson.model.Cause.UserIdCause; //导入依赖的package包/类
@Test
public void testManual_Modtime() throws Exception {
String client = "modtime.ws";
String stream = null;
String line = "LOCAL";
String view = "//depot/Data/... //" + client + "/...";
// The test was designed for pre 15.1 modtime checks. Since RSH requires 15.1
// the test is not required, however later assets have some use. The pre20151
// bool 'fakes' the test and allows the other checks to pass.
boolean pre20151 = false;
WorkspaceSpec spec = new WorkspaceSpec(false, false, false, false, !pre20151, false, stream, line, view);
FreeStyleProject project = jenkins.createFreeStyleProject("Manual_Modtime");
ManualWorkspaceImpl workspace = new ManualWorkspaceImpl("none", false, client, spec);
boolean isModtime = true;
Populate populate = new AutoCleanImpl(true, true, isModtime, false, null, null);
PerforceScm scm = new PerforceScm(CREDENTIAL, workspace, populate);
project.setScm(scm);
project.save();
FreeStyleBuild build;
UserIdCause cause = new Cause.UserIdCause();
build = project.scheduleBuild2(0, cause).get();
assertEquals(Result.SUCCESS, build.getResult());
// Log in for next set of tests...
ClientHelper p4 = new ClientHelper(auth, null, client, "utf8");
boolean mod = p4.getClient().getOptions().isModtime();
assertEquals(true, mod);
// Check file exists with the correct date
String ws = build.getWorkspace().getRemote();
File file = new File(ws + "/file-0.dat");
assertEquals(true, file.exists());
String ver = Metadata.getP4JVersionString();
logger.info("P4Java Version: " + ver);
long epoch = file.lastModified();
assertEquals(1397049803000L, epoch);
}
开发者ID:p4paul,项目名称:p4-jenkins,代码行数:44,代码来源:ConnectionTest.java
注:本文中的hudson.model.Cause.UserIdCause类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论