Migrate OSGI compendium reference
[controller.git] / opendaylight / md-sal / sal-binding-broker / src / test / java / org / opendaylight / controller / sal / binding / test / util / BindingBrokerTestFactory.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.controller.sal.binding.test.util;
9
10 import com.google.common.annotations.Beta;
11 import com.google.common.base.Preconditions;
12 import com.google.common.util.concurrent.ListeningExecutorService;
13 import com.google.common.util.concurrent.MoreExecutors;
14 import java.util.concurrent.ExecutorService;
15
16 @Beta
17 @Deprecated
18 public class BindingBrokerTestFactory {
19     private boolean startWithParsedSchema = true;
20     private ExecutorService executor;
21
22
23     public boolean isStartWithParsedSchema() {
24         return startWithParsedSchema;
25     }
26
27     public void setStartWithParsedSchema(final boolean startWithParsedSchema) {
28         this.startWithParsedSchema = startWithParsedSchema;
29     }
30
31     public ExecutorService getExecutor() {
32         return executor;
33     }
34
35     public void setExecutor(final ExecutorService executor) {
36         this.executor = executor;
37     }
38
39     public BindingTestContext getTestContext() {
40         Preconditions.checkState(executor != null, "Executor is not set.");
41         ListeningExecutorService listenableExecutor = MoreExecutors.listeningDecorator(executor);
42         return new BindingTestContext(listenableExecutor, startWithParsedSchema);
43     }
44 }