本文整理汇总了Java中hudson.util.ListBoxModel.Option方法的典型用法代码示例。如果您正苦于以下问题:Java ListBoxModel.Option方法的具体用法?Java ListBoxModel.Option怎么用?Java ListBoxModel.Option使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hudson.util.ListBoxModel
的用法示例。
在下文中一共展示了ListBoxModel.Option方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doFillImageItems_shouldFillWithDockerImages
import hudson.util.ListBoxModel; //导入方法依赖的package包/类
@Test
public void doFillImageItems_shouldFillWithDockerImages() {
TestgridBuildWrapper.DescriptorImpl descriptor = jenkins.getInstance().getDescriptorByType(TestgridBuildWrapper.DescriptorImpl.class);
List<DockerImageSettings> images = new ArrayList<DockerImageSettings>();
images.add(new DockerImageSettings("ff","ffimage"));
images.add(new DockerImageSettings("chrome","chromeimage"));
descriptor.setDockerImages(images);
ListBoxModel model = new BrowserInstance("").getDescriptor().doFillImageItems();
assertEquals(images.size(),model.size());
for (int i = 0; i < model.size(); i++) {
DockerImageSettings image = images.get(i);
ListBoxModel.Option o = model.get(i);
assertEquals(image.getName(), o.name);
assertEquals(image.getImageName(),o.value);
}
}
示例2: testListBoxEmpty
import hudson.util.ListBoxModel; //导入方法依赖的package包/类
@Test
public void testListBoxEmpty() throws Exception {
ListBoxModel list = GoogleRobotCredentials.getCredentialsListBox(
FakeGoogleCredentials.class);
assertEquals(0, list.size());
FakeGoogleCredentials credentials = new FakeGoogleCredentials(PROJECT_ID,
fakeCredential);
SystemCredentialsProvider.getInstance().getCredentials().add(credentials);
list = GoogleRobotCredentials.getCredentialsListBox(
FakeGoogleCredentials.class);
assertEquals(1, list.size());
for (ListBoxModel.Option option : list) {
assertEquals(NAME, option.name);
assertEquals(credentials.getId(), option.value);
}
}
示例3: doFillAuthenticationItems
import hudson.util.ListBoxModel; //导入方法依赖的package包/类
/**
* Fills the items for authentication for global configuration.
* @return
*/
@SuppressWarnings("UnusedDeclaration")
public ListBoxModel doFillAuthenticationItems(){
ListBoxModel authModel = new ListBoxModel(
new ListBoxModel.Option("Username / Password", Authentication.plain.name()),
new ListBoxModel.Option("OpenSSL", Authentication.openSSL.name()),
new ListBoxModel.Option("Kerberos (TBD)", Authentication.kerberos.name())
);
if (authentication == null) {
authModel.get(0).selected = true;
return authModel;
}
for (ListBoxModel.Option option : authModel) {
if (option.value.equals(Authentication.plain.name()))
option.selected = authentication.equals(Authentication.plain.name());
else if (option.value.equals(Authentication.openSSL.name()))
option.selected = authentication.equals(Authentication.openSSL.name());
else if (option.value.equals(Authentication.kerberos.name()))
option.selected = authentication.equals(Authentication.kerberos.name());
}
return authModel;
}
示例4: doFillApiTokenIdItems
import hudson.util.ListBoxModel; //导入方法依赖的package包/类
public ListBoxModel doFillApiTokenIdItems(@QueryParameter String name, @QueryParameter String url) {
if (Jenkins.getInstance().hasPermission(Item.CONFIGURE)) {
AbstractIdCredentialsListBoxModel<StandardListBoxModel, StandardCredentials> options = new StandardListBoxModel()
.includeEmptyValue()
.includeMatchingAs(ACL.SYSTEM,
Jenkins.getActiveInstance(),
StandardCredentials.class,
URIRequirementBuilder.fromUri(url).build(),
new GitLabCredentialMatcher());
if (name != null && connectionMap.containsKey(name)) {
String apiTokenId = connectionMap.get(name).getApiTokenId();
options.includeCurrentValue(apiTokenId);
for (ListBoxModel.Option option : options) {
if (option.value.equals(apiTokenId)) {
option.selected = true;
}
}
}
return options;
}
return new StandardListBoxModel();
}
示例5: doCheckCredentialsId
import hudson.util.ListBoxModel; //导入方法依赖的package包/类
public FormValidation doCheckCredentialsId(
@AncestorInPath Item context, @QueryParameter String remote, @QueryParameter String value) {
if (context == null && !Jenkins.getActiveInstance().hasPermission(Jenkins.ADMINISTER)
|| context != null && !context.hasPermission(Item.EXTENDED_READ)) {
return FormValidation.ok();
}
value = Util.fixEmptyAndTrim(value);
if (value == null) {
return FormValidation.ok();
}
remote = Util.fixEmptyAndTrim(remote);
if (remote == null)
// not set, can't check
{
return FormValidation.ok();
}
for (ListBoxModel.Option o :
CredentialsProvider.listCredentials(
StandardUsernameCredentials.class,
context,
context instanceof Queue.Task
? Tasks.getAuthenticationOf((Queue.Task) context)
: ACL.SYSTEM,
URIRequirementBuilder.fromUri(remote).build(),
GitClient.CREDENTIALS_MATCHER)) {
if (StringUtils.equals(value, o.value)) {
// TODO check if this type of credential is acceptable to the Git client or does it merit warning
// NOTE: we would need to actually lookup the credential to do the check, which may require
// fetching the actual credential instance from a remote credentials store. Perhaps this is
// not required
return FormValidation.ok();
}
}
// no credentials available, can't check
return FormValidation.warning("Cannot find any credentials with id " + value);
}
示例6: doFillNameItems
import hudson.util.ListBoxModel; //导入方法依赖的package包/类
public ListBoxModel doFillNameItems(@QueryParameter @RelativePath("..") final String serverUrl,
@QueryParameter @RelativePath("..") final String userName,
@QueryParameter @RelativePath("..") final String password,
@QueryParameter @RelativePath("..") final String tenant,
@QueryParameter @RelativePath("..") final String workflowName,
@QueryParameter final String name)
throws KeyManagementException, NoSuchAlgorithmException, KeyStoreException, IOException,
URISyntaxException {
BuildParam listWorkflowBuildParam = new BuildParam(serverUrl, userName, password, tenant, null);
OrchestratorClient listWfClient = new OrchestratorClient(listWorkflowBuildParam);
List<Workflow> workflows = listWfClient.fetchWorkflows();
String workflowId = null;
for (Workflow workflow : workflows) {
if (workflow.getName().equals(workflowName)) {
workflowId = workflow.getId();
break;
}
}
BuildParam buildParam = new BuildParam(serverUrl, userName, password, tenant, workflowId);
OrchestratorClient client = new OrchestratorClient(buildParam);
List<Parameter> parameters = client.fetchWorkflowInputParameters();
List<ListBoxModel.Option> options = new ArrayList<ListBoxModel.Option>(parameters.size());
for (Parameter parameter : parameters) {
String paramDisplayName = String.format("%[email protected]%s", parameter.getName(), parameter.getType());
options.add(new ListBoxModel.Option(paramDisplayName, paramDisplayName,
paramDisplayName.matches(name)));
}
ListBoxModel listBoxModel = new ListBoxModel(options);
return listBoxModel;
}
示例7: doFillIncreaseVersionOptionItems
import hudson.util.ListBoxModel; //导入方法依赖的package包/类
public ListBoxModel doFillIncreaseVersionOptionItems() {
return new ListBoxModel(
new ListBoxModel.Option("Major", String.valueOf(VersionUtils.increaseVersionOptions.MAJOR), false),
new ListBoxModel.Option("Minor", String.valueOf(VersionUtils.increaseVersionOptions.MINOR), false),
new ListBoxModel.Option("Patch", String.valueOf(VersionUtils.increaseVersionOptions.PACTH), false),
new ListBoxModel.Option("Build", String.valueOf(VersionUtils.increaseVersionOptions.BUILD), true)
);
}
示例8: doFillGitHubAuthIdItems
import hudson.util.ListBoxModel; //导入方法依赖的package包/类
@SuppressWarnings("UnusedDeclaration")
public ListBoxModel doFillGitHubAuthIdItems(@QueryParameter("gitHubAuthId") String gitHubAuthId) {
ListBoxModel model = new ListBoxModel();
for (GhprcGitHubAuth auth : getGithubAuth()) {
String description = Util.fixNull(auth.getDescription());
int length = description.length();
length = length > 50 ? 50 : length;
ListBoxModel.Option next = new ListBoxModel.Option(auth.getServerAPIUrl() + " : " + description.substring(0, length), auth.getId());
if (!StringUtils.isEmpty(gitHubAuthId) && gitHubAuthId.equals(auth.getId())) {
next.selected = true;
}
model.add(next);
}
return model;
}
示例9: doFillProjectNameItems
import hudson.util.ListBoxModel; //导入方法依赖的package包/类
/**
* Populate the project drop-down from the AWS Device Farm API or local cache.
*
* @return The ListBoxModel for the UI.
*/
@SuppressWarnings("unused")
public ListBoxModel doFillProjectNameItems(@QueryParameter String currentProjectName) {
// Create ListBoxModel from all projects for this AWS Device Farm account.
List<ListBoxModel.Option> entries = new ArrayList<ListBoxModel.Option>();
System.out.print("getting projects");
List<String> projectNames = getAWSDeviceFarmProjects();
System.out.print(String.format("project length = %d", projectNames.size()));
for (String projectName : projectNames) {
// We don't ignore case because these *should* be unique.
entries.add(new ListBoxModel.Option(projectName, projectName, projectName.equals(currentProjectName)));
}
return new ListBoxModel(entries);
}
示例10: doFillDevicePoolNameItems
import hudson.util.ListBoxModel; //导入方法依赖的package包/类
/**
* Populate the device pool drop-down from AWS Device Farm API or local cache.
* based on the selected project.
*
* @param projectName Name of the project selected.
* @param currentDevicePoolName Name of the device pool selected.
* @return The ListBoxModel for the UI.
*/
@SuppressWarnings("unused")
public ListBoxModel doFillDevicePoolNameItems(@QueryParameter String projectName, @QueryParameter String currentDevicePoolName) {
List<ListBoxModel.Option> entries = new ArrayList<ListBoxModel.Option>();
List<String> devicePoolNames = getAWSDeviceFarmDevicePools(projectName);
if (devicePoolNames == null) {
return new ListBoxModel();
}
for (String devicePoolName : devicePoolNames) {
// We don't ignore case because these *should* be unique.
entries.add(new ListBoxModel.Option(devicePoolName, devicePoolName, devicePoolName.equals(currentDevicePoolName)));
}
return new ListBoxModel(entries);
}
示例11: doFillAppiumVersionJunitItems
import hudson.util.ListBoxModel; //导入方法依赖的package包/类
/**
* Populate the project drop-down Appium Version.
*
* @return The ListBoxModel for the UI.
*/
@SuppressWarnings("unused")
public ListBoxModel doFillAppiumVersionJunitItems(@QueryParameter String currentAppiumVersion) {
List<ListBoxModel.Option> entries = new ArrayList<ListBoxModel.Option>();
ArrayList<String> appiumVersions = new ArrayList<String>();
appiumVersions.add(APPIUM_VERSION_1_6_3);
appiumVersions.add(APPIUM_VERSION_1_6_5);
appiumVersions.add(APPIUM_VERSION_1_4_16);
for (String appiumVersion: appiumVersions) {
entries.add(new ListBoxModel.Option(appiumVersion, appiumVersion, appiumVersion.equals(currentAppiumVersion)));
}
return new ListBoxModel(entries);
}
示例12: doFillAppiumVersionTestngItems
import hudson.util.ListBoxModel; //导入方法依赖的package包/类
/**
* Populate the project drop-down Appium Version.
*
* @return The ListBoxModel for the UI.
*/
@SuppressWarnings("unused")
public ListBoxModel doFillAppiumVersionTestngItems(@QueryParameter String currentAppiumVersion) {
List<ListBoxModel.Option> entries = new ArrayList<ListBoxModel.Option>();
ArrayList<String> appiumVersions = new ArrayList<String>();
appiumVersions.add(APPIUM_VERSION_1_6_3);
appiumVersions.add(APPIUM_VERSION_1_6_5);
appiumVersions.add(APPIUM_VERSION_1_4_16);
for (String appiumVersion: appiumVersions) {
// We don't ignore case because these *should* be unique.
entries.add(new ListBoxModel.Option(appiumVersion, appiumVersion, appiumVersion.equals(currentAppiumVersion)));
}
return new ListBoxModel(entries);
}
示例13: doFillAppiumVersionPythonItems
import hudson.util.ListBoxModel; //导入方法依赖的package包/类
/**
* Populate the project drop-down Appium Version.
*
* @return The ListBoxModel for the UI.
*/
@SuppressWarnings("unused")
public ListBoxModel doFillAppiumVersionPythonItems(@QueryParameter String currentAppiumVersion) {
// Create ListBoxModel from all projects for this AWS Device Farm account.
List<ListBoxModel.Option> entries = new ArrayList<ListBoxModel.Option>();
//System.out.print("getting appium version");
ArrayList<String> appiumVersions = new ArrayList<String>();
appiumVersions.add(APPIUM_VERSION_1_6_3);
appiumVersions.add(APPIUM_VERSION_1_6_5);
appiumVersions.add(APPIUM_VERSION_1_4_16);
for (String appiumVersion: appiumVersions) {
entries.add(new ListBoxModel.Option(appiumVersion, appiumVersion, appiumVersion.equals(currentAppiumVersion)));
}
return new ListBoxModel(entries);
}
示例14: doFillKojiTaskItems
import hudson.util.ListBoxModel; //导入方法依赖的package包/类
/**
* Fills the Koji task options for project configurations.
* @return
*/
@SuppressWarnings("UnusedDeclaration")
public ListBoxModel doFillKojiTaskItems(){
ListBoxModel kojiTaskModel = new ListBoxModel(
new ListBoxModel.Option("Koji moshimoshi (validate client configuration)", KojiTask.moshimoshi.name()),
new ListBoxModel.Option("Run a new maven build", KojiTask.mavenBuild.name()),
new ListBoxModel.Option("Download maven build", KojiTask.download.name()),
new ListBoxModel.Option("List latest build for package", KojiTask.listLatest.name())
);
return kojiTaskModel;
}
示例15: doFillServerTypeItems
import hudson.util.ListBoxModel; //导入方法依赖的package包/类
public ListBoxModel doFillServerTypeItems()
{
return new ListBoxModel(
new ListBoxModel.Option("Production (https://login.salesforce.com)", "https://login.salesforce.com"),
new ListBoxModel.Option("Sandbox (https://test.salesforce.com)", "https://test.salesforce.com")
);
}