Resolve the Bug GSO-9
authorj00302280 <j00101220@huawei.com>
Mon, 10 Oct 2016 09:56:49 +0000 (17:56 +0800)
committerj00302280 <j00101220@huawei.com>
Mon, 10 Oct 2016 09:56:49 +0000 (17:56 +0800)
Change-Id: I1cbbc996ce1a43159073d02c8ebb733cfc7d8d54
Signed-off-by: j00302280 <j00101220@huawei.com>
servicegateway/service/src/main/java/org/openo/gso/gui/servicegateway/service/impl/ServiceGatewayImpl.java
servicegateway/service/src/test/java/org/openo/gso/gui/servicegateway/roa/impl/ServiceGatewayRoaModuleImplTest.java
servicegateway/service/src/test/java/org/openo/gso/gui/servicegateway/service/impl/ServiceGatewayImplTest.java

index 113693c..0a70850 100644 (file)
@@ -64,7 +64,7 @@ public class ServiceGatewayImpl implements IServiceGateway {
        if(StringUtils.isEmpty(reqContent))
        {
                LOGGER.error("ServiceGatewayImpl createService reqContent is null.");
-               return null;
+               throw new ServiceException("ServiceGatewayImpl createService reqContent is null.");             
        }
        
        // Parse request
@@ -128,6 +128,11 @@ public class ServiceGatewayImpl implements IServiceGateway {
      */
     @Override
     public void deleteService(String serviceId, 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);
index adbcd75..4fd620c 100644 (file)
@@ -122,6 +122,8 @@ public class ServiceGatewayRoaModuleImplTest {
      */
     @Test
     public void testDeleteService() throws ServiceException {
+        mockGetRequestBody(FILE_PATH + "createServiceInstance.json");        
+        mockPost(responseSuccess);
         serviceRoa.deleteService("1", httpRequest);
     }
 
index fddebe0..d1cb391 100644 (file)
@@ -65,7 +65,7 @@ public class ServiceGatewayImplTest {
      * @since GSO 0.5
      */
     @Test(expected = ServiceException.class)
-    public void testDeleteServiceFail() throws ServiceException {
+    public void testDeleteServiceFail() throws ServiceException {      
         serviceManager.deleteService(null, httpRequest);
     }