本文整理汇总了Java中com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration.add方法的典型用法代码示例。如果您正苦于以下问题:Java PackageConfiguration.add方法的具体用法?Java PackageConfiguration.add怎么用?Java PackageConfiguration.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration
的用法示例。
在下文中一共展示了PackageConfiguration.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPackageConfiguration
import com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration; //导入方法依赖的package包/类
@Override
@EntryPoint
public PackageConfiguration getPackageConfiguration() {
PackageConfiguration packageConfig = new PackageConfiguration();
packageConfig.add(property(MODULE_NAME)
.withDisplayName("Module Name")
.withPartOfIdentity(true)
.withDisplayOrder(0)
.build());
packageConfig.add(property(LOWER_VERSION_BOUND_INCLUSIVE)
.withRequired(false)
.withDisplayName("Version to poll >=")
.withPartOfIdentity(false)
.withDisplayOrder(1)
.build());
packageConfig.add(property(UPPER_VERSION_BOUND_EXCLUSIVE)
.withRequired(false)
.withDisplayName("Version to poll <")
.withPartOfIdentity(false)
.withDisplayOrder(2)
.build());
return packageConfig;
}
示例2: shouldFailValidationIfSpuriousPropertiesAreConfigured
import com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration; //导入方法依赖的package包/类
@Test
public void shouldFailValidationIfSpuriousPropertiesAreConfigured() {
ValidationResult validationResult = new ValidationResult();
PackageConfiguration packageConfigurations = new PackageConfiguration();
RepositoryConfiguration repositoryConfiguration = new RepositoryConfiguration();
packageConfigurations.add(new PackageMaterialProperty("PACKAGE_NAME", "foo"));
packageConfigurations.add(new PackageMaterialProperty("foo1", "foo"));
packageConfigurations.add(new PackageMaterialProperty("foo2", "foo"));
repositoryConfiguration.add(new PackageMaterialProperty("bar1", "bar"));
repositoryConfiguration.add(new PackageMaterialProperty("bar2", "bar"));
repositoryConfiguration.add(new PackageMaterialProperty("REPO_URL", "http://asdsa"));
new DebRepositoryConfiguration().validate(packageConfigurations, repositoryConfiguration, validationResult);
assertThat(validationResult.isSuccessful(), is(false));
assertThat(validationResult.getErrors().contains(new ValidationError("", "Unsupported key(s) found : bar1, bar2. Allowed key(s) are : REPO_URL")), is(true));
assertThat(validationResult.getErrors().contains(new ValidationError("", "Unsupported key(s) found : foo1, foo2. Allowed key(s) are : PACKAGE_NAME, VERSION_SPEC, ARCHITECTURE")), is(true));
}
示例3: shouldThrowExceptionGivenEmptyRepo_getLatestRevision
import com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration; //导入方法依赖的package包/类
@Test
public void shouldThrowExceptionGivenEmptyRepo_getLatestRevision() throws Exception {
RepositoryConfiguration repositoryPackageConfigurations = new RepositoryConfiguration();
File emptyRepo = new File(getClass().getResource("/repos/emptyrepo").toURI());
repositoryPackageConfigurations.add(new PackageMaterialProperty(Constants.REPO_URL, "file://" + emptyRepo.getAbsolutePath()));
PackageConfiguration packagePackageConfigurations = new PackageConfiguration();
packagePackageConfigurations.add(new PackageMaterialProperty(Constants.PACKAGE_NAME, "crap-artifact"));
try {
poller.getLatestRevision(packagePackageConfigurations, repositoryPackageConfigurations);
fail("");
} catch (RuntimeException e) {
String expectedMessage = "Invalid file path.";
String actualMessage = e.getMessage();
assertThat(actualMessage.startsWith(expectedMessage), is((true)));
}
}
示例4: getPackageConfiguration
import com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration; //导入方法依赖的package包/类
@Override
public PackageConfiguration getPackageConfiguration() {
LOGGER.debug("getPackageConfiguration called.");
PackageConfiguration packageConfig = new PackageConfiguration();
packageConfig.add(space);
packageConfig.add(appName);
packageConfig.add(orgName);
return packageConfig;
}
示例5: shouldRejectUnsupportedTagsInPkgConfig
import com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration; //导入方法依赖的package包/类
@Test
public void shouldRejectUnsupportedTagsInPkgConfig() {
PackageConfiguration pkgConfig = new PackageConfiguration();
pkgConfig.add(new PackageMaterialProperty(PACKAGE_ID, "abc"));
pkgConfig.add(new PackageMaterialProperty("unsupported_key", "value"));
assertForPackageConfigurationErrors(
pkgConfig,
asList(new ValidationError("Unsupported key: unsupported_key. Valid keys: " + Arrays.toString(NpmPackageConfig.getValidKeys()))),
false);
}
示例6: factoryCreatesInstance
import com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration; //导入方法依赖的package包/类
@Test
public void factoryCreatesInstance() throws Exception {
PackageConfiguration packageConfig = new PackageConfiguration();
packageConfig.add(property(MODULE_NAME, "puppetlabs/apache"));
packageConfig.add(property(LOWER_VERSION_BOUND_INCLUSIVE, "1.0.0"));
packageConfig.add(property(UPPER_VERSION_BOUND_EXCLUSIVE, "1.1.0"));
ModuleSpec moduleSpec = new ModuleSpec.Factory().build(packageConfig);
assertThat(moduleSpec.getName(), is("puppetlabs/apache"));
assertThat(moduleSpec.getLowerVersionBound(), is(Version.of("1.0.0")));
assertThat(moduleSpec.getUpperVersionBound(), is(Version.of("1.1.0")));
}
示例7: factoryIgnoresNullVersionNumbers
import com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration; //导入方法依赖的package包/类
@Test
//TODO: does this actually happen?
public void factoryIgnoresNullVersionNumbers() throws Exception {
PackageConfiguration packageConfig = new PackageConfiguration();
packageConfig.add(property(MODULE_NAME, "puppetlabs/apache"));
packageConfig.add(property(LOWER_VERSION_BOUND_INCLUSIVE, null));
packageConfig.add(property(UPPER_VERSION_BOUND_EXCLUSIVE, null));
ModuleSpec moduleSpec = new ModuleSpec.Factory().build(packageConfig);
assertThat(moduleSpec.getLowerVersionBound(), is(Version.ZERO));
assertThat(moduleSpec.getUpperVersionBound(), is(Version.INFINITY));
}
示例8: factoryIgnoresMissingVersionNumbers
import com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration; //导入方法依赖的package包/类
/**
* This happens when checking the connection to the repository after creating the resource
*/
@Test
public void factoryIgnoresMissingVersionNumbers() throws Exception {
PackageConfiguration packageConfig = new PackageConfiguration();
packageConfig.add(property(MODULE_NAME, "puppetlabs/apache"));
ModuleSpec moduleSpec = new ModuleSpec.Factory().build(packageConfig);
assertThat(moduleSpec.getLowerVersionBound(), is(Version.ZERO));
assertThat(moduleSpec.getUpperVersionBound(), is(Version.INFINITY));
}
示例9: factoryIgnoresEmptyVersionNumbers
import com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration; //导入方法依赖的package包/类
@Test
public void factoryIgnoresEmptyVersionNumbers() throws Exception {
PackageConfiguration packageConfig = new PackageConfiguration();
packageConfig.add(property(MODULE_NAME, "puppetlabs/apache"));
packageConfig.add(property(LOWER_VERSION_BOUND_INCLUSIVE, " "));
packageConfig.add(property(UPPER_VERSION_BOUND_EXCLUSIVE, " "));
ModuleSpec moduleSpec = new ModuleSpec.Factory().build(packageConfig);
assertThat(moduleSpec.getLowerVersionBound(), is(Version.ZERO));
assertThat(moduleSpec.getUpperVersionBound(), is(Version.INFINITY));
}
示例10: shouldAcceptPackageConfigIfNoVersionsSpecified
import com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration; //导入方法依赖的package包/类
@Test
public void shouldAcceptPackageConfigIfNoVersionsSpecified() throws Exception {
PackageConfiguration packageConfig = new PackageConfiguration();
packageConfig.add(property(MODULE_NAME, "puppetlabs/apache"));
ValidationResult validationResult = config.isPackageConfigurationValid(packageConfig, new RepositoryConfiguration());
assertThat(validationResult.isSuccessful(), is(true));
}
示例11: shouldRejectPackageConfigIfModuleNameIsEmpty
import com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration; //导入方法依赖的package包/类
@Test
public void shouldRejectPackageConfigIfModuleNameIsEmpty() throws Exception {
PackageConfiguration packageConfig = new PackageConfiguration();
packageConfig.add(property(MODULE_NAME, " "));
ValidationResult validationResult = config.isPackageConfigurationValid(packageConfig, new RepositoryConfiguration());
assertThat(validationResult.isSuccessful(), is(false));
assertThat(validationResult.getMessages(), hasItem(equalTo("Module name is mandatory")));
}
示例12: shouldRejectPackageConfigIfModuleNameIsNull
import com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration; //导入方法依赖的package包/类
@Test
public void shouldRejectPackageConfigIfModuleNameIsNull() throws Exception {
PackageConfiguration packageConfig = new PackageConfiguration();
packageConfig.add(property(MODULE_NAME, null));
ValidationResult validationResult = config.isPackageConfigurationValid(packageConfig, new RepositoryConfiguration());
assertThat(validationResult.isSuccessful(), is(false));
assertThat(validationResult.getMessages(), hasItem(equalTo("Module name is mandatory")));
}
示例13: shouldRejectPackageConfigIfModuleNameInWrongFormat
import com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration; //导入方法依赖的package包/类
@Test
public void shouldRejectPackageConfigIfModuleNameInWrongFormat() throws Exception {
PackageConfiguration packageConfig = new PackageConfiguration();
packageConfig.add(property(MODULE_NAME, "apache"));
ValidationResult validationResult = config.isPackageConfigurationValid(packageConfig, new RepositoryConfiguration());
assertThat(validationResult.isSuccessful(), is(false));
assertThat(validationResult.getMessages(), hasItem(equalTo("Module name should be in format \"author/module\"")));
}
示例14: shouldRejectPackageConfigIfLowerVersionBoundInWrongFormat
import com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration; //导入方法依赖的package包/类
@Test
public void shouldRejectPackageConfigIfLowerVersionBoundInWrongFormat() throws Exception {
PackageConfiguration packageConfig = new PackageConfiguration();
packageConfig.add(property(MODULE_NAME, "puppetlabs/apache"));
packageConfig.add(property(LOWER_VERSION_BOUND_INCLUSIVE, "XX Bad format XX"));
ValidationResult validationResult = config.isPackageConfigurationValid(packageConfig, new RepositoryConfiguration());
assertThat(validationResult.isSuccessful(), is(false));
assertThat(validationResult.getMessages(), hasItem(equalTo("Version to poll >= should be a version number")));
}
示例15: shouldRejectPackageConfigIfUpperVersionBoundInWrongFormat
import com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration; //导入方法依赖的package包/类
@Test
public void shouldRejectPackageConfigIfUpperVersionBoundInWrongFormat() throws Exception {
PackageConfiguration packageConfig = new PackageConfiguration();
packageConfig.add(property(MODULE_NAME, "puppetlabs/apache"));
packageConfig.add(property(UPPER_VERSION_BOUND_EXCLUSIVE, "XX Bad format XX"));
ValidationResult validationResult = config.isPackageConfigurationValid(packageConfig, new RepositoryConfiguration());
assertThat(validationResult.isSuccessful(), is(false));
assertThat(validationResult.getMessages(), hasItem(equalTo("Version to poll < should be a version number")));
}