Package org.sonatype.configuration.validation

Examples of org.sonatype.configuration.validation.ValidationResponse


      public List<String> getMemberRepositoryIds() {
        return Lists.newArrayList("1", "1");
      }
    };

    final ValidationResponse validationResponse = underTest.doValidateChanges(
        applicationConfiguration, mock(CoreConfiguration.class), xpp3Dom
    );

    assertThat(validationResponse.isValid(), is(false));
    assertThat(validationResponse.getValidationErrors().size(), is(1));
    assertThat(
        validationResponse.getValidationErrors().get(0).getMessage(),
        is("Group repository has same member multiple times!")
    );
  }
View Full Code Here


    @Override
    public ValidationResponse doValidateChanges(ApplicationConfiguration applicationConfiguration,
                                                CoreConfiguration owner, Xpp3Dom configuration)
    {
      return new ValidationResponse();
    }
View Full Code Here

    badShadow.setExternalConfiguration(externalConfig);
    ExternalConfigUtil.setNodeValue(externalConfig, "masterRepositoryId", "non-existent");
    config.addRepository(badShadow);

    // now validate it
    ValidationResponse response = underTest.validateModel(new ValidationRequest(config));

    assertThat(response.getValidationWarnings(), hasSize(1));
    assertThat(response.getValidationErrors(), hasSize(0));

    // codehaus-snapshots has no name, it will be defaulted
    assertThat(response.isModified(), is(true));

    assertThat(response.isValid(), is(true));
  }
View Full Code Here

    }

    // TODO: add more errors here

    // now validate it
    ValidationResponse response = underTest.validateModel(new ValidationRequest(config));

    assertThat(response.isValid(), is(false));
    assertThat(response.isModified(), is(false));

    assertThat(response.getValidationErrors(), hasSize(greaterThan(0)));
    assertThat(response.getValidationWarnings(), hasSize(0));
  }
View Full Code Here

    ApplicationValidationContext ctx = new ApplicationValidationContext();

    CRepository repo = new CRepository();
    repo.setLocalStatus(LocalStatus.IN_SERVICE.toString());
    repo.setName("name");
    ValidationResponse response = underTest.validateRepository(ctx, repo);

    assertThat(response.isValid(), is(false));
    assertThat(response.isModified(), is(false));

    assertThat(response.getValidationErrors(), hasSize(1));
    assertThat(response.getValidationWarnings(), hasSize(0));
    assertThat(response.getValidationErrors().get(0), hasKey("id"));
  }
View Full Code Here

    CRepository repo = new CRepository();
    repo.setId(" ");
    repo.setLocalStatus(LocalStatus.IN_SERVICE.toString());
    repo.setName("name");

    ValidationResponse response = underTest.validateRepository(ctx, repo);

    assertThat(response.isValid(), is(false));
    assertThat(response.isModified(), is(false));

    assertThat(response.getValidationErrors(), hasSize(1));
    assertThat(response.getValidationWarnings(), hasSize(0));
    assertThat(response.getValidationErrors().get(0), hasKey("id"));
  }
View Full Code Here

    CRepository repo = new CRepository();
    repo.setId("id");
    repo.setLocalStatus(LocalStatus.IN_SERVICE.toString());
    repo.setName("name");

    ValidationResponse response = underTest.validateRepository(ctx, repo);

    assertThat(response.isValid(), is(false));
    assertThat(response.isModified(), is(false));

    assertThat(response.getValidationErrors(), hasSize(1));
    assertThat(response.getValidationWarnings(), hasSize(0));
    assertThat(response.getValidationErrors().get(0), hasKey("id"));
  }
View Full Code Here

    CRepository repo = new CRepository();
    repo.setId("id");
    repo.setLocalStatus(LocalStatus.IN_SERVICE.toString());
    repo.setName("name");

    ValidationResponse response = underTest.validateRepository(ctx, repo);

    assertThat(response.isValid(), is(false));
    assertThat(response.isModified(), is(false));

    assertThat(response.getValidationErrors(), hasSize(1));
    assertThat(response.getValidationWarnings(), hasSize(0));
    assertThat(response.getValidationErrors().get(0), hasKey("id"));
  }
View Full Code Here

    CRepository repo = new CRepository();
    repo.setId("id");
    repo.setLocalStatus(LocalStatus.IN_SERVICE.toString());
    repo.setName("name");

    ValidationResponse response = underTest.validateRepository(ctx, repo);

    assertThat(response.isValid(), is(false));
    assertThat(response.isModified(), is(false));

    assertThat(response.getValidationErrors(), hasSize(1));
    assertThat(response.getValidationWarnings(), hasSize(0));
    assertThat(response.getValidationErrors().get(0), hasKey("id"));
  }
View Full Code Here

    ApplicationValidationContext ctx = new ApplicationValidationContext();
    CRepository repo = new CRepository();
    repo.setId("id");
    repo.setLocalStatus(LocalStatus.IN_SERVICE.toString());

    ValidationResponse response = underTest.validateRepository(ctx, repo);

    assertThat(response.isValid(), is(true));
    assertThat(response.isModified(), is(true));

    assertThat(response.getValidationErrors(), hasSize(0));
    assertThat(response.getValidationWarnings(), hasSize(1));
    ValidationMessage actual = response.getValidationWarnings().get(0);
    assertThat(actual, hasKey("id"));
  }
View Full Code Here

TOP

Related Classes of org.sonatype.configuration.validation.ValidationResponse

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.