From f319e58261ac33b4c08d72b428ee3a9b8da82e79 Mon Sep 17 00:00:00 2001 From: "Determe, Sebastien (sd378r)" Date: Wed, 21 Mar 2018 14:59:15 +0100 Subject: [PATCH] Remove the test flag Remove test flag from deploy and undeploy. Also remove useless variable definition Issue-ID: CLAMP-141 Change-Id: I49bd3e88b9a37d891fce243dbadb9a5f890c06cf Signed-off-by: Determe, Sebastien (sd378r) --- ...clds-policy-config-third_party_proxy.properties | 37 ----------- .../org/onap/clamp/clds/service/CldsService.java | 72 ++++++++++++++++++++++ 2 files changed, 72 insertions(+), 37 deletions(-) delete mode 100644 extra/docker/clamp/config/clds-policy-config-third_party_proxy.properties diff --git a/extra/docker/clamp/config/clds-policy-config-third_party_proxy.properties b/extra/docker/clamp/config/clds-policy-config-third_party_proxy.properties deleted file mode 100644 index 58a89f4d..00000000 --- a/extra/docker/clamp/config/clds-policy-config-third_party_proxy.properties +++ /dev/null @@ -1,37 +0,0 @@ -### -# ============LICENSE_START======================================================= -# ONAP CLAMP -# ================================================================================ -# Copyright (C) 2017 AT&T Intellectual Property. All rights -# reserved. -# ================================================================================ -# 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. -# ============LICENSE_END============================================ -# =================================================================== -# ECOMP is a trademark and service mark of AT&T Intellectual Property. -### - -# Configuration Settings for Policy Engine Components -PDP_URL1=http://third_party_proxy:8085/pdp/ , testpdp, alpha123 -PDP_URL2=http://third_party_proxy:8085/pdp/ , testpdp, alpha123 -NOTIFICATION_TYPE=websocket -NOTIFICATION_UEB_SERVERS=localhost -NOTIFICATION_TOPIC= -CLIENT_ID=python -# base64 encoding -#CLIENT_KEY=ChlakDuk -CLIENT_KEY=dGVzdA== -#DEVL for development -#TEST for Test environments -#PROD for prod environments -ENVIRONMENT=TEST \ No newline at end of file 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 7eff681a..bce50e52 100644 --- a/src/main/java/org/onap/clamp/clds/service/CldsService.java +++ b/src/main/java/org/onap/clamp/clds/service/CldsService.java @@ -401,8 +401,72 @@ public class CldsService extends SecureServiceBase { @PathParam("modelName") String modelName, @QueryParam("test") String test, CldsModel model) throws TransformerException, ParseException, GeneralSecurityException, DecoderException { Date startTime = new Date(); +<<<<<<< Upstream, based on f7e5aab99d6c2a0a9d5e56b561ba0513aafd504e CldsModel retrievedModel = null; Boolean errorCase = false; +======= + LoggingUtils.setRequestContext("CldsService: Process model action", getPrincipalName()); + String actionCd = action.toUpperCase(); + SecureServicePermission permisionManage = SecureServicePermission.create(cldsPermissionTypeClManage, + cldsPermissionInstance, actionCd); + isAuthorized(permisionManage); + isAuthorizedForVf(model); + String userId = getUserId(); + String actionStateCd = CldsEvent.ACTION_STATE_INITIATED; + logger.info("PUT actionCd={}", actionCd); + logger.info("PUT actionStateCd={}", actionStateCd); + logger.info("PUT modelName={}", modelName); + logger.info("PUT test={}", test); + logger.info("PUT bpmnText={}", model.getBpmnText()); + logger.info("PUT propText={}", model.getPropText()); + logger.info("PUT userId={}", userId); + logger.info("PUT getTypeId={}", model.getTypeId()); + logger.info("PUT deploymentId={}", model.getDeploymentId()); + if (model.getTemplateName() != null) { + CldsTemplate template = cldsDao.getTemplate(model.getTemplateName()); + if (template != null) { + model.setTemplateId(template.getId()); + model.setDocText(template.getPropText()); + // This is to provide the Bpmn XML when Template part in UI is + // disabled + model.setBpmnText(template.getBpmnText()); + } + } + // save model to db + model.setName(modelName); + model.save(cldsDao, getUserId()); + // get vars and format if necessary + String prop = model.getPropText(); + String bpmn = model.getBpmnText(); + String docText = model.getDocText(); + String controlName = model.getControlName(); + String bpmnJson = cldsBpmnTransformer.doXslTransformToString(bpmn); + logger.info("PUT bpmnJson={}", bpmnJson); + // Flag indicates whether it is triggered by Validation Test button from + // UI + boolean isTest = false; + if (test != null && test.equalsIgnoreCase("true")) { + isTest = true; + } else { + String actionTestOverride = refProp.getStringValue("action.test.override"); + if (actionTestOverride != null && actionTestOverride.equalsIgnoreCase("true")) { + logger.info("PUT actionTestOverride={}", actionTestOverride); + logger.info("PUT override test indicator and setting it to true"); + isTest = true; + } + } + logger.info("PUT isTest={}", isTest); + boolean isInsertTestEvent = false; + String insertTestEvent = refProp.getStringValue("action.insert.test.event"); + if (insertTestEvent != null && insertTestEvent.equalsIgnoreCase("true")) { + isInsertTestEvent = true; + } + logger.info("PUT isInsertTestEvent={}", isInsertTestEvent); + // determine if requested action is permitted + model.validateAction(actionCd); + logger.info("modelProp - " + prop); + logger.info("docText - " + docText); +>>>>>>> 95a4d95 Remove the test flag try { LoggingUtils.setRequestContext("CldsService: Process model action", getPrincipalName()); String actionCd = action.toUpperCase(); @@ -806,8 +870,12 @@ public class CldsService extends SecureServiceBase { @Path("/deploy/{modelName}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) +<<<<<<< Upstream, based on f7e5aab99d6c2a0a9d5e56b561ba0513aafd504e public Response deployModel(@PathParam("modelName") String modelName, CldsModel model) { +======= + public CldsModel deployModel(@PathParam("modelName") String modelName, CldsModel model) { +>>>>>>> 95a4d95 Remove the test flag Date startTime = new Date(); LoggingUtils.setRequestContext("CldsService: Deploy model", getPrincipalName()); Boolean errorCase = false; @@ -874,8 +942,12 @@ public class CldsService extends SecureServiceBase { @Path("/undeploy/{modelName}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) +<<<<<<< Upstream, based on f7e5aab99d6c2a0a9d5e56b561ba0513aafd504e public Response unDeployModel(@PathParam("modelName") String modelName, CldsModel model) { +======= + public CldsModel unDeployModel(@PathParam("modelName") String modelName, CldsModel model) { +>>>>>>> 95a4d95 Remove the test flag Date startTime = new Date(); LoggingUtils.setRequestContext("CldsService: Undeploy model", getPrincipalName()); -- 2.16.6