2 * Copyright (c) 2014 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.sal.binding.test.util;
10 import java.util.concurrent.ExecutorService;
12 import javassist.ClassPool;
14 import org.opendaylight.controller.sal.core.api.data.DataStore;
15 import org.opendaylight.controller.sal.dom.broker.impl.DataStoreStatsWrapper;
16 import org.opendaylight.controller.sal.dom.broker.impl.HashMapDataStore;
17 import org.opendaylight.controller.sal.dom.broker.impl.SchemaAwareDataStoreAdapter;
19 import com.google.common.base.Preconditions;
20 import com.google.common.util.concurrent.ListeningExecutorService;
21 import com.google.common.util.concurrent.MoreExecutors;
23 public class BindingBrokerTestFactory {
25 private static final ClassPool CLASS_POOL = new ClassPool();
26 private boolean startWithParsedSchema = true;
27 private ExecutorService executor;
28 private ClassPool classPool;
31 public boolean isStartWithParsedSchema() {
32 return startWithParsedSchema;
35 public void setStartWithParsedSchema(boolean startWithParsedSchema) {
36 this.startWithParsedSchema = startWithParsedSchema;
39 public ExecutorService getExecutor() {
43 public void setExecutor(ExecutorService executor) {
44 this.executor = executor;
48 public BindingTestContext getTestContext() {
49 Preconditions.checkState(executor != null, "Executor is not set.");
50 ListeningExecutorService listenableExecutor = MoreExecutors.listeningDecorator(executor);
51 return new BindingTestContext(listenableExecutor, getClassPool(),startWithParsedSchema);
54 public ClassPool getClassPool() {
55 if(classPool == null) {
62 public void setClassPool(ClassPool classPool) {
63 this.classPool = classPool;