\r
import org.apache.commons.lang3.StringUtils;\r
import org.openo.baseservice.util.impl.SystemEnvVariablesFactory;\r
+import org.openo.gso.gui.servicegateway.constant.Constant;\r
+import org.openo.gso.gui.servicegateway.util.register.RegisterUtil;\r
import org.slf4j.Logger;\r
import org.slf4j.LoggerFactory;\r
\r
\r
private static final Logger LOGGER = LoggerFactory.getLogger(Activator.class);\r
\r
+\r
/**\r
* start operation by spring <br/>\r
* \r
private void registerService() {\r
// get the jsonString form the service file\r
String root = SystemEnvVariablesFactory.getInstance().getAppRoot();\r
-// String serviceFilePath = root + File.separator + Constant.FILE_PATH_ETC + File.separator\r
-// + Constant.FILE_PATH_REGISTER + File.separator + Constant.FILE_PATH_JSON;\r
-// String jsonInfo = RegisterUtil.readFile(serviceFilePath);\r
-//\r
-// // check the jsonInfo\r
-// if(StringUtils.isEmpty(jsonInfo)) {\r
-// LOGGER.error("GSO ReadFile fail: jsonInfo is null. the serviceFilePath=" + serviceFilePath);\r
-// return;\r
-// }\r
+ String serviceFilePath = root + File.separator + Constant.FILE_PATH_ETC + File.separator\r
+ + Constant.FILE_PATH_REGISTER + File.separator + Constant.FILE_PATH_JSON;\r
+ String jsonInfo = RegisterUtil.readFile(serviceFilePath);\r
+\r
+ // check the jsonInfo\r
+ if(StringUtils.isEmpty(jsonInfo)) {\r
+ LOGGER.error("ServiceGateway ReadFile fail: jsonInfo is null. the serviceFilePath=" + serviceFilePath);\r
+ return;\r
+ }\r
\r
// register service by the jsonInfo\r
-// RegisterUtil.registerService(jsonInfo);\r
+ RegisterUtil.registerService(jsonInfo);\r
}\r
\r
/**\r
*/\r
public class Constant {\r
\r
- /**\r
- * Service instance name.\r
- */\r
- public static final String SERVICE_NAME = "name";\r
-\r
- /**\r
- * Service instance description.\r
+ /**\r
+ * Service instance ID.\r
*/\r
- public static final String SERVICE_DESCRIPTION = "description";\r
-\r
+ public static final String SERVICE_INDENTIFY = "service";\r
+ \r
/**\r
* Service instance ID.\r
*/\r
public static final String SERVICE_DEF_ID = "serviceDefId";\r
\r
/**\r
- * Service template ID.\r
+ * Service gateway URL.\r
*/\r
- public static final String SERVICE_TEMPLATE_ID = "templateId";\r
+ public static final String SERVICE_GATEWAY_URI = "gatewayUri";\r
\r
- /**\r
- * Service template name.\r
- */\r
- public static final String SERVICE_TEMPLATE_NAME = "templateName";\r
-\r
- /**\r
- * service parameters\r
- */\r
- public static final String SERVICE_PARAMETERS = "parameters";\r
\r
/**\r
* Create workflow name.\r
public static final String RESPONSE_STATUS_FAIL = "fail";\r
\r
/**\r
- * Identify of csar.\r
+ * ID of instance.\r
*/\r
- public static final String CSAR_ID = "csarId";\r
+ public static final String NS_INSTANCE_ID = "nsInstanceId";\r
\r
/**\r
* service identify.\r
*/\r
- public static final String SERVICE_INDENTIFY = "service";\r
+ public static final String SERVICE_ID = "serviceId";\r
+\r
+ /**\r
+ * job Id\r
+ */\r
+ public static final String JOB_ID = "jobId";\r
+ \r
+ /**\r
+ * service file Path:etc\r
+ */\r
+ public static final String FILE_PATH_ETC = "etc";\r
+\r
+ /**\r
+ * service file Path:register\r
+ */\r
+ public static final String FILE_PATH_REGISTER = "register";\r
+\r
+ /**\r
+ * service file Path:file name\r
+ */\r
+ public static final String FILE_PATH_JSON = "service.json";\r
+ \r
+ /**\r
+ * the head type for Restful\r
+ */\r
+ public static final String HEAD_ERMAP_TYPE = "Content-Type";\r
+\r
+ /**\r
+ * the head value for Restful\r
+ */\r
+ public static final String HEAD_ERMAP_VALUE = "application/json;charset=UTF-8";\r
+ \r
+ /**\r
+ * the URL for Register service to the M-service Bus\r
+ */\r
+ public static final String M_BUS_REGISTER_URL = "/openoapi/microservices/v1/services";\r
+\r
+ /**\r
+ * the IP key for the service file\r
+ */\r
+ public static final String SERVICE_KEY_IP = "getInputIP";\r
\r
/**\r
- * Predefine parameter for service design\r
+ * constant:0\r
*/\r
- public static final String PREDEFINE_GSO_ID = "predefine_gsoId";\r
+ public static final int ZERO = 0;\r
\r
/**\r
* Constructor<br/>\r
* Package is being deleted.\r
*/\r
public static final String SVCMGR_PACKAGE_BEING_DELETED = "servicemgr.package.beingDelete";\r
+ \r
+ /**\r
+ * operation fail\r
+ */\r
+ public static final int FAIL = 3;\r
+\r
+ /**\r
+ * operation partial success\r
+ */\r
+ public static final int PARTIAL_SUCCESS = 1;\r
+ \r
+ /**\r
+ * operation success\r
+ */\r
+ public static final int SUCCESS = 0;\r
\r
/**\r
* Constructor<br/>\r
import javax.ws.rs.core.Response;\r
\r
import org.openo.baseservice.remoteservice.exception.ServiceException;\r
+import org.openo.baseservice.util.RestUtils;\r
+import org.openo.gso.gui.servicegateway.constant.Constant;\r
+import org.openo.gso.gui.servicegateway.exception.HttpCode;\r
import org.openo.gso.gui.servicegateway.roa.inf.IServiceGatewayRoaModule;\r
+import org.openo.gso.gui.servicegateway.service.impl.ServiceGatewayImpl;\r
import org.openo.gso.gui.servicegateway.service.inf.IServiceGateway;\r
+import org.openo.gso.gui.servicegateway.util.http.ResponseUtils;\r
+import org.openo.gso.gui.servicegateway.util.validate.ValidateUtil;\r
import org.slf4j.Logger;\r
import org.slf4j.LoggerFactory;\r
\r
/**\r
* Service manager.\r
*/\r
- private IServiceGateway serviceManager;\r
-\r
- /**\r
- * @return Returns the serviceManager.\r
- */\r
- public IServiceGateway getServiceGateway() {\r
- return serviceManager;\r
- }\r
-\r
- /**\r
- * @param serviceManager The serviceManager to set.\r
- */\r
- public void setServicemanager(IServiceGateway serviceManager) {\r
- this.serviceManager = serviceManager;\r
- }\r
+ private IServiceGateway serviceGateway = new ServiceGatewayImpl();\r
\r
/**\r
* Create service instance.<br/>\r
*/\r
@Override\r
public Response createService(HttpServletRequest servletReq) {\r
+ Map<String, Object> operateStatus = null;\r
Map<String, Object> result = null;\r
+ String serviceId = null;\r
+ try {\r
+ // 1. Check validation\r
+ String reqContent = RestUtils.getRequestBody(servletReq);\r
+ ValidateUtil.assertStringNotNull(reqContent);\r
+\r
+ // 2. Create service\r
+ serviceId = serviceGateway.createService(reqContent, servletReq);\r
+ } catch(ServiceException exception) {\r
+ LOGGER.error("Fail to create service instance.");\r
+ operateStatus = ResponseUtils.setOperateStatus(Constant.RESPONSE_STATUS_FAIL, exception,\r
+ String.valueOf(exception.getHttpCode())); \r
+ result = ResponseUtils.setResult(serviceId, operateStatus);\r
+\r
+ return Response.accepted().entity(result).build();\r
+ }\r
+\r
+ operateStatus = ResponseUtils.setOperateStatus(Constant.RESPONSE_STATUS_SUCCESS, null,\r
+ String.valueOf(HttpCode.RESPOND_OK));\r
+ result = ResponseUtils.setResult(serviceId, operateStatus);\r
\r
return Response.accepted().entity(result).build();\r
}\r
\r
package org.openo.gso.gui.servicegateway.service.impl;\r
\r
+import java.util.Map;\r
+\r
import javax.servlet.http.HttpServletRequest;\r
\r
+import org.apache.commons.lang.StringUtils;\r
import org.openo.baseservice.remoteservice.exception.ServiceException;\r
+import org.openo.baseservice.roa.util.restclient.RestfulFactory;\r
+import org.openo.baseservice.roa.util.restclient.RestfulParametes;\r
+import org.openo.baseservice.roa.util.restclient.RestfulResponse;\r
+import org.openo.gso.gui.servicegateway.constant.Constant;\r
import org.openo.gso.gui.servicegateway.service.inf.IServiceGateway;\r
+import org.openo.gso.gui.servicegateway.util.json.JsonUtil;\r
+import org.openo.gso.gui.servicegateway.util.validate.ValidateUtil;\r
import org.slf4j.Logger;\r
import org.slf4j.LoggerFactory;\r
\r
*/\r
@SuppressWarnings("unchecked")\r
@Override\r
- public Object createService(String reqContent, HttpServletRequest httpRequest) throws ServiceException {\r
+ public String createService(String reqContent, HttpServletRequest httpRequest) throws ServiceException {\r
+ // check the value\r
+ if(StringUtils.isEmpty(reqContent))\r
+ {\r
+ LOGGER.error("ServiceGatewayImpl createService reqContent is null.");\r
+ return null;\r
+ }\r
+ \r
+ // Parse request\r
+ Map<String, Object> requestBody = JsonUtil.unMarshal(reqContent, Map.class);\r
+ Map<String, Object> service = (Map<String, Object>)requestBody.get(Constant.SERVICE_INDENTIFY);\r
+ if(null == service)\r
+ {\r
+ service = requestBody;\r
+ }\r
+ ValidateUtil.assertObjectNotNull(requestBody);\r
+\r
+ // Validate data\r
+ String gatewayUri = (String)service.get(Constant.SERVICE_GATEWAY_URI);\r
+ ValidateUtil.assertStringNotNull(gatewayUri);\r
+ service.remove(Constant.SERVICE_GATEWAY_URI);\r
\r
+ // call the restful \r
+ String id = null;\r
+ try {\r
+ RestfulResponse restfulRsp = RestfulFactory.getRestInstance("http").post(gatewayUri,\r
+ getRestfulParameters(JsonUtil.marshal(requestBody)));\r
+ if (null != restfulRsp) {\r
+ // Record the result of registration\r
+ // (201:success;415:Invalid Parameter;500:Internal Server Error)\r
+ LOGGER.info("restful call result:", restfulRsp.getStatus());\r
+ id = restfulRsp.getRespHeaderStr(Constant.SERVICE_ID);\r
+ id = (null == id) ? restfulRsp.getRespHeaderStr(Constant.NS_INSTANCE_ID) : id;\r
+ id = (null == id) ? restfulRsp.getRespHeaderStr(Constant.JOB_ID) : id;\r
+ }\r
+ } catch(ServiceException e) {\r
+ LOGGER.error("service gateway create restful call result:", e);\r
+ throw e;\r
+ }\r
\r
- return null;\r
+ return id;\r
+ }\r
+ \r
+ /**\r
+ * get the parameters for restful<br/>\r
+ * \r
+ * @author\r
+ * @param bodyData\r
+ * Json Body\r
+ * @return the RestfulParametes Instance\r
+ * @since GSO 0.5, 2016-8-9\r
+ */\r
+ private static RestfulParametes getRestfulParameters(final String bodyData) {\r
+ RestfulParametes param = new RestfulParametes();\r
+ param.putHttpContextHeader(Constant.HEAD_ERMAP_TYPE, Constant.HEAD_ERMAP_VALUE);\r
+ param.setRawData(bodyData);\r
+ return param;\r
}\r
\r
/**\r
* @throws ServiceException when operate DB or parameter is wrong.\r
* @since GSO 0.5\r
*/\r
- Object createService(String reqContent, HttpServletRequest httpRequest) throws ServiceException;\r
+ String createService(String reqContent, HttpServletRequest httpRequest) throws ServiceException;\r
\r
/**\r
* Delete service instances.<br/>\r
\r
return result;\r
}\r
+ \r
+ /**\r
+ * Assemble operation result.<br/>\r
+ * \r
+ * @param objectId instance ID\r
+ * @param operateCode operation result\r
+ * @return Response result\r
+ * @since GSO 0.5\r
+ */\r
+ public static Map<String, Object> setResult(String objectId, Object operateCode) {\r
+ Map<String, Object> result = new HashMap<String, Object>();\r
+ result.put(Constant.RESPONSE_RESULT, operateCode);\r
+ String serviceId = (null != objectId) ? objectId : null;\r
+ result.put(Constant.SERVICE_INSTANCE_ID, serviceId);\r
+\r
+ return result;\r
+ }\r
}\r
--- /dev/null
+/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.openo.gso.gui.servicegateway.util.register;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+
+import org.apache.commons.lang.StringUtils;
+import org.openo.baseservice.remoteservice.exception.ServiceException;
+import org.openo.baseservice.roa.util.restclient.RestfulFactory;
+import org.openo.baseservice.roa.util.restclient.RestfulParametes;
+import org.openo.baseservice.roa.util.restclient.RestfulResponse;
+import org.openo.gso.commsvc.common.constant.Constant;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Register Tool <br/>
+ *
+ * @author
+ * @since GSO 0.5, 2016-8-9
+ */
+public class RegisterUtil {
+
+ /**
+ * Logger
+ */
+ private static final Logger LOGGER = LoggerFactory.getLogger(RegisterUtil.class);
+
+ private RegisterUtil() {
+ }
+
+ /**
+ * register the service to M-Bus by the parameter<br/>
+ *
+ * @author
+ * @param jsonInfo
+ * register body Data
+ * @since GSO 0.5, 2016-8-9
+ */
+ public static void registerService(final String jsonInfo) {
+ // check the parameter
+ if (StringUtils.isEmpty(jsonInfo)) {
+ LOGGER.error("RegisterUtil registerService jsonInfo is null");
+ return;
+ }
+
+ // replace the remote IP Address by the jsonInfo
+ String bodyData = jsonInfo;
+ boolean isIPExist = bodyData.indexOf(Constant.SERVICE_KEY_IP) > Constant.ZERO;
+ try {
+ // get the local IP address
+ String localIP = InetAddress.getLocalHost().getHostAddress();
+
+ // if the jsonInfo have the getInputIP string,start to replace the
+ // local IP
+ if (isIPExist) {
+ if (!StringUtils.isEmpty(localIP)) {
+ bodyData = bodyData.replace(Constant.SERVICE_KEY_IP, localIP);
+ } else {
+ LOGGER.error("RegisterUtil registerService localIP is null");
+ return;
+ }
+ }
+ } catch (UnknownHostException e) {
+ LOGGER.error("RegisterUtil registerService getHostAddress fail:", e);
+ if (isIPExist) {
+ // if get local IP failed In the isIPExist is true ,operation is
+ // stopped.
+ return;
+ }
+ }
+
+ // register the service to M-bus by the restful Interface
+ try {
+ RestfulResponse restfulRsp = RestfulFactory.getRestInstance("http").post(Constant.M_BUS_REGISTER_URL,
+ getRestfulParameters(bodyData));
+ if (null != restfulRsp) {
+ // Record the result of registration
+ // (201:success;415:Invalid Parameter;500:Internal Server Error)
+ LOGGER.info("RegisterUtil registerService register result:", restfulRsp.getStatus());
+ }
+ } catch (ServiceException e) {
+ LOGGER.error("RegisterUtil registerService post fail:", e);
+ }
+ }
+
+ /**
+ * get the parameters for restful<br/>
+ *
+ * @author
+ * @param bodyData
+ * Json Body
+ * @return the RestfulParametes Instance
+ * @since GSO 0.5, 2016-8-9
+ */
+ private static RestfulParametes getRestfulParameters(final String bodyData) {
+ RestfulParametes param = new RestfulParametes();
+ param.putHttpContextHeader(Constant.HEAD_ERMAP_TYPE, Constant.HEAD_ERMAP_VALUE);
+ param.setRawData(bodyData);
+ return param;
+ }
+
+ /**
+ * read the service file<br/>
+ *
+ * @param path
+ * the service File Path
+ * @return jsonString
+ * @since GSO 0.5, 2016-8-9
+ */
+ public static String readFile(String path) {
+ // check parameter
+ if (StringUtils.isEmpty(path)) {
+ return null;
+ }
+
+ File file = new File(path);
+ BufferedReader reader = null;
+ String laststr = "";
+ try {
+ reader = new BufferedReader(new FileReader(file));
+ String tempString = null;
+ // Read one line at a time until the end of the null file.
+ while ((tempString = reader.readLine()) != null) {
+ // add the line
+ laststr = laststr + tempString;
+ }
+ reader.close();
+ } catch (IOException e) {
+ LOGGER.error("GSO ReadFile fail.", e);
+ } finally {
+ if (reader != null) {
+ try {
+ reader.close();
+ } catch (IOException e1) {
+ LOGGER.error("GSO ReadFile reader close fail.", e1);
+ }
+ }
+ }
+ return laststr;
+ }
+}
--- /dev/null
+/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.openo.gso.gui.servicegateway.util.validate;
+
+import org.openo.baseservice.remoteservice.exception.ServiceException;
+import org.openo.gso.gui.servicegateway.exception.ErrorCode;
+import org.openo.gso.gui.servicegateway.exception.HttpCode;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.util.StringUtils;
+
+/**
+ * Validate Util <br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version GSO 0.5 2016/8/19
+ */
+public class ValidateUtil {
+
+ /**
+ * Log server.
+ */
+ private static final Logger LOGGER = LoggerFactory.getLogger(ValidateUtil.class);
+
+ /**
+ * Constructor<br/>
+ * <p>
+ * </p>
+ *
+ * @since GSO 0.5
+ */
+ private ValidateUtil() {
+
+ }
+
+ /**
+ * Assert String parameter.<br/>
+ *
+ * @param param parameter data
+ * @throws ServiceException when parameter is null or empty.
+ * @since GSO 0.5
+ */
+ public static void assertStringNotNull(String param) throws ServiceException {
+ if(StringUtils.hasLength(param)) {
+ return;
+ }
+
+ LOGGER.error("Parameter is null or empty.");
+ throw new ServiceException(ErrorCode.SVCMGR_SERVICEMGR_BAD_PARAM, HttpCode.BAD_REQUEST);
+ }
+
+ /**
+ * Assert object is null.<br/>
+ *
+ * @param object data object
+ * @throws ServiceException when object is null.
+ * @since GSO 0.5
+ */
+ public static void assertObjectNotNull(Object object) throws ServiceException {
+ if(null == object) {
+ LOGGER.error("Object is null.");
+ throw new ServiceException(ErrorCode.SVCMGR_SERVICEMGR_BAD_PARAM, "Object is null.");
+ }
+
+ }
+
+}
\r
package org.openo.gso.gui.servicegateway.roa.impl;\r
\r
-import static org.junit.Assert.assertNotNull;\r
-\r
+import java.io.File;\r
+import java.io.FileInputStream;\r
import java.io.IOException;\r
-import java.io.Reader;\r
-import java.sql.Connection;\r
import java.sql.SQLException;\r
\r
import javax.servlet.http.HttpServletRequest;\r
\r
-import org.apache.ibatis.io.Resources;\r
-import org.apache.ibatis.jdbc.ScriptRunner;\r
-import org.apache.ibatis.session.SqlSession;\r
-import org.apache.ibatis.session.SqlSessionFactory;\r
-import org.apache.ibatis.session.SqlSessionFactoryBuilder;\r
+import org.apache.commons.io.IOUtils;\r
+import org.apache.commons.lang.StringUtils;\r
import org.junit.After;\r
+import org.junit.Assert;\r
import org.junit.Before;\r
import org.junit.Test;\r
import org.openo.baseservice.remoteservice.exception.ServiceException;\r
+import org.openo.baseservice.roa.util.restclient.RestfulResponse;\r
+import org.openo.baseservice.util.RestUtils;\r
+import org.openo.gso.gui.servicegateway.exception.HttpCode;\r
import org.openo.gso.gui.servicegateway.service.impl.ServiceGatewayImpl;\r
+import org.openo.gso.gui.servicegateway.util.http.HttpUtil;\r
+\r
+import mockit.Mock;\r
+import mockit.MockUp;\r
\r
/**\r
* Test ServicemgrRoaModuleImpl class.<br/>\r
*/\r
public class ServiceGatewayRoaModuleImplTest {\r
\r
+ /**\r
+ * File path\r
+ */\r
+ private static final String FILE_PATH = "src/test/resources/json/";\r
+ \r
/**\r
* Service ROA.\r
*/\r
* Http request.\r
*/\r
HttpServletRequest httpRequest;\r
+ \r
+ /**\r
+ * Rest response.\r
+ */\r
+ RestfulResponse responseSuccess;\r
\r
/**\r
* Before executing UT, start sql.<br/>\r
*/\r
@Before\r
public void start() throws IOException, SQLException {\r
-\r
+ responseSuccess = new RestfulResponse();\r
+ responseSuccess.setStatus(HttpCode.RESPOND_OK);\r
}\r
\r
\r
*/\r
@Test\r
public void testCreateService() throws ServiceException {\r
+ // mock request body\r
+ mockGetRequestBody(FILE_PATH + "createServiceInstance.json");\r
+ \r
+ mockPost(responseSuccess);\r
\r
+ serviceRoa.createService(httpRequest);\r
}\r
\r
/**\r
* @since GSO 0.5\r
*/\r
@Test\r
- public void testTeleteService() throws ServiceException {\r
+ public void testDeleteService() throws ServiceException {\r
serviceRoa.deleteService("1", httpRequest);\r
}\r
\r
+ /**\r
+ * Mock to get request body.<br/>\r
+ * \r
+ * @param file json file path.\r
+ * @since GSO 0.5\r
+ */\r
+ private void mockGetRequestBody(final String file) {\r
+ new MockUp<RestUtils>() {\r
+\r
+ @Mock\r
+ public String getRequestBody(HttpServletRequest request) {\r
+ return getJsonString(file);\r
+ }\r
+ };\r
+ }\r
+ \r
+ /**\r
+ * Mock rest request for post.<br/>\r
+ * \r
+ * @param response rest response\r
+ * @since GSO 0.5\r
+ */\r
+ private void mockPost(final RestfulResponse response) {\r
+ new MockUp<HttpUtil>() {\r
+\r
+ @Mock\r
+ public RestfulResponse post(final String url, Object sendObj, HttpServletRequest httpRequest) {\r
+ return response;\r
+ }\r
+ };\r
+ }\r
+ \r
+ /**\r
+ * Get json string from file.<br/>\r
+ * \r
+ * @param file the path of file\r
+ * @return json string\r
+ * @throws IOException when fail to read\r
+ * @since GSO 0.5\r
+ */\r
+ private String getJsonString(final String file) {\r
+ if(StringUtils.isEmpty(file)) {\r
+ return "";\r
+ }\r
+\r
+ String json = null;\r
+ try {\r
+ FileInputStream fileStream = new FileInputStream(new File(file));\r
+ json = IOUtils.toString(fileStream);\r
+ } catch(Exception e) {\r
+ Assert.fail(e.getMessage());\r
+ }\r
+\r
+ return json;\r
+ }\r
}\r
*/\r
ServiceGatewayImpl serviceManager = new ServiceGatewayImpl();\r
\r
-\r
/**\r
* Http request.\r
*/\r
--- /dev/null
+{
+ "name": "gso_service",
+ "description": "siteToDc",
+ "serviceDefId": "78ede6f3-66cc-46ab-b748-38a6c010d272",
+ "templateId": "38a6c01-66cc-46ab-b748-38a6c010d272",
+ "templateName": "GsoTemplate",
+ "gatewayUri":"/openoapi/lifecyclymgr/v1/services",
+ "parameters": {
+ "POP.vFW-moc": "xxx",
+ "POP.vCPE-moc": "xxx"
+ }
+}
\ No newline at end of file