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%2FRestPutOperationTest.java;h=3af2945526466fabf3e9c139b79eb4134107752f;hp=45ead9bfdda629a61244492086ef29e82f73901e;hb=4063669aa69554b0513aac11c7a4e20fa066fa06;hpb=7974eb6a8ede81ed2593fe3fb5cda65cee51ee5d diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestPutOperationTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestPutOperationTest.java index 45ead9bfdd..3af2945526 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestPutOperationTest.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestPutOperationTest.java @@ -1,11 +1,16 @@ +/* + * Copyright (c) 2014 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.sal.restconf.impl.test; import static org.junit.Assert.assertEquals; import static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import static org.opendaylight.controller.sal.restconf.impl.test.RestOperationUtils.XML; -import static org.opendaylight.controller.sal.restconf.impl.test.RestOperationUtils.createUri; import java.io.FileNotFoundException; import java.io.IOException; @@ -17,17 +22,14 @@ import java.util.concurrent.Future; import javax.ws.rs.client.Entity; import javax.ws.rs.core.Application; import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.test.JerseyTest; import org.junit.BeforeClass; -import org.junit.Ignore; import org.junit.Test; import org.opendaylight.controller.md.sal.common.api.TransactionStatus; import org.opendaylight.controller.sal.core.api.mount.MountInstance; import org.opendaylight.controller.sal.core.api.mount.MountService; -import org.opendaylight.controller.sal.rest.api.Draft02; import org.opendaylight.controller.sal.rest.impl.JsonToCompositeNodeProvider; import org.opendaylight.controller.sal.rest.impl.StructuredDataToJsonProvider; import org.opendaylight.controller.sal.rest.impl.StructuredDataToXmlProvider; @@ -92,20 +94,7 @@ public class RestPutOperationTest extends JerseyTest { */ @Test public void putConfigStatusCodes() throws UnsupportedEncodingException { - String uri = createUri("/config/", "ietf-interfaces:interfaces/interface/eth0"); - mockCommitConfigurationDataPutMethod(TransactionStatus.COMMITED); - assertEquals(200, put(uri, MediaType.APPLICATION_XML, xmlData)); - - mockCommitConfigurationDataPutMethod(TransactionStatus.FAILED); - assertEquals(500, put(uri, MediaType.APPLICATION_XML, xmlData)); - } - - /** - * Tests of status codes for "/datastore/{identifier}". - */ - @Test - public void putDatastoreStatusCodes() throws UnsupportedEncodingException { - String uri = createUri("/datastore/", "ietf-interfaces:interfaces/interface/eth0"); + String uri = "/config/ietf-interfaces:interfaces/interface/eth0"; mockCommitConfigurationDataPutMethod(TransactionStatus.COMMITED); assertEquals(200, put(uri, MediaType.APPLICATION_XML, xmlData)); @@ -124,10 +113,6 @@ public class RestPutOperationTest extends JerseyTest { brokerFacade.commitConfigurationDataPutBehindMountPoint(any(MountInstance.class), any(InstanceIdentifier.class), any(CompositeNode.class))).thenReturn(dummyFuture); - InputStream xmlStream = RestconfImplTest.class.getResourceAsStream("/full-versions/test-data2/data2.xml"); - String xml = TestUtils.getDocumentInPrintableForm(TestUtils.loadDocumentFrom(xmlStream)); - Entity entity = Entity.entity(xml, Draft02.MediaTypes.DATA + XML); - MountInstance mountInstance = mock(MountInstance.class); when(mountInstance.getSchemaContext()).thenReturn(schemaContextTestModule); MountService mockMountService = mock(MountService.class); @@ -135,10 +120,10 @@ public class RestPutOperationTest extends JerseyTest { ControllerContext.getInstance().setMountService(mockMountService); - String uri = createUri("/config/", "ietf-interfaces:interfaces/interface/0/yang-ext:mount/test-module:cont"); + String uri = "/config/ietf-interfaces:interfaces/interface/0/yang-ext:mount/test-module:cont"; assertEquals(200, put(uri, MediaType.APPLICATION_XML, xmlData2)); - uri = createUri("/config/", "ietf-interfaces:interfaces/yang-ext:mount/test-module:cont"); + uri = "/config/ietf-interfaces:interfaces/yang-ext:mount/test-module:cont"; assertEquals(200, put(uri, MediaType.APPLICATION_XML, xmlData2)); } @@ -158,7 +143,7 @@ public class RestPutOperationTest extends JerseyTest { ControllerContext.getInstance().setMountService(mockMountService); - String uri = createUri("/config/", "ietf-interfaces:interfaces/yang-ext:mount"); + String uri = "/config/ietf-interfaces:interfaces/yang-ext:mount"; assertEquals(200, put(uri, MediaType.APPLICATION_XML, xmlData3)); }