@Test public void init() { ApiaryRangerAuthAllAccessPolicyProvider apiaryRangerAuthAllAccessPolicyProvider = new ApiaryRangerAuthAllAccessPolicyProvider(rangerAdminRESTClient); apiaryRangerAuthAllAccessPolicyProvider.init(serviceName, appId, configPropertyPrefix); verify(rangerAdminRESTClient, times(1)).init(serviceName, appId, configPropertyPrefix); ServicePolicies servicePolicies = apiaryRangerAuthAllAccessPolicyProvider.getServicePolicies(); assertThat(servicePolicies.getPolicies(), hasSize(1)); assertThat(servicePolicies.getPolicies().get(0).getPolicyItems(), hasSize(1)); assertThat(servicePolicies.getPolicies().get(0).getPolicyItems().get(0).getGroups(), hasItems(ApiaryRangerAuthAllAccessPolicyProvider.ALL_USERS_GROUP)); assertThat(servicePolicies.getPolicies().get(0).getPolicyItems().get(0).getAccesses(), hasSize(ApiaryRangerAuthAllAccessPolicyProvider.ACCESS_NAMES.size())); }
@Override public void init(String serviceName, String appId, String configPropertyPrefix) { servicePolicies = new ServicePolicies(); servicePolicies.setServiceName(serviceName); servicePolicies.setServiceId(1L); servicePolicies.setPolicyVersion(1L); servicePolicies.setPolicyUpdateTime(new Date()); List<RangerPolicy> policies = new ArrayList<>(); policies.add(getPolicy(1L, serviceName, POLICY_RESOURCES)); servicePolicies.setPolicies(policies); rangerAdminClient.init(serviceName, appId, configPropertyPrefix); log.debug("Successfully initialized ApiaryRangerAuthAllAccessPolicyProvider"); }
ApiaryRangerAuthAllAccessPolicyProvider implements RangerAdminClient { @Override public void init(String serviceName, String appId, String configPropertyPrefix) { servicePolicies = new ServicePolicies(); servicePolicies.setServiceName(serviceName); servicePolicies.setServiceId(1L); servicePolicies.setPolicyVersion(1L); servicePolicies.setPolicyUpdateTime(new Date()); List<RangerPolicy> policies = new ArrayList<>(); policies.add(getPolicy(1L, serviceName, POLICY_RESOURCES)); servicePolicies.setPolicies(policies); rangerAdminClient.init(serviceName, appId, configPropertyPrefix); log.debug("Successfully initialized ApiaryRangerAuthAllAccessPolicyProvider"); } }
ApiaryRangerAuthAllAccessPolicyProvider implements RangerAdminClient { @Override public void init(String serviceName, String appId, String configPropertyPrefix) { servicePolicies = new ServicePolicies(); servicePolicies.setServiceName(serviceName); servicePolicies.setServiceId(1L); servicePolicies.setPolicyVersion(1L); servicePolicies.setPolicyUpdateTime(new Date()); List<RangerPolicy> policies = new ArrayList<>(); policies.add(getPolicy(1L, serviceName, POLICY_RESOURCES)); servicePolicies.setPolicies(policies); rangerAdminClient.init(serviceName, appId, configPropertyPrefix); log.debug("Successfully initialized ApiaryRangerAuthAllAccessPolicyProvider"); } ApiaryRangerAuthAllAccessPolicyProvider();  ApiaryRangerAuthAllAccessPolicyProvider(RangerAdminClient rangerAdminClient); }
ApiaryRangerAuthAllAccessPolicyProvider implements RangerAdminClient { @Override public void init(String serviceName, String appId, String configPropertyPrefix) { servicePolicies = new ServicePolicies(); servicePolicies.setServiceName(serviceName); servicePolicies.setServiceId(1L); servicePolicies.setPolicyVersion(1L); servicePolicies.setPolicyUpdateTime(new Date()); List<RangerPolicy> policies = new ArrayList<>(); policies.add(getPolicy(1L, serviceName, POLICY_RESOURCES)); servicePolicies.setPolicies(policies); rangerAdminClient.init(serviceName, appId, configPropertyPrefix); log.debug("Successfully initialized ApiaryRangerAuthAllAccessPolicyProvider"); } ApiaryRangerAuthAllAccessPolicyProvider();  ApiaryRangerAuthAllAccessPolicyProvider(RangerAdminClient rangerAdminClient); @Override void init(String serviceName, String appId, String configPropertyPrefix); @Override RangerRole createRole(RangerRole request); @Override void dropRole(String execUser, String roleName); @Override List<String> getAllRoles(String execUser); @Override List<String> getUserRoles(String execUser); @Override RangerRole getRole(String execUser, String roleName); @Override ServicePolicies getServicePoliciesIfUpdated(long lastKnownVersion, long lastActivationTimeInMillis); @Override void grantAccess(GrantRevokeRequest request); @Override void revokeAccess(GrantRevokeRequest request); @Override void grantRole(GrantRevokeRoleRequest request); @Override void revokeRole(GrantRevokeRoleRequest request); @Override ServiceTags getServiceTagsIfUpdated(long lastKnownVersion, long lastActivationTimeInMillis); @Override List<String> getTagTypes(String tagTypePattern); }
ApiaryRangerAuthAllAccessPolicyProvider implements RangerAdminClient { @Override public void init(String serviceName, String appId, String configPropertyPrefix) { servicePolicies = new ServicePolicies(); servicePolicies.setServiceName(serviceName); servicePolicies.setServiceId(1L); servicePolicies.setPolicyVersion(1L); servicePolicies.setPolicyUpdateTime(new Date()); List<RangerPolicy> policies = new ArrayList<>(); policies.add(getPolicy(1L, serviceName, POLICY_RESOURCES)); servicePolicies.setPolicies(policies); rangerAdminClient.init(serviceName, appId, configPropertyPrefix); log.debug("Successfully initialized ApiaryRangerAuthAllAccessPolicyProvider"); } ApiaryRangerAuthAllAccessPolicyProvider();  ApiaryRangerAuthAllAccessPolicyProvider(RangerAdminClient rangerAdminClient); @Override void init(String serviceName, String appId, String configPropertyPrefix); @Override RangerRole createRole(RangerRole request); @Override void dropRole(String execUser, String roleName); @Override List<String> getAllRoles(String execUser); @Override List<String> getUserRoles(String execUser); @Override RangerRole getRole(String execUser, String roleName); @Override ServicePolicies getServicePoliciesIfUpdated(long lastKnownVersion, long lastActivationTimeInMillis); @Override void grantAccess(GrantRevokeRequest request); @Override void revokeAccess(GrantRevokeRequest request); @Override void grantRole(GrantRevokeRoleRequest request); @Override void revokeRole(GrantRevokeRoleRequest request); @Override ServiceTags getServiceTagsIfUpdated(long lastKnownVersion, long lastActivationTimeInMillis); @Override List<String> getTagTypes(String tagTypePattern);  }