From: Tomas Olvecky Date: Tue, 15 Apr 2014 11:26:05 +0000 (+0200) Subject: Resolve Bug:745 - remove windows line endings from config and netconf. X-Git-Tag: autorelease-tag-v20140601202136_82eb3f9~220^2 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=2476e664eca3001805739246afa857695916814c Resolve Bug:745 - remove windows line endings from config and netconf. Change-Id: Id60c44a5f3fd4979f4e13cb00e6537998718e94f Signed-off-by: Tomas Olvecky --- diff --git a/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/async/AsyncEventBusConfigBeanTest.java b/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/async/AsyncEventBusConfigBeanTest.java index b9731cd46d..177adc1588 100644 --- a/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/async/AsyncEventBusConfigBeanTest.java +++ b/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/async/AsyncEventBusConfigBeanTest.java @@ -1,107 +1,107 @@ -/* - * 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; - } - -} +/* + * 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; + } + +} diff --git a/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/eventbus/TestingEventBusModule.java b/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/eventbus/TestingEventBusModule.java index 01a89a987b..4431f78edb 100644 --- a/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/eventbus/TestingEventBusModule.java +++ b/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/eventbus/TestingEventBusModule.java @@ -1,35 +1,35 @@ -/* - * 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; - } - -} +/* + * 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; + } + +} diff --git a/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/fixed/FixedThreadPoolConfigBeanTest.java b/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/fixed/FixedThreadPoolConfigBeanTest.java index 8bfd049b4b..781215da43 100644 --- a/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/fixed/FixedThreadPoolConfigBeanTest.java +++ b/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/fixed/FixedThreadPoolConfigBeanTest.java @@ -1,136 +1,136 @@ -/* - * 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; - } - -} +/* + * 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; + } + +} diff --git a/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/fixed/TestingFixedThreadPoolModule.java b/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/fixed/TestingFixedThreadPoolModule.java index 1fc0821405..03cf9d63a2 100644 --- a/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/fixed/TestingFixedThreadPoolModule.java +++ b/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/fixed/TestingFixedThreadPoolModule.java @@ -1,37 +1,37 @@ -/* - * 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; - } - -} +/* + * 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; + } + +} diff --git a/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/flexible/FlexibleThreadPoolConfigBeanTest.java b/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/flexible/FlexibleThreadPoolConfigBeanTest.java index 43cb7e1bcb..f0e8a108e7 100644 --- a/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/flexible/FlexibleThreadPoolConfigBeanTest.java +++ b/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/flexible/FlexibleThreadPoolConfigBeanTest.java @@ -1,180 +1,180 @@ -/* - * 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); - } - -} +/* + * 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); + } + +} diff --git a/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/naming/NamingThreadPoolFactoryConfigBeanTest.java b/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/naming/NamingThreadPoolFactoryConfigBeanTest.java index 7280b04103..6dea96e21f 100644 --- a/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/naming/NamingThreadPoolFactoryConfigBeanTest.java +++ b/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/naming/NamingThreadPoolFactoryConfigBeanTest.java @@ -1,143 +1,143 @@ -/* - * 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; - } - -} +/* + * 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; + } + +} diff --git a/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/naming/TestingNamingThreadPoolFactoryModule.java b/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/naming/TestingNamingThreadPoolFactoryModule.java index f22da34d76..47613bfb1b 100644 --- a/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/naming/TestingNamingThreadPoolFactoryModule.java +++ b/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/naming/TestingNamingThreadPoolFactoryModule.java @@ -1,66 +1,66 @@ -/* - * 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; - } - -} +/* + * 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; + } + +} diff --git a/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/scheduled/ScheduledThreadPoolConfigBeanTest.java b/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/scheduled/ScheduledThreadPoolConfigBeanTest.java index 6183cb56c1..538d43726b 100644 --- a/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/scheduled/ScheduledThreadPoolConfigBeanTest.java +++ b/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/scheduled/ScheduledThreadPoolConfigBeanTest.java @@ -1,161 +1,161 @@ -/* - * 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; - } - -} +/* + * 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; + } + +} diff --git a/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/scheduled/TestingScheduledThreadPoolModule.java b/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/scheduled/TestingScheduledThreadPoolModule.java index 0fe5b0d183..2ba1b3b20d 100644 --- a/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/scheduled/TestingScheduledThreadPoolModule.java +++ b/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/scheduled/TestingScheduledThreadPoolModule.java @@ -1,82 +1,82 @@ -/* - * 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) { - } - -} +/* + * 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) { + } + +} diff --git a/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/mapping/operations/DefaultStartExi.java b/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/mapping/operations/DefaultStartExi.java index 15cc7bcff6..a2befbadd2 100644 --- a/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/mapping/operations/DefaultStartExi.java +++ b/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/mapping/operations/DefaultStartExi.java @@ -1,77 +1,77 @@ -/* - * 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; - } - - -} +/* + * 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; + } + + +} diff --git a/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/mapping/operations/DefaultStopExi.java b/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/mapping/operations/DefaultStopExi.java index ae3b00b11a..836f826912 100644 --- a/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/mapping/operations/DefaultStopExi.java +++ b/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/mapping/operations/DefaultStopExi.java @@ -1,62 +1,62 @@ -/* - * 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; - } -} +/* + * 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; + } +} diff --git a/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/ExiEncodeDecodeTest.java b/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/ExiEncodeDecodeTest.java index d7beb5df9b..58c6566d91 100644 --- a/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/ExiEncodeDecodeTest.java +++ b/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/ExiEncodeDecodeTest.java @@ -1,43 +1,43 @@ -/* - * 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 newOut = new ArrayList(); - ExiUtil.decode(encodedBuf, newOut, exiParams); - - ByteBuf decodedBuf = (ByteBuf)newOut.get(0); - String decodedString = new String(decodedBuf.array(),"UTF-8"); - assertNotNull(decodedString); - */ - } -} +/* + * 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 newOut = new ArrayList(); + ExiUtil.decode(encodedBuf, newOut, exiParams); + + ByteBuf decodedBuf = (ByteBuf)newOut.get(0); + String decodedString = new String(decodedBuf.array(),"UTF-8"); + assertNotNull(decodedString); + */ + } +} diff --git a/opendaylight/netconf/netconf-impl/src/test/resources/testConfigs/input.json b/opendaylight/netconf/netconf-impl/src/test/resources/testConfigs/input.json index 5e03681d95..fcef6b730c 100644 --- a/opendaylight/netconf/netconf-impl/src/test/resources/testConfigs/input.json +++ b/opendaylight/netconf/netconf-impl/src/test/resources/testConfigs/input.json @@ -1,10 +1,10 @@ -{ - "value":null, - "status":200, - "request": { - "type":"exec", - "mbean":"java.util.logging:type=Logging", - "operation":"setLoggerLevel", - "arguments":["global","INFO"] - } +{ + "value":null, + "status":200, + "request": { + "type":"exec", + "mbean":"java.util.logging:type=Logging", + "operation":"setLoggerLevel", + "arguments":["global","INFO"] + } } \ No newline at end of file diff --git a/opendaylight/netconf/netconf-impl/src/test/resources/testConfigs/input.xml b/opendaylight/netconf/netconf-impl/src/test/resources/testConfigs/input.xml index b04ace303f..09ba714ea9 100644 --- a/opendaylight/netconf/netconf-impl/src/test/resources/testConfigs/input.xml +++ b/opendaylight/netconf/netconf-impl/src/test/resources/testConfigs/input.xml @@ -1,7 +1,7 @@ - - org.opendaylight.controller:type=AppDeployer - EXEC - lookupConfigBeans - abc,bcd.aas - 64 + + org.opendaylight.controller:type=AppDeployer + EXEC + lookupConfigBeans + abc,bcd.aas + 64 \ No newline at end of file diff --git a/opendaylight/netconf/netconf-impl/src/test/resources/testConfigs/inputList.xml b/opendaylight/netconf/netconf-impl/src/test/resources/testConfigs/inputList.xml index 5fc93532a4..011d472634 100644 --- a/opendaylight/netconf/netconf-impl/src/test/resources/testConfigs/inputList.xml +++ b/opendaylight/netconf/netconf-impl/src/test/resources/testConfigs/inputList.xml @@ -1,9 +1,9 @@ - - org.opendaylight.controller:type=AppDeployer - EXEC - lookupConfigBeans - - 22 - 69 - + + org.opendaylight.controller:type=AppDeployer + EXEC + lookupConfigBeans + + 22 + 69 + \ No newline at end of file diff --git a/opendaylight/netconf/netconf-impl/src/test/resources/testConfigs/inputMap.xml b/opendaylight/netconf/netconf-impl/src/test/resources/testConfigs/inputMap.xml index 9bf5b58dc4..947335d215 100644 --- a/opendaylight/netconf/netconf-impl/src/test/resources/testConfigs/inputMap.xml +++ b/opendaylight/netconf/netconf-impl/src/test/resources/testConfigs/inputMap.xml @@ -1,14 +1,14 @@ - - org.opendaylight.controller:type=AppDeployer - EXEC - lookupConfigBeans - - - single - mock - - 2 - 22 - arg - + + org.opendaylight.controller:type=AppDeployer + EXEC + lookupConfigBeans + + + single + mock + + 2 + 22 + arg + \ No newline at end of file diff --git a/opendaylight/netconf/netconf-impl/src/test/resources/testConfigs/inputMultiple.xml b/opendaylight/netconf/netconf-impl/src/test/resources/testConfigs/inputMultiple.xml index 23a3489310..2ad485f6c5 100644 --- a/opendaylight/netconf/netconf-impl/src/test/resources/testConfigs/inputMultiple.xml +++ b/opendaylight/netconf/netconf-impl/src/test/resources/testConfigs/inputMultiple.xml @@ -1,29 +1,29 @@ - - - org.opendaylight.controller:type=AppDeployer - EXEC - lookupConfigBeans - abc,bcd.aas - 22 - - - org.opendaylight.controller:type=AppDeployer - WRITE - attribute - 22 - - - org.opendaylight.controller:type=AppDeployer - EXEC - lookupConfigBeans - - - single - mock - - 2 - 22 - arg - - + + + org.opendaylight.controller:type=AppDeployer + EXEC + lookupConfigBeans + abc,bcd.aas + 22 + + + org.opendaylight.controller:type=AppDeployer + WRITE + attribute + 22 + + + org.opendaylight.controller:type=AppDeployer + EXEC + lookupConfigBeans + + + single + mock + + 2 + 22 + arg + + \ No newline at end of file diff --git a/opendaylight/netconf/netconf-impl/src/test/resources/testConfigs/inputSetter.xml b/opendaylight/netconf/netconf-impl/src/test/resources/testConfigs/inputSetter.xml index abad54d27a..a5882d6ded 100644 --- a/opendaylight/netconf/netconf-impl/src/test/resources/testConfigs/inputSetter.xml +++ b/opendaylight/netconf/netconf-impl/src/test/resources/testConfigs/inputSetter.xml @@ -1,6 +1,6 @@ - - org.opendaylight.controller:type=AppDeployer - WRITE - attribute - 22 + + org.opendaylight.controller:type=AppDeployer + WRITE + attribute + 22 \ No newline at end of file diff --git a/opendaylight/netconf/netconf-impl/src/test/resources/testConfigs/inputSetterList.xml b/opendaylight/netconf/netconf-impl/src/test/resources/testConfigs/inputSetterList.xml index 7162b8f056..24d2171fe4 100644 --- a/opendaylight/netconf/netconf-impl/src/test/resources/testConfigs/inputSetterList.xml +++ b/opendaylight/netconf/netconf-impl/src/test/resources/testConfigs/inputSetterList.xml @@ -1,8 +1,8 @@ - - org.opendaylight.controller:type=AppDeployer - WRITE - attribute - 22 - 222 - 223 + + org.opendaylight.controller:type=AppDeployer + WRITE + attribute + 22 + 222 + 223 \ No newline at end of file diff --git a/opendaylight/netconf/netconf-impl/src/test/resources/testConfigs/inputSetterMap.xml b/opendaylight/netconf/netconf-impl/src/test/resources/testConfigs/inputSetterMap.xml index 00a0536c0c..9af105fe58 100644 --- a/opendaylight/netconf/netconf-impl/src/test/resources/testConfigs/inputSetterMap.xml +++ b/opendaylight/netconf/netconf-impl/src/test/resources/testConfigs/inputSetterMap.xml @@ -1,9 +1,9 @@ - - org.opendaylight.controller:type=AppDeployer - WRITE - setAtr - - 1 - 2 - - + + org.opendaylight.controller:type=AppDeployer + WRITE + setAtr + + 1 + 2 + + diff --git a/opendaylight/netconf/netconf-impl/src/test/resources/testConfigs/map.json b/opendaylight/netconf/netconf-impl/src/test/resources/testConfigs/map.json index 60fabb62d1..d7538663e3 100644 --- a/opendaylight/netconf/netconf-impl/src/test/resources/testConfigs/map.json +++ b/opendaylight/netconf/netconf-impl/src/test/resources/testConfigs/map.json @@ -1,134 +1,134 @@ -{ - "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" - ] - } +{ + "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 diff --git a/opendaylight/netconf/netconf-mapping-api/src/main/java/org/opendaylight/controller/netconf/mapping/api/DefaultNetconfOperation.java b/opendaylight/netconf/netconf-mapping-api/src/main/java/org/opendaylight/controller/netconf/mapping/api/DefaultNetconfOperation.java index 816650c4bb..314eb3834f 100644 --- a/opendaylight/netconf/netconf-mapping-api/src/main/java/org/opendaylight/controller/netconf/mapping/api/DefaultNetconfOperation.java +++ b/opendaylight/netconf/netconf-mapping-api/src/main/java/org/opendaylight/controller/netconf/mapping/api/DefaultNetconfOperation.java @@ -1,14 +1,14 @@ -/* - * 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); -} +/* + * 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); +} diff --git a/opendaylight/netconf/netconf-util/src/test/resources/netconfMessages/startExi.xml b/opendaylight/netconf/netconf-util/src/test/resources/netconfMessages/startExi.xml index 6b9e9452e8..7e44f74830 100644 --- a/opendaylight/netconf/netconf-util/src/test/resources/netconfMessages/startExi.xml +++ b/opendaylight/netconf/netconf-util/src/test/resources/netconfMessages/startExi.xml @@ -1,9 +1,9 @@ - - -pre-compression - - - - - + + +pre-compression + + + + + \ No newline at end of file diff --git a/opendaylight/netconf/netconf-util/src/test/resources/netconfMessages/stopExi.xml b/opendaylight/netconf/netconf-util/src/test/resources/netconfMessages/stopExi.xml index 4168d21aba..d131ce7bbd 100644 --- a/opendaylight/netconf/netconf-util/src/test/resources/netconfMessages/stopExi.xml +++ b/opendaylight/netconf/netconf-util/src/test/resources/netconfMessages/stopExi.xml @@ -1,3 +1,3 @@ - - + + \ No newline at end of file