| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2014 ForgeRock AS. |
| | | * Copyright 2014-2015 ForgeRock AS. |
| | | */ |
| | | package org.opends.server; |
| | | |
| | |
| | | import java.io.File; |
| | | |
| | | import org.forgerock.opendj.config.server.ServerManagementContext; |
| | | import org.forgerock.opendj.ldap.schema.Schema; |
| | | import org.forgerock.opendj.ldap.schema.SchemaBuilder; |
| | | import org.opends.server.core.ConfigurationBootstrapper; |
| | | import org.opends.server.core.ServerContext; |
| | | import org.opends.server.schema.SchemaUpdater; |
| | |
| | | return serverContext; |
| | | } |
| | | |
| | | public ServerContextBuilder setSchemaDirectory(File path) |
| | | public ServerContextBuilder schemaDirectory(File path) |
| | | throws InitializationException |
| | | { |
| | | env.setSchemaDirectory(path); |
| | | return this; |
| | | } |
| | | |
| | | public ServerContextBuilder setConfigFile(File path) |
| | | public ServerContextBuilder schemaNG(Schema schema) |
| | | { |
| | | when(serverContext.getSchemaNG()).thenReturn(schema); |
| | | return this; |
| | | } |
| | | |
| | | public ServerContextBuilder configFile(File path) |
| | | throws InitializationException |
| | | { |
| | | env.setConfigFile(path); |
| | | return this; |
| | | } |
| | | |
| | | public ServerContextBuilder setSchemaUpdater(SchemaUpdater updater) |
| | | public ServerContextBuilder schemaUpdater(SchemaUpdater updater) |
| | | { |
| | | when(serverContext.getSchemaUpdater()).thenReturn(updater); |
| | | return this; |
| | |
| | | return this; |
| | | } |
| | | |
| | | /** A mock for schema updater. */ |
| | | public static final class MockSchemaUpdater implements SchemaUpdater |
| | | { |
| | | private Schema schema; |
| | | |
| | | public MockSchemaUpdater(Schema schema) |
| | | { |
| | | this.schema = schema; |
| | | } |
| | | |
| | | @Override |
| | | public boolean updateSchema(Schema schema) |
| | | { |
| | | this.schema = schema; |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public SchemaBuilder getSchemaBuilder() |
| | | { |
| | | return new SchemaBuilder(schema); |
| | | } |
| | | } |
| | | |
| | | } |