aboutsummaryrefslogtreecommitdiffstats
path: root/appc-dispatcher/appc-license-manager/appc-license-manager-core
diff options
context:
space:
mode:
authorPatrick Brady <pb071s@att.com>2017-02-15 23:11:26 -0800
committerPatrick Brady <pb071s@att.com>2017-02-15 23:13:06 -0800
commit1c192d2dd68724e292b6a30f463085a262e1e813 (patch)
treed0e2b3a396e169863cd0efaa835c8675e9d5aaac /appc-dispatcher/appc-license-manager/appc-license-manager-core
parentc69ba05c7508aa7d7f675189a45c8c87569369ef (diff)
Moving all files to root directory
Change-Id: Ica5535fd6ec85f350fe1640b42137b49f83f10f0 Signed-off-by: Patrick Brady <pb071s@att.com>
Diffstat (limited to 'appc-dispatcher/appc-license-manager/appc-license-manager-core')
-rw-r--r--appc-dispatcher/appc-license-manager/appc-license-manager-core/.gitignore1
-rw-r--r--appc-dispatcher/appc-license-manager/appc-license-manager-core/.settings/org.eclipse.wst.common.project.facet.core.xml4
-rw-r--r--appc-dispatcher/appc-license-manager/appc-license-manager-core/pom.xml71
-rw-r--r--appc-dispatcher/appc-license-manager/appc-license-manager-core/src/main/java/org/openecomp/appc/licmgr/impl/LicenseDataAccessServiceImpl.java177
-rw-r--r--appc-dispatcher/appc-license-manager/appc-license-manager-core/src/main/java/org/openecomp/appc/licmgr/impl/LicenseManagerImpl.java100
-rw-r--r--appc-dispatcher/appc-license-manager/appc-license-manager-core/src/main/resources/OSGI-INF/blueprint/blueprint.xml33
-rw-r--r--appc-dispatcher/appc-license-manager/appc-license-manager-core/src/main/resources/org/openecomp/appc/default.properties49
-rw-r--r--appc-dispatcher/appc-license-manager/appc-license-manager-core/src/test/java/org/openecomp/appc/licmgr/LicenseManagerImplTest.java22
-rw-r--r--appc-dispatcher/appc-license-manager/appc-license-manager-core/src/test/java/org/openecomp/appc/licmgr/LicenseManagerMock.java57
-rw-r--r--appc-dispatcher/appc-license-manager/appc-license-manager-core/src/test/java/org/openecomp/appc/licmgr/LicenseManagerPluginImplTest.java22
-rw-r--r--appc-dispatcher/appc-license-manager/appc-license-manager-core/src/test/java/org/openecomp/appc/licmgr/LicenseServiceMock.java56
-rw-r--r--appc-dispatcher/appc-license-manager/appc-license-manager-core/src/test/java/org/openecomp/appc/licmgr/TestVfLicenseModelConvert.java61
12 files changed, 653 insertions, 0 deletions
diff --git a/appc-dispatcher/appc-license-manager/appc-license-manager-core/.gitignore b/appc-dispatcher/appc-license-manager/appc-license-manager-core/.gitignore
new file mode 100644
index 000000000..b83d22266
--- /dev/null
+++ b/appc-dispatcher/appc-license-manager/appc-license-manager-core/.gitignore
@@ -0,0 +1 @@
+/target/
diff --git a/appc-dispatcher/appc-license-manager/appc-license-manager-core/.settings/org.eclipse.wst.common.project.facet.core.xml b/appc-dispatcher/appc-license-manager/appc-license-manager-core/.settings/org.eclipse.wst.common.project.facet.core.xml
new file mode 100644
index 000000000..f4ef8aa0a
--- /dev/null
+++ b/appc-dispatcher/appc-license-manager/appc-license-manager-core/.settings/org.eclipse.wst.common.project.facet.core.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faceted-project>
+ <installed facet="java" version="1.8"/>
+</faceted-project>
diff --git a/appc-dispatcher/appc-license-manager/appc-license-manager-core/pom.xml b/appc-dispatcher/appc-license-manager/appc-license-manager-core/pom.xml
new file mode 100644
index 000000000..1b209f1e0
--- /dev/null
+++ b/appc-dispatcher/appc-license-manager/appc-license-manager-core/pom.xml
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-license-manager</artifactId>
+ <version>1.0.0</version>
+ </parent>
+ <artifactId>appc-license-manager-core</artifactId>
+ <packaging>bundle</packaging>
+
+ <name>APPC License Manager Bundle</name>
+ <description>appc-license-manager-core OSGi bundle project.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-license-manager-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.mail</groupId>
+ <artifactId>javax.mail</artifactId>
+ <version>1.5.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdnc.core</groupId>
+ <artifactId>sli-common</artifactId>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdnc.core</groupId>
+ <artifactId>sli-provider</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdnc.core</groupId>
+ <artifactId>dblib-provider</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <configuration>
+ <instructions>
+ <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
+ <Bundle-Version>${project.version}</Bundle-Version>
+ <Embed-Dependency>!dblib-provider,appc-common,eelf-core,logback-core,logback-classic,javax.mail;scope=compile|runtime;inline=false</Embed-Dependency>
+ <Embed-Transitive>true</Embed-Transitive>
+ <Export-Service>org.openecomp.appc.licmgr.LicenseManager</Export-Service>
+ <Import-Package>org.openecomp.appc.licmgr,org.openecomp.appc.licmgr.exception,org.openecomp.appc.licmgr.objects,javax.mail.internet,!javax.mail,!groovy.lang,!javax.jms,!org.apache.log,!org.apache.log4j.*,!org.codehaus.jackson.*,!org.codehaus.jackson.map.*,!org.codehaus.commons.compiler,!org.codehaus.groovy.*,!org.codehaus.janino,!org.jasypt.*,!com.ibm.icu.*,!com.sun.faces.*,*</Import-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
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
new file mode 100644
index 000000000..2aff1ffb9
--- /dev/null
+++ b/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/main/java/org/openecomp/appc/licmgr/impl/LicenseDataAccessServiceImpl.java
@@ -0,0 +1,177 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : APP-C
+ * ================================================================================
+ * 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=========================================================
+ */
+
+package org.openecomp.appc.licmgr.impl;
+
+import org.openecomp.appc.licmgr.Constants;
+import org.openecomp.appc.licmgr.LicenseDataAccessService;
+import org.openecomp.appc.licmgr.exception.DataAccessException;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import org.openecomp.sdnc.sli.resource.dblib.DbLibService;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.ServiceReference;
+
+import javax.sql.rowset.CachedRowSet;
+
+import static org.openecomp.appc.licmgr.Constants.ASDC_ARTIFACTS_FIELDS;
+
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+
+@SuppressWarnings("JavaDoc")
+class LicenseDataAccessServiceImpl implements LicenseDataAccessService {
+
+ private static EELFLogger logger = EELFManager.getInstance().getLogger(LicenseDataAccessServiceImpl.class);
+
+ public void setSchema(String schema) {
+ this.schema = schema;
+ }
+
+ private String schema;
+
+ private DbLibService dbLibService;
+
+ private void checkDbLibService() throws DataAccessException {
+ if (null != dbLibService) {return;}
+
+ //get dblib service and send it to DAService
+ BundleContext bctx = FrameworkUtil.getBundle(LicenseManagerImpl.class).getBundleContext();
+ ServiceReference sref = bctx.getServiceReference(DbLibService.class.getName());
+ dbLibService = (DbLibService)bctx.getService(sref);
+
+ }
+
+ /**
+ * empty constructor
+ */
+ public LicenseDataAccessServiceImpl(){}
+
+ @Override
+ public Map<String,String> retrieveLicenseModelData(String vnfType, String vnfVersion, String... fields) throws
+ DataAccessException {
+
+ checkDbLibService();
+
+ Map<String,String> result = new HashMap<>();
+ if (null == fields || 0 == fields.length) fields = new String[]{ASDC_ARTIFACTS_FIELDS.ARTIFACT_CONTENT.name()};
+
+ String queryString = buildQueryStatement();
+
+ ArrayList<String> argList = new ArrayList<>();
+ argList.add(vnfType);
+ argList.add(vnfVersion);
+ argList.add(Constants.VF_LICENSE);
+
+ try {
+
+ final CachedRowSet data = dbLibService.getData(queryString, argList, Constants.NETCONF_SCHEMA);
+
+ if (data.first()) {
+ for (String field : fields) {
+ 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;
+ logger.info(msg);
+ }
+ } catch (SQLException e) {
+ logger.error("Error Accessing Database " + e);
+ throw new DataAccessException(e);
+ }
+
+ return result;
+ }
+
+ private String buildQueryStatement() {
+ return "select * " + "from " + Constants.ASDC_ARTIFACTS_TABLE_NAME + " " +
+ "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 {
+
+ checkDbLibService();
+
+ 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
new file mode 100644
index 000000000..815bb02ab
--- /dev/null
+++ b/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/main/java/org/openecomp/appc/licmgr/impl/LicenseManagerImpl.java
@@ -0,0 +1,100 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : APP-C
+ * ================================================================================
+ * 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=========================================================
+ */
+
+package org.openecomp.appc.licmgr.impl;
+
+import static org.openecomp.appc.licmgr.Constants.ASDC_ARTIFACTS_FIELDS.ARTIFACT_CONTENT;
+
+import java.util.Map;
+
+import org.openecomp.appc.licmgr.Constants;
+import org.openecomp.appc.licmgr.LicenseDataAccessService;
+import org.openecomp.appc.licmgr.LicenseManager;
+import org.openecomp.appc.licmgr.exception.DataAccessException;
+import org.openecomp.appc.licmgr.objects.LicenseModel;
+
+
+@SuppressWarnings("all")
+public class LicenseManagerImpl implements LicenseManager {
+
+ private LicenseDataAccessService DAService;
+
+ public void setDAService(LicenseDataAccessService daSrv){
+ DAService = daSrv;
+ }
+
+ public LicenseManagerImpl() {
+ DAService = new LicenseDataAccessServiceImpl();
+ DAService.setSchema(Constants.SDNCTL_SCHEMA);
+ }
+
+ @Override
+ public LicenseModel retrieveLicenseModel(String vnfType, String vnfVersion) throws DataAccessException {
+
+ LicenseModel licenseModel;
+ try {
+ Map<String,String> resultMap = DAService.retrieveLicenseModelData(vnfType, vnfVersion);
+ if (resultMap.isEmpty()) {
+ throw new DataAccessException(String.format("License model not found for vnfType='%s' and vnfVersion='%s'", vnfType, vnfVersion));
+ }
+ String licenseModelXML = resultMap.get(ARTIFACT_CONTENT.name());
+ licenseModel = convert(licenseModelXML); // JAXBUtil.<VfLicenseModel>toObject(licenseModelXML, VfLicenseModel.class);
+ } catch (DataAccessException le) {
+ throw le;
+ } catch (Exception e) {
+ throw new DataAccessException(e);
+ }
+ 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) {
+
+ LicenseModel licenseModel = new LicenseModel();
+
+ int posEntitlementStart = xml.indexOf("<entitlement-pool-uuid>");
+ int posEntitlementEnd = xml.indexOf("</entitlement-pool-uuid>", posEntitlementStart);
+ if (-1 != posEntitlementStart) {
+ licenseModel.setEntitlementPoolUuid(xml.substring(posEntitlementStart + "<entitlement-pool-uuid>".length(), posEntitlementEnd));
+ }
+
+ int posLicenseStart = xml.indexOf("<license-key-group-uuid>");
+ int posLicenseEnd = xml.indexOf("</license-key-group-uuid>", posEntitlementStart);
+ if (-1 != posLicenseStart) {
+ licenseModel.setLicenseKeyGroupUuid(xml.substring(posLicenseStart + "<license-key-group-uuid>".length(), posLicenseEnd));
+ }
+
+ return licenseModel;
+ }
+
+}
diff --git a/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
new file mode 100644
index 000000000..c8efb8390
--- /dev/null
+++ b/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============LICENSE_START=======================================================
+ openECOMP : APP-C
+ ================================================================================
+ 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=========================================================
+ -->
+
+<!--
+ Starter Blueprint Camel Definition appc-command-executor-blueprint
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
+
+ <bean id="licenseServiceBean" class="org.openecomp.appc.licmgr.impl.LicenseManagerImpl" scope="singleton" activation="lazy"/>
+ <service id="licenseService" interface="org.openecomp.appc.licmgr.LicenseManager" ref="licenseServiceBean"/>
+
+</blueprint>
diff --git a/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/main/resources/org/openecomp/appc/default.properties b/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/main/resources/org/openecomp/appc/default.properties
new file mode 100644
index 000000000..9d9e1d787
--- /dev/null
+++ b/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/main/resources/org/openecomp/appc/default.properties
@@ -0,0 +1,49 @@
+###
+# ============LICENSE_START=======================================================
+# openECOMP : APP-C
+# ================================================================================
+# 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=========================================================
+###
+
+# Define the name and path of any user-provided configuration (bootstrap) file that can be loaded
+# to supply configuration options
+org.openecomp.appc.bootstrap.file=appc.properties
+org.openecomp.appc.bootstrap.path=/opt/openecomp/appc/data/properties,${user.home},.
+
+
+#Property below provided by appc.properties
+#dmaap.poolMembers=<DMAAP_IP>:3904
+
+dmaap.topic.read=APPC-TEST2
+dmaap.topic.write=APPC-TEST2
+#dmaap.topic.read.filter={"class":"Assigned","field":"request"}
+dmaap.topic.read.filter={"class": "And","filters": [{"class": "Assigned","field": "request"},{"class": "Unassigned","field": "response"}]}
+dmaap.client.name=APPC-TEST-CLIENT-LIC-MGR-MAIN
+dmaap.client.name.id=0
+#dmaap.client.key=random
+#dmaap.client.secret=random
+
+dmaap.threads.queuesize.min=1
+dmaap.threads.queuesize.max=1000
+dmaap.threads.poolsize.min=2
+dmaap.threads.poolsize.max=2
+
+#
+# This needs to be changed so that the action can be appended to the end of the URL path
+#
+#provider.urls.topology=https://admin:password@<IP_ADDRESS>:8443/restconf/operations/appc-provider:topology-service
+#provider.urls.topology=https://admin:password@<IP_ADDRESS>:8443/restconf/operations/appc-provider:
diff --git a/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/test/java/org/openecomp/appc/licmgr/LicenseManagerImplTest.java b/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/test/java/org/openecomp/appc/licmgr/LicenseManagerImplTest.java
new file mode 100644
index 000000000..41bc7cadf
--- /dev/null
+++ b/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/test/java/org/openecomp/appc/licmgr/LicenseManagerImplTest.java
@@ -0,0 +1,22 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : APP-C
+ * ================================================================================
+ * 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=========================================================
+ */
+
+package org.openecomp.appc.licmgr;
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
new file mode 100644
index 000000000..ca7c1f2e9
--- /dev/null
+++ b/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/test/java/org/openecomp/appc/licmgr/LicenseManagerMock.java
@@ -0,0 +1,57 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : APP-C
+ * ================================================================================
+ * 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=========================================================
+ */
+
+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;
+
+
+public class LicenseManagerMock implements LicenseManager {
+
+ LicenseModel licenseModel;
+ @Override
+ public LicenseModel retrieveLicenseModel(String vnfType, String vnfVersion) throws DataAccessException {
+ if (vnfType == "VSCP" && vnfVersion == "123"){
+ return licenseModel;
+ }
+ else {
+ return null;
+ }
+ }
+
+ @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/LicenseManagerPluginImplTest.java b/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/test/java/org/openecomp/appc/licmgr/LicenseManagerPluginImplTest.java
new file mode 100644
index 000000000..41bc7cadf
--- /dev/null
+++ b/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/test/java/org/openecomp/appc/licmgr/LicenseManagerPluginImplTest.java
@@ -0,0 +1,22 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : APP-C
+ * ================================================================================
+ * 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=========================================================
+ */
+
+package org.openecomp.appc.licmgr;
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
new file mode 100644
index 000000000..e496da7b5
--- /dev/null
+++ b/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/test/java/org/openecomp/appc/licmgr/LicenseServiceMock.java
@@ -0,0 +1,56 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : APP-C
+ * ================================================================================
+ * 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=========================================================
+ */
+
+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;
+
+class LicenseServiceMock implements LicenseDataAccessService {
+
+ private String configFile;
+ private HashMap<String, String> backupConf;
+
+ @Override
+ public void setSchema(String schema) {
+ }
+
+ void setConfigFile(String configFile) {
+ this.configFile = configFile;
+ }
+
+ public HashMap<String, String> getBackupConf() {
+ return backupConf;
+ }
+
+ @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 DataAccessException {
+ }
+}
diff --git a/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/test/java/org/openecomp/appc/licmgr/TestVfLicenseModelConvert.java b/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/test/java/org/openecomp/appc/licmgr/TestVfLicenseModelConvert.java
new file mode 100644
index 000000000..26482a1dc
--- /dev/null
+++ b/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/test/java/org/openecomp/appc/licmgr/TestVfLicenseModelConvert.java
@@ -0,0 +1,61 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : APP-C
+ * ================================================================================
+ * 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=========================================================
+ */
+
+package org.openecomp.appc.licmgr;
+
+/*
+import org.openecomp.appc.licmgr.objects.VfLicenseModel;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Unmarshaller;
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+*/
+
+public class TestVfLicenseModelConvert {
+/*
+ public static void main(String args[]) {
+
+ try {
+
+ //create JAXB context
+ JAXBContext context = JAXBContext.newInstance(VfLicenseModel.class);
+
+ //Create Unmarshaller using JAXB context
+ Unmarshaller unmarshaller = context.createUnmarshaller();
+
+ Path xmlPath = Paths.get("src/test/resources/xml/vf-license-model.xml");
+ InputStream xmlInputStream = Files.newInputStream(xmlPath);
+
+ VfLicenseModel licenseModel = (VfLicenseModel) unmarshaller.unmarshal(xmlInputStream);
+
+ String vnfId = licenseModel.getVnfId();
+ String vendorName = licenseModel.getVendorName();
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+*/
+}