SlaveOptionsDescriptor extends OsAuthDescriptor<SlaveOptions> { @Restricted(DoNotUse.class) @RequirePOST public FormValidation doCheckStartTimeout( @QueryParameter String value, @RelativePath("../../slaveOptions") @QueryParameter("startTimeout") String def ) { Jenkins.get().checkPermission(Jenkins.ADMINISTER); if (Util.fixEmpty(value) == null) { String d = getDefault(def, opts().getStartTimeout()); if (d != null) return FormValidation.ok(def(d)); return REQUIRED; } return FormValidation.validatePositiveInteger(value); } SlaveOptionsDescriptor(); @Override String getDisplayName(); @Restricted(DoNotUse.class) @RequirePOST FormValidation doCheckInstanceCap(
            @QueryParameter String value,
            @RelativePath("../../slaveOptions") @QueryParameter("instanceCap") String def
    ); @Restricted(DoNotUse.class) @RequirePOST FormValidation doCheckInstancesMin(
            @QueryParameter String value,
            @RelativePath("../../slaveOptions") @QueryParameter("instancesMin") String def
    ); @Restricted(DoNotUse.class) @RequirePOST FormValidation doCheckStartTimeout(
            @QueryParameter String value,
            @RelativePath("../../slaveOptions") @QueryParameter("startTimeout") String def
    ); @Restricted(DoNotUse.class) @RequirePOST FormValidation doCheckNumExecutors(
            @QueryParameter String value,
            @RelativePath("../../slaveOptions") @QueryParameter("numExecutors") String def
    ); @Restricted(DoNotUse.class) @RequirePOST FormValidation doCheckRetentionTime(
            @QueryParameter String value,
            @RelativePath("../../slaveOptions") @QueryParameter("retentionTime") String def
    ); @Restricted(DoNotUse.class) @InjectOsAuth @RequirePOST ListBoxModel doFillFloatingIpPoolItems(
            @QueryParameter String floatingIpPool,
            @QueryParameter String endPointUrl, @QueryParameter boolean ignoreSsl,
            @QueryParameter String credentialsId, @QueryParameter String zone
    ); @Restricted(DoNotUse.class) @RequirePOST FormValidation doCheckFloatingIpPool(
            @QueryParameter String value,
            @RelativePath("../../slaveOptions") @QueryParameter("floatingIpPool") String def
    ); @Restricted(DoNotUse.class) @InjectOsAuth @RequirePOST ListBoxModel doFillHardwareIdItems(
            @QueryParameter String hardwareId, @QueryParameter String endPointUrl,
            @QueryParameter boolean ignoreSsl,
            @QueryParameter String credentialsId, @QueryParameter String zone
    ); @Restricted(DoNotUse.class) @RequirePOST FormValidation doCheckHardwareId(
            @QueryParameter String value,
            @RelativePath("../../slaveOptions") @QueryParameter("hardwareId") String def
    ); @Restricted(DoNotUse.class) @RequirePOST FormValidation doCheckNetworkId(
            @QueryParameter String value,
            @RelativePath("../../slaveOptions") @QueryParameter("networkId") String def,
            // authentication fields can be in two places relative to us.
            @RelativePath("..") @QueryParameter("endPointUrl") String endPointUrlCloud,
            @RelativePath("..") @QueryParameter("ignoreSsl") boolean ignoreSsl,
            @RelativePath("../..") @QueryParameter("endPointUrl") String endPointUrlTemplate,
            @RelativePath("..") @QueryParameter("credentialsId") String credentialsIdCloud,
            @RelativePath("../..") @QueryParameter("credentialsId") String credentialsIdTemplate,
            @RelativePath("..") @QueryParameter("zone") String zoneCloud,
            @RelativePath("../..") @QueryParameter("zone") String zoneTemplate
    ); @Restricted(DoNotUse.class) @RequirePOST ListBoxModel doFillUserDataIdItems(); @Restricted(DoNotUse.class) @RequirePOST FormValidation doCheckUserDataId(
            @QueryParameter String value,
            @RelativePath("../../slaveOptions") @QueryParameter("userDataId") String def
    ); @Restricted(DoNotUse.class) @RequirePOST ListBoxModel doFillConfigDriveItems(
            @QueryParameter String value,
            @RelativePath("../../slaveOptions") @QueryParameter("configDrive") String def
    ); @Restricted(DoNotUse.class) @RequirePOST FormValidation doCheckSecurityGroups(
            @QueryParameter String value,
            @RelativePath("../../slaveOptions") @QueryParameter("securityGroups") String def
    ); @Restricted(DoNotUse.class) @InjectOsAuth @RequirePOST ComboBoxModel doFillAvailabilityZoneItems(
            @QueryParameter String availabilityZone, @QueryParameter String endPointUrl,
            @QueryParameter boolean ignoreSsl,
            @QueryParameter String credentialsId, @QueryParameter String zone
    ); @Restricted(DoNotUse.class) @RequirePOST FormValidation doCheckAvailabilityZone(
            @QueryParameter String value,
            @RelativePath("../../slaveOptions") @QueryParameter("availabilityZone") String def,
            // authentication fields can be in two places relative to us.
            @RelativePath("..") @QueryParameter("endPointUrl") String endPointUrlCloud,
            @RelativePath("..") @QueryParameter("ignoreSsl") boolean ignoreSsl,
            @RelativePath("../..") @QueryParameter("endPointUrl") String endPointUrlTemplate,
            @RelativePath("..") @QueryParameter("credentialsId") String credentialsIdCloud,
            @RelativePath("../..") @QueryParameter("credentialsId") String credentialsIdTemplate,
            @RelativePath("..") @QueryParameter("zone") String zoneCloud,
            @RelativePath("../..") @QueryParameter("zone") String zoneTemplate
    ); @Restricted(DoNotUse.class) @InjectOsAuth @RequirePOST ListBoxModel doFillKeyPairNameItems(
            @QueryParameter String keyPairName,
            @QueryParameter String endPointUrl,
            @QueryParameter boolean ignoreSsl,
            @QueryParameter String credentialsId, @QueryParameter String zone
    ); @Restricted(DoNotUse.class) @RequirePOST FormValidation doCheckKeyPairName(
            @QueryParameter String value,
            @RelativePath("../../slaveOptions") @QueryParameter("keyPairName") String def
    ); @Restricted(DoNotUse.class) @RequirePOST FormValidation doCheckJvmOptions(
            @QueryParameter String value,
            @RelativePath("../../slaveOptions") @QueryParameter("jvmOptions") String def
    ); @Restricted(DoNotUse.class) @RequirePOST FormValidation doCheckFsRoot(
            @QueryParameter String value,
            @RelativePath("../../slaveOptions") @QueryParameter("fsRoot") String def
    ); @Override List<String> getAuthFieldsOffsets(); @Nonnull @Restricted(NoExternalUse.class) // used by Jelly EL only List<NodePropertyDescriptor> getNodePropertiesDescriptors(); @Override @Restricted(NoExternalUse.class) // Stapler SlaveOptions newInstance(@Nullable StaplerRequest req, @Nonnull JSONObject formData); static final FormValidation OK; static final FormValidation REQUIRED; }
@Test public void doCheckStartTimeout() { assertThat(d.doCheckStartTimeout(null, null), j.validateAs(OK, "Inherited value: 600000")); assertThat(d.doCheckStartTimeout(null, "10"), j.validateAs(OK, "Inherited value: 10")); assertThat(d.doCheckStartTimeout(null, "err"), j.validateAs(OK, "Inherited value: err")); assertThat(d.doCheckStartTimeout("1", "1"), j.validateAs(OK, null)); assertThat(d.doCheckStartTimeout("0", "1"), j.validateAs(ERROR, "Not a positive number")); assertThat(d.doCheckStartTimeout("err", null), j.validateAs(ERROR, "Not a number")); assertThat(d.doCheckStartTimeout("err", "1"), j.validateAs(ERROR, "Not a number")); assertThat(d.doCheckStartTimeout("-1", null), j.validateAs(ERROR, "Not a positive number")); assertThat(d.doCheckStartTimeout("-1", "1"), j.validateAs(ERROR, "Not a positive number")); }