本文整理汇总了Java中hudson.model.Descriptor.FormException方法的典型用法代码示例。如果您正苦于以下问题:Java Descriptor.FormException方法的具体用法?Java Descriptor.FormException怎么用?Java Descriptor.FormException使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hudson.model.Descriptor
的用法示例。
在下文中一共展示了Descriptor.FormException方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doTestConnection
import hudson.model.Descriptor; //导入方法依赖的package包/类
public FormValidation doTestConnection(
@QueryParameter("mirrorGateAPIUrl") final String mirrorGateAPIUrl,
@QueryParameter("mirrorgateCredentialsId") final String credentialsId)
throws Descriptor.FormException {
MirrorGateService testMirrorGateService = getMirrorGateService();
if (testMirrorGateService != null) {
MirrorGateResponse response
= testMirrorGateService.testConnection();
return response.getResponseCode() == HttpStatus.SC_OK
? FormValidation.ok("Success")
: FormValidation.error("Failure<"
+ response.getResponseCode() + ">");
} else {
return FormValidation.error("Failure");
}
}
示例2: NomadSlave
import hudson.model.Descriptor; //导入方法依赖的package包/类
public NomadSlave(
NomadCloud cloud,
String name,
String nodeDescription,
NomadSlaveTemplate template,
String labelString,
Mode mode,
hudson.slaves.RetentionStrategy retentionStrategy,
List<? extends NodeProperty<?>> nodeProperties
) throws Descriptor.FormException, IOException {
super(
name,
nodeDescription,
template.getRemoteFs(),
template.getNumExecutors(),
mode,
labelString,
new JNLPLauncher(),
retentionStrategy,
nodeProperties
);
this.cloud = cloud;
}
示例3: reconfigure
import hudson.model.Descriptor; //导入方法依赖的package包/类
/**
* This method is called whenever the Job form is saved. We use the 'on' property
* to determine if the controls are selected.
*
* @param req - The request
* @param form - A JSONObject containing the submitted form data from the job configuration
* @return a {@link JobProperty} object representing the tagging added to the job
* @throws hudson.model.Descriptor.FormException if querying of form throws an error
*/
@Override
public JobProperty<?> reconfigure(StaplerRequest req, @Nonnull JSONObject form)
throws Descriptor.FormException {
DatadogJobProperty prop = (DatadogJobProperty) super.reconfigure(req, form);
System.out.println(form);
boolean isEnableFile = form.getBoolean("enableFile");
boolean isEnableTagProperties = form.getBoolean("enableProperty");
if(!isEnableFile) {
prop.tagFile = null;
prop.emitOnCheckout = false;
}
if(!isEnableTagProperties) {
prop.tagProperties = null;
}
return prop;
}
示例4: DockerSlave
import hudson.model.Descriptor; //导入方法依赖的package包/类
public DockerSlave(String slaveName, String nodeDescription, ComputerLauncher launcher, String containerId,
DockerSlaveTemplate dockerSlaveTemplate, String cloudId, ProvisioningActivity.Id provisioningId)
throws IOException, Descriptor.FormException {
super(slaveName,
nodeDescription, //description
dockerSlaveTemplate.getRemoteFs(),
dockerSlaveTemplate.getNumExecutors(),
dockerSlaveTemplate.getMode(),
dockerSlaveTemplate.getLabelString(),
launcher,
dockerSlaveTemplate.getRetentionStrategyCopy(),
dockerSlaveTemplate.getNodeProperties()
);
this.displayName = slaveName; // initial value
this.containerId = containerId;
this.cloudId = cloudId;
setDockerSlaveTemplate(dockerSlaveTemplate);
this.provisioningId = provisioningId;
}
示例5: configure
import hudson.model.Descriptor; //导入方法依赖的package包/类
@Override
public boolean configure(StaplerRequest sr, JSONObject formData)
throws Descriptor.FormException {
mirrorGateAPIUrl = sr.getParameter("mirrorGateAPIUrl");
mirrorgateCredentialsId = sr.getParameter("_.mirrorgateCredentialsId");
extraURLs = sr.getParameter("extraURLs");
save();
return super.configure(sr, formData);
}
示例6: SetCommitStatusStep
import hudson.model.Descriptor; //导入方法依赖的package包/类
@DataBoundConstructor
public SetCommitStatusStep(String serverUrl, String credentials, String commitId, String state, String key, String url)
throws Descriptor.FormException {
this.serverUrl = serverUrl;
this.credentials = credentials;
this.commitId = commitId;
this.state = state;
this.key = key;
this.url = url;
if (StringUtils.isBlank(serverUrl)) {
throw new Descriptor.FormException("Can not be empty", "serverUrl");
}
if (StringUtils.isBlank(credentials)) {
throw new Descriptor.FormException("Can not be empty", "credentials");
}
if (StringUtils.isBlank(commitId)) {
throw new Descriptor.FormException("Can not be empty", "commitId");
}
if (StringUtils.isBlank(state)) {
throw new Descriptor.FormException("Can not be empty", "state");
}
if (StringUtils.isBlank(key)) {
throw new Descriptor.FormException("Can not be empty", "key");
}
if (StringUtils.isBlank(url)) {
throw new Descriptor.FormException("Can not be empty", "url");
}
}
示例7: get
import hudson.model.Descriptor; //导入方法依赖的package包/类
@SuppressWarnings("unused")
public T get(Descriptor<T> descriptor) {
for (T item : this) {
if (descriptor.isInstance(item)) {
return item;
}
}
try {
return descriptor.newInstance(null, new JSONObject());
} catch (Descriptor.FormException e) {
throw new AssertionError(e);
}
}
示例8: testDoTestConnection
import hudson.model.Descriptor; //导入方法依赖的package包/类
@Test
public void testDoTestConnection() {
if (telegramServiceStub != null) {
telegramServiceStub.setResponse(response);
}
descriptor.setTelegramService(telegramServiceStub);
try {
FormValidation result = descriptor.doTestConnection("authToken", "room", "buildServerUrl");
assertEquals(result.kind, expectedResult);
} catch (Descriptor.FormException e) {
e.printStackTrace();
assertTrue(false);
}
}
示例9: prepareExecutorFor
import hudson.model.Descriptor; //导入方法依赖的package包/类
private Node prepareExecutorFor(final AbstractProject job) throws Descriptor.FormException, IOException, InterruptedException {
LOGGER.info("Creating a Container slave to host " + job.toString() + "#" + job.getNextBuildNumber());
// Immediately create a slave for this item
// Real provisioning will happen later
String slaveName = "Container for " + job.getName() + "#" + job.getNextBuildNumber();
String description = "Container slave for building " + job.getFullName();
HyperSlaves plugin = HyperSlaves.get();
return new HyperSlave(slaveName, description, null, plugin.createStandardJobProvisionerFactory(job));
}
示例10: ParallelsDesktopVMSlave
import hudson.model.Descriptor; //导入方法依赖的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;
}
示例11: ParallelsDesktopConnectorSlave
import hudson.model.Descriptor; //导入方法依赖的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;
}
示例12: testDoTestConnection
import hudson.model.Descriptor; //导入方法依赖的package包/类
@Test
public void testDoTestConnection() {
if (mattermostServiceStub != null) {
mattermostServiceStub.setResponse(response);
}
descriptor.setMattermostService(mattermostServiceStub);
try {
FormValidation result = descriptor.doTestConnection("host", "room", "", "buildServerUrl");
assertEquals(result.kind, expectedResult);
} catch (Descriptor.FormException e) {
e.printStackTrace();
assertTrue(false);
}
}
示例13: DockerSlaveSingle
import hudson.model.Descriptor; //导入方法依赖的package包/类
public DockerSlaveSingle(@Nonnull String name,
@Nonnull String nodeDescription,
@Nonnull DockerSlaveConfig config,
@Nonnull YADockerConnector connector,
@Nonnull ProvisioningActivity.Id activityId)
throws IOException, Descriptor.FormException {
super(name, nodeDescription,
config.getRemoteFs(), config.getNumExecutors(), config.getMode(),
"",
config.getLauncher(), config.getRetentionStrategy(), config.getNodeProperties());
this.connector = connector;
this.activityId = activityId;
this.config = config;
}
示例14: nullRetention
import hudson.model.Descriptor; //导入方法依赖的package包/类
@Test
public void nullRetention() throws Descriptor.FormException {
final DockerSlaveTemplate template = new DockerSlaveTemplate("id");
template.setRetentionStrategy(null);
assertThat(notAllowedStrategy(template), is(true));
}
示例15: dockerOnceRetention1
import hudson.model.Descriptor; //导入方法依赖的package包/类
@Test
public void dockerOnceRetention1() throws Descriptor.FormException {
final DockerSlaveTemplate template = new DockerSlaveTemplate("id");
template.setRetentionStrategy(new DockerOnceRetentionStrategy(3));
assertThat(notAllowedStrategy(template), is(false));
}