diff options
author | Patrick Brady <pb071s@att.com> | 2017-07-28 11:29:23 -0700 |
---|---|---|
committer | Patrick Brady <pb071s@att.com> | 2017-08-02 15:43:44 +0000 |
commit | 38713207b817ed4700f630748c681116338d32f0 (patch) | |
tree | 9eb2097cee8d85ac14f17e3a280ae8aefb69d9de /appc-dispatcher/appc-license-manager/appc-license-manager-core/src | |
parent | 771ac55e29d099d8bbf783612de975047d75ab12 (diff) |
Merging in bug fixes
Change-Id: I85da90b9ba0d03149f42035a820c76ef0285e413
Signed-off-by: Patrick Brady <pb071s@att.com>
Issue: APPC-100
Diffstat (limited to 'appc-dispatcher/appc-license-manager/appc-license-manager-core/src')
4 files changed, 4 insertions, 93 deletions
diff --git a/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/main/java/org/openecomp/appc/licmgr/impl/LicenseDataAccessServiceImpl.java b/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/main/java/org/openecomp/appc/licmgr/impl/LicenseDataAccessServiceImpl.java index ef252cca6..8e999c4c9 100644 --- a/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/main/java/org/openecomp/appc/licmgr/impl/LicenseDataAccessServiceImpl.java +++ b/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/main/java/org/openecomp/appc/licmgr/impl/LicenseDataAccessServiceImpl.java @@ -87,7 +87,7 @@ public class LicenseDataAccessServiceImpl implements LicenseDataAccessService { result.put(field, data.getString(field)); } } else { - String msg = "Missing license model for VNF_TYPE: " + vnfType + " and VNF_VERSION: " + vnfVersion + " in table " + Constants.ASDC_ARTIFACTS_TABLE_NAME; + String msg = "Missing license model for VNF_TYPE: " + vnfType + " and VNF_VERSION: " + vnfVersion + " in table " + Constants.ASDC_ARTIFACTS; logger.info(msg); } } catch (SQLException e) { @@ -99,70 +99,10 @@ public class LicenseDataAccessServiceImpl implements LicenseDataAccessService { } private String buildQueryStatement() { - return "select * " + "from " + Constants.ASDC_ARTIFACTS_TABLE_NAME + " " + + return "select * " + "from " + Constants.ASDC_ARTIFACTS + " " + "where " + ASDC_ARTIFACTS_FIELDS.RESOURCE_NAME.name() + " = ?" + " AND " + ASDC_ARTIFACTS_FIELDS.RESOURCE_VERSION.name() + " = ?" + " AND " + ASDC_ARTIFACTS_FIELDS.ARTIFACT_TYPE.name() + " = ?"; } - /** - * Implementation of storeArtifactPayload() - * @see LicenseDataAccessService - */ - @Override - public void storeArtifactPayload(Map<String, String> parameters) throws RuntimeException { - - if(parameters == null || parameters.isEmpty()) { - throw new RuntimeException("No parameters for insert are provided"); - } - - String insertStr = "INSERT INTO " + Constants.ASDC_ARTIFACTS_TABLE_NAME + "("; - String valuesStr = "VALUES("; - String insertStatementStr; - - ArrayList<String> params = new ArrayList<>(); - boolean firstTime = true; - for(Map.Entry<String, String> entry : parameters.entrySet()) { - if(!firstTime) { - insertStr += ","; - valuesStr += ","; - } - else { - firstTime = false; - } - insertStr += entry.getKey(); - valuesStr += "?"; - - params.add(entry.getValue()); - } - - insertStr += ")"; - valuesStr += ")"; - insertStatementStr = insertStr + " " + valuesStr; - - executeStoreArtifactPayload(insertStatementStr, params); - } - - /** - * Exexutes insert statement for artifact payload - * @param insertStatementStr - * @param params - * @throws RuntimeException - */ - private void executeStoreArtifactPayload(String insertStatementStr, ArrayList<String> params) throws RuntimeException { - - try { - logger.info("used schema=" + this.schema); - logger.info("insert statement=" + insertStatementStr); - - dbLibService.writeData(insertStatementStr, params, this.schema); - - logger.info("finished to execute insert"); - - } catch (SQLException e) { - logger.error("Storing Artifact payload failed - " + insertStatementStr); - throw new RuntimeException("Storing Artifact payload failed - " + insertStatementStr); - } - } - } diff --git a/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/main/java/org/openecomp/appc/licmgr/impl/LicenseManagerImpl.java b/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/main/java/org/openecomp/appc/licmgr/impl/LicenseManagerImpl.java index 0d7da6766..9f3db5aab 100644 --- a/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/main/java/org/openecomp/appc/licmgr/impl/LicenseManagerImpl.java +++ b/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/main/java/org/openecomp/appc/licmgr/impl/LicenseManagerImpl.java @@ -65,18 +65,6 @@ public class LicenseManagerImpl implements LicenseManager { return licenseModel; } - @Override - public Map<String, String> retrieveLicenseModelData(String vnfType, String vnfVersion, String... fields) throws DataAccessException { - - Map<String,String> resultMap = DAService.retrieveLicenseModelData(vnfType, vnfVersion, fields); - return resultMap; - } - - @Override - public void storeArtifactPayload(Map<String, String> parameters) throws RuntimeException { - - DAService.storeArtifactPayload(parameters); - } private static LicenseModel convert(String xml) { diff --git a/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/test/java/org/openecomp/appc/licmgr/LicenseManagerMock.java b/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/test/java/org/openecomp/appc/licmgr/LicenseManagerMock.java index 2dad318c6..92adefe55 100644 --- a/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/test/java/org/openecomp/appc/licmgr/LicenseManagerMock.java +++ b/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/test/java/org/openecomp/appc/licmgr/LicenseManagerMock.java @@ -24,9 +24,6 @@ package org.openecomp.appc.licmgr; -import java.util.Map; - -import org.openecomp.appc.licmgr.LicenseManager; import org.openecomp.appc.licmgr.exception.DataAccessException; import org.openecomp.appc.licmgr.objects.LicenseModel; @@ -44,15 +41,6 @@ public class LicenseManagerMock implements LicenseManager { } } - @Override public Map<String, String> retrieveLicenseModelData(String vnfType, String vnfVersion, String... fields) - throws DataAccessException { - return null; - } - - @Override public void storeArtifactPayload(Map<String, String> parameters) throws RuntimeException { - - } - public void storeLicenseModel(LicenseModel licenseModel){ this.licenseModel = licenseModel; diff --git a/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/test/java/org/openecomp/appc/licmgr/LicenseServiceMock.java b/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/test/java/org/openecomp/appc/licmgr/LicenseServiceMock.java index c930807b2..ec44e7cdf 100644 --- a/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/test/java/org/openecomp/appc/licmgr/LicenseServiceMock.java +++ b/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/test/java/org/openecomp/appc/licmgr/LicenseServiceMock.java @@ -23,12 +23,10 @@ */ package org.openecomp.appc.licmgr; -import java.util.HashMap; -import java.util.Map; -import org.openecomp.appc.licmgr.LicenseDataAccessService; import org.openecomp.appc.licmgr.exception.DataAccessException; -import org.openecomp.sdnc.sli.resource.dblib.DbLibService; +import java.util.HashMap; +import java.util.Map; class LicenseServiceMock implements LicenseDataAccessService { @@ -52,7 +50,4 @@ class LicenseServiceMock implements LicenseDataAccessService { return null; } - @Override - public void storeArtifactPayload(Map<String, String> parameters) throws DataAccessException { - } } |