\r
import com.att.eelf.configuration.EELFLogger;\r
import com.att.eelf.configuration.EELFManager;\r
+import com.fasterxml.jackson.databind.node.ObjectNode;\r
\r
import java.io.BufferedReader;\r
import java.io.DataOutputStream;\r
if (inStream != null) {\r
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inStream));\r
String inputLine = null;\r
- StringBuffer response = new StringBuffer();\r
+ StringBuilder response = new StringBuilder();\r
while ((inputLine = bufferedReader.readLine()) != null) {\r
response.append(inputLine);\r
}\r
responseStr = response.toString();\r
}\r
\r
- if (responseStr != null) {\r
- if (requestFailed) {\r
- logger.error("requestFailed - responseStr=" + responseStr);\r
- throw new BadRequestException(responseStr);\r
- }\r
+ if (responseStr != null && requestFailed) {\r
+ logger.error("requestFailed - responseStr=" + responseStr);\r
+ throw new BadRequestException(responseStr);\r
}\r
\r
logger.debug("response code " + responseCode);\r
Date startTime = new Date();\r
LoggingUtils.setTargetContext("DCAE", "createNewDeployment");\r
try {\r
- String apiBodyString = "{\"serviceTypeId\": \"" + serviceTypeId + "\"}";\r
+ ObjectNode rootNode = (ObjectNode) refProp.getJsonTemplate("dcae.deployment.template");\r
+ ((ObjectNode) rootNode).put("serviceTypeId", serviceTypeId);\r
+ String apiBodyString = rootNode.toString();\r
+\r
logger.info("Dcae api Body String - " + apiBodyString);\r
String url = refProp.getStringValue("DCAE_DISPATCHER_URL") + "/dcae-deployments/" + deploymentId;\r
logger.info("Dcae Dispatcher Service url - " + url);\r
\r
String inputLine = null;\r
\r
- StringBuffer response = new StringBuffer();\r
+ StringBuilder response = new StringBuilder();\r
\r
while ((inputLine = in.readLine()) != null) {\r
response.append(inputLine);\r
responseStr = response.toString();\r
}\r
\r
- if (responseStr != null) {\r
- if (requestFailed) {\r
- logger.error("requestFailed - responseStr=" + responseStr);\r
- throw new BadRequestException(responseStr);\r
- }\r
+ if (responseStr != null && requestFailed) {\r
+ logger.error("requestFailed - responseStr=" + responseStr);\r
+ throw new BadRequestException(responseStr);\r
}\r
\r
logger.debug("response code " + responseCode);\r