@Test public void getUsersForListValue() throws Exception { System.out.println("Searcher.getUsersForListValue"); Map<String, String> attributesWithSearchingValues = new HashMap<String, String>(); attributesWithSearchingValues.put(listAttr.getName(), "ttribute2"); List<User> users = new ArrayList<User>(); users = searcherBl.getUsers(sess, attributesWithSearchingValues); assertTrue("user2 have to be found", users.contains(user2)); assertTrue("user1 have to be found", users.contains(user1)); }
@Test public void getUsersForIntegerValue() throws Exception { System.out.println("Searcher.getUsersForIntegerValue"); Map<String, String> attributesWithSearchingValues = new HashMap<String, String>(); attributesWithSearchingValues.put(integerAttr.getName(), "100"); AttributeDefinition attrDef = sess.getPerun().getAttributesManager().getAttributeDefinition(sess, integerAttr.getName()); Attribute attr = new Attribute(attrDef); List<User> users = new ArrayList<User>(); users = searcherBl.getUsers(sess, attributesWithSearchingValues); assertTrue("user1 have to be found", users.contains(user1)); assertTrue("user2 have not to be found", !users.contains(user2)); }
@Test public void getUsersForCoreAttribute() throws Exception { System.out.println("Searcher.getUsersForCoreAttribute"); Attribute attr = perun .getAttributesManagerBl() .getAttribute(sess, user1, "urn:perun:user:attribute-def:core:id"); Map<String, String> attributesWithSearchingValues = new HashMap<String, String>(); attributesWithSearchingValues.put(attr.getName(), attr.getValue().toString()); List<User> users = new ArrayList<User>(); users = searcherBl.getUsers(sess, attributesWithSearchingValues); System.out.println(attr.getValue().toString()); System.out.println(attr.getType().toString()); System.out.println(users.toString()); }