Search in sources :

Example 21 with LifecycleState

use of org.wso2.carbon.lcm.core.impl.LifecycleState in project carbon-apimgt by wso2.

the class APIProviderImpl method getAPILifeCycleData.

@Override
public /*
    * This method returns the lifecycle data for an API including current state,next states.
    *
    * @param apiId APIIdentifier
    * @return Map<String,Object> a map with lifecycle data
    */
Map<String, Object> getAPILifeCycleData(APIIdentifier apiId) throws APIManagementException {
    String path = APIUtil.getAPIPath(apiId);
    Map<String, Object> lcData = new HashMap<String, Object>();
    String providerTenantMode = apiId.getProviderName();
    boolean isTenantFlowStarted = false;
    try {
        String tenantDomain = MultitenantUtils.getTenantDomain(APIUtil.replaceEmailDomainBack(providerTenantMode));
        if (tenantDomain != null && !MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equals(tenantDomain)) {
            isTenantFlowStarted = true;
            PrivilegedCarbonContext.startTenantFlow();
            PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(tenantDomain, true);
        }
        Resource apiSourceArtifact = registry.get(path);
        GenericArtifactManager artifactManager = APIUtil.getArtifactManager(registry, APIConstants.API_KEY);
        if (artifactManager == null) {
            String errorMessage = "Failed to retrieve artifact manager when getting lifecycle data for API " + apiId;
            log.error(errorMessage);
            throw new APIManagementException(errorMessage);
        }
        GenericArtifact artifact = artifactManager.getGenericArtifact(apiSourceArtifact.getUUID());
        // Get all the actions corresponding to current state of the api artifact
        String[] actions = artifact.getAllLifecycleActions(APIConstants.API_LIFE_CYCLE);
        // Put next states into map
        lcData.put(APIConstants.LC_NEXT_STATES, actions);
        String lifeCycleState = artifact.getLifecycleState();
        lcData.put(APIConstants.LC_STATUS, lifeCycleState);
        LifecycleBean bean;
        bean = LifecycleBeanPopulator.getLifecycleBean(path, (UserRegistry) registry, configRegistry);
        if (bean != null) {
            ArrayList<CheckListItem> checkListItems = new ArrayList<CheckListItem>();
            ArrayList<String> permissionList = new ArrayList<String>();
            // Get lc properties
            Property[] lifecycleProps = bean.getLifecycleProperties();
            // Get roles of the current session holder
            String[] roleNames = bean.getRolesOfUser();
            for (Property property : lifecycleProps) {
                String propName = property.getKey();
                String[] propValues = property.getValues();
                // Check for permission properties if any exists
                if (propValues != null && propValues.length != 0) {
                    if (propName.startsWith(APIConstants.LC_PROPERTY_CHECKLIST_PREFIX) && propName.endsWith(APIConstants.LC_PROPERTY_PERMISSION_SUFFIX) && propName.contains(APIConstants.API_LIFE_CYCLE)) {
                        for (String role : roleNames) {
                            for (String propValue : propValues) {
                                String key = propName.replace(APIConstants.LC_PROPERTY_CHECKLIST_PREFIX, "").replace(APIConstants.LC_PROPERTY_PERMISSION_SUFFIX, "");
                                if (propValue.equals(role)) {
                                    permissionList.add(key);
                                } else if (propValue.startsWith(APIConstants.LC_PROPERTY_CHECKLIST_PREFIX) && propValue.endsWith(APIConstants.LC_PROPERTY_PERMISSION_SUFFIX)) {
                                    permissionList.add(key);
                                }
                            }
                        }
                    }
                }
            }
            // Check for lifecycle checklist item properties defined
            for (Property property : lifecycleProps) {
                String propName = property.getKey();
                String[] propValues = property.getValues();
                if (propValues != null && propValues.length != 0) {
                    CheckListItem checkListItem = new CheckListItem();
                    checkListItem.setVisible("false");
                    if (propName.startsWith(APIConstants.LC_PROPERTY_CHECKLIST_PREFIX) && propName.endsWith(APIConstants.LC_PROPERTY_ITEM_SUFFIX) && propName.contains(APIConstants.API_LIFE_CYCLE)) {
                        if (propValues.length > 2) {
                            for (String param : propValues) {
                                if (param.startsWith(APIConstants.LC_STATUS)) {
                                    checkListItem.setLifeCycleStatus(param.substring(7));
                                } else if (param.startsWith(APIConstants.LC_CHECK_ITEM_NAME)) {
                                    checkListItem.setName(param.substring(5));
                                } else if (param.startsWith(APIConstants.LC_CHECK_ITEM_VALUE)) {
                                    checkListItem.setValue(param.substring(6));
                                } else if (param.startsWith(APIConstants.LC_CHECK_ITEM_ORDER)) {
                                    checkListItem.setOrder(param.substring(6));
                                }
                            }
                        }
                        String key = propName.replace(APIConstants.LC_PROPERTY_CHECKLIST_PREFIX, "").replace(APIConstants.LC_PROPERTY_ITEM_SUFFIX, "");
                        if (permissionList.contains(key)) {
                            // Set visible to true if the checklist item permits
                            checkListItem.setVisible("true");
                        }
                    }
                    if (checkListItem.matchLifeCycleStatus(lifeCycleState)) {
                        checkListItems.add(checkListItem);
                    }
                }
            }
            lcData.put("items", checkListItems);
        }
    } catch (Exception e) {
        handleException(e.getMessage(), e);
    } finally {
        if (isTenantFlowStarted) {
            PrivilegedCarbonContext.endTenantFlow();
        }
    }
    return lcData;
}
Also used : GenericArtifact(org.wso2.carbon.governance.api.generic.dataobjects.GenericArtifact) GenericArtifactManager(org.wso2.carbon.governance.api.generic.GenericArtifactManager) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) CheckListItem(org.wso2.carbon.governance.custom.lifecycles.checklist.util.CheckListItem) Resource(org.wso2.carbon.registry.core.Resource) APIProductResource(org.wso2.carbon.apimgt.api.model.APIProductResource) APIResource(org.wso2.carbon.apimgt.api.doc.model.APIResource) ArrayList(java.util.ArrayList) UserRegistry(org.wso2.carbon.registry.core.session.UserRegistry) APIPersistenceException(org.wso2.carbon.apimgt.persistence.exceptions.APIPersistenceException) XMLStreamException(javax.xml.stream.XMLStreamException) GraphQLPersistenceException(org.wso2.carbon.apimgt.persistence.exceptions.GraphQLPersistenceException) APIImportExportException(org.wso2.carbon.apimgt.impl.importexport.APIImportExportException) IOException(java.io.IOException) MediationPolicyPersistenceException(org.wso2.carbon.apimgt.persistence.exceptions.MediationPolicyPersistenceException) APIManagementException(org.wso2.carbon.apimgt.api.APIManagementException) ArtifactSynchronizerException(org.wso2.carbon.apimgt.impl.gatewayartifactsynchronizer.exception.ArtifactSynchronizerException) WSDLPersistenceException(org.wso2.carbon.apimgt.persistence.exceptions.WSDLPersistenceException) UserStoreException(org.wso2.carbon.user.api.UserStoreException) GovernanceException(org.wso2.carbon.governance.api.exception.GovernanceException) DocumentationPersistenceException(org.wso2.carbon.apimgt.persistence.exceptions.DocumentationPersistenceException) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) APIMgtResourceNotFoundException(org.wso2.carbon.apimgt.api.APIMgtResourceNotFoundException) RegistryException(org.wso2.carbon.registry.core.exceptions.RegistryException) PersistenceException(org.wso2.carbon.apimgt.persistence.exceptions.PersistenceException) UnsupportedPolicyTypeException(org.wso2.carbon.apimgt.api.UnsupportedPolicyTypeException) FaultGatewaysException(org.wso2.carbon.apimgt.api.FaultGatewaysException) NotificationException(org.wso2.carbon.apimgt.impl.notification.exception.NotificationException) APIMgtResourceAlreadyExistsException(org.wso2.carbon.apimgt.api.APIMgtResourceAlreadyExistsException) MonetizationException(org.wso2.carbon.apimgt.api.MonetizationException) ThumbnailPersistenceException(org.wso2.carbon.apimgt.persistence.exceptions.ThumbnailPersistenceException) OASPersistenceException(org.wso2.carbon.apimgt.persistence.exceptions.OASPersistenceException) WorkflowException(org.wso2.carbon.apimgt.impl.workflow.WorkflowException) AsyncSpecPersistenceException(org.wso2.carbon.apimgt.persistence.exceptions.AsyncSpecPersistenceException) ParseException(org.json.simple.parser.ParseException) MalformedURLException(java.net.MalformedURLException) OMException(org.apache.axiom.om.OMException) APIManagementException(org.wso2.carbon.apimgt.api.APIManagementException) LifecycleBean(org.wso2.carbon.governance.custom.lifecycles.checklist.beans.LifecycleBean) JSONObject(org.json.simple.JSONObject) Property(org.wso2.carbon.governance.custom.lifecycles.checklist.util.Property)

Example 22 with LifecycleState

use of org.wso2.carbon.lcm.core.impl.LifecycleState in project carbon-apimgt by wso2.

the class APIPublisherImplTestCase method testAddAlreadyAddedEndpointToApi.

@Test(description = "Test add api with Api Specific Endpoint", expectedExceptions = { APIManagementException.class })
public void testAddAlreadyAddedEndpointToApi() throws APIManagementException, LifecycleException {
    /**
     * this test method verify the API Add with correct API object get invoked correctly
     */
    ApiDAO apiDAO = Mockito.mock(ApiDAO.class);
    LabelDAO labelDao = Mockito.mock(LabelDAO.class);
    GatewaySourceGenerator gatewaySourceGenerator = Mockito.mock(GatewaySourceGenerator.class);
    APILifecycleManager apiLifecycleManager = Mockito.mock(APILifecycleManager.class);
    Endpoint globalEndpoint = new Endpoint.Builder().id(UUID.randomUUID().toString()).name("testEndpoint").applicableLevel(APIMgtConstants.GLOBAL_ENDPOINT).build();
    Endpoint apiEndpoint = new Endpoint.Builder().id(UUID.randomUUID().toString()).name("apiEndpoint").applicableLevel(APIMgtConstants.API_SPECIFIC_ENDPOINT).build();
    Map<String, Endpoint> endpointMap = new HashMap();
    endpointMap.put(APIMgtConstants.PRODUCTION_ENDPOINT, globalEndpoint);
    endpointMap.put(APIMgtConstants.SANDBOX_ENDPOINT, apiEndpoint);
    API.APIBuilder apiBuilder = SampleTestObjectCreator.createDefaultAPI().endpoint(endpointMap);
    Mockito.when(apiLifecycleManager.addLifecycle(APIMgtConstants.API_LIFECYCLE, USER)).thenReturn(new LifecycleState());
    APIGateway gateway = Mockito.mock(APIGateway.class);
    APIPublisherImpl apiPublisher = getApiPublisherImpl(null, apiDAO, null, null, null, apiLifecycleManager, labelDao, null, null, null, gatewaySourceGenerator, gateway);
    Mockito.when(apiDAO.getEndpoint(globalEndpoint.getId())).thenReturn(globalEndpoint);
    Mockito.when(apiDAO.getEndpointByName(apiEndpoint.getName())).thenReturn(apiEndpoint);
    Mockito.when(apiDAO.isAPINameExists(apiBuilder.getName(), USER)).thenReturn(false);
    apiPublisher.addAPI(apiBuilder);
    Mockito.verify(apiDAO, Mockito.times(1)).addAPI(apiBuilder.build());
    Mockito.verify(apiLifecycleManager, Mockito.times(1)).addLifecycle(APIMgtConstants.API_LIFECYCLE, USER);
    Mockito.verify(apiDAO, Mockito.times(1)).getEndpointByName(apiEndpoint.getName());
    Mockito.verify(apiDAO, Mockito.times(1)).isAPINameExists(apiBuilder.getName(), USER);
}
Also used : HashMap(java.util.HashMap) APIBuilder(org.wso2.carbon.apimgt.core.models.API.APIBuilder) WorkflowExtensionsConfigBuilder(org.wso2.carbon.apimgt.core.workflow.WorkflowExtensionsConfigBuilder) APIBuilder(org.wso2.carbon.apimgt.core.models.API.APIBuilder) LifecycleState(org.wso2.carbon.lcm.core.impl.LifecycleState) LabelDAO(org.wso2.carbon.apimgt.core.dao.LabelDAO) GatewaySourceGenerator(org.wso2.carbon.apimgt.core.api.GatewaySourceGenerator) APILifecycleManager(org.wso2.carbon.apimgt.core.api.APILifecycleManager) Endpoint(org.wso2.carbon.apimgt.core.models.Endpoint) API(org.wso2.carbon.apimgt.core.models.API) APIGateway(org.wso2.carbon.apimgt.core.api.APIGateway) ApiDAO(org.wso2.carbon.apimgt.core.dao.ApiDAO) Test(org.testng.annotations.Test)

Example 23 with LifecycleState

use of org.wso2.carbon.lcm.core.impl.LifecycleState in project carbon-apimgt by wso2.

the class APIStateChangeWorkflow method updateAPIStatusForWorkflowComplete.

private void updateAPIStatusForWorkflowComplete(String apiId, String status, String updatedBy, LocalDateTime time) throws APIManagementException {
    boolean requireReSubscriptions = false;
    boolean deprecateOlderVersion = false;
    try {
        API api = apiDAO.getAPI(apiId);
        API.APIBuilder apiBuilder = new API.APIBuilder(api);
        apiBuilder.lastUpdatedTime(time);
        apiBuilder.updatedBy(updatedBy);
        LifecycleState currentState = apiLifecycleManager.getLifecycleDataForState(apiBuilder.getLifecycleInstanceId(), apiBuilder.getLifeCycleStatus());
        apiBuilder.lifecycleState(currentState);
        if (APIMgtConstants.APILCWorkflowStatus.PENDING.toString().equals(api.getWorkflowStatus())) {
            apiBuilder.workflowStatus(APIMgtConstants.APILCWorkflowStatus.APPROVED.toString());
            apiDAO.updateAPIWorkflowStatus(apiId, APIMgtConstants.APILCWorkflowStatus.APPROVED);
        }
        List<CheckItemBean> list = currentState.getCheckItemBeanList();
        for (Iterator iterator = list.iterator(); iterator.hasNext(); ) {
            CheckItemBean checkItemBean = (CheckItemBean) iterator.next();
            if (APIMgtConstants.DEPRECATE_PREVIOUS_VERSIONS.equals(checkItemBean.getName())) {
                deprecateOlderVersion = checkItemBean.isValue();
            } else if (APIMgtConstants.REQUIRE_RE_SUBSCRIPTIONS.equals(checkItemBean.getName())) {
                requireReSubscriptions = checkItemBean.isValue();
            }
        }
        API originalAPI = apiBuilder.build();
        apiLifecycleManager.executeLifecycleEvent(api.getLifeCycleStatus(), status, apiBuilder.getLifecycleInstanceId(), updatedBy, originalAPI);
        if (deprecateOlderVersion) {
            if (StringUtils.isNotEmpty(api.getCopiedFromApiId())) {
                API oldAPI = apiDAO.getAPI(api.getCopiedFromApiId());
                if (oldAPI != null) {
                    API.APIBuilder previousAPI = new API.APIBuilder(oldAPI);
                    previousAPI.setLifecycleStateInfo(apiLifecycleManager.getLifecycleDataForState(previousAPI.getLifecycleInstanceId(), previousAPI.getLifeCycleStatus()));
                    if (APIUtils.validateTargetState(previousAPI.getLifecycleState(), APIStatus.DEPRECATED.getStatus())) {
                        apiLifecycleManager.executeLifecycleEvent(previousAPI.getLifeCycleStatus(), APIStatus.DEPRECATED.getStatus(), previousAPI.getLifecycleInstanceId(), updatedBy, previousAPI.build());
                    }
                }
            }
        }
        if (!requireReSubscriptions) {
            if (StringUtils.isNotEmpty(api.getCopiedFromApiId())) {
                List<Subscription> subscriptions = apiSubscriptionDAO.getAPISubscriptionsByAPI(api.getCopiedFromApiId());
                List<Subscription> subscriptionList = new ArrayList<>();
                for (Subscription subscription : subscriptions) {
                    if (api.getPolicies().contains(subscription.getPolicy())) {
                        if (!APIMgtConstants.SubscriptionStatus.ON_HOLD.equals(subscription.getStatus())) {
                            subscriptionList.add(new Subscription(UUID.randomUUID().toString(), subscription.getApplication(), subscription.getApi(), subscription.getPolicy()));
                        }
                    }
                    apiSubscriptionDAO.copySubscriptions(subscriptionList);
                }
            }
        }
        // publish API state change to gateway
        apiGateway.changeAPIState(originalAPI, status);
    } catch (APIMgtDAOException e) {
        String errorMsg = "Couldn't change the status of api ID " + apiId;
        log.error(errorMsg, e);
        throw new APIManagementException(errorMsg, e, e.getErrorHandler());
    } catch (LifecycleException e) {
        String errorMsg = "Couldn't change the status of api ID " + apiId;
        log.error(errorMsg, e);
        throw new APIManagementException(errorMsg, e, ExceptionCodes.APIMGT_LIFECYCLE_EXCEPTION);
    } catch (GatewayException e) {
        String message = "Error occurred while changing the state of api ID: " + apiId + " to " + status + "in gateway";
        log.error(message, e);
        throw new APIManagementException(message, ExceptionCodes.GATEWAY_EXCEPTION);
    }
}
Also used : APIMgtDAOException(org.wso2.carbon.apimgt.core.exception.APIMgtDAOException) LifecycleException(org.wso2.carbon.lcm.core.exception.LifecycleException) ArrayList(java.util.ArrayList) LifecycleState(org.wso2.carbon.lcm.core.impl.LifecycleState) APIManagementException(org.wso2.carbon.apimgt.core.exception.APIManagementException) GatewayException(org.wso2.carbon.apimgt.core.exception.GatewayException) ContainerBasedGatewayException(org.wso2.carbon.apimgt.core.exception.ContainerBasedGatewayException) CheckItemBean(org.wso2.carbon.lcm.core.beans.CheckItemBean) Iterator(java.util.Iterator) API(org.wso2.carbon.apimgt.core.models.API) Subscription(org.wso2.carbon.apimgt.core.models.Subscription)

Example 24 with LifecycleState

use of org.wso2.carbon.lcm.core.impl.LifecycleState in project carbon-apimgt by wso2.

the class APIPublisherImplTestCase method testAddApiFromDefinitionFromUrlConnection.

@Test(description = "Add api from definition using httpUrlConnection")
public void testAddApiFromDefinitionFromUrlConnection() throws APIManagementException, LifecycleException, IOException {
    ApiDAO apiDAO = Mockito.mock(ApiDAO.class);
    LabelDAO labelDao = Mockito.mock(LabelDAO.class);
    APILifecycleManager apiLifecycleManager = Mockito.mock(APILifecycleManager.class);
    HttpURLConnection httpURLConnection = Mockito.mock(HttpURLConnection.class);
    Mockito.when(apiLifecycleManager.addLifecycle(APIMgtConstants.API_LIFECYCLE, USER)).thenReturn(new LifecycleState());
    GatewaySourceGenerator gatewaySourceGenerator = Mockito.mock(GatewaySourceGenerator.class);
    APIGateway gateway = Mockito.mock(APIGateway.class);
    PolicyDAO policyDAO = Mockito.mock(PolicyDAO.class);
    KeyManager keyManager = Mockito.mock(KeyManager.class);
    Mockito.when(policyDAO.getSimplifiedPolicyByLevelAndName(APIMgtAdminService.PolicyLevel.api, APIMgtConstants.DEFAULT_API_POLICY)).thenReturn(new APIPolicy(APIMgtConstants.DEFAULT_API_POLICY));
    APIPublisherImpl apiPublisher = getApiPublisherImpl(null, keyManager, apiDAO, null, null, policyDAO, apiLifecycleManager, labelDao, null, null, null, gatewaySourceGenerator, gateway);
    String def = SampleTestObjectCreator.apiDefinition;
    InputStream apiDefinition = new ByteArrayInputStream(def.getBytes());
    Mockito.when(httpURLConnection.getInputStream()).thenReturn(apiDefinition);
    Mockito.when(httpURLConnection.getResponseCode()).thenReturn(200);
    apiPublisher.addApiFromDefinition(httpURLConnection);
    Mockito.verify(apiLifecycleManager, Mockito.times(1)).addLifecycle(APIMgtConstants.API_LIFECYCLE, USER);
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) LifecycleState(org.wso2.carbon.lcm.core.impl.LifecycleState) LabelDAO(org.wso2.carbon.apimgt.core.dao.LabelDAO) GatewaySourceGenerator(org.wso2.carbon.apimgt.core.api.GatewaySourceGenerator) APILifecycleManager(org.wso2.carbon.apimgt.core.api.APILifecycleManager) HttpURLConnection(java.net.HttpURLConnection) ByteArrayInputStream(java.io.ByteArrayInputStream) APIGateway(org.wso2.carbon.apimgt.core.api.APIGateway) APIPolicy(org.wso2.carbon.apimgt.core.models.policy.APIPolicy) KeyManager(org.wso2.carbon.apimgt.core.api.KeyManager) ApiDAO(org.wso2.carbon.apimgt.core.dao.ApiDAO) PolicyDAO(org.wso2.carbon.apimgt.core.dao.PolicyDAO) Test(org.testng.annotations.Test)

Example 25 with LifecycleState

use of org.wso2.carbon.lcm.core.impl.LifecycleState in project carbon-apimgt by wso2.

the class APIPublisherImplTestCase method testUpdateAPIStatusException.

@Test(description = "Exception when updating api status", expectedExceptions = APIManagementException.class)
public void testUpdateAPIStatusException() throws APIManagementException, LifecycleException {
    ApiDAO apiDAO = Mockito.mock(ApiDAO.class);
    WorkflowDAO workflowDAO = Mockito.mock(WorkflowDAO.class);
    APILifecycleManager apiLifecycleManager = Mockito.mock(APILifecycleManager.class);
    APIGateway gateway = Mockito.mock(APIGateway.class);
    APIPublisherImpl apiPublisher = getApiPublisherImpl(apiLifecycleManager, apiDAO, workflowDAO, gateway);
    API api = SampleTestObjectCreator.createDefaultAPI().build();
    String uuid = api.getId();
    String lcState = api.getLifeCycleStatus();
    String lifecycleId = api.getLifecycleInstanceId();
    LifecycleState lifecycleState = SampleTestObjectCreator.getMockLifecycleStateObject(lifecycleId);
    Mockito.when(apiLifecycleManager.getLifecycleDataForState(lifecycleId, lcState)).thenReturn(lifecycleState);
    Mockito.when(apiDAO.getAPI(uuid)).thenReturn(api);
    API.APIBuilder apiBuilder = new API.APIBuilder(api);
    apiBuilder.lifecycleState(lifecycleState);
    apiBuilder.updatedBy(USER);
    api = apiBuilder.build();
    Mockito.when(apiLifecycleManager.executeLifecycleEvent(APIStatus.CREATED.getStatus(), APIStatus.PUBLISHED.getStatus(), lifecycleId, USER, api)).thenThrow(new LifecycleException("Couldn't change the status of api ID " + uuid));
    apiPublisher.updateAPIStatus(uuid, APIStatus.PUBLISHED.getStatus(), new HashMap<>());
}
Also used : WorkflowDAO(org.wso2.carbon.apimgt.core.dao.WorkflowDAO) APILifecycleManager(org.wso2.carbon.apimgt.core.api.APILifecycleManager) LifecycleException(org.wso2.carbon.lcm.core.exception.LifecycleException) APIBuilder(org.wso2.carbon.apimgt.core.models.API.APIBuilder) API(org.wso2.carbon.apimgt.core.models.API) LifecycleState(org.wso2.carbon.lcm.core.impl.LifecycleState) APIGateway(org.wso2.carbon.apimgt.core.api.APIGateway) APIBuilder(org.wso2.carbon.apimgt.core.models.API.APIBuilder) ApiDAO(org.wso2.carbon.apimgt.core.dao.ApiDAO) Test(org.testng.annotations.Test)

Aggregations

LifecycleState (org.wso2.carbon.lcm.core.impl.LifecycleState)34 APIGateway (org.wso2.carbon.apimgt.core.api.APIGateway)28 APILifecycleManager (org.wso2.carbon.apimgt.core.api.APILifecycleManager)28 Test (org.testng.annotations.Test)27 ApiDAO (org.wso2.carbon.apimgt.core.dao.ApiDAO)27 API (org.wso2.carbon.apimgt.core.models.API)27 APIBuilder (org.wso2.carbon.apimgt.core.models.API.APIBuilder)19 GatewaySourceGenerator (org.wso2.carbon.apimgt.core.api.GatewaySourceGenerator)16 LabelDAO (org.wso2.carbon.apimgt.core.dao.LabelDAO)15 HashMap (java.util.HashMap)14 Endpoint (org.wso2.carbon.apimgt.core.models.Endpoint)11 PolicyDAO (org.wso2.carbon.apimgt.core.dao.PolicyDAO)9 APIPolicy (org.wso2.carbon.apimgt.core.models.policy.APIPolicy)9 SubscriptionPolicy (org.wso2.carbon.apimgt.core.models.policy.SubscriptionPolicy)9 UriTemplate (org.wso2.carbon.apimgt.core.models.UriTemplate)7 WorkflowExtensionsConfigBuilder (org.wso2.carbon.apimgt.core.workflow.WorkflowExtensionsConfigBuilder)7 APIManagementException (org.wso2.carbon.apimgt.core.exception.APIManagementException)6 LifecycleException (org.wso2.carbon.lcm.core.exception.LifecycleException)5 HttpURLConnection (java.net.HttpURLConnection)4 ArrayList (java.util.ArrayList)4