Resolve Bug:745 - remove windows line endings from config and netconf. 00/6200/1
authorTomas Olvecky <tolvecky@cisco.com>
Tue, 15 Apr 2014 11:26:05 +0000 (13:26 +0200)
committerTomas Olvecky <tolvecky@cisco.com>
Tue, 15 Apr 2014 11:26:05 +0000 (13:26 +0200)
Change-Id: Id60c44a5f3fd4979f4e13cb00e6537998718e94f
Signed-off-by: Tomas Olvecky <tolvecky@cisco.com>
24 files changed:
opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/async/AsyncEventBusConfigBeanTest.java
opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/eventbus/TestingEventBusModule.java
opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/fixed/FixedThreadPoolConfigBeanTest.java
opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/fixed/TestingFixedThreadPoolModule.java
opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/flexible/FlexibleThreadPoolConfigBeanTest.java
opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/naming/NamingThreadPoolFactoryConfigBeanTest.java
opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/naming/TestingNamingThreadPoolFactoryModule.java
opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/scheduled/ScheduledThreadPoolConfigBeanTest.java
opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/scheduled/TestingScheduledThreadPoolModule.java
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/mapping/operations/DefaultStartExi.java
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/mapping/operations/DefaultStopExi.java
opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/ExiEncodeDecodeTest.java
opendaylight/netconf/netconf-impl/src/test/resources/testConfigs/input.json
opendaylight/netconf/netconf-impl/src/test/resources/testConfigs/input.xml
opendaylight/netconf/netconf-impl/src/test/resources/testConfigs/inputList.xml
opendaylight/netconf/netconf-impl/src/test/resources/testConfigs/inputMap.xml
opendaylight/netconf/netconf-impl/src/test/resources/testConfigs/inputMultiple.xml
opendaylight/netconf/netconf-impl/src/test/resources/testConfigs/inputSetter.xml
opendaylight/netconf/netconf-impl/src/test/resources/testConfigs/inputSetterList.xml
opendaylight/netconf/netconf-impl/src/test/resources/testConfigs/inputSetterMap.xml
opendaylight/netconf/netconf-impl/src/test/resources/testConfigs/map.json
opendaylight/netconf/netconf-mapping-api/src/main/java/org/opendaylight/controller/netconf/mapping/api/DefaultNetconfOperation.java
opendaylight/netconf/netconf-util/src/test/resources/netconfMessages/startExi.xml
opendaylight/netconf/netconf-util/src/test/resources/netconfMessages/stopExi.xml

index b9731cd..177adc1 100644 (file)
-/*\r
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.controller.config.threadpool.async;\r
-\r
-import static org.junit.Assert.assertThat;\r
-import static org.junit.Assert.fail;\r
-import static org.junit.matchers.JUnitMatchers.containsString;\r
-\r
-import javax.management.InstanceAlreadyExistsException;\r
-import javax.management.ObjectName;\r
-\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.opendaylight.controller.config.api.ConflictingVersionException;\r
-import org.opendaylight.controller.config.api.ValidationException;\r
-import org.opendaylight.controller.config.api.jmx.CommitStatus;\r
-import org.opendaylight.controller.config.manager.impl.AbstractConfigTest;\r
-import org.opendaylight.controller.config.manager.impl.ClassBasedModuleFactory;\r
-import org.opendaylight.controller.config.manager.impl.factoriesresolver.HardcodedModuleFactoriesResolver;\r
-import org.opendaylight.controller.config.threadpool.scheduled.TestingScheduledThreadPoolModule;\r
-import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;\r
-import org.opendaylight.controller.config.yang.threadpool.impl.AsyncEventBusModuleFactory;\r
-import org.opendaylight.controller.config.yang.threadpool.impl.AsyncEventBusModuleMXBean;\r
-\r
-public class AsyncEventBusConfigBeanTest extends AbstractConfigTest {\r
-\r
-    private AsyncEventBusModuleFactory factory;\r
-    private final String instanceName = "async1";\r
-    private final String poolImplName = "fixed1";\r
-\r
-    @Before\r
-    public void setUp() {\r
-\r
-        ClassBasedModuleFactory scheduledThreadPoolConfigFactory = createClassBasedCBF(\r
-                TestingScheduledThreadPoolModule.class, poolImplName);\r
-\r
-        factory = new AsyncEventBusModuleFactory();\r
-        super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(factory,\r
-                scheduledThreadPoolConfigFactory));\r
-    }\r
-\r
-    @Test\r
-    public void testCreateBean() throws InstanceAlreadyExistsException, ValidationException,\r
-            ConflictingVersionException {\r
-        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();\r
-\r
-        createAsynced(transaction, instanceName, transaction.createModule(poolImplName, "pool-test"));\r
-        transaction.validateConfig();\r
-        CommitStatus status = transaction.commit();\r
-\r
-        assertBeanCount(1, factory.getImplementationName());\r
-        assertStatus(status, 2, 0, 0);\r
-    }\r
-\r
-    @Test\r
-    public void testReusingOldInstance() throws InstanceAlreadyExistsException, ConflictingVersionException,\r
-            ValidationException {\r
-\r
-        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();\r
-        createAsynced(transaction, instanceName, transaction.createModule(poolImplName, "pool-test"));\r
-\r
-        transaction.commit();\r
-\r
-        assertBeanCount(1, factory.getImplementationName());\r
-\r
-        transaction = configRegistryClient.createTransaction();\r
-        CommitStatus status = transaction.commit();\r
-\r
-        assertBeanCount(1, factory.getImplementationName());\r
-        assertStatus(status, 0, 0, 2);\r
-\r
-    }\r
-\r
-    @Test\r
-    public void testInstanceAlreadyExistsException() throws ConflictingVersionException, ValidationException,\r
-            InstanceAlreadyExistsException {\r
-        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();\r
-\r
-        ObjectName poolCB = transaction.createModule(poolImplName, "pool-test");\r
-        createAsynced(transaction, instanceName, poolCB);\r
-        transaction.commit();\r
-\r
-        transaction = configRegistryClient.createTransaction();\r
-        try {\r
-            createAsynced(transaction, instanceName, poolCB);\r
-            fail();\r
-        } catch (InstanceAlreadyExistsException e) {\r
-            assertThat(\r
-                    e.getMessage(),\r
-                    containsString("There is an instance registered with name ModuleIdentifier{factoryName='async-eventbus', instanceName='async1'}"));\r
-        }\r
-    }\r
-\r
-    private ObjectName createAsynced(ConfigTransactionJMXClient transaction, String instanceName, ObjectName threadPool)\r
-            throws InstanceAlreadyExistsException {\r
-        ObjectName nameCreated = transaction.createModule(factory.getImplementationName(), instanceName);\r
-        AsyncEventBusModuleMXBean mxBean = transaction.newMBeanProxy(nameCreated, AsyncEventBusModuleMXBean.class);\r
-        mxBean.setThreadpool(threadPool);\r
-        return nameCreated;\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.async;
+
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
+import static org.junit.matchers.JUnitMatchers.containsString;
+
+import javax.management.InstanceAlreadyExistsException;
+import javax.management.ObjectName;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.controller.config.api.ConflictingVersionException;
+import org.opendaylight.controller.config.api.ValidationException;
+import org.opendaylight.controller.config.api.jmx.CommitStatus;
+import org.opendaylight.controller.config.manager.impl.AbstractConfigTest;
+import org.opendaylight.controller.config.manager.impl.ClassBasedModuleFactory;
+import org.opendaylight.controller.config.manager.impl.factoriesresolver.HardcodedModuleFactoriesResolver;
+import org.opendaylight.controller.config.threadpool.scheduled.TestingScheduledThreadPoolModule;
+import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;
+import org.opendaylight.controller.config.yang.threadpool.impl.AsyncEventBusModuleFactory;
+import org.opendaylight.controller.config.yang.threadpool.impl.AsyncEventBusModuleMXBean;
+
+public class AsyncEventBusConfigBeanTest extends AbstractConfigTest {
+
+    private AsyncEventBusModuleFactory factory;
+    private final String instanceName = "async1";
+    private final String poolImplName = "fixed1";
+
+    @Before
+    public void setUp() {
+
+        ClassBasedModuleFactory scheduledThreadPoolConfigFactory = createClassBasedCBF(
+                TestingScheduledThreadPoolModule.class, poolImplName);
+
+        factory = new AsyncEventBusModuleFactory();
+        super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(factory,
+                scheduledThreadPoolConfigFactory));
+    }
+
+    @Test
+    public void testCreateBean() throws InstanceAlreadyExistsException, ValidationException,
+            ConflictingVersionException {
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
+
+        createAsynced(transaction, instanceName, transaction.createModule(poolImplName, "pool-test"));
+        transaction.validateConfig();
+        CommitStatus status = transaction.commit();
+
+        assertBeanCount(1, factory.getImplementationName());
+        assertStatus(status, 2, 0, 0);
+    }
+
+    @Test
+    public void testReusingOldInstance() throws InstanceAlreadyExistsException, ConflictingVersionException,
+            ValidationException {
+
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
+        createAsynced(transaction, instanceName, transaction.createModule(poolImplName, "pool-test"));
+
+        transaction.commit();
+
+        assertBeanCount(1, factory.getImplementationName());
+
+        transaction = configRegistryClient.createTransaction();
+        CommitStatus status = transaction.commit();
+
+        assertBeanCount(1, factory.getImplementationName());
+        assertStatus(status, 0, 0, 2);
+
+    }
+
+    @Test
+    public void testInstanceAlreadyExistsException() throws ConflictingVersionException, ValidationException,
+            InstanceAlreadyExistsException {
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
+
+        ObjectName poolCB = transaction.createModule(poolImplName, "pool-test");
+        createAsynced(transaction, instanceName, poolCB);
+        transaction.commit();
+
+        transaction = configRegistryClient.createTransaction();
+        try {
+            createAsynced(transaction, instanceName, poolCB);
+            fail();
+        } catch (InstanceAlreadyExistsException e) {
+            assertThat(
+                    e.getMessage(),
+                    containsString("There is an instance registered with name ModuleIdentifier{factoryName='async-eventbus', instanceName='async1'}"));
+        }
+    }
+
+    private ObjectName createAsynced(ConfigTransactionJMXClient transaction, String instanceName, ObjectName threadPool)
+            throws InstanceAlreadyExistsException {
+        ObjectName nameCreated = transaction.createModule(factory.getImplementationName(), instanceName);
+        AsyncEventBusModuleMXBean mxBean = transaction.newMBeanProxy(nameCreated, AsyncEventBusModuleMXBean.class);
+        mxBean.setThreadpool(threadPool);
+        return nameCreated;
+    }
+
+}
index 01a89a9..4431f78 100644 (file)
@@ -1,35 +1,35 @@
-/*\r
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.controller.config.threadpool.eventbus;\r
-\r
-import static org.mockito.Mockito.doNothing;\r
-import static org.mockito.Mockito.mock;\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.CloseableEventBus;\r
-import org.opendaylight.controller.config.yang.threadpool.EventBusServiceInterface;\r
-import org.opendaylight.controller.config.yang.threadpool.impl.EventBusModuleMXBean;\r
-\r
-public class TestingEventBusModule extends AbstractMockedModule implements Module, EventBusServiceInterface,\r
-        EventBusModuleMXBean {\r
-\r
-    public TestingEventBusModule(DynamicMBeanWithInstance old, ModuleIdentifier id) {\r
-        super(old, id);\r
-    }\r
-\r
-    @Override\r
-    protected AutoCloseable prepareMockedInstance() throws Exception {\r
-        CloseableEventBus bus = mock(CloseableEventBus.class);\r
-        doNothing().when(bus).close();\r
-        return bus;\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.eventbus;
+
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.mock;
+
+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.CloseableEventBus;
+import org.opendaylight.controller.config.yang.threadpool.EventBusServiceInterface;
+import org.opendaylight.controller.config.yang.threadpool.impl.EventBusModuleMXBean;
+
+public class TestingEventBusModule extends AbstractMockedModule implements Module, EventBusServiceInterface,
+        EventBusModuleMXBean {
+
+    public TestingEventBusModule(DynamicMBeanWithInstance old, ModuleIdentifier id) {
+        super(old, id);
+    }
+
+    @Override
+    protected AutoCloseable prepareMockedInstance() throws Exception {
+        CloseableEventBus bus = mock(CloseableEventBus.class);
+        doNothing().when(bus).close();
+        return bus;
+    }
+
+}
index 8bfd049..781215d 100644 (file)
-/*\r
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.controller.config.threadpool.fixed;\r
-\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.opendaylight.controller.config.api.ConflictingVersionException;\r
-import org.opendaylight.controller.config.api.ValidationException;\r
-import org.opendaylight.controller.config.api.jmx.CommitStatus;\r
-import org.opendaylight.controller.config.manager.impl.AbstractConfigTest;\r
-import org.opendaylight.controller.config.manager.impl.factoriesresolver.HardcodedModuleFactoriesResolver;\r
-import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;\r
-import org.opendaylight.controller.config.yang.threadpool.impl.NamingThreadFactoryModuleFactory;\r
-import org.opendaylight.controller.config.yang.threadpool.impl.NamingThreadFactoryModuleMXBean;\r
-import org.opendaylight.controller.config.yang.threadpool.impl.fixed.FixedThreadPoolModuleFactory;\r
-import org.opendaylight.controller.config.yang.threadpool.impl.fixed.FixedThreadPoolModuleMXBean;\r
-\r
-import javax.management.InstanceAlreadyExistsException;\r
-import javax.management.InstanceNotFoundException;\r
-import javax.management.ObjectName;\r
-\r
-import static org.junit.Assert.assertThat;\r
-import static org.junit.Assert.fail;\r
-import static org.junit.matchers.JUnitMatchers.containsString;\r
-\r
-public class FixedThreadPoolConfigBeanTest extends AbstractConfigTest {\r
-\r
-    private FixedThreadPoolModuleFactory factory;\r
-    private final String nameInstance = "fixedInstance";\r
-\r
-    @Before\r
-    public void setUp() {\r
-        factory = new FixedThreadPoolModuleFactory();\r
-        super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(factory,\r
-                new NamingThreadFactoryModuleFactory()));\r
-    }\r
-\r
-    @Test\r
-    public void testCreateBean() throws InstanceAlreadyExistsException, ValidationException,\r
-            ConflictingVersionException {\r
-        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();\r
-        createFixed(transaction, nameInstance, 2);\r
-\r
-        transaction.validateConfig();\r
-        CommitStatus status = transaction.commit();\r
-\r
-        assertBeanCount(1, factory.getImplementationName());\r
-        assertStatus(status, 2, 0, 0);\r
-    }\r
-\r
-    @Test\r
-    public void testReusingOldInstance() throws InstanceAlreadyExistsException, ConflictingVersionException,\r
-            ValidationException {\r
-        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();\r
-        createFixed(transaction, nameInstance, 4);\r
-\r
-        transaction.validateConfig();\r
-        transaction.commit();\r
-\r
-        assertBeanCount(1, factory.getImplementationName());\r
-\r
-        transaction = configRegistryClient.createTransaction();\r
-        CommitStatus status = transaction.commit();\r
-\r
-        assertBeanCount(1, factory.getImplementationName());\r
-        assertStatus(status, 0, 0, 2);\r
-    }\r
-\r
-    @Test\r
-    public void testNegative() throws ConflictingVersionException, ValidationException, InstanceAlreadyExistsException {\r
-        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();\r
-\r
-        createFixed(transaction, nameInstance, 5);\r
-        transaction.commit();\r
-\r
-        transaction = configRegistryClient.createTransaction();\r
-        try {\r
-            createFixed(transaction, nameInstance, 0);\r
-            fail();\r
-        } catch (InstanceAlreadyExistsException e) {\r
-            assertThat(\r
-                    e.getMessage(),\r
-                    containsString("There is an instance registered with name ModuleIdentifier{factoryName='threadpool-fixed', instanceName='fixedInstance'}"));\r
-        }\r
-    }\r
-\r
-    @Test\r
-    public void testDestroy() throws InstanceAlreadyExistsException, ValidationException, ConflictingVersionException,\r
-            InstanceNotFoundException {\r
-        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();\r
-        createFixed(transaction, nameInstance, 1);\r
-\r
-        transaction.commit();\r
-\r
-        transaction = configRegistryClient.createTransaction();\r
-        transaction.destroyConfigBean(factory.getImplementationName(), nameInstance);\r
-        CommitStatus status = transaction.commit();\r
-\r
-        assertBeanCount(0, factory.getImplementationName());\r
-        assertStatus(status, 0, 0, 1);\r
-    }\r
-\r
-    @Test\r
-    public void testValidationException() throws InstanceAlreadyExistsException {\r
-        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();\r
-        createFixed(transaction, nameInstance, -1);\r
-        try {\r
-            transaction.validateConfig();\r
-            fail();\r
-        } catch (ValidationException e) {\r
-            assertThat(e.getMessage(), containsString("MaxThreadCount must be greater than zero"));\r
-        }\r
-    }\r
-\r
-    private ObjectName createFixed(ConfigTransactionJMXClient transaction, String name, int numberOfThreads)\r
-            throws InstanceAlreadyExistsException {\r
-        ObjectName nameCreated = transaction.createModule(factory.getImplementationName(), name);\r
-        FixedThreadPoolModuleMXBean mxBean = transaction.newMXBeanProxy(nameCreated, FixedThreadPoolModuleMXBean.class);\r
-        mxBean.setMaxThreadCount(numberOfThreads);\r
-\r
-        ObjectName threadFactoryON = transaction.createModule(NamingThreadFactoryModuleFactory.NAME, "naming");\r
-        NamingThreadFactoryModuleMXBean namingThreadFactoryModuleMXBean = transaction.newMXBeanProxy(threadFactoryON,\r
-                NamingThreadFactoryModuleMXBean.class);\r
-        namingThreadFactoryModuleMXBean.setNamePrefix("prefix");\r
-\r
-        mxBean.setThreadFactory(threadFactoryON);\r
-\r
-        return nameCreated;\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.fixed;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.controller.config.api.ConflictingVersionException;
+import org.opendaylight.controller.config.api.ValidationException;
+import org.opendaylight.controller.config.api.jmx.CommitStatus;
+import org.opendaylight.controller.config.manager.impl.AbstractConfigTest;
+import org.opendaylight.controller.config.manager.impl.factoriesresolver.HardcodedModuleFactoriesResolver;
+import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;
+import org.opendaylight.controller.config.yang.threadpool.impl.NamingThreadFactoryModuleFactory;
+import org.opendaylight.controller.config.yang.threadpool.impl.NamingThreadFactoryModuleMXBean;
+import org.opendaylight.controller.config.yang.threadpool.impl.fixed.FixedThreadPoolModuleFactory;
+import org.opendaylight.controller.config.yang.threadpool.impl.fixed.FixedThreadPoolModuleMXBean;
+
+import javax.management.InstanceAlreadyExistsException;
+import javax.management.InstanceNotFoundException;
+import javax.management.ObjectName;
+
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
+import static org.junit.matchers.JUnitMatchers.containsString;
+
+public class FixedThreadPoolConfigBeanTest extends AbstractConfigTest {
+
+    private FixedThreadPoolModuleFactory factory;
+    private final String nameInstance = "fixedInstance";
+
+    @Before
+    public void setUp() {
+        factory = new FixedThreadPoolModuleFactory();
+        super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(factory,
+                new NamingThreadFactoryModuleFactory()));
+    }
+
+    @Test
+    public void testCreateBean() throws InstanceAlreadyExistsException, ValidationException,
+            ConflictingVersionException {
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
+        createFixed(transaction, nameInstance, 2);
+
+        transaction.validateConfig();
+        CommitStatus status = transaction.commit();
+
+        assertBeanCount(1, factory.getImplementationName());
+        assertStatus(status, 2, 0, 0);
+    }
+
+    @Test
+    public void testReusingOldInstance() throws InstanceAlreadyExistsException, ConflictingVersionException,
+            ValidationException {
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
+        createFixed(transaction, nameInstance, 4);
+
+        transaction.validateConfig();
+        transaction.commit();
+
+        assertBeanCount(1, factory.getImplementationName());
+
+        transaction = configRegistryClient.createTransaction();
+        CommitStatus status = transaction.commit();
+
+        assertBeanCount(1, factory.getImplementationName());
+        assertStatus(status, 0, 0, 2);
+    }
+
+    @Test
+    public void testNegative() throws ConflictingVersionException, ValidationException, InstanceAlreadyExistsException {
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
+
+        createFixed(transaction, nameInstance, 5);
+        transaction.commit();
+
+        transaction = configRegistryClient.createTransaction();
+        try {
+            createFixed(transaction, nameInstance, 0);
+            fail();
+        } catch (InstanceAlreadyExistsException e) {
+            assertThat(
+                    e.getMessage(),
+                    containsString("There is an instance registered with name ModuleIdentifier{factoryName='threadpool-fixed', instanceName='fixedInstance'}"));
+        }
+    }
+
+    @Test
+    public void testDestroy() throws InstanceAlreadyExistsException, ValidationException, ConflictingVersionException,
+            InstanceNotFoundException {
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
+        createFixed(transaction, nameInstance, 1);
+
+        transaction.commit();
+
+        transaction = configRegistryClient.createTransaction();
+        transaction.destroyConfigBean(factory.getImplementationName(), nameInstance);
+        CommitStatus status = transaction.commit();
+
+        assertBeanCount(0, factory.getImplementationName());
+        assertStatus(status, 0, 0, 1);
+    }
+
+    @Test
+    public void testValidationException() throws InstanceAlreadyExistsException {
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
+        createFixed(transaction, nameInstance, -1);
+        try {
+            transaction.validateConfig();
+            fail();
+        } catch (ValidationException e) {
+            assertThat(e.getMessage(), containsString("MaxThreadCount must be greater than zero"));
+        }
+    }
+
+    private ObjectName createFixed(ConfigTransactionJMXClient transaction, String name, int numberOfThreads)
+            throws InstanceAlreadyExistsException {
+        ObjectName nameCreated = transaction.createModule(factory.getImplementationName(), name);
+        FixedThreadPoolModuleMXBean mxBean = transaction.newMXBeanProxy(nameCreated, FixedThreadPoolModuleMXBean.class);
+        mxBean.setMaxThreadCount(numberOfThreads);
+
+        ObjectName threadFactoryON = transaction.createModule(NamingThreadFactoryModuleFactory.NAME, "naming");
+        NamingThreadFactoryModuleMXBean namingThreadFactoryModuleMXBean = transaction.newMXBeanProxy(threadFactoryON,
+                NamingThreadFactoryModuleMXBean.class);
+        namingThreadFactoryModuleMXBean.setNamePrefix("prefix");
+
+        mxBean.setThreadFactory(threadFactoryON);
+
+        return nameCreated;
+    }
+
+}
index 1fc0821..03cf9d6 100644 (file)
@@ -1,37 +1,37 @@
-/*\r
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.controller.config.threadpool.fixed;\r
-\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.ExecutorService;\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.FixedThreadPoolWrapper;\r
-import org.opendaylight.controller.config.yang.threadpool.ThreadPoolServiceInterface;\r
-\r
-public class TestingFixedThreadPoolModule extends AbstractMockedModule implements ThreadPoolServiceInterface, Module {\r
-\r
-    public TestingFixedThreadPoolModule(DynamicMBeanWithInstance old, ModuleIdentifier id) {\r
-        super(old, id);\r
-    }\r
-\r
-    @Override\r
-    protected AutoCloseable prepareMockedInstance() throws Exception {\r
-        FixedThreadPoolWrapper pool = mock(FixedThreadPoolWrapper.class);\r
-        doNothing().when(pool).close();\r
-        doReturn(mock(ExecutorService.class)).when(pool).getExecutor();\r
-        return pool;\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.fixed;
+
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+
+import java.util.concurrent.ExecutorService;
+
+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.FixedThreadPoolWrapper;
+import org.opendaylight.controller.config.yang.threadpool.ThreadPoolServiceInterface;
+
+public class TestingFixedThreadPoolModule extends AbstractMockedModule implements ThreadPoolServiceInterface, Module {
+
+    public TestingFixedThreadPoolModule(DynamicMBeanWithInstance old, ModuleIdentifier id) {
+        super(old, id);
+    }
+
+    @Override
+    protected AutoCloseable prepareMockedInstance() throws Exception {
+        FixedThreadPoolWrapper pool = mock(FixedThreadPoolWrapper.class);
+        doNothing().when(pool).close();
+        doReturn(mock(ExecutorService.class)).when(pool).getExecutor();
+        return pool;
+    }
+
+}
index 43cb7e1..f0e8a10 100644 (file)
-/*\r
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.controller.config.threadpool.flexible;\r
-\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.opendaylight.controller.config.api.ConflictingVersionException;\r
-import org.opendaylight.controller.config.api.ValidationException;\r
-import org.opendaylight.controller.config.api.jmx.CommitStatus;\r
-import org.opendaylight.controller.config.manager.impl.AbstractConfigTest;\r
-import org.opendaylight.controller.config.manager.impl.factoriesresolver.HardcodedModuleFactoriesResolver;\r
-import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;\r
-import org.opendaylight.controller.config.yang.threadpool.impl.NamingThreadFactoryModuleFactory;\r
-import org.opendaylight.controller.config.yang.threadpool.impl.NamingThreadFactoryModuleMXBean;\r
-import org.opendaylight.controller.config.yang.threadpool.impl.flexible.FlexibleThreadPoolModuleFactory;\r
-import org.opendaylight.controller.config.yang.threadpool.impl.flexible.FlexibleThreadPoolModuleMXBean;\r
-\r
-import javax.management.InstanceAlreadyExistsException;\r
-import javax.management.InstanceNotFoundException;\r
-import javax.management.ObjectName;\r
-\r
-import static org.junit.Assert.assertThat;\r
-import static org.junit.Assert.fail;\r
-import static org.junit.matchers.JUnitMatchers.containsString;\r
-\r
-public class FlexibleThreadPoolConfigBeanTest extends AbstractConfigTest {\r
-\r
-    private FlexibleThreadPoolModuleFactory flexibleFactory;\r
-    private final String instanceName = "flexible1";\r
-    private final String threadFactoryName = "threadFactoryName";\r
-\r
-    @Before\r
-    public void setUp() {\r
-\r
-        flexibleFactory = new FlexibleThreadPoolModuleFactory();\r
-        super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(flexibleFactory,\r
-                new NamingThreadFactoryModuleFactory()));\r
-    }\r
-\r
-    @Test\r
-    public void testCreateBean() throws InstanceAlreadyExistsException, ValidationException,\r
-            ConflictingVersionException {\r
-        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();\r
-\r
-        createFlexible(transaction, instanceName, threadFactoryName, 1, 20, 20);\r
-        transaction.validateConfig();\r
-        CommitStatus status = transaction.commit();\r
-\r
-        assertBeanCount(1, flexibleFactory.getImplementationName());\r
-        assertStatus(status, 2, 0, 0);\r
-    }\r
-\r
-    @Test\r
-    public void testReusingOldInstance() throws InstanceAlreadyExistsException, ConflictingVersionException,\r
-            ValidationException {\r
-\r
-        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();\r
-        createFlexible(transaction, instanceName, threadFactoryName, 1, 20, 10);\r
-\r
-        transaction.commit();\r
-\r
-        assertBeanCount(1, flexibleFactory.getImplementationName());\r
-\r
-        transaction = configRegistryClient.createTransaction();\r
-        CommitStatus status = transaction.commit();\r
-\r
-        assertBeanCount(1, flexibleFactory.getImplementationName());\r
-        assertStatus(status, 0, 0, 2);\r
-\r
-    }\r
-\r
-    @Test\r
-    public void testInstanceAlreadyExistsException() throws ConflictingVersionException, ValidationException {\r
-        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();\r
-\r
-        try {\r
-            createFlexible(transaction, instanceName, threadFactoryName, 1, 1, 2);\r
-            transaction.commit();\r
-        } catch (InstanceAlreadyExistsException e1) {\r
-            fail();\r
-        }\r
-\r
-        transaction = configRegistryClient.createTransaction();\r
-        try {\r
-            createFlexible(transaction, instanceName, "threadFactoryName1", 2, 2, 2);\r
-            fail();\r
-        } catch (InstanceAlreadyExistsException e) {\r
-            assertThat(\r
-                    e.getMessage(),\r
-                    containsString("There is an instance registered with name ModuleIdentifier{factoryName='threadpool-flexible', instanceName='flexible1'}"));\r
-        }\r
-    }\r
-\r
-    @Test\r
-    public void testValidationException() throws InstanceAlreadyExistsException {\r
-        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();\r
-\r
-        createFlexible(transaction, instanceName, threadFactoryName, 0, 10, 10);\r
-\r
-        try {\r
-            transaction.validateConfig();\r
-            fail();\r
-        } catch (ValidationException e) {\r
-            assertThat(e.getMessage(), containsString("MinThreadCount must be greater than zero"));\r
-        }\r
-    }\r
-\r
-    @Test\r
-    public void testValidationException2() throws InstanceAlreadyExistsException {\r
-        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();\r
-\r
-        createFlexible(transaction, instanceName, threadFactoryName, 0, 0, 10);\r
-\r
-        try {\r
-            transaction.validateConfig();\r
-            fail();\r
-        } catch (ValidationException e) {\r
-            assertThat(e.getMessage(), containsString("KeepAliveMillis must be greater than zero"));\r
-        }\r
-    }\r
-\r
-    @Test\r
-    public void testValidationException3() throws InstanceAlreadyExistsException {\r
-        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();\r
-\r
-        createFlexible(transaction, instanceName, threadFactoryName, 10, 50, 0);\r
-\r
-        try {\r
-            transaction.validateConfig();\r
-            fail();\r
-        } catch (ValidationException e) {\r
-            assertThat(e.getMessage(), containsString("MaxThreadCount must be greater than zero"));\r
-        }\r
-    }\r
-\r
-    private ObjectName createFlexible(ConfigTransactionJMXClient transaction, String instanceName,\r
-            String threadFactoryName, int minThreadCount, long keepAliveMillis, int maxThreadCount)\r
-            throws InstanceAlreadyExistsException {\r
-\r
-        ObjectName threadFactoryON = transaction.createModule(NamingThreadFactoryModuleFactory.NAME, threadFactoryName);\r
-        NamingThreadFactoryModuleMXBean namingThreadFactoryModuleMXBean = transaction.newMXBeanProxy(threadFactoryON,\r
-                NamingThreadFactoryModuleMXBean.class);\r
-        namingThreadFactoryModuleMXBean.setNamePrefix("prefix");\r
-\r
-        ObjectName flexibleON = transaction.createModule(flexibleFactory.getImplementationName(), instanceName);\r
-        FlexibleThreadPoolModuleMXBean mxBean = transaction.newMBeanProxy(flexibleON,\r
-                FlexibleThreadPoolModuleMXBean.class);\r
-        mxBean.setKeepAliveMillis(keepAliveMillis);\r
-        mxBean.setMaxThreadCount(maxThreadCount);\r
-        mxBean.setMinThreadCount(minThreadCount);\r
-        mxBean.setThreadFactory(threadFactoryON);\r
-        return flexibleON;\r
-    }\r
-\r
-    @Test\r
-    public void testReconfigurationInstance() throws InstanceAlreadyExistsException, ValidationException,\r
-            ConflictingVersionException, InstanceNotFoundException {\r
-        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();\r
-        createFlexible(transaction, instanceName, threadFactoryName, 2, 2, 2);\r
-\r
-        transaction.commit();\r
-\r
-        transaction = configRegistryClient.createTransaction();\r
-        ObjectName databaseNew = transaction.lookupConfigBean(flexibleFactory.getImplementationName(), instanceName);\r
-        FlexibleThreadPoolModuleMXBean proxy = transaction.newMXBeanProxy(databaseNew,\r
-                FlexibleThreadPoolModuleMXBean.class);\r
-        proxy.setMaxThreadCount(99);\r
-\r
-        CommitStatus status = transaction.commit();\r
-\r
-        assertBeanCount(1, flexibleFactory.getImplementationName());\r
-        assertStatus(status, 0, 1, 1);\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.flexible;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.controller.config.api.ConflictingVersionException;
+import org.opendaylight.controller.config.api.ValidationException;
+import org.opendaylight.controller.config.api.jmx.CommitStatus;
+import org.opendaylight.controller.config.manager.impl.AbstractConfigTest;
+import org.opendaylight.controller.config.manager.impl.factoriesresolver.HardcodedModuleFactoriesResolver;
+import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;
+import org.opendaylight.controller.config.yang.threadpool.impl.NamingThreadFactoryModuleFactory;
+import org.opendaylight.controller.config.yang.threadpool.impl.NamingThreadFactoryModuleMXBean;
+import org.opendaylight.controller.config.yang.threadpool.impl.flexible.FlexibleThreadPoolModuleFactory;
+import org.opendaylight.controller.config.yang.threadpool.impl.flexible.FlexibleThreadPoolModuleMXBean;
+
+import javax.management.InstanceAlreadyExistsException;
+import javax.management.InstanceNotFoundException;
+import javax.management.ObjectName;
+
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
+import static org.junit.matchers.JUnitMatchers.containsString;
+
+public class FlexibleThreadPoolConfigBeanTest extends AbstractConfigTest {
+
+    private FlexibleThreadPoolModuleFactory flexibleFactory;
+    private final String instanceName = "flexible1";
+    private final String threadFactoryName = "threadFactoryName";
+
+    @Before
+    public void setUp() {
+
+        flexibleFactory = new FlexibleThreadPoolModuleFactory();
+        super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(flexibleFactory,
+                new NamingThreadFactoryModuleFactory()));
+    }
+
+    @Test
+    public void testCreateBean() throws InstanceAlreadyExistsException, ValidationException,
+            ConflictingVersionException {
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
+
+        createFlexible(transaction, instanceName, threadFactoryName, 1, 20, 20);
+        transaction.validateConfig();
+        CommitStatus status = transaction.commit();
+
+        assertBeanCount(1, flexibleFactory.getImplementationName());
+        assertStatus(status, 2, 0, 0);
+    }
+
+    @Test
+    public void testReusingOldInstance() throws InstanceAlreadyExistsException, ConflictingVersionException,
+            ValidationException {
+
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
+        createFlexible(transaction, instanceName, threadFactoryName, 1, 20, 10);
+
+        transaction.commit();
+
+        assertBeanCount(1, flexibleFactory.getImplementationName());
+
+        transaction = configRegistryClient.createTransaction();
+        CommitStatus status = transaction.commit();
+
+        assertBeanCount(1, flexibleFactory.getImplementationName());
+        assertStatus(status, 0, 0, 2);
+
+    }
+
+    @Test
+    public void testInstanceAlreadyExistsException() throws ConflictingVersionException, ValidationException {
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
+
+        try {
+            createFlexible(transaction, instanceName, threadFactoryName, 1, 1, 2);
+            transaction.commit();
+        } catch (InstanceAlreadyExistsException e1) {
+            fail();
+        }
+
+        transaction = configRegistryClient.createTransaction();
+        try {
+            createFlexible(transaction, instanceName, "threadFactoryName1", 2, 2, 2);
+            fail();
+        } catch (InstanceAlreadyExistsException e) {
+            assertThat(
+                    e.getMessage(),
+                    containsString("There is an instance registered with name ModuleIdentifier{factoryName='threadpool-flexible', instanceName='flexible1'}"));
+        }
+    }
+
+    @Test
+    public void testValidationException() throws InstanceAlreadyExistsException {
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
+
+        createFlexible(transaction, instanceName, threadFactoryName, 0, 10, 10);
+
+        try {
+            transaction.validateConfig();
+            fail();
+        } catch (ValidationException e) {
+            assertThat(e.getMessage(), containsString("MinThreadCount must be greater than zero"));
+        }
+    }
+
+    @Test
+    public void testValidationException2() throws InstanceAlreadyExistsException {
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
+
+        createFlexible(transaction, instanceName, threadFactoryName, 0, 0, 10);
+
+        try {
+            transaction.validateConfig();
+            fail();
+        } catch (ValidationException e) {
+            assertThat(e.getMessage(), containsString("KeepAliveMillis must be greater than zero"));
+        }
+    }
+
+    @Test
+    public void testValidationException3() throws InstanceAlreadyExistsException {
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
+
+        createFlexible(transaction, instanceName, threadFactoryName, 10, 50, 0);
+
+        try {
+            transaction.validateConfig();
+            fail();
+        } catch (ValidationException e) {
+            assertThat(e.getMessage(), containsString("MaxThreadCount must be greater than zero"));
+        }
+    }
+
+    private ObjectName createFlexible(ConfigTransactionJMXClient transaction, String instanceName,
+            String threadFactoryName, int minThreadCount, long keepAliveMillis, int maxThreadCount)
+            throws InstanceAlreadyExistsException {
+
+        ObjectName threadFactoryON = transaction.createModule(NamingThreadFactoryModuleFactory.NAME, threadFactoryName);
+        NamingThreadFactoryModuleMXBean namingThreadFactoryModuleMXBean = transaction.newMXBeanProxy(threadFactoryON,
+                NamingThreadFactoryModuleMXBean.class);
+        namingThreadFactoryModuleMXBean.setNamePrefix("prefix");
+
+        ObjectName flexibleON = transaction.createModule(flexibleFactory.getImplementationName(), instanceName);
+        FlexibleThreadPoolModuleMXBean mxBean = transaction.newMBeanProxy(flexibleON,
+                FlexibleThreadPoolModuleMXBean.class);
+        mxBean.setKeepAliveMillis(keepAliveMillis);
+        mxBean.setMaxThreadCount(maxThreadCount);
+        mxBean.setMinThreadCount(minThreadCount);
+        mxBean.setThreadFactory(threadFactoryON);
+        return flexibleON;
+    }
+
+    @Test
+    public void testReconfigurationInstance() throws InstanceAlreadyExistsException, ValidationException,
+            ConflictingVersionException, InstanceNotFoundException {
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
+        createFlexible(transaction, instanceName, threadFactoryName, 2, 2, 2);
+
+        transaction.commit();
+
+        transaction = configRegistryClient.createTransaction();
+        ObjectName databaseNew = transaction.lookupConfigBean(flexibleFactory.getImplementationName(), instanceName);
+        FlexibleThreadPoolModuleMXBean proxy = transaction.newMXBeanProxy(databaseNew,
+                FlexibleThreadPoolModuleMXBean.class);
+        proxy.setMaxThreadCount(99);
+
+        CommitStatus status = transaction.commit();
+
+        assertBeanCount(1, flexibleFactory.getImplementationName());
+        assertStatus(status, 0, 1, 1);
+    }
+
+}
index 7280b04..6dea96e 100644 (file)
-/*\r
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.controller.config.threadpool.naming;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertThat;\r
-import static org.junit.Assert.assertTrue;\r
-import static org.junit.Assert.fail;\r
-import static org.junit.matchers.JUnitMatchers.containsString;\r
-\r
-import javax.management.InstanceAlreadyExistsException;\r
-import javax.management.InstanceNotFoundException;\r
-import javax.management.ObjectName;\r
-\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.opendaylight.controller.config.api.ConflictingVersionException;\r
-import org.opendaylight.controller.config.api.ValidationException;\r
-import org.opendaylight.controller.config.api.jmx.CommitStatus;\r
-import org.opendaylight.controller.config.manager.impl.AbstractConfigTest;\r
-import org.opendaylight.controller.config.manager.impl.factoriesresolver.HardcodedModuleFactoriesResolver;\r
-import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;\r
-import org.opendaylight.controller.config.yang.threadpool.ThreadFactoryServiceInterface;\r
-import org.opendaylight.controller.config.yang.threadpool.impl.NamingThreadFactoryModuleFactory;\r
-import org.opendaylight.controller.config.yang.threadpool.impl.NamingThreadFactoryModuleMXBean;\r
-\r
-public class NamingThreadPoolFactoryConfigBeanTest extends AbstractConfigTest {\r
-\r
-    private NamingThreadFactoryModuleFactory factory;\r
-    private final String instanceName = "named";\r
-\r
-    @Before\r
-    public void setUp() {\r
-\r
-        factory = new NamingThreadFactoryModuleFactory();\r
-        super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(factory));\r
-    }\r
-\r
-    @Test\r
-    public void testCreateBean() throws InstanceAlreadyExistsException, ValidationException,\r
-            ConflictingVersionException {\r
-        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();\r
-\r
-        createNamed(transaction, instanceName, "prefixes");\r
-        transaction.validateConfig();\r
-        CommitStatus status = transaction.commit();\r
-\r
-        assertEquals(1, configRegistry.lookupConfigBeans(factory.getImplementationName()).size());\r
-        assertEquals(1, status.getNewInstances().size());\r
-        assertEquals(0, status.getRecreatedInstances().size());\r
-        assertEquals(0, status.getReusedInstances().size());\r
-    }\r
-\r
-    @Test\r
-    public void testReusingOldInstance() throws InstanceAlreadyExistsException, ConflictingVersionException,\r
-            ValidationException {\r
-\r
-        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();\r
-        createNamed(transaction, instanceName, "prefixes");\r
-\r
-        transaction.commit();\r
-\r
-        assertEquals(1, configRegistry.lookupConfigBeans(factory.getImplementationName()).size());\r
-\r
-        transaction = configRegistryClient.createTransaction();\r
-        CommitStatus status = transaction.commit();\r
-\r
-        assertEquals(1, configRegistry.lookupConfigBeans(factory.getImplementationName()).size());\r
-        assertEquals(0, status.getNewInstances().size());\r
-        assertEquals(0, status.getRecreatedInstances().size());\r
-        assertEquals(1, status.getReusedInstances().size());\r
-\r
-    }\r
-\r
-    @Test\r
-    public void testInstanceAlreadyExistsException() throws ConflictingVersionException, ValidationException,\r
-            InstanceAlreadyExistsException {\r
-        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();\r
-\r
-        createNamed(transaction, instanceName, "prefixes");\r
-        transaction.commit();\r
-\r
-        transaction = configRegistryClient.createTransaction();\r
-        try {\r
-            createNamed(transaction, instanceName, "prefixes1");\r
-            fail();\r
-        } catch (InstanceAlreadyExistsException e) {\r
-            assertThat(\r
-                    e.getMessage(),\r
-                    containsString("There is an instance registered with name ModuleIdentifier{factoryName='threadfactory-naming', instanceName='named'}"));\r
-        }\r
-    }\r
-\r
-    @Test\r
-    public void testValidationException() throws InstanceAlreadyExistsException {\r
-        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();\r
-\r
-        ObjectName nameCreated = transaction.createModule(factory.getImplementationName(), instanceName);\r
-        transaction.newMXBeanProxy(nameCreated, ThreadFactoryServiceInterface.class);\r
-        try {\r
-            transaction.validateConfig();\r
-            fail();\r
-        } catch (ValidationException e) {\r
-            assertTrue(e.getFailedValidations().containsKey(factory.getImplementationName()));\r
-            assertEquals(1, e.getFailedValidations().get(factory.getImplementationName()).keySet().size());\r
-        }\r
-    }\r
-\r
-    @Test\r
-    public void testReconfigurationInstance() throws InstanceAlreadyExistsException, ValidationException,\r
-            ConflictingVersionException, InstanceNotFoundException {\r
-        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();\r
-        createNamed(transaction, instanceName, "pref");\r
-\r
-        transaction.commit();\r
-\r
-        transaction = configRegistryClient.createTransaction();\r
-        ObjectName databaseNew = transaction.lookupConfigBean(factory.getImplementationName(), instanceName);\r
-        NamingThreadFactoryModuleMXBean proxy = transaction.newMXBeanProxy(databaseNew,\r
-                NamingThreadFactoryModuleMXBean.class);\r
-        proxy.setNamePrefix("pref1");\r
-\r
-        CommitStatus status = transaction.commit();\r
-\r
-        assertBeanCount(1, factory.getImplementationName());\r
-        assertStatus(status, 0, 1, 0);\r
-    }\r
-\r
-    private ObjectName createNamed(ConfigTransactionJMXClient transaction, String instanceName, String prefixes)\r
-            throws InstanceAlreadyExistsException {\r
-        ObjectName nameCreated = transaction.createModule(factory.getImplementationName(), instanceName);\r
-        NamingThreadFactoryModuleMXBean mxBean = transaction.newMBeanProxy(nameCreated,\r
-                NamingThreadFactoryModuleMXBean.class);\r
-        mxBean.setNamePrefix(prefixes);\r
-        return nameCreated;\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.naming;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.junit.matchers.JUnitMatchers.containsString;
+
+import javax.management.InstanceAlreadyExistsException;
+import javax.management.InstanceNotFoundException;
+import javax.management.ObjectName;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.controller.config.api.ConflictingVersionException;
+import org.opendaylight.controller.config.api.ValidationException;
+import org.opendaylight.controller.config.api.jmx.CommitStatus;
+import org.opendaylight.controller.config.manager.impl.AbstractConfigTest;
+import org.opendaylight.controller.config.manager.impl.factoriesresolver.HardcodedModuleFactoriesResolver;
+import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;
+import org.opendaylight.controller.config.yang.threadpool.ThreadFactoryServiceInterface;
+import org.opendaylight.controller.config.yang.threadpool.impl.NamingThreadFactoryModuleFactory;
+import org.opendaylight.controller.config.yang.threadpool.impl.NamingThreadFactoryModuleMXBean;
+
+public class NamingThreadPoolFactoryConfigBeanTest extends AbstractConfigTest {
+
+    private NamingThreadFactoryModuleFactory factory;
+    private final String instanceName = "named";
+
+    @Before
+    public void setUp() {
+
+        factory = new NamingThreadFactoryModuleFactory();
+        super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(factory));
+    }
+
+    @Test
+    public void testCreateBean() throws InstanceAlreadyExistsException, ValidationException,
+            ConflictingVersionException {
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
+
+        createNamed(transaction, instanceName, "prefixes");
+        transaction.validateConfig();
+        CommitStatus status = transaction.commit();
+
+        assertEquals(1, configRegistry.lookupConfigBeans(factory.getImplementationName()).size());
+        assertEquals(1, status.getNewInstances().size());
+        assertEquals(0, status.getRecreatedInstances().size());
+        assertEquals(0, status.getReusedInstances().size());
+    }
+
+    @Test
+    public void testReusingOldInstance() throws InstanceAlreadyExistsException, ConflictingVersionException,
+            ValidationException {
+
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
+        createNamed(transaction, instanceName, "prefixes");
+
+        transaction.commit();
+
+        assertEquals(1, configRegistry.lookupConfigBeans(factory.getImplementationName()).size());
+
+        transaction = configRegistryClient.createTransaction();
+        CommitStatus status = transaction.commit();
+
+        assertEquals(1, configRegistry.lookupConfigBeans(factory.getImplementationName()).size());
+        assertEquals(0, status.getNewInstances().size());
+        assertEquals(0, status.getRecreatedInstances().size());
+        assertEquals(1, status.getReusedInstances().size());
+
+    }
+
+    @Test
+    public void testInstanceAlreadyExistsException() throws ConflictingVersionException, ValidationException,
+            InstanceAlreadyExistsException {
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
+
+        createNamed(transaction, instanceName, "prefixes");
+        transaction.commit();
+
+        transaction = configRegistryClient.createTransaction();
+        try {
+            createNamed(transaction, instanceName, "prefixes1");
+            fail();
+        } catch (InstanceAlreadyExistsException e) {
+            assertThat(
+                    e.getMessage(),
+                    containsString("There is an instance registered with name ModuleIdentifier{factoryName='threadfactory-naming', instanceName='named'}"));
+        }
+    }
+
+    @Test
+    public void testValidationException() throws InstanceAlreadyExistsException {
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
+
+        ObjectName nameCreated = transaction.createModule(factory.getImplementationName(), instanceName);
+        transaction.newMXBeanProxy(nameCreated, ThreadFactoryServiceInterface.class);
+        try {
+            transaction.validateConfig();
+            fail();
+        } catch (ValidationException e) {
+            assertTrue(e.getFailedValidations().containsKey(factory.getImplementationName()));
+            assertEquals(1, e.getFailedValidations().get(factory.getImplementationName()).keySet().size());
+        }
+    }
+
+    @Test
+    public void testReconfigurationInstance() throws InstanceAlreadyExistsException, ValidationException,
+            ConflictingVersionException, InstanceNotFoundException {
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
+        createNamed(transaction, instanceName, "pref");
+
+        transaction.commit();
+
+        transaction = configRegistryClient.createTransaction();
+        ObjectName databaseNew = transaction.lookupConfigBean(factory.getImplementationName(), instanceName);
+        NamingThreadFactoryModuleMXBean proxy = transaction.newMXBeanProxy(databaseNew,
+                NamingThreadFactoryModuleMXBean.class);
+        proxy.setNamePrefix("pref1");
+
+        CommitStatus status = transaction.commit();
+
+        assertBeanCount(1, factory.getImplementationName());
+        assertStatus(status, 0, 1, 0);
+    }
+
+    private ObjectName createNamed(ConfigTransactionJMXClient transaction, String instanceName, String prefixes)
+            throws InstanceAlreadyExistsException {
+        ObjectName nameCreated = transaction.createModule(factory.getImplementationName(), instanceName);
+        NamingThreadFactoryModuleMXBean mxBean = transaction.newMBeanProxy(nameCreated,
+                NamingThreadFactoryModuleMXBean.class);
+        mxBean.setNamePrefix(prefixes);
+        return nameCreated;
+    }
+
+}
index f22da34..47613bf 100644 (file)
@@ -1,66 +1,66 @@
-/*\r
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.controller.config.threadpool.naming;\r
-\r
-import static org.mockito.Matchers.any;\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.io.Closeable;\r
-import java.io.IOException;\r
-\r
-import org.opendaylight.controller.config.api.DynamicMBeanWithInstance;\r
-import org.opendaylight.controller.config.api.ModuleIdentifier;\r
-import org.opendaylight.controller.config.spi.Module;\r
-import org.opendaylight.controller.config.threadpool.util.NamingThreadPoolFactory;\r
-import org.opendaylight.controller.config.yang.threadpool.ThreadFactoryServiceInterface;\r
-import org.opendaylight.controller.config.yang.threadpool.impl.NamingThreadFactoryModuleMXBean;\r
-\r
-public class TestingNamingThreadPoolFactoryModule implements Module, ThreadFactoryServiceInterface,\r
-        NamingThreadFactoryModuleMXBean {\r
-\r
-    private final NamingThreadPoolFactory fact;\r
-\r
-    public TestingNamingThreadPoolFactoryModule() throws IOException {\r
-        fact = mock(NamingThreadPoolFactory.class);\r
-        Thread thread = mock(Thread.class);\r
-        doNothing().when(thread).start();\r
-        doReturn(thread).when(fact).newThread(any(Runnable.class));\r
-        doNothing().when(fact).close();\r
-    }\r
-\r
-    public TestingNamingThreadPoolFactoryModule(DynamicMBeanWithInstance old) {\r
-        fact = (NamingThreadPoolFactory) old.getInstance();\r
-    }\r
-\r
-    @Override\r
-    public ModuleIdentifier getIdentifier() {\r
-        return new ModuleIdentifier(TestingNamingThreadPoolFactoryModule.class.getCanonicalName(), "mock");\r
-    }\r
-\r
-    @Override\r
-    public String getNamePrefix() {\r
-        return null;\r
-    }\r
-\r
-    @Override\r
-    public void setNamePrefix(String arg) {\r
-        throw new UnsupportedOperationException();\r
-    }\r
-\r
-    @Override\r
-    public void validate() {\r
-    }\r
-\r
-    @Override\r
-    public Closeable getInstance() {\r
-        return fact;\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.naming;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+
+import java.io.Closeable;
+import java.io.IOException;
+
+import org.opendaylight.controller.config.api.DynamicMBeanWithInstance;
+import org.opendaylight.controller.config.api.ModuleIdentifier;
+import org.opendaylight.controller.config.spi.Module;
+import org.opendaylight.controller.config.threadpool.util.NamingThreadPoolFactory;
+import org.opendaylight.controller.config.yang.threadpool.ThreadFactoryServiceInterface;
+import org.opendaylight.controller.config.yang.threadpool.impl.NamingThreadFactoryModuleMXBean;
+
+public class TestingNamingThreadPoolFactoryModule implements Module, ThreadFactoryServiceInterface,
+        NamingThreadFactoryModuleMXBean {
+
+    private final NamingThreadPoolFactory fact;
+
+    public TestingNamingThreadPoolFactoryModule() throws IOException {
+        fact = mock(NamingThreadPoolFactory.class);
+        Thread thread = mock(Thread.class);
+        doNothing().when(thread).start();
+        doReturn(thread).when(fact).newThread(any(Runnable.class));
+        doNothing().when(fact).close();
+    }
+
+    public TestingNamingThreadPoolFactoryModule(DynamicMBeanWithInstance old) {
+        fact = (NamingThreadPoolFactory) old.getInstance();
+    }
+
+    @Override
+    public ModuleIdentifier getIdentifier() {
+        return new ModuleIdentifier(TestingNamingThreadPoolFactoryModule.class.getCanonicalName(), "mock");
+    }
+
+    @Override
+    public String getNamePrefix() {
+        return null;
+    }
+
+    @Override
+    public void setNamePrefix(String arg) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void validate() {
+    }
+
+    @Override
+    public Closeable getInstance() {
+        return fact;
+    }
+
+}
index 6183cb5..538d437 100644 (file)
-/*\r
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.controller.config.threadpool.scheduled;\r
-\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.opendaylight.controller.config.api.ConflictingVersionException;\r
-import org.opendaylight.controller.config.api.ValidationException;\r
-import org.opendaylight.controller.config.api.jmx.CommitStatus;\r
-import org.opendaylight.controller.config.manager.impl.AbstractConfigTest;\r
-import org.opendaylight.controller.config.manager.impl.factoriesresolver.HardcodedModuleFactoriesResolver;\r
-import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;\r
-import org.opendaylight.controller.config.yang.threadpool.impl.NamingThreadFactoryModuleFactory;\r
-import org.opendaylight.controller.config.yang.threadpool.impl.NamingThreadFactoryModuleMXBean;\r
-import org.opendaylight.controller.config.yang.threadpool.impl.scheduled.ScheduledThreadPoolModuleFactory;\r
-import org.opendaylight.controller.config.yang.threadpool.impl.scheduled.ScheduledThreadPoolModuleMXBean;\r
-\r
-import javax.management.InstanceAlreadyExistsException;\r
-import javax.management.InstanceNotFoundException;\r
-import javax.management.ObjectName;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertThat;\r
-import static org.junit.Assert.assertTrue;\r
-import static org.junit.Assert.fail;\r
-import static org.junit.matchers.JUnitMatchers.containsString;\r
-\r
-public class ScheduledThreadPoolConfigBeanTest extends AbstractConfigTest {\r
-\r
-    private ScheduledThreadPoolModuleFactory factory;\r
-    private final String instanceName = "scheduled1";\r
-\r
-    @Before\r
-    public void setUp() {\r
-\r
-        factory = new ScheduledThreadPoolModuleFactory();\r
-        super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(factory,\r
-                new NamingThreadFactoryModuleFactory()));\r
-    }\r
-\r
-    @Test\r
-    public void testCreateBean() throws InstanceAlreadyExistsException, ValidationException,\r
-            ConflictingVersionException {\r
-        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();\r
-\r
-        createScheduled(transaction, instanceName, 1);\r
-        transaction.validateConfig();\r
-        CommitStatus status = transaction.commit();\r
-\r
-        assertBeanCount(1, factory.getImplementationName());\r
-        assertStatus(status, 2, 0, 0);\r
-    }\r
-\r
-    @Test\r
-    public void testReusingOldInstance() throws InstanceAlreadyExistsException, ConflictingVersionException,\r
-            ValidationException {\r
-\r
-        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();\r
-        createScheduled(transaction, instanceName, 1);\r
-\r
-        transaction.commit();\r
-\r
-        assertBeanCount(1, factory.getImplementationName());\r
-\r
-        transaction = configRegistryClient.createTransaction();\r
-        CommitStatus status = transaction.commit();\r
-\r
-        assertBeanCount(1, factory.getImplementationName());\r
-        assertStatus(status, 0, 0, 2);\r
-    }\r
-\r
-    @Test\r
-    public void testReconfigurationInstance() throws InstanceAlreadyExistsException, ValidationException,\r
-            ConflictingVersionException, InstanceNotFoundException {\r
-        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();\r
-        createScheduled(transaction, instanceName, 1);\r
-\r
-        transaction.commit();\r
-\r
-        transaction = configRegistryClient.createTransaction();\r
-        ObjectName databaseNew = transaction.lookupConfigBean(factory.getImplementationName(), instanceName);\r
-        ScheduledThreadPoolModuleMXBean proxy = transaction.newMXBeanProxy(databaseNew,\r
-                ScheduledThreadPoolModuleMXBean.class);\r
-        proxy.setMaxThreadCount(99);\r
-\r
-        CommitStatus status = transaction.commit();\r
-\r
-        assertBeanCount(1, factory.getImplementationName());\r
-        assertStatus(status, 0, 1, 1);\r
-    }\r
-\r
-    @Test\r
-    public void testDestroy() throws InstanceAlreadyExistsException, ValidationException, ConflictingVersionException,\r
-            InstanceNotFoundException {\r
-        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();\r
-        createScheduled(transaction, instanceName, 1);\r
-\r
-        transaction.commit();\r
-\r
-        transaction = configRegistryClient.createTransaction();\r
-        transaction.destroyConfigBean(factory.getImplementationName(), instanceName);\r
-        CommitStatus status = transaction.commit();\r
-\r
-        assertBeanCount(0, factory.getImplementationName());\r
-        assertStatus(status, 0, 0, 1);\r
-    }\r
-\r
-    @Test\r
-    public void testInstanceAlreadyExistsException() throws ConflictingVersionException, ValidationException,\r
-            InstanceAlreadyExistsException {\r
-        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();\r
-        createScheduled(transaction, instanceName, 1);\r
-        transaction.commit();\r
-        transaction = configRegistryClient.createTransaction();\r
-        try {\r
-            createScheduled(transaction, instanceName, 2);\r
-            fail();\r
-        } catch (InstanceAlreadyExistsException e) {\r
-            assertThat(\r
-                    e.getMessage(),\r
-                    containsString("There is an instance registered with name ModuleIdentifier{factoryName='threadpool-scheduled', instanceName='scheduled1'}"));\r
-        }\r
-    }\r
-\r
-    @Test\r
-    public void testValidationException() throws InstanceAlreadyExistsException {\r
-        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();\r
-        createScheduled(transaction, instanceName, 0);\r
-\r
-        try {\r
-            transaction.validateConfig();\r
-            fail();\r
-        } catch (ValidationException e) {\r
-            assertTrue(e.getFailedValidations().containsKey(factory.getImplementationName()));\r
-            assertEquals(1, e.getFailedValidations().get(factory.getImplementationName()).keySet().size());\r
-        }\r
-    }\r
-\r
-    private ObjectName createScheduled(ConfigTransactionJMXClient transaction, String instanceName, int maxThreadCount)\r
-            throws InstanceAlreadyExistsException {\r
-        ObjectName nameCreated = transaction.createModule(factory.getImplementationName(), instanceName);\r
-        ScheduledThreadPoolModuleMXBean mxBean = transaction.newMBeanProxy(nameCreated,\r
-                ScheduledThreadPoolModuleMXBean.class);\r
-        mxBean.setMaxThreadCount(maxThreadCount);\r
-\r
-        ObjectName threadFactoryON = transaction.createModule(NamingThreadFactoryModuleFactory.NAME, "naming");\r
-        NamingThreadFactoryModuleMXBean namingThreadFactoryModuleMXBean = transaction.newMXBeanProxy(threadFactoryON,\r
-                NamingThreadFactoryModuleMXBean.class);\r
-        namingThreadFactoryModuleMXBean.setNamePrefix("prefix");\r
-\r
-        mxBean.setThreadFactory(threadFactoryON);\r
-\r
-        return nameCreated;\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 org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.controller.config.api.ConflictingVersionException;
+import org.opendaylight.controller.config.api.ValidationException;
+import org.opendaylight.controller.config.api.jmx.CommitStatus;
+import org.opendaylight.controller.config.manager.impl.AbstractConfigTest;
+import org.opendaylight.controller.config.manager.impl.factoriesresolver.HardcodedModuleFactoriesResolver;
+import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;
+import org.opendaylight.controller.config.yang.threadpool.impl.NamingThreadFactoryModuleFactory;
+import org.opendaylight.controller.config.yang.threadpool.impl.NamingThreadFactoryModuleMXBean;
+import org.opendaylight.controller.config.yang.threadpool.impl.scheduled.ScheduledThreadPoolModuleFactory;
+import org.opendaylight.controller.config.yang.threadpool.impl.scheduled.ScheduledThreadPoolModuleMXBean;
+
+import javax.management.InstanceAlreadyExistsException;
+import javax.management.InstanceNotFoundException;
+import javax.management.ObjectName;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.junit.matchers.JUnitMatchers.containsString;
+
+public class ScheduledThreadPoolConfigBeanTest extends AbstractConfigTest {
+
+    private ScheduledThreadPoolModuleFactory factory;
+    private final String instanceName = "scheduled1";
+
+    @Before
+    public void setUp() {
+
+        factory = new ScheduledThreadPoolModuleFactory();
+        super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(factory,
+                new NamingThreadFactoryModuleFactory()));
+    }
+
+    @Test
+    public void testCreateBean() throws InstanceAlreadyExistsException, ValidationException,
+            ConflictingVersionException {
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
+
+        createScheduled(transaction, instanceName, 1);
+        transaction.validateConfig();
+        CommitStatus status = transaction.commit();
+
+        assertBeanCount(1, factory.getImplementationName());
+        assertStatus(status, 2, 0, 0);
+    }
+
+    @Test
+    public void testReusingOldInstance() throws InstanceAlreadyExistsException, ConflictingVersionException,
+            ValidationException {
+
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
+        createScheduled(transaction, instanceName, 1);
+
+        transaction.commit();
+
+        assertBeanCount(1, factory.getImplementationName());
+
+        transaction = configRegistryClient.createTransaction();
+        CommitStatus status = transaction.commit();
+
+        assertBeanCount(1, factory.getImplementationName());
+        assertStatus(status, 0, 0, 2);
+    }
+
+    @Test
+    public void testReconfigurationInstance() throws InstanceAlreadyExistsException, ValidationException,
+            ConflictingVersionException, InstanceNotFoundException {
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
+        createScheduled(transaction, instanceName, 1);
+
+        transaction.commit();
+
+        transaction = configRegistryClient.createTransaction();
+        ObjectName databaseNew = transaction.lookupConfigBean(factory.getImplementationName(), instanceName);
+        ScheduledThreadPoolModuleMXBean proxy = transaction.newMXBeanProxy(databaseNew,
+                ScheduledThreadPoolModuleMXBean.class);
+        proxy.setMaxThreadCount(99);
+
+        CommitStatus status = transaction.commit();
+
+        assertBeanCount(1, factory.getImplementationName());
+        assertStatus(status, 0, 1, 1);
+    }
+
+    @Test
+    public void testDestroy() throws InstanceAlreadyExistsException, ValidationException, ConflictingVersionException,
+            InstanceNotFoundException {
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
+        createScheduled(transaction, instanceName, 1);
+
+        transaction.commit();
+
+        transaction = configRegistryClient.createTransaction();
+        transaction.destroyConfigBean(factory.getImplementationName(), instanceName);
+        CommitStatus status = transaction.commit();
+
+        assertBeanCount(0, factory.getImplementationName());
+        assertStatus(status, 0, 0, 1);
+    }
+
+    @Test
+    public void testInstanceAlreadyExistsException() throws ConflictingVersionException, ValidationException,
+            InstanceAlreadyExistsException {
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
+        createScheduled(transaction, instanceName, 1);
+        transaction.commit();
+        transaction = configRegistryClient.createTransaction();
+        try {
+            createScheduled(transaction, instanceName, 2);
+            fail();
+        } catch (InstanceAlreadyExistsException e) {
+            assertThat(
+                    e.getMessage(),
+                    containsString("There is an instance registered with name ModuleIdentifier{factoryName='threadpool-scheduled', instanceName='scheduled1'}"));
+        }
+    }
+
+    @Test
+    public void testValidationException() throws InstanceAlreadyExistsException {
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
+        createScheduled(transaction, instanceName, 0);
+
+        try {
+            transaction.validateConfig();
+            fail();
+        } catch (ValidationException e) {
+            assertTrue(e.getFailedValidations().containsKey(factory.getImplementationName()));
+            assertEquals(1, e.getFailedValidations().get(factory.getImplementationName()).keySet().size());
+        }
+    }
+
+    private ObjectName createScheduled(ConfigTransactionJMXClient transaction, String instanceName, int maxThreadCount)
+            throws InstanceAlreadyExistsException {
+        ObjectName nameCreated = transaction.createModule(factory.getImplementationName(), instanceName);
+        ScheduledThreadPoolModuleMXBean mxBean = transaction.newMBeanProxy(nameCreated,
+                ScheduledThreadPoolModuleMXBean.class);
+        mxBean.setMaxThreadCount(maxThreadCount);
+
+        ObjectName threadFactoryON = transaction.createModule(NamingThreadFactoryModuleFactory.NAME, "naming");
+        NamingThreadFactoryModuleMXBean namingThreadFactoryModuleMXBean = transaction.newMXBeanProxy(threadFactoryON,
+                NamingThreadFactoryModuleMXBean.class);
+        namingThreadFactoryModuleMXBean.setNamePrefix("prefix");
+
+        mxBean.setThreadFactory(threadFactoryON);
+
+        return nameCreated;
+    }
+
+}
index 0fe5b0d..2ba1b3b 100644 (file)
@@ -1,82 +1,82 @@
-/*\r
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.controller.config.threadpool.scheduled;\r
-\r
-import com.google.common.util.concurrent.ListenableFutureTask;\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.scheduled.ScheduledThreadPoolModuleMXBean;\r
-\r
-import javax.management.ObjectName;\r
-import java.util.concurrent.ScheduledExecutorService;\r
-import java.util.concurrent.ScheduledFuture;\r
-import java.util.concurrent.TimeUnit;\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
-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) {
+    }
+
+}
index 15cc7bc..a2befba 100644 (file)
@@ -1,77 +1,77 @@
-/*\r
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.controller.netconf.impl.mapping.operations;\r
-\r
-import org.opendaylight.controller.netconf.api.NetconfDocumentedException;\r
-import org.opendaylight.controller.netconf.api.NetconfSession;\r
-import org.opendaylight.controller.netconf.mapping.api.DefaultNetconfOperation;\r
-import org.opendaylight.controller.netconf.util.mapping.AbstractSingletonNetconfOperation;\r
-import org.opendaylight.controller.netconf.util.xml.XmlElement;\r
-import org.opendaylight.controller.netconf.util.xml.XmlNetconfConstants;\r
-import org.opendaylight.controller.netconf.util.xml.XmlUtil;\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
-import org.w3c.dom.Document;\r
-import org.w3c.dom.Element;\r
-\r
-import com.google.common.base.Optional;\r
-\r
-public class DefaultStartExi extends AbstractSingletonNetconfOperation implements DefaultNetconfOperation {\r
-\r
-    public static final String START_EXI = "start-exi";\r
-\r
-    private NetconfSession netconfSession;\r
-\r
-    private static final Logger logger = LoggerFactory.getLogger(DefaultStartExi.class);\r
-\r
-    public DefaultStartExi(String netconfSessionIdForReporting) {\r
-        super(netconfSessionIdForReporting);\r
-    }\r
-\r
-    @Override\r
-    protected String getOperationName() {\r
-        return START_EXI;\r
-    }\r
-\r
-    @Override\r
-    protected Element handleWithNoSubsequentOperations(Document document, XmlElement operationElement) throws NetconfDocumentedException {\r
-\r
-        Element getSchemaResult = XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.of(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0));\r
-\r
-        throw new UnsupportedOperationException("Not implemented");\r
-\r
-        /*\r
-        try {\r
-            ExiParameters exiParams = new ExiParameters();\r
-            exiParams.setParametersFromXmlElement(operationElement);\r
-\r
-            netconfSession.addExiDecoder(ExiDecoderHandler.HANDLER_NAME, new ExiDecoderHandler(exiParams));\r
-            netconfSession.addExiEncoderAfterMessageSent(ExiEncoderHandler.HANDLER_NAME,new ExiEncoderHandler(exiParams));\r
-\r
-        } catch (EXIException e) {\r
-            getSchemaResult = document\r
-                    .createElement(XmlNetconfConstants.RPC_ERROR);\r
-        }\r
-\r
-        logger.trace("{} operation successful", START_EXI);\r
-        logger.debug("received start-exi message {} ", XmlUtil.toString(document));\r
-        return getSchemaResult;\r
-        */\r
-    }\r
-\r
-    @Override\r
-    public void setNetconfSession(NetconfSession s) {\r
-        netconfSession = s;\r
-    }\r
-\r
-    public NetconfSession getNetconfSession() {\r
-        return netconfSession;\r
-    }\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.netconf.impl.mapping.operations;
+
+import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
+import org.opendaylight.controller.netconf.api.NetconfSession;
+import org.opendaylight.controller.netconf.mapping.api.DefaultNetconfOperation;
+import org.opendaylight.controller.netconf.util.mapping.AbstractSingletonNetconfOperation;
+import org.opendaylight.controller.netconf.util.xml.XmlElement;
+import org.opendaylight.controller.netconf.util.xml.XmlNetconfConstants;
+import org.opendaylight.controller.netconf.util.xml.XmlUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import com.google.common.base.Optional;
+
+public class DefaultStartExi extends AbstractSingletonNetconfOperation implements DefaultNetconfOperation {
+
+    public static final String START_EXI = "start-exi";
+
+    private NetconfSession netconfSession;
+
+    private static final Logger logger = LoggerFactory.getLogger(DefaultStartExi.class);
+
+    public DefaultStartExi(String netconfSessionIdForReporting) {
+        super(netconfSessionIdForReporting);
+    }
+
+    @Override
+    protected String getOperationName() {
+        return START_EXI;
+    }
+
+    @Override
+    protected Element handleWithNoSubsequentOperations(Document document, XmlElement operationElement) throws NetconfDocumentedException {
+
+        Element getSchemaResult = XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.of(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0));
+
+        throw new UnsupportedOperationException("Not implemented");
+
+        /*
+        try {
+            ExiParameters exiParams = new ExiParameters();
+            exiParams.setParametersFromXmlElement(operationElement);
+
+            netconfSession.addExiDecoder(ExiDecoderHandler.HANDLER_NAME, new ExiDecoderHandler(exiParams));
+            netconfSession.addExiEncoderAfterMessageSent(ExiEncoderHandler.HANDLER_NAME,new ExiEncoderHandler(exiParams));
+
+        } catch (EXIException e) {
+            getSchemaResult = document
+                    .createElement(XmlNetconfConstants.RPC_ERROR);
+        }
+
+        logger.trace("{} operation successful", START_EXI);
+        logger.debug("received start-exi message {} ", XmlUtil.toString(document));
+        return getSchemaResult;
+        */
+    }
+
+    @Override
+    public void setNetconfSession(NetconfSession s) {
+        netconfSession = s;
+    }
+
+    public NetconfSession getNetconfSession() {
+        return netconfSession;
+    }
+
+
+}
index ae3b00b..836f826 100644 (file)
@@ -1,62 +1,62 @@
-/*\r
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.controller.netconf.impl.mapping.operations;\r
-\r
-import org.opendaylight.controller.netconf.api.NetconfDocumentedException;\r
-import org.opendaylight.controller.netconf.api.NetconfSession;\r
-import org.opendaylight.controller.netconf.mapping.api.DefaultNetconfOperation;\r
-import org.opendaylight.controller.netconf.util.mapping.AbstractSingletonNetconfOperation;\r
-import org.opendaylight.controller.netconf.util.xml.XmlElement;\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
-import org.w3c.dom.Document;\r
-import org.w3c.dom.Element;\r
-\r
-public class DefaultStopExi extends AbstractSingletonNetconfOperation implements DefaultNetconfOperation {\r
-\r
-    public static final String STOP_EXI = "stop-exi";\r
-    private NetconfSession netconfSession;\r
-\r
-    private static final Logger logger = LoggerFactory\r
-            .getLogger(DefaultStartExi.class);\r
-\r
-    public DefaultStopExi(String netconfSessionIdForReporting) {\r
-        super(netconfSessionIdForReporting);\r
-    }\r
-\r
-    @Override\r
-    protected String getOperationName() {\r
-        return STOP_EXI;\r
-    }\r
-\r
-    @Override\r
-    protected Element handleWithNoSubsequentOperations(Document document, XmlElement operationElement)\r
-            throws NetconfDocumentedException {\r
-        throw new UnsupportedOperationException("Not implemented");\r
-        /*\r
-        netconfSession.remove(ExiDecoderHandler.class);\r
-        netconfSession.removeAfterMessageSent(ExiEncoderHandler.HANDLER_NAME);\r
-\r
-        Element getSchemaResult = document.createElement(XmlNetconfConstants.OK);\r
-        XmlUtil.addNamespaceAttr(getSchemaResult,\r
-                XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0);\r
-        logger.trace("{} operation successful", STOP_EXI);\r
-        logger.debug("received stop-exi message {} ", XmlUtil.toString(document));\r
-        return getSchemaResult;\r
-        */\r
-    }\r
-\r
-    @Override\r
-    public void setNetconfSession(NetconfSession s) {\r
-        this.netconfSession = s;\r
-    }\r
-\r
-    public NetconfSession getNetconfSession() {\r
-        return netconfSession;\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.netconf.impl.mapping.operations;
+
+import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
+import org.opendaylight.controller.netconf.api.NetconfSession;
+import org.opendaylight.controller.netconf.mapping.api.DefaultNetconfOperation;
+import org.opendaylight.controller.netconf.util.mapping.AbstractSingletonNetconfOperation;
+import org.opendaylight.controller.netconf.util.xml.XmlElement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+public class DefaultStopExi extends AbstractSingletonNetconfOperation implements DefaultNetconfOperation {
+
+    public static final String STOP_EXI = "stop-exi";
+    private NetconfSession netconfSession;
+
+    private static final Logger logger = LoggerFactory
+            .getLogger(DefaultStartExi.class);
+
+    public DefaultStopExi(String netconfSessionIdForReporting) {
+        super(netconfSessionIdForReporting);
+    }
+
+    @Override
+    protected String getOperationName() {
+        return STOP_EXI;
+    }
+
+    @Override
+    protected Element handleWithNoSubsequentOperations(Document document, XmlElement operationElement)
+            throws NetconfDocumentedException {
+        throw new UnsupportedOperationException("Not implemented");
+        /*
+        netconfSession.remove(ExiDecoderHandler.class);
+        netconfSession.removeAfterMessageSent(ExiEncoderHandler.HANDLER_NAME);
+
+        Element getSchemaResult = document.createElement(XmlNetconfConstants.OK);
+        XmlUtil.addNamespaceAttr(getSchemaResult,
+                XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0);
+        logger.trace("{} operation successful", STOP_EXI);
+        logger.debug("received stop-exi message {} ", XmlUtil.toString(document));
+        return getSchemaResult;
+        */
+    }
+
+    @Override
+    public void setNetconfSession(NetconfSession s) {
+        this.netconfSession = s;
+    }
+
+    public NetconfSession getNetconfSession() {
+        return netconfSession;
+    }
+}
index d7beb5d..58c6566 100644 (file)
@@ -1,43 +1,43 @@
-/*\r
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.controller.netconf.impl;\r
-\r
-import static junit.framework.Assert.assertNotNull;\r
-\r
-import org.junit.Test;\r
-import org.opendaylight.controller.netconf.api.NetconfMessage;\r
-import org.opendaylight.controller.netconf.util.test.XmlFileLoader;\r
-\r
-public class ExiEncodeDecodeTest  {\r
-    @Test\r
-    public void encodeExi() throws Exception{\r
-\r
-        String startExiString = XmlFileLoader.xmlFileToString("netconfMessages/startExi.xml");\r
-        assertNotNull(startExiString);\r
-\r
-        NetconfMessage startExiMessage = XmlFileLoader.xmlFileToNetconfMessage(("netconfMessages/startExi.xml"));\r
-        assertNotNull(startExiMessage);\r
-\r
-        /*\r
-        ExiParameters exiParams = new ExiParameters();\r
-        exiParams.setParametersFromXmlElement(XmlElement.fromDomElement(startExiMessage.getDocument().getDocumentElement()));\r
-        assertNotNull(exiParams);\r
-\r
-        ByteBuf encodedBuf = Unpooled.buffer();\r
-        ByteBuf sourceBuf = Unpooled.copiedBuffer(startExiString.getBytes());\r
-        ExiUtil.encode(sourceBuf, encodedBuf, exiParams);\r
-\r
-        List<Object> newOut = new ArrayList<Object>();\r
-        ExiUtil.decode(encodedBuf, newOut, exiParams);\r
-\r
-        ByteBuf decodedBuf = (ByteBuf)newOut.get(0);\r
-        String decodedString = new String(decodedBuf.array(),"UTF-8");\r
-        assertNotNull(decodedString);\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.netconf.impl;
+
+import static junit.framework.Assert.assertNotNull;
+
+import org.junit.Test;
+import org.opendaylight.controller.netconf.api.NetconfMessage;
+import org.opendaylight.controller.netconf.util.test.XmlFileLoader;
+
+public class ExiEncodeDecodeTest  {
+    @Test
+    public void encodeExi() throws Exception{
+
+        String startExiString = XmlFileLoader.xmlFileToString("netconfMessages/startExi.xml");
+        assertNotNull(startExiString);
+
+        NetconfMessage startExiMessage = XmlFileLoader.xmlFileToNetconfMessage(("netconfMessages/startExi.xml"));
+        assertNotNull(startExiMessage);
+
+        /*
+        ExiParameters exiParams = new ExiParameters();
+        exiParams.setParametersFromXmlElement(XmlElement.fromDomElement(startExiMessage.getDocument().getDocumentElement()));
+        assertNotNull(exiParams);
+
+        ByteBuf encodedBuf = Unpooled.buffer();
+        ByteBuf sourceBuf = Unpooled.copiedBuffer(startExiString.getBytes());
+        ExiUtil.encode(sourceBuf, encodedBuf, exiParams);
+
+        List<Object> newOut = new ArrayList<Object>();
+        ExiUtil.decode(encodedBuf, newOut, exiParams);
+
+        ByteBuf decodedBuf = (ByteBuf)newOut.get(0);
+        String decodedString = new String(decodedBuf.array(),"UTF-8");
+        assertNotNull(decodedString);
+        */
+    }
+}
index 5e03681..fcef6b7 100644 (file)
@@ -1,10 +1,10 @@
-{\r
-   "value":null,\r
-   "status":200,\r
-   "request": {\r
-                "type":"exec",\r
-                "mbean":"java.util.logging:type=Logging",\r
-                "operation":"setLoggerLevel",\r
-                "arguments":["global","INFO"]\r
-              }\r
+{
+   "value":null,
+   "status":200,
+   "request": {
+                "type":"exec",
+                "mbean":"java.util.logging:type=Logging",
+                "operation":"setLoggerLevel",
+                "arguments":["global","INFO"]
+              }
 }
\ No newline at end of file
index b04ace3..09ba714 100644 (file)
@@ -1,7 +1,7 @@
-<jmxbean>\r
-    <mBean>org.opendaylight.controller:type=AppDeployer</mBean>\r
-    <type>EXEC</type>\r
-    <operation>lookupConfigBeans</operation>\r
-    <arguments>abc,bcd.aas</arguments>\r
-    <arguments>64</arguments>\r
+<jmxbean>
+    <mBean>org.opendaylight.controller:type=AppDeployer</mBean>
+    <type>EXEC</type>
+    <operation>lookupConfigBeans</operation>
+    <arguments>abc,bcd.aas</arguments>
+    <arguments>64</arguments>
 </jmxbean>
\ No newline at end of file
index 5fc9353..011d472 100644 (file)
@@ -1,9 +1,9 @@
-<jmxbean>\r
-    <mBean>org.opendaylight.controller:type=AppDeployer</mBean>\r
-    <type>EXEC</type>\r
-    <operation>lookupConfigBeans</operation>\r
-    <arguments>\r
-        <elements>22</elements>\r
-        <elements>69</elements>\r
-    </arguments>\r
+<jmxbean>
+    <mBean>org.opendaylight.controller:type=AppDeployer</mBean>
+    <type>EXEC</type>
+    <operation>lookupConfigBeans</operation>
+    <arguments>
+        <elements>22</elements>
+        <elements>69</elements>
+    </arguments>
 </jmxbean>
\ No newline at end of file
index 9bf5b58..947335d 100644 (file)
@@ -1,14 +1,14 @@
-<jmxbean>\r
-    <mBean>org.opendaylight.controller:type=AppDeployer</mBean>\r
-    <type>EXEC</type>\r
-    <operation>lookupConfigBeans</operation>\r
-    <arguments>\r
-        <map>\r
-            <topology-registry>single</topology-registry>\r
-            <bgp-update>mock</bgp-update>\r
-        </map>\r
-        <array>2</array>\r
-        <array>22</array>\r
-        <anotherArg>arg</anotherArg>\r
-    </arguments>\r
+<jmxbean>
+    <mBean>org.opendaylight.controller:type=AppDeployer</mBean>
+    <type>EXEC</type>
+    <operation>lookupConfigBeans</operation>
+    <arguments>
+        <map>
+            <topology-registry>single</topology-registry>
+            <bgp-update>mock</bgp-update>
+        </map>
+        <array>2</array>
+        <array>22</array>
+        <anotherArg>arg</anotherArg>
+    </arguments>
 </jmxbean>
\ No newline at end of file
index 23a3489..2ad485f 100644 (file)
@@ -1,29 +1,29 @@
-<config>\r
-    <jmxbean>\r
-        <mBean>org.opendaylight.controller:type=AppDeployer</mBean>\r
-        <type>EXEC</type>\r
-        <operation>lookupConfigBeans</operation>\r
-        <attribute>abc,bcd.aas</attribute>\r
-        <attribute>22</attribute>\r
-    </jmxbean>\r
-    <jmxbean>\r
-        <mBean>org.opendaylight.controller:type=AppDeployer</mBean>\r
-        <type>WRITE</type>\r
-        <attribute>attribute</attribute>\r
-        <value>22</value>\r
-    </jmxbean>\r
-    <jmxbean>\r
-        <mBean>org.opendaylight.controller:type=AppDeployer</mBean>\r
-        <type>EXEC</type>\r
-        <operation>lookupConfigBeans</operation>\r
-        <arguments>\r
-            <map>\r
-                <topology-registry>single</topology-registry>\r
-                <bgp-update>mock</bgp-update>\r
-            </map>\r
-            <array>2</array>\r
-            <array>22</array>\r
-            <anotherArg>arg</anotherArg>\r
-        </arguments>\r
-    </jmxbean>\r
+<config>
+    <jmxbean>
+        <mBean>org.opendaylight.controller:type=AppDeployer</mBean>
+        <type>EXEC</type>
+        <operation>lookupConfigBeans</operation>
+        <attribute>abc,bcd.aas</attribute>
+        <attribute>22</attribute>
+    </jmxbean>
+    <jmxbean>
+        <mBean>org.opendaylight.controller:type=AppDeployer</mBean>
+        <type>WRITE</type>
+        <attribute>attribute</attribute>
+        <value>22</value>
+    </jmxbean>
+    <jmxbean>
+        <mBean>org.opendaylight.controller:type=AppDeployer</mBean>
+        <type>EXEC</type>
+        <operation>lookupConfigBeans</operation>
+        <arguments>
+            <map>
+                <topology-registry>single</topology-registry>
+                <bgp-update>mock</bgp-update>
+            </map>
+            <array>2</array>
+            <array>22</array>
+            <anotherArg>arg</anotherArg>
+        </arguments>
+    </jmxbean>
 </config>
\ No newline at end of file
index abad54d..a5882d6 100644 (file)
@@ -1,6 +1,6 @@
-<jmxbean>\r
-    <mBean>org.opendaylight.controller:type=AppDeployer</mBean>\r
-    <type>WRITE</type>\r
-    <attribute>attribute</attribute>\r
-    <value>22</value>\r
+<jmxbean>
+    <mBean>org.opendaylight.controller:type=AppDeployer</mBean>
+    <type>WRITE</type>
+    <attribute>attribute</attribute>
+    <value>22</value>
 </jmxbean>
\ No newline at end of file
index 7162b8f..24d2171 100644 (file)
@@ -1,8 +1,8 @@
-<jmxbean>\r
-    <mBean>org.opendaylight.controller:type=AppDeployer</mBean>\r
-    <type>WRITE</type>\r
-    <attribute>attribute</attribute>\r
-    <value>22</value>\r
-    <value>222</value>\r
-    <value>223</value>\r
+<jmxbean>
+    <mBean>org.opendaylight.controller:type=AppDeployer</mBean>
+    <type>WRITE</type>
+    <attribute>attribute</attribute>
+    <value>22</value>
+    <value>222</value>
+    <value>223</value>
 </jmxbean>
\ No newline at end of file
index 00a0536..9af105f 100644 (file)
@@ -1,9 +1,9 @@
-<jmxbean>\r
-    <mBean>org.opendaylight.controller:type=AppDeployer</mBean>\r
-    <type>WRITE</type>\r
-    <attribute>setAtr</attribute>\r
-    <value>\r
-        <abc>1</abc>\r
-        <bcd>2</bcd>\r
-    </value>\r
-</jmxbean>\r
+<jmxbean>
+    <mBean>org.opendaylight.controller:type=AppDeployer</mBean>
+    <type>WRITE</type>
+    <attribute>setAtr</attribute>
+    <value>
+        <abc>1</abc>
+        <bcd>2</bcd>
+    </value>
+</jmxbean>
index 60fabb6..d753866 100644 (file)
-{\r
-   "timestamp":1362488209,\r
-   "status":200,\r
-   "request":{\r
-      "mbean":"org.opendaylight.controller:type=ConfigRegistry",\r
-      "attribute":"AvailableInterfacesAndImplementations",\r
-      "type":"read"\r
-   },\r
-   "value":{\r
-      "topology-registry":[\r
-         "single"\r
-      ],\r
-      "bgp-update":[\r
-         "mock",\r
-         "bgp-impl"\r
-      ],\r
-      "positioning-service":[\r
-         "combine",\r
-         "onehop",\r
-         "ondemand",\r
-         "pxe",\r
-         "precompute"\r
-      ],\r
-      "serializer":[\r
-         "serializer-impl"\r
-      ],\r
-      "network-topology-factory":[\r
-         "mock-xml",\r
-         "bgp-network-topology-factory",\r
-         "transient"\r
-      ],\r
-      "dwe-topology":[\r
-         "ebgp",\r
-         "defaultmetric",\r
-         "igp",\r
-         "network"\r
-      ],\r
-      "thread-factory":[\r
-         "naming-thread-factory"\r
-      ],\r
-      "bgp-parser":[\r
-         "parser"\r
-      ],\r
-      "pcep-dispatcher":[\r
-         "dispatcher"\r
-      ],\r
-      "threadpool":[\r
-         "flexible",\r
-         "fixed",\r
-         "scheduled"\r
-      ],\r
-      "scheduled-threadpool":[\r
-         "scheduled"\r
-      ],\r
-      "positioning-onehop":[\r
-         "onehop"\r
-      ],\r
-      "bgp-dispatcher":[\r
-         "bgp-dispatcher-impl"\r
-      ],\r
-      "cost-combiner":[\r
-         "pxe"\r
-      ],\r
-      "apsp-provider":[\r
-         "jgrapht",\r
-         "parallel",\r
-         "single-threaded"\r
-      ],\r
-      "topology":[\r
-         "ebgp",\r
-         "defaultmetric",\r
-         "igp",\r
-         "network"\r
-      ],\r
-      "soap-resource":[\r
-         "positioning-adaptor-pxe"\r
-      ],\r
-      "database-provider-factory":[\r
-         "transient"\r
-      ],\r
-      "bgp-proposal-checker":[\r
-         "bgp-proposal-checker-impl"\r
-      ],\r
-      "bgp-proposal":[\r
-         "bgp-proposal-impl"\r
-      ],\r
-      "listenable-network-topology-factory":[\r
-         "transient"\r
-      ],\r
-      "event-bus":[\r
-         "sync",\r
-         "async"\r
-      ],\r
-      "topology-registry-provider":[\r
-         "single"\r
-      ],\r
-      "topology-provider-factory":[\r
-         "transient"\r
-      ],\r
-      "rest-resource":[\r
-         "topology-resource-holder",\r
-         "alto-resource-holder",\r
-         "topology-visual-holder",\r
-         "network-resource-holder",\r
-         "path-resource-holder"\r
-      ],\r
-      "listenable-database-provider-factory":[\r
-         "transient"\r
-      ],\r
-      "topology-validator":[\r
-         "accept-all",\r
-         "threshold"\r
-      ],\r
-      "replicator":[\r
-         "replicator-impl"\r
-      ],\r
-      "server":[\r
-         "soap",\r
-         "rest"\r
-      ],\r
-      "combiner-pxe":[\r
-         "pxe"\r
-      ],\r
-      "rest":[\r
-         "rest"\r
-      ],\r
-      "soap":[\r
-         "soap"\r
-      ],\r
-      "path-service":[\r
-         "cariden"\r
-      ]\r
-   }\r
+{
+   "timestamp":1362488209,
+   "status":200,
+   "request":{
+      "mbean":"org.opendaylight.controller:type=ConfigRegistry",
+      "attribute":"AvailableInterfacesAndImplementations",
+      "type":"read"
+   },
+   "value":{
+      "topology-registry":[
+         "single"
+      ],
+      "bgp-update":[
+         "mock",
+         "bgp-impl"
+      ],
+      "positioning-service":[
+         "combine",
+         "onehop",
+         "ondemand",
+         "pxe",
+         "precompute"
+      ],
+      "serializer":[
+         "serializer-impl"
+      ],
+      "network-topology-factory":[
+         "mock-xml",
+         "bgp-network-topology-factory",
+         "transient"
+      ],
+      "dwe-topology":[
+         "ebgp",
+         "defaultmetric",
+         "igp",
+         "network"
+      ],
+      "thread-factory":[
+         "naming-thread-factory"
+      ],
+      "bgp-parser":[
+         "parser"
+      ],
+      "pcep-dispatcher":[
+         "dispatcher"
+      ],
+      "threadpool":[
+         "flexible",
+         "fixed",
+         "scheduled"
+      ],
+      "scheduled-threadpool":[
+         "scheduled"
+      ],
+      "positioning-onehop":[
+         "onehop"
+      ],
+      "bgp-dispatcher":[
+         "bgp-dispatcher-impl"
+      ],
+      "cost-combiner":[
+         "pxe"
+      ],
+      "apsp-provider":[
+         "jgrapht",
+         "parallel",
+         "single-threaded"
+      ],
+      "topology":[
+         "ebgp",
+         "defaultmetric",
+         "igp",
+         "network"
+      ],
+      "soap-resource":[
+         "positioning-adaptor-pxe"
+      ],
+      "database-provider-factory":[
+         "transient"
+      ],
+      "bgp-proposal-checker":[
+         "bgp-proposal-checker-impl"
+      ],
+      "bgp-proposal":[
+         "bgp-proposal-impl"
+      ],
+      "listenable-network-topology-factory":[
+         "transient"
+      ],
+      "event-bus":[
+         "sync",
+         "async"
+      ],
+      "topology-registry-provider":[
+         "single"
+      ],
+      "topology-provider-factory":[
+         "transient"
+      ],
+      "rest-resource":[
+         "topology-resource-holder",
+         "alto-resource-holder",
+         "topology-visual-holder",
+         "network-resource-holder",
+         "path-resource-holder"
+      ],
+      "listenable-database-provider-factory":[
+         "transient"
+      ],
+      "topology-validator":[
+         "accept-all",
+         "threshold"
+      ],
+      "replicator":[
+         "replicator-impl"
+      ],
+      "server":[
+         "soap",
+         "rest"
+      ],
+      "combiner-pxe":[
+         "pxe"
+      ],
+      "rest":[
+         "rest"
+      ],
+      "soap":[
+         "soap"
+      ],
+      "path-service":[
+         "cariden"
+      ]
+   }
 }
\ No newline at end of file
index 816650c..314eb38 100644 (file)
@@ -1,14 +1,14 @@
-/*\r
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.controller.netconf.mapping.api;\r
-\r
-import org.opendaylight.controller.netconf.api.NetconfSession;\r
-\r
-public interface DefaultNetconfOperation {\r
-    void setNetconfSession(NetconfSession s);\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.netconf.mapping.api;
+
+import org.opendaylight.controller.netconf.api.NetconfSession;
+
+public interface DefaultNetconfOperation {
+    void setNetconfSession(NetconfSession s);
+}
index 6b9e945..7e44f74 100644 (file)
@@ -1,9 +1,9 @@
-<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" a="64" message-id="a">\r
-<start-exi>\r
-<alignment>pre-compression</alignment>\r
-<fidelity>\r
-<dtd/>\r
-<lexical-values/>\r
-</fidelity>\r
-</start-exi>\r
+<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" a="64" message-id="a">
+<start-exi>
+<alignment>pre-compression</alignment>
+<fidelity>
+<dtd/>
+<lexical-values/>
+</fidelity>
+</start-exi>
 </rpc>
\ No newline at end of file
index 4168d21..d131ce7 100644 (file)
@@ -1,3 +1,3 @@
-<rpc message-id="a" a="64" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">\r
-    <stop-exi/>\r
+<rpc message-id="a" a="64" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+    <stop-exi/>
 </rpc>
\ No newline at end of file

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.