GSO-34 Fix unmarshal json error.
authorLuji7 <lu.ji3@zte.com.cn>
Fri, 21 Oct 2016 07:41:31 +0000 (15:41 +0800)
committerLuji <lu.ji3@zte.com.cn>
Mon, 24 Oct 2016 02:13:50 +0000 (02:13 +0000)
Change-Id: Ife9941fbb9f765673edd22613d41603a7d11060a
Signed-off-by: Luji7 <lu.ji3@zte.com.cn>
(cherry picked from commit aa290444e456ebfc7b8cf48ea344e17c17105a0a)

servicegateway/service/src/main/java/org/openo/gso/gui/servicegateway/roa/impl/ServiceGatewayRoaModuleImpl.java
servicegateway/service/src/main/java/org/openo/gso/gui/servicegateway/service/impl/ServiceGatewayImpl.java
servicegateway/service/src/main/java/org/openo/gso/gui/servicegateway/service/inf/IServiceGateway.java
servicegateway/service/src/test/java/org/openo/gso/gui/servicegateway/service/impl/ServiceGatewayImplTest.java

index 7b3cec0..059e6fd 100644 (file)
@@ -108,7 +108,7 @@ public class ServiceGatewayRoaModuleImpl implements IServiceGatewayRoaModule {
             ValidateUtil.assertStringNotNull(reqContent);
 
             // 2. Delete service
-            result = serviceGateway.deleteService(serviceId, servletReq);
+            result = serviceGateway.deleteService(serviceId, reqContent, servletReq);
         } catch(ServiceException exception) {
             LOGGER.error("Fail to delete service instance.");
             return Response.serverError().build();
index bc716d5..4f592f5 100644 (file)
@@ -131,14 +131,13 @@ public class ServiceGatewayImpl implements IServiceGateway {
      * @since GSO 0.5
      */
     @Override
-    public Map<String, Object> deleteService(String serviceId, HttpServletRequest httpRequest) throws ServiceException {
+    public Map<String, Object> deleteService(String serviceId, String reqContent, HttpServletRequest httpRequest) throws ServiceException {
        if(httpRequest == null)
        {               
                LOGGER.error("ServiceGatewayImpl.deleteService httpRequest is null");
                throw new ServiceException("ServiceGatewayImpl.deleteService httpRequest is null");
        }
         // Parse request
-        String reqContent = RestUtils.getRequestBody(httpRequest);
         Map<String, Object> requestBody = JsonUtil.unMarshal(reqContent, Map.class);
         ValidateUtil.assertObjectNotNull(requestBody);
 
index cba925c..a5f6b6f 100644 (file)
@@ -52,6 +52,6 @@ public interface IServiceGateway {
      * @throws ServiceException operate DB or parameter is wrong.
      * @since GSO 0.5
      */
-    Map<String, Object> deleteService(String serviceId, HttpServletRequest httpRequest) throws ServiceException;
+    Map<String, Object> deleteService(String serviceId, String reqContent, HttpServletRequest httpRequest) throws ServiceException;
 
 }
index d1cb391..b7c1657 100644 (file)
@@ -66,7 +66,7 @@ public class ServiceGatewayImplTest {
      */
     @Test(expected = ServiceException.class)
     public void testDeleteServiceFail() throws ServiceException {      
-        serviceManager.deleteService(null, httpRequest);
+        serviceManager.deleteService(null, "", httpRequest);
     }
 
 }