| | |
| | | */ |
| | | private class MockConstraintHandler extends ServerConstraintHandler { |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isDeleteAllowed(ServerManagedObject<?> managedObject, |
| | | Collection<LocalizableMessage> unacceptableReasons) throws ConfigException { |
| | |
| | | return isDeleteAllowed; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isUsable(ServerManagedObject<?> managedObject, |
| | | Collection<LocalizableMessage> unacceptableReasons) throws ConfigException { |
| | |
| | | return isUsable; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void performPostAdd(ServerManagedObject<?> managedObject) throws ConfigException { |
| | | // Make sure that the associated config entry exists. |
| | |
| | | Assert.assertTrue(configRepository.hasEntry(targetDN)); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void performPostDelete(ServerManagedObject<?> managedObject) throws ConfigException { |
| | | // Make sure that the associated config entry does not exist. |
| | |
| | | Assert.assertTrue(configRepository.hasEntry(targetDN)); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void performPostModify(ServerManagedObject<?> managedObject) throws ConfigException { |
| | | // Make sure that the associated config entry exists. |
| | |
| | | |
| | | } |
| | | |
| | | // Determines if delete operations are allowed. |
| | | /** Determines if delete operations are allowed. */ |
| | | private final boolean isDeleteAllowed; |
| | | |
| | | // Determines if configurations can be decoded. |
| | | /** Determines if configurations can be decoded. */ |
| | | private final boolean isUsable; |
| | | |
| | | private final ConfigurationRepository configRepository; |
| | |
| | | this.configRepository = configRepository; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | public Collection<ClientConstraintHandler> getClientConstraintHandlers() { |
| | | return Collections.emptySet(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | public Collection<ServerConstraintHandler> getServerConstraintHandlers() { |
| | | return Collections.<ServerConstraintHandler> singleton(new MockConstraintHandler()); |
| | | } |