use of org.commonjava.indy.promote.model.GroupPromoteRequest in project indy by Commonjava.
the class GroupPromoteTest method run.
@Test
public void run() throws Exception {
final GroupPromoteResult result = client.module(IndyPromoteClientModule.class).promoteToGroup(new GroupPromoteRequest(source.getKey(), target.getName()));
assertThat(result.getRequest().getSource(), equalTo(source.getKey()));
assertThat(result.getRequest().getTargetGroup(), equalTo(target.getName()));
assertThat(result.getError(), nullValue());
assertThat(client.content().exists(target.getKey().getType(), target.getName(), first), equalTo(true));
assertThat(client.content().exists(target.getKey().getType(), target.getName(), second), equalTo(true));
Group g = client.stores().load(StoreType.group, target.getName(), Group.class);
assertThat(g.getConstituents().contains(source.getKey()), equalTo(true));
}
use of org.commonjava.indy.promote.model.GroupPromoteRequest in project indy by Commonjava.
the class ProjectArtifactsRuleTest method run.
@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 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));
}
use of org.commonjava.indy.promote.model.GroupPromoteRequest in project indy by Commonjava.
the class ArtifactRefs_DependencyTwoExtraGroups_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";
String dep1Pom = "org/bar/dep/1.0/dep-1.0.pom";
String dep1Jar = "org/bar/dep/1.0/dep-1.0.jar";
String dep2Pom = "org/blat/dep2/1.0/dep2-1.0.pom";
String dep2Jar = "org/blat/dep2/1.0/dep2-1.0.jar";
String content = "this is some content";
client.content().store(otherSource.getKey(), dep1Pom, new ByteArrayInputStream(content.getBytes()));
client.content().store(otherSource.getKey(), dep1Jar, new ByteArrayInputStream(content.getBytes()));
client.content().store(thirdSource.getKey(), dep2Pom, new ByteArrayInputStream(content.getBytes()));
client.content().store(thirdSource.getKey(), dep2Jar, new ByteArrayInputStream(content.getBytes()));
InputStream stream = client.content().get(other.getKey(), dep1Pom);
String retrieved = IOUtils.toString(stream);
stream.close();
assertThat(dep1Pom + " invalid from: " + other.getKey(), retrieved, equalTo(content));
stream = client.content().get(other.getKey(), dep1Jar);
retrieved = IOUtils.toString(stream);
stream.close();
assertThat(dep1Jar + " invalid from: " + other.getKey(), retrieved, equalTo(content));
deployResource(invalid, PREFIX + "invalid-external-dep.pom.xml");
deployResource(valid, PREFIX + "valid-two-external-deps.pom.xml");
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