GSO-34 Fix unmarshal json error.
Change-Id: Ife9941fbb9f765673edd22613d41603a7d11060a
Signed-off-by: Luji7 <lu.ji3@zte.com.cn>
diff --git a/servicegateway/service/src/main/java/org/openo/gso/gui/servicegateway/roa/impl/ServiceGatewayRoaModuleImpl.java b/servicegateway/service/src/main/java/org/openo/gso/gui/servicegateway/roa/impl/ServiceGatewayRoaModuleImpl.java
index cca5f60..bd91ff2 100644
--- a/servicegateway/service/src/main/java/org/openo/gso/gui/servicegateway/roa/impl/ServiceGatewayRoaModuleImpl.java
+++ b/servicegateway/service/src/main/java/org/openo/gso/gui/servicegateway/roa/impl/ServiceGatewayRoaModuleImpl.java
@@ -108,7 +108,7 @@
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();
diff --git a/servicegateway/service/src/main/java/org/openo/gso/gui/servicegateway/service/impl/ServiceGatewayImpl.java b/servicegateway/service/src/main/java/org/openo/gso/gui/servicegateway/service/impl/ServiceGatewayImpl.java
index bc716d5..4f592f5 100644
--- a/servicegateway/service/src/main/java/org/openo/gso/gui/servicegateway/service/impl/ServiceGatewayImpl.java
+++ b/servicegateway/service/src/main/java/org/openo/gso/gui/servicegateway/service/impl/ServiceGatewayImpl.java
@@ -131,14 +131,13 @@
* @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);
diff --git a/servicegateway/service/src/main/java/org/openo/gso/gui/servicegateway/service/inf/IServiceGateway.java b/servicegateway/service/src/main/java/org/openo/gso/gui/servicegateway/service/inf/IServiceGateway.java
index cba925c..a5f6b6f 100644
--- a/servicegateway/service/src/main/java/org/openo/gso/gui/servicegateway/service/inf/IServiceGateway.java
+++ b/servicegateway/service/src/main/java/org/openo/gso/gui/servicegateway/service/inf/IServiceGateway.java
@@ -52,6 +52,6 @@
* @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;
}
diff --git a/servicegateway/service/src/test/java/org/openo/gso/gui/servicegateway/service/impl/ServiceGatewayImplTest.java b/servicegateway/service/src/test/java/org/openo/gso/gui/servicegateway/service/impl/ServiceGatewayImplTest.java
index d1cb391..b7c1657 100644
--- a/servicegateway/service/src/test/java/org/openo/gso/gui/servicegateway/service/impl/ServiceGatewayImplTest.java
+++ b/servicegateway/service/src/test/java/org/openo/gso/gui/servicegateway/service/impl/ServiceGatewayImplTest.java
@@ -66,7 +66,7 @@
*/
@Test(expected = ServiceException.class)
public void testDeleteServiceFail() throws ServiceException {
- serviceManager.deleteService(null, httpRequest);
+ serviceManager.deleteService(null, "", httpRequest);
}
}