2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.config.manager.impl;
10 import org.opendaylight.controller.config.api.DynamicMBeanWithInstance;
11 import org.opendaylight.controller.config.api.ModuleIdentifier;
12 import org.opendaylight.controller.config.spi.Module;
14 public abstract class AbstractMockedModule implements Module {
16 protected final AutoCloseable instance;
18 public AbstractMockedModule() throws Exception {
19 instance = prepareMockedInstance();
22 protected abstract AutoCloseable prepareMockedInstance() throws Exception;
24 public AbstractMockedModule(DynamicMBeanWithInstance old) {
25 instance = old.getInstance();
29 public void validate() {
33 public AutoCloseable getInstance() {
38 public ModuleIdentifier getName() {
39 return new ModuleIdentifier(getClass().getCanonicalName(), "mock");