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));
}
use of org.commonjava.indy.promote.model.GroupPromoteRequest in project indy by Commonjava.
the class ProjectArtifactsRuleTest method run.
// @Override
// protected int getTestTimeoutMultiplier()
// {
// return 3;
// }
@Test
@Category(EventDependent.class)
public void run() throws Exception {
String invalidGav = "org.foo:invalid:1";
String validGav = "org.foo:valid:1.1";
String invalidPom = "org/foo/invalid/1/invalid-1.pom";
String invalidJar = "org/foo/invalid/1/invalid-1.jar";
String validPom = "org/foo/valid/1.1/valid-1.1.pom";
String validJar = "org/foo/valid/1.1/valid-1.1.jar";
String validSources = "org/foo/valid/1.1/valid-1.1-sources.jar";
String validJavadocs = "org/foo/valid/1.1/valid-1.1-javadoc.jar";
deploy(invalidPom, CONTENT);
deploy(invalidJar, CONTENT);
deploy(validPom, CONTENT);
deploy(validJar, CONTENT);
deploy(validSources, CONTENT);
deploy(validJavadocs, CONTENT);
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(validGav), equalTo(false));
assertThat(errors.contains(invalidGav), equalTo(true));
}
use of org.commonjava.indy.promote.model.GroupPromoteRequest in project indy by Commonjava.
the class ProjectVersionPatternRuleForTempBuildTest method run.
@Test
@Category(EventDependent.class)
public void run() throws Exception {
String invalidJar = "org/foo/invalid/1.0.0.redhat-00004/invalid-1.0.0.redhat-00004.jar";
String validJar = "org/foo/valid/1.0.0.temporary-redhat-00004/valid-1.0.0.temporary-redhat-00004.jar";
String invalidDocJar = "org/foo/invalid/1.0.0.redhat-00004/invalid-1.0.0.redhat-00004-javadoc.jar";
String validDocJar = "org/foo/valid/1.0.0.temporary-redhat-00004/valid-1.0.0.temporary-redhat-00004-javadoc.jar";
String invalidSrcJar = "org/foo/invalid/1.0.0.redhat-00004/invalid-1.0.0.redhat-00004-sources.jar";
String validSrcJar = "org/foo/valid/1.0.0.temporary-redhat-00004/valid-1.0.0.temporary-redhat-00004-sources.jar";
// Set<String> paths = new HashSet<>( 6 );
// paths.add(invalidJar);
// paths.add(validJar);
// paths.add(invalidDocJar);
// paths.add(validDocJar);
// paths.add(invalidSrcJar);
// paths.add(validSrcJar);
deploy(invalidJar, "just for test of invalid jar");
deploy(validJar, "just for test of valid jar");
deploy(invalidDocJar, "just for test of invalid javadoc jar");
deploy(validDocJar, "just for test of valid javadoc jar");
deploy(invalidSrcJar, "just for test of invalid source jar");
deploy(validSrcJar, "just for test of valid source jar");
waitForEventPropagation();
GroupPromoteRequest request = new GroupPromoteRequest(source.getKey(), target.getName());
GroupPromoteResult result = module.promoteToGroup(request);
// PathsPromoteRequest request = new PathsPromoteRequest( source.getKey(), target.getKey(), paths );
// PathsPromoteResult result = module.promoteByPath( request );
assertThat(result, notNullValue());
ValidationResult validations = result.getValidations();
assertThat(validations, notNullValue());
assertThat(validations.isValid(), equalTo(false));
Map<String, String> validatorErrors = validations.getValidatorErrors();
assertThat(validatorErrors, notNullValue());
assertThat(validatorErrors.size(), not(0));
logger.info("Validation error:\n{}", validatorErrors);
String errors = validatorErrors.get(RULE);
assertThat(errors, notNullValue());
assertThat(errors.contains(validJar), equalTo(false));
assertThat(errors.contains(invalidJar), equalTo(true));
assertThat(errors.contains(validDocJar), equalTo(false));
assertThat(errors.contains(invalidDocJar), equalTo(true));
assertThat(errors.contains(validSrcJar), equalTo(false));
assertThat(errors.contains(invalidSrcJar), equalTo(true));
}
use of org.commonjava.indy.promote.model.GroupPromoteRequest in project indy by Commonjava.
the class ProjectArtifactsRule_PomDeploymentTest method run.
@Test
@Category(EventDependent.class)
public void run() throws Exception {
String validGav = "org.foo:valid:1.1";
String validPom = "org/foo/valid/1.1/valid-1.1.pom";
deploy(validPom, CONTENT);
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);
System.out.println(validatorErrors);
assertThat(errors, nullValue());
}
use of org.commonjava.indy.promote.model.GroupPromoteRequest in project indy by Commonjava.
the class ProjectVersionPatternRuleTest 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></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