summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/lib')
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/VendorLicenseConstants.java10
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/VendorLicenseModelDaoZusammenImpl.java14
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToVLMGeneralConvertor.java6
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/test/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToVLMGeneralConvertorTest.java22
4 files changed, 29 insertions, 23 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/VendorLicenseConstants.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/VendorLicenseConstants.java
index d43797e498..2f1d385e48 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/VendorLicenseConstants.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/VendorLicenseConstants.java
@@ -19,18 +19,24 @@
*/
package org.openecomp.sdc.vendorlicense;
+import static org.openecomp.sdc.common.api.Constants.VENDOR_LICENSE_MODEL;
+import static org.openecomp.sdc.common.api.Constants.VF_LICENSE_MODEL;
+
import java.io.File;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
public final class VendorLicenseConstants {
public static final String VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE = "VendorLicenseModel";
public static final String EXTERNAL_ARTIFACTS_DIR = "Artifacts";
//todo change when separating external from internal artifacts
- public static final String VNF_ARTIFACT_NAME_WITH_PATH = EXTERNAL_ARTIFACTS_DIR + File.separator + "vf-license-model.xml";
- public static final String VENDOR_LICENSE_MODEL_ARTIFACT_NAME_WITH_PATH = EXTERNAL_ARTIFACTS_DIR + File.separator + "vendor-license-model.xml";
+ public static final String VNF_ARTIFACT_NAME_WITH_PATH = EXTERNAL_ARTIFACTS_DIR + File.separator + VF_LICENSE_MODEL;
+ public static final String VENDOR_LICENSE_MODEL_ARTIFACT_NAME_WITH_PATH = EXTERNAL_ARTIFACTS_DIR + File.separator + VENDOR_LICENSE_MODEL;
public static final String VENDOR_LICENSE_MODEL_ARTIFACT_REGEX_REMOVE = " xmlns=\"\"";
public static final String UNSUPPORTED_OPERATION_ERROR = "An error has occurred: Unsupported operation for 1707 release.";
+ @NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class UniqueValues {
public static final String VENDOR_NAME = "Vendor name";
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/VendorLicenseModelDaoZusammenImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/VendorLicenseModelDaoZusammenImpl.java
index 8f974c4df8..0453b305f3 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/VendorLicenseModelDaoZusammenImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/VendorLicenseModelDaoZusammenImpl.java
@@ -15,6 +15,7 @@
*/
package org.openecomp.sdc.vendorlicense.dao.impl.zusammen;
+import static org.openecomp.sdc.vendorlicense.VendorLicenseConstants.VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE;
import static org.openecomp.sdc.versioning.dao.impl.zusammen.ItemZusammenDaoImpl.ItemInfoProperty.ITEM_TYPE;
import com.amdocs.zusammen.adaptor.inbound.api.types.item.ZusammenElement;
@@ -44,7 +45,8 @@ public class VendorLicenseModelDaoZusammenImpl implements VendorLicenseModelDao
@Override
public void registerVersioning(String versionableEntityType) {
- VersionableEntityMetadata metadata = new VersionableEntityMetadata(VersionableEntityStoreType.Zusammen, "VendorLicenseModel", null, null);
+ VersionableEntityMetadata metadata = new VersionableEntityMetadata(VersionableEntityStoreType.Zusammen, VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE,
+ null, null);
ActionVersioningManagerFactory.getInstance().createInterface().register(versionableEntityType, metadata);
}
@@ -52,7 +54,7 @@ public class VendorLicenseModelDaoZusammenImpl implements VendorLicenseModelDao
public Collection<VendorLicenseModelEntity> list(VendorLicenseModelEntity vendorLicenseModelEntity) {
ElementToVLMGeneralConvertor convertor = new ElementToVLMGeneralConvertor();
return zusammenAdaptor.listItems(ZusammenUtil.createSessionContext()).stream()
- .filter(item -> "VendorLicenseModel".equals(item.getInfo().getProperty(ITEM_TYPE.getName()))).map(item -> {
+ .filter(item -> VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE.equals(item.getInfo().getProperty(ITEM_TYPE.getName()))).map(item -> {
VendorLicenseModelEntity entity = convertor.convert(item);
entity.setId(item.getId().getValue());
entity.setVersion(null);
@@ -109,10 +111,10 @@ public class VendorLicenseModelDaoZusammenImpl implements VendorLicenseModelDao
}
private void addVlmToInfo(Info info, VendorLicenseModelEntity vendorLicenseModel) {
- info.addProperty(InfoPropertyName.name.name(), vendorLicenseModel.getVendorName());
- info.addProperty(InfoPropertyName.description.name(), vendorLicenseModel.getDescription());
- info.addProperty(InfoPropertyName.iconRef.name(), vendorLicenseModel.getIconRef());
+ info.addProperty(InfoPropertyName.NAME.name(), vendorLicenseModel.getVendorName());
+ info.addProperty(InfoPropertyName.DESCRIPTION.name(), vendorLicenseModel.getDescription());
+ info.addProperty(InfoPropertyName.ICON_REF.name(), vendorLicenseModel.getIconRef());
}
- public enum InfoPropertyName {name, description, iconRef,}
+ public enum InfoPropertyName {NAME, DESCRIPTION, ICON_REF,}
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToVLMGeneralConvertor.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToVLMGeneralConvertor.java
index e274e264c0..aef20cf490 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToVLMGeneralConvertor.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToVLMGeneralConvertor.java
@@ -55,9 +55,9 @@ public class ElementToVLMGeneralConvertor extends ElementConvertor {
private VendorLicenseModelEntity mapInfoToVendorLicenseModelEntity(Info info) {
VendorLicenseModelEntity vendorLicenseModelEntity = new VendorLicenseModelEntity();
- vendorLicenseModelEntity.setVendorName(info.getProperty(VendorLicenseModelDaoZusammenImpl.InfoPropertyName.name.name()));
- vendorLicenseModelEntity.setDescription(info.getProperty(VendorLicenseModelDaoZusammenImpl.InfoPropertyName.description.name()));
- vendorLicenseModelEntity.setIconRef(info.getProperty(VendorLicenseModelDaoZusammenImpl.InfoPropertyName.iconRef.name()));
+ vendorLicenseModelEntity.setVendorName(info.getProperty(VendorLicenseModelDaoZusammenImpl.InfoPropertyName.NAME.name()));
+ vendorLicenseModelEntity.setDescription(info.getProperty(VendorLicenseModelDaoZusammenImpl.InfoPropertyName.DESCRIPTION.name()));
+ vendorLicenseModelEntity.setIconRef(info.getProperty(VendorLicenseModelDaoZusammenImpl.InfoPropertyName.ICON_REF.name()));
return vendorLicenseModelEntity;
}
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/test/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToVLMGeneralConvertorTest.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/test/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToVLMGeneralConvertorTest.java
index 45660a6854..9d9f002c9b 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/test/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToVLMGeneralConvertorTest.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/test/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToVLMGeneralConvertorTest.java
@@ -15,15 +15,16 @@
*/
package org.openecomp.sdc.vendorlicense.dao.impl.zusammen.convertor;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import com.amdocs.zusammen.adaptor.inbound.api.types.item.ElementInfo;
import com.amdocs.zusammen.adaptor.inbound.api.types.item.ZusammenElement;
import com.amdocs.zusammen.datatypes.item.Info;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.VendorLicenseModelDaoZusammenImpl;
import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity;
-public class ElementToVLMGeneralConvertorTest {
+class ElementToVLMGeneralConvertorTest {
private static final String ENTITY_NAME = "entityTestName";
private static final String ENTITY_DESCRIPTION = "entityTestDesc";
@@ -31,30 +32,27 @@ public class ElementToVLMGeneralConvertorTest {
private ElementToVLMGeneralConvertor converter = new ElementToVLMGeneralConvertor();
@Test
- public void shouldConvertElementToVendorLicenseModelEntity() {
+ void shouldConvertElementToVendorLicenseModelEntity() {
ZusammenElement elementToConvert = new ZusammenElement();
Info info = new Info();
- info.addProperty("name",ENTITY_NAME);
- info.addProperty("description",ENTITY_DESCRIPTION);
+ info.addProperty(VendorLicenseModelDaoZusammenImpl.InfoPropertyName.NAME.name(), ENTITY_NAME);
+ info.addProperty(VendorLicenseModelDaoZusammenImpl.InfoPropertyName.DESCRIPTION.name(), ENTITY_DESCRIPTION);
elementToConvert.setInfo(info);
VendorLicenseModelEntity result = converter.convert(elementToConvert);
assertEquals(ENTITY_NAME, result.getVendorName());
assertEquals(ENTITY_DESCRIPTION, result.getDescription());
-
-
}
@Test
- public void shouldConvertElementInfoToVendorLicenseModelEntity() {
+ void shouldConvertElementInfoToVendorLicenseModelEntity() {
ElementInfo elementInfo = new ElementInfo();
Info info = new Info();
- info.addProperty("name",ENTITY_NAME);
- info.addProperty("description",ENTITY_DESCRIPTION);
+ info.addProperty(VendorLicenseModelDaoZusammenImpl.InfoPropertyName.NAME.name(), ENTITY_NAME);
+ info.addProperty(VendorLicenseModelDaoZusammenImpl.InfoPropertyName.DESCRIPTION.name(), ENTITY_DESCRIPTION);
elementInfo.setInfo(info);
VendorLicenseModelEntity result = converter.convert(elementInfo);
assertEquals(ENTITY_NAME, result.getVendorName());
assertEquals(ENTITY_DESCRIPTION, result.getDescription());
}
-
}