本文整理汇总了Java中hudson.model.Project类的典型用法代码示例。如果您正苦于以下问题:Java Project类的具体用法?Java Project怎么用?Java Project使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Project类属于hudson.model包,在下文中一共展示了Project类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: executeCheck
import hudson.model.Project; //导入依赖的package包/类
public boolean executeCheck(Item item) {
boolean notfound = true;
if (Jenkins.getInstance().pluginManager.getPlugin("build-timeout") != null) {
if (item.getClass().getName().endsWith("hudson.maven.MavenModuleSet")) {
try {
Method method = item.getClass().getMethod("getBuildWrappersList");
DescribableList<BuildWrapper,Descriptor<BuildWrapper>> buildWrapperList = ((DescribableList<BuildWrapper,Descriptor<BuildWrapper>>) method.invoke(item));
notfound = !isTimeout(buildWrapperList);
} catch (Exception e) {
LOG.log(Level.WARNING, "Exception " + e.getMessage(), e.getCause());
notfound = false;
}
}
if (item instanceof Project) {
notfound = !isTimeout(((Project) item).getBuildWrappersList());
}
if (item instanceof MatrixProject) {
notfound = !isTimeout(((MatrixProject) item).getBuildWrappersList());
}
}
return notfound;
}
示例2: executeCheck
import hudson.model.Project; //导入依赖的package包/类
public boolean executeCheck(Item item) {
boolean found = false;
if (Jenkins.getInstance().pluginManager.getPlugin("gradle") != null) {
if (Jenkins.getInstance().pluginManager.getPlugin("maven-plugin")!=null) {
if (item instanceof MavenModuleSet) {
found = isGradlew(((MavenModuleSet) item).getPrebuilders());
}
}
if (item instanceof Project) {
found = isGradlew(((Project) item).getBuilders());
}
if (item instanceof MatrixProject) {
found = isGradlew(((MatrixProject) item).getBuilders());
}
}
return found;
}
示例3: executeCheck
import hudson.model.Project; //导入依赖的package包/类
public boolean executeCheck(Item item) {
LOG.log(Level.FINE, "executeCheck " + item);
if (item instanceof Project) {
Project project = (Project) item;
DescribableList<Publisher, Descriptor<Publisher>> publishersList = project.getPublishersList();
for (Publisher publisher : publishersList) {
if (publisher instanceof ArtifactArchiver) {
LOG.log(Level.FINEST, "ArtifactChecker " + publisher);
return (((ArtifactArchiver) publisher).getArtifacts() == null ||
(((ArtifactArchiver) publisher).getArtifacts() != null &&
((ArtifactArchiver) publisher).getArtifacts().length() == 0));
}
}
}
return false;
}
示例4: executeCheck
import hudson.model.Project; //导入依赖的package包/类
public boolean executeCheck(Item item) {
LOG.log(Level.FINE, "executeCheck " + item);
boolean found = false;
if (Jenkins.getInstance().pluginManager.getPlugin("maven-plugin")!=null) {
if (item instanceof MavenModuleSet) {
found = isBuilderHarcoded(((MavenModuleSet) item).getPrebuilders());
}
}
if (item instanceof Project) {
found = isBuilderHarcoded (((Project)item).getBuilders());
}
if (item instanceof MatrixProject) {
found = isBuilderHarcoded (((MatrixProject)item).getBuilders());
}
return found;
}
示例5: perform
import hudson.model.Project; //导入依赖的package包/类
@Override
public boolean perform(AbstractBuild<?, ?> build, Launcher launcher,
BuildListener listener) throws InterruptedException, IOException {
try {
boolean isPProjectBuilding = false;
while (true) {
isPProjectBuilding = false;
List<DTJob> listOfProjects = getAllParentProjects();
for (Project<?, ?> project : listOfProjects) {
isPProjectBuilding = checkIfParentIsBuilding(project);
}
if (!isPProjectBuilding) {
return true;
}
Thread.sleep(1000);
}
} catch (InterruptedException ex) {
return false;
}
}
示例6: getDockerImagesUsedByJob
import hudson.model.Project; //导入依赖的package包/类
@Nonnull
@Override
public Collection<String> getDockerImagesUsedByJob(@Nonnull Job<?,?> job) {
if (job instanceof Project) {
Project<? extends Project, ? extends Build> project = (Project<?,? extends Build>)job;
Set<String> images = new HashSet<String>();
// check DockerHub build step for matching image ID
for (Builder b : project.getBuilders()) {
if (b instanceof DockerPullImageBuilder) {
images.add(((DockerPullImageBuilder)b).getImage());
}
}
return images;
} else {
return Collections.emptySet();
}
}
示例7: scheduleJob
import hudson.model.Project; //导入依赖的package包/类
public SlackTextMessage scheduleJob(String projectName) {
ACL.impersonate(ACL.SYSTEM);
String response = "";
Project project =
Jenkins.getInstance().getItemByFullName(projectName, Project.class);
boolean success = false;
if (project != null)
success = project.scheduleBuild(new SlackWebhookCause(this.slackUser));
else
return new SlackTextMessage("Could not find project ("+projectName+")\n");
if (success)
return new SlackTextMessage("Build scheduled for project "+ projectName+"\n");
else
return new SlackTextMessage("Build not scheduled due to an issue with Jenkins");
}
示例8: isParameterDefinitionOf
import hudson.model.Project; //导入依赖的package包/类
/**
* Returns true if this parameter definition is a definition of the given project.
*
* @since 1.3
* @author dynamic-parameter-plugin
* @param parameterUUID UUID of the project parameter
* @param project the project to search for this parameter definition.
* @return {@code true} if the project contains this parameter definition.
*/
private static boolean isParameterDefinitionOf(@Nonnull String parameterUUID, @Nonnull Project<?, ?> project) {
List<ParameterDefinition> parameterDefinitions = new ArrayList<ParameterDefinition>();
parameterDefinitions.addAll(getProjectParameterDefinitions(project));
for (List<ParameterDefinition> params : getBuildWrapperParameterDefinitions(project).values()) {
parameterDefinitions.addAll(params);
}
for (ParameterDefinition pd : parameterDefinitions) {
if (pd instanceof AbstractUnoChoiceParameter) {
AbstractUnoChoiceParameter parameterDefinition = (AbstractUnoChoiceParameter) pd;
String uuid = parameterDefinition.getRandomName();
if (ObjectUtils.equals(parameterUUID, uuid)) {
return true;
}
}
}
return false;
}
示例9: getBuildWrapperParameterDefinitions
import hudson.model.Project; //导入依赖的package包/类
/**
* Get parameter definitions associated with {@link BuildWrapper}s of the given {@link Project}.
* @param project the project for which the parameter definitions should be found
* @return Map
*/
public static @Nonnull Map<BuildWrapper, List<ParameterDefinition>> getBuildWrapperParameterDefinitions(@Nonnull Project<?, ?> project) {
final List<BuildWrapper> buildWrappersList = project.getBuildWrappersList();
final Map<BuildWrapper, List<ParameterDefinition>> result = new LinkedHashMap<BuildWrapper, List<ParameterDefinition>>();
List<ParameterDefinition> value = new ArrayList<ParameterDefinition>();
for (BuildWrapper buildWrapper : buildWrappersList) {
final PropertyDescriptor[] propertyDescriptors;
try {
propertyDescriptors = Introspector.getBeanInfo(buildWrapper.getClass()).getPropertyDescriptors();
} catch (IntrospectionException e) {
continue;
}
for (PropertyDescriptor propertyDescriptor : propertyDescriptors) {
addParameterDefinitionsTo(value, buildWrapper, propertyDescriptor);
}
if (!value.isEmpty()) {
result.put(buildWrapper, value);
value = new ArrayList<ParameterDefinition>();
}
}
return result.isEmpty() ? Collections.<BuildWrapper, List<ParameterDefinition>> emptyMap() : result;
}
示例10: getJobTemplate
import hudson.model.Project; //导入依赖的package包/类
/**
* Helper method to determine the template from a given item.
*
* @param item Item which includes a template.
* @return If the item includes a template then the template will be returned. Otherwise <code>null</code>.
*/
private DockerJobTemplateProperty getJobTemplate(Item item) {
if (item.task instanceof Project) {
Project<?, ?> project = (Project<?, ?>) item.task;
if (project != null) {
final DockerJobTemplateProperty p = project.getProperty(DockerJobTemplateProperty.class);
if (p != null) return p;
// backward compatibility. DockerJobTemplateProperty used to be a nested object in DockerJobProperty
DockerJobProperty property = project.getProperty(DockerJobProperty.class);
if (property != null) {
return property.getDockerJobTemplate();
}
}
}
return null;
}
示例11: getProjectAction
import hudson.model.Project; //导入依赖的package包/类
@Override
public Action getProjectAction(final AbstractProject<?, ?> project) {
log.info("Gebe Projektaktion aus, Klasse: " + project.getClass() + " Instanz von Projekt: " + (project instanceof Project));
if (project instanceof AbstractProject)
{
lastProject = project;
VisualizeAction va = new VisualizeAction(project, this);
lastVisulizeAction = va;
log.info("Visualizer: " + va.getVisualizer().size());
collectorNames = va.getCollectorNames();
testNames = va.getTestNames();
testcases = new LinkedList<GraphVisualizer>();
for (GraphVisualizer gv : va.getVisualizer()) {
log.info("Füge Testcase hinzu: " + gv.getName());
testcases.add(gv);
}
log.info("Aktion: " + va);
return va;
}
else {
log.log(Level.ALL, "Unexpected Class: " + project.getClass());
}
return null;
}
示例12: getPluginOptions
import hudson.model.Project; //导入依赖的package包/类
/**
* Get the configured instance for the plugin.
*
* @param project
* @return
*/
public static NeoLoadPluginOptions getPluginOptions(final AbstractProject<?, ?> project) {
final Project<?, ?> proj;
NeoBuildAction nba = null;
if (!(project instanceof Project)) {
return null;
}
proj = (Project<?, ?>) project;
final List<Builder> builders = proj.getBuilders();
for (final Builder b : builders) {
if (b instanceof NeoBuildAction) {
nba = (NeoBuildAction) b;
break;
}
}
return (NeoLoadPluginOptions) nba;
}
示例13: testRegisterJobs_ProjectSingleLabel
import hudson.model.Project; //导入依赖的package包/类
@Test
public void testRegisterJobs_ProjectSingleLabel() throws Exception {
Project<?, ?> lemon = createFreeStyleProject("lemon");
lemon.setAssignedLabel(new LabelAtom("linux"));
AbstractWorkerThread oneiric = new ExecutorWorkerThread("GearmanServer", 4730, "MyWorker", slave.toComputer(), "master", new NoopAvailabilityMonitor());
oneiric.testInitWorker();
oneiric.registerJobs();
Set<String> functions = oneiric.worker.getRegisteredFunctions();
assertEquals(2, functions.size());
assertTrue(functions.contains("build:lemon"));
assertTrue(functions.contains("build:lemon:linux"));
}
示例14: testRegisterJobs_ProjectNoLabel
import hudson.model.Project; //导入依赖的package包/类
@Test
public void testRegisterJobs_ProjectNoLabel() throws Exception {
Project<?, ?> lemon = createFreeStyleProject("lemon");
AbstractWorkerThread oneiric = new ExecutorWorkerThread(
"GearmanServer",
4730,
"MyWorker",
slave.toComputer(),
"master",
new NoopAvailabilityMonitor());
oneiric.testInitWorker();
oneiric.registerJobs();
Set<String> functions = oneiric.worker.getRegisteredFunctions();
assertEquals(1, functions.size());
assertTrue(functions.contains("build:lemon"));
}
示例15: testRegisterJobs_ProjectNoLabel_Exclusive
import hudson.model.Project; //导入依赖的package包/类
@Test
public void testRegisterJobs_ProjectNoLabel_Exclusive() throws Exception {
Project<?, ?> lemon = createFreeStyleProject("lemon");
DumbSlave exclusive_slave = createOnlineSlave(new LabelAtom("foo"));
exclusive_slave.setMode(Mode.EXCLUSIVE);
AbstractWorkerThread oneiric = new ExecutorWorkerThread(
"GearmanServer",
4730,
"MyWorker",
exclusive_slave.toComputer(),
"master",
new NoopAvailabilityMonitor());
oneiric.testInitWorker();
oneiric.registerJobs();
Set<String> functions = oneiric.worker.getRegisteredFunctions();
assertEquals(0, functions.size());
}