| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2013-2015 ForgeRock AS. |
| | | * Copyright 2013-2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.adapter.server3x; |
| | | |
| | |
| | | byte[] data = { 0x00, 0x01, 0x02, (byte) 0xff }; |
| | | |
| | | ByteString attrValue = ByteString.wrap(data); |
| | | Attribute attribute = Attributes.create(DirectoryServer.getAttributeTypeOrNull("cn"), attrValue); |
| | | Attribute attribute = Attributes.create(DirectoryServer.getAttributeType("cn"), attrValue); |
| | | assertThat(from(attribute).firstValue().toByteArray()).isEqualTo(data); |
| | | } |
| | | |
| | |
| | | |
| | | import static org.testng.Assert.*; |
| | | |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.server.DirectoryServerTestCase; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.admin.std.meta.RootCfgDefn; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.testng.annotations.DataProvider; |
| | | import org.testng.annotations.Test; |
| | |
| | | public void testValidateValue() { |
| | | AttributeTypePropertyDefinition.setCheckSchema(true); |
| | | AttributeTypePropertyDefinition d = createPropertyDefinition(); |
| | | d.validateValue(DirectoryServer.getAttributeTypeOrNull("cn")); |
| | | d.validateValue(DirectoryServer.getAttributeType("cn")); |
| | | } |
| | | |
| | | |
| | |
| | | public void testDecodeValue(String value) { |
| | | AttributeTypePropertyDefinition.setCheckSchema(true); |
| | | AttributeTypePropertyDefinition d = createPropertyDefinition(); |
| | | AttributeType expected = DirectoryServer.getAttributeTypeOrNull(value); |
| | | AttributeType expected = DirectoryServer.getAttributeType(value); |
| | | assertEquals(d.decodeValue(value), expected); |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2007-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.admin.client.ldap; |
| | | |
| | |
| | | TestParentCfgClient parent = getTestParent(ctx, "test parent 1"); |
| | | TestChildCfgClient child = parent.createTestChild(TestChildCfgDefn.getInstance(), "test child new", null); |
| | | child.setMandatoryBooleanProperty(true); |
| | | child.setMandatoryReadOnlyAttributeTypeProperty(DirectoryServer.getAttributeTypeOrNull("description")); |
| | | child.setMandatoryReadOnlyAttributeTypeProperty(DirectoryServer.getAttributeType("description")); |
| | | child.setAggregationProperty(Collections.singleton("LDAP Connection Handler")); |
| | | child.commit(); |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | * Portions Copyright 2014-2016 ForgeRock AS |
| | | */ |
| | | package org.opends.server.admin.client.ldap; |
| | | |
| | |
| | | TestParentCfgClient parent = getTestParent(ctx, "test parent 1"); |
| | | TestChildCfgClient child = parent.createTestChild(TestChildCfgDefn.getInstance(), "test child new", null); |
| | | child.setMandatoryBooleanProperty(true); |
| | | child.setMandatoryReadOnlyAttributeTypeProperty(DirectoryServer.getAttributeTypeOrNull("description")); |
| | | child.setMandatoryReadOnlyAttributeTypeProperty(DirectoryServer.getAttributeType("description")); |
| | | child.commit(); |
| | | |
| | | c.assertEntryIsCreated(); |
| | |
| | | try { |
| | | TestParentCfgClient parent = createTestParent(ctx, "test parent new"); |
| | | parent.setMandatoryBooleanProperty(true); |
| | | parent.setMandatoryReadOnlyAttributeTypeProperty(DirectoryServer.getAttributeTypeOrNull("description")); |
| | | parent.setMandatoryReadOnlyAttributeTypeProperty(DirectoryServer.getAttributeType("description")); |
| | | parent.commit(); |
| | | } catch (Exception e) { |
| | | Assert.assertEquals(e.getClass(), expected); |
| | |
| | | ManagementContext ctx = LDAPManagementContext.createFromContext(c); |
| | | TestParentCfgClient parent = createTestParent(ctx, "test parent new"); |
| | | parent.setMandatoryBooleanProperty(true); |
| | | parent.setMandatoryReadOnlyAttributeTypeProperty(DirectoryServer.getAttributeTypeOrNull("description")); |
| | | parent.setMandatoryReadOnlyAttributeTypeProperty(DirectoryServer.getAttributeType("description")); |
| | | parent.commit(); |
| | | c.assertEntryIsCreated(); |
| | | } |
| | |
| | | Assert.assertEquals(child.getMandatoryClassProperty(), |
| | | "org.opends.server.extensions.UserDefinedVirtualAttributeProvider"); |
| | | Assert.assertEquals(child.getMandatoryReadOnlyAttributeTypeProperty(), |
| | | DirectoryServer.getAttributeTypeOrNull("description")); |
| | | DirectoryServer.getAttributeType("description")); |
| | | assertDNSetEquals(child.getOptionalMultiValuedDNProperty1(), |
| | | "dc=default value c3v1,dc=com", "dc=default value c3v2,dc=com"); |
| | | assertDNSetEquals(child.getOptionalMultiValuedDNProperty2(), |
| | |
| | | Assert.assertEquals(child.getMandatoryClassProperty(), |
| | | "org.opends.server.extensions.UserDefinedVirtualAttributeProvider"); |
| | | Assert.assertEquals(child.getMandatoryReadOnlyAttributeTypeProperty(), |
| | | DirectoryServer.getAttributeTypeOrNull("description")); |
| | | DirectoryServer.getAttributeType("description")); |
| | | assertDNSetEquals(child.getOptionalMultiValuedDNProperty1(), |
| | | "dc=domain1,dc=com", "dc=domain2,dc=com", "dc=domain3,dc=com"); |
| | | assertDNSetEquals(child.getOptionalMultiValuedDNProperty2(), |
| | |
| | | Assert.assertEquals(parent.getMandatoryClassProperty(), |
| | | "org.opends.server.extensions.UserDefinedVirtualAttributeProvider"); |
| | | Assert.assertEquals(parent.getMandatoryReadOnlyAttributeTypeProperty(), |
| | | DirectoryServer.getAttributeTypeOrNull("description")); |
| | | DirectoryServer.getAttributeType("description")); |
| | | assertDNSetEquals(parent.getOptionalMultiValuedDNProperty(), |
| | | "dc=default value p2v1,dc=com", "dc=default value p2v2,dc=com"); |
| | | } |
| | |
| | | Assert.assertEquals(parent.getMandatoryClassProperty(), |
| | | "org.opends.server.extensions.UserDefinedVirtualAttributeProvider"); |
| | | Assert.assertEquals(parent.getMandatoryReadOnlyAttributeTypeProperty(), |
| | | DirectoryServer.getAttributeTypeOrNull("description")); |
| | | DirectoryServer.getAttributeType("description")); |
| | | assertDNSetEquals(parent.getOptionalMultiValuedDNProperty(), |
| | | "dc=domain1,dc=com", "dc=domain2,dc=com", "dc=domain3,dc=com"); |
| | | } |
| | |
| | | |
| | | // Check that the default values are not committed. |
| | | child.setMandatoryBooleanProperty(true); |
| | | child.setMandatoryReadOnlyAttributeTypeProperty(DirectoryServer.getAttributeTypeOrNull("description")); |
| | | child.setMandatoryReadOnlyAttributeTypeProperty(DirectoryServer.getAttributeType("description")); |
| | | child.commit(); |
| | | |
| | | c.assertEntryIsCreated(); |
| | |
| | | |
| | | // Check that the default values are not committed. |
| | | child.setMandatoryBooleanProperty(true); |
| | | child.setMandatoryReadOnlyAttributeTypeProperty(DirectoryServer.getAttributeTypeOrNull("description")); |
| | | child.setMandatoryReadOnlyAttributeTypeProperty(DirectoryServer.getAttributeType("description")); |
| | | child.commit(); |
| | | |
| | | c.assertEntryIsCreated(); |
| | |
| | | TestParentCfgClient parent = getTestParent(ctx, "test parent 1"); |
| | | TestChildCfgClient child = parent.createTestChild(TestChildCfgDefn.getInstance(), "test child new", null); |
| | | child.setMandatoryBooleanProperty(true); |
| | | child.setMandatoryReadOnlyAttributeTypeProperty(DirectoryServer.getAttributeTypeOrNull("description")); |
| | | child.setMandatoryReadOnlyAttributeTypeProperty(DirectoryServer.getAttributeType("description")); |
| | | child.commit(); |
| | | |
| | | c.assertEntryIsCreated(); |
| | |
| | | TestParentCfgClient parent = getTestParent(ctx, "test parent 1"); |
| | | TestChildCfgClient child = parent.createTestChild(TestChildCfgDefn.getInstance(), "test child new", null); |
| | | child.setMandatoryBooleanProperty(true); |
| | | child.setMandatoryReadOnlyAttributeTypeProperty(DirectoryServer.getAttributeTypeOrNull("description")); |
| | | child.setMandatoryReadOnlyAttributeTypeProperty(DirectoryServer.getAttributeType("description")); |
| | | child.commit(); |
| | | Assert.fail("The add constraint failed to prevent creation of the managed object"); |
| | | } finally { |
| | |
| | | * |
| | | * |
| | | * Copyright 2007-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2015 ForgeRock AS |
| | | * Portions Copyright 2013-2016 ForgeRock AS |
| | | */ |
| | | package org.opends.server.admin.server; |
| | | |
| | |
| | | Assert.assertEquals(child.getMandatoryClassProperty(), |
| | | "org.opends.server.extensions.UserDefinedVirtualAttributeProvider"); |
| | | Assert.assertEquals(child.getMandatoryReadOnlyAttributeTypeProperty(), |
| | | DirectoryServer.getAttributeTypeOrNull("description")); |
| | | DirectoryServer.getAttributeType("description")); |
| | | assertSetEquals(child.getAggregationProperty(), new String[0]); |
| | | } |
| | | |
| | |
| | | Assert.assertEquals(child.getMandatoryClassProperty(), |
| | | "org.opends.server.extensions.UserDefinedVirtualAttributeProvider"); |
| | | Assert.assertEquals(child.getMandatoryReadOnlyAttributeTypeProperty(), |
| | | DirectoryServer.getAttributeTypeOrNull("description")); |
| | | DirectoryServer.getAttributeType("description")); |
| | | |
| | | // Test normalization. |
| | | assertSetEquals(child.getAggregationProperty(), "LDAP Connection Handler"); |
| | |
| | | Assert.assertEquals(child.getMandatoryClassProperty(), |
| | | "org.opends.server.extensions.UserDefinedVirtualAttributeProvider"); |
| | | Assert.assertEquals(child.getMandatoryReadOnlyAttributeTypeProperty(), |
| | | DirectoryServer.getAttributeTypeOrNull("description")); |
| | | DirectoryServer.getAttributeType("description")); |
| | | assertSetEquals(child.getAggregationProperty(), "LDAPS Connection Handler", |
| | | "LDAP Connection Handler"); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | * Portions Copyright 2014-2016 ForgeRock AS |
| | | */ |
| | | package org.opends.server.admin.server; |
| | | |
| | |
| | | Assert.assertEquals(child.getMandatoryClassProperty(), |
| | | "org.opends.server.extensions.UserDefinedVirtualAttributeProvider"); |
| | | Assert.assertEquals(child.getMandatoryReadOnlyAttributeTypeProperty(), |
| | | DirectoryServer.getAttributeTypeOrNull("description")); |
| | | DirectoryServer.getAttributeType("description")); |
| | | assertDNSetEquals(child.getOptionalMultiValuedDNProperty1(), |
| | | "dc=new value 1,dc=com", "dc=new value 2,dc=com"); |
| | | assertDNSetEquals(child.getOptionalMultiValuedDNProperty2(), |
| | |
| | | Assert.assertEquals(child.getMandatoryClassProperty(), |
| | | "org.opends.server.extensions.UserDefinedVirtualAttributeProvider"); |
| | | Assert.assertEquals(child.getMandatoryReadOnlyAttributeTypeProperty(), |
| | | DirectoryServer.getAttributeTypeOrNull("description")); |
| | | DirectoryServer.getAttributeType("description")); |
| | | assertDNSetEquals(child.getOptionalMultiValuedDNProperty1(), |
| | | "dc=new value 1,dc=com", "dc=new value 2,dc=com"); |
| | | assertDNSetEquals(child.getOptionalMultiValuedDNProperty2(), |
| | |
| | | Assert.assertEquals(child.getMandatoryClassProperty(), |
| | | "org.opends.server.extensions.UserDefinedVirtualAttributeProvider"); |
| | | Assert.assertEquals(child.getMandatoryReadOnlyAttributeTypeProperty(), |
| | | DirectoryServer.getAttributeTypeOrNull("description")); |
| | | DirectoryServer.getAttributeType("description")); |
| | | assertDNSetEquals(child.getOptionalMultiValuedDNProperty1(), |
| | | "dc=domain1,dc=com", "dc=domain2,dc=com", "dc=domain3,dc=com"); |
| | | assertDNSetEquals(child.getOptionalMultiValuedDNProperty2(), |
| | |
| | | Assert.assertEquals(child.getMandatoryClassProperty(), |
| | | "org.opends.server.extensions.UserDefinedVirtualAttributeProvider"); |
| | | Assert.assertEquals(child.getMandatoryReadOnlyAttributeTypeProperty(), |
| | | DirectoryServer.getAttributeTypeOrNull("description")); |
| | | DirectoryServer.getAttributeType("description")); |
| | | assertDNSetEquals(child.getOptionalMultiValuedDNProperty1(), |
| | | "dc=new value 1,dc=com", "dc=new value 2,dc=com"); |
| | | assertDNSetEquals(child.getOptionalMultiValuedDNProperty2(), |
| | |
| | | Assert.assertEquals(parent.getMandatoryClassProperty(), |
| | | "org.opends.server.extensions.UserDefinedVirtualAttributeProvider"); |
| | | Assert.assertEquals(parent.getMandatoryReadOnlyAttributeTypeProperty(), |
| | | DirectoryServer.getAttributeTypeOrNull("description")); |
| | | DirectoryServer.getAttributeType("description")); |
| | | assertDNSetEquals(parent.getOptionalMultiValuedDNProperty(), |
| | | "dc=domain1,dc=com", "dc=domain2,dc=com", "dc=domain3,dc=com"); |
| | | } |
| | |
| | | Assert.assertEquals(parent.getMandatoryClassProperty(), |
| | | "org.opends.server.extensions.UserDefinedVirtualAttributeProvider"); |
| | | Assert.assertEquals(parent.getMandatoryReadOnlyAttributeTypeProperty(), |
| | | DirectoryServer.getAttributeTypeOrNull("description")); |
| | | DirectoryServer.getAttributeType("description")); |
| | | assertDNSetEquals(parent.getOptionalMultiValuedDNProperty(), |
| | | "dc=default value p2v1,dc=com", "dc=default value p2v2,dc=com"); |
| | | } |
| | |
| | | Assert.assertEquals(child.getMandatoryClassProperty(), |
| | | "org.opends.server.extensions.UserDefinedVirtualAttributeProvider"); |
| | | Assert.assertEquals(child.getMandatoryReadOnlyAttributeTypeProperty(), |
| | | DirectoryServer.getAttributeTypeOrNull("description")); |
| | | DirectoryServer.getAttributeType("description")); |
| | | assertDNSetEquals(child.getOptionalMultiValuedDNProperty1(), |
| | | "dc=domain1,dc=com", "dc=domain2,dc=com", "dc=domain3,dc=com"); |
| | | assertDNSetEquals(child.getOptionalMultiValuedDNProperty2(), |
| | |
| | | Assert.assertEquals(child.getMandatoryClassProperty(), |
| | | "org.opends.server.extensions.UserDefinedVirtualAttributeProvider"); |
| | | Assert.assertEquals(child.getMandatoryReadOnlyAttributeTypeProperty(), |
| | | DirectoryServer.getAttributeTypeOrNull("description")); |
| | | DirectoryServer.getAttributeType("description")); |
| | | assertDNSetEquals(child.getOptionalMultiValuedDNProperty1(), |
| | | "dc=default value c2v1,dc=com", "dc=default value c2v2,dc=com"); |
| | | assertDNSetEquals(child.getOptionalMultiValuedDNProperty2(), |
| | |
| | | Assert.assertEquals(child.getMandatoryClassProperty(), |
| | | "org.opends.server.extensions.UserDefinedVirtualAttributeProvider"); |
| | | Assert.assertEquals(child.getMandatoryReadOnlyAttributeTypeProperty(), |
| | | DirectoryServer.getAttributeTypeOrNull("description")); |
| | | DirectoryServer.getAttributeType("description")); |
| | | assertDNSetEquals(child.getOptionalMultiValuedDNProperty1(), |
| | | "dc=default value c3v1,dc=com", "dc=default value c3v2,dc=com"); |
| | | assertDNSetEquals(child.getOptionalMultiValuedDNProperty2(), |
| | |
| | | Assert.assertEquals(child.getMandatoryClassProperty(), |
| | | "org.opends.server.extensions.UserDefinedVirtualAttributeProvider"); |
| | | Assert.assertEquals(child.getMandatoryReadOnlyAttributeTypeProperty(), |
| | | DirectoryServer.getAttributeTypeOrNull("description")); |
| | | DirectoryServer.getAttributeType("description")); |
| | | assertDNSetEquals(child.getOptionalMultiValuedDNProperty1(), |
| | | "dc=default value p2v1,dc=com", "dc=default value p2v2,dc=com"); |
| | | assertDNSetEquals(child.getOptionalMultiValuedDNProperty2(), |
| | |
| | | package org.opends.server.backends; |
| | | |
| | | import static org.opends.server.TestCaseUtils.*; |
| | | import static org.opends.server.core.DirectoryServer.*; |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.*; |
| | | import static org.opends.server.protocols.internal.Requests.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | |
| | | assertNotNull(schemaEntry); |
| | | assertEquals(schemaEntry.getName(), schemaDN); |
| | | |
| | | AttributeType t = DirectoryServer.getAttributeTypeOrNull("attributetypes"); |
| | | assertTrue(schemaEntry.hasAttribute(t)); |
| | | |
| | | t = DirectoryServer.getAttributeTypeOrNull("objectclasses"); |
| | | assertTrue(schemaEntry.hasAttribute(t)); |
| | | |
| | | t = DirectoryServer.getAttributeTypeOrNull("ldapsyntaxes"); |
| | | assertTrue(schemaEntry.hasAttribute(t)); |
| | | |
| | | t = DirectoryServer.getAttributeTypeOrNull("matchingrules"); |
| | | assertTrue(schemaEntry.hasAttribute(t)); |
| | | assertTrue(schemaEntry.hasAttribute(getAttributeType("attributetypes"))); |
| | | assertTrue(schemaEntry.hasAttribute(getAttributeType("objectclasses"))); |
| | | assertTrue(schemaEntry.hasAttribute(getAttributeType("ldapsyntaxes"))); |
| | | assertTrue(schemaEntry.hasAttribute(getAttributeType("matchingrules"))); |
| | | } |
| | | |
| | | /** |
| | |
| | | assertNotNull(schemaEntry); |
| | | assertEquals(schemaEntry.getName(), schemaDN); |
| | | |
| | | AttributeType t = DirectoryServer.getAttributeTypeOrNull("attributetypes"); |
| | | assertTrue(schemaEntry.hasAttribute(t)); |
| | | |
| | | t = DirectoryServer.getAttributeTypeOrNull("objectclasses"); |
| | | assertTrue(schemaEntry.hasAttribute(t)); |
| | | |
| | | t = DirectoryServer.getAttributeTypeOrNull("ldapsyntaxes"); |
| | | assertTrue(schemaEntry.hasAttribute(t)); |
| | | |
| | | t = DirectoryServer.getAttributeTypeOrNull("matchingrules"); |
| | | assertTrue(schemaEntry.hasAttribute(t)); |
| | | assertTrue(schemaEntry.hasAttribute(getAttributeType("attributetypes"))); |
| | | assertTrue(schemaEntry.hasAttribute(getAttributeType("objectclasses"))); |
| | | assertTrue(schemaEntry.hasAttribute(getAttributeType("ldapsyntaxes"))); |
| | | assertTrue(schemaEntry.hasAttribute(getAttributeType("matchingrules"))); |
| | | |
| | | schemaDN = DN.valueOf("cn=subschema"); |
| | | schemaEntry = schemaBackend.getSchemaEntry(schemaDN, false); |
| | | assertNotNull(schemaEntry); |
| | | assertEquals(schemaEntry.getName(), schemaDN); |
| | | |
| | | t = DirectoryServer.getAttributeTypeOrNull("attributetypes"); |
| | | assertTrue(schemaEntry.hasAttribute(t)); |
| | | |
| | | t = DirectoryServer.getAttributeTypeOrNull("objectclasses"); |
| | | assertTrue(schemaEntry.hasAttribute(t)); |
| | | |
| | | t = DirectoryServer.getAttributeTypeOrNull("ldapsyntaxes"); |
| | | assertTrue(schemaEntry.hasAttribute(t)); |
| | | |
| | | t = DirectoryServer.getAttributeTypeOrNull("matchingrules"); |
| | | assertTrue(schemaEntry.hasAttribute(t)); |
| | | assertTrue(schemaEntry.hasAttribute(getAttributeType("attributetypes"))); |
| | | assertTrue(schemaEntry.hasAttribute(getAttributeType("objectclasses"))); |
| | | assertTrue(schemaEntry.hasAttribute(getAttributeType("ldapsyntaxes"))); |
| | | assertTrue(schemaEntry.hasAttribute(getAttributeType("matchingrules"))); |
| | | } |
| | | |
| | | /** |
| | |
| | | throws Exception |
| | | { |
| | | DN schemaDN = DN.valueOf("cn=schema"); |
| | | AttributeType a = DirectoryServer.getAttributeTypeOrNull("attributetypes"); |
| | | AttributeType o = DirectoryServer.getAttributeTypeOrNull("objectclasses"); |
| | | AttributeType m = DirectoryServer.getAttributeTypeOrNull("matchingrules"); |
| | | AttributeType s = DirectoryServer.getAttributeTypeOrNull("ldapsyntaxes"); |
| | | AttributeType a = DirectoryServer.getAttributeType("attributetypes"); |
| | | AttributeType o = DirectoryServer.getAttributeType("objectclasses"); |
| | | AttributeType m = DirectoryServer.getAttributeType("matchingrules"); |
| | | AttributeType s = DirectoryServer.getAttributeType("ldapsyntaxes"); |
| | | |
| | | assertFalse(schemaBackend.showAllAttributes()); |
| | | Entry schemaEntry = schemaBackend.getSchemaEntry(schemaDN, false); |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2015 ForgeRock AS |
| | | * Copyright 2015-2016 ForgeRock AS |
| | | */ |
| | | package org.opends.server.backends.pluggable; |
| | | |
| | |
| | | |
| | | BackendIndexCfg indexCfg = legacyMockCfg(BackendIndexCfg.class); |
| | | when(indexCfg.getIndexType()).thenReturn(newTreeSet(IndexType.PRESENCE, IndexType.EQUALITY)); |
| | | when(indexCfg.getAttribute()).thenReturn(DirectoryServer.getAttributeTypeOrNull("sn")); |
| | | when(indexCfg.getAttribute()).thenReturn(DirectoryServer.getAttributeType("sn")); |
| | | when(backendCfg.getBackendIndex("sn")).thenReturn(indexCfg); |
| | | |
| | | return backendCfg; |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2015 ForgeRock AS |
| | | * Copyright 2015-2016 ForgeRock AS |
| | | */ |
| | | package org.opends.server.backends.pluggable; |
| | | |
| | |
| | | |
| | | BackendIndexCfg indexCfg = legacyMockCfg(BackendIndexCfg.class); |
| | | when(indexCfg.getIndexType()).thenReturn(newTreeSet(IndexType.PRESENCE, IndexType.EQUALITY)); |
| | | when(indexCfg.getAttribute()).thenReturn(DirectoryServer.getAttributeTypeOrNull("sn")); |
| | | when(indexCfg.getAttribute()).thenReturn(DirectoryServer.getAttributeType("sn")); |
| | | when(backendCfg.getBackendIndex("sn")).thenReturn(indexCfg); |
| | | |
| | | return backendCfg; |
| | |
| | | for (Map.Entry<String, IndexType[]> index : backendIndexes.entrySet()) |
| | | { |
| | | final String attributeName = index.getKey(); |
| | | final AttributeType attribute = DirectoryServer.getAttributeTypeOrNull(attributeName); |
| | | final AttributeType attribute = DirectoryServer.getAttributeType(attributeName); |
| | | Reject.ifNull(attribute, "Attribute type '" + attributeName + "' doesn't exists."); |
| | | |
| | | BackendIndexCfg indexCfg = mock(BackendIndexCfg.class); |
| | |
| | | { |
| | | for (IndexType type : index.getValue()) |
| | | { |
| | | final AttributeType attributeType = DirectoryServer.getAttributeTypeOrNull(index.getKey()); |
| | | final AttributeType attributeType = DirectoryServer.getAttributeType(index.getKey()); |
| | | assertTrue(backend.isIndexed(attributeType, |
| | | org.opends.server.types.IndexType.valueOf(type.toString().toUpperCase()))); |
| | | } |
| | |
| | | Entry oldEntry = workEntries.get(0); |
| | | Entry newEntry = oldEntry.duplicate(false); |
| | | |
| | | modifyAttribute = DirectoryServer.getAttributeTypeOrNull("jpegphoto"); |
| | | modifyAttribute = DirectoryServer.getAttributeType("jpegphoto"); |
| | | List<Modification> mods = Arrays.asList( |
| | | // unindexed |
| | | new Modification(ADD, create(modifyAttribute, modifyValue)), |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2015 ForgeRock AS |
| | | * Copyright 2015-2016 ForgeRock AS |
| | | */ |
| | | package org.opends.server.backends.pluggable; |
| | | |
| | |
| | | |
| | | BackendIndexCfg indexCfg = legacyMockCfg(BackendIndexCfg.class); |
| | | when(indexCfg.getIndexType()).thenReturn(newTreeSet(IndexType.PRESENCE, IndexType.EQUALITY)); |
| | | when(indexCfg.getAttribute()).thenReturn(DirectoryServer.getAttributeTypeOrNull("sn")); |
| | | when(indexCfg.getAttribute()).thenReturn(DirectoryServer.getAttributeType("sn")); |
| | | when(backendCfg.getBackendIndex("sn")).thenReturn(indexCfg); |
| | | |
| | | return backendCfg; |
| | |
| | | } |
| | | |
| | | |
| | | AttributeType attType = DirectoryServer.getAttributeTypeOrNull(type); |
| | | AttributeType attType = DirectoryServer.getAttributeType(type); |
| | | ByteString attVal = null; |
| | | if (attType != null) |
| | | { |
| | |
| | | |
| | | // input parameter |
| | | String rawAttTypeTest = type; |
| | | AttributeType attTypeTest = DirectoryServer.getAttributeTypeOrNull(type); |
| | | AttributeType attTypeTest = DirectoryServer.getAttributeType(type); |
| | | ByteString subInitialTest = ByteString.valueOfUtf8(subInitial); |
| | | List<ByteString> subAnyTest = new ArrayList<>(subAny.size()); |
| | | for (String s : subAny) |
| | |
| | | } |
| | | |
| | | // ( AttributeType attributeType, ByteString assertionValue |
| | | AttributeType attType = DirectoryServer.getAttributeTypeOrNull(type); |
| | | AttributeType attType = DirectoryServer.getAttributeType(type); |
| | | ByteString attVal = null; |
| | | if (attType != null) |
| | | { |
| | |
| | | } |
| | | |
| | | |
| | | AttributeType attType = DirectoryServer.getAttributeTypeOrNull(type); |
| | | AttributeType attType = DirectoryServer.getAttributeType(type); |
| | | ByteString attVal = null ; |
| | | if (attType != null) |
| | | { |
| | |
| | | assertEquals(mvf.getMatchType(), MatchedValuesFilter.PRESENT_TYPE); |
| | | |
| | | // ( AttributeType attributeType |
| | | AttributeType attType = DirectoryServer.getAttributeTypeOrNull(type); |
| | | AttributeType attType = DirectoryServer.getAttributeType(type); |
| | | |
| | | try |
| | | { |
| | |
| | | } |
| | | |
| | | // ( AttributeType attributeType, ByteString assertionValue |
| | | AttributeType attType = DirectoryServer.getAttributeTypeOrNull(type); |
| | | AttributeType attType = DirectoryServer.getAttributeType(type); |
| | | ByteString attVal = null ; |
| | | if (attType != null) |
| | | { |
| | |
| | | |
| | | // input value |
| | | String rawAttTypeTest = type ; |
| | | AttributeType attTypeTest = DirectoryServer.getAttributeTypeOrNull(type) ; |
| | | AttributeType attTypeTest = DirectoryServer.getAttributeType(type) ; |
| | | String matchingRuleIdTest = matchingRule.getOID() ; |
| | | ByteString attValueTest = (attTypeTest == null) ? null : ByteString.valueOfUtf8(value); |
| | | // parameter used for the test. |
| | |
| | | public void testDifferentNormalization(String type, ByteString value, |
| | | String assertion) |
| | | { |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrNull("usercertificate"); |
| | | AttributeType attrType = DirectoryServer.getAttributeType("usercertificate"); |
| | | MatchedValuesFilter mvf = MatchedValuesFilter.createEqualityFilter(type, ByteString.valueOfUtf8(assertion)); |
| | | assertTrue(mvf.valueMatches(attrType, value)); |
| | | } |
| | |
| | | { |
| | | TestCaseUtils.startServer(); |
| | | |
| | | givenNameType = DirectoryServer.getAttributeTypeOrNull("givenname"); |
| | | givenNameType = DirectoryServer.getAttributeType("givenname"); |
| | | assertNotNull(givenNameType); |
| | | |
| | | snType = DirectoryServer.getAttributeTypeOrNull("sn"); |
| | | snType = DirectoryServer.getAttributeType("sn"); |
| | | assertNotNull(snType); |
| | | |
| | | aaccfJohnsonDN = DN.valueOf("uid=aaccf.johnson,dc=example,dc=com"); |
| | |
| | | { |
| | | TestCaseUtils.startServer(); |
| | | |
| | | givenNameType = DirectoryServer.getAttributeTypeOrNull("givenname"); |
| | | givenNameType = DirectoryServer.getAttributeType("givenname"); |
| | | assertNotNull(givenNameType); |
| | | |
| | | snType = DirectoryServer.getAttributeTypeOrNull("sn"); |
| | | snType = DirectoryServer.getAttributeType("sn"); |
| | | assertNotNull(snType); |
| | | |
| | | aaccfJohnsonDN = DN.valueOf("uid=aaccf.johnson,dc=example,dc=com"); |
| | |
| | | "objectClass: organization", |
| | | "o: test"); |
| | | |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrNull("description"); |
| | | AttributeType attrType = DirectoryServer.getAttributeType("description"); |
| | | Map<AttributeType,List<Attribute>> userAttrs = entry.getUserAttributes(); |
| | | userAttrs.put(attrType, newArrayList(Attributes.empty(attrType))); |
| | | |
| | |
| | | { |
| | | PasswordPolicy p = DirectoryServer.getDefaultPasswordPolicy(); |
| | | AttributeType t = p.getPasswordAttribute(); |
| | | assertEquals(t, DirectoryServer.getAttributeTypeOrNull("userpassword")); |
| | | assertEquals(t, DirectoryServer.getAttributeType("userpassword")); |
| | | } |
| | | |
| | | |
| | |
| | | "cn=config"); |
| | | PasswordPolicy p = (PasswordPolicy) DirectoryServer.getAuthenticationPolicy(dn); |
| | | AttributeType t = p.getPasswordAttribute(); |
| | | assertEquals(t, DirectoryServer.getAttributeTypeOrNull("authpassword")); |
| | | assertEquals(t, DirectoryServer.getAttributeType("authpassword")); |
| | | } |
| | | |
| | | |
| | |
| | | { |
| | | Entry entry = DirectoryServer.getEntry(DN.valueOf(dn)); |
| | | assertNotNull(entry); |
| | | AttributeType pwdHistory = DirectoryServer.getAttributeTypeOrNull("pwdhistory"); |
| | | AttributeType pwdHistory = DirectoryServer.getAttributeType("pwdhistory"); |
| | | assertNotNull(pwdHistory); |
| | | Attribute historyAttr = entry.getExactAttribute(pwdHistory, null); |
| | | assertNotNull(historyAttr); |
| | |
| | | private void hasValues(DN dn, String attrName, String... values) throws DirectoryException |
| | | { |
| | | Entry entry = DirectoryServer.getEntry(dn); |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(attrName); |
| | | AttributeType attrType = DirectoryServer.getAttributeType(attrName); |
| | | assertTrue(entry.hasAttribute(attrType)); |
| | | for (String value : values) |
| | | { |
| | |
| | | private void doesNotHaveValues(DN dn, String attrName, String... values) throws DirectoryException |
| | | { |
| | | Entry entry = DirectoryServer.getEntry(dn); |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(attrName); |
| | | AttributeType attrType = DirectoryServer.getAttributeType(attrName); |
| | | assertTrue(entry.hasAttribute(attrType)); |
| | | for (String value : values) |
| | | { |
| | |
| | | private void hasNoAttribute(DN dn, String attrName) throws Exception |
| | | { |
| | | Entry entry = DirectoryServer.getEntry(dn); |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(attrName); |
| | | AttributeType attrType = DirectoryServer.getAttributeType(attrName); |
| | | assertFalse(entry.hasAttribute(attrType)); |
| | | } |
| | | |
| | |
| | | |
| | | assertEquals(searchOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertEquals(searchOperation.getEntriesSent(), 1); |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrNull("collectiveattributesubentries"); |
| | | AttributeType attrType = DirectoryServer.getAttributeType("collectiveattributesubentries"); |
| | | Entry e = searchOperation.getSearchEntries().getFirst(); |
| | | assertTrue(e.hasValue(attrType, null, ByteString.valueOfObject(collectiveSubentry.getName()))); |
| | | } |
| | |
| | | Entry testEntry = DirectoryServer.getEntry(DN.valueOf("uid=rogasawara," + BASE)); |
| | | assertNotNull(testEntry); |
| | | |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrNull("pwdpolicysubentry"); |
| | | AttributeType attrType = DirectoryServer.getAttributeType("pwdpolicysubentry"); |
| | | |
| | | // Make sure that default policy is in effect |
| | | // for the user entry. |
| | |
| | | |
| | | private void assertAttrValue(Entry newEntry, String attrName, String expectedAttrValue) |
| | | { |
| | | AttributeType at = DirectoryServer.getAttributeTypeOrNull(attrName); |
| | | AttributeType at = DirectoryServer.getAttributeType(attrName); |
| | | List<Attribute> attrList = newEntry.getAttribute(at); |
| | | assertThat(attrList).hasSize(1); |
| | | |
| | |
| | | TestCaseUtils.startServer(); |
| | | |
| | | // Initialize the provider. |
| | | config.getExcludedAttribute().add(DirectoryServer.getAttributeTypeOrNull("modifytimestamp")); |
| | | config.getExcludedAttribute().add(DirectoryServer.getAttributeType("modifytimestamp")); |
| | | provider.initializeVirtualAttributeProvider(config); |
| | | } |
| | | |
| | |
| | | final SearchOperation searchOp = mock(SearchOperation.class); |
| | | |
| | | VirtualAttributeRule rule = new VirtualAttributeRule( |
| | | DirectoryServer.getAttributeTypeOrNull(ETAG), provider, |
| | | DirectoryServer.getAttributeType(ETAG), provider, |
| | | Collections.<DN> emptySet(), SearchScope.WHOLE_SUBTREE, |
| | | Collections.<DN> emptySet(), Collections.<SearchFilter> emptySet(), |
| | | VirtualAttributeCfgDefn.ConflictBehavior.REAL_OVERRIDES_VIRTUAL); |
| | |
| | | |
| | | private VirtualAttributeRule getRule() |
| | | { |
| | | AttributeType type = DirectoryServer.getAttributeTypeOrNull("etag"); |
| | | AttributeType type = DirectoryServer.getAttributeType("etag"); |
| | | return new VirtualAttributeRule(type, provider, |
| | | Collections.<DN>emptySet(), SearchScope.WHOLE_SUBTREE, |
| | | Collections.<DN>emptySet(), |
| | |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | TestCaseUtils.clearBackend("userRoot", "dc=example,dc=com"); |
| | | |
| | | entryDNType = DirectoryServer.getAttributeTypeOrNull("entrydn"); |
| | | entryDNType = DirectoryServer.getAttributeType("entrydn"); |
| | | assertNotNull(entryDNType); |
| | | } |
| | | |
| | |
| | | { |
| | | TestCaseUtils.startServer(); |
| | | |
| | | entryUUIDType = DirectoryServer.getAttributeTypeOrNull("entryuuid"); |
| | | entryUUIDType = DirectoryServer.getAttributeType("entryuuid"); |
| | | assertNotNull(entryUUIDType); |
| | | } |
| | | |
| | |
| | | "ds-cfg-enabled: true", |
| | | "ds-cfg-match-attribute: uid"); |
| | | |
| | | AttributeType t = DirectoryServer.getAttributeTypeOrNull("ds-cfg-match-base-dn"); |
| | | AttributeType t = DirectoryServer.getAttributeType("ds-cfg-match-base-dn"); |
| | | e.addAttribute(Attributes.empty(t), new ArrayList<ByteString>()); |
| | | entries.add(e); |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012-2015 ForgeRock AS |
| | | * Portions Copyright 2012-2016 ForgeRock AS |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | { |
| | | String mapperDN = "cn=Fingerprint Mapper,cn=Certificate Mappers,cn=config"; |
| | | |
| | | Attribute a = Attributes.empty(DirectoryServer.getAttributeTypeOrNull("ds-cfg-fingerprint-attribute")); |
| | | Attribute a = Attributes.empty(DirectoryServer.getAttributeType("ds-cfg-fingerprint-attribute")); |
| | | |
| | | ArrayList<Modification> mods = newArrayList(new Modification(DELETE, a)); |
| | | ModifyOperation modifyOperation = |
| | |
| | | { |
| | | String mapperDN = "cn=Fingerprint Mapper,cn=Certificate Mappers,cn=config"; |
| | | |
| | | Attribute a = Attributes.empty(DirectoryServer.getAttributeTypeOrNull("ds-cfg-fingerprint-algorithm")); |
| | | Attribute a = Attributes.empty(DirectoryServer.getAttributeType("ds-cfg-fingerprint-algorithm")); |
| | | |
| | | ArrayList<Modification> mods = newArrayList(new Modification(DELETE, a)); |
| | | ModifyOperation modifyOperation = |
| | |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | TestCaseUtils.clearBackend("userRoot", "dc=example,dc=com"); |
| | | |
| | | governingStructureRuleType = DirectoryServer.getAttributeTypeOrNull("governingstructurerule"); |
| | | governingStructureRuleType = DirectoryServer.getAttributeType("governingstructurerule"); |
| | | assertNotNull(governingStructureRuleType); |
| | | int resultCode = TestCaseUtils.applyModifications(true, |
| | | "dn: cn=schema", |
| | |
| | | { |
| | | TestCaseUtils.startServer(); |
| | | |
| | | hasSubordinatesType = DirectoryServer.getAttributeTypeOrNull("hassubordinates"); |
| | | hasSubordinatesType = DirectoryServer.getAttributeType("hassubordinates"); |
| | | assertNotNull(hasSubordinatesType); |
| | | |
| | | entries = TestCaseUtils.makeEntries( |
| | |
| | | { |
| | | TestCaseUtils.restartServer(); |
| | | |
| | | isMemberOfType = DirectoryServer.getAttributeTypeOrNull("ismemberof"); |
| | | isMemberOfType = DirectoryServer.getAttributeType("ismemberof"); |
| | | assertNotNull(isMemberOfType); |
| | | } |
| | | |
| | |
| | | { |
| | | TestCaseUtils.restartServer(); |
| | | |
| | | numSubordinatesType = DirectoryServer.getAttributeTypeOrNull("numsubordinates"); |
| | | numSubordinatesType = DirectoryServer.getAttributeType("numsubordinates"); |
| | | assertNotNull(numSubordinatesType); |
| | | |
| | | entries = TestCaseUtils.makeEntries( |
| | |
| | | |
| | | try |
| | | { |
| | | AttributeType lastLoginTimeAttr = DirectoryServer.getAttributeTypeOrNull("ds-pwp-last-login-time"); |
| | | AttributeType lastLoginTimeAttr = DirectoryServer.getAttributeType("ds-pwp-last-login-time"); |
| | | assertNotNull(lastLoginTimeAttr); |
| | | |
| | | DN userDN = DN.valueOf("uid=test.user,o=test"); |
| | |
| | | |
| | | try |
| | | { |
| | | AttributeType authFailureTimesAttr = DirectoryServer.getAttributeTypeOrNull("pwdfailuretime"); |
| | | AttributeType authFailureTimesAttr = DirectoryServer.getAttributeType("pwdfailuretime"); |
| | | assertNotNull(authFailureTimesAttr); |
| | | |
| | | DN userDN = DN.valueOf("uid=test.user,o=test"); |
| | |
| | | |
| | | try |
| | | { |
| | | AttributeType pwdHistoryAttr = DirectoryServer.getAttributeTypeOrNull("pwdhistory"); |
| | | AttributeType pwdHistoryAttr = DirectoryServer.getAttributeType("pwdhistory"); |
| | | assertNotNull(pwdHistoryAttr); |
| | | |
| | | DN userDN = DN.valueOf("uid=test.user,o=test"); |
| | |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | TestCaseUtils.clearBackend("userRoot", "dc=example,dc=com"); |
| | | |
| | | structuralObjectClassType = DirectoryServer.getAttributeTypeOrNull("structuralobjectclass"); |
| | | structuralObjectClassType = DirectoryServer.getAttributeType("structuralobjectclass"); |
| | | assertNotNull(structuralObjectClassType); |
| | | } |
| | | |
| | |
| | | { |
| | | String mapperDN = "cn=Subject Attribute to User Attribute,cn=Certificate Mappers,cn=config"; |
| | | |
| | | Attribute a = Attributes.empty(DirectoryServer.getAttributeTypeOrNull("ds-cfg-subject-attribute-mapping")); |
| | | Attribute a = Attributes.empty(DirectoryServer.getAttributeType("ds-cfg-subject-attribute-mapping")); |
| | | |
| | | ArrayList<Modification> mods = newArrayList( |
| | | new Modification(ModificationType.DELETE, a)); |
| | |
| | | { |
| | | String mapperDN = "cn=Subject Attribute to User Attribute,cn=Certificate Mappers,cn=config"; |
| | | |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrNull("ds-cfg-user-base-dn"); |
| | | AttributeType attrType = DirectoryServer.getAttributeType("ds-cfg-user-base-dn"); |
| | | AttributeBuilder builder = new AttributeBuilder(attrType); |
| | | if (baseDNs != null) |
| | | { |
| | |
| | | throws Exception |
| | | { |
| | | String mapperDN = "cn=Subject DN to User Attribute,cn=Certificate Mappers,cn=config"; |
| | | Attribute a = Attributes.empty(DirectoryServer.getAttributeTypeOrNull("ds-cfg-subject-attribute")); |
| | | Attribute a = Attributes.empty(DirectoryServer.getAttributeType("ds-cfg-subject-attribute")); |
| | | |
| | | ArrayList<Modification> mods = newArrayList(new Modification(ModificationType.DELETE, a)); |
| | | ModifyOperation modifyOperation = |
| | |
| | | { |
| | | String mapperDN = "cn=Subject DN to User Attribute,cn=Certificate Mappers,cn=config"; |
| | | |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrNull("ds-cfg-user-base-dn"); |
| | | AttributeType attrType = DirectoryServer.getAttributeType("ds-cfg-user-base-dn"); |
| | | AttributeBuilder builder = new AttributeBuilder(attrType); |
| | | if (baseDNs != null) |
| | | { |
| | |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | TestCaseUtils.clearBackend("userRoot", "dc=example,dc=com"); |
| | | |
| | | subschemaSubentryType = DirectoryServer.getAttributeTypeOrNull("subschemasubentry"); |
| | | subschemaSubentryType = DirectoryServer.getAttributeType("subschemasubentry"); |
| | | assertNotNull(subschemaSubentryType); |
| | | } |
| | | |
| | |
| | | { |
| | | TestCaseUtils.startServer(); |
| | | |
| | | descriptionType = DirectoryServer.getAttributeTypeOrNull("description"); |
| | | descriptionType = DirectoryServer.getAttributeType("description"); |
| | | assertNotNull(descriptionType); |
| | | |
| | | pwPolicyDNType = DirectoryServer.getAttributeTypeOrNull("ds-pwp-password-policy-dn"); |
| | | pwPolicyDNType = DirectoryServer.getAttributeType("ds-pwp-password-policy-dn"); |
| | | assertNotNull(pwPolicyDNType); |
| | | |
| | | privNameType = DirectoryServer.getAttributeTypeOrNull("ds-privilege-name"); |
| | | privNameType = DirectoryServer.getAttributeType("ds-privilege-name"); |
| | | assertNotNull(privNameType); |
| | | } |
| | | |
| | |
| | | { |
| | | TestCaseUtils.startServer(); |
| | | |
| | | memberType = DirectoryServer.getAttributeTypeOrNull("member"); |
| | | memberType = DirectoryServer.getAttributeType("member"); |
| | | assertNotNull(memberType); |
| | | |
| | | uniqueMemberType = DirectoryServer.getAttributeTypeOrNull("uniquemember"); |
| | | uniqueMemberType = DirectoryServer.getAttributeType("uniquemember"); |
| | | assertNotNull(uniqueMemberType); |
| | | |
| | | groupManager = DirectoryServer.getGroupManager(); |
| | |
| | | public void testInitializeWithValidConfigsWithoutSchema(Entry e) |
| | | throws Exception |
| | | { |
| | | AttributeType entryUUIDType = DirectoryServer.getAttributeTypeOrNull("entryuuid"); |
| | | AttributeType entryUUIDType = DirectoryServer.getAttributeType("entryuuid"); |
| | | DirectoryServer.deregisterAttributeType(entryUUIDType); |
| | | |
| | | HashSet<PluginType> pluginTypes = TestCaseUtils.getPluginTypes(e); |
| | |
| | | public void testInitializeWithValidConfigsWithoutSchema(Entry e) |
| | | throws Exception |
| | | { |
| | | AttributeType ctType = DirectoryServer.getAttributeTypeOrNull("createtimestamp"); |
| | | AttributeType cnType = DirectoryServer.getAttributeTypeOrNull("creatorsname"); |
| | | AttributeType mtType = DirectoryServer.getAttributeTypeOrNull("modifytimestamp"); |
| | | AttributeType mnType = DirectoryServer.getAttributeTypeOrNull("modifiersname"); |
| | | AttributeType ctType = DirectoryServer.getAttributeType("createtimestamp"); |
| | | AttributeType cnType = DirectoryServer.getAttributeType("creatorsname"); |
| | | AttributeType mtType = DirectoryServer.getAttributeType("modifytimestamp"); |
| | | AttributeType mnType = DirectoryServer.getAttributeType("modifiersname"); |
| | | |
| | | DirectoryServer.deregisterAttributeType(ctType); |
| | | DirectoryServer.deregisterAttributeType(cnType); |
| | |
| | | * |
| | | * |
| | | * Copyright 2007-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2015 ForgeRock AS |
| | | * Portions Copyright 2011-2016 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication; |
| | | |
| | |
| | | int sequence; |
| | | for (sequence = 1; sequence<=addSequenceLength; sequence ++) |
| | | { |
| | | entry.removeAttribute(getAttributeTypeOrNull("entryuuid")); |
| | | entry.removeAttribute(getAttributeType("entryuuid")); |
| | | entry.addAttribute(Attributes.create("entryuuid", stringUID(sequence+1)), |
| | | new LinkedList<ByteString>()); |
| | | addDN = DN.valueOf("dc=dependency" + sequence + "," + addDN); |
| | |
| | | baseDN, brokerId, 1000, replServer.getReplicationPort(), 1000, CLEAN_DB_GENERATION_ID); |
| | | |
| | | // add an entry to play with. |
| | | entry.removeAttribute(getAttributeTypeOrNull("entryuuid")); |
| | | entry.removeAttribute(getAttributeType("entryuuid")); |
| | | entry.addAttribute(Attributes.create("entryuuid", |
| | | stringUID(renamedEntryUuid)), |
| | | new LinkedList<ByteString>()); |
| | |
| | | for (sequence = 1; sequence<=addSequenceLength; sequence ++) |
| | | { |
| | | // add the entry a first time |
| | | entry.removeAttribute(getAttributeTypeOrNull("entryuuid")); |
| | | entry.removeAttribute(getAttributeType("entryuuid")); |
| | | entry.addAttribute(Attributes.create("entryuuid", stringUID(sequence+1)), |
| | | new LinkedList<ByteString>()); |
| | | DN addDN = DN.valueOf("dc=dependency" + sequence + "," + TEST_ROOT_DN_STRING); |
| | |
| | | broker.publish(delMsg(addDN, sequence + 1, gen)); |
| | | |
| | | // add again the entry with a new entryuuid. |
| | | entry.removeAttribute(getAttributeTypeOrNull("entryuuid")); |
| | | entry.removeAttribute(getAttributeType("entryuuid")); |
| | | entry.addAttribute(Attributes.create("entryuuid", stringUID(sequence+1025)), |
| | | new LinkedList<ByteString>()); |
| | | broker.publish(addMsg(addDN, entry, sequence + 1025, 1, gen)); |
| | |
| | | for (sequence = 1; sequence<=addSequenceLength; sequence ++) |
| | | { |
| | | // add the entry |
| | | entry.removeAttribute(getAttributeTypeOrNull("entryuuid")); |
| | | entry.removeAttribute(getAttributeType("entryuuid")); |
| | | entry.addAttribute(Attributes.create("entryuuid", stringUID(sequence+1)), |
| | | new LinkedList<ByteString>()); |
| | | addDN = DN.valueOf("dc=dependency" + sequence + "," + TEST_ROOT_DN_STRING); |
| | |
| | | { |
| | | debugInfo("Entry found <" + baseDN + ">"); |
| | | |
| | | AttributeType synchronizationGenIDType = DirectoryServer.getAttributeTypeOrNull(REPLICATION_GENERATION_ID); |
| | | AttributeType synchronizationGenIDType = DirectoryServer.getAttributeType(REPLICATION_GENERATION_ID); |
| | | Attribute attr = resultEntry.getExactAttribute(synchronizationGenIDType, new HashSet<String>()); |
| | | return Long.valueOf(attr.iterator().next().toString()); |
| | | } |
| | |
| | | { |
| | | testSetUp("modifyConflicts"); |
| | | final DN dn1 = DN.valueOf("cn=test1," + baseDN); |
| | | final AttributeType attrType = DirectoryServer.getAttributeTypeOrNull("displayname"); |
| | | final AttributeType entryuuidType = DirectoryServer.getAttributeTypeOrNull("entryuuid"); |
| | | final AttributeType attrType = DirectoryServer.getAttributeType("displayname"); |
| | | final AttributeType entryuuidType = DirectoryServer.getAttributeType("entryuuid"); |
| | | String monitorAttr = "resolved-modify-conflicts"; |
| | | |
| | | /* |
| | |
| | | assertEquals(attrInfo4.getValuesHistorical().size(), 1); |
| | | |
| | | // Check |
| | | AttributeType type = DirectoryServer.getAttributeTypeOrNull(ATTRIBUTE_NAME); |
| | | AttributeType type = DirectoryServer.getAttributeType(ATTRIBUTE_NAME); |
| | | attrInfo3.delete(Attributes.create(type, att), updateTime) ; |
| | | assertEquals(attrInfo3.getValuesHistorical().size(), 1); |
| | | |
| | |
| | | debugInfo("Entry found <" + rootDn + ">"); |
| | | |
| | | AttributeType synchronizationGenIDType = |
| | | DirectoryServer.getAttributeTypeOrNull(REPLICATION_GENERATION_ID); |
| | | DirectoryServer.getAttributeType(REPLICATION_GENERATION_ID); |
| | | List<Attribute> attrs = resultEntry.getAttribute(synchronizationGenIDType); |
| | | if (!attrs.isEmpty()) |
| | | { |
| | |
| | | { |
| | | if (!first) |
| | | { |
| | | assertFalse(newEntry.hasAttribute(DirectoryServer.getAttributeTypeOrNull(fracAttr))); |
| | | assertFalse(newEntry.hasAttribute(DirectoryServer.getAttributeType(fracAttr))); |
| | | } |
| | | first = false; |
| | | } |
| | |
| | | } |
| | | first = false; |
| | | } |
| | | assertFalse(newEntry.hasAttribute(DirectoryServer.getAttributeTypeOrNull(OPTIONAL_ATTR))); |
| | | assertFalse(newEntry.hasAttribute(DirectoryServer.getAttributeType(OPTIONAL_ATTR))); |
| | | break; |
| | | default: |
| | | fail("Unexpected fractional mode."); |
| | |
| | | { |
| | | if (!first) |
| | | { |
| | | assertFalse(entry.hasAttribute(DirectoryServer.getAttributeTypeOrNull(fracAttr))); |
| | | assertFalse(entry.hasAttribute(DirectoryServer.getAttributeType(fracAttr))); |
| | | } |
| | | first = false; |
| | | } |
| | |
| | | } |
| | | first = false; |
| | | } |
| | | assertFalse(entry.hasAttribute(DirectoryServer.getAttributeTypeOrNull(OPTIONAL_ATTR))); |
| | | assertFalse(entry.hasAttribute(DirectoryServer.getAttributeType(OPTIONAL_ATTR))); |
| | | break; |
| | | default: |
| | | fail("Unexpected fractional mode."); |
| | |
| | | private Entry waitTillEntryHasSynchroAttribute(String entryDN) |
| | | throws Exception |
| | | { |
| | | AttributeType synchroAttrType = DirectoryServer.getAttributeTypeOrNull(SYNCHRO_OPTIONAL_ATTR); |
| | | AttributeType synchroAttrType = DirectoryServer.getAttributeType(SYNCHRO_OPTIONAL_ATTR); |
| | | DN dn = DN.valueOf(entryDN); |
| | | |
| | | Entry entry = null; |
| | |
| | | long startTime = TimeThread.getTime(); |
| | | final DN dn1 = DN.valueOf("cn=test1," + baseDN); |
| | | final AttributeType histType = |
| | | DirectoryServer.getAttributeTypeOrNull(EntryHistorical.HISTORICAL_ATTRIBUTE_NAME); |
| | | DirectoryServer.getAttributeType(EntryHistorical.HISTORICAL_ATTRIBUTE_NAME); |
| | | |
| | | logger.error(LocalizableMessage.raw("Starting replication test : changesCmpTest")); |
| | | |
| | |
| | | final DN dn1 = DN.valueOf("cn=test1," + TEST_ROOT_DN_STRING); |
| | | final DN dn2 = DN.valueOf("cn=test2," + TEST_ROOT_DN_STRING); |
| | | final DN baseDN = DN.valueOf(TEST_ROOT_DN_STRING); |
| | | final AttributeType attrType = DirectoryServer.getAttributeTypeOrNull("displayname"); |
| | | final AttributeType entryuuidType = DirectoryServer.getAttributeTypeOrNull("entryuuid"); |
| | | final AttributeType attrType = DirectoryServer.getAttributeType("displayname"); |
| | | final AttributeType entryuuidType = DirectoryServer.getAttributeType("entryuuid"); |
| | | |
| | | /* |
| | | * Open a session to the replicationServer using the broker API. |
| | |
| | | |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ModificationType; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.ModifyOperationBasis; |
| | | import org.opends.server.replication.ReplicationTestCase; |
| | |
| | | import org.opends.server.replication.protocol.LDAPUpdateMsg; |
| | | import org.opends.server.replication.protocol.ModifyContext; |
| | | import org.opends.server.replication.protocol.ReplicationMsg; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.server.types.*; |
| | | import org.opends.server.types.Attribute; |
| | | import org.opends.server.types.AttributeBuilder; |
| | | import org.opends.server.types.Attributes; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.Modification; |
| | | import org.opends.server.types.ObjectClass; |
| | | import org.opends.server.workflowelement.localbackend.LocalBackendModifyOperation; |
| | | import org.testng.annotations.Test; |
| | | |
| | |
| | | UUID uuid = UUID.randomUUID(); |
| | | |
| | | // Create the att values list |
| | | AttributeType entryuuidAttrType = getAttributeTypeOrNull(ENTRYUUID_ATTRIBUTE_NAME); |
| | | AttributeType entryuuidAttrType = getAttributeType(ENTRYUUID_ATTRIBUTE_NAME); |
| | | List<Attribute> uuidList = Attributes.createAsList(entryuuidAttrType, uuid.toString()); |
| | | |
| | | // Add the uuid in the entry |
| | |
| | | */ |
| | | private void assertEntryHistoricalEncodingDecoding(Entry entry, EntryHistorical hist) |
| | | { |
| | | entry.removeAttribute(getAttributeTypeOrNull(HISTORICAL_ATTRIBUTE_NAME)); |
| | | entry.removeAttribute(getAttributeType(HISTORICAL_ATTRIBUTE_NAME)); |
| | | entry.addAttribute(hist.encodeAndPurge(), null); |
| | | EntryHistorical hist2 = EntryHistorical.newInstanceFromEntry(entry); |
| | | assertEquals(hist2.encodeAndPurge(), hist.encodeAndPurge()); |
| | |
| | | |
| | | private void assertContainsOnlyValues(Entry entry, String attrName, String... expectedValues) |
| | | { |
| | | Attribute attr = entry.getExactAttribute(getAttributeTypeOrNull(attrName), Collections.<String> emptySet()); |
| | | Attribute attr = entry.getExactAttribute(getAttributeType(attrName), Collections.<String> emptySet()); |
| | | assertThat(attr).hasSize(expectedValues.length); |
| | | for (String value : expectedValues) |
| | | { |
| | |
| | | |
| | | private String getEntryUUID(Entry entry) |
| | | { |
| | | AttributeType entryuuidAttrType = getAttributeTypeOrNull(ENTRYUUID_ATTRIBUTE_NAME); |
| | | AttributeType entryuuidAttrType = getAttributeType(ENTRYUUID_ATTRIBUTE_NAME); |
| | | List<Attribute> uuidAttrs = entry.getOperationalAttributes().get(entryuuidAttrType); |
| | | return uuidAttrs.get(0).iterator().next().toString(); |
| | | } |
| | |
| | | CSN csn1 = new CSN(1, 0, 1); |
| | | CSN csn2 = new CSN(TimeThread.getTime(), 123, 45); |
| | | |
| | | AttributeType type = DirectoryServer.getAttributeTypeOrNull("description"); |
| | | AttributeType type = DirectoryServer.getAttributeType("description"); |
| | | |
| | | Attribute attr1 = Attributes.create("description", "new value"); |
| | | Modification mod1 = new Modification(ModificationType.REPLACE, attr1); |
| | |
| | | @DataProvider(name = "createModifyDnData") |
| | | public Object[][] createModifyDnData() { |
| | | |
| | | AttributeType type = DirectoryServer.getAttributeTypeOrNull("description"); |
| | | AttributeType type = DirectoryServer.getAttributeType("description"); |
| | | |
| | | Attribute attr1 = Attributes.create("description", "new value"); |
| | | Modification mod1 = new Modification(ModificationType.REPLACE, attr1); |
| | |
| | | CSN csn2 = new CSN(TimeThread.getTime(), 123, 45); |
| | | CSN csn3 = new CSN(TimeThread.getTime(), 67894123, 45678); |
| | | |
| | | AttributeType type = DirectoryServer.getAttributeTypeOrNull("description"); |
| | | AttributeType type = DirectoryServer.getAttributeType("description"); |
| | | |
| | | Attribute attr1 = Attributes.create("description", "new value"); |
| | | Modification mod1 = new Modification(ModificationType.REPLACE, attr1); |
| | |
| | | @DataProvider(name = "createModifyDnData") |
| | | public Object[][] createModifyDnData() { |
| | | |
| | | AttributeType type = DirectoryServer.getAttributeTypeOrNull("description"); |
| | | AttributeType type = DirectoryServer.getAttributeType("description"); |
| | | |
| | | Attribute attr1 = Attributes.create("description", "new value"); |
| | | Modification mod1 = new Modification(ModificationType.REPLACE, attr1); |
| | |
| | | |
| | | FakeEntryIndex(String attrName) throws DecodeException |
| | | { |
| | | attrType = DirectoryServer.getAttributeTypeOrNull(attrName); |
| | | attrType = DirectoryServer.getAttributeType(attrName); |
| | | if (attrType == null) |
| | | { |
| | | throw new IllegalArgumentException("Cannot find attribute with name \"" + attrName + "\""); |
| | |
| | | continue; |
| | | } |
| | | |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrNull("attributetypes"); |
| | | AttributeType attrType = DirectoryServer.getAttributeType("attributetypes"); |
| | | assertNotNull(attrType); |
| | | List<Attribute> attrList = e.getAttribute(attrType); |
| | | if (attrList.isEmpty()) |
| | |
| | | continue; |
| | | } |
| | | |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrNull("objectclasses"); |
| | | AttributeType attrType = DirectoryServer.getAttributeType("objectclasses"); |
| | | assertNotNull(attrType); |
| | | List<Attribute> attrList = e.getAttribute(attrType); |
| | | if (attrList.isEmpty()) |
| | |
| | | continue; |
| | | } |
| | | |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrNull("nameforms"); |
| | | AttributeType attrType = DirectoryServer.getAttributeType("nameforms"); |
| | | assertNotNull(attrType); |
| | | List<Attribute> attrList = e.getAttribute(attrType); |
| | | if (attrList.isEmpty()) |
| | |
| | | TestCaseUtils.startServer(); |
| | | |
| | | // Initialize the CN attribute type used in all tests. |
| | | cnType = DirectoryServer.getAttributeTypeOrNull("cn"); |
| | | cnType = DirectoryServer.getAttributeType("cn"); |
| | | Assert.assertNotNull(cnType); |
| | | |
| | | cnValue = ByteString.valueOfUtf8("john doe"); |
| | |
| | | */ |
| | | package org.opends.server.types; |
| | | |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | |
| | | import static org.opends.server.types.AcceptRejectWarn.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | |
| | | |
| | | import org.forgerock.i18n.LocalizableMessageBuilder; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.tools.LDAPModify; |
| | |
| | | "objectClass: domain", |
| | | "dc: example"); |
| | | |
| | | AttributeType creatorsNameType = DirectoryServer.getAttributeTypeOrNull("creatorsname"); |
| | | AttributeType creatorsNameType = DirectoryServer.getAttributeType("creatorsname"); |
| | | assertTrue(creatorsNameType.isOperational()); |
| | | |
| | | AttributeBuilder builder = new AttributeBuilder(creatorsNameType, |
| | |
| | | { |
| | | assertEquals(conn.hasPrivilege(Privilege.CONFIG_READ, null), hasPrivilege); |
| | | |
| | | AttributeType cnAttrType = DirectoryServer.getAttributeTypeOrNull("cn"); |
| | | AttributeType cnAttrType = DirectoryServer.getAttributeType("cn"); |
| | | CompareOperation compareOperation = conn.processCompare( |
| | | DN.valueOf("cn=config"), cnAttrType, ByteString.valueOfUtf8("config")); |
| | | if (hasPrivilege) |
| | |
| | | FilterDescription description = new FilterDescription(); |
| | | |
| | | description.filterType = filterType; |
| | | description.attributeType = DirectoryServer.getAttributeTypeOrNull(attributeType); |
| | | description.attributeType = DirectoryServer.getAttributeType(attributeType); |
| | | description.assertionValue = ByteString.valueOfUtf8(attributeValue); |
| | | |
| | | if (filterType == FilterType.EQUALITY) { |
| | |
| | | FilterDescription description = new FilterDescription(); |
| | | |
| | | description.filterType = FilterType.SUBSTRING; |
| | | description.attributeType = DirectoryServer.getAttributeTypeOrNull(attributeType); |
| | | description.attributeType = DirectoryServer.getAttributeType(attributeType); |
| | | |
| | | description.subInitialElement = ByteString.valueOfUtf8(subInitial); |
| | | description.subAnyElements = new ArrayList<>(); |
| | |
| | | */ |
| | | @Test |
| | | public void testParseAttributeNotFound() throws Exception { |
| | | AttributeType type1 = DirectoryServer.getAttributeTypeOrNull("description"); |
| | | AttributeType type2 = DirectoryServer.getAttributeTypeOrNull("inheritable"); |
| | | AttributeType type1 = DirectoryServer.getAttributeType("description"); |
| | | AttributeType type2 = DirectoryServer.getAttributeType("inheritable"); |
| | | |
| | | Entry entry = createTestEntry(type1, "hello world"); |
| | | |
| | |
| | | */ |
| | | @Test |
| | | public void testParseAttributeBooleanTrue() throws Exception { |
| | | AttributeType type = DirectoryServer.getAttributeTypeOrNull("inheritable"); |
| | | AttributeType type = DirectoryServer.getAttributeType("inheritable"); |
| | | |
| | | Entry entry = createTestEntry(type, "true"); |
| | | |
| | |
| | | @Test |
| | | public void testParseAttributeBooleanFalse() throws Exception |
| | | { |
| | | AttributeType type = DirectoryServer.getAttributeTypeOrNull("inheritable"); |
| | | AttributeType type = DirectoryServer.getAttributeType("inheritable"); |
| | | |
| | | Entry entry = createTestEntry(type, "false"); |
| | | |
| | |
| | | @Test(expectedExceptions = LocalizedIllegalArgumentException.class) |
| | | public void testParseAttributeBooleanBad() throws Exception |
| | | { |
| | | AttributeType type = DirectoryServer.getAttributeTypeOrNull("inheritable"); |
| | | AttributeType type = DirectoryServer.getAttributeType("inheritable"); |
| | | |
| | | Entry entry = createTestEntry(type, "bad-value"); |
| | | entry.parseAttribute(type.getNameOrOID()).asBoolean(); |
| | |
| | | @Test |
| | | public void testParseAttributesInteger() throws Exception |
| | | { |
| | | AttributeType type = DirectoryServer.getAttributeTypeOrNull("supportedldapversion"); |
| | | AttributeType type = DirectoryServer.getAttributeType("supportedldapversion"); |
| | | String[] values = new String[] { "-4", "-2", "0", "1", "3" }; |
| | | |
| | | HashSet<Integer> expected = new HashSet<>(); |
| | |
| | | @Test(expectedExceptions = LocalizedIllegalArgumentException.class) |
| | | public void testParseAttributeIntegerBad() throws Exception |
| | | { |
| | | AttributeType type = DirectoryServer.getAttributeTypeOrNull("supportedldapversion"); |
| | | AttributeType type = DirectoryServer.getAttributeType("supportedldapversion"); |
| | | String[] values = new String[] { "-4", "-2", "xxx", "1", "3" }; |
| | | |
| | | Entry entry = createTestEntry(type, values); |
| | |
| | | assertTrue(e.conformsToSchema(null, false, false, false, |
| | | new LocalizableMessageBuilder())); |
| | | |
| | | AttributeType ocType = DirectoryServer.getAttributeTypeOrNull("objectclass"); |
| | | AttributeType cnType = DirectoryServer.getAttributeTypeOrNull("cn"); |
| | | AttributeType nameType = DirectoryServer.getAttributeTypeOrNull("name"); |
| | | AttributeType uidType = DirectoryServer.getAttributeTypeOrNull("uid"); |
| | | AttributeType mnType = DirectoryServer.getAttributeTypeOrNull("modifiersname"); |
| | | AttributeType ocType = DirectoryServer.getAttributeType("objectclass"); |
| | | AttributeType cnType = DirectoryServer.getAttributeType("cn"); |
| | | AttributeType nameType = DirectoryServer.getAttributeType("name"); |
| | | AttributeType uidType = DirectoryServer.getAttributeType("uid"); |
| | | AttributeType mnType = DirectoryServer.getAttributeType("modifiersname"); |
| | | |
| | | assertTrue(e.hasAttribute(ocType)); |
| | | assertTrue(e.hasAttribute(cnType)); |
| | |
| | | assertTrue(e.conformsToSchema(null, false, false, false, |
| | | new LocalizableMessageBuilder())); |
| | | |
| | | AttributeType ocType = DirectoryServer.getAttributeTypeOrNull("objectclass"); |
| | | AttributeType cnType = DirectoryServer.getAttributeTypeOrNull("cn"); |
| | | AttributeType nameType = DirectoryServer.getAttributeTypeOrNull("name"); |
| | | AttributeType uidType = DirectoryServer.getAttributeTypeOrNull("uid"); |
| | | AttributeType mnType = DirectoryServer.getAttributeTypeOrNull("modifiersname"); |
| | | AttributeType ocType = DirectoryServer.getAttributeType("objectclass"); |
| | | AttributeType cnType = DirectoryServer.getAttributeType("cn"); |
| | | AttributeType nameType = DirectoryServer.getAttributeType("name"); |
| | | AttributeType uidType = DirectoryServer.getAttributeType("uid"); |
| | | AttributeType mnType = DirectoryServer.getAttributeType("modifiersname"); |
| | | |
| | | assertFalse(e.hasUserAttribute(ocType)); |
| | | assertTrue(e.hasUserAttribute(cnType)); |
| | |
| | | assertTrue(e.conformsToSchema(null, false, false, false, |
| | | new LocalizableMessageBuilder())); |
| | | |
| | | AttributeType ocType = DirectoryServer.getAttributeTypeOrNull("objectclass"); |
| | | AttributeType cnType = DirectoryServer.getAttributeTypeOrNull("cn"); |
| | | AttributeType nameType = DirectoryServer.getAttributeTypeOrNull("name"); |
| | | AttributeType uidType = DirectoryServer.getAttributeTypeOrNull("uid"); |
| | | AttributeType mnType = DirectoryServer.getAttributeTypeOrNull("modifiersname"); |
| | | AttributeType ocType = DirectoryServer.getAttributeType("objectclass"); |
| | | AttributeType cnType = DirectoryServer.getAttributeType("cn"); |
| | | AttributeType nameType = DirectoryServer.getAttributeType("name"); |
| | | AttributeType uidType = DirectoryServer.getAttributeType("uid"); |
| | | AttributeType mnType = DirectoryServer.getAttributeType("modifiersname"); |
| | | |
| | | assertFalse(e.hasOperationalAttribute(ocType)); |
| | | assertFalse(e.hasOperationalAttribute(cnType)); |
| | |
| | | assertTrue(e.conformsToSchema(null, false, false, false, |
| | | new LocalizableMessageBuilder())); |
| | | |
| | | AttributeType ocType = DirectoryServer.getAttributeTypeOrNull("objectclass"); |
| | | AttributeType cnType = DirectoryServer.getAttributeTypeOrNull("cn"); |
| | | AttributeType nameType = DirectoryServer.getAttributeTypeOrNull("name"); |
| | | AttributeType uidType = DirectoryServer.getAttributeTypeOrNull("uid"); |
| | | AttributeType mnType = DirectoryServer.getAttributeTypeOrNull("modifiersname"); |
| | | AttributeType ocType = DirectoryServer.getAttributeType("objectclass"); |
| | | AttributeType cnType = DirectoryServer.getAttributeType("cn"); |
| | | AttributeType nameType = DirectoryServer.getAttributeType("name"); |
| | | AttributeType uidType = DirectoryServer.getAttributeType("uid"); |
| | | AttributeType mnType = DirectoryServer.getAttributeType("modifiersname"); |
| | | |
| | | assertThat(e.getAttribute(ocType)).hasSize(1); |
| | | assertThat(e.getAttribute(cnType)).hasSize(2); |
| | |
| | | assertTrue(e.conformsToSchema(null, false, false, false, |
| | | new LocalizableMessageBuilder())); |
| | | |
| | | AttributeType ocType = DirectoryServer.getAttributeTypeOrNull("objectclass"); |
| | | AttributeType cnType = DirectoryServer.getAttributeTypeOrNull("cn"); |
| | | AttributeType nameType = DirectoryServer.getAttributeTypeOrNull("name"); |
| | | AttributeType uidType = DirectoryServer.getAttributeTypeOrNull("uid"); |
| | | AttributeType mnType = DirectoryServer.getAttributeTypeOrNull("modifiersname"); |
| | | AttributeType ocType = DirectoryServer.getAttributeType("objectclass"); |
| | | AttributeType cnType = DirectoryServer.getAttributeType("cn"); |
| | | AttributeType nameType = DirectoryServer.getAttributeType("name"); |
| | | AttributeType uidType = DirectoryServer.getAttributeType("uid"); |
| | | AttributeType mnType = DirectoryServer.getAttributeType("modifiersname"); |
| | | |
| | | assertThat(e.getUserAttribute(ocType)).isEmpty(); |
| | | assertThat(e.getUserAttribute(cnType)).hasSize(2); |
| | |
| | | assertTrue(e.conformsToSchema(null, false, false, false, |
| | | new LocalizableMessageBuilder())); |
| | | |
| | | AttributeType ocType = DirectoryServer.getAttributeTypeOrNull("objectclass"); |
| | | AttributeType cnType = DirectoryServer.getAttributeTypeOrNull("cn"); |
| | | AttributeType nameType = DirectoryServer.getAttributeTypeOrNull("name"); |
| | | AttributeType uidType = DirectoryServer.getAttributeTypeOrNull("uid"); |
| | | AttributeType mnType = DirectoryServer.getAttributeTypeOrNull("modifiersname"); |
| | | AttributeType ocType = DirectoryServer.getAttributeType("objectclass"); |
| | | AttributeType cnType = DirectoryServer.getAttributeType("cn"); |
| | | AttributeType nameType = DirectoryServer.getAttributeType("name"); |
| | | AttributeType uidType = DirectoryServer.getAttributeType("uid"); |
| | | AttributeType mnType = DirectoryServer.getAttributeType("modifiersname"); |
| | | |
| | | assertThat(e.getOperationalAttribute(ocType)).isEmpty(); |
| | | assertThat(e.getOperationalAttribute(cnType)).isEmpty(); |
| | |
| | | // we'll start the server. |
| | | TestCaseUtils.startServer(); |
| | | |
| | | AT_DC = DirectoryServer.getAttributeTypeOrNull("dc"); |
| | | AT_CN = DirectoryServer.getAttributeTypeOrNull("cn"); |
| | | AT_DC = DirectoryServer.getAttributeType("dc"); |
| | | AT_CN = DirectoryServer.getAttributeType("cn"); |
| | | |
| | | String attrName = "x-test-integer-type"; |
| | | AttributeType dummy = getAttributeType(attrName, getDefaultIntegerSyntax()); |
| | |
| | | */ |
| | | package org.opends.server.types; |
| | | |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import static org.testng.Assert.*; |
| | | |
| | | import java.util.Collections; |
| | | import java.util.LinkedHashSet; |
| | | |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.admin.std.meta.VirtualAttributeCfgDefn.ConflictBehavior; |
| | | import org.opends.server.core.DirectoryServer; |
| | |
| | | import org.testng.annotations.DataProvider; |
| | | import org.testng.annotations.Test; |
| | | |
| | | import static org.testng.Assert.*; |
| | | |
| | | /** |
| | | * This class provides a set of test cases for virtual attribute rules, which |
| | | * link a virtual attribute provider implementation with an attribute type and a |
| | |
| | | { |
| | | TestCaseUtils.startServer(); |
| | | |
| | | entryDNType = DirectoryServer.getAttributeTypeOrNull("entrydn"); |
| | | entryDNType = DirectoryServer.getAttributeType("entrydn"); |
| | | assertNotNull(entryDNType); |
| | | } |
| | | |
| | |
| | | */ |
| | | package org.opends.server.types; |
| | | |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import static org.testng.Assert.*; |
| | | |
| | | import java.util.Collections; |
| | | import java.util.LinkedHashSet; |
| | |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ConditionResult; |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.admin.std.meta.VirtualAttributeCfgDefn.ConflictBehavior; |
| | | import org.opends.server.core.DirectoryServer; |
| | |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.testng.annotations.Test; |
| | | |
| | | import static org.testng.Assert.*; |
| | | |
| | | /** |
| | | * This class provides a set of test cases for virtual attributes. |
| | | */ |
| | |
| | | { |
| | | TestCaseUtils.startServer(); |
| | | |
| | | entryDNType = DirectoryServer.getAttributeTypeOrNull("entrydn"); |
| | | entryDNType = DirectoryServer.getAttributeType("entrydn"); |
| | | assertNotNull(entryDNType); |
| | | |
| | | EntryDNVirtualAttributeProvider provider = |
| | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ModificationType; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.server.types.*; |
| | | import org.opends.server.types.Attribute; |
| | | import org.opends.server.types.AttributeBuilder; |
| | | import org.opends.server.types.Attributes; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.LDIFImportConfig; |
| | | import org.opends.server.types.Modification; |
| | | import org.opends.server.types.ObjectClass; |
| | | import org.opends.server.types.RDN; |
| | | import org.opends.server.types.RawModification; |
| | | import org.testng.Assert; |
| | | import org.testng.annotations.AfterClass; |
| | | import org.testng.annotations.BeforeClass; |
| | |
| | | OC_PERSON = DirectoryServer.getObjectClass("person"); |
| | | |
| | | AT_OC = DirectoryServer.getObjectClassAttributeType(); |
| | | AT_CN = DirectoryServer.getAttributeTypeOrNull("cn"); |
| | | AT_SN = DirectoryServer.getAttributeTypeOrNull("sn"); |
| | | AT_DESCR = DirectoryServer.getAttributeTypeOrNull("description"); |
| | | AT_TELN = DirectoryServer.getAttributeTypeOrNull("telephonenumber"); |
| | | AT_CN = DirectoryServer.getAttributeType("cn"); |
| | | AT_SN = DirectoryServer.getAttributeType("sn"); |
| | | AT_DESCR = DirectoryServer.getAttributeType("description"); |
| | | AT_TELN = DirectoryServer.getAttributeType("telephonenumber"); |
| | | |
| | | // Create a temporary file containing an attribute value. |
| | | TEMP_FILE = File.createTempFile("tmp", "txt"); |
| | |
| | | Assert.assertTrue(i.hasNext()); |
| | | mod = i.next().toModification(); |
| | | Assert.assertEquals(mod.getModificationType(), ModificationType.REPLACE); |
| | | attr = Attributes.empty(DirectoryServer.getAttributeTypeOrNull("postaladdress")); |
| | | attr = Attributes.empty(DirectoryServer.getAttributeType("postaladdress")); |
| | | Assert.assertEquals(mod.getAttribute(), attr); |
| | | |
| | | // Change record #7. |