From dad7a9a85e4434fa9fafb62c38a80a5163a98d41 Mon Sep 17 00:00:00 2001 From: Tomas Olvecky Date: Sun, 1 Dec 2013 17:23:18 +0100 Subject: [PATCH] Separate threadpool-fixed,-flexible-scheduled from threadpool-impl.yang Change-Id: I994f962489829c1acf5c47663cf0ace6ce06f92f Signed-off-by: Tomas Olvecky --- .../config/threadpool-config-impl/pom.xml | 2 +- .../impl/FixedThreadPoolModuleFactory.java | 18 -- .../impl/FlexibleThreadPoolModuleFactory.java | 18 -- .../impl/ScheduledThreadPoolModule.java | 44 ----- .../ScheduledThreadPoolModuleFactory.java | 18 -- .../{ => fixed}/FixedThreadPoolModule.java | 29 ++- .../fixed/FixedThreadPoolModuleFactory.java | 19 ++ .../FlexibleThreadPoolModule.java | 29 ++- .../FlexibleThreadPoolModuleFactory.java | 19 ++ .../scheduled/ScheduledThreadPoolModule.java | 41 ++++ .../ScheduledThreadPoolModuleFactory.java | 19 ++ .../src/main/yang/threadpool-impl-fixed.yang | 55 ++++++ .../main/yang/threadpool-impl-flexible.yang | 59 ++++++ .../main/yang/threadpool-impl-scheduled.yang | 53 +++++ .../src/main/yang/threadpool-impl.yang | 185 +++++------------- .../fixed/FixedThreadPoolConfigBeanTest.java | 20 +- .../FlexibleThreadPoolConfigBeanTest.java | 20 +- .../ScheduledThreadPoolConfigBeanTest.java | 24 +-- .../TestingScheduledThreadPoolModule.java | 28 ++- 19 files changed, 390 insertions(+), 310 deletions(-) delete mode 100644 opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/FixedThreadPoolModuleFactory.java delete mode 100644 opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/FlexibleThreadPoolModuleFactory.java delete mode 100644 opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/ScheduledThreadPoolModule.java delete mode 100644 opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/ScheduledThreadPoolModuleFactory.java rename opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/{ => fixed}/FixedThreadPoolModule.java (50%) create mode 100644 opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/fixed/FixedThreadPoolModuleFactory.java rename opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/{ => flexible}/FlexibleThreadPoolModule.java (62%) create mode 100644 opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/flexible/FlexibleThreadPoolModuleFactory.java create mode 100644 opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/scheduled/ScheduledThreadPoolModule.java create mode 100644 opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/scheduled/ScheduledThreadPoolModuleFactory.java create mode 100644 opendaylight/config/threadpool-config-impl/src/main/yang/threadpool-impl-fixed.yang create mode 100644 opendaylight/config/threadpool-config-impl/src/main/yang/threadpool-impl-flexible.yang create mode 100644 opendaylight/config/threadpool-config-impl/src/main/yang/threadpool-impl-scheduled.yang diff --git a/opendaylight/config/threadpool-config-impl/pom.xml b/opendaylight/config/threadpool-config-impl/pom.xml index 4cbe397693..53b8b2b53c 100644 --- a/opendaylight/config/threadpool-config-impl/pom.xml +++ b/opendaylight/config/threadpool-config-impl/pom.xml @@ -69,7 +69,7 @@ org.opendaylight.controller.config.threadpool.util, javax.annotation.*, - org.opendaylight.controller.config.yang.threadpool.impl, + org.opendaylight.controller.config.yang.threadpool.impl*, org.opendaylight.controller.config.threadpool.util, diff --git a/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/FixedThreadPoolModuleFactory.java b/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/FixedThreadPoolModuleFactory.java deleted file mode 100644 index 2803448fd2..0000000000 --- a/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/FixedThreadPoolModuleFactory.java +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Generated file - - * Generated from: yang module name: threadpool-impl yang module local name: threadpool-fixed - * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator - * Generated at: Wed Nov 06 16:19:33 CET 2013 - * - * Do not modify this file unless it is present under src/main directory - */ -package org.opendaylight.controller.config.yang.threadpool.impl; - -/** -* -*/ -public class FixedThreadPoolModuleFactory extends - org.opendaylight.controller.config.yang.threadpool.impl.AbstractFixedThreadPoolModuleFactory { - -} diff --git a/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/FlexibleThreadPoolModuleFactory.java b/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/FlexibleThreadPoolModuleFactory.java deleted file mode 100644 index ef6ebd25e2..0000000000 --- a/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/FlexibleThreadPoolModuleFactory.java +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Generated file - - * Generated from: yang module name: threadpool-impl yang module local name: threadpool-flexible - * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator - * Generated at: Wed Nov 06 16:19:33 CET 2013 - * - * Do not modify this file unless it is present under src/main directory - */ -package org.opendaylight.controller.config.yang.threadpool.impl; - -/** -* -*/ -public class FlexibleThreadPoolModuleFactory extends - org.opendaylight.controller.config.yang.threadpool.impl.AbstractFlexibleThreadPoolModuleFactory { - -} diff --git a/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/ScheduledThreadPoolModule.java b/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/ScheduledThreadPoolModule.java deleted file mode 100644 index 42739b4b32..0000000000 --- a/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/ScheduledThreadPoolModule.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Generated file - - * Generated from: yang module name: threadpool-impl yang module local name: threadpool-scheduled - * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator - * Generated at: Wed Nov 06 16:19:33 CET 2013 - * - * Do not modify this file unless it is present under src/main directory - */ -package org.opendaylight.controller.config.yang.threadpool.impl; - -import org.opendaylight.controller.config.api.JmxAttributeValidationException; -import org.opendaylight.controller.config.threadpool.util.ScheduledThreadPoolWrapper; - -/** -* -*/ -public final class ScheduledThreadPoolModule extends - org.opendaylight.controller.config.yang.threadpool.impl.AbstractScheduledThreadPoolModule { - - public ScheduledThreadPoolModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, - org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) { - super(identifier, dependencyResolver); - } - - public ScheduledThreadPoolModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, - org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, - ScheduledThreadPoolModule oldModule, java.lang.AutoCloseable oldInstance) { - super(identifier, dependencyResolver, oldModule, oldInstance); - } - - @Override - public void validate() { - super.validate(); - JmxAttributeValidationException.checkNotNull(getMaxThreadCount(), maxThreadCountJmxAttribute); - JmxAttributeValidationException.checkCondition(getMaxThreadCount() > 0, "must be greater than zero", - maxThreadCountJmxAttribute); - } - - @Override - public java.lang.AutoCloseable createInstance() { - return new ScheduledThreadPoolWrapper(getMaxThreadCount(), getThreadFactoryDependency()); - } -} diff --git a/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/ScheduledThreadPoolModuleFactory.java b/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/ScheduledThreadPoolModuleFactory.java deleted file mode 100644 index 489af822e2..0000000000 --- a/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/ScheduledThreadPoolModuleFactory.java +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Generated file - - * Generated from: yang module name: threadpool-impl yang module local name: threadpool-scheduled - * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator - * Generated at: Wed Nov 06 16:19:33 CET 2013 - * - * Do not modify this file unless it is present under src/main directory - */ -package org.opendaylight.controller.config.yang.threadpool.impl; - -/** -* -*/ -public class ScheduledThreadPoolModuleFactory extends - org.opendaylight.controller.config.yang.threadpool.impl.AbstractScheduledThreadPoolModuleFactory { - -} diff --git a/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/FixedThreadPoolModule.java b/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/fixed/FixedThreadPoolModule.java similarity index 50% rename from opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/FixedThreadPoolModule.java rename to opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/fixed/FixedThreadPoolModule.java index a0a9addf03..de6e6a5ec8 100644 --- a/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/FixedThreadPoolModule.java +++ b/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/fixed/FixedThreadPoolModule.java @@ -1,13 +1,13 @@ /** - * Generated file +* Generated file - * Generated from: yang module name: threadpool-impl yang module local name: threadpool-fixed - * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator - * Generated at: Wed Nov 06 16:19:33 CET 2013 - * - * Do not modify this file unless it is present under src/main directory - */ -package org.opendaylight.controller.config.yang.threadpool.impl; +* Generated from: yang module name: threadpool-impl-fixed yang module local name: threadpool-fixed +* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator +* Generated at: Sun Dec 01 17:13:32 CET 2013 +* +* Do not modify this file unless it is present under src/main directory +*/ +package org.opendaylight.controller.config.yang.threadpool.impl.fixed; import org.opendaylight.controller.config.api.JmxAttributeValidationException; import org.opendaylight.controller.config.threadpool.util.FixedThreadPoolWrapper; @@ -15,22 +15,19 @@ import org.opendaylight.controller.config.threadpool.util.FixedThreadPoolWrapper /** * */ -public final class FixedThreadPoolModule extends - org.opendaylight.controller.config.yang.threadpool.impl.AbstractFixedThreadPoolModule { +public final class FixedThreadPoolModule extends org.opendaylight.controller.config.yang.threadpool.impl.fixed.AbstractFixedThreadPoolModule +{ - public FixedThreadPoolModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, - org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) { + public FixedThreadPoolModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) { super(identifier, dependencyResolver); } - public FixedThreadPoolModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, - org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, - FixedThreadPoolModule oldModule, java.lang.AutoCloseable oldInstance) { + public FixedThreadPoolModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, FixedThreadPoolModule oldModule, java.lang.AutoCloseable oldInstance) { super(identifier, dependencyResolver, oldModule, oldInstance); } @Override - public void validate() { + public void validate(){ super.validate(); JmxAttributeValidationException.checkNotNull(getMaxThreadCount(), maxThreadCountJmxAttribute); diff --git a/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/fixed/FixedThreadPoolModuleFactory.java b/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/fixed/FixedThreadPoolModuleFactory.java new file mode 100644 index 0000000000..1d3a37c50d --- /dev/null +++ b/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/fixed/FixedThreadPoolModuleFactory.java @@ -0,0 +1,19 @@ +/** +* Generated file + +* Generated from: yang module name: threadpool-impl-fixed yang module local name: threadpool-fixed +* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator +* Generated at: Sun Dec 01 17:13:32 CET 2013 +* +* Do not modify this file unless it is present under src/main directory +*/ +package org.opendaylight.controller.config.yang.threadpool.impl.fixed; + +/** +* +*/ +public class FixedThreadPoolModuleFactory extends org.opendaylight.controller.config.yang.threadpool.impl.fixed.AbstractFixedThreadPoolModuleFactory +{ + + +} diff --git a/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/FlexibleThreadPoolModule.java b/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/flexible/FlexibleThreadPoolModule.java similarity index 62% rename from opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/FlexibleThreadPoolModule.java rename to opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/flexible/FlexibleThreadPoolModule.java index 47b4eec689..259d90817e 100644 --- a/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/FlexibleThreadPoolModule.java +++ b/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/flexible/FlexibleThreadPoolModule.java @@ -1,13 +1,13 @@ /** - * Generated file +* Generated file - * Generated from: yang module name: threadpool-impl yang module local name: threadpool-flexible - * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator - * Generated at: Wed Nov 06 16:19:33 CET 2013 - * - * Do not modify this file unless it is present under src/main directory - */ -package org.opendaylight.controller.config.yang.threadpool.impl; +* Generated from: yang module name: threadpool-impl-flexible yang module local name: threadpool-flexible +* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator +* Generated at: Sun Dec 01 17:13:32 CET 2013 +* +* Do not modify this file unless it is present under src/main directory +*/ +package org.opendaylight.controller.config.yang.threadpool.impl.flexible; import java.util.concurrent.TimeUnit; @@ -17,22 +17,19 @@ import org.opendaylight.controller.config.threadpool.util.FlexibleThreadPoolWrap /** * */ -public final class FlexibleThreadPoolModule extends - org.opendaylight.controller.config.yang.threadpool.impl.AbstractFlexibleThreadPoolModule { +public final class FlexibleThreadPoolModule extends org.opendaylight.controller.config.yang.threadpool.impl.flexible.AbstractFlexibleThreadPoolModule +{ - public FlexibleThreadPoolModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, - org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) { + public FlexibleThreadPoolModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) { super(identifier, dependencyResolver); } - public FlexibleThreadPoolModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, - org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, - FlexibleThreadPoolModule oldModule, java.lang.AutoCloseable oldInstance) { + public FlexibleThreadPoolModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, FlexibleThreadPoolModule oldModule, java.lang.AutoCloseable oldInstance) { super(identifier, dependencyResolver, oldModule, oldInstance); } @Override - public void validate() { + public void validate(){ super.validate(); JmxAttributeValidationException.checkNotNull(getKeepAliveMillis(), keepAliveMillisJmxAttribute); JmxAttributeValidationException.checkCondition(getKeepAliveMillis() > 0, "must be greater than zero", diff --git a/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/flexible/FlexibleThreadPoolModuleFactory.java b/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/flexible/FlexibleThreadPoolModuleFactory.java new file mode 100644 index 0000000000..878adcfb2c --- /dev/null +++ b/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/flexible/FlexibleThreadPoolModuleFactory.java @@ -0,0 +1,19 @@ +/** +* Generated file + +* Generated from: yang module name: threadpool-impl-flexible yang module local name: threadpool-flexible +* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator +* Generated at: Sun Dec 01 17:13:32 CET 2013 +* +* Do not modify this file unless it is present under src/main directory +*/ +package org.opendaylight.controller.config.yang.threadpool.impl.flexible; + +/** +* +*/ +public class FlexibleThreadPoolModuleFactory extends org.opendaylight.controller.config.yang.threadpool.impl.flexible.AbstractFlexibleThreadPoolModuleFactory +{ + + +} diff --git a/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/scheduled/ScheduledThreadPoolModule.java b/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/scheduled/ScheduledThreadPoolModule.java new file mode 100644 index 0000000000..83c4cccfeb --- /dev/null +++ b/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/scheduled/ScheduledThreadPoolModule.java @@ -0,0 +1,41 @@ +/** +* Generated file + +* Generated from: yang module name: threadpool-impl-scheduled yang module local name: threadpool-scheduled +* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator +* Generated at: Sun Dec 01 17:13:32 CET 2013 +* +* Do not modify this file unless it is present under src/main directory +*/ +package org.opendaylight.controller.config.yang.threadpool.impl.scheduled; + +import org.opendaylight.controller.config.api.JmxAttributeValidationException; +import org.opendaylight.controller.config.threadpool.util.ScheduledThreadPoolWrapper; + +/** +* +*/ +public final class ScheduledThreadPoolModule extends org.opendaylight.controller.config.yang.threadpool.impl.scheduled.AbstractScheduledThreadPoolModule +{ + + public ScheduledThreadPoolModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) { + super(identifier, dependencyResolver); + } + + public ScheduledThreadPoolModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, ScheduledThreadPoolModule oldModule, java.lang.AutoCloseable oldInstance) { + super(identifier, dependencyResolver, oldModule, oldInstance); + } + + @Override + public void validate(){ + super.validate(); + JmxAttributeValidationException.checkNotNull(getMaxThreadCount(), maxThreadCountJmxAttribute); + JmxAttributeValidationException.checkCondition(getMaxThreadCount() > 0, "must be greater than zero", + maxThreadCountJmxAttribute); + } + + @Override + public java.lang.AutoCloseable createInstance() { + return new ScheduledThreadPoolWrapper(getMaxThreadCount(), getThreadFactoryDependency()); + } +} diff --git a/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/scheduled/ScheduledThreadPoolModuleFactory.java b/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/scheduled/ScheduledThreadPoolModuleFactory.java new file mode 100644 index 0000000000..ea345baaeb --- /dev/null +++ b/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/scheduled/ScheduledThreadPoolModuleFactory.java @@ -0,0 +1,19 @@ +/** +* Generated file + +* Generated from: yang module name: threadpool-impl-scheduled yang module local name: threadpool-scheduled +* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator +* Generated at: Sun Dec 01 17:13:32 CET 2013 +* +* Do not modify this file unless it is present under src/main directory +*/ +package org.opendaylight.controller.config.yang.threadpool.impl.scheduled; + +/** +* +*/ +public class ScheduledThreadPoolModuleFactory extends org.opendaylight.controller.config.yang.threadpool.impl.scheduled.AbstractScheduledThreadPoolModuleFactory +{ + + +} diff --git a/opendaylight/config/threadpool-config-impl/src/main/yang/threadpool-impl-fixed.yang b/opendaylight/config/threadpool-config-impl/src/main/yang/threadpool-impl-fixed.yang new file mode 100644 index 0000000000..b09ce5b28c --- /dev/null +++ b/opendaylight/config/threadpool-config-impl/src/main/yang/threadpool-impl-fixed.yang @@ -0,0 +1,55 @@ +module threadpool-impl-fixed { + yang-version 1; + namespace "urn:opendaylight:params:xml:ns:yang:controller:threadpool:impl:fixed"; + prefix "th-java-fixed"; + + import threadpool { prefix th; revision-date 2013-04-09; } + import config { prefix config; revision-date 2013-04-05; } + import rpc-context { prefix rpcx; revision-date 2013-06-17; } + + organization "Cisco Systems, Inc."; + + contact "Robert Varga "; + + description + "This module contains the base YANG definitions for + thread services pure Java implementation. + + Copyright (c)2013 Cisco Systems, Inc. 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"; + + revision "2013-12-01" { + description + "Initial revision"; + } + + + identity threadpool-fixed { + base config:module-type; + config:provided-service th:threadpool; + config:java-name-prefix FixedThreadPool; + } + + augment "/config:modules/config:module/config:configuration" { + case threadpool-fixed { + when "/config:modules/config:module/config:type = 'threadpool-fixed'"; + leaf max-thread-count { + type uint16; + } + + container threadFactory { + uses config:service-ref { + refine type { + //mandatory true; + config:required-identity th:threadfactory; + } + } + } + } + } +} + diff --git a/opendaylight/config/threadpool-config-impl/src/main/yang/threadpool-impl-flexible.yang b/opendaylight/config/threadpool-config-impl/src/main/yang/threadpool-impl-flexible.yang new file mode 100644 index 0000000000..8d1a6307b5 --- /dev/null +++ b/opendaylight/config/threadpool-config-impl/src/main/yang/threadpool-impl-flexible.yang @@ -0,0 +1,59 @@ +module threadpool-impl-flexible { + yang-version 1; + namespace "urn:opendaylight:params:xml:ns:yang:controller:threadpool:impl:flexible"; + prefix "th-java-flexible"; + + import threadpool { prefix th; revision-date 2013-04-09; } + import config { prefix config; revision-date 2013-04-05; } + import rpc-context { prefix rpcx; revision-date 2013-06-17; } + + organization "Cisco Systems, Inc."; + + contact "Robert Varga "; + + description + "This module contains the base YANG definitions for + thread services pure Java implementation. + + Copyright (c)2013 Cisco Systems, Inc. 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"; + + revision "2013-12-01" { + description + "Initial revision"; + } + + identity threadpool-flexible { + base config:module-type; + config:provided-service th:threadpool; + config:java-name-prefix FlexibleThreadPool; + } + + augment "/config:modules/config:module/config:configuration" { + case threadpool-flexible { + when "/config:modules/config:module/config:type = 'threadpool-flexible'"; + leaf max-thread-count { + type uint16; + } + leaf minThreadCount { + type uint16; + } + leaf keepAliveMillis { + type uint32; + } + + container threadFactory { + uses config:service-ref { + refine type { + // mandatory true; + config:required-identity th:threadfactory; + } + } + } + } + } +} diff --git a/opendaylight/config/threadpool-config-impl/src/main/yang/threadpool-impl-scheduled.yang b/opendaylight/config/threadpool-config-impl/src/main/yang/threadpool-impl-scheduled.yang new file mode 100644 index 0000000000..07f6c5b198 --- /dev/null +++ b/opendaylight/config/threadpool-config-impl/src/main/yang/threadpool-impl-scheduled.yang @@ -0,0 +1,53 @@ +module threadpool-impl-scheduled { + yang-version 1; + namespace "urn:opendaylight:params:xml:ns:yang:controller:threadpool:impl:scheduled"; + prefix "th-java-scheduled"; + + import threadpool { prefix th; revision-date 2013-04-09; } + import config { prefix config; revision-date 2013-04-05; } + import rpc-context { prefix rpcx; revision-date 2013-06-17; } + + organization "Cisco Systems, Inc."; + + contact "Robert Varga "; + + description + "This module contains the base YANG definitions for + thread services pure Java implementation. + + Copyright (c)2013 Cisco Systems, Inc. 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"; + + revision "2013-12-01" { + description + "Initial revision"; + } + + identity threadpool-scheduled { + base config:module-type; + config:provided-service th:scheduled-threadpool; + config:java-name-prefix ScheduledThreadPool; + } + + augment "/config:modules/config:module/config:configuration" { + case threadpool-scheduled { + when "/config:modules/config:module/config:type = 'threadpool-scheduled'"; + leaf max-thread-count { + type uint16; + } + + container threadFactory { + uses config:service-ref { + refine type { + // mandatory true; + config:required-identity th:threadfactory; + } + } + } + } + } +} diff --git a/opendaylight/config/threadpool-config-impl/src/main/yang/threadpool-impl.yang b/opendaylight/config/threadpool-config-impl/src/main/yang/threadpool-impl.yang index a2366f285a..cc4af4d596 100644 --- a/opendaylight/config/threadpool-config-impl/src/main/yang/threadpool-impl.yang +++ b/opendaylight/config/threadpool-config-impl/src/main/yang/threadpool-impl.yang @@ -1,4 +1,3 @@ -// vi: set smarttab et sw=4 tabstop=4: module threadpool-impl { yang-version 1; namespace "urn:opendaylight:params:xml:ns:yang:controller:threadpool:impl"; @@ -17,11 +16,11 @@ module threadpool-impl { thread services pure Java implementation. Copyright (c)2013 Cisco Systems, Inc. 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"; + 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"; revision "2013-04-05" { description @@ -40,21 +39,21 @@ module threadpool-impl { config:java-name-prefix EventBus; } - augment "/config:modules/config:module/config:configuration" { - case eventbus { - when "/config:modules/config:module/config:type = 'eventbus'"; - // No real configuration + augment "/config:modules/config:module/config:configuration" { + case eventbus { + when "/config:modules/config:module/config:type = 'eventbus'"; + // No real configuration } } - augment "/config:modules/config:module/config:state" { - case eventbus { - when "/config:modules/config:module/config:type = 'eventbus'"; - rpcx:rpc-context-instance "event-bus-rpc"; + augment "/config:modules/config:module/config:state" { + case eventbus { + when "/config:modules/config:module/config:type = 'eventbus'"; + rpcx:rpc-context-instance "event-bus-rpc"; } } - identity event-bus-rpc; + identity event-bus-rpc; identity async-eventbus { base config:module-type; @@ -62,134 +61,56 @@ module threadpool-impl { config:java-name-prefix AsyncEventBus; } - augment "/config:modules/config:module/config:configuration" { - case async-eventbus { - when "/config:modules/config:module/config:type = 'async-eventbus'"; - container threadpool { - uses config:service-ref { - refine type { - //mandatory true; - config:required-identity th:threadpool; - } - } - } - } - } - - augment "/config:modules/config:module/config:state" { - case async-eventbus { - when "/config:modules/config:module/config:type = 'async-eventbus'"; - rpcx:rpc-context-instance "event-bus-rpc"; + augment "/config:modules/config:module/config:configuration" { + case async-eventbus { + when "/config:modules/config:module/config:type = 'async-eventbus'"; + container threadpool { + uses config:service-ref { + refine type { + //mandatory true; + config:required-identity th:threadpool; + } + } + } } } - rpc get-dead-events-count { - config:java-name-prefix countDeadEvents; - input { - uses rpcx:rpc-context-ref { - refine context-instance { - rpcx:rpc-context-instance event-bus-rpc; - } - } - } - output { - leaf result { - type uint32; - } - } - } - - identity threadfactory-naming { - base config:module-type; - config:provided-service th:threadfactory; - config:java-name-prefix NamingThreadFactory; + augment "/config:modules/config:module/config:state" { + case async-eventbus { + when "/config:modules/config:module/config:type = 'async-eventbus'"; + rpcx:rpc-context-instance "event-bus-rpc"; + } } - augment "/config:modules/config:module/config:configuration" { - case threadfactory-naming { - when "/config:modules/config:module/config:type = 'threadfactory-naming'"; - leaf name-prefix { - type string; - } + rpc get-dead-events-count { + config:java-name-prefix countDeadEvents; + input { + uses rpcx:rpc-context-ref { + refine context-instance { + rpcx:rpc-context-instance event-bus-rpc; + } + } + } + output { + leaf result { + type uint32; + } } } - identity threadpool-fixed { - base config:module-type; - config:provided-service th:threadpool; - config:java-name-prefix FixedThreadPool; + identity threadfactory-naming { + base config:module-type; + config:provided-service th:threadfactory; + config:java-name-prefix NamingThreadFactory; } - augment "/config:modules/config:module/config:configuration" { - case threadpool-fixed { - when "/config:modules/config:module/config:type = 'threadpool-fixed'"; - leaf max-thread-count { - type uint16; - } - - container threadFactory { - uses config:service-ref { - refine type { - //mandatory true; - config:required-identity th:threadfactory; - } - } - } + augment "/config:modules/config:module/config:configuration" { + case threadfactory-naming { + when "/config:modules/config:module/config:type = 'threadfactory-naming'"; + leaf name-prefix { + type string; + } } - } - - identity threadpool-flexible { - base config:module-type; - config:provided-service th:threadpool; - config:java-name-prefix FlexibleThreadPool; - } - - augment "/config:modules/config:module/config:configuration" { - case threadpool-flexible { - when "/config:modules/config:module/config:type = 'threadpool-flexible'"; - leaf max-thread-count { - type uint16; - } - leaf minThreadCount { - type uint16; - } - leaf keepAliveMillis { - type uint32; - } - - container threadFactory { - uses config:service-ref { - refine type { - // mandatory true; - config:required-identity th:threadfactory; - } - } - } - } - } - - identity threadpool-scheduled { - base config:module-type; - config:provided-service th:scheduled-threadpool; - config:java-name-prefix ScheduledThreadPool; - } - - augment "/config:modules/config:module/config:configuration" { - case threadpool-scheduled { - when "/config:modules/config:module/config:type = 'threadpool-scheduled'"; - leaf max-thread-count { - type uint16; - } - - container threadFactory { - uses config:service-ref { - refine type { - // mandatory true; - config:required-identity th:threadfactory; - } - } - } - } - } + } } 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 4fda06bf4c..81455a9b21 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,13 +1,5 @@ package org.opendaylight.controller.config.threadpool.fixed; -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.InstanceNotFoundException; -import javax.management.ObjectName; - import org.junit.Before; import org.junit.Test; import org.opendaylight.controller.config.api.ConflictingVersionException; @@ -16,10 +8,18 @@ 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.FixedThreadPoolModuleFactory; -import org.opendaylight.controller.config.yang.threadpool.impl.FixedThreadPoolModuleMXBean; 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 { 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 ee1de8f8ab..5f1a3ee957 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,13 +1,5 @@ package org.opendaylight.controller.config.threadpool.flexible; -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.InstanceNotFoundException; -import javax.management.ObjectName; - import org.junit.Before; import org.junit.Test; import org.opendaylight.controller.config.api.ConflictingVersionException; @@ -16,10 +8,18 @@ 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.FlexibleThreadPoolModuleFactory; -import org.opendaylight.controller.config.yang.threadpool.impl.FlexibleThreadPoolModuleMXBean; 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 { 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 b4b1b60ffe..1567896701 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,15 +1,5 @@ package org.opendaylight.controller.config.threadpool.scheduled; -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; @@ -20,8 +10,18 @@ import org.opendaylight.controller.config.manager.impl.factoriesresolver.Hardcod 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.ScheduledThreadPoolModuleFactory; -import org.opendaylight.controller.config.yang.threadpool.impl.ScheduledThreadPoolModuleMXBean; +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 { 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 27e60eef5c..d1464baa6e 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,27 +1,25 @@ package org.opendaylight.controller.config.threadpool.scheduled; -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; - -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ScheduledFuture; -import java.util.concurrent.TimeUnit; - -import javax.management.ObjectName; - +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.ScheduledThreadPoolModuleMXBean; +import org.opendaylight.controller.config.yang.threadpool.impl.scheduled.ScheduledThreadPoolModuleMXBean; -import com.google.common.util.concurrent.ListenableFutureTask; +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 { -- 2.36.6