@Test public void testIPAddress() { RuleFilter filter = new RuleFilter(RuleFilter.SpecialFilterType.ANY); assertEquals(0, ruleAdminService.count(filter)); UserGroup g1 = createRole("g1"); UserGroup g2 = createRole("g2"); IPAddressRange ip10 = new IPAddressRange("10.10.100.0/24"); IPAddressRange ip192 = new IPAddressRange("192.168.0.0/16"); Rule r1 = new Rule(10, null, "g1", null,ip10, "s1", "r1", "w1", "l1", GrantType.ALLOW); Rule r2 = new Rule(20, null, "g2", null,ip10, "s1", "r2", "w2", "l2", GrantType.ALLOW); Rule r3 = new Rule(30, null, "g1", null,ip192, "s3", "r3", "w3", "l3", GrantType.ALLOW); Rule r4 = new Rule(40, null, "g1", null,null, null, null, null, null, GrantType.ALLOW); ruleAdminService.insert(r1); ruleAdminService.insert(r2); ruleAdminService.insert(r3); ruleAdminService.insert(r4); assertEquals(4, ruleReaderService.getMatchingRules("*","*", "*", "*", "*", "*","*","*").size()); assertEquals(3, ruleReaderService.getMatchingRules("*","g1","*", "*", "*", "*","*","*").size()); assertEquals(1, ruleReaderService.getMatchingRules("*","g2","*", "*", "*", "*","*","*").size()); assertEquals(2, ruleReaderService.getMatchingRules("*","g1","*", "*", "s1", "*","*","*").size()); assertEquals(1, ruleReaderService.getMatchingRules("*","*", "*", "*", "ZZ", "*","*","*").size()); assertEquals(3, ruleReaderService.getMatchingRules("*","*", "*", "10.10.100.4", "*", "*","*","*").size()); assertEquals(2, ruleReaderService.getMatchingRules("*","g1","*", "10.10.100.4", "*", "*","*","*").size()); assertEquals(1, ruleReaderService.getMatchingRules("*","*", "*", "10.10.1.4", "*", "*","*","*").size()); assertEquals(2, ruleReaderService.getMatchingRules("*","*", "*", "192.168.1.1", "*", "*","*","*").size()); assertEquals(1, ruleReaderService.getMatchingRules("*","*", "*", null, "*", "*","*","*").size()); assertEquals(0, ruleReaderService.getMatchingRules("*","*","*","BAD", "*", "*","*","*").size()); }
@Override @Deprecated public List<ShortRule> getMatchingRules( String userName, String profileName, String instanceName, String sourceAddress, String service, String request, String workspace, String layer) { return getMatchingRules(new RuleFilter(userName, profileName, instanceName, sourceAddress, service, request, workspace, layer)); }
RuleReaderServiceImpl implements RuleReaderService { @Override @Deprecated public List<ShortRule> getMatchingRules( String userName, String profileName, String instanceName, String sourceAddress, String service, String request, String workspace, String layer) { return getMatchingRules(new RuleFilter(userName, profileName, instanceName, sourceAddress, service, request, workspace, layer)); } }
RuleReaderServiceImpl implements RuleReaderService { @Override @Deprecated public List<ShortRule> getMatchingRules( String userName, String profileName, String instanceName, String sourceAddress, String service, String request, String workspace, String layer) { return getMatchingRules(new RuleFilter(userName, profileName, instanceName, sourceAddress, service, request, workspace, layer)); }  }
RuleReaderServiceImpl implements RuleReaderService { @Override @Deprecated public List<ShortRule> getMatchingRules( String userName, String profileName, String instanceName, String sourceAddress, String service, String request, String workspace, String layer) { return getMatchingRules(new RuleFilter(userName, profileName, instanceName, sourceAddress, service, request, workspace, layer)); }  @Override @Deprecated List<ShortRule> getMatchingRules(
                    String userName, String profileName, String instanceName,
                    String sourceAddress,
                    String service, String request,
                    String workspace, String layer); @Override List<ShortRule> getMatchingRules(RuleFilter filter); @Override @Deprecated AccessInfo getAccessInfo(String userName, String roleName, String instanceName,
            String sourceAddress,
            String service, String request,
            String workspace, String layer); @Override AccessInfo getAccessInfo(RuleFilter filter); @Override AccessInfo getAdminAuthorization(RuleFilter filter); @Override @Deprecated AuthUser authorize(String username, String password); void setRuleDAO(RuleDAO ruleDAO); void setAdminRuleDAO(AdminRuleDAO adminRuleDAO); void setLayerDetailsDAO(LayerDetailsDAO detailsDAO); void setUserResolver(UserResolver userResolver); void setAuthorizationService(AuthorizationService authorizationService); }
RuleReaderServiceImpl implements RuleReaderService { @Override @Deprecated public List<ShortRule> getMatchingRules( String userName, String profileName, String instanceName, String sourceAddress, String service, String request, String workspace, String layer) { return getMatchingRules(new RuleFilter(userName, profileName, instanceName, sourceAddress, service, request, workspace, layer)); }  @Override @Deprecated List<ShortRule> getMatchingRules(
                    String userName, String profileName, String instanceName,
                    String sourceAddress,
                    String service, String request,
                    String workspace, String layer); @Override List<ShortRule> getMatchingRules(RuleFilter filter); @Override @Deprecated AccessInfo getAccessInfo(String userName, String roleName, String instanceName,
            String sourceAddress,
            String service, String request,
            String workspace, String layer); @Override AccessInfo getAccessInfo(RuleFilter filter); @Override AccessInfo getAdminAuthorization(RuleFilter filter); @Override @Deprecated AuthUser authorize(String username, String password); void setRuleDAO(RuleDAO ruleDAO); void setAdminRuleDAO(AdminRuleDAO adminRuleDAO); void setLayerDetailsDAO(LayerDetailsDAO detailsDAO); void setUserResolver(UserResolver userResolver); void setAuthorizationService(AuthorizationService authorizationService);  }