Fixed missing uses of ${artifactId} in urn
[controller.git] / opendaylight / config / threadpool-config-impl / src / test / java / org / opendaylight / controller / config / threadpool / naming / TestingNamingThreadPoolFactoryModule.java
1 /*
2  * Copyright (c) 2013 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.config.threadpool.naming;
9
10 import static org.mockito.Matchers.any;
11 import static org.mockito.Mockito.doNothing;
12 import static org.mockito.Mockito.doReturn;
13 import static org.mockito.Mockito.mock;
14
15 import java.io.Closeable;
16 import java.io.IOException;
17 import org.opendaylight.controller.config.api.DynamicMBeanWithInstance;
18 import org.opendaylight.controller.config.api.ModuleIdentifier;
19 import org.opendaylight.controller.config.spi.Module;
20 import org.opendaylight.controller.config.threadpool.util.NamingThreadPoolFactory;
21 import org.opendaylight.controller.config.yang.threadpool.ThreadFactoryServiceInterface;
22 import org.opendaylight.controller.config.yang.threadpool.impl.NamingThreadFactoryModuleMXBean;
23
24 public class TestingNamingThreadPoolFactoryModule implements Module, ThreadFactoryServiceInterface,
25         NamingThreadFactoryModuleMXBean {
26
27     private final NamingThreadPoolFactory fact;
28
29     public TestingNamingThreadPoolFactoryModule() throws IOException {
30         fact = mock(NamingThreadPoolFactory.class);
31         Thread thread = mock(Thread.class);
32         doNothing().when(thread).start();
33         doReturn(thread).when(fact).newThread(any(Runnable.class));
34         doNothing().when(fact).close();
35     }
36
37     public TestingNamingThreadPoolFactoryModule(DynamicMBeanWithInstance old) {
38         fact = (NamingThreadPoolFactory) old.getInstance();
39     }
40
41     @Override
42     public ModuleIdentifier getIdentifier() {
43         return new ModuleIdentifier(TestingNamingThreadPoolFactoryModule.class.getCanonicalName(), "mock");
44     }
45
46     @Override
47     public String getNamePrefix() {
48         return null;
49     }
50
51     @Override
52     public void setNamePrefix(String arg) {
53         throw new UnsupportedOperationException();
54     }
55
56     @Override
57     public void validate() {
58     }
59
60     @Override
61     public Closeable getInstance() {
62         return fact;
63     }
64
65 }