@Test public void getServicePoliciesIfUpdated() throws Exception { RangerAdminClientImpl testImpl = new RangerAdminClientImpl(); testImpl.init(serviceName, appId, "ranger.plugin.hive"); ServicePolicies jsonPolicies = testImpl.getServicePoliciesIfUpdated(1L, 1L); ApiaryRangerAuthAllAccessPolicyProvider apiaryRangerAuthAllAccessPolicyProvider = new ApiaryRangerAuthAllAccessPolicyProvider(testImpl); apiaryRangerAuthAllAccessPolicyProvider.init(serviceName, appId, configPropertyPrefix); ServicePolicies servicePolicies = apiaryRangerAuthAllAccessPolicyProvider. getServicePoliciesIfUpdated(1L, 1L); assertThat(jsonPolicies.getPolicies(), hasSize(10)); assertThat(servicePolicies.getPolicies(), hasSize(1)); assertThat(jsonPolicies.getServiceDef().getGuid(), equalTo(servicePolicies.getServiceDef().getGuid())); }
@Override public ServicePolicies getServicePoliciesIfUpdated(long lastKnownVersion, long lastActivationTimeInMillis) throws Exception { ServicePolicies realServicePolicies = rangerAdminClient.getServicePoliciesIfUpdated(lastKnownVersion, lastActivationTimeInMillis); servicePolicies.setServiceDef(realServicePolicies.getServiceDef()); return servicePolicies; }
ApiaryRangerAuthAllAccessPolicyProvider implements RangerAdminClient { @Override public ServicePolicies getServicePoliciesIfUpdated(long lastKnownVersion, long lastActivationTimeInMillis) throws Exception { ServicePolicies realServicePolicies = rangerAdminClient.getServicePoliciesIfUpdated(lastKnownVersion, lastActivationTimeInMillis); servicePolicies.setServiceDef(realServicePolicies.getServiceDef()); return servicePolicies; } }
ApiaryRangerAuthAllAccessPolicyProvider implements RangerAdminClient { @Override public ServicePolicies getServicePoliciesIfUpdated(long lastKnownVersion, long lastActivationTimeInMillis) throws Exception { ServicePolicies realServicePolicies = rangerAdminClient.getServicePoliciesIfUpdated(lastKnownVersion, lastActivationTimeInMillis); servicePolicies.setServiceDef(realServicePolicies.getServiceDef()); return servicePolicies; } ApiaryRangerAuthAllAccessPolicyProvider();  ApiaryRangerAuthAllAccessPolicyProvider(RangerAdminClient rangerAdminClient); }
ApiaryRangerAuthAllAccessPolicyProvider implements RangerAdminClient { @Override public ServicePolicies getServicePoliciesIfUpdated(long lastKnownVersion, long lastActivationTimeInMillis) throws Exception { ServicePolicies realServicePolicies = rangerAdminClient.getServicePoliciesIfUpdated(lastKnownVersion, lastActivationTimeInMillis); servicePolicies.setServiceDef(realServicePolicies.getServiceDef()); return servicePolicies; } 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 ServicePolicies getServicePoliciesIfUpdated(long lastKnownVersion, long lastActivationTimeInMillis) throws Exception { ServicePolicies realServicePolicies = rangerAdminClient.getServicePoliciesIfUpdated(lastKnownVersion, lastActivationTimeInMillis); servicePolicies.setServiceDef(realServicePolicies.getServiceDef()); return servicePolicies; } 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);  }