use of com.venafi.vcert.sdk.policy.domain.PolicySpecification in project vcert-java by Venafi.
the class TppTokenConnectorTest method testExceptionValidatingPolicyKeySizesContainsUnsupportedValue.
@Test
@DisplayName("TPP - Testing Exception in Validation of Policy KeySizes that has unsupported value")
public void testExceptionValidatingPolicyKeySizesContainsUnsupportedValue() throws VCertException {
PolicySpecification policySpecification = TppTestUtils.getPolicySpecification();
// setting the keysizes to a list of values which contains
// more than on value to validate that the related VCertException is thrown
policySpecification.policy().keyPair().rsaKeySizes(new Integer[] { 256 });
Exception exception = assertThrows(VCertException.class, () -> classUnderTest.setPolicy(TppTestUtils.getRandomZone(), policySpecification));
Assertions.assertEquals(TppTestUtils.getVCertExceptionMessage(TPPPolicySpecificationValidator.ATTRIBUTE_DOESNT_MATCH_WITH_ACCEPTED_VALUES_EXCEPTION_MESSAGE, PolicySpecificationConst.ATT_POLICY_KEYPAIR_RSA_KEY_SIZES), exception.getMessage());
}
use of com.venafi.vcert.sdk.policy.domain.PolicySpecification in project vcert-java by Venafi.
the class TppTokenConnectorTest method testExceptionValidatingDefaultKeySizeDoesntMatchWithPolicyKeyType.
@Test
@DisplayName("TPP - Testing Exception in Validation of Default KeySize with a value not matching with the Policy KeySize")
public void testExceptionValidatingDefaultKeySizeDoesntMatchWithPolicyKeyType() throws VCertException {
PolicySpecification policySpecification = TppTestUtils.getPolicySpecification();
// setting the default KeySize to a value which is not matching with
// the Policy KeySize to validate that the related VCertException is thrown
policySpecification.defaults().keyPair().rsaKeySize(512);
Exception exception = assertThrows(VCertException.class, () -> classUnderTest.setPolicy(TppTestUtils.getRandomZone(), policySpecification));
Assertions.assertEquals(TppTestUtils.getVCertExceptionMessage(TPPPolicySpecificationValidator.DEFAULT_ATTRIBUTE_DOESNT_MATCH_EXCEPTION_MESSAGE, PolicySpecificationConst.ATT_DEFAULTS_KEYPAIR_RSA_KEY_SIZE, PolicySpecificationConst.ATT_POLICY_KEYPAIR_RSA_KEY_SIZES), exception.getMessage());
}
use of com.venafi.vcert.sdk.policy.domain.PolicySpecification in project vcert-java by Venafi.
the class TppTokenConnectorTest method testExceptionValidatingPolicyKeySizesHasMoreThanOneValue.
@Test
@DisplayName("TPP - Testing Exception in Validation of Policy KeySizes that has more than one value")
public void testExceptionValidatingPolicyKeySizesHasMoreThanOneValue() throws VCertException {
PolicySpecification policySpecification = TppTestUtils.getPolicySpecification();
// setting the keysizes to a list of values which contains
// more than on value to validate that the related VCertException is thrown
policySpecification.policy().keyPair().rsaKeySizes(new Integer[] { 1024, 3072 });
Exception exception = assertThrows(VCertException.class, () -> classUnderTest.setPolicy(TppTestUtils.getRandomZone(), policySpecification));
Assertions.assertEquals(TppTestUtils.getVCertExceptionMessage(TPPPolicySpecificationValidator.ATTRIBUTE_HAS_MORE_THAN_ONE_VALUE_EXCEPTION_MESSAGE, PolicySpecificationConst.ATT_POLICY_KEYPAIR_RSA_KEY_SIZES), exception.getMessage());
}
use of com.venafi.vcert.sdk.policy.domain.PolicySpecification in project vcert-java by Venafi.
the class TppTokenConnectorTest method testExceptionValidatingPolicyECHasMoreThanOneValue.
@Test
@DisplayName("TPP - Testing Exception in Validation of Policy EC that has more than one value")
public void testExceptionValidatingPolicyECHasMoreThanOneValue() throws VCertException {
PolicySpecification policySpecification = TppTestUtils.getPolicySpecification();
// setting the EC to a list of values which contains
// more than on value to validate that the related VCertException is thrown
policySpecification.policy().keyPair().ellipticCurves(new String[] { "P256", "P384" });
Exception exception = assertThrows(VCertException.class, () -> classUnderTest.setPolicy(TppTestUtils.getRandomZone(), policySpecification));
Assertions.assertEquals(TppTestUtils.getVCertExceptionMessage(TPPPolicySpecificationValidator.ATTRIBUTE_HAS_MORE_THAN_ONE_VALUE_EXCEPTION_MESSAGE, PolicySpecificationConst.ATT_POLICY_KEYPAIR_ELLIPTIC_CURVES), exception.getMessage());
}
use of com.venafi.vcert.sdk.policy.domain.PolicySpecification in project vcert-java by Venafi.
the class TppTokenConnectorTest method testExceptionValidatingPolicyStates.
@Test
@DisplayName("TPP - Testing Exception in Validation of Policy States with more than one value")
public void testExceptionValidatingPolicyStates() throws VCertException {
PolicySpecification policySpecification = TppTestUtils.getPolicySpecification();
// setting the states to a list of more than 1 values
// to validate that the related VCertException is thrown
policySpecification.policy().subject().states(new String[] { "State1", "State2" });
Exception exception = assertThrows(VCertException.class, () -> classUnderTest.setPolicy(TppTestUtils.getRandomZone(), policySpecification));
Assertions.assertEquals(TppTestUtils.getVCertExceptionMessage(TPPPolicySpecificationValidator.ATTRIBUTE_HAS_MORE_THAN_ONE_VALUE_EXCEPTION_MESSAGE, PolicySpecificationConst.ATT_POLICY_SUBJECT_STATES), exception.getMessage());
}
Aggregations