当前位置: 首页>>代码示例>>Java>>正文


Java DescribableList类代码示例

本文整理汇总了Java中hudson.util.DescribableList的典型用法代码示例。如果您正苦于以下问题:Java DescribableList类的具体用法?Java DescribableList怎么用?Java DescribableList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DescribableList类属于hudson.util包,在下文中一共展示了DescribableList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findNodeProperty

import hudson.util.DescribableList; //导入依赖的package包/类
/**
 * Finds the {@link NodeProperty} for the external workspace definition.
 *
 * @param node the current node
 * @return the node property for the external workspace manager
 * @throws IOException if node property was not found
 */
@Nonnull
private static ExternalWorkspaceProperty findNodeProperty(Node node) throws IOException {
    DescribableList<NodeProperty<?>, NodePropertyDescriptor> nodeProperties = node.getNodeProperties();

    ExternalWorkspaceProperty exwsNodeProperty = null;
    for (NodeProperty<?> nodeProperty : nodeProperties) {
        if (nodeProperty instanceof ExternalWorkspaceProperty) {
            exwsNodeProperty = (ExternalWorkspaceProperty) nodeProperty;
            break;
        }
    }

    if (exwsNodeProperty == null) {
        String message = format("There is no External Workspace config defined in Node '%s' config", node.getDisplayName());
        throw new AbortException(message);
    }

    return exwsNodeProperty;
}
 
开发者ID:jenkinsci,项目名称:external-workspace-manager-plugin,代码行数:27,代码来源:ExwsExecution.java

示例2: localRootPathToNodeMountPoint

import hudson.util.DescribableList; //导入依赖的package包/类
@LocalData
@Test
public void localRootPathToNodeMountPoint() throws Exception {

    // The node configuration version 1.0.0 contains a localRootPath field.
    // This tests that future versions load this field as nodeMountPoint,
    // in other words it tests NodeDisk.readResolve()

    Computer computer = jr.getInstance().getComputer("node1");
    Node node = computer.getNode();
    DescribableList<NodeProperty<?>,NodePropertyDescriptor> props = node.getNodeProperties();
    ExternalWorkspaceProperty exwsProp = props.get(ExternalWorkspaceProperty.class);

    List<NodeDiskPool> diskPools = exwsProp.getNodeDiskPools();
    assertThat(diskPools.size(), is(1));

    NodeDiskPool diskPool = diskPools.get(0);
    assertThat(diskPool.getDiskPoolRefId(), is ("dp1"));

    List<NodeDisk> disks = diskPool.getNodeDisks();
    assertThat(disks.size(), is(1));

    NodeDisk disk = disks.get(0);
    assertThat(disk.getDiskRefId(), is("d1"));
    assertThat(disk.getNodeMountPoint(), is("/tmp/dp1/d1"));
}
 
开发者ID:jenkinsci,项目名称:external-workspace-manager-plugin,代码行数:27,代码来源:ConfigMigrationTest.java

示例3: findItemWithBuildWrapper

import hudson.util.DescribableList; //导入依赖的package包/类
private static <T extends BuildWrapper> BuildWrapperItem<T> findItemWithBuildWrapper(final AbstractItem buildItem, Class<T> buildWrapperClass) {
    if (buildItem == null) {
        return null;
    }

    if (buildItem instanceof BuildableItemWithBuildWrappers) {
        BuildableItemWithBuildWrappers buildWrapper = (BuildableItemWithBuildWrappers) buildItem;
        DescribableList<BuildWrapper, Descriptor<BuildWrapper>> buildWrappersList = buildWrapper.getBuildWrappersList();

        if (buildWrappersList != null && !buildWrappersList.isEmpty()) {
            return new BuildWrapperItem<T>(buildWrappersList.get(buildWrapperClass), buildItem);
        }
    }

    if (buildItem.getParent() instanceof AbstractItem) {
        return findItemWithBuildWrapper((AbstractItem) buildItem.getParent(), buildWrapperClass);
    }

    return null;
}
 
开发者ID:jenkinsci,项目名称:browserstack-integration-plugin,代码行数:21,代码来源:BrowserStackBuildWrapper.java

示例4: executeCheck

import hudson.util.DescribableList; //导入依赖的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;
}
 
开发者ID:v1v,项目名称:jenkinslint-plugin,代码行数:23,代码来源:TimeoutChecker.java

示例5: executeCheck

import hudson.util.DescribableList; //导入依赖的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;
}
 
开发者ID:v1v,项目名称:jenkinslint-plugin,代码行数:18,代码来源:ArtifactChecker.java

示例6: configure

import hudson.util.DescribableList; //导入依赖的package包/类
@Override
public boolean configure(StaplerRequest req, JSONObject formData) throws FormException {
    cron = formData.getString("cron");
    outputFile = formData.getString("outputFile");
    unstableAs = GHCommitState.valueOf(formData.getString("unstableAs"));
    autoCloseFailedPullRequests = formData.getBoolean("autoCloseFailedPullRequests");
    displayBuildErrorsOnDownstreamBuilds = formData.getBoolean("displayBuildErrorsOnDownstreamBuilds");
    
    githubAuth = req.bindJSONToList(GhprcGitHubAuth.class, formData.get("githubAuth"));
    
    extensions = new DescribableList<GhprcExtension, GhprcExtensionDescriptor>(Saveable.NOOP);

    try {
        extensions.rebuildHetero(req, formData, getGlobalExtensionDescriptors(), "extensions");
    } catch (IOException e) {
        e.printStackTrace();
    }
    
    readBackFromLegacy();

    save();
    return super.configure(req, formData);
}
 
开发者ID:bratchenko,项目名称:jenkins-github-pull-request-comments,代码行数:24,代码来源:GhprcTrigger.java

示例7: getJobExtensions

import hudson.util.DescribableList; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static DescribableList<GhprcExtension, GhprcExtensionDescriptor> getJobExtensions(GhprcTrigger trigger, Class<?> ...types) {
    
    // First get all global extensions
    DescribableList<GhprcExtension, GhprcExtensionDescriptor> copied = copyExtensions(trigger.getDescriptor().getExtensions());
    
    // Remove extensions that are specified by job
    filterList(copied, PredicateUtils.notPredicate(InstanceofPredicate.getInstance(GhprcProjectExtension.class)));
    
    // Then get the rest of the extensions from the job
    copied = copyExtensions(copied, trigger.getExtensions());
    
    // Filter extensions by desired interface
    filterList(copied, PredicateUtils.anyPredicate(createPredicate(types)));
    return copied;
}
 
开发者ID:bratchenko,项目名称:jenkins-github-pull-request-comments,代码行数:17,代码来源:Ghprc.java

示例8: rewrite

import hudson.util.DescribableList; //导入依赖的package包/类
/**
 * Walk the fields of an {@code object} via reflection and populate fields
 * of type {@link DescribableList} with a {@link FilteredDescribableList}
 * with the provided {@link Predicate}.
 */
public static void rewrite(Object object, Predicate predicate) {
  // TODO(mattmoor): This should be recursive.
  for (Class<?> clazz = object.getClass(); clazz != null;
       clazz = clazz.getSuperclass()) {
    for (Field field : clazz.getDeclaredFields()) {
      if (DescribableList.class.isAssignableFrom(field.getType())) {
        try {
          field.setAccessible(true);
          DescribableList list = (DescribableList) field.get(object);
          checkState(list == null || list.size() == 0);

          field.set(object, new FilteredDescribableList(
              predicate, (Saveable) object));
        } catch (IllegalAccessException e) {
          // Impossible, we have given ourselves access.
        }
      }
    }
  }
}
 
开发者ID:jenkinsci,项目名称:yaml-project-plugin,代码行数:26,代码来源:FilteredDescribableList.java

示例9: getPublishersList

import hudson.util.DescribableList; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public DescribableList<Publisher, Descriptor<Publisher>> getPublishersList() {
  // TODO(mattmoor): switch to utilize something with an atomic
  // compare/exchange semantic.
  if (publishers != null) {
    return publishers;
  }

  // NOTE: I believe this is lazily initialized vs. created in the
  // constructor so that lazy API consumers can omit an empty publisher list
  // from their serialized XML blob.
  synchronized (this) {
    if (publishers == null) {
      publishers =
          new DescribableList<Publisher, Descriptor<Publisher>>(this);
    }
  }

  return publishers;
}
 
开发者ID:jenkinsci,项目名称:yaml-project-plugin,代码行数:22,代码来源:AbstractRunnableItemGroup.java

示例10: should_set_build_timeout_to_60_mins_and_adds_ansi_color_xterm

import hudson.util.DescribableList; //导入依赖的package包/类
@Test
public void should_set_build_timeout_to_60_mins_and_adds_ansi_color_xterm() throws Exception {
    DynamicProject project = mock(DynamicProject.class);
    DescribableList wrapperList = mock(DescribableList.class);
    when(project.getBuildWrappersList()).thenReturn(wrapperList);
    DotCiProjectSetupListener dotCiProjectSetupListener = new DotCiProjectSetupListener();
    dotCiProjectSetupListener.onCreated(project);

    ArgumentCaptor<Object> argument = ArgumentCaptor.forClass(Object.class);
    verify(wrapperList, atMost(2)).add(argument.capture());
    List wrappers = argument.getAllValues();

    BuildTimeoutWrapper timeoutWrapper = (BuildTimeoutWrapper) wrappers.get(0);
    AbsoluteTimeOutStrategy absoluteTimeOutStrategy = (AbsoluteTimeOutStrategy)timeoutWrapper.getStrategy();
    assertEquals("60", absoluteTimeOutStrategy.getTimeoutMinutes());
    assertEquals("xterm", ((AnsiColorBuildWrapper) wrappers.get(1)).getColorMapName());

}
 
开发者ID:groupon,项目名称:DotCi-Plugins-Starter-Pack,代码行数:19,代码来源:DotCiProjectSetupListenerTest.java

示例11: configDefaults

import hudson.util.DescribableList; //导入依赖的package包/类
/**
 * Xstream ignores default field values, so set them explicitly
 */
private void configDefaults() {
    if (mode == null) {
        mode = Node.Mode.NORMAL;
    }
    if (retentionStrategy == null) {
        retentionStrategy = new DockerOnceRetentionStrategy(10);
    }
    if (pullStrategy == null) {
        pullStrategy = DockerImagePullStrategy.PULL_LATEST;
    }
    if (nodeProperties == null) {
        nodeProperties = 
            new DescribableList<NodeProperty<?>, NodePropertyDescriptor>(Jenkins.getInstance());
    }
}
 
开发者ID:jenkinsci,项目名称:docker-plugin,代码行数:19,代码来源:DockerTemplate.java

示例12: decode

import hudson.util.DescribableList; //导入依赖的package包/类
@Override
public Object decode(Class targetClass, Object fromDBObject, MappedField optionalExtraInfo) {
    if (fromDBObject == null) return null;

    BasicDBList rawList = (BasicDBList) fromDBObject;

    List list = new ArrayList();
    for (Object obj : rawList) {
        DBObject dbObj = (DBObject) obj;
        list.add(getMapper().fromDBObject(optionalExtraInfo.getSubClass(), dbObj, getMapper().createEntityCache()));
    }

    Saveable owner = null; // TODO figure out how to associate the deserialized project here

    return new DescribableList(owner, list);
}
 
开发者ID:groupon,项目名称:DotCi,代码行数:17,代码来源:DescribableListConverter.java

示例13: getBuildersList

import hudson.util.DescribableList; //导入依赖的package包/类
public DescribableList<Builder, Descriptor<Builder>> getBuildersList(
		IMode mode) {
	InheritanceGovernor<DescribableList<Builder, Descriptor<Builder>>> gov =
			new InheritanceGovernor<DescribableList<Builder, Descriptor<Builder>>>(
					"buildersList", SELECTOR.BUILDER, this) {
		@Override
		protected DescribableList<Builder, Descriptor<Builder>> castToDestinationType(Object o) {
			return castToDescribableList(o);
		}
		
		@Override
		public DescribableList<Builder, Descriptor<Builder>> getRawField(
				InheritanceProject ip) {
			return ip.getRawBuildersList();
		}
		
		@Override
		protected DescribableList<Builder, Descriptor<Builder>> reduceFromFullInheritance(
				Deque<DescribableList<Builder, Descriptor<Builder>>> list) {
			return InheritanceGovernor.reduceDescribableByMerge(list);
		}
	};
	
	return gov.retrieveFullyDerivedField(this, mode);
}
 
开发者ID:i-m-c,项目名称:jenkins-inheritance-plugin,代码行数:26,代码来源:InheritanceProject.java

示例14: getBuildWrappersList

import hudson.util.DescribableList; //导入依赖的package包/类
public DescribableList<BuildWrapper, Descriptor<BuildWrapper>> getBuildWrappersList(
		IMode mode) {
	InheritanceGovernor<DescribableList<BuildWrapper, Descriptor<BuildWrapper>>> gov =
			new InheritanceGovernor<DescribableList<BuildWrapper, Descriptor<BuildWrapper>>>(
					"buildWrappersList", SELECTOR.BUILD_WRAPPER, this) {
		@Override
		protected DescribableList<BuildWrapper, Descriptor<BuildWrapper>> castToDestinationType(Object o) {
			return castToDescribableList(o);
		}
		
		@Override
		public DescribableList<BuildWrapper, Descriptor<BuildWrapper>> getRawField(
				InheritanceProject ip) {
			return ip.getRawBuildWrappersList();
		}
		
		@Override
		protected DescribableList<BuildWrapper, Descriptor<BuildWrapper>> reduceFromFullInheritance(
				Deque<DescribableList<BuildWrapper, Descriptor<BuildWrapper>>> list) {
			return InheritanceGovernor.reduceDescribableByMergeWithoutDuplicates(list);
		}
	};
	
	return gov.retrieveFullyDerivedField(this, mode);
}
 
开发者ID:i-m-c,项目名称:jenkins-inheritance-plugin,代码行数:26,代码来源:InheritanceProject.java

示例15: getPublishersList

import hudson.util.DescribableList; //导入依赖的package包/类
public DescribableList<Publisher,Descriptor<Publisher>> getPublishersList(
		IMode mode) {
	InheritanceGovernor<DescribableList<Publisher, Descriptor<Publisher>>> gov =
			new InheritanceGovernor<DescribableList<Publisher, Descriptor<Publisher>>>(
					"publishersList", SELECTOR.PUBLISHER, this) {
		@Override
		protected DescribableList<Publisher, Descriptor<Publisher>> castToDestinationType(Object o) {
			return castToDescribableList(o);
		}
		
		@Override
		public DescribableList<Publisher, Descriptor<Publisher>> getRawField(
				InheritanceProject ip) {
			return ip.getRawPublishersList();
		}
		
		@Override
		protected DescribableList<Publisher, Descriptor<Publisher>> reduceFromFullInheritance(
				Deque<DescribableList<Publisher, Descriptor<Publisher>>> list) {
			return InheritanceGovernor.reduceDescribableByMerge(list);
		}
	};
	
	return gov.retrieveFullyDerivedField(this, mode);
}
 
开发者ID:i-m-c,项目名称:jenkins-inheritance-plugin,代码行数:26,代码来源:InheritanceProject.java


注:本文中的hudson.util.DescribableList类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。