本文整理汇总了Java中hudson.slaves.NodeProperty类的典型用法代码示例。如果您正苦于以下问题:Java NodeProperty类的具体用法?Java NodeProperty怎么用?Java NodeProperty使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NodeProperty类属于hudson.slaves包,在下文中一共展示了NodeProperty类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findNodeProperty
import hudson.slaves.NodeProperty; //导入依赖的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;
}
示例2: localRootPathToNodeMountPoint
import hudson.slaves.NodeProperty; //导入依赖的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"));
}
示例3: EC2AbstractSlave
import hudson.slaves.NodeProperty; //导入依赖的package包/类
@DataBoundConstructor
public EC2AbstractSlave(String name, String instanceId, String description, String remoteFS, int numExecutors, Mode mode, String labelString, ComputerLauncher launcher, RetentionStrategy<EC2Computer> retentionStrategy, String initScript, String tmpDir, List<? extends NodeProperty<?>> nodeProperties, String remoteAdmin, String jvmopts, boolean stopOnTerminate, String idleTerminationMinutes, List<EC2Tag> tags, String cloudName, boolean usePrivateDnsName, boolean useDedicatedTenancy, int launchTimeout, AMITypeData amiType) throws FormException, IOException {
super(name, "", remoteFS, numExecutors, mode, labelString, launcher, retentionStrategy, nodeProperties);
this.instanceId = instanceId;
this.initScript = initScript;
this.tmpDir = tmpDir;
this.remoteAdmin = remoteAdmin;
this.jvmopts = jvmopts;
this.stopOnTerminate = stopOnTerminate;
this.idleTerminationMinutes = idleTerminationMinutes;
this.tags = tags;
this.usePrivateDnsName = usePrivateDnsName;
this.useDedicatedTenancy = useDedicatedTenancy;
this.cloudName = cloudName;
this.launchTimeout = launchTimeout;
this.amiType = amiType;
readResolve();
}
示例4: testGetLaunchTimeoutInMillisShouldNotOverflow
import hudson.slaves.NodeProperty; //导入依赖的package包/类
public void testGetLaunchTimeoutInMillisShouldNotOverflow() throws Exception {
EC2AbstractSlave slave = new EC2AbstractSlave("name","id","description","fs",1,null,"label",null,null,"init","tmpDir", new ArrayList<NodeProperty<?>>(),"root","jvm",false,"idle",null,"cloud",false,false,Integer.MAX_VALUE, new UnixData("remote", "22")) {
@Override
public void terminate() {
//To change body of implemented methods use File | Settings | File Templates.
}
@Override
public String getEc2Type() {
return null; //To change body of implemented methods use File | Settings | File Templates.
}
};
assertEquals((long)timeoutInSecs * 1000, slave.getLaunchTimeoutInMillis());
}
示例5: OVirtVMSlave
import hudson.slaves.NodeProperty; //导入依赖的package包/类
/**
* The constructor for OVIrtVMSlave. Even though it has tons of parameters,
* it's Jenkins' responsibility to fill those in. This object is used to
* represent a node creating using the ovirt cloud.
*
* @param name name of the node
* @param nodeDescription node description
* @param remoteFS the filesystem used
* @param numExecutors how many executors to run with
* @param mode mode?
* @param labelString the labels associated with this node
* @param delegateLauncher the launcher used to launch that node
* @param retentionStrategy retention strategy
* @param hypervisorDescription the hypervisor description
* @param snapshotName the snapshot used
* @param waitSec how many seconds to wait before retrying
* @param retries how many retries to do
* @param virtualMachineName the name of the ovirt vm
* @param nodeProperties the node properties
*
* @throws Descriptor.FormException FormException
* @throws IOException IOException
*/
@DataBoundConstructor
public OVirtVMSlave(String name, String nodeDescription, String remoteFS,
String numExecutors, Mode mode, String labelString,
ComputerLauncher delegateLauncher,
RetentionStrategy retentionStrategy,
String hypervisorDescription, String snapshotName,
int waitSec, int retries,
String virtualMachineName,
List<? extends NodeProperty<?>> nodeProperties)
throws Descriptor.FormException, IOException {
super(name, nodeDescription, remoteFS, numExecutors, mode, labelString,
new OVirtVMLauncher(delegateLauncher, hypervisorDescription,
virtualMachineName, snapshotName,
waitSec, retries),
retentionStrategy,
nodeProperties);
this.hypervisorDescription = hypervisorDescription;
this.snapshotName = snapshotName;
this.virtualMachineName = virtualMachineName;
this.waitSec = waitSec;
this.retries = retries;
this.delegateLauncher = delegateLauncher;
}
示例6: doFillEnvironmentItems
import hudson.slaves.NodeProperty; //导入依赖的package包/类
public ListBoxModel doFillEnvironmentItems() {
ListBoxModel items = new ListBoxModel();
Node node = LeroyUtils.findNodeByName(leroyNode);
List<EnvironmentBean> envs = new ArrayList<EnvironmentBean>();
if (node != null) {
for (NodeProperty<?> nodeProperty : node.getNodeProperties()) {
if (nodeProperty instanceof LeroyNodeProperty) {
envs = ((LeroyNodeProperty) nodeProperty).getEnvironments();
}
}
}
if (CollectionUtils.isEmpty(envs)) {
LOGGER.severe("No environments found for node '" + leroyNode + "'");
}
for (EnvironmentBean env : envs) {
items.add(env.getName(), env.getName());
}
return items;
}
示例7: configDefaults
import hudson.slaves.NodeProperty; //导入依赖的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());
}
}
示例8: getNodePropertiesDescriptors
import hudson.slaves.NodeProperty; //导入依赖的package包/类
/**
* Get a list of all {@link NodePropertyDescriptor}s we can use to define DockerSlave NodeProperties.
*/
public List<NodePropertyDescriptor> getNodePropertiesDescriptors() {
// Copy/paste hudson.model.Slave.SlaveDescriptor.nodePropertyDescriptors marked as @Restricted for reasons I don't get
List<NodePropertyDescriptor> result = new ArrayList<NodePropertyDescriptor>();
Collection<NodePropertyDescriptor> list =
(Collection) Jenkins.getInstance().getDescriptorList(NodeProperty.class);
for (NodePropertyDescriptor npd : DescriptorVisibilityFilter.applyType(DockerTransientNode.class, list)) {
if (npd.isApplicable(DockerTransientNode.class)) {
result.add(npd);
}
}
final Iterator<NodePropertyDescriptor> iterator = result.iterator();
while (iterator.hasNext()) {
final NodePropertyDescriptor de = iterator.next();
// see https://issues.jenkins-ci.org/browse/JENKINS-47697
if ("org.jenkinsci.plugins.matrixauth.AuthorizationMatrixNodeProperty".equals(de.getKlass().toJavaClass().getName())) {
iterator.remove();
}
}
return result;
}
示例9: VirtualMachineSlave
import hudson.slaves.NodeProperty; //导入依赖的package包/类
@DataBoundConstructor
public VirtualMachineSlave(String name, String nodeDescription, String remoteFS, String numExecutors,
Mode mode, String labelString, ComputerLauncher delegateLauncher,
RetentionStrategy retentionStrategy, List<? extends NodeProperty<?>> nodeProperties,
String datacenterDescription, String datacenterNode, Integer virtualMachineId,
String snapshotName, Boolean startVM, int startupWaitingPeriodSeconds)
throws
Descriptor.FormException, IOException {
super(name, nodeDescription, remoteFS, numExecutors, mode, labelString,
new VirtualMachineLauncher(delegateLauncher, datacenterDescription, datacenterNode, virtualMachineId,
snapshotName, startVM, startupWaitingPeriodSeconds),
retentionStrategy, nodeProperties);
this.datacenterDescription = datacenterDescription;
this.datacenterNode = datacenterNode;
this.virtualMachineId = virtualMachineId;
this.snapshotName = snapshotName;
this.startVM = startVM;
this.startupWaitingPeriodSeconds = startupWaitingPeriodSeconds;
}
示例10: setup
import hudson.slaves.NodeProperty; //导入依赖的package包/类
@Before
public void setup() throws Exception {
super.setup();
JavaGitContainer slaveContainer = slaveRule.get();
DumbSlave agent = new DumbSlave("remote", "", "/home/test/slave", "1", Node.Mode.NORMAL, "",
new SSHLauncher(slaveContainer.ipBound(22), slaveContainer.port(22), "test", "test", "", ""),
RetentionStrategy.INSTANCE, Collections.<NodeProperty<?>>emptyList());
jenkinsRule.jenkins.addNode(agent);
}
示例11: ParallelsDesktopVMSlave
import hudson.slaves.NodeProperty; //导入依赖的package包/类
@DataBoundConstructor
public ParallelsDesktopVMSlave(ParallelsDesktopVM vm, ParallelsDesktopConnectorSlaveComputer connector)
throws IOException, Descriptor.FormException
{
super(vm.getSlaveName(), "", vm.getRemoteFS(), 1, Mode.NORMAL, vm.getLabels(), vm.getLauncher(),
new ParallelsDesktopCloudRetentionStrategy(), new ArrayList<NodeProperty<?>>());
this.connector = connector;
this.vm = vm;
}
示例12: ParallelsDesktopConnectorSlave
import hudson.slaves.NodeProperty; //导入依赖的package包/类
@DataBoundConstructor
public ParallelsDesktopConnectorSlave(ParallelsDesktopCloud owner, String name, String remoteFS,
ComputerLauncher launcher, boolean useAsBuilder)
throws IOException, Descriptor.FormException
{
super(name, "", remoteFS, 1, Mode.NORMAL, "", launcher,
useAsBuilder ? new RetentionStrategy.Always() : new RetentionStrategy.Demand(1, 1),
new ArrayList<NodeProperty<?>>());
this.owner = owner;
this.useAsBuilder = useAsBuilder;
}
示例13: DockerImage
import hudson.slaves.NodeProperty; //导入依赖的package包/类
@DataBoundConstructor
public DockerImage(String name, String labelString, Node.Mode mode, String instanceCapStr, String dockerImageName,
String remoteFS, boolean pullForced, boolean pullDisabled, String userOverride, long cpuShares,
boolean memoryLimited, long memoryLimitMB, boolean swapLimited, long swapLimitMB, boolean privileged,
String workingDir, String volumes, List<? extends NodeProperty<?>> nodeProperties) throws IOException {
this.name = name;
this.labelString = labelString;
this.mode = mode;
this.dockerImageName = dockerImageName;
this.remoteFS = remoteFS;
this.pullForced = pullForced;
this.pullDisabled = pullDisabled;
this.userOverride = userOverride;
this.cpuShares = cpuShares;
this.memoryLimited = memoryLimited;
this.memoryLimitMB = memoryLimitMB;
this.swapLimited = swapLimited;
this.swapLimitMB = swapLimitMB;
this.privileged = privileged;
this.workingDir = workingDir;
this.volumes = volumes;
if (instanceCapStr == null || "".equals(instanceCapStr)) {
instanceCap = Integer.MAX_VALUE;
} else {
instanceCap = Integer.parseInt(instanceCapStr);
}
this.nodeProperties.replaceBy(nodeProperties);
}
示例14: getNodePropertyDescriptors
import hudson.slaves.NodeProperty; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
public static List<NodePropertyDescriptor> getNodePropertyDescriptors(Class<? extends Node> clazz) {
List<NodePropertyDescriptor> result = new ArrayList<>();
Collection<NodePropertyDescriptor> list = (Collection) Jenkins.getInstance().getDescriptorList(NodeProperty.class);
for (NodePropertyDescriptor npd : list) {
if (npd.isApplicable(clazz)) {
result.add(npd);
}
}
return result;
}
示例15: DockerSlaveTemplate
import hudson.slaves.NodeProperty; //导入依赖的package包/类
/**
* FIXME DescribableList doesn't work with DBS https://gist.github.com/KostyaSha/3414f4f453ea7c7406b4
*/
@DataBoundConstructor
public DockerSlaveTemplate(@Nonnull String id, List<NodeProperty<?>> nodeProperties)
throws FormException {
this(id);
setNodeProperties(nodeProperties);
}