From 323faa703b9eddae0c3f8a0267f4e732981a3c23 Mon Sep 17 00:00:00 2001 From: Joss Armstrong Date: Mon, 11 Feb 2019 12:59:49 +0000 Subject: Test coverage for ParseAdminArtifact Increased coverage from 65% to 85% Issue-ID: APPC-1409 Change-Id: If39c07b3edbcaad6d618e54b27483323848410fe Signed-off-by: Joss Armstrong --- .../appc/encryptiontool/fqdn/ParseAdminArtifcat.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'appc-config/appc-encryption-tool/provider/src/main/java/org') diff --git a/appc-config/appc-encryption-tool/provider/src/main/java/org/onap/appc/encryptiontool/fqdn/ParseAdminArtifcat.java b/appc-config/appc-encryption-tool/provider/src/main/java/org/onap/appc/encryptiontool/fqdn/ParseAdminArtifcat.java index e68a6f444..5118970eb 100644 --- a/appc-config/appc-encryption-tool/provider/src/main/java/org/onap/appc/encryptiontool/fqdn/ParseAdminArtifcat.java +++ b/appc-config/appc-encryption-tool/provider/src/main/java/org/onap/appc/encryptiontool/fqdn/ParseAdminArtifcat.java @@ -3,6 +3,8 @@ * ONAP : APPC * ================================================================================ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Modifications Copyright (C) 2019 Ericsson * ============================================================================= * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +27,6 @@ import java.io.IOException; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.function.Consumer; import org.apache.commons.lang.StringUtils; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; @@ -47,22 +48,22 @@ public class ParseAdminArtifcat implements SvcLogicJavaPlugin { private static String fqdn = null; private SvcLogicResource serviceLogic; + public ParseAdminArtifcat() { + serviceLogic = new SqlResource(); + } + public static ParseAdminArtifcat initialise() { parseArtifact = new ParseAdminArtifcat(); return parseArtifact; } - public ParseAdminArtifcat() { - serviceLogic = new SqlResource(); - } - protected ParseAdminArtifcat(SqlResource svcLogic) { serviceLogic = svcLogic; } protected static Map parseAdminArtifact(ArtifactMapper js) { List fqdnList = js.getFqdnList(); - Map mp = new HashMap(); + Map mp = new HashMap<>(); for (FqdnList listFqdn : fqdnList) { for (CloudOwnerList clList : listFqdn.getCloudOwnerList()) { @@ -143,10 +144,10 @@ public class ParseAdminArtifcat implements SvcLogicJavaPlugin { QueryStatus status = null; String fn = "ParseAdminArtifcat:getAdminArtifact"; String jsonContent = null; - String artifcatName = "ansible_admin_FQDN_Artifact_0.0.1V.json"; + String artifactName = "ansible_admin_FQDN_Artifact_0.0.1V.json"; try { String query = "SELECT ARTIFACT_CONTENT as adminjson" + " FROM ASDC_ARTIFACTS " + "WHERE ARTIFACT_NAME = '" - + artifcatName + "' " + "ORDER BY INTERNAL_VERSION DESC LIMIT 1 "; + + artifactName + "' " + "ORDER BY INTERNAL_VERSION DESC LIMIT 1 "; log.info("Getting artifact details :" + query); status = serviceLogic.query("SQL", false, null, query, null, null, ctx); jsonContent = ctx.getAttribute("adminjson"); -- cgit 1.2.3-korg