@BeforeClass(alwaysRun = true) public void setEnvironment() throws Exception { super.init(userMode); // Load the back-end dummy API if (TestUserMode.SUPER_TENANT_ADMIN == userMode) { String gatewaySessionCookie = createSession(gatewayContextMgt); loadSynapseConfigurationFromClasspath( "artifacts" + File.separator + "AM" + File.separator + "synapseconfigs" + File.separator + "rest" + File.separator + "dummy_api.xml", gatewayContextMgt, gatewaySessionCookie); } publisherURLHttp = getPublisherURLHttp(); apiPublisher = new APIPublisherRestClient(publisherURLHttp); apiPublisher.login(user.getUserName(), user.getPassword()); String providerName = user.getUserName(); URL endpointUrl = new URL(getSuperTenantAPIInvocationURLHttp("response", "1.0.0")); ArrayList<APIResourceBean> resourceBeanList = new ArrayList<APIResourceBean>(); resourceBeanList.add( new APIResourceBean( APIMIntegrationConstants.HTTP_VERB_GET, APIMIntegrationConstants.RESOURCE_AUTH_TYPE_APPLICATION_AND_APPLICATION_USER, APIMIntegrationConstants.RESOURCE_TIER.UNLIMITED, "/*")); apiCreationRequestBean = new APICreationRequestBean( API_NAME, API_CONTEXT, API_VERSION, providerName, endpointUrl, resourceBeanList); apiCreationRequestBean.setTags(TAGS); apiCreationRequestBean.setDescription(DESCRIPTION); String publisherURLHttp = getPublisherURLHttp(); String storeURLHttp = getStoreURLHttp(); apiPublisherClientUser1 = new APIPublisherRestClient(publisherURLHttp); apiStoreClientUser1 = new APIStoreRestClient(storeURLHttp); // Login to API Publisher with admin apiPublisherClientUser1.login(user.getUserName(), user.getPassword()); // Login to API Store with admin apiStoreClientUser1.login(user.getUserName(), user.getPassword()); apiIdentifier = new APIIdentifier(providerName, API_NAME, API_VERSION); apiIdentifier.setTier(APIMIntegrationConstants.API_TIER.GOLD); // Create application apiStoreClientUser1.addApplication( APPLICATION_NAME, APIMIntegrationConstants.APPLICATION_TIER.LARGE, "", ""); accessToken = generateApplicationKeys(apiStoreClientUser1, APPLICATION_NAME).getAccessToken(); createPublishAndSubscribeToAPI( apiIdentifier, apiCreationRequestBean, apiPublisherClientUser1, apiStoreClientUser1, APPLICATION_NAME); waitForAPIDeploymentSync( user.getUserName(), API_NAME, API_VERSION, APIMIntegrationConstants.IS_API_EXISTS); }
@AfterClass(alwaysRun = true) public void destroy() throws Exception { super.cleanUp(); }