X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fconfig%2Fconfig-manager-facade-xml%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Ffacade%2Fxml%2Frpc%2FRuntimeRpcElementResolvedTest.java;fp=opendaylight%2Fconfig%2Fconfig-manager-facade-xml%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Ffacade%2Fxml%2Frpc%2FRuntimeRpcElementResolvedTest.java;h=0000000000000000000000000000000000000000;hp=babd325c1b5fd9e979d27b006b7e566948c07edc;hb=ac6f2699cd0c1e340cc32e8f0d0ca94c8e9c0cc0;hpb=f43b01b81319959b1907e3e04537f5169e7f33d8 diff --git a/opendaylight/config/config-manager-facade-xml/src/test/java/org/opendaylight/controller/config/facade/xml/rpc/RuntimeRpcElementResolvedTest.java b/opendaylight/config/config-manager-facade-xml/src/test/java/org/opendaylight/controller/config/facade/xml/rpc/RuntimeRpcElementResolvedTest.java deleted file mode 100644 index babd325c1b..0000000000 --- a/opendaylight/config/config-manager-facade-xml/src/test/java/org/opendaylight/controller/config/facade/xml/rpc/RuntimeRpcElementResolvedTest.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2015, 2017 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.facade.xml.rpc; - -import static org.junit.Assert.assertEquals; - -import com.google.common.collect.ImmutableMap; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; - -@RunWith(Parameterized.class) -public class RuntimeRpcElementResolvedTest { - - private static final String MODULE_TYPE = "moduleType"; - private static final String INSTANCE_NAME = "instanceName"; - @Parameterized.Parameter(0) - public String xpath; - @Parameterized.Parameter(1) - public Map additional; - - @Parameterized.Parameters(name = "{index}: parsed({0}) contains moduleName:{1} and instanceName:{2}") - @SuppressWarnings("linelength") - public static Collection data() { - return Arrays.asList(new Object[][] { - // With namespaces - { "/a:modules/a:module[a:name='instanceName'][a:type='moduleType']/b:listener-state[b:peer-id='127.0.0.1']", - new HashMap<>(ImmutableMap.of("listener-state", "127.0.0.1")) }, - { "/a:modules/a:module[a:name='instanceName'][a:type='moduleType']", null }, - - // Without namespaces - { "/modules/module[name=instanceName][type=moduleType]", null }, - { "/modules/module[type=moduleType][name='instanceName']", null }, - { "/modules/module[name=\'instanceName\'][type=\"moduleType\"]", null }, - { "/modules/module[type=moduleType and name=instanceName]", null }, - { "/modules/module[name=\"instanceName\" and type=moduleType]", null }, - { "/modules/module[type=\"moduleType\" and name=instanceName]", null }, - { "/modules/module[name=\'instanceName\' and type=\"moduleType\"]", null }, - - // With inner beans - { "/modules/module[name=instanceName and type=\"moduleType\"]/inner[key=b]", - Collections.singletonMap("inner", "b") }, - { "/modules/module[name=instanceName and type=moduleType]/inner[key=b]", - Collections.singletonMap("inner", "b") }, - { "/modules/module[name=instanceName and type=moduleType]/inner[key=\'b\']", - Collections.singletonMap("inner", "b") }, - { "/modules/module[name=instanceName and type=moduleType]/inner[key=\"b\"]", - Collections.singletonMap("inner", "b") }, - - { "/modules/module[name=instanceName and type=\"moduleType\"]/inner[key2=a]/inner2[key=b]", - new HashMap<>(ImmutableMap.of("inner", "a", "inner2", "b")) }, }); - } - - @Test - public void testFromXpath() throws Exception { - final RuntimeRpcElementResolved resolved = RuntimeRpcElementResolved.fromXpath(xpath, "element", "namespace"); - assertEquals(MODULE_TYPE, resolved.getModuleName()); - assertEquals(INSTANCE_NAME, resolved.getInstanceName()); - if (additional != null) { - assertEquals(additional, resolved.getAdditionalAttributes()); - } - } -}