本文整理汇总了Java中jetbrains.buildServer.serverSide.InvalidProperty类的典型用法代码示例。如果您正苦于以下问题:Java InvalidProperty类的具体用法?Java InvalidProperty怎么用?Java InvalidProperty使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
InvalidProperty类属于jetbrains.buildServer.serverSide包,在下文中一共展示了InvalidProperty类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPropertiesProcessor
import jetbrains.buildServer.serverSide.InvalidProperty; //导入依赖的package包/类
@Nullable
@Override
public PropertiesProcessor getPropertiesProcessor() {
return properties -> {
List<InvalidProperty> result = new Vector<InvalidProperty>();
final String releaseName = properties.get(HELM_ROLLBACK_COMMAND_NAME + HelmConstants.RELEASE_NAME);
if (PropertiesUtil.isEmptyOrNull(releaseName)) {
result.add(new InvalidProperty(HELM_ROLLBACK_COMMAND_NAME + HelmConstants.RELEASE_NAME, "Release name must be specified"));
}
final Integer revision = PropertiesUtil.parseInt(properties.get(HELM_ROLLBACK_COMMAND_NAME + HelmConstants.REVISION));
if (revision == null || revision <= 0) {
result.add(new InvalidProperty(HELM_ROLLBACK_COMMAND_NAME + HelmConstants.REVISION, "Revision must be specified as positive integer"));
}
return result;
};
}
示例2: getPropertiesProcessor
import jetbrains.buildServer.serverSide.InvalidProperty; //导入依赖的package包/类
@Nullable
@Override
public PropertiesProcessor getPropertiesProcessor() {
return properties -> {
List<InvalidProperty> result = new Vector<InvalidProperty>();
final String chart = properties.get(HELM_UPGRADE_COMMAND_NAME + HelmConstants.CHART);
if (PropertiesUtil.isEmptyOrNull(chart)) {
result.add(new InvalidProperty(HELM_UPGRADE_COMMAND_NAME + HelmConstants.CHART, "Chart must be specified"));
}
final String releaseName = properties.get(HELM_UPGRADE_COMMAND_NAME + HelmConstants.RELEASE_NAME);
if (PropertiesUtil.isEmptyOrNull(releaseName)) {
result.add(new InvalidProperty(HELM_UPGRADE_COMMAND_NAME + HelmConstants.RELEASE_NAME, "Release name must be specified"));
}
return result;
};
}
示例3: getRunnerPropertiesProcessor
import jetbrains.buildServer.serverSide.InvalidProperty; //导入依赖的package包/类
@Nullable
@Override
public PropertiesProcessor getRunnerPropertiesProcessor() {
return properties -> {
List<InvalidProperty> result = new Vector<>();
final String commandId = properties.get(HelmConstants.COMMAND_ID);
if (PropertiesUtil.isEmptyOrNull(commandId)) {
result.add(new InvalidProperty(HelmConstants.COMMAND_ID, "Command to run must be specified"));
}
final HelmCommand helmCommand = HelmCommands.find(commandId);
if(helmCommand != null){
PropertiesProcessor propertiesProcessor = helmCommand.getPropertiesProcessor();
if(propertiesProcessor != null) {
result.addAll(propertiesProcessor.process(properties));
}
}
return result;
};
}
示例4: testProcessWhenAllRequiredValuesMissing
import jetbrains.buildServer.serverSide.InvalidProperty; //导入依赖的package包/类
@Test
public void testProcessWhenAllRequiredValuesMissing() throws Exception {
Map<String, String> input = new HashMap();
Collection<InvalidProperty> result = validator.process(input);
assertEquals(result.size(), 5);
ArrayList<InvalidProperty> result_array = (ArrayList<InvalidProperty>) result;
assertEquals(result_array.get(0).getPropertyName(), PluginConstants.UI_PARAM_BUCKET_NAME);
assertEquals(result_array.get(0).getInvalidReason(), String.format(validator.VALIDATOR_MISSING_VALUE_ERROR, PluginConstants.UI_PARAM_BUCKET_NAME_DESCRIPTION));
assertEquals(result_array.get(1).getPropertyName(), PluginConstants.UI_PARAM_BUCKET_REGION);
assertEquals(result_array.get(1).getInvalidReason(), String.format(validator.VALIDATOR_MISSING_VALUE_ERROR, PluginConstants.UI_PARAM_BUCKET_REGION_DESCRIPTION));
assertEquals(result_array.get(2).getPropertyName(), PluginConstants.UI_PARAM_CREDENTIALS_PUB_KEY);
assertEquals(result_array.get(2).getInvalidReason(), String.format(validator.VALIDATOR_MISSING_VALUE_ERROR, PluginConstants.UI_PARAM_CREDENTIALS_PUB_KEY_DESCRIPTION));
assertEquals(result_array.get(3).getPropertyName(), PluginConstants.UI_PARAM_CREDENTIALS_PRIVATE_KEY);
assertEquals(result_array.get(3).getInvalidReason(), String.format(validator.VALIDATOR_MISSING_VALUE_ERROR, PluginConstants.UI_PARAM_CREDENTIALS_PRIVATE_KEY_DESCRIPTION));
assertEquals(result_array.get(4).getPropertyName(), PluginConstants.UI_PARAM_CONTENT_PATHS);
assertEquals(result_array.get(4).getInvalidReason(), String.format(validator.VALIDATOR_MISSING_VALUE_ERROR, PluginConstants.UI_PARAM_CONTENT_PATHS_DESCRIPTION));
}
示例5: getParametersProcessor
import jetbrains.buildServer.serverSide.InvalidProperty; //导入依赖的package包/类
@Nullable
@Override
public PropertiesProcessor getParametersProcessor() {
return properties -> {
ArrayList<InvalidProperty> toReturn = new ArrayList<>();
if (!properties.containsKey(RunInContainerCloudConstants.ParameterName_CloudProfile))
toReturn.add(new InvalidProperty(RunInContainerCloudConstants.ParameterName_CloudProfile,
"Please choose a cloud profile"));
if (!properties.containsKey(RunInContainerCloudConstants.ParameterName_Image) ||
properties.get(RunInContainerCloudConstants.ParameterName_Image).isEmpty())
toReturn.add(new InvalidProperty(RunInContainerCloudConstants.ParameterName_Image,
"Please choose an image"));
else if (!properties.get(RunInContainerCloudConstants.ParameterName_Image).matches(ContainerCloudConstants.ContainerImageRegex))
toReturn.add(new InvalidProperty(RunInContainerCloudConstants.ParameterName_Image,
"Image must have format owner/image:version or repo-domain/owner/image:version (note that upper-case letters are not allowed)"));
return toReturn;
};
}
示例6: getPropertiesProcessor
import jetbrains.buildServer.serverSide.InvalidProperty; //导入依赖的package包/类
public static PropertiesProcessor getPropertiesProcessor() {
return properties -> {
if (!properties.containsKey(ContainerCloudConstants.ProfileParameterName_ContainerProvider)) {
// There's no use trying to validate anything more at this point (shouldn't ever happen anayway...)
return Stream.of(
new InvalidProperty(ContainerCloudConstants.ProfileParameterName_ContainerProvider,
"Container provider not selected"))
.collect(Collectors.toList());
}
PropertiesProcessor specificProcessor;
String provider = properties.get(ContainerCloudConstants.ProfileParameterName_ContainerProvider);
switch (provider) {
case ContainerCloudConstants.ProfileParameterValue_ContainerProvider_DockerSocket:
specificProcessor = DockerSocketContainerProvider.getPropertiesProcessor();
break;
case ContainerCloudConstants.ProfileParameterValue_ContainerProvider_Helios:
specificProcessor = HeliosContainerProvider.getPropertiesProcessor();
break;
default:
throw new CloudException("Unknown container provider '" + provider + "'");
}
return specificProcessor.process(properties);
};
}
示例7: process
import jetbrains.buildServer.serverSide.InvalidProperty; //导入依赖的package包/类
@Override
public Collection<InvalidProperty> process(Map<String, String> properties) {
Collection<InvalidProperty> invalidProperties = new ArrayList<InvalidProperty>();
validateProperty(Constants.PROPERTY_NAME_ACCOUNT_ID, "Account id must be set.", properties, invalidProperties);
validateProperty(Constants.PROPERTY_NAME_PROJECT_ID, "Project id must be set.", properties, invalidProperties);
validateProperty(Constants.PROPERTY_NAME_SCENARIO_IDS, "Scenario id's must be set.", properties, invalidProperties);
if(invalidProperties.isEmpty()){
String accountId = properties.get(Constants.PROPERTY_NAME_ACCOUNT_ID);
AccountSerializable account = configPersistenceManager.getAccount(accountId);
properties.put(Constants.PROPERTY_NAME_ACCOUNT_USERNAME, account.getUsername());
properties.put(Constants.PROPERTY_NAME_ACCOUNT_PASSWORD, account.getPassword());
}
return invalidProperties;
}
示例8: getParametersProcessor
import jetbrains.buildServer.serverSide.InvalidProperty; //导入依赖的package包/类
@Nullable
@Override
public PropertiesProcessor getParametersProcessor() {
return new PropertiesProcessor() {
public Collection<InvalidProperty> process(Map<String, String> properties) {
List<InvalidProperty> result = new ArrayList<InvalidProperty>();
final String userName = properties.get(myBean.getRunAsUserKey());
if (isEmpty(userName))
result.add(new InvalidProperty(myBean.getRunAsUserKey(), "Please specify an user name"));
final String password = properties.get(myBean.getRunAsPasswordKey());
if (isEmpty(password))
result.add(new InvalidProperty(myBean.getRunAsPasswordKey(), "Please specify a password"));
return result;
}
};
}
示例9: getRunnerPropertiesProcessor
import jetbrains.buildServer.serverSide.InvalidProperty; //导入依赖的package包/类
@Nullable
@Override
public PropertiesProcessor getRunnerPropertiesProcessor() {
return new PropertiesProcessor() {
@Override
public Collection<InvalidProperty> process(final Map<String, String> properties) {
final ArrayList<InvalidProperty> result = new ArrayList<InvalidProperty>();
final String user = properties.get(RunAsBean.Shared.getRunAsUserKey());
final String password = properties.get(RunAsBean.Shared.getRunAsPasswordKey());
if(!(StringUtil.isEmpty(user) && StringUtil.isEmpty(password))) {
if (StringUtil.isEmptyOrSpaces(user)) {
result.add(new InvalidProperty(RunAsBean.Shared.getRunAsUserKey(), "The user must be specified."));
}
if (StringUtil.isEmpty(password)) {
result.add(new InvalidProperty(RunAsBean.Shared.getRunAsPasswordKey(), "The password must be specified."));
}
}
return result;
}
};
}
示例10: checkInstancesLimitFormat
import jetbrains.buildServer.serverSide.InvalidProperty; //导入依赖的package包/类
private Collection<InvalidProperty> checkInstancesLimitFormat(Map<String, String> stringStringMap) {
String instancesLimitNumber = stringStringMap.get(WebConstants.INSTANCES_COUNT_LIMIT);
if (Strings.isNullOrEmpty(instancesLimitNumber)) {
return singleErrorList(WebConstants.INSTANCES_COUNT_LIMIT,
"Must be provided.");
} else {
try {
Integer parsedInteger = Integer.parseInt(instancesLimitNumber);
if (parsedInteger <= 0) {
return singleErrorList(WebConstants.INSTANCES_COUNT_LIMIT,
"Must be positive number.");
}
} catch (NumberFormatException e) {
return singleErrorList(WebConstants.INSTANCES_COUNT_LIMIT,
"Must be number.");
}
}
return Collections.emptyList();
}
示例11: validateImage
import jetbrains.buildServer.serverSide.InvalidProperty; //导入依赖的package包/类
private Collection<InvalidProperty> validateImage(String imageName, DropletSize dropletSize, String token) {
DOClientService client = clientFactory.createClient(token);
try {
DOCloudImage image = client.findImageByName(imageName);
Integer minDiskSize = image.getImage().getMinDiskSize();
DropletSize minSize = DropletSize.resolveByDiskSize(minDiskSize);
if (!minSize.isLessOrEqualThen(dropletSize)) {
return singleErrorList(WebConstants.DROPLET_SIZE,
"Selected image requires droplet with minimum " + minDiskSize + " disk size.");
}
} catch (DOError e) {
return singleErrorList(WebConstants.IMAGE_NAME, e.getMessage());
}
return Collections.emptyList();
}
示例12: getRunnerPropertiesProcessor
import jetbrains.buildServer.serverSide.InvalidProperty; //导入依赖的package包/类
@Override
public PropertiesProcessor getRunnerPropertiesProcessor() {
return new SSHDeployerPropertiesProcessor() {
@Override
public Collection<InvalidProperty> process(Map<String, String> properties) {
final Collection<InvalidProperty> invalidProperties = new HashSet<InvalidProperty>();
if (jetbrains.buildServer.util.StringUtil.isEmptyOrSpaces(properties.get(DeployerRunnerConstants.PARAM_USERNAME)) &&
!SSHRunnerConstants.AUTH_METHOD_DEFAULT_KEY.equals(properties.get(SSHRunnerConstants.PARAM_AUTH_METHOD))) {
invalidProperties.add(new InvalidProperty(DeployerRunnerConstants.PARAM_USERNAME, "Username must be specified."));
}
if (jetbrains.buildServer.util.StringUtil.isEmptyOrSpaces(properties.get(DeployerRunnerConstants.PARAM_TARGET_URL))) {
invalidProperties.add(new InvalidProperty(DeployerRunnerConstants.PARAM_TARGET_URL, "The target must be specified."));
}
if (jetbrains.buildServer.util.StringUtil.isEmptyOrSpaces(properties.get(SSHRunnerConstants.PARAM_COMMAND))) {
invalidProperties.add(new InvalidProperty(SSHRunnerConstants.PARAM_COMMAND, "Remote command must be specified"));
}
return invalidProperties;
}
};
}
示例13: getRunnerPropertiesProcessor
import jetbrains.buildServer.serverSide.InvalidProperty; //导入依赖的package包/类
@Nullable
@Override
public PropertiesProcessor getRunnerPropertiesProcessor() {
return new PropertiesProcessor() {
private void checkNotEmpty(@NotNull final Map<String, String> properties,
@NotNull final String key,
@NotNull final String message,
@NotNull final Collection<InvalidProperty> res) {
if (jetbrains.buildServer.util.StringUtil.isEmptyOrSpaces(properties.get(key))) {
res.add(new InvalidProperty(key, message));
}
}
@NotNull
public Collection<InvalidProperty> process(@Nullable final Map<String, String> p) {
final Collection<InvalidProperty> result = new ArrayList<InvalidProperty>();
if (p == null) return result;
checkNotEmpty(p, DotNetBuildConstants.Instance.getAssemblyKey(), "Assembly must be specified", result);
checkNotEmpty(p, DotNetBuildConstants.Instance.getTargetKey(), "Target must be specified", result);
return result;
}
};
}
示例14: getRunnerPropertiesProcessor
import jetbrains.buildServer.serverSide.InvalidProperty; //导入依赖的package包/类
@Nullable
@Override
public PropertiesProcessor getRunnerPropertiesProcessor() {
return new PropertiesProcessor() {
@Override
public Collection<InvalidProperty> process(final Map<String, String> properties) {
final ArrayList<InvalidProperty> result = new ArrayList<InvalidProperty>();
final boolean useDotTrace = StringUtil.isTrue(properties.get(DotTraceBean.Shared.getUseDotTraceKey()));
if(useDotTrace && StringUtil.isEmptyOrSpaces(properties.get(DotTraceBean.Shared.getPathKey()))) {
result.add(new InvalidProperty(DotTraceBean.Shared.getPathKey(), PATH_NOT_SPECIFIED_ERROR_MESSAGE));
}
if(useDotTrace && StringUtil.isEmptyOrSpaces(properties.get(DotTraceBean.Shared.getThresholdsKey()))) {
result.add(new InvalidProperty(DotTraceBean.Shared.getThresholdsKey(), THRESHOLDS_NOT_SPECIFIED_ERROR_MESSAGE));
}
return result;
}
};
}
示例15: process
import jetbrains.buildServer.serverSide.InvalidProperty; //导入依赖的package包/类
@Override
public Collection<InvalidProperty> process(Map<String, String> properties) {
Collection<InvalidProperty> result = new HashSet<InvalidProperty>();
if (StringUtil.isEmptyOrSpaces(properties.get(TodoBuildRunnerConstants.PARAM_INCLUDE_REGEX))) {
result.add(new InvalidProperty(TodoBuildRunnerConstants.PARAM_INCLUDE_REGEX, "The parameter 'include regex' must be specified."));
}
if (StringUtil.isEmptyOrSpaces(properties.get(TodoBuildRunnerConstants.PARAM_PATTERN_MINOR_REGEX))) {
result.add(new InvalidProperty(TodoBuildRunnerConstants.PARAM_PATTERN_MINOR_REGEX, "The parameter 'minor pattern' must be specified."));
}
if (StringUtil.isEmptyOrSpaces(properties.get(TodoBuildRunnerConstants.PARAM_PATTERN_MAJOR_REGEX))) {
result.add(new InvalidProperty(TodoBuildRunnerConstants.PARAM_PATTERN_MAJOR_REGEX, "The parameter 'major pattern' must be specified."));
}
if (StringUtil.isEmptyOrSpaces(properties.get(TodoBuildRunnerConstants.PARAM_PATTERN_CRITICAL_REGEX))) {
result.add(new InvalidProperty(TodoBuildRunnerConstants.PARAM_PATTERN_CRITICAL_REGEX, "The parameter 'critical pattern' must be specified."));
}
return result;
}