use of io.fabric8.maven.core.util.validator.ResourceValidator in project fabric8-maven-plugin by fabric8io.
the class ResourceValidatorTest method testValidKubernetesResourcesDirectory.
@Test
public void testValidKubernetesResourcesDirectory() throws IOException, URISyntaxException {
// Given
URL fileUrl = ResourceValidatorTest.class.getResource("/validations/kubernetes");
// When
ResourceValidator resourceValidator = new ResourceValidator(Paths.get(fileUrl.toURI()).toFile(), ResourceClassifier.KUBERNETES, logger);
int resources = resourceValidator.validate();
// Then
Assert.assertEquals(2, resources);
}
use of io.fabric8.maven.core.util.validator.ResourceValidator in project fabric8-maven-plugin by fabric8io.
the class ResourceValidatorTest method testInvalidKubernetesPodSpec.
@Test
public void testInvalidKubernetesPodSpec() throws IOException, URISyntaxException {
// Given
URL fileUrl = ResourceValidatorTest.class.getResource("/validations/kubernetes-deploy-invalid.yml");
// When
ResourceValidator resourceValidator = new ResourceValidator(Paths.get(fileUrl.toURI()).toFile(), ResourceClassifier.KUBERNETES, logger);
// Then
thrown.expect(ConstraintViolationException.class);
thrown.expect(Matchers.hasProperty("constraintViolations", IsCollectionWithSize.hasSize(2)));
// On
resourceValidator.validate();
}
use of io.fabric8.maven.core.util.validator.ResourceValidator in project fabric8-maven-plugin by fabric8io.
the class ResourceValidatorTest method testValidOpenShiftResources.
@Test
public void testValidOpenShiftResources() throws IOException, URISyntaxException {
// Given
URL fileUrl = ResourceValidatorTest.class.getResource("/validations/openshift-deploymentconfig.yml");
// When
ResourceValidator resourceValidator = new ResourceValidator(Paths.get(fileUrl.toURI()).toFile(), ResourceClassifier.OPENSHIFT, logger);
int resources = resourceValidator.validate();
// Then
Assert.assertEquals(1, resources);
}
use of io.fabric8.maven.core.util.validator.ResourceValidator in project fabric8-maven-plugin by fabric8io.
the class ResourceValidatorTest method testValidOpenshiftResourcesDirectory.
@Test
public void testValidOpenshiftResourcesDirectory() throws IOException, URISyntaxException {
// Given
URL fileUrl = ResourceValidatorTest.class.getResource("/validations/openshift");
// When
ResourceValidator resourceValidator = new ResourceValidator(Paths.get(fileUrl.toURI()).toFile(), ResourceClassifier.OPENSHIFT, logger);
int resources = resourceValidator.validate();
// Then
Assert.assertEquals(2, resources);
}
use of io.fabric8.maven.core.util.validator.ResourceValidator in project fabric8-maven-plugin by fabric8io.
the class ResourceValidatorTest method testInvalidOpenshiftDeployConfig.
@Test
public void testInvalidOpenshiftDeployConfig() throws IOException, URISyntaxException {
// Given
URL fileUrl = ResourceValidatorTest.class.getResource("/validations/openshift-invalid-deploymentconfig.yml");
// When
ResourceValidator resourceValidator = new ResourceValidator(Paths.get(fileUrl.toURI()).toFile(), ResourceClassifier.OPENSHIFT, logger);
// Then
thrown.expect(ConstraintViolationException.class);
thrown.expect(Matchers.hasProperty("constraintViolations", IsCollectionWithSize.hasSize(1)));
// On
resourceValidator.validate();
}
Aggregations