X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-rest-connector%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Frestconf%2Fimpl%2Ftest%2FRestGetOperationTest.java;h=eb7ea71bf4c65bee9336a2561e7470c16aabfc0f;hp=1dc5d672f39c0dd37c329b4905dd574298780c5e;hb=a59286ee063c90817958e9cef4836e15aec3c7a6;hpb=23dd80128aab8979cf7b3a48cea80dceb8ebe762 diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestGetOperationTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestGetOperationTest.java index 1dc5d672f3..eb7ea71bf4 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestGetOperationTest.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestGetOperationTest.java @@ -17,7 +17,6 @@ import static org.mockito.Matchers.any; import static org.mockito.Matchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; - import com.google.common.base.Optional; import com.google.common.collect.Maps; import java.io.FileNotFoundException; @@ -313,7 +312,6 @@ public class RestGetOperationTest extends JerseyTest { // /operations @Test - @Ignore // FIXME restconf-netconf yang schema has to be updated for operations container public void getOperationsTest() throws FileNotFoundException, UnsupportedEncodingException { setControllerContext(schemaContextModules); @@ -339,32 +337,26 @@ public class RestGetOperationTest extends JerseyTest { } private void validateOperationsResponseXml(final Document responseDoc, final SchemaContext schemaContext) { + final Element operationsElem = responseDoc.getDocumentElement(); assertEquals(RESTCONF_NS, operationsElem.getNamespaceURI()); assertEquals("operations", operationsElem.getLocalName()); - - final HashSet foundOperations = new HashSet<>(); - final NodeList operationsList = operationsElem.getChildNodes(); - for(int i = 0;i < operationsList.getLength();i++) { - final org.w3c.dom.Node operation = operationsList.item(i); + final HashSet foundOperations = new HashSet<>(); - final String namespace = operation.getNamespaceURI(); - final String name = operation.getLocalName(); - final QName opQName = QName.create(URI.create(namespace), null, name); - foundOperations.add(opQName); + for (int i = 0; i < operationsList.getLength(); i++) { + final org.w3c.dom.Node operation = operationsList.item(i); + foundOperations.add(operation.getLocalName()); } - for(final RpcDefinition schemaOp : schemaContext.getOperations()) { - assertTrue(foundOperations.contains(schemaOp.getQName().withoutRevision())); + for (final RpcDefinition schemaOp : schemaContext.getOperations()) { + assertTrue(foundOperations.contains(schemaOp.getQName().getLocalName())); } - } // /operations/pathToMountPoint/yang-ext:mount @Test - @Ignore // FIXME fix the way to provide operations overview functionality asap public void getOperationsBehindMountPointTest() throws FileNotFoundException, UnsupportedEncodingException { setControllerContext(schemaContextModules); @@ -395,33 +387,7 @@ public class RestGetOperationTest extends JerseyTest { private Matcher validateOperationsResponseJson(final String searchIn, final String rpcName, final String moduleName) { final StringBuilder regex = new StringBuilder(); - regex.append("^"); - - regex.append(".*\\{"); - regex.append(".*\""); - - // operations prefix optional - regex.append("("); - regex.append("ietf-restconf:"); - regex.append("|)"); - // :operations prefix optional - - regex.append("operations\""); - regex.append(".*:"); - regex.append(".*\\{"); - - regex.append(".*\"" + moduleName); - regex.append(":"); - regex.append(rpcName + "\""); - regex.append(".*\\["); - regex.append(".*null"); - regex.append(".*\\]"); - - regex.append(".*\\}"); - regex.append(".*\\}"); - - regex.append(".*"); - regex.append("$"); + regex.append(".*\"" + rpcName + "\""); final Pattern ptrn = Pattern.compile(regex.toString(), Pattern.DOTALL); return ptrn.matcher(searchIn);