Search in sources :

Example 6 with ResponseCode

use of org.wso2.carbon.apimgt.impl.certificatemgt.ResponseCode in project carbon-apimgt by wso2.

the class CertificateMgtUtilTest method testUpdateCertificate.

@Test
public void testUpdateCertificate() throws CertificateManagementException {
    ResponseCode responseCode = certificateMgtUtils.updateCertificate(BASE64_ENCODED_CERT_STRING, ALIAS);
    Assert.assertEquals(ResponseCode.SUCCESS, responseCode);
}
Also used : ResponseCode(org.wso2.carbon.apimgt.impl.certificatemgt.ResponseCode) Test(org.junit.Test)

Example 7 with ResponseCode

use of org.wso2.carbon.apimgt.impl.certificatemgt.ResponseCode in project carbon-apimgt by wso2.

the class CertificateMgtUtilTest method testUpdateCertificateWithExpiredCertificate.

@Test
public void testUpdateCertificateWithExpiredCertificate() throws CertificateManagementException {
    ResponseCode responseCode = certificateMgtUtils.updateCertificate(EXPIRED_CERTIFICATE, ALIAS);
    Assert.assertEquals(ResponseCode.CERTIFICATE_EXPIRED, responseCode);
}
Also used : ResponseCode(org.wso2.carbon.apimgt.impl.certificatemgt.ResponseCode) Test(org.junit.Test)

Example 8 with ResponseCode

use of org.wso2.carbon.apimgt.impl.certificatemgt.ResponseCode in project carbon-apimgt by wso2.

the class CertificateMgtUtilTest method testAddCertificateToTrustStore.

@Test
public void testAddCertificateToTrustStore() {
    ResponseCode result = certificateMgtUtils.addCertificateToTrustStore(BASE64_ENCODED_CERT_STRING, ALIAS);
    Assert.assertEquals(result, ResponseCode.SUCCESS);
}
Also used : ResponseCode(org.wso2.carbon.apimgt.impl.certificatemgt.ResponseCode) Test(org.junit.Test)

Example 9 with ResponseCode

use of org.wso2.carbon.apimgt.impl.certificatemgt.ResponseCode in project carbon-apimgt by wso2.

the class CertificateMgtUtilTest method testUpdateCertificateWithEmptyCertificate.

@Test
public void testUpdateCertificateWithEmptyCertificate() throws CertificateManagementException {
    ResponseCode responseCode = certificateMgtUtils.updateCertificate("", ALIAS);
    Assert.assertEquals(ResponseCode.INTERNAL_SERVER_ERROR, responseCode);
}
Also used : ResponseCode(org.wso2.carbon.apimgt.impl.certificatemgt.ResponseCode) Test(org.junit.Test)

Example 10 with ResponseCode

use of org.wso2.carbon.apimgt.impl.certificatemgt.ResponseCode in project carbon-apimgt by wso2.

the class CertificateMgtUtilTest method testUpdateCertificateWithCertificateNotFound.

@Test
public void testUpdateCertificateWithCertificateNotFound() throws CertificateManagementException {
    ResponseCode responseCode = certificateMgtUtils.updateCertificate(BASE64_ENCODED_CERT_STRING, ALIAS_NOT_EXIST);
    Assert.assertEquals(ResponseCode.CERTIFICATE_NOT_FOUND, responseCode);
}
Also used : ResponseCode(org.wso2.carbon.apimgt.impl.certificatemgt.ResponseCode) Test(org.junit.Test)

Aggregations

ResponseCode (org.wso2.carbon.apimgt.impl.certificatemgt.ResponseCode)18 Test (org.junit.Test)17 APIManagementException (org.wso2.carbon.apimgt.api.APIManagementException)9 IOException (java.io.IOException)8 APIProvider (org.wso2.carbon.apimgt.api.APIProvider)6 ArrayList (java.util.ArrayList)5 CertificateMetadataDTO (org.wso2.carbon.apimgt.api.dto.CertificateMetadataDTO)5 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)4 UserStoreException (org.wso2.carbon.user.api.UserStoreException)4 URI (java.net.URI)3 URISyntaxException (java.net.URISyntaxException)3 ContentDisposition (org.apache.cxf.jaxrs.ext.multipart.ContentDisposition)3 FaultGatewaysException (org.wso2.carbon.apimgt.api.FaultGatewaysException)3 API (org.wso2.carbon.apimgt.api.model.API)3 APIIdentifier (org.wso2.carbon.apimgt.api.model.APIIdentifier)3 APIProduct (org.wso2.carbon.apimgt.api.model.APIProduct)3 APIProductIdentifier (org.wso2.carbon.apimgt.api.model.APIProductIdentifier)3 SubscribedAPI (org.wso2.carbon.apimgt.api.model.SubscribedAPI)3 CertificateAliasExistsException (org.wso2.carbon.apimgt.impl.certificatemgt.exceptions.CertificateAliasExistsException)3 CertificateManagementException (org.wso2.carbon.apimgt.impl.certificatemgt.exceptions.CertificateManagementException)3