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%2FTestingConfigTransactionController.java;h=ee1e61967db9b7180f232de50fdd277cc0293009;hb=d7ce37f576bcf35aa29665db89cadf854487f338;hp=4d16f51ae5e8e3068a32a0315dadc82ee16c6f42;hpb=81282cf3711693da7dde667c6bbf18cb40e81ad0;p=controller.git diff --git a/opendaylight/config/config-util/src/test/java/org/opendaylight/controller/config/util/TestingConfigTransactionController.java b/opendaylight/config/config-util/src/test/java/org/opendaylight/controller/config/util/TestingConfigTransactionController.java index 4d16f51ae5..ee1e61967d 100644 --- a/opendaylight/config/config-util/src/test/java/org/opendaylight/controller/config/util/TestingConfigTransactionController.java +++ b/opendaylight/config/config-util/src/test/java/org/opendaylight/controller/config/util/TestingConfigTransactionController.java @@ -7,6 +7,7 @@ */ package org.opendaylight.controller.config.util; +import java.util.HashMap; import java.util.Map; import java.util.Set; @@ -24,6 +25,10 @@ public class TestingConfigTransactionController implements ConfigTransactionControllerMXBean { public final ObjectName conf1, conf2, conf3; + public ObjectName conf4; + public String check; + Map mapSub; + Map> map; public static final String moduleName1 = "moduleA"; public static final String moduleName2 = "moduleB"; @@ -42,17 +47,29 @@ public class TestingConfigTransactionController implements + ":type=Module," + ObjectNameUtil.MODULE_FACTORY_NAME_KEY + "=" + moduleName2 + "," + ObjectNameUtil.INSTANCE_NAME_KEY + "=" + instName2); + conf4 = ObjectNameUtil.createON(ObjectNameUtil.ON_DOMAIN + + ":type=Module," + ObjectNameUtil.MODULE_FACTORY_NAME_KEY + + "=" + moduleName2 + "," + ObjectNameUtil.INSTANCE_NAME_KEY + + "=" + instName2); + mapSub = new HashMap(); + map = new HashMap>(); } @Override public ObjectName createModule(String moduleName, String instanceName) throws InstanceAlreadyExistsException { - return null; + //return null; + return ObjectNameUtil.createON(ObjectNameUtil.ON_DOMAIN + + ":type=Module," + ObjectNameUtil.MODULE_FACTORY_NAME_KEY + + "=" + moduleName); } @Override public void destroyModule(ObjectName objectName) throws InstanceNotFoundException { + if(objectName != null){ + conf4 = null; + } } @Override @@ -65,7 +82,8 @@ public class TestingConfigTransactionController implements @Override public String getTransactionName() { - return null; + //return null; + return "transactionName"; } @Override @@ -113,66 +131,69 @@ public class TestingConfigTransactionController implements @Override public void checkConfigBeanExists(ObjectName objectName) throws InstanceNotFoundException { - throw new UnsupportedOperationException(); + check = "configBeanExists"; } @Override public ObjectName saveServiceReference(String serviceInterfaceName, String refName, ObjectName moduleON) throws InstanceNotFoundException { - throw new UnsupportedOperationException(); + return moduleON; } @Override public void removeServiceReference(String serviceInterfaceName, String refName) { - throw new UnsupportedOperationException(); + check = refName; } @Override public void removeAllServiceReferences() { - throw new UnsupportedOperationException(); + check = null; } @Override public ObjectName lookupConfigBeanByServiceInterfaceName(String serviceInterfaceQName, String refName) { - throw new UnsupportedOperationException(); + return conf3; } @Override public Map> getServiceMapping() { - throw new UnsupportedOperationException(); + mapSub.put("A",conf2); + map.put("AA", mapSub); + return map; } @Override public Map lookupServiceReferencesByServiceInterfaceName(String serviceInterfaceQName) { - throw new UnsupportedOperationException(); + mapSub.put("A",conf2); + return mapSub; } @Override public Set lookupServiceInterfaceNames(ObjectName objectName) throws InstanceNotFoundException { - throw new UnsupportedOperationException(); + return Sets.newHashSet("setA"); } @Override public String getServiceInterfaceName(String namespace, String localName) { - throw new UnsupportedOperationException(); + return check=namespace+localName; } @Override public boolean removeServiceReferences(ObjectName objectName) throws InstanceNotFoundException { - throw new UnsupportedOperationException(); + return true; } @Override public Set getAvailableModuleFactoryQNames() { - throw new UnsupportedOperationException(); + return Sets.newHashSet("availableModuleFactoryQNames"); } @Override public ObjectName getServiceReference(String serviceInterfaceQName, String refName) throws InstanceNotFoundException { - throw new UnsupportedOperationException(); + return conf3; } @Override public void checkServiceReferenceExists(ObjectName objectName) throws InstanceNotFoundException { - throw new UnsupportedOperationException(); + check = "referenceExist"; } }