Merge "Bug 509: Improve logging in InMemoryDataStore."
[controller.git] / opendaylight / config / threadpool-config-impl / src / test / java / org / opendaylight / controller / config / threadpool / scheduled / TestingScheduledThreadPoolModule.java
index 27e60eef5cab734c64ba33622df00e2b230af020..2ba1b3b20da023be13004a65c07fcae21474687b 100644 (file)
@@ -1,77 +1,82 @@
-package org.opendaylight.controller.config.threadpool.scheduled;\r
-\r
-import static org.mockito.Matchers.any;\r
-import static org.mockito.Matchers.anyBoolean;\r
-import static org.mockito.Matchers.anyLong;\r
-import static org.mockito.Mockito.doNothing;\r
-import static org.mockito.Mockito.doReturn;\r
-import static org.mockito.Mockito.mock;\r
-\r
-import java.util.concurrent.ScheduledExecutorService;\r
-import java.util.concurrent.ScheduledFuture;\r
-import java.util.concurrent.TimeUnit;\r
-\r
-import javax.management.ObjectName;\r
-\r
-import org.opendaylight.controller.config.api.DynamicMBeanWithInstance;\r
-import org.opendaylight.controller.config.api.ModuleIdentifier;\r
-import org.opendaylight.controller.config.manager.impl.AbstractMockedModule;\r
-import org.opendaylight.controller.config.spi.Module;\r
-import org.opendaylight.controller.config.threadpool.util.ScheduledThreadPoolWrapper;\r
-import org.opendaylight.controller.config.yang.threadpool.ScheduledThreadPoolServiceInterface;\r
-import org.opendaylight.controller.config.yang.threadpool.impl.ScheduledThreadPoolModuleMXBean;\r
-\r
-import com.google.common.util.concurrent.ListenableFutureTask;\r
-\r
-public class TestingScheduledThreadPoolModule extends AbstractMockedModule implements\r
-        ScheduledThreadPoolServiceInterface, Module, ScheduledThreadPoolModuleMXBean {\r
-\r
-    public TestingScheduledThreadPoolModule(DynamicMBeanWithInstance old, ModuleIdentifier id) {\r
-        super(old, id);\r
-    }\r
-\r
-    @Override\r
-    protected AutoCloseable prepareMockedInstance() throws Exception {\r
-        ScheduledThreadPoolWrapper instance = mock(ScheduledThreadPoolWrapper.class);\r
-        ScheduledExecutorService ses = mock(ScheduledExecutorService.class);\r
-        {// mockFuture\r
-            ScheduledFuture<?> future = mock(ScheduledFuture.class);\r
-            doReturn(false).when(future).cancel(anyBoolean());\r
-            try {\r
-                doReturn(mock(Object.class)).when(future).get();\r
-            } catch (Exception e) {\r
-                throw new RuntimeException(e);\r
-            }\r
-            doReturn(future).when(ses).schedule(any(Runnable.class), any(Long.class), any(TimeUnit.class));\r
-            doReturn(future).when(ses).scheduleWithFixedDelay(any(Runnable.class), anyLong(), anyLong(),\r
-                    any(TimeUnit.class));\r
-\r
-        }\r
-        doNothing().when(ses).execute(any(Runnable.class));\r
-        doNothing().when(ses).execute(any(ListenableFutureTask.class));\r
-        doReturn(ses).when(instance).getExecutor();\r
-        doNothing().when(instance).close();\r
-\r
-        doReturn(1).when(instance).getMaxThreadCount();\r
-        return instance;\r
-    }\r
-\r
-    @Override\r
-    public ObjectName getThreadFactory() {\r
-        return any(ObjectName.class);\r
-    }\r
-\r
-    @Override\r
-    public void setThreadFactory(ObjectName threadFactory) {\r
-    }\r
-\r
-    @Override\r
-    public Integer getMaxThreadCount() {\r
-        return 1;\r
-    }\r
-\r
-    @Override\r
-    public void setMaxThreadCount(Integer maxThreadCount) {\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.config.threadpool.scheduled;
+
+import com.google.common.util.concurrent.ListenableFutureTask;
+import org.opendaylight.controller.config.api.DynamicMBeanWithInstance;
+import org.opendaylight.controller.config.api.ModuleIdentifier;
+import org.opendaylight.controller.config.manager.impl.AbstractMockedModule;
+import org.opendaylight.controller.config.spi.Module;
+import org.opendaylight.controller.config.threadpool.util.ScheduledThreadPoolWrapper;
+import org.opendaylight.controller.config.yang.threadpool.ScheduledThreadPoolServiceInterface;
+import org.opendaylight.controller.config.yang.threadpool.impl.scheduled.ScheduledThreadPoolModuleMXBean;
+
+import javax.management.ObjectName;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ScheduledFuture;
+import java.util.concurrent.TimeUnit;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyBoolean;
+import static org.mockito.Matchers.anyLong;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+
+public class TestingScheduledThreadPoolModule extends AbstractMockedModule implements
+        ScheduledThreadPoolServiceInterface, Module, ScheduledThreadPoolModuleMXBean {
+
+    public TestingScheduledThreadPoolModule(DynamicMBeanWithInstance old, ModuleIdentifier id) {
+        super(old, id);
+    }
+
+    @Override
+    protected AutoCloseable prepareMockedInstance() throws Exception {
+        ScheduledThreadPoolWrapper instance = mock(ScheduledThreadPoolWrapper.class);
+        ScheduledExecutorService ses = mock(ScheduledExecutorService.class);
+        {// mockFuture
+            ScheduledFuture<?> future = mock(ScheduledFuture.class);
+            doReturn(false).when(future).cancel(anyBoolean());
+            try {
+                doReturn(mock(Object.class)).when(future).get();
+            } catch (Exception e) {
+                throw new RuntimeException(e);
+            }
+            doReturn(future).when(ses).schedule(any(Runnable.class), any(Long.class), any(TimeUnit.class));
+            doReturn(future).when(ses).scheduleWithFixedDelay(any(Runnable.class), anyLong(), anyLong(),
+                    any(TimeUnit.class));
+
+        }
+        doNothing().when(ses).execute(any(Runnable.class));
+        doNothing().when(ses).execute(any(ListenableFutureTask.class));
+        doReturn(ses).when(instance).getExecutor();
+        doNothing().when(instance).close();
+
+        doReturn(1).when(instance).getMaxThreadCount();
+        return instance;
+    }
+
+    @Override
+    public ObjectName getThreadFactory() {
+        return any(ObjectName.class);
+    }
+
+    @Override
+    public void setThreadFactory(ObjectName threadFactory) {
+    }
+
+    @Override
+    public Integer getMaxThreadCount() {
+        return 1;
+    }
+
+    @Override
+    public void setMaxThreadCount(Integer maxThreadCount) {
+    }
+
+}