use of com.venafi.vcert.sdk.VCertException in project vcert-java by Venafi.
the class CloudConnectorTest method testExceptionValidatingSANUriAllowed.
@Test
@DisplayName("Cloud - Testing Exception in Validation of Policy SAN UriAllowed")
public void testExceptionValidatingSANUriAllowed() throws VCertException {
classUnderTest.authenticate(new Authentication(null, null, "12345678-1234-1234-1234-123456789012"));
PolicySpecification policySpecification = CloudTestUtils.getPolicySpecification();
// setting the uriAllowed to true to validate that the related VCertException is thrown
policySpecification.policy().subjectAltNames().uriAllowed(true);
Exception exception = assertThrows(VCertException.class, () -> classUnderTest.setPolicy(CloudTestUtils.getRandomZone(), policySpecification));
assertEquals(CloudTestUtils.getVCertExceptionMessage(CloudPolicySpecificationValidator.SUBJECT_ALT_NAME_ATTRIBUTE_DOESNT_SUPPORTED_EXCEPTION_MESSAGE, PolicySpecificationConst.ATT_POLICY_SUBJECT_ALT_NAMES_URI_ALLOWED), exception.getMessage());
}
use of com.venafi.vcert.sdk.VCertException in project vcert-java by Venafi.
the class CloudConnectorTest method testExceptionValidatingPolicyOrgUnitsWhenWildcards.
@Test
@DisplayName("Cloud - Testing Exception in Validation of Policy OrgUnits with wildcard value")
public void testExceptionValidatingPolicyOrgUnitsWhenWildcards() throws VCertException {
classUnderTest.authenticate(new Authentication(null, null, "12345678-1234-1234-1234-123456789012"));
PolicySpecification policySpecification = CloudTestUtils.getPolicySpecification();
// setting the orgUnits to a list of values which contains ".*" to validate that the related VCertException is thrown
policySpecification.policy().subject().orgUnits(new String[] { PolicySpecificationConst.ALLOW_ALL, "org1" });
Exception exception = assertThrows(VCertException.class, () -> classUnderTest.setPolicy(CloudTestUtils.getRandomZone(), policySpecification));
assertEquals(CloudTestUtils.getVCertExceptionMessage(CloudPolicySpecificationValidator.ATTRIBUTE_HAS_MORE_THAN_ONE_VALUE_CONTAINING_ALLOW_ALL_STRING_EXCEPTION_MESSAGE, PolicySpecificationConst.ATT_POLICY_SUBJECT_ORG_UNITS), exception.getMessage());
}
use of com.venafi.vcert.sdk.VCertException in project vcert-java by Venafi.
the class CloudConnectorTest method testExceptionValidatingCertificateAuthority.
@Test
@DisplayName("Cloud - Testing Exception in Validation of CertificateAuthority")
public void testExceptionValidatingCertificateAuthority() throws VCertException {
classUnderTest.authenticate(new Authentication(null, null, "12345678-1234-1234-1234-123456789012"));
PolicySpecification policySpecification = CloudTestUtils.getPolicySpecification();
// setting the certificate authority to null to validate that the related VCertException is thrown
policySpecification.policy().certificateAuthority("certificateAuthority");
Exception exception = assertThrows(VCertException.class, () -> classUnderTest.setPolicy(CloudTestUtils.getRandomZone(), policySpecification));
assertEquals(CloudTestUtils.getVCertExceptionMessage(CloudPolicySpecificationValidator.CERTIFICATE_AUTHORITY_EXCEPTION_MESSAGE), exception.getMessage());
}
use of com.venafi.vcert.sdk.VCertException in project vcert-java by Venafi.
the class CloudConnectorTest method testExceptionValidatingPolicyStatesWhenWildcards.
@Test
@DisplayName("Cloud - Testing Exception in Validation of Policy States with wildcard value")
public void testExceptionValidatingPolicyStatesWhenWildcards() throws VCertException {
classUnderTest.authenticate(new Authentication(null, null, "12345678-1234-1234-1234-123456789012"));
PolicySpecification policySpecification = CloudTestUtils.getPolicySpecification();
// setting the States to a list of values which contains ".*" to validate that the related VCertException is thrown
policySpecification.policy().subject().states(new String[] { PolicySpecificationConst.ALLOW_ALL, "Yucatan" });
Exception exception = assertThrows(VCertException.class, () -> classUnderTest.setPolicy(CloudTestUtils.getRandomZone(), policySpecification));
assertEquals(CloudTestUtils.getVCertExceptionMessage(CloudPolicySpecificationValidator.ATTRIBUTE_HAS_MORE_THAN_ONE_VALUE_CONTAINING_ALLOW_ALL_STRING_EXCEPTION_MESSAGE, PolicySpecificationConst.ATT_POLICY_SUBJECT_STATES), exception.getMessage());
}
use of com.venafi.vcert.sdk.VCertException in project vcert-java by Venafi.
the class CloudConnectorTest method testExceptionValidatingPolicyCountriesWhenWildcards.
@Test
@DisplayName("Cloud - Testing Exception in Validation of Policy Countries with wildcard value")
public void testExceptionValidatingPolicyCountriesWhenWildcards() throws VCertException {
classUnderTest.authenticate(new Authentication(null, null, "12345678-1234-1234-1234-123456789012"));
PolicySpecification policySpecification = CloudTestUtils.getPolicySpecification();
// setting the Countries to a list of values which contains ".*" to validate that the related VCertException is thrown
policySpecification.policy().subject().countries(new String[] { PolicySpecificationConst.ALLOW_ALL, "Mexico" });
Exception exception = assertThrows(VCertException.class, () -> classUnderTest.setPolicy(CloudTestUtils.getRandomZone(), policySpecification));
assertEquals(CloudTestUtils.getVCertExceptionMessage(CloudPolicySpecificationValidator.ATTRIBUTE_HAS_MORE_THAN_ONE_VALUE_CONTAINING_ALLOW_ALL_STRING_EXCEPTION_MESSAGE, PolicySpecificationConst.ATT_POLICY_SUBJECT_COUNTRIES), exception.getMessage());
}
Aggregations