Search in sources :

Example 16 with GroupPromoteResult

use of org.commonjava.indy.promote.model.GroupPromoteResult in project indy by Commonjava.

the class GroupPromoteSourceIsReadOnlyTest 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));
    source = client.stores().load(hosted, source.getName(), HostedRepository.class);
    assertThat(source.isReadonly(), equalTo(true));
}
Also used : GroupPromoteRequest(org.commonjava.indy.promote.model.GroupPromoteRequest) Group(org.commonjava.indy.model.core.Group) GroupPromoteResult(org.commonjava.indy.promote.model.GroupPromoteResult) IndyPromoteClientModule(org.commonjava.indy.promote.client.IndyPromoteClientModule) HostedRepository(org.commonjava.indy.model.core.HostedRepository) Test(org.junit.Test)

Example 17 with GroupPromoteResult

use of org.commonjava.indy.promote.model.GroupPromoteResult 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));
}
Also used : GroupPromoteRequest(org.commonjava.indy.promote.model.GroupPromoteRequest) Group(org.commonjava.indy.model.core.Group) GroupPromoteResult(org.commonjava.indy.promote.model.GroupPromoteResult) IndyPromoteClientModule(org.commonjava.indy.promote.client.IndyPromoteClientModule) Test(org.junit.Test)

Example 18 with GroupPromoteResult

use of org.commonjava.indy.promote.model.GroupPromoteResult 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));
}
Also used : GroupPromoteRequest(org.commonjava.indy.promote.model.GroupPromoteRequest) GroupPromoteResult(org.commonjava.indy.promote.model.GroupPromoteResult) ValidationResult(org.commonjava.indy.promote.model.ValidationResult) Category(org.junit.experimental.categories.Category) Test(org.junit.Test)

Example 19 with GroupPromoteResult

use of org.commonjava.indy.promote.model.GroupPromoteResult 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());
}
Also used : GroupPromoteRequest(org.commonjava.indy.promote.model.GroupPromoteRequest) GroupPromoteResult(org.commonjava.indy.promote.model.GroupPromoteResult) ValidationResult(org.commonjava.indy.promote.model.ValidationResult) Category(org.junit.experimental.categories.Category) Test(org.junit.Test)

Example 20 with GroupPromoteResult

use of org.commonjava.indy.promote.model.GroupPromoteResult 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));
}
Also used : GroupPromoteRequest(org.commonjava.indy.promote.model.GroupPromoteRequest) GroupPromoteResult(org.commonjava.indy.promote.model.GroupPromoteResult) ValidationResult(org.commonjava.indy.promote.model.ValidationResult) Category(org.junit.experimental.categories.Category) Test(org.junit.Test)

Aggregations

GroupPromoteResult (org.commonjava.indy.promote.model.GroupPromoteResult)23 GroupPromoteRequest (org.commonjava.indy.promote.model.GroupPromoteRequest)22 Test (org.junit.Test)20 ValidationResult (org.commonjava.indy.promote.model.ValidationResult)16 Category (org.junit.experimental.categories.Category)15 Group (org.commonjava.indy.model.core.Group)7 InputStream (java.io.InputStream)5 IndyPromoteClientModule (org.commonjava.indy.promote.client.IndyPromoteClientModule)5 ByteArrayInputStream (java.io.ByteArrayInputStream)4 ChangeSummary (org.commonjava.indy.audit.ChangeSummary)2 IndyDataException (org.commonjava.indy.data.IndyDataException)2 AbstractContentManagementTest (org.commonjava.indy.ftest.core.AbstractContentManagementTest)2 HostedRepository (org.commonjava.indy.model.core.HostedRepository)2 EventMetadata (org.commonjava.maven.galley.event.EventMetadata)2 IOException (java.io.IOException)1 IndyClientException (org.commonjava.indy.client.core.IndyClientException)1 StoreKey (org.commonjava.indy.model.core.StoreKey)1