Search in sources :

Example 76 with ApiPolicy

use of org.wso2.carbon.apimgt.throttle.policy.deployer.dto.ApiPolicy in project carbon-apimgt by wso2.

the class PolicyUtil method deployPolicy.

/**
 * Deploy the given throttle policy in the Traffic Manager.
 *
 * @param policy      policy object
 * @param policyEvent policy event object which was triggered
 */
public static void deployPolicy(Policy policy, PolicyEvent policyEvent) {
    EventProcessorService eventProcessorService = ServiceReferenceHolder.getInstance().getEventProcessorService();
    ThrottlePolicyTemplateBuilder policyTemplateBuilder = new ThrottlePolicyTemplateBuilder();
    Map<String, String> policiesToDeploy = new HashMap<>();
    List<String> policiesToUndeploy = new ArrayList<>();
    try {
        PrivilegedCarbonContext.startTenantFlow();
        PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(APIConstants.SUPER_TENANT_DOMAIN, true);
        String policyFile;
        String policyString;
        if (Policy.PolicyType.SUBSCRIPTION.equals(policy.getType()) && policy instanceof SubscriptionPolicy) {
            // Add Subscription policy
            policyFile = String.join(APIConstants.DELEM_UNDERSCORE, policy.getTenantDomain(), PolicyConstants.POLICY_LEVEL_SUB, policy.getName());
            policyString = policyTemplateBuilder.getThrottlePolicyForSubscriptionLevel((SubscriptionPolicy) policy);
            policiesToDeploy.put(policyFile, policyString);
        } else if (Policy.PolicyType.APPLICATION.equals(policy.getType()) && policy instanceof ApplicationPolicy) {
            // Add Application policy
            policyFile = String.join(APIConstants.DELEM_UNDERSCORE, policy.getTenantDomain(), PolicyConstants.POLICY_LEVEL_APP, policy.getName());
            policyString = policyTemplateBuilder.getThrottlePolicyForAppLevel((ApplicationPolicy) policy);
            policiesToDeploy.put(policyFile, policyString);
        } else if (Policy.PolicyType.API.equals(policy.getType()) && policy instanceof ApiPolicy) {
            // Add API policy
            policiesToDeploy = policyTemplateBuilder.getThrottlePolicyForAPILevel((ApiPolicy) policy);
            String defaultPolicy = policyTemplateBuilder.getThrottlePolicyForAPILevelDefault((ApiPolicy) policy);
            policyFile = String.join(APIConstants.DELEM_UNDERSCORE, policy.getTenantDomain(), PolicyConstants.POLICY_LEVEL_RESOURCE, policy.getName());
            String defaultPolicyName = policyFile + APIConstants.THROTTLE_POLICY_DEFAULT;
            policiesToDeploy.put(defaultPolicyName, defaultPolicy);
            if (policyEvent instanceof APIPolicyEvent) {
                List<Integer> deletedConditionGroupIds = ((APIPolicyEvent) policyEvent).getDeletedConditionGroupIds();
                // Undeploy removed condition groups
                if (deletedConditionGroupIds != null) {
                    for (int conditionGroupId : deletedConditionGroupIds) {
                        policiesToUndeploy.add(policyFile + APIConstants.THROTTLE_POLICY_CONDITION + conditionGroupId);
                    }
                }
            }
        } else if (Policy.PolicyType.GLOBAL.equals(policy.getType()) && policy instanceof GlobalPolicy) {
            // Add Global policy
            GlobalPolicy globalPolicy = (GlobalPolicy) policy;
            policyFile = String.join(APIConstants.DELEM_UNDERSCORE, PolicyConstants.POLICY_LEVEL_GLOBAL, policy.getName());
            policyString = policyTemplateBuilder.getThrottlePolicyForGlobalLevel(globalPolicy);
            policiesToDeploy.put(policyFile, policyString);
        }
        // Undeploy removed policies
        undeployPolicies(policiesToUndeploy);
        for (Map.Entry<String, String> pair : policiesToDeploy.entrySet()) {
            String policyPlanName = pair.getKey();
            String flowString = pair.getValue();
            String executionPlan = null;
            try {
                executionPlan = eventProcessorService.getActiveExecutionPlan(policyPlanName);
            } catch (ExecutionPlanConfigurationException e) {
                // Deploy new policies
                eventProcessorService.deployExecutionPlan(flowString);
            }
            if (executionPlan != null) {
                // Update existing policies
                eventProcessorService.editActiveExecutionPlan(flowString, policyPlanName);
            }
        }
    } catch (APITemplateException e) {
        log.error("Error in creating execution plan", e);
    } catch (ExecutionPlanConfigurationException | ExecutionPlanDependencyValidationException e) {
        log.error("Error in deploying execution plan", e);
    } finally {
        PrivilegedCarbonContext.endTenantFlow();
    }
}
Also used : HashMap(java.util.HashMap) GlobalPolicy(org.wso2.carbon.apimgt.throttle.policy.deployer.dto.GlobalPolicy) ArrayList(java.util.ArrayList) ApiPolicy(org.wso2.carbon.apimgt.throttle.policy.deployer.dto.ApiPolicy) ExecutionPlanConfigurationException(org.wso2.carbon.event.processor.core.exception.ExecutionPlanConfigurationException) EventProcessorService(org.wso2.carbon.event.processor.core.EventProcessorService) ExecutionPlanDependencyValidationException(org.wso2.carbon.event.processor.core.exception.ExecutionPlanDependencyValidationException) SubscriptionPolicy(org.wso2.carbon.apimgt.throttle.policy.deployer.dto.SubscriptionPolicy) APIPolicyEvent(org.wso2.carbon.apimgt.impl.notifier.events.APIPolicyEvent) ApplicationPolicy(org.wso2.carbon.apimgt.throttle.policy.deployer.dto.ApplicationPolicy) APITemplateException(org.wso2.carbon.apimgt.impl.template.APITemplateException) HashMap(java.util.HashMap) Map(java.util.Map)

Example 77 with ApiPolicy

use of org.wso2.carbon.apimgt.throttle.policy.deployer.dto.ApiPolicy in project carbon-apimgt by wso2.

the class PolicyUtilTest method testUpdatePolicy_APIType.

@Test
public void testUpdatePolicy_APIType() throws ExecutionPlanConfigurationException, ExecutionPlanDependencyValidationException {
    ApiPolicy policy = TestUtil.getPolicyAPILevel();
    List<Integer> deletedConditionGroupIds = new ArrayList<>();
    deletedConditionGroupIds.add(5);
    deletedConditionGroupIds.add(6);
    APIPolicyEvent policyEvent = new APIPolicyEvent(UUID.randomUUID().toString(), System.currentTimeMillis(), APIConstants.EventType.POLICY_UPDATE.name(), -1234, policy.getTenantDomain(), policy.getId(), policy.getName(), policy.getDefaultLimit().getQuotaType(), null, deletedConditionGroupIds);
    ExecutionPlanConfigurationException executionPlanConfigurationException = Mockito.mock(ExecutionPlanConfigurationException.class);
    Mockito.when(eventProcessorService.getActiveExecutionPlan(policy.getTenantDomain() + "_" + PolicyConstants.POLICY_LEVEL_RESOURCE + "_" + policy.getName() + "_condition_1")).thenThrow(executionPlanConfigurationException);
    Mockito.when(eventProcessorService.getActiveExecutionPlan(policy.getTenantDomain() + "_" + PolicyConstants.POLICY_LEVEL_RESOURCE + "_" + policy.getName() + "_condition_5")).thenReturn("EXECUTION_PLAN");
    Mockito.when(eventProcessorService.getActiveExecutionPlan(policy.getTenantDomain() + "_" + PolicyConstants.POLICY_LEVEL_RESOURCE + "_" + policy.getName() + "_condition_6")).thenReturn("EXECUTION_PLAN");
    Mockito.when(eventProcessorService.getActiveExecutionPlan(policy.getTenantDomain() + "_" + PolicyConstants.POLICY_LEVEL_RESOURCE + "_" + policy.getName() + "_default")).thenReturn("EXECUTION_PLAN");
    PolicyUtil.deployPolicy(policy, policyEvent);
    Mockito.verify(eventProcessorService, Mockito.times(2)).undeployActiveExecutionPlan(Mockito.anyString());
    Mockito.verify(eventProcessorService, Mockito.times(1)).editActiveExecutionPlan(Mockito.anyString(), Mockito.anyString());
    Mockito.verify(eventProcessorService, Mockito.times(1)).deployExecutionPlan(Mockito.anyString());
}
Also used : APIPolicyEvent(org.wso2.carbon.apimgt.impl.notifier.events.APIPolicyEvent) ApiPolicy(org.wso2.carbon.apimgt.throttle.policy.deployer.dto.ApiPolicy) ArrayList(java.util.ArrayList) ExecutionPlanConfigurationException(org.wso2.carbon.event.processor.core.exception.ExecutionPlanConfigurationException) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 78 with ApiPolicy

use of org.wso2.carbon.apimgt.throttle.policy.deployer.dto.ApiPolicy in project carbon-apimgt by wso2.

the class PolicyRetriever method getApiPolicy.

/**
 * Get a API policy given the name.
 *
 * @param policyName   policy name
 * @param tenantDomain tenant domain
 * @return API policy
 * @throws ThrottlePolicyDeployerException if failure occurs
 */
public ApiPolicy getApiPolicy(String policyName, String tenantDomain) throws ThrottlePolicyDeployerException {
    String path = APIConstants.SubscriptionValidationResources.API_POLICIES + "?policyName=" + policyName;
    ApiPolicyList apiPolicyList = getPolicies(path, tenantDomain, ApiPolicyList.class);
    if (apiPolicyList.getList() != null && !apiPolicyList.getList().isEmpty()) {
        return apiPolicyList.getList().get(0);
    }
    return null;
}
Also used : ApiPolicyList(org.wso2.carbon.apimgt.throttle.policy.deployer.dto.ApiPolicyList)

Example 79 with ApiPolicy

use of org.wso2.carbon.apimgt.throttle.policy.deployer.dto.ApiPolicy in project carbon-apimgt by wso2.

the class APIProviderImpl method addPolicy.

/**
 * Deploy policy to global CEP and persist the policy object
 *
 * @param policy policy object
 */
public void addPolicy(Policy policy) throws APIManagementException {
    if (policy instanceof APIPolicy) {
        APIPolicy apiPolicy = (APIPolicy) policy;
        // Check if there's a policy exists before adding the new policy
        Policy existingPolicy = getAPIPolicy(userNameWithoutChange, apiPolicy.getPolicyName());
        if (existingPolicy != null) {
            handleException("Advanced Policy with name " + apiPolicy.getPolicyName() + " already exists");
        }
        apiPolicy.setUserLevel(PolicyConstants.ACROSS_ALL);
        apiPolicy = apiMgtDAO.addAPIPolicy(apiPolicy);
        List<Integer> addedConditionGroupIds = new ArrayList<>();
        for (Pipeline pipeline : apiPolicy.getPipelines()) {
            addedConditionGroupIds.add(pipeline.getId());
        }
        APIPolicyEvent apiPolicyEvent = new APIPolicyEvent(UUID.randomUUID().toString(), System.currentTimeMillis(), APIConstants.EventType.POLICY_CREATE.name(), tenantId, apiPolicy.getTenantDomain(), apiPolicy.getPolicyId(), apiPolicy.getPolicyName(), apiPolicy.getDefaultQuotaPolicy().getType(), addedConditionGroupIds, null);
        APIUtil.sendNotification(apiPolicyEvent, APIConstants.NotifierType.POLICY.name());
    } else if (policy instanceof ApplicationPolicy) {
        ApplicationPolicy appPolicy = (ApplicationPolicy) policy;
        // Check if there's a policy exists before adding the new policy
        Policy existingPolicy = getApplicationPolicy(userNameWithoutChange, appPolicy.getPolicyName());
        if (existingPolicy != null) {
            handleException("Application Policy with name " + appPolicy.getPolicyName() + " already exists");
        }
        apiMgtDAO.addApplicationPolicy(appPolicy);
        // policy id is not set. retrieving policy to get the id.
        ApplicationPolicy retrievedPolicy = apiMgtDAO.getApplicationPolicy(appPolicy.getPolicyName(), tenantId);
        ApplicationPolicyEvent applicationPolicyEvent = new ApplicationPolicyEvent(UUID.randomUUID().toString(), System.currentTimeMillis(), APIConstants.EventType.POLICY_CREATE.name(), tenantId, appPolicy.getTenantDomain(), retrievedPolicy.getPolicyId(), appPolicy.getPolicyName(), appPolicy.getDefaultQuotaPolicy().getType());
        APIUtil.sendNotification(applicationPolicyEvent, APIConstants.NotifierType.POLICY.name());
    } else if (policy instanceof SubscriptionPolicy) {
        SubscriptionPolicy subPolicy = (SubscriptionPolicy) policy;
        // Check if there's a policy exists before adding the new policy
        Policy existingPolicy = getSubscriptionPolicy(userNameWithoutChange, subPolicy.getPolicyName());
        if (existingPolicy != null) {
            handleException("Subscription Policy with name " + subPolicy.getPolicyName() + " already exists");
        }
        apiMgtDAO.addSubscriptionPolicy(subPolicy);
        String monetizationPlan = subPolicy.getMonetizationPlan();
        Map<String, String> monetizationPlanProperties = subPolicy.getMonetizationPlanProperties();
        if (StringUtils.isNotBlank(monetizationPlan) && MapUtils.isNotEmpty(monetizationPlanProperties)) {
            createMonetizationPlan(subPolicy);
        }
        // policy id is not set. retrieving policy to get the id.
        SubscriptionPolicy retrievedPolicy = apiMgtDAO.getSubscriptionPolicy(subPolicy.getPolicyName(), tenantId);
        SubscriptionPolicyEvent subscriptionPolicyEvent = new SubscriptionPolicyEvent(UUID.randomUUID().toString(), System.currentTimeMillis(), APIConstants.EventType.POLICY_CREATE.name(), tenantId, subPolicy.getTenantDomain(), retrievedPolicy.getPolicyId(), subPolicy.getPolicyName(), subPolicy.getDefaultQuotaPolicy().getType(), subPolicy.getRateLimitCount(), subPolicy.getRateLimitTimeUnit(), subPolicy.isStopOnQuotaReach(), subPolicy.getGraphQLMaxDepth(), subPolicy.getGraphQLMaxComplexity(), subPolicy.getSubscriberCount());
        APIUtil.sendNotification(subscriptionPolicyEvent, APIConstants.NotifierType.POLICY.name());
    } else if (policy instanceof GlobalPolicy) {
        GlobalPolicy globalPolicy = (GlobalPolicy) policy;
        // checking if policy already exist
        Policy existingPolicy = getGlobalPolicy(globalPolicy.getPolicyName());
        if (existingPolicy != null) {
            throw new APIManagementException("Policy name already exists");
        }
        apiMgtDAO.addGlobalPolicy(globalPolicy);
        publishKeyTemplateEvent(globalPolicy.getKeyTemplate(), "add");
        GlobalPolicy retrievedPolicy = apiMgtDAO.getGlobalPolicy(globalPolicy.getPolicyName());
        GlobalPolicyEvent globalPolicyEvent = new GlobalPolicyEvent(UUID.randomUUID().toString(), System.currentTimeMillis(), APIConstants.EventType.POLICY_CREATE.name(), tenantId, globalPolicy.getTenantDomain(), retrievedPolicy.getPolicyId(), globalPolicy.getPolicyName());
        APIUtil.sendNotification(globalPolicyEvent, APIConstants.NotifierType.POLICY.name());
    } else {
        String msg = "Policy type " + policy.getClass().getName() + " is not supported";
        log.error(msg);
        throw new UnsupportedPolicyTypeException(msg);
    }
}
Also used : ApplicationPolicy(org.wso2.carbon.apimgt.api.model.policy.ApplicationPolicy) APIPolicy(org.wso2.carbon.apimgt.api.model.policy.APIPolicy) GlobalPolicy(org.wso2.carbon.apimgt.api.model.policy.GlobalPolicy) OperationPolicy(org.wso2.carbon.apimgt.api.model.OperationPolicy) SubscriptionPolicy(org.wso2.carbon.apimgt.api.model.policy.SubscriptionPolicy) Policy(org.wso2.carbon.apimgt.api.model.policy.Policy) GlobalPolicy(org.wso2.carbon.apimgt.api.model.policy.GlobalPolicy) UnsupportedPolicyTypeException(org.wso2.carbon.apimgt.api.UnsupportedPolicyTypeException) ArrayList(java.util.ArrayList) ApplicationPolicyEvent(org.wso2.carbon.apimgt.impl.notifier.events.ApplicationPolicyEvent) SubscriptionPolicyEvent(org.wso2.carbon.apimgt.impl.notifier.events.SubscriptionPolicyEvent) Pipeline(org.wso2.carbon.apimgt.api.model.policy.Pipeline) APIManagementException(org.wso2.carbon.apimgt.api.APIManagementException) APIPolicyEvent(org.wso2.carbon.apimgt.impl.notifier.events.APIPolicyEvent) SubscriptionPolicy(org.wso2.carbon.apimgt.api.model.policy.SubscriptionPolicy) ApplicationPolicy(org.wso2.carbon.apimgt.api.model.policy.ApplicationPolicy) APIPolicy(org.wso2.carbon.apimgt.api.model.policy.APIPolicy) GlobalPolicyEvent(org.wso2.carbon.apimgt.impl.notifier.events.GlobalPolicyEvent)

Example 80 with ApiPolicy

use of org.wso2.carbon.apimgt.throttle.policy.deployer.dto.ApiPolicy in project carbon-apimgt by wso2.

the class APIProviderImpl method updatePolicy.

public void updatePolicy(Policy policy) throws APIManagementException {
    String oldKeyTemplate = null;
    String newKeyTemplate = null;
    if (policy instanceof APIPolicy) {
        APIPolicy apiPolicy = (APIPolicy) policy;
        apiPolicy.setUserLevel(PolicyConstants.ACROSS_ALL);
        // TODO this has done due to update policy method not deleting the second level entries when delete on cascade
        // TODO Need to fix appropriately
        List<Pipeline> pipelineList = apiPolicy.getPipelines();
        if (pipelineList != null && pipelineList.size() != 0) {
            Iterator<Pipeline> pipelineIterator = pipelineList.iterator();
            while (pipelineIterator.hasNext()) {
                Pipeline pipeline = pipelineIterator.next();
                if (!pipeline.isEnabled()) {
                    pipelineIterator.remove();
                } else {
                    if (pipeline.getConditions() != null && pipeline.getConditions().size() != 0) {
                        Iterator<Condition> conditionIterator = pipeline.getConditions().iterator();
                        while (conditionIterator.hasNext()) {
                            Condition condition = conditionIterator.next();
                            if (JavaUtils.isFalseExplicitly(condition.getConditionEnabled())) {
                                conditionIterator.remove();
                            }
                        }
                    } else {
                        pipelineIterator.remove();
                    }
                }
            }
        }
        APIPolicy existingPolicy = apiMgtDAO.getAPIPolicy(policy.getPolicyName(), policy.getTenantId());
        apiPolicy = apiMgtDAO.updateAPIPolicy(apiPolicy);
        // TODO rename level to  resource or appropriate name
        APIManagerConfiguration config = getAPIManagerConfiguration();
        if (log.isDebugEnabled()) {
            log.debug("Calling invalidation cache for API Policy for tenant ");
        }
        String policyContext = APIConstants.POLICY_CACHE_CONTEXT + "/t/" + apiPolicy.getTenantDomain() + "/";
        invalidateResourceCache(policyContext, null, Collections.EMPTY_SET);
        List<Integer> addedConditionGroupIds = new ArrayList<>();
        List<Integer> deletedConditionGroupIds = new ArrayList<>();
        for (Pipeline pipeline : existingPolicy.getPipelines()) {
            deletedConditionGroupIds.add(pipeline.getId());
        }
        for (Pipeline pipeline : apiPolicy.getPipelines()) {
            addedConditionGroupIds.add(pipeline.getId());
        }
        APIPolicyEvent apiPolicyEvent = new APIPolicyEvent(UUID.randomUUID().toString(), System.currentTimeMillis(), APIConstants.EventType.POLICY_UPDATE.name(), tenantId, apiPolicy.getTenantDomain(), apiPolicy.getPolicyId(), apiPolicy.getPolicyName(), apiPolicy.getDefaultQuotaPolicy().getType(), addedConditionGroupIds, deletedConditionGroupIds);
        APIUtil.sendNotification(apiPolicyEvent, APIConstants.NotifierType.POLICY.name());
    } else if (policy instanceof ApplicationPolicy) {
        ApplicationPolicy appPolicy = (ApplicationPolicy) policy;
        apiMgtDAO.updateApplicationPolicy(appPolicy);
        // policy id is not set. retrieving policy to get the id.
        ApplicationPolicy retrievedPolicy = apiMgtDAO.getApplicationPolicy(appPolicy.getPolicyName(), tenantId);
        ApplicationPolicyEvent applicationPolicyEvent = new ApplicationPolicyEvent(UUID.randomUUID().toString(), System.currentTimeMillis(), APIConstants.EventType.POLICY_UPDATE.name(), tenantId, appPolicy.getTenantDomain(), retrievedPolicy.getPolicyId(), appPolicy.getPolicyName(), appPolicy.getDefaultQuotaPolicy().getType());
        APIUtil.sendNotification(applicationPolicyEvent, APIConstants.NotifierType.POLICY.name());
    } else if (policy instanceof SubscriptionPolicy) {
        SubscriptionPolicy subPolicy = (SubscriptionPolicy) policy;
        apiMgtDAO.updateSubscriptionPolicy(subPolicy);
        String monetizationPlan = subPolicy.getMonetizationPlan();
        Map<String, String> monetizationPlanProperties = subPolicy.getMonetizationPlanProperties();
        // call the monetization extension point to create plans (if any)
        if (StringUtils.isNotBlank(monetizationPlan) && MapUtils.isNotEmpty(monetizationPlanProperties)) {
            updateMonetizationPlan(subPolicy);
        }
        // policy id is not set. retrieving policy to get the id.
        SubscriptionPolicy retrievedPolicy = apiMgtDAO.getSubscriptionPolicy(subPolicy.getPolicyName(), tenantId);
        SubscriptionPolicyEvent subscriptionPolicyEvent = new SubscriptionPolicyEvent(UUID.randomUUID().toString(), System.currentTimeMillis(), APIConstants.EventType.POLICY_UPDATE.name(), tenantId, subPolicy.getTenantDomain(), retrievedPolicy.getPolicyId(), subPolicy.getPolicyName(), subPolicy.getDefaultQuotaPolicy().getType(), subPolicy.getRateLimitCount(), subPolicy.getRateLimitTimeUnit(), subPolicy.isStopOnQuotaReach(), subPolicy.getGraphQLMaxDepth(), subPolicy.getGraphQLMaxComplexity(), subPolicy.getSubscriberCount());
        APIUtil.sendNotification(subscriptionPolicyEvent, APIConstants.NotifierType.POLICY.name());
    } else if (policy instanceof GlobalPolicy) {
        GlobalPolicy globalPolicy = (GlobalPolicy) policy;
        // getting key templates before updating database
        GlobalPolicy oldGlobalPolicy = apiMgtDAO.getGlobalPolicy(policy.getPolicyName());
        oldKeyTemplate = oldGlobalPolicy.getKeyTemplate();
        newKeyTemplate = globalPolicy.getKeyTemplate();
        apiMgtDAO.updateGlobalPolicy(globalPolicy);
        GlobalPolicy retrievedPolicy = apiMgtDAO.getGlobalPolicy(globalPolicy.getPolicyName());
        GlobalPolicyEvent globalPolicyEvent = new GlobalPolicyEvent(UUID.randomUUID().toString(), System.currentTimeMillis(), APIConstants.EventType.POLICY_UPDATE.name(), tenantId, globalPolicy.getTenantDomain(), retrievedPolicy.getPolicyId(), globalPolicy.getPolicyName());
        APIUtil.sendNotification(globalPolicyEvent, APIConstants.NotifierType.POLICY.name());
    } else {
        String msg = "Policy type " + policy.getClass().getName() + " is not supported";
        log.error(msg);
        throw new UnsupportedPolicyTypeException(msg);
    }
    // publishing keytemplate after update
    if (oldKeyTemplate != null && newKeyTemplate != null) {
        publishKeyTemplateEvent(oldKeyTemplate, "remove");
        publishKeyTemplateEvent(newKeyTemplate, "add");
    }
}
Also used : Condition(org.wso2.carbon.apimgt.api.model.policy.Condition) GlobalPolicy(org.wso2.carbon.apimgt.api.model.policy.GlobalPolicy) UnsupportedPolicyTypeException(org.wso2.carbon.apimgt.api.UnsupportedPolicyTypeException) ArrayList(java.util.ArrayList) ApplicationPolicyEvent(org.wso2.carbon.apimgt.impl.notifier.events.ApplicationPolicyEvent) SubscriptionPolicyEvent(org.wso2.carbon.apimgt.impl.notifier.events.SubscriptionPolicyEvent) Pipeline(org.wso2.carbon.apimgt.api.model.policy.Pipeline) APIPolicyEvent(org.wso2.carbon.apimgt.impl.notifier.events.APIPolicyEvent) SubscriptionPolicy(org.wso2.carbon.apimgt.api.model.policy.SubscriptionPolicy) ApplicationPolicy(org.wso2.carbon.apimgt.api.model.policy.ApplicationPolicy) APIPolicy(org.wso2.carbon.apimgt.api.model.policy.APIPolicy) GlobalPolicyEvent(org.wso2.carbon.apimgt.impl.notifier.events.GlobalPolicyEvent)

Aggregations

APIPolicy (org.wso2.carbon.apimgt.core.models.policy.APIPolicy)87 Test (org.testng.annotations.Test)44 SubscriptionPolicy (org.wso2.carbon.apimgt.core.models.policy.SubscriptionPolicy)40 PolicyDAO (org.wso2.carbon.apimgt.core.dao.PolicyDAO)39 ArrayList (java.util.ArrayList)38 API (org.wso2.carbon.apimgt.core.models.API)33 APIPolicy (org.wso2.carbon.apimgt.api.model.policy.APIPolicy)30 APIGateway (org.wso2.carbon.apimgt.core.api.APIGateway)27 HashMap (java.util.HashMap)25 APILifecycleManager (org.wso2.carbon.apimgt.core.api.APILifecycleManager)22 GatewaySourceGenerator (org.wso2.carbon.apimgt.core.api.GatewaySourceGenerator)22 ApiDAO (org.wso2.carbon.apimgt.core.dao.ApiDAO)22 APIBuilder (org.wso2.carbon.apimgt.core.models.API.APIBuilder)21 Policy (org.wso2.carbon.apimgt.core.models.policy.Policy)20 HashSet (java.util.HashSet)19 Test (org.junit.Test)19 QuotaPolicy (org.wso2.carbon.apimgt.core.models.policy.QuotaPolicy)19 ApplicationPolicy (org.wso2.carbon.apimgt.core.models.policy.ApplicationPolicy)18 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)17 PreparedStatement (java.sql.PreparedStatement)15