X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fconfig%2Fconfig-util%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Futil%2FTestingConfigRegistry.java;fp=opendaylight%2Fconfig%2Fconfig-util%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Futil%2FTestingConfigRegistry.java;h=ab6cda935bd5976fc2c1f446d82bc68393c41d35;hb=76cc965bd2d9978fedcbe19603c98e7752abf5a8;hp=e0d4c8594375c58739a46c1c27760c1a1c9860a1;hpb=25b805c6685467f561506dbb5187a744fc12096b;p=controller.git diff --git a/opendaylight/config/config-util/src/test/java/org/opendaylight/controller/config/util/TestingConfigRegistry.java b/opendaylight/config/config-util/src/test/java/org/opendaylight/controller/config/util/TestingConfigRegistry.java index e0d4c85943..ab6cda935b 100644 --- a/opendaylight/config/config-util/src/test/java/org/opendaylight/controller/config/util/TestingConfigRegistry.java +++ b/opendaylight/config/config-util/src/test/java/org/opendaylight/controller/config/util/TestingConfigRegistry.java @@ -7,6 +7,7 @@ */ package org.opendaylight.controller.config.util; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; @@ -26,20 +27,31 @@ import com.google.common.collect.Sets; public class TestingConfigRegistry implements ConfigRegistryMXBean { static final ObjectName conf1, conf2, conf3, run1, run2, run3; + public static String check; + public static boolean checkBool; + private Map map = new HashMap<>(); public static final String moduleName1 = "moduleA"; public static final String moduleName2 = "moduleB"; public static final String instName1 = "instA"; public static final String instName2 = "instB"; + public static final String refName1 = "refA"; + public static final String refName2 = "refB"; + public static final String serviceQName1 = "qnameA"; + public static final String serviceQName2 = "qnameB"; static { conf1 = ObjectNameUtil.createON(ObjectNameUtil.ON_DOMAIN + ":type=Module," + ObjectNameUtil.MODULE_FACTORY_NAME_KEY - + "=" + moduleName1); + + "=" + moduleName1 + "," + ObjectNameUtil.SERVICE_QNAME_KEY + + "=" + serviceQName1 + "," + ObjectNameUtil.REF_NAME_KEY + + "=" + refName1); conf2 = ObjectNameUtil.createON(ObjectNameUtil.ON_DOMAIN + ":type=Module," + ObjectNameUtil.MODULE_FACTORY_NAME_KEY + "=" + moduleName1 + "," + ObjectNameUtil.INSTANCE_NAME_KEY - + "=" + instName1); + + "=" + instName1 + "," + ObjectNameUtil.SERVICE_QNAME_KEY + + "=" + serviceQName2 + "," + ObjectNameUtil.REF_NAME_KEY + + "=" + refName1); conf3 = ObjectNameUtil.createON(ObjectNameUtil.ON_DOMAIN + ":type=Module," + ObjectNameUtil.MODULE_FACTORY_NAME_KEY + "=" + moduleName2 + "," + ObjectNameUtil.INSTANCE_NAME_KEY @@ -55,11 +67,15 @@ public class TestingConfigRegistry implements ConfigRegistryMXBean { + ":type=RuntimeBean," + ObjectNameUtil.MODULE_FACTORY_NAME_KEY + "=" + moduleName2 + "," + ObjectNameUtil.INSTANCE_NAME_KEY + "=" + instName2); + + check = null; + checkBool = false; + } @Override public ObjectName beginConfig() { - return null; + return conf2; } @Override @@ -146,42 +162,60 @@ public class TestingConfigRegistry implements ConfigRegistryMXBean { @Override public void checkConfigBeanExists(ObjectName objectName) throws InstanceNotFoundException { - throw new UnsupportedOperationException(); + Set configBeans = Sets. newHashSet(run1, run2, run3); + if(configBeans.size()>0){ + checkBool = true; + } } @Override public ObjectName lookupConfigBeanByServiceInterfaceName(String serviceInterfaceQName, String refName) { - throw new UnsupportedOperationException(); + if (serviceInterfaceQName.equals(serviceQName1) && refName.equals(refName1)) { + return conf1; + } + else{ + return null; + } } @Override public Map> getServiceMapping() { - throw new UnsupportedOperationException(); + return null; } @Override public Map lookupServiceReferencesByServiceInterfaceName(String serviceInterfaceQName) { - throw new UnsupportedOperationException(); + + if(serviceInterfaceQName.equals(serviceQName1)){ + map.put("conf1", conf1); + } + else if(serviceInterfaceQName.equals(serviceQName2)){ + map.put("conf2", conf2); + } + else{ + map.put("conf3", conf3); + } + return map; } @Override public Set lookupServiceInterfaceNames(ObjectName objectName) throws InstanceNotFoundException { - throw new UnsupportedOperationException(); + return Sets. newHashSet(serviceQName1, serviceQName2); } @Override public String getServiceInterfaceName(String namespace, String localName) { - throw new UnsupportedOperationException(); + return null; } @Override public Set getAvailableModuleFactoryQNames() { - throw new UnsupportedOperationException(); + return Sets. newHashSet(moduleName1, moduleName2); } @Override public ObjectName getServiceReference(String serviceInterfaceQName, String refName) throws InstanceNotFoundException { - throw new UnsupportedOperationException(); + return conf1; } @Override