@Test public void testModifyNonExistingSingleAttributeToExistingEntry() throws Exception { Map<String, Object> params = new HashMap<String, Object>(); params.put("dn", "uid=user1,ou=people,dc=mulesoft,dc=org"); params.put("attributeName", "telephoneNumber"); params.put("attributeValue", "777888999100"); LDAPEntry result = (LDAPEntry) runFlow("testModifySingleAttributeFlow", params); assertEquals("user1", result.getAttribute("uid").getValue()); assertEquals(params.get("attributeValue"), result.getAttribute("telephoneNumber").getValue()); }
// Single @Test public void testModifyExistingSingleAttributeToExistingEntry() throws Exception { Map<String, Object> params = new HashMap<String, Object>(); params.put("dn", "uid=user1,ou=people,dc=mulesoft,dc=org"); params.put("attributeName", "cn"); params.put("attributeValue", "User One Modified"); LDAPEntry result = (LDAPEntry) runFlow("testModifySingleAttributeFlow", params); assertEquals("user1", result.getAttribute("uid").getValue()); assertEquals(params.get("attributeValue"), result.getAttribute("cn").getValue()); assertEquals(1, result.getAttribute("cn").getValues().size()); }
@Test public void testModifySingleAttributeValueToExistingMultiValueAttributeToExistingEntry() throws Exception { Map<String, Object> params = new HashMap<String, Object>(); params.put("dn", "uid=user3,ou=people,dc=mulesoft,dc=org"); params.put("attributeName", "mail"); params.put("attributeValue", "*****@*****.**"); LDAPEntry result = (LDAPEntry) runFlow("testModifySingleAttributeFlow", params); assertEquals("user3", result.getAttribute("uid").getValue()); assertEquals(1, result.getAttribute("mail").getValues().size()); assertFalse(result.getAttribute("mail").getValues().contains("*****@*****.**")); assertTrue(result.getAttribute("mail").getValues().contains(params.get("attributeValue"))); }
// Multi @Test public void testModifyNewMultiAttributeToExistingEntry() throws Exception { List<String> mails = new ArrayList<String>(); mails.add("*****@*****.**"); mails.add("*****@*****.**"); Map<String, Object> params = new HashMap<String, Object>(); params.put("dn", "uid=user3,ou=people,dc=mulesoft,dc=org"); params.put("attributeName", "mail"); params.put("attributeValues", mails); LDAPEntry result = (LDAPEntry) runFlow("testModifyMultiAttributeFlow", params); assertEquals("user3", result.getAttribute("uid").getValue()); assertEquals(mails.size(), result.getAttribute("mail").getValues().size()); assertTrue(result.getAttribute("mail").getValues().containsAll(mails)); assertFalse(result.getAttribute("mail").getValues().contains("*****@*****.**")); }