use of org.commonjava.indy.promote.model.GroupPromoteRequest in project indy by Commonjava.
the class NoSnapshots_PluginVersion_RuleTest method run.
@Test
@Category(EventDependent.class)
public void run() throws Exception {
String invalid = "org/foo/invalid/1/invalid-1.pom";
String valid = "org/foo/valid/1.1/valid-1.1.pom";
deploy(invalid, "<?xml version=\"1.0\"?>\n<project><modelVersion>4.0.0</modelVersion><groupId>org.foo</groupId>" + "<artifactId>invalid</artifactId><version>1</version><build><plugins>" + "<plugin><groupId>org.bar</groupId><artifactId>plugin</artifactId>" + "<version>1.0-SNAPSHOT</version></plugin></plugins></build></project>");
deploy(valid, "<?xml version=\"1.0\"?>\n<project><modelVersion>4.0.0</modelVersion><groupId>org.foo</groupId>" + "<artifactId>valid</artifactId><version>1.1</version><build><plugins>\"\n" + " + \"<plugin><groupId>org.bar</groupId><artifactId>plugin</artifactId>\"\n" + " + \"<version>1.0</version></plugin></plugins></build></project>");
waitForEventPropagation();
GroupPromoteRequest request = new GroupPromoteRequest(source.getKey(), target.getName());
GroupPromoteResult result = module.promoteToGroup(request);
assertThat(result, notNullValue());
ValidationResult validations = result.getValidations();
assertThat(validations, notNullValue());
Map<String, String> validatorErrors = validations.getValidatorErrors();
assertThat(validatorErrors, notNullValue());
System.out.println(validatorErrors);
String errors = validatorErrors.get(RULE);
assertThat("There should have been some validation errors!", errors, notNullValue());
System.out.println(validatorErrors);
assertThat("Validation errors should not originate from: " + valid, errors.contains(valid), equalTo(false));
assertThat("Validation errors should originate from: " + invalid, errors.contains(invalid), equalTo(true));
}
use of org.commonjava.indy.promote.model.GroupPromoteRequest in project indy by Commonjava.
the class NoSnapshots_ProjectVersion_RuleTest method run.
@Test
@Category(EventDependent.class)
public void run() throws Exception {
String invalid = "org/foo/invalid/1-SNAPSHOT/invalid-1-SNAPSHOT.pom";
String valid = "org/foo/valid/1.1/valid-1.1.pom";
deploy(invalid, "<?xml version=\"1.0\"?>\n<project><modelVersion>4.0.0</modelVersion><groupId>org.foo</groupId>" + "<artifactId>invalid</artifactId><version>1-SNAPSHOT</version></project>");
deploy(valid, "<?xml version=\"1.0\"?>\n<project><modelVersion>4.0.0</modelVersion><groupId>org.foo</groupId>" + "<artifactId>valid</artifactId><version>1.1</version></project>");
waitForEventPropagation();
GroupPromoteRequest request = new GroupPromoteRequest(source.getKey(), target.getName());
GroupPromoteResult result = module.promoteToGroup(request);
assertThat(result, notNullValue());
ValidationResult validations = result.getValidations();
assertThat(validations, notNullValue());
Map<String, String> validatorErrors = validations.getValidatorErrors();
assertThat(validatorErrors, notNullValue());
System.out.println(validatorErrors);
String errors = validatorErrors.get(RULE);
assertThat(errors, notNullValue());
System.out.println(validatorErrors);
assertThat(errors.contains(valid), equalTo(false));
assertThat(errors.contains(invalid), equalTo(true));
}
Aggregations