summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjin xin <j00101220@huawei.com>2016-10-10 10:00:54 +0000
committerGerrit Code Review <gerrit@open-o.org>2016-10-10 10:00:54 +0000
commit42b281cebb70e5dd2c8a968f8583668c046ca62e (patch)
treedb32262ff822653fbb977b03e821d6a321bc0096
parent533d56dfdc13b468932602cd225389f4ba56d9c8 (diff)
parentd2c51b8d20c56fa9a0ddc40b2a9d49e421362c44 (diff)
Merge "Resolve the Bug GSO-9"
-rw-r--r--servicegateway/service/src/main/java/org/openo/gso/gui/servicegateway/service/impl/ServiceGatewayImpl.java7
-rw-r--r--servicegateway/service/src/test/java/org/openo/gso/gui/servicegateway/roa/impl/ServiceGatewayRoaModuleImplTest.java2
-rw-r--r--servicegateway/service/src/test/java/org/openo/gso/gui/servicegateway/service/impl/ServiceGatewayImplTest.java2
3 files changed, 9 insertions, 2 deletions
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 113693c8..0a70850c 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
@@ -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);
diff --git a/servicegateway/service/src/test/java/org/openo/gso/gui/servicegateway/roa/impl/ServiceGatewayRoaModuleImplTest.java b/servicegateway/service/src/test/java/org/openo/gso/gui/servicegateway/roa/impl/ServiceGatewayRoaModuleImplTest.java
index adbcd757..4fd620cc 100644
--- a/servicegateway/service/src/test/java/org/openo/gso/gui/servicegateway/roa/impl/ServiceGatewayRoaModuleImplTest.java
+++ b/servicegateway/service/src/test/java/org/openo/gso/gui/servicegateway/roa/impl/ServiceGatewayRoaModuleImplTest.java
@@ -122,6 +122,8 @@ public class ServiceGatewayRoaModuleImplTest {
*/
@Test
public void testDeleteService() throws ServiceException {
+ mockGetRequestBody(FILE_PATH + "createServiceInstance.json");
+ mockPost(responseSuccess);
serviceRoa.deleteService("1", httpRequest);
}
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 fddebe00..d1cb3916 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
@@ -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);
}