@Test public void noSearchResultsReturnsEmptyList() throws Exception { List<SMSDataEntry> emptyIndexes = Collections.emptyList(); when(dnMapper.orgNameToDN(REALM)).thenReturn(REALM_DN); when(privilegedAction.run()).thenReturn(ssoToken); when(serviceManagementDAO.checkIfEntryExists(SERVICE_DN, ssoToken)).thenReturn(true); when(serviceManagementDAO.search(ssoToken, SERVICE_DN, FILTER, 0, 0, false, false, excludes)) .thenReturn(emptyIndexes.iterator()); Set<String> results = treeService.searchTree("http: verify(dnMapper).orgNameToDN(REALM); verify(privilegedAction).run(); verify(serviceManagementDAO).checkIfEntryExists(SERVICE_DN, ssoToken); verify(serviceManagementDAO).search(ssoToken, SERVICE_DN, FILTER, 0, 0, false, false, excludes); assertNotNull(results); assertTrue(results.isEmpty()); }
@Override public Set<String> searchTree(String resource, String realm) throws EntitlementException { IndexRuleTree indexRuleTree = getIndexTree(realm); if (indexRuleTree == null) { return Collections.emptySet(); } Set<String> results = indexRuleTree.searchTree(resource); if (DEBUG.messageEnabled()) { DEBUG.message(String.format("Matched index rules (resource:%s, realm:%s): %s", resource, realm, results)); } return results; }
IndexTreeServiceImpl implements IndexTreeService, IndexChangeObserver, ShutdownListener { @Override public Set<String> searchTree(String resource, String realm) throws EntitlementException { IndexRuleTree indexRuleTree = getIndexTree(realm); if (indexRuleTree == null) { return Collections.emptySet(); } Set<String> results = indexRuleTree.searchTree(resource); if (DEBUG.messageEnabled()) { DEBUG.message(String.format("Matched index rules (resource:%s, realm:%s): %s", resource, realm, results)); } return results; } }
IndexTreeServiceImpl implements IndexTreeService, IndexChangeObserver, ShutdownListener { @Override public Set<String> searchTree(String resource, String realm) throws EntitlementException { IndexRuleTree indexRuleTree = getIndexTree(realm); if (indexRuleTree == null) { return Collections.emptySet(); } Set<String> results = indexRuleTree.searchTree(resource); if (DEBUG.messageEnabled()) { DEBUG.message(String.format("Matched index rules (resource:%s, realm:%s): %s", resource, realm, results)); } return results; } @Inject  IndexTreeServiceImpl(IndexChangeManager manager, PrivilegedAction<SSOToken> adminTokenAction,
                                ServiceManagementDAO smDAO, DNWrapper dnMapper,
                                ShutdownManagerWrapper shutdownManager); }
IndexTreeServiceImpl implements IndexTreeService, IndexChangeObserver, ShutdownListener { @Override public Set<String> searchTree(String resource, String realm) throws EntitlementException { IndexRuleTree indexRuleTree = getIndexTree(realm); if (indexRuleTree == null) { return Collections.emptySet(); } Set<String> results = indexRuleTree.searchTree(resource); if (DEBUG.messageEnabled()) { DEBUG.message(String.format("Matched index rules (resource:%s, realm:%s): %s", resource, realm, results)); } return results; } @Inject  IndexTreeServiceImpl(IndexChangeManager manager, PrivilegedAction<SSOToken> adminTokenAction,
                                ServiceManagementDAO smDAO, DNWrapper dnMapper,
                                ShutdownManagerWrapper shutdownManager); @Override Set<String> searchTree(String resource, String realm); @Override void update(IndexChangeEvent event); @Override void shutdown(); }
IndexTreeServiceImpl implements IndexTreeService, IndexChangeObserver, ShutdownListener { @Override public Set<String> searchTree(String resource, String realm) throws EntitlementException { IndexRuleTree indexRuleTree = getIndexTree(realm); if (indexRuleTree == null) { return Collections.emptySet(); } Set<String> results = indexRuleTree.searchTree(resource); if (DEBUG.messageEnabled()) { DEBUG.message(String.format("Matched index rules (resource:%s, realm:%s): %s", resource, realm, results)); } return results; } @Inject  IndexTreeServiceImpl(IndexChangeManager manager, PrivilegedAction<SSOToken> adminTokenAction,
                                ServiceManagementDAO smDAO, DNWrapper dnMapper,
                                ShutdownManagerWrapper shutdownManager); @Override Set<String> searchTree(String resource, String realm); @Override void update(IndexChangeEvent event); @Override void shutdown();  }