diff options
author | sebdet <sd378r@intl.att.com> | 2018-09-20 18:27:17 +0200 |
---|---|---|
committer | sebdet <sd378r@intl.att.com> | 2018-09-20 18:27:17 +0200 |
commit | 57ea28b4de97b23a52254e9632e32c26652ef67d (patch) | |
tree | 1a1d6c17c7a4f2f57d14cef4828b7c0d020b2927 /src/main/java | |
parent | a9cdc79ba7e928b38ed132d38426b6c8b70635bf (diff) |
Add tests
Add some tests and fix event for Submit action
Issue-ID: CLAMP-217
Change-Id: I1882a35da110130529085fad5524e82a509cd7e1
Signed-off-by: sebdet <sd378r@intl.att.com>
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/org/onap/clamp/clds/model/CldsModel.java | 174 | ||||
-rw-r--r-- | src/main/java/org/onap/clamp/clds/service/CldsService.java | 70 |
2 files changed, 127 insertions, 117 deletions
diff --git a/src/main/java/org/onap/clamp/clds/model/CldsModel.java b/src/main/java/org/onap/clamp/clds/model/CldsModel.java index 55f4dfd64..d7228cfcf 100644 --- a/src/main/java/org/onap/clamp/clds/model/CldsModel.java +++ b/src/main/java/org/onap/clamp/clds/model/CldsModel.java @@ -18,7 +18,7 @@ * limitations under the License. * ============LICENSE_END============================================ * =================================================================== - * + * */ package org.onap.clamp.clds.model; @@ -45,13 +45,13 @@ public class CldsModel { private static final EELFLogger logger = EELFManager.getInstance().getLogger(CldsModel.class); private static final int UUID_LENGTH = 36; - private static final String STATUS_DESIGN = "DESIGN"; - private static final String STATUS_DISTRIBUTED = "DISTRIBUTED"; - private static final String STATUS_ACTIVE = "ACTIVE"; - private static final String STATUS_STOPPED = "STOPPED"; - private static final String STATUS_DELETING = "DELETING"; - private static final String STATUS_ERROR = "ERROR"; - private static final String STATUS_UNKNOWN = "UNKNOWN"; + public static final String STATUS_DESIGN = "DESIGN"; + public static final String STATUS_DISTRIBUTED = "DISTRIBUTED"; + public static final String STATUS_ACTIVE = "ACTIVE"; + public static final String STATUS_STOPPED = "STOPPED"; + public static final String STATUS_DELETING = "DELETING"; + public static final String STATUS_ERROR = "ERROR"; + public static final String STATUS_UNKNOWN = "UNKNOWN"; private String id; private String templateId; private String templateName; @@ -99,7 +99,7 @@ public class CldsModel { boolean canCall = false; /* Below checks the clds event is submit/resubmit/distribute */ if (event.isActionCd(CldsEvent.ACTION_SUBMIT) || event.isActionCd(CldsEvent.ACTION_RESUBMIT) - || event.isActionCd(CldsEvent.ACTION_DISTRIBUTE) || event.isActionCd(CldsEvent.ACTION_SUBMITDCAE)) { + || event.isActionCd(CldsEvent.ACTION_DISTRIBUTE) || event.isActionCd(CldsEvent.ACTION_SUBMITDCAE)) { canCall = true; } return canCall; @@ -125,22 +125,22 @@ public class CldsModel { } else if (event.isActionStateCd(CldsEvent.ACTION_STATE_ERROR)) { status = STATUS_ERROR; } else if (event.isActionAndStateCd(CldsEvent.ACTION_CREATE, CldsEvent.ACTION_STATE_ANY) - || event.isActionAndStateCd(CldsEvent.ACTION_SUBMIT, CldsEvent.ACTION_STATE_ANY) - || event.isActionAndStateCd(CldsEvent.ACTION_RESUBMIT, CldsEvent.ACTION_STATE_ANY) - || event.isActionAndStateCd(CldsEvent.ACTION_SUBMITDCAE, CldsEvent.ACTION_STATE_ANY) - || event.isActionAndStateCd(CldsEvent.ACTION_DELETE, CldsEvent.ACTION_STATE_RECEIVED) - || event.isActionAndStateCd(CldsEvent.ACTION_MODIFY, CldsEvent.ACTION_STATE_ANY)) { + || event.isActionAndStateCd(CldsEvent.ACTION_SUBMIT, CldsEvent.ACTION_STATE_ANY) + || event.isActionAndStateCd(CldsEvent.ACTION_RESUBMIT, CldsEvent.ACTION_STATE_ANY) + || event.isActionAndStateCd(CldsEvent.ACTION_SUBMITDCAE, CldsEvent.ACTION_STATE_ANY) + || event.isActionAndStateCd(CldsEvent.ACTION_DELETE, CldsEvent.ACTION_STATE_RECEIVED) + || event.isActionAndStateCd(CldsEvent.ACTION_MODIFY, CldsEvent.ACTION_STATE_ANY)) { status = STATUS_DESIGN; } else if (event.isActionAndStateCd(CldsEvent.ACTION_DISTRIBUTE, CldsEvent.ACTION_STATE_RECEIVED) - || event.isActionAndStateCd(CldsEvent.ACTION_UNDEPLOY, CldsEvent.ACTION_STATE_RECEIVED)) { + || event.isActionAndStateCd(CldsEvent.ACTION_UNDEPLOY, CldsEvent.ACTION_STATE_RECEIVED)) { status = STATUS_DISTRIBUTED; } else if (event.isActionAndStateCd(CldsEvent.ACTION_DELETE, CldsEvent.ACTION_STATE_SENT)) { status = STATUS_DELETING; } else if (event.isActionAndStateCd(CldsEvent.ACTION_DEPLOY, CldsEvent.ACTION_STATE_RECEIVED) - || event.isActionAndStateCd(CldsEvent.ACTION_RESTART, CldsEvent.ACTION_STATE_ANY) - || event.isActionAndStateCd(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_STATE_ANY) - || event.isActionAndStateCd(CldsEvent.ACTION_DEPLOY, CldsEvent.ACTION_STATE_ANY) - || event.isActionAndStateCd(CldsEvent.ACTION_SUBMITPOLICY, CldsEvent.ACTION_STATE_ANY)) { + || event.isActionAndStateCd(CldsEvent.ACTION_RESTART, CldsEvent.ACTION_STATE_ANY) + || event.isActionAndStateCd(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_STATE_ANY) + || event.isActionAndStateCd(CldsEvent.ACTION_DEPLOY, CldsEvent.ACTION_STATE_ANY) + || event.isActionAndStateCd(CldsEvent.ACTION_SUBMITPOLICY, CldsEvent.ACTION_STATE_ANY)) { status = STATUS_ACTIVE; } else if (event.isActionAndStateCd(CldsEvent.ACTION_STOP, CldsEvent.ACTION_STATE_ANY)) { status = STATUS_STOPPED; @@ -182,69 +182,69 @@ public class CldsModel { private void determinePermittedActionCd() { String actionCd = getCurrentActionCd(); switch (actionCd) { - case CldsEvent.ACTION_CREATE: - permittedActionCd = Arrays.asList(CldsEvent.ACTION_SUBMIT, CldsEvent.ACTION_TEST, - CldsEvent.ACTION_DELETE); - if (isSimplifiedModel()) { - permittedActionCd = Arrays.asList(CldsEvent.ACTION_SUBMITDCAE, CldsEvent.ACTION_SUBMITPOLICY, - CldsEvent.ACTION_TEST, CldsEvent.ACTION_DELETE); - } - break; - case CldsEvent.ACTION_MODIFY: - permittedActionCd = Arrays.asList(CldsEvent.ACTION_RESUBMIT, CldsEvent.ACTION_DELETE); - if (isSimplifiedModel()) { - permittedActionCd = Arrays.asList(CldsEvent.ACTION_SUBMITDCAE, CldsEvent.ACTION_SUBMITPOLICY, - CldsEvent.ACTION_DELETE); - } - break; - case CldsEvent.ACTION_SUBMIT: - case CldsEvent.ACTION_RESUBMIT: - permittedActionCd = Arrays.asList(CldsEvent.ACTION_RESUBMIT, CldsEvent.ACTION_DELETE); - break; - case CldsEvent.ACTION_SUBMITDCAE: - permittedActionCd = Arrays.asList(CldsEvent.ACTION_SUBMITDCAE, CldsEvent.ACTION_DELETE); - break; - case CldsEvent.ACTION_SUBMITPOLICY: - permittedActionCd = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_STOP); - break; - case CldsEvent.ACTION_DISTRIBUTE: - permittedActionCd = Arrays.asList(CldsEvent.ACTION_DEPLOY, CldsEvent.ACTION_RESUBMIT, - CldsEvent.ACTION_DELETE); - if (isSimplifiedModel()) { - permittedActionCd = Arrays.asList(CldsEvent.ACTION_DEPLOY, CldsEvent.ACTION_SUBMITDCAE, - CldsEvent.ACTION_DELETE); - } - break; - case CldsEvent.ACTION_UNDEPLOY: + case CldsEvent.ACTION_CREATE: + permittedActionCd = Arrays.asList(CldsEvent.ACTION_SUBMIT, CldsEvent.ACTION_TEST, + CldsEvent.ACTION_DELETE); + if (isSimplifiedModel()) { + permittedActionCd = Arrays.asList(CldsEvent.ACTION_SUBMITDCAE, CldsEvent.ACTION_SUBMITPOLICY, + CldsEvent.ACTION_TEST, CldsEvent.ACTION_DELETE); + } + break; + case CldsEvent.ACTION_MODIFY: + permittedActionCd = Arrays.asList(CldsEvent.ACTION_RESUBMIT, CldsEvent.ACTION_DELETE); + if (isSimplifiedModel()) { + permittedActionCd = Arrays.asList(CldsEvent.ACTION_SUBMITDCAE, CldsEvent.ACTION_SUBMITPOLICY, + CldsEvent.ACTION_DELETE); + } + break; + case CldsEvent.ACTION_SUBMIT: + case CldsEvent.ACTION_RESUBMIT: + permittedActionCd = Arrays.asList(CldsEvent.ACTION_RESUBMIT, CldsEvent.ACTION_DELETE); + break; + case CldsEvent.ACTION_SUBMITDCAE: + permittedActionCd = Arrays.asList(CldsEvent.ACTION_SUBMITDCAE, CldsEvent.ACTION_DELETE); + break; + case CldsEvent.ACTION_SUBMITPOLICY: + permittedActionCd = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_STOP); + break; + case CldsEvent.ACTION_DISTRIBUTE: + permittedActionCd = Arrays.asList(CldsEvent.ACTION_DEPLOY, CldsEvent.ACTION_RESUBMIT, + CldsEvent.ACTION_DELETE); + if (isSimplifiedModel()) { + permittedActionCd = Arrays.asList(CldsEvent.ACTION_DEPLOY, CldsEvent.ACTION_SUBMITDCAE, + CldsEvent.ACTION_DELETE); + } + break; + case CldsEvent.ACTION_UNDEPLOY: + permittedActionCd = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_DEPLOY, + CldsEvent.ACTION_RESUBMIT, CldsEvent.ACTION_DELETE); + if (isSimplifiedModel()) { permittedActionCd = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_DEPLOY, - CldsEvent.ACTION_RESUBMIT, CldsEvent.ACTION_DELETE); - if (isSimplifiedModel()) { - permittedActionCd = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_DEPLOY, - CldsEvent.ACTION_SUBMITDCAE, CldsEvent.ACTION_DELETE); - } - break; - case CldsEvent.ACTION_DEPLOY: - permittedActionCd = Arrays.asList(CldsEvent.ACTION_DEPLOY, CldsEvent.ACTION_UNDEPLOY, - CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_STOP); - break; - case CldsEvent.ACTION_RESTART: - case CldsEvent.ACTION_UPDATE: - permittedActionCd = Arrays.asList(CldsEvent.ACTION_DEPLOY, CldsEvent.ACTION_UPDATE, - CldsEvent.ACTION_STOP, CldsEvent.ACTION_UNDEPLOY); - if (isPolicyOnly()) { - permittedActionCd = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_STOP); - } - break; - case CldsEvent.ACTION_STOP: + CldsEvent.ACTION_SUBMITDCAE, CldsEvent.ACTION_DELETE); + } + break; + case CldsEvent.ACTION_DEPLOY: + permittedActionCd = Arrays.asList(CldsEvent.ACTION_DEPLOY, CldsEvent.ACTION_UNDEPLOY, + CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_STOP); + break; + case CldsEvent.ACTION_RESTART: + case CldsEvent.ACTION_UPDATE: + permittedActionCd = Arrays.asList(CldsEvent.ACTION_DEPLOY, CldsEvent.ACTION_UPDATE, + CldsEvent.ACTION_STOP, CldsEvent.ACTION_UNDEPLOY); + if (isPolicyOnly()) { + permittedActionCd = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_STOP); + } + break; + case CldsEvent.ACTION_STOP: + permittedActionCd = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_RESTART, + CldsEvent.ACTION_UNDEPLOY); + if (isPolicyOnly()) { permittedActionCd = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_RESTART, - CldsEvent.ACTION_UNDEPLOY); - if (isPolicyOnly()) { - permittedActionCd = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_RESTART, - CldsEvent.ACTION_DELETE); - } - break; - default: - logger.warn("Invalid current actionCd: " + actionCd); + CldsEvent.ACTION_DELETE); + } + break; + default: + logger.warn("Invalid current actionCd: " + actionCd); } } @@ -289,8 +289,8 @@ public class CldsModel { determinePermittedActionCd(); if (!permittedActionCd.contains(requestedActionCd)) { throw new IllegalArgumentException( - "Invalid requestedActionCd: " + requestedActionCd + ". Given current actionCd: " - + getCurrentActionCd() + ", the permittedActionCd: " + permittedActionCd); + "Invalid requestedActionCd: " + requestedActionCd + ". Given current actionCd: " + + getCurrentActionCd() + ", the permittedActionCd: " + permittedActionCd); } } @@ -303,8 +303,8 @@ public class CldsModel { public static CldsModel createUsingControlName(String fullControlName) { if (fullControlName == null || fullControlName.length() < UUID_LENGTH) { throw new BadRequestException( - "closed loop id / control name length, " + (fullControlName != null ? fullControlName.length() : 0) - + ", less than the minimum of: " + UUID_LENGTH); + "closed loop id / control name length, " + (fullControlName != null ? fullControlName.length() : 0) + + ", less than the minimum of: " + UUID_LENGTH); } CldsModel model = new CldsModel(); model.setControlNamePrefix(fullControlName.substring(0, fullControlName.length() - UUID_LENGTH)); @@ -328,10 +328,10 @@ public class CldsModel { cldsModel = cldsDao.getModelByUuid(cldsModel.getControlNameUuid()); cldsModel.determineStatus(); if (dcaeEvent.getCldsActionCd().equals(CldsEvent.ACTION_UNDEPLOY) || (dcaeEvent.getCldsActionCd() - .equals(CldsEvent.ACTION_DEPLOY) - && (cldsModel.getStatus().equals(STATUS_DISTRIBUTED) || cldsModel.getStatus().equals(STATUS_DESIGN)))) { + .equals(CldsEvent.ACTION_DEPLOY) + && (cldsModel.getStatus().equals(STATUS_DISTRIBUTED) || cldsModel.getStatus().equals(STATUS_DESIGN)))) { CldsEvent.insEvent(cldsDao, dcaeEvent.getControlName(), userid, dcaeEvent.getCldsActionCd(), - CldsEvent.ACTION_STATE_RECEIVED, null); + CldsEvent.ACTION_STATE_RECEIVED, null); } cldsDao.insModelInstance(cldsModel, dcaeEvent.getInstances()); return cldsModel; diff --git a/src/main/java/org/onap/clamp/clds/service/CldsService.java b/src/main/java/org/onap/clamp/clds/service/CldsService.java index 243881f67..5e35b8954 100644 --- a/src/main/java/org/onap/clamp/clds/service/CldsService.java +++ b/src/main/java/org/onap/clamp/clds/service/CldsService.java @@ -118,6 +118,7 @@ public class CldsService extends SecureServiceBase { @Autowired private HttpServletRequest request; + @Autowired public CldsService(CldsDao cldsDao, XslTransformer cldsBpmnTransformer, ClampProperties refProp, SdcCatalogServices sdcCatalogServices, DcaeDispatcherServices dcaeDispatcherServices, @@ -127,7 +128,7 @@ public class CldsService extends SecureServiceBase { @Value("${clamp.config.security.permission.type.cl.event:permission-type-cl-event}") String cldsPermissionTypeClEvent, @Value("${clamp.config.security.permission.type.filter.vf:permission-type-filter-vf}") String cldsPermissionTypeFilterVf, @Value("${clamp.config.security.permission.type.template:permission-type-template}") String cldsPermissionTypeTemplate, - @Value("${clamp.config.security.permission.type.tosca:permission-type-tosca}") String cldsPermissionTypeTosca, + @Value("${clamp.config.security.permission.type.tosca:permission-type-tosca}") String cldsPermissionTypeTosca, @Value("${clamp.config.security.permission.instance:dev}") String cldsPermissionInstance) { this.cldsDao = cldsDao; this.cldsBpmnTransformer = cldsBpmnTransformer; @@ -149,7 +150,7 @@ public class CldsService extends SecureServiceBase { "update"); permissionReadTosca = SecureServicePermission.create(cldsPermissionTypeTosca, cldsPermissionInstance, "read"); permissionUpdateTosca = SecureServicePermission.create(cldsPermissionTypeTosca, cldsPermissionInstance, - "update"); + "update"); } /* @@ -222,7 +223,7 @@ public class CldsService extends SecureServiceBase { * @return image xml text - content of image given name */ public String getImageXml(String modelName) { - util.entering(request, "CldsService: GET model image"); + util.entering(request, "CldsService: GET model image"); Date startTime = new Date(); isAuthorized(permissionReadCl); logger.info("GET imageText for modelName={}", modelName); @@ -241,7 +242,7 @@ public class CldsService extends SecureServiceBase { * @return clds model - clds model for the given model name */ public CldsModel getModel(String modelName) { - util.entering(request, "CldsService: GET model"); + util.entering(request, "CldsService: GET model"); Date startTime = new Date(); isAuthorized(permissionReadCl); logger.debug("GET model for modelName={}", modelName); @@ -270,7 +271,7 @@ public class CldsService extends SecureServiceBase { * @param modelName */ public CldsModel putModel(String modelName, CldsModel cldsModel) { - util.entering(request, "CldsService: PUT model"); + util.entering(request, "CldsService: PUT model"); Date startTime = new Date(); isAuthorized(permissionUpdateCl); isAuthorizedForVf(cldsModel); @@ -339,9 +340,8 @@ public class CldsService extends SecureServiceBase { * @throws DecoderException * In case of issues with the Hex String decoding */ - public ResponseEntity<?> putModelAndProcessAction(String action, - String modelName,String test, CldsModel model) - throws TransformerException, ParseException { + public ResponseEntity<?> putModelAndProcessAction(String action, String modelName, String test, CldsModel model) + throws TransformerException, ParseException { util.entering(request, "CldsService: Process model action"); Date startTime = new Date(); CldsModel retrievedModel = null; @@ -364,7 +364,7 @@ public class CldsService extends SecureServiceBase { this.fillInCldsModel(model); // save model to db model.setName(modelName); - updateAndInsertNewEvent(modelName, model.getControlNamePrefix(), model.getEvent(), CldsEvent.ACTION_MODIFY); + updateAndInsertNewEvent(modelName, model.getControlNamePrefix(), model.getEvent(), CldsEvent.ACTION_SUBMIT); model.save(cldsDao, getUserId()); // get vars and format if necessary String prop = model.getPropText(); @@ -376,10 +376,10 @@ public class CldsService extends SecureServiceBase { // Flag indicates whether it is triggered by Validation Test button // from // UI - boolean isTest = Boolean.valueOf(test); + boolean isTest = Boolean.parseBoolean(test); if (!isTest) { String actionTestOverride = refProp.getStringValue("action.test.override"); - if (Boolean.valueOf(actionTestOverride)) { + if (Boolean.parseBoolean(actionTestOverride)) { logger.info("PUT actionTestOverride={}", actionTestOverride); logger.info("PUT override test indicator and setting it to true"); isTest = true; @@ -387,7 +387,7 @@ public class CldsService extends SecureServiceBase { } logger.info("PUT isTest={}", isTest); String insertTestEvent = refProp.getStringValue("action.insert.test.event"); - boolean isInsertTestEvent = Boolean.valueOf(insertTestEvent); + boolean isInsertTestEvent = Boolean.parseBoolean(insertTestEvent); logger.info("PUT isInsertTestEvent={}", isInsertTestEvent); // determine if requested action is permitted @@ -407,12 +407,14 @@ public class CldsService extends SecureServiceBase { retrievedModel = CldsModel.retrieve(cldsDao, modelName, false); } if (retrievedModel != null) { - if (!isTest && !errorCase && (actionCd.equalsIgnoreCase(CldsEvent.ACTION_SUBMIT) - || actionCd.equalsIgnoreCase(CldsEvent.ACTION_RESUBMIT) - || actionCd.equalsIgnoreCase(CldsEvent.ACTION_SUBMITDCAE))) { + if (!isTest && !errorCase + && (actionCd.equalsIgnoreCase(CldsEvent.ACTION_SUBMIT) + || actionCd.equalsIgnoreCase(CldsEvent.ACTION_RESUBMIT) + || actionCd.equalsIgnoreCase(CldsEvent.ACTION_SUBMITDCAE))) { if (retrievedModel.getTemplateName().startsWith(CsarInstallerImpl.TEMPLATE_NAME_PREFIX)) { // SDC artifact case - logger.info("Skipping DCAE inventory call as closed loop has been created from SDC notification"); + logger + .info("Skipping DCAE inventory call as closed loop has been created from SDC notification"); DcaeEvent dcaeEvent = new DcaeEvent(); dcaeEvent.setArtifactName(retrievedModel.getControlName() + ".yml"); dcaeEvent.setEvent(DcaeEvent.EVENT_DISTRIBUTION); @@ -432,15 +434,19 @@ public class CldsService extends SecureServiceBase { auditLogger.info("Process model action completed"); } else { logger.error("CldsModel not found in database with modelName: " + modelName); - util.exiting(HttpStatus.INTERNAL_SERVER_ERROR.toString(), "CldsModel not found in database with modelName " + "modelName", Level.INFO, ONAPLogConstants.ResponseStatus.ERROR); - return new ResponseEntity<String>("CldsModel not found in database with modelName: \" + modelName", HttpStatus.INTERNAL_SERVER_ERROR); + util.exiting(HttpStatus.INTERNAL_SERVER_ERROR.toString(), + "CldsModel not found in database with modelName " + "modelName", Level.INFO, + ONAPLogConstants.ResponseStatus.ERROR); + return new ResponseEntity<String>("CldsModel not found in database with modelName: \" + modelName", + HttpStatus.INTERNAL_SERVER_ERROR); } } catch (Exception e) { errorCase = true; logger.error("Exception occured during putModelAndProcessAction", e); } if (errorCase) { - util.exiting(HttpStatus.INTERNAL_SERVER_ERROR.toString(), "putModelAndProcessAction failed", Level.INFO, ONAPLogConstants.ResponseStatus.ERROR); + util.exiting(HttpStatus.INTERNAL_SERVER_ERROR.toString(), "putModelAndProcessAction failed", Level.INFO, + ONAPLogConstants.ResponseStatus.ERROR); return new ResponseEntity<>(retrievedModel, HttpStatus.INTERNAL_SERVER_ERROR); } util.exiting(HttpStatus.OK.toString(), "Successful", Level.INFO, ONAPLogConstants.ResponseStatus.COMPLETED); @@ -467,7 +473,7 @@ public class CldsService extends SecureServiceBase { } // Flag indicates whether it is triggered by Validation Test button from // UI - boolean isTest = Boolean.valueOf(test); + boolean isTest = Boolean.parseBoolean(test); int instanceCount = 0; if (dcaeEvent.getInstances() != null) { instanceCount = dcaeEvent.getInstances().size(); @@ -540,9 +546,8 @@ public class CldsService extends SecureServiceBase { * @throws IOException * In case of issue to convert CldsServiceCache to InputStream */ - public String getSdcPropertiesByServiceUUIDForRefresh( - String serviceInvariantUUID, Boolean refresh) - throws GeneralSecurityException, DecoderException, IOException { + public String getSdcPropertiesByServiceUUIDForRefresh(String serviceInvariantUUID, Boolean refresh) + throws GeneralSecurityException, DecoderException, IOException { util.entering(request, "CldsService: GET sdc properties by uuid"); Date startTime = new Date(); CldsServiceData cldsServiceData = new CldsServiceData(); @@ -561,7 +566,8 @@ public class CldsService extends SecureServiceBase { // audit log LoggingUtils.setTimeContext(startTime, new Date()); auditLogger.info("GET sdc properties by uuid completed"); - util.exiting("200", "Get sdc properties by uuid success", Level.INFO, ONAPLogConstants.ResponseStatus.COMPLETED); + util.exiting("200", "Get sdc properties by uuid success", Level.INFO, + ONAPLogConstants.ResponseStatus.COMPLETED); return sdcProperties; } @@ -774,7 +780,8 @@ public class CldsService extends SecureServiceBase { model.save(cldsDao, getUserId()); } else { logger.info("Deploy model (" + modelName + ") failed...Operation Status is - " + operationStatus); - util.exiting(HttpStatus.INTERNAL_SERVER_ERROR.toString(), "DeployModel failed", Level.INFO, ONAPLogConstants.ResponseStatus.ERROR); + util.exiting(HttpStatus.INTERNAL_SERVER_ERROR.toString(), "DeployModel failed", Level.INFO, + ONAPLogConstants.ResponseStatus.ERROR); throw new HttpClientErrorException(HttpStatus.INTERNAL_SERVER_ERROR, "Deploy model (" + modelName + ") failed...Operation Status is - " + operationStatus); } @@ -787,7 +794,8 @@ public class CldsService extends SecureServiceBase { logger.error("Exception occured during deployModel", e); } if (errorCase) { - util.exiting(HttpStatus.INTERNAL_SERVER_ERROR.toString(), "DeployModel failed", Level.INFO, ONAPLogConstants.ResponseStatus.ERROR); + util.exiting(HttpStatus.INTERNAL_SERVER_ERROR.toString(), "DeployModel failed", Level.INFO, + ONAPLogConstants.ResponseStatus.ERROR); return new ResponseEntity<>(model, HttpStatus.INTERNAL_SERVER_ERROR); } util.exiting(HttpStatus.OK.toString(), "Successful", Level.INFO, ONAPLogConstants.ResponseStatus.COMPLETED); @@ -821,7 +829,8 @@ public class CldsService extends SecureServiceBase { model.save(cldsDao, getUserId()); } else { logger.info("Undeploy model (" + modelName + ") failed...Operation Status is - " + operationStatus); - util.exiting(HttpStatus.INTERNAL_SERVER_ERROR.toString(), "UndeployModel failed", Level.INFO, ONAPLogConstants.ResponseStatus.ERROR); + util.exiting(HttpStatus.INTERNAL_SERVER_ERROR.toString(), "UndeployModel failed", Level.INFO, + ONAPLogConstants.ResponseStatus.ERROR); throw new HttpClientErrorException(HttpStatus.INTERNAL_SERVER_ERROR, "Undeploy model (" + modelName + ") failed...Operation Status is - " + operationStatus); } @@ -834,7 +843,8 @@ public class CldsService extends SecureServiceBase { logger.error("Exception occured during unDeployModel", e); } if (errorCase) { - util.exiting(HttpStatus.INTERNAL_SERVER_ERROR.toString(), "UndeployModel failed", Level.INFO, ONAPLogConstants.ResponseStatus.ERROR); + util.exiting(HttpStatus.INTERNAL_SERVER_ERROR.toString(), "UndeployModel failed", Level.INFO, + ONAPLogConstants.ResponseStatus.ERROR); return new ResponseEntity<>(model, HttpStatus.INTERNAL_SERVER_ERROR); } util.exiting(HttpStatus.OK.toString(), "Successful", Level.INFO, ONAPLogConstants.ResponseStatus.COMPLETED); @@ -879,7 +889,7 @@ public class CldsService extends SecureServiceBase { } // Created for the integration test - public void setLoggingUtil (LoggingUtils utilP) { - util = utilP; + public void setLoggingUtil(LoggingUtils utilP) { + util = utilP; } }
\ No newline at end of file |