auth3.getAuthDetail().getWhiteListedIps().add("12.23.45.56");
auth3.getAuthDetail().getWhiteListedIps().add("45.45.89.65");
dataManager.addAuth(auth3);
// Add a new Policy: Associated to API id1 and Auth id1
Policy policy = new Policy();
policy.setId("id31");
policy.getApiIds().add(api.getId());
// Create Bucket authIds of auth ids
QuotaRLBucket authIds = new QuotaRLBucket();
authIds.setId("bucketId");
authIds.getAuthIds().add(auth.getId());
authIds.getAuthIds().add(auth2.getId());
authIds.getAuthIds().add(auth3.getId());
// Add bucket authIds to policy
policy.getAuthIds().add(authIds);
dataManager.addPolicy(policy);
Api api_ = dataManager.getApiById(api.getId());
Auth auth_ = dataManager.getAuthById(auth.getId());
List<CallDescriptor> list1 = dataManager.getMatchingPolicies(api_, auth_);
assertEquals("List1 has correct size", 1, list1.size());
assertEquals("Matching policy is correct", policy.getId(), list1.get(0).getPolicy().getId());
// cleanup
dataManager.removePolicy(policy.getId());
dataManager.removeApi(api.getId());
dataManager.removeAuth(auth.getId());
dataManager.removeAuth(auth2.getId());
dataManager.removeAuth(auth3.getId());
}