From 69785b88e46c6bcf5f94f2db2a1c097b08bacc7c Mon Sep 17 00:00:00 2001 From: "Determe, Sebastien (sd378r)" Date: Fri, 16 Mar 2018 19:46:33 +0100 Subject: Rework the code Some reworking of different services classes Issue-ID: CLAMP-81 Change-Id: I7815e805f2a41954d633d3e3453af02d0de6b283 Signed-off-by: Determe, Sebastien (sd378r) --- src/main/java/org/onap/clamp/clds/service/CldsService.java | 2 +- .../org/onap/clamp/clds/service/CldsTemplateService.java | 13 +------------ .../org/onap/clamp/clds/it/CldsTemplateServiceItCase.java | 9 +-------- 3 files changed, 3 insertions(+), 21 deletions(-) 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 34bd3d787..a9c81dbb2 100644 --- a/src/main/java/org/onap/clamp/clds/service/CldsService.java +++ b/src/main/java/org/onap/clamp/clds/service/CldsService.java @@ -67,13 +67,13 @@ import org.onap.clamp.clds.dao.CldsDao; import org.onap.clamp.clds.exception.CldsConfigException; import org.onap.clamp.clds.exception.policy.PolicyClientException; import org.onap.clamp.clds.exception.sdc.SdcCommunicationException; -import org.onap.clamp.clds.model.CldsMonitoringDetails; import org.onap.clamp.clds.model.CldsDbServiceCache; import org.onap.clamp.clds.model.CldsEvent; import org.onap.clamp.clds.model.CldsHealthCheck; import org.onap.clamp.clds.model.CldsInfo; import org.onap.clamp.clds.model.CldsModel; import org.onap.clamp.clds.model.CldsModelProp; +import org.onap.clamp.clds.model.CldsMonitoringDetails; import org.onap.clamp.clds.model.CldsServiceData; import org.onap.clamp.clds.model.CldsTemplate; import org.onap.clamp.clds.model.DcaeEvent; diff --git a/src/main/java/org/onap/clamp/clds/service/CldsTemplateService.java b/src/main/java/org/onap/clamp/clds/service/CldsTemplateService.java index 1b03922d1..7a9ee70e5 100644 --- a/src/main/java/org/onap/clamp/clds/service/CldsTemplateService.java +++ b/src/main/java/org/onap/clamp/clds/service/CldsTemplateService.java @@ -38,7 +38,6 @@ import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; -import javax.xml.transform.TransformerException; import org.onap.clamp.clds.dao.CldsDao; import org.onap.clamp.clds.model.CldsTemplate; @@ -156,8 +155,7 @@ public class CldsTemplateService extends SecureServiceBase { @Path("/template/{templateName}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - public CldsTemplate putTemplate(@PathParam("templateName") String templateName, CldsTemplate cldsTemplate) - throws TransformerException, IOException { + public CldsTemplate putTemplate(@PathParam("templateName") String templateName, CldsTemplate cldsTemplate) { Date startTime = new Date(); LoggingUtils.setRequestContext("CldsTemplateService: PUT template", getPrincipalName()); isAuthorized(permissionUpdateTemplate); @@ -166,15 +164,6 @@ public class CldsTemplateService extends SecureServiceBase { logger.info("PUT propText=" + cldsTemplate.getPropText()); logger.info("PUT imageText=" + cldsTemplate.getImageText()); cldsTemplate.setName(templateName); - String bpmnText = cldsTemplate.getBpmnText(); - String imageText = cldsTemplate.getImageText(); - String propText = cldsTemplate.getPropText(); - cldsTemplate.setBpmnText(bpmnText); - cldsTemplate.setImageText(imageText); - cldsTemplate.setPropText(propText); - logger.info(" bpmnText : " + cldsTemplate.getBpmnText()); - logger.info(" Image Text : " + cldsTemplate.getImageText()); - logger.info(" Prop Text : " + cldsTemplate.getPropText()); cldsTemplate.save(cldsDao, null); // audit log LoggingUtils.setTimeContext(startTime, new Date()); diff --git a/src/test/java/org/onap/clamp/clds/it/CldsTemplateServiceItCase.java b/src/test/java/org/onap/clamp/clds/it/CldsTemplateServiceItCase.java index 1caa637c5..be2997a31 100644 --- a/src/test/java/org/onap/clamp/clds/it/CldsTemplateServiceItCase.java +++ b/src/test/java/org/onap/clamp/clds/it/CldsTemplateServiceItCase.java @@ -35,7 +35,6 @@ import java.security.Principal; import java.util.List; import javax.ws.rs.core.SecurityContext; -import javax.xml.transform.TransformerException; import org.junit.Before; import org.junit.Test; @@ -93,13 +92,7 @@ public class CldsTemplateServiceItCase { cldsTemplate.setBpmnText(bpmnText); cldsTemplate.setImageText(imageText); cldsTemplate.setPropText(bpmnPropText); - try { - cldsTemplateService.putTemplate("testModel", cldsTemplate); - } catch (IOException e) { - logger.error("IOException while saving template", e); - } catch (TransformerException ex) { - logger.error("Transforming exception while saving template.", ex); - } + cldsTemplateService.putTemplate("testModel", cldsTemplate); } @Test -- cgit 1.2.3-korg