From a1c7e3e560f36cb8eecd3dd21a7068a174bcd4ed Mon Sep 17 00:00:00 2001 From: Martin Sunal Date: Thu, 30 Jan 2014 15:26:54 +0100 Subject: [PATCH] BUG 312: Removed legacy RESTCONF draft 01 syntax Change-Id: I1dab84ae70ef39964ead1b14efd58ae2e3eee087 Signed-off-by: Martin Sunal --- .../controller/sal/rest/api/Draft01.java | 19 ------- .../sal/rest/api/RestconfService.java | 14 ++--- .../sal/rest/api/RestconfServiceLegacy.java | 55 ------------------- .../impl/JsonToCompositeNodeProvider.java | 4 +- .../impl/StructuredDataToJsonProvider.java | 4 +- .../impl/StructuredDataToXmlProvider.java | 4 +- .../rest/impl/XmlToCompositeNodeProvider.java | 4 +- .../sal/restconf/impl/RestconfImpl.xtend | 25 --------- .../impl/test/RestGetOperationTest.java | 24 -------- .../impl/test/RestPostOperationTest.java | 17 ------ .../impl/test/RestPutOperationTest.java | 21 ------- 11 files changed, 9 insertions(+), 182 deletions(-) delete mode 100644 opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/api/Draft01.java delete mode 100644 opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/api/RestconfServiceLegacy.java diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/api/Draft01.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/api/Draft01.java deleted file mode 100644 index 557adb6129..0000000000 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/api/Draft01.java +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) 2013 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.rest.api; - -public class Draft01 { - public static class MediaTypes { - public static final String API = "application/vnd.yang.api"; - public static final String DATASTORE = "application/vnd.yang.datastore"; - public static final String DATA = "application/vnd.yang.data"; - public static final String EVENT = "application/vnd.yang.event"; - public static final String OPERATION = "application/vnd.yang.operation"; - public static final String PATCH = "application/vnd.yang.patch"; - } -} diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/api/RestconfService.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/api/RestconfService.java index 60a8f285a2..5300e2f21b 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/api/RestconfService.java +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/api/RestconfService.java @@ -49,7 +49,7 @@ import org.opendaylight.yangtools.yang.data.api.CompositeNode; * */ @Path("/") -public interface RestconfService extends RestconfServiceLegacy { +public interface RestconfService { public static final String XML = "+xml"; public static final String JSON = "+json"; @@ -59,24 +59,20 @@ public interface RestconfService extends RestconfServiceLegacy { @GET @Path("/modules") - @Produces({Draft01.MediaTypes.API+JSON,Draft01.MediaTypes.API+XML, - Draft02.MediaTypes.API+JSON,Draft02.MediaTypes.API+XML}) + @Produces({Draft02.MediaTypes.API+JSON,Draft02.MediaTypes.API+XML}) public StructuredData getModules(); @POST @Path("/operations/{identifier}") - @Produces({Draft01.MediaTypes.DATA+JSON,Draft01.MediaTypes.DATA+XML, - Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML, + @Produces({Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML}) - @Consumes({Draft01.MediaTypes.DATA+JSON,Draft01.MediaTypes.DATA+XML, - Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML, + @Consumes({Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML}) public StructuredData invokeRpc(@PathParam("identifier") String identifier, CompositeNode payload); @POST @Path("/operations/{identifier}") - @Produces({Draft01.MediaTypes.DATA+JSON,Draft01.MediaTypes.DATA+XML, - Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML, + @Produces({Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML}) public StructuredData invokeRpc(@PathParam("identifier") String identifier); diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/api/RestconfServiceLegacy.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/api/RestconfServiceLegacy.java deleted file mode 100644 index 7d6cbfe919..0000000000 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/api/RestconfServiceLegacy.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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.rest.api; - -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - -import org.opendaylight.controller.sal.restconf.impl.StructuredData; -import org.opendaylight.yangtools.yang.data.api.CompositeNode; - -public interface RestconfServiceLegacy { - - public static final String XML = "+xml"; - public static final String JSON = "+json"; - - @Deprecated - @GET - @Path("/datastore") - @Produces({Draft01.MediaTypes.DATASTORE+JSON,Draft01.MediaTypes.DATASTORE+XML}) - public StructuredData readAllData(); - - @Deprecated - @GET - @Path("/datastore/{identifier:.+}") - @Produces({Draft01.MediaTypes.DATA+JSON,Draft01.MediaTypes.DATA+XML, - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML}) - public StructuredData readData(@PathParam("identifier") String identifier); - - @Deprecated - @POST - @Path("/datastore/{identifier:.+}") - @Consumes({Draft01.MediaTypes.DATA+JSON,Draft01.MediaTypes.DATA+XML, - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML}) - public Response createConfigurationDataLegacy(@PathParam("identifier") String identifier, CompositeNode payload); - - @Deprecated - @PUT - @Path("/datastore/{identifier:.+}") - @Consumes({Draft01.MediaTypes.DATA+JSON,Draft01.MediaTypes.DATA+XML, - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML}) - public Response updateConfigurationDataLegacy(@PathParam("identifier") String identifier, CompositeNode payload); - -} diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/JsonToCompositeNodeProvider.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/JsonToCompositeNodeProvider.java index f3995707f3..06576abeec 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/JsonToCompositeNodeProvider.java +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/JsonToCompositeNodeProvider.java @@ -20,14 +20,12 @@ import javax.ws.rs.core.Response; import javax.ws.rs.ext.MessageBodyReader; import javax.ws.rs.ext.Provider; -import org.opendaylight.controller.sal.rest.api.Draft01; import org.opendaylight.controller.sal.rest.api.Draft02; import org.opendaylight.controller.sal.rest.api.RestconfService; import org.opendaylight.yangtools.yang.data.api.CompositeNode; @Provider -@Consumes({ Draft01.MediaTypes.DATA + RestconfService.JSON, Draft02.MediaTypes.DATA + RestconfService.JSON, - MediaType.APPLICATION_JSON }) +@Consumes({ Draft02.MediaTypes.DATA + RestconfService.JSON, MediaType.APPLICATION_JSON }) public enum JsonToCompositeNodeProvider implements MessageBodyReader { INSTANCE; diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/StructuredDataToJsonProvider.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/StructuredDataToJsonProvider.java index e4c4993244..60850d3be1 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/StructuredDataToJsonProvider.java +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/StructuredDataToJsonProvider.java @@ -21,7 +21,6 @@ import javax.ws.rs.core.Response; import javax.ws.rs.ext.MessageBodyWriter; import javax.ws.rs.ext.Provider; -import org.opendaylight.controller.sal.rest.api.Draft01; import org.opendaylight.controller.sal.rest.api.Draft02; import org.opendaylight.controller.sal.rest.api.RestconfService; import org.opendaylight.controller.sal.restconf.impl.ResponseException; @@ -32,8 +31,7 @@ import org.opendaylight.yangtools.yang.model.api.DataNodeContainer; import com.google.gson.stream.JsonWriter; @Provider -@Produces({ Draft01.MediaTypes.DATA + RestconfService.JSON, Draft02.MediaTypes.DATA + RestconfService.JSON, - MediaType.APPLICATION_JSON }) +@Produces({ Draft02.MediaTypes.DATA + RestconfService.JSON, MediaType.APPLICATION_JSON }) public enum StructuredDataToJsonProvider implements MessageBodyWriter { INSTANCE; diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/StructuredDataToXmlProvider.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/StructuredDataToXmlProvider.java index bbe156d3c4..b0ebe78501 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/StructuredDataToXmlProvider.java +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/StructuredDataToXmlProvider.java @@ -26,7 +26,6 @@ import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; -import org.opendaylight.controller.sal.rest.api.Draft01; import org.opendaylight.controller.sal.rest.api.Draft02; import org.opendaylight.controller.sal.rest.api.RestconfService; import org.opendaylight.controller.sal.restconf.impl.ResponseException; @@ -38,8 +37,7 @@ import org.slf4j.LoggerFactory; import org.w3c.dom.Document; @Provider -@Produces({ Draft01.MediaTypes.DATA + RestconfService.XML, Draft02.MediaTypes.DATA + RestconfService.XML, - MediaType.APPLICATION_XML, MediaType.TEXT_XML }) +@Produces({ Draft02.MediaTypes.DATA + RestconfService.XML, MediaType.APPLICATION_XML, MediaType.TEXT_XML }) public enum StructuredDataToXmlProvider implements MessageBodyWriter { INSTANCE; diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/XmlToCompositeNodeProvider.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/XmlToCompositeNodeProvider.java index f03431291e..875c6fffcf 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/XmlToCompositeNodeProvider.java +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/XmlToCompositeNodeProvider.java @@ -21,15 +21,13 @@ import javax.ws.rs.ext.MessageBodyReader; import javax.ws.rs.ext.Provider; import javax.xml.stream.XMLStreamException; -import org.opendaylight.controller.sal.rest.api.Draft01; import org.opendaylight.controller.sal.rest.api.Draft02; import org.opendaylight.controller.sal.rest.api.RestconfService; import org.opendaylight.controller.sal.restconf.impl.ResponseException; import org.opendaylight.yangtools.yang.data.api.CompositeNode; @Provider -@Consumes({ Draft01.MediaTypes.DATA + RestconfService.XML, Draft02.MediaTypes.DATA + RestconfService.XML, - MediaType.APPLICATION_XML, MediaType.TEXT_XML }) +@Consumes({ Draft02.MediaTypes.DATA + RestconfService.XML, MediaType.APPLICATION_XML, MediaType.TEXT_XML }) public enum XmlToCompositeNodeProvider implements MessageBodyReader { INSTANCE; diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/RestconfImpl.xtend b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/RestconfImpl.xtend index 07fb05aded..59d058600a 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/RestconfImpl.xtend +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/RestconfImpl.xtend @@ -58,12 +58,6 @@ class RestconfImpl implements RestconfService { return INSTANCE } - override readAllData() { - - // return broker.readOperationalData("".toInstanceIdentifier.getInstanceIdentifier); - throw new UnsupportedOperationException("Reading all data is currently not supported.") - } - override getModules() { throw new UnsupportedOperationException("TODO: auto-generated method stub") } @@ -103,17 +97,6 @@ class RestconfImpl implements RestconfService { return new StructuredData(rpcResult.result, rpc.output, null) } - override readData(String identifier) { - val iiWithData = identifier.toInstanceIdentifier - var CompositeNode data = null; - if (iiWithData.mountPoint !== null) { - data = broker.readOperationalDataBehindMountPoint(iiWithData.mountPoint, iiWithData.instanceIdentifier) - } else { - data = broker.readOperationalData(iiWithData.getInstanceIdentifier); - } - return new StructuredData(data, iiWithData.schemaNode, iiWithData.mountPoint) - } - override readConfigurationData(String identifier) { val iiWithData = identifier.toInstanceIdentifier var CompositeNode data = null; @@ -136,10 +119,6 @@ class RestconfImpl implements RestconfService { return new StructuredData(data, iiWithData.schemaNode, iiWithData.mountPoint) } - override updateConfigurationDataLegacy(String identifier, CompositeNode payload) { - updateConfigurationData(identifier, payload); - } - override updateConfigurationData(String identifier, CompositeNode payload) { val iiWithData = identifier.toInstanceIdentifier val value = normalizeNode(payload, iiWithData.schemaNode, iiWithData.mountPoint) @@ -156,10 +135,6 @@ class RestconfImpl implements RestconfService { } } - override createConfigurationDataLegacy(String identifier, CompositeNode payload) { - createConfigurationData(identifier, payload); - } - override createConfigurationData(String identifier, CompositeNode payload) { if (payload.namespace === null) { throw new ResponseException(BAD_REQUEST, 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 76ec65c712..be7be9444c 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 @@ -11,7 +11,6 @@ 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; @@ -20,21 +19,16 @@ import java.net.URI; import java.net.URISyntaxException; import java.util.ArrayList; import java.util.List; -import java.util.logging.Level; 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.glassfish.jersey.test.TestProperties; import org.junit.BeforeClass; import org.junit.Test; 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; @@ -84,24 +78,6 @@ public class RestGetOperationTest extends JerseyTest { return resourceConfig; } - /** - * Tests of status codes for "/datastore/{identifier}". - */ - @Test - public void getDatastoreStatusCodes() throws FileNotFoundException, UnsupportedEncodingException { - mockReadOperationalDataMethod(); - String uri = createUri("/datastore/", "ietf-interfaces:interfaces/interface/eth0"); - assertEquals(200, get(uri, MediaType.APPLICATION_XML)); - - uri = createUri("/datastore/", "wrong-module:interfaces/interface/eth0"); - assertEquals(400, get(uri, MediaType.APPLICATION_XML)); - - // Test of request for not existing data. Returning status code 404 - uri = createUri("/datastore/", "ietf-interfaces:interfaces/interface/eth0"); - when(brokerFacade.readOperationalData(any(InstanceIdentifier.class))).thenReturn(null); - assertEquals(404, get(uri, MediaType.APPLICATION_XML)); - } - /** * Tests of status codes for "/operational/{identifier}". */ diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestPostOperationTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestPostOperationTest.java index ab63fbc547..050aa9ab24 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestPostOperationTest.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestPostOperationTest.java @@ -14,7 +14,6 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; 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.IOException; import java.io.InputStream; @@ -29,7 +28,6 @@ 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; @@ -43,7 +41,6 @@ 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; -import org.opendaylight.controller.sal.rest.impl.XmlMapper; import org.opendaylight.controller.sal.rest.impl.XmlToCompositeNodeProvider; import org.opendaylight.controller.sal.restconf.impl.BrokerFacade; import org.opendaylight.controller.sal.restconf.impl.CompositeNodeWrapper; @@ -153,20 +150,6 @@ public class RestPostOperationTest extends JerseyTest { assertEquals(500, post(uri, MediaType.APPLICATION_XML, xmlDataInterfaceAbsolutePath)); } - @Test - public void postDatastoreStatusCodes() throws UnsupportedEncodingException { - controllerContext.setSchemas(schemaContextYangsIetf); - mockCommitConfigurationDataPostMethod(TransactionStatus.COMMITED); - String uri = createUri("/datastore/", "ietf-interfaces:interfaces"); - assertEquals(204, post(uri, MediaType.APPLICATION_XML, xmlDataInterfaceAbsolutePath)); - - mockCommitConfigurationDataPostMethod(null); - assertEquals(202, post(uri, MediaType.APPLICATION_XML, xmlDataInterfaceAbsolutePath)); - - mockCommitConfigurationDataPostMethod(TransactionStatus.FAILED); - assertEquals(500, post(uri, MediaType.APPLICATION_XML, xmlDataInterfaceAbsolutePath)); - } - @Test public void postDataViaUrlMountPoint() throws UnsupportedEncodingException { controllerContext.setSchemas(schemaContextYangsIetf); 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 5d7eb20c42..2ba4a38c88 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 @@ -11,7 +11,6 @@ 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; @@ -24,17 +23,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; @@ -107,19 +103,6 @@ public class RestPutOperationTest extends JerseyTest { 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"); - mockCommitConfigurationDataPutMethod(TransactionStatus.COMMITED); - assertEquals(200, put(uri, MediaType.APPLICATION_XML, xmlData)); - - mockCommitConfigurationDataPutMethod(TransactionStatus.FAILED); - assertEquals(500, put(uri, MediaType.APPLICATION_XML, xmlData)); - } - @Test public void testRpcResultCommitedToStatusCodesWithMountPoint() throws UnsupportedEncodingException, FileNotFoundException, URISyntaxException { @@ -131,10 +114,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); -- 2.36.6