| | |
| | | entry.addControl(control); |
| | | } |
| | | entry.addAttribute(new LinkedAttribute("test", "value1")); |
| | | entry.addAttribute(new LinkedAttribute("Another", ByteString.valueOf("myValue"))); |
| | | entry.addAttribute(new LinkedAttribute("Another", ByteString.valueOfUtf8("myValue"))); |
| | | |
| | | SearchResultEntry result = to(entry); |
| | | assertThat(result.getName().toString()).isEqualTo(entry.getName().toString()); |
| | |
| | | new LinkedHashMapEntry(org.forgerock.opendj.ldap.DN |
| | | .valueOf("uid=scarter,ou=People,dc=example,dc=com")); |
| | | entry.addAttribute(new LinkedAttribute("test", "value1")); |
| | | entry.addAttribute(new LinkedAttribute("Another", ByteString.valueOf("myValue"))); |
| | | entry.addAttribute(new LinkedAttribute("Another", ByteString.valueOfUtf8("myValue"))); |
| | | |
| | | org.opends.server.types.Entry result = to(entry); |
| | | assertThat(result.getName().toString()).isEqualTo(entry.getName().toString()); |
| | |
| | | assertThat(srvAttribute.getValues().get(0).toString()).isEqualTo("value1"); |
| | | |
| | | org.forgerock.opendj.ldap.Attribute attribute2 = |
| | | new LinkedAttribute("Another", ByteString.valueOf("myValue")); |
| | | new LinkedAttribute("Another", ByteString.valueOfUtf8("myValue")); |
| | | |
| | | org.opends.server.types.RawAttribute srvAttribute2 = to(attribute2); |
| | | assertThat(srvAttribute2.getAttributeType()).isEqualTo("Another"); |
| | |
| | | assertThat(srvAttribute.iterator().next().toString()).isEqualTo("value1"); |
| | | |
| | | org.forgerock.opendj.ldap.Attribute attribute2 = |
| | | new LinkedAttribute("Another", ByteString.valueOf("myValue")); |
| | | new LinkedAttribute("Another", ByteString.valueOfUtf8("myValue")); |
| | | |
| | | org.opends.server.types.Attribute srvAttribute2 = toAttribute(attribute2); |
| | | assertThat(srvAttribute2.getAttributeType().getNameOrOID()).isEqualTo("Another"); |
| | |
| | | @Test |
| | | public final void testToRawModification() { |
| | | org.forgerock.opendj.ldap.Attribute attribute = |
| | | new LinkedAttribute("test", ByteString.valueOf("value1"), ByteString |
| | | .valueOf("value2")); |
| | | new LinkedAttribute("test", ByteString.valueOfUtf8("value1"), ByteString |
| | | .valueOfUtf8("value2")); |
| | | |
| | | Modification mod = new Modification(ModificationType.ADD, attribute); |
| | | |
| | |
| | | @Test |
| | | public final void testToModification() { |
| | | org.forgerock.opendj.ldap.Attribute attribute = |
| | | new LinkedAttribute("test", ByteString.valueOf("value1"), ByteString |
| | | .valueOf("value2")); |
| | | new LinkedAttribute("test", ByteString.valueOfUtf8("value1"), ByteString |
| | | .valueOfUtf8("value2")); |
| | | |
| | | Modification mod = new Modification(ModificationType.ADD, attribute); |
| | | |
| | |
| | | @Test |
| | | public static void testFromLDAPControl() { |
| | | org.opends.server.protocols.ldap.LDAPControl ldapControl = |
| | | new LDAPControl("1.2.3.4", false, ByteString.valueOf("myData")); |
| | | new LDAPControl("1.2.3.4", false, ByteString.valueOfUtf8("myData")); |
| | | Control sdkControl = from(ldapControl); |
| | | |
| | | Control expectedSdkControl = GenericControl.newControl("1.2.3.4", false, "myData"); |
| | |
| | | @Test |
| | | public static void testFromControl() { |
| | | final org.opends.server.types.Control control = |
| | | new LDAPControl("1.2.3.4", false, ByteString.valueOf("myData")); |
| | | new LDAPControl("1.2.3.4", false, ByteString.valueOfUtf8("myData")); |
| | | Control sdkControl = from(control); |
| | | |
| | | Control expectedSdkControl = GenericControl.newControl("1.2.3.4", false, "myData"); |
| | |
| | | final GenericBindRequest genericBindRequest = bindClient.nextBindRequest(); |
| | | |
| | | assertThat(getCredentials(genericBindRequest.getAuthenticationValue())).isEqualTo( |
| | | ByteString.valueOf("\u0000u:user.0\u0000password")); |
| | | ByteString.valueOfUtf8("\u0000u:user.0\u0000password")); |
| | | } |
| | | |
| | | /** |