Search in sources :

Example 11 with ThreatProtectionPolicyDTO

use of org.wso2.carbon.apimgt.rest.api.publisher.dto.ThreatProtectionPolicyDTO in project carbon-apimgt by wso2.

the class SampleTestObjectCreator method createUniqueThreatProtectionPolicyDTO.

/**
 * Creates a new {@link ThreatProtectionPolicyDTO} object for testing purposes
 * @return {@link ThreatProtectionPolicyDTO}
 */
public static ThreatProtectionPolicyDTO createUniqueThreatProtectionPolicyDTO() {
    ThreatProtectionPolicyDTO dto = new ThreatProtectionPolicyDTO();
    dto.setUuid(UUID.randomUUID().toString());
    dto.setType("JSON");
    dto.setName("JSON POLICY 1");
    String policyString = "{\"maxFieldLength\": 20, \"maxDepth\": 20, \"maxFieldCount\": 20, " + "\"maxStringLength\": 100, \"maxArrayElementCount\": 100}";
    dto.setPolicy(policyString);
    return dto;
}
Also used : ThreatProtectionPolicyDTO(org.wso2.carbon.apimgt.rest.api.core.dto.ThreatProtectionPolicyDTO)

Example 12 with ThreatProtectionPolicyDTO

use of org.wso2.carbon.apimgt.rest.api.publisher.dto.ThreatProtectionPolicyDTO in project carbon-apimgt by wso2.

the class MappingUtil method toThreatProtectionPolicyDTO.

public static ThreatProtectionPolicyDTO toThreatProtectionPolicyDTO(ThreatProtectionPolicy policy) {
    ThreatProtectionPolicyDTO dto = new ThreatProtectionPolicyDTO();
    dto.setUuid(policy.getUuid());
    dto.setType(policy.getType());
    dto.setName(policy.getName());
    dto.setPolicy(policy.getPolicy());
    return dto;
}
Also used : ThreatProtectionPolicyDTO(org.wso2.carbon.apimgt.rest.api.publisher.dto.ThreatProtectionPolicyDTO)

Aggregations

ThreatProtectionPolicy (org.wso2.carbon.apimgt.core.models.policy.ThreatProtectionPolicy)4 ThreatProtectionPolicyDTO (org.wso2.carbon.apimgt.rest.api.admin.dto.ThreatProtectionPolicyDTO)4 APIManagementException (org.wso2.carbon.apimgt.core.exception.APIManagementException)3 ThreatProtectionPolicyDTO (org.wso2.carbon.apimgt.rest.api.core.dto.ThreatProtectionPolicyDTO)3 Response (javax.ws.rs.core.Response)2 Test (org.junit.Test)2 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)2 APIMgtAdminService (org.wso2.carbon.apimgt.core.api.APIMgtAdminService)2 APIManagerFactory (org.wso2.carbon.apimgt.core.impl.APIManagerFactory)2 APIMgtAdminServiceImpl (org.wso2.carbon.apimgt.core.impl.APIMgtAdminServiceImpl)2 ThreatProtectionPolicyDTO (org.wso2.carbon.apimgt.rest.api.publisher.dto.ThreatProtectionPolicyDTO)2 ArrayList (java.util.ArrayList)1 Test (org.testng.annotations.Test)1 APIPublisher (org.wso2.carbon.apimgt.core.api.APIPublisher)1