diff options
Diffstat (limited to 'appc-dispatcher/appc-license-manager')
7 files changed, 7 insertions, 121 deletions
diff --git a/appc-dispatcher/appc-license-manager/appc-license-manager-api/src/main/java/org/openecomp/appc/licmgr/Constants.java b/appc-dispatcher/appc-license-manager/appc-license-manager-api/src/main/java/org/openecomp/appc/licmgr/Constants.java index c3b098f46..dc255cd57 100644 --- a/appc-dispatcher/appc-license-manager/appc-license-manager-api/src/main/java/org/openecomp/appc/licmgr/Constants.java +++ b/appc-dispatcher/appc-license-manager/appc-license-manager-api/src/main/java/org/openecomp/appc/licmgr/Constants.java @@ -55,7 +55,7 @@ public class Constants { public static final String REQUEST_ID_FIELD_NAME = "REQUEST_ID"; public static final String CREATION_DATE_FIELD_NAME = "CREATION_DATE"; public static final String LOG_FIELD_NAME = "LOG"; - public static final String ASDC_ARTIFACTS_TABLE_NAME = "ASDC_ARTIFACTS"; + public static final String ASDC_ARTIFACTS = "ASDC_ARTIFACTS"; // input fields names public static final String PAYLOAD = "payload"; diff --git a/appc-dispatcher/appc-license-manager/appc-license-manager-api/src/main/java/org/openecomp/appc/licmgr/LicenseDataAccessService.java b/appc-dispatcher/appc-license-manager/appc-license-manager-api/src/main/java/org/openecomp/appc/licmgr/LicenseDataAccessService.java index 1c3d55ccb..0f14b2ee6 100644 --- a/appc-dispatcher/appc-license-manager/appc-license-manager-api/src/main/java/org/openecomp/appc/licmgr/LicenseDataAccessService.java +++ b/appc-dispatcher/appc-license-manager/appc-license-manager-api/src/main/java/org/openecomp/appc/licmgr/LicenseDataAccessService.java @@ -24,10 +24,9 @@ package org.openecomp.appc.licmgr; -import java.util.Map; - import org.openecomp.appc.licmgr.exception.DataAccessException; -import org.openecomp.sdnc.sli.resource.dblib.DbLibService; + +import java.util.Map; @SuppressWarnings("JavaDoc") @@ -48,10 +47,4 @@ public interface LicenseDataAccessService { */ Map<String,String> retrieveLicenseModelData(String vnfType, String vnfVersion, String... fields) throws DataAccessException; - /** - * - * @param parameters parameters to store in artifacts table - * @throws RuntimeException - */ - void storeArtifactPayload(Map<String, String> parameters) throws RuntimeException; } diff --git a/appc-dispatcher/appc-license-manager/appc-license-manager-api/src/main/java/org/openecomp/appc/licmgr/LicenseManager.java b/appc-dispatcher/appc-license-manager/appc-license-manager-api/src/main/java/org/openecomp/appc/licmgr/LicenseManager.java index ba874b21c..144cfb633 100644 --- a/appc-dispatcher/appc-license-manager/appc-license-manager-api/src/main/java/org/openecomp/appc/licmgr/LicenseManager.java +++ b/appc-dispatcher/appc-license-manager/appc-license-manager-api/src/main/java/org/openecomp/appc/licmgr/LicenseManager.java @@ -24,8 +24,6 @@ package org.openecomp.appc.licmgr; -import java.util.Map; - import org.openecomp.appc.licmgr.exception.DataAccessException; import org.openecomp.appc.licmgr.objects.LicenseModel; @@ -42,21 +40,5 @@ public interface LicenseManager { */ LicenseModel retrieveLicenseModel(String vnfType, String vnfVersion) throws DataAccessException; - /** - * - * @param vnfType resource name - * @param vnfVersion resource version - * @return map contains requested fields as Strings - * @throws RuntimeException - */ - Map<String,String> retrieveLicenseModelData(String vnfType, String vnfVersion, String... fields) throws - DataAccessException; - - /** - * - * @param parameters parameters to store in artifacts table - * @throws RuntimeException - */ - void storeArtifactPayload(Map<String, String> parameters) throws RuntimeException; } 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 { - } } |