| | |
| | | * |
| | | * |
| | | * 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 { |