Search in sources :

Example 26 with GroupPromoteRequest

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));
}
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 27 with GroupPromoteRequest

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));
}
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 28 with GroupPromoteRequest

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));
}
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 29 with GroupPromoteRequest

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());
}
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 30 with GroupPromoteRequest

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));
}
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

GroupPromoteRequest (org.commonjava.indy.promote.model.GroupPromoteRequest)32 GroupPromoteResult (org.commonjava.indy.promote.model.GroupPromoteResult)32 Test (org.junit.Test)26 ValidationResult (org.commonjava.indy.promote.model.ValidationResult)18 Category (org.junit.experimental.categories.Category)17 Group (org.commonjava.indy.model.core.Group)11 IndyPromoteClientModule (org.commonjava.indy.promote.client.IndyPromoteClientModule)9 InputStream (java.io.InputStream)6 ByteArrayInputStream (java.io.ByteArrayInputStream)5 IndyDataException (org.commonjava.indy.data.IndyDataException)3 AbstractContentManagementTest (org.commonjava.indy.ftest.core.AbstractContentManagementTest)3 IOException (java.io.IOException)2 ExecutionException (java.util.concurrent.ExecutionException)2 HostedRepository (org.commonjava.indy.model.core.HostedRepository)2 StoreKey (org.commonjava.indy.model.core.StoreKey)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 Arrays (java.util.Arrays)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1