Source:
public void testCreateAndInvokeApiProduct() throws Exception { List<APIDTO> apisToBeUsed = new ArrayList<>(); apisToBeUsed.add(apiTestHelper. createApiOne(getBackendEndServiceEndPointHttp("wildcard/resources"))); apisToBeUsed.add(apiTestHelper. createApiTwo(getBackendEndServiceEndPointHttp("wildcard/resources"))); final String provider = UUID.randomUUID().toString(); final String name = UUID.randomUUID().toString(); final String context = "/" + UUID.randomUUID().toString(); List<String> policies = Arrays.asList(TIER_UNLIMITED, TIER_GOLD); APIProductDTO apiProductDTO = apiProductTestHelper.createAPIProductInPublisher(provider, name, context, apisToBeUsed, policies); Thread.sleep(45000); apiProductTestHelper.verfiyApiProductInPublisher(apiProductDTO); org.wso2.am.integration.clients.store.api.v1.dto.APIDTO apiDTO = apiProductTestHelper.verifyApiProductInPortal(apiProductDTO); ApplicationDTO applicationDTO = apiTestHelper.verifySubscription(apiDTO, UUID.randomUUID().toString(), TIER_UNLIMITED); List<String> grantTypes = Arrays.asList("client_credentials", "password"); ApplicationKeyDTO productionAppKey = apiTestHelper.verifyKeyGeneration(applicationDTO, ApplicationKeyGenerateRequestDTO.KeyTypeEnum.PRODUCTION, new ArrayList<>(), grantTypes); ApplicationKeyDTO sandboxAppKey = apiTestHelper.verifyKeyGeneration(applicationDTO, ApplicationKeyGenerateRequestDTO.KeyTypeEnum.SANDBOX, new ArrayList<>(), grantTypes); InvocationStatusCodes invocationStatusCodes = new InvocationStatusCodes(); apiTestHelper.verifyInvocation(apiDTO, productionAppKey.getToken().getAccessToken(), sandboxAppKey.getToken().getAccessToken(), invocationStatusCodes); String productionToken = apiTestHelper.generateTokenPasswordGrant(productionAppKey.getConsumerKey(), productionAppKey.getConsumerSecret(), STANDARD_SUBSCRIBER, PASSWORD, Collections.emptyList()); String sandboxToken = apiTestHelper.generateTokenPasswordGrant(sandboxAppKey.getConsumerKey(), sandboxAppKey.getConsumerSecret(), STANDARD_SUBSCRIBER, PASSWORD, Collections.emptyList()); apiTestHelper.verifyInvocation(apiDTO, productionToken, sandboxToken, invocationStatusCodes); }

Target:
public void testCreateAndInvokeApiProduct() throws Exception { List<APIDTO> apisToBeUsed = new ArrayList<>(); apisToBeUsed.add(apiTestHelper. createApiOne(getBackendEndServiceEndPointHttp("wildcard/resources"))); apisToBeUsed.add(apiTestHelper. createApiTwo(getBackendEndServiceEndPointHttp("wildcard/resources"))); final String provider = UUID.randomUUID().toString(); final String name = UUID.randomUUID().toString(); final String context = "/" + UUID.randomUUID().toString(); List<String> policies = Arrays.asList(TIER_UNLIMITED, TIER_GOLD); APIProductDTO apiProductDTO = apiProductTestHelper.createAPIProductInPublisher(provider, name, context, apisToBeUsed, policies); waitForAPIDeployment(); apiProductTestHelper.verfiyApiProductInPublisher(apiProductDTO); org.wso2.am.integration.clients.store.api.v1.dto.APIDTO apiDTO = apiProductTestHelper.verifyApiProductInPortal(apiProductDTO); ApplicationDTO applicationDTO = apiTestHelper.verifySubscription(apiDTO, UUID.randomUUID().toString(), TIER_UNLIMITED); List<String> grantTypes = Arrays.asList("client_credentials", "password"); ApplicationKeyDTO productionAppKey = apiTestHelper.verifyKeyGeneration(applicationDTO, ApplicationKeyGenerateRequestDTO.KeyTypeEnum.PRODUCTION, new ArrayList<>(), grantTypes); ApplicationKeyDTO sandboxAppKey = apiTestHelper.verifyKeyGeneration(applicationDTO, ApplicationKeyGenerateRequestDTO.KeyTypeEnum.SANDBOX, new ArrayList<>(), grantTypes); InvocationStatusCodes invocationStatusCodes = new InvocationStatusCodes(); apiTestHelper.verifyInvocation(apiDTO, productionAppKey.getToken().getAccessToken(), sandboxAppKey.getToken().getAccessToken(), invocationStatusCodes); String productionToken = apiTestHelper.generateTokenPasswordGrant(productionAppKey.getConsumerKey(), productionAppKey.getConsumerSecret(), STANDARD_SUBSCRIBER, PASSWORD, Collections.emptyList()); String sandboxToken = apiTestHelper.generateTokenPasswordGrant(sandboxAppKey.getConsumerKey(), sandboxAppKey.getConsumerSecret(), STANDARD_SUBSCRIBER, PASSWORD, Collections.emptyList()); apiTestHelper.verifyInvocation(apiDTO, productionToken, sandboxToken, invocationStatusCodes); }