diff options
author | xuegao <xue.gao@intl.att.com> | 2021-03-11 20:04:46 +0100 |
---|---|---|
committer | Vasyl Razinkov <vasyl.razinkov@est.tech> | 2021-03-12 11:52:36 +0000 |
commit | 6387653c4058694b0cb6bf53efc64e79918b87e2 (patch) | |
tree | 1e394a398da1893c422b5c327317d14a9b69d298 /openecomp-be | |
parent | f54b124ccfcf596e19d19ba2d24fd2702cd73c8d (diff) |
Adding unit tests
Adding unit tests to improve test coverage.
Issue-ID: SDC-3428
Signed-off-by: xuegao <xue.gao@intl.att.com>
Change-Id: I685f01886b314dea9b8507afd93937e070d7501d
Diffstat (limited to 'openecomp-be')
9 files changed, 101 insertions, 216 deletions
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/application-config-rest-types/src/main/java/org/openecomp/sdcrests/applicationconfiguration/types/ConfigurationDataDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/application-config-rest-types/src/main/java/org/openecomp/sdcrests/applicationconfiguration/types/ConfigurationDataDto.java index 2a523783ab..75aaf756d5 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/application-config-rest-types/src/main/java/org/openecomp/sdcrests/applicationconfiguration/types/ConfigurationDataDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/application-config-rest-types/src/main/java/org/openecomp/sdcrests/applicationconfiguration/types/ConfigurationDataDto.java @@ -7,9 +7,9 @@ * 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. @@ -20,34 +20,19 @@ package org.openecomp.sdcrests.applicationconfiguration.types; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + /** * Created by Talio on 8/9/2016. */ +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor public class ConfigurationDataDto { private String value; private long timeStamp; - - public ConfigurationDataDto(String value, long timeStamp) { - this.value = value; - this.timeStamp = timeStamp; - } - - public ConfigurationDataDto() { - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - - public long getTimeStamp() { - return timeStamp; - } - - public void setTimeStamp(long timeStamp) { - this.timeStamp = timeStamp; - } } diff --git a/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/ErrorCodeAndMessage.java b/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/ErrorCodeAndMessage.java index 58f073935a..d7c5c63506 100644 --- a/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/ErrorCodeAndMessage.java +++ b/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/ErrorCodeAndMessage.java @@ -7,9 +7,9 @@ * 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. @@ -21,12 +21,19 @@ package org.openecomp.sdc.common.errors; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + import javax.ws.rs.core.Response; /** * This class represents an error object to be returned in failed REST instead of just returning one * of HTTP fail statuses. */ +@Getter +@Setter +@NoArgsConstructor public class ErrorCodeAndMessage { /** @@ -44,9 +51,6 @@ public class ErrorCodeAndMessage { */ private String message; - public ErrorCodeAndMessage() { - } - /** * Instantiates a new Error code and message. * @@ -58,30 +62,4 @@ public class ErrorCodeAndMessage { this.message = errorCode.message(); this.errorCode = errorCode.id(); } - - - public Response.Status getStatus() { - return status; - } - - public void setStatus(Response.Status status) { - this.status = status; - } - - public String getErrorCode() { - return errorCode; - } - - public void setErrorCode(String errorCode) { - this.errorCode = errorCode; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - } diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/type/ConfigurationData.java b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/type/ConfigurationData.java index b41cda635d..6149fc6ce4 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/type/ConfigurationData.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/type/ConfigurationData.java @@ -7,9 +7,9 @@ * 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. @@ -20,30 +20,15 @@ package org.openecomp.core.utilities.applicationconfig.type; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; +@Getter +@Setter +@AllArgsConstructor public class ConfigurationData { private String value; private long timeStamp; - - public ConfigurationData(String value, long timeStamp) { - this.value = value; - this.timeStamp = timeStamp; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - - public long getTimeStamp() { - return timeStamp; - } - - public void setTimeStamp(long timeStamp) { - this.timeStamp = timeStamp; - } } diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/ItemElementLoggerTargetServiceName.java b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/ItemElementLoggerTargetServiceName.java index 45981e70ab..9ac46fda8b 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/ItemElementLoggerTargetServiceName.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/ItemElementLoggerTargetServiceName.java @@ -12,9 +12,14 @@ * 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. -*/ + */ package org.openecomp.core.zusammen.impl; +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor public enum ItemElementLoggerTargetServiceName { ITEM_CREATION("Item Creation"), ITEM_VERSION_CREATION("Item Version Creation"), @@ -27,12 +32,4 @@ public enum ItemElementLoggerTargetServiceName { ITEM_VERSION_RETRIEVAL("Item version retrieval)"); private final String description; - - ItemElementLoggerTargetServiceName(String description) { - this.description = description; - } - - public String getDescription() { - return description; - } } diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/inter/Enricher.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/inter/Enricher.java index 8e66887c1e..cc3a0d5186 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/inter/Enricher.java +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/inter/Enricher.java @@ -7,9 +7,9 @@ * 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. @@ -21,6 +21,7 @@ package org.openecomp.sdc.enrichment.inter; +import lombok.Setter; import org.openecomp.sdc.datatypes.error.ErrorMessage; import org.openecomp.sdc.datatypes.model.AsdcModel; import org.openecomp.sdc.enrichment.EnrichmentInfo; @@ -28,19 +29,12 @@ import org.openecomp.sdc.enrichment.EnrichmentInfo; import java.util.List; import java.util.Map; +@Setter public abstract class Enricher { protected EnrichmentInfo data; protected AsdcModel model; - public void setData(EnrichmentInfo data) { - this.data = data; - } - - public void setModel(AsdcModel model) { - this.model = model; - } - public abstract Map<String, List<ErrorMessage>> enrich() throws Exception; } diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/type/NamingConventionValidationContext.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/type/NamingConventionValidationContext.java index 25b846e42b..7bad45f5fd 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/type/NamingConventionValidationContext.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/type/NamingConventionValidationContext.java @@ -15,6 +15,7 @@ */ package org.openecomp.sdc.validation.type; +import lombok.AllArgsConstructor; import org.openecomp.sdc.heat.datatypes.model.HeatOrchestrationTemplate; import org.openecomp.sdc.validation.ValidationContext; @@ -26,15 +27,9 @@ import lombok.EqualsAndHashCode; */ @Getter @EqualsAndHashCode +@AllArgsConstructor public class NamingConventionValidationContext implements ValidationContext { private HeatOrchestrationTemplate heatOrchestrationTemplate; private String envFileName; - - public NamingConventionValidationContext( - HeatOrchestrationTemplate heatOrchestrationTemplate, - String envFileName) { - this.heatOrchestrationTemplate = heatOrchestrationTemplate; - this.envFileName = envFileName; - } } diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/LimitXml.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/LimitXml.java index 9cc1aed72b..0c989cb3f9 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/LimitXml.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/LimitXml.java @@ -20,6 +20,11 @@ package org.openecomp.sdc.vendorlicense.dao.types.xml; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter public class LimitXml { String description; String metric; @@ -28,54 +33,6 @@ public class LimitXml { String time; String aggregationFunction; - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getMetric() { - return metric; - } - - public void setMetric(String metric) { - this.metric = metric; - } - - public String getValues() { - return values; - } - - public void setValues(String values) { - this.values = values; - } - - public String getUnit() { - return unit; - } - - public void setUnit(String unit) { - this.unit = unit; - } - - public String getTime() { - return time; - } - - public void setTime(String time) { - this.time = time; - } - - public String getAggregationFunction() { - return aggregationFunction; - } - - public void setAggregationFunction(String aggregationFunction) { - this.aggregationFunction = aggregationFunction; - } - public EntitlementTimeForXml getTimeForArtifact() { EntitlementTimeForXml timeForXml = new EntitlementTimeForXml(); if (time != null) { 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/LicenseAgreementDaoZusammenImpl.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/LicenseAgreementDaoZusammenImpl.java index 348bfe1829..d30931c8c7 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/LicenseAgreementDaoZusammenImpl.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/LicenseAgreementDaoZusammenImpl.java @@ -24,6 +24,7 @@ import com.amdocs.zusammen.datatypes.SessionContext; import com.amdocs.zusammen.datatypes.item.Action; import com.amdocs.zusammen.datatypes.item.ElementContext; import com.amdocs.zusammen.datatypes.item.Info; +import lombok.AllArgsConstructor; import org.openecomp.core.zusammen.api.ZusammenAdaptor; import org.openecomp.sdc.datatypes.model.ElementType; import org.openecomp.sdc.vendorlicense.dao.LicenseAgreementDao; @@ -38,15 +39,11 @@ import java.util.stream.Collectors; import static org.openecomp.core.zusammen.api.ZusammenUtil.*; - +@AllArgsConstructor public class LicenseAgreementDaoZusammenImpl implements LicenseAgreementDao { private ZusammenAdaptor zusammenAdaptor; - public LicenseAgreementDaoZusammenImpl(ZusammenAdaptor zusammenAdaptor) { - this.zusammenAdaptor = zusammenAdaptor; - } - @Override public void registerVersioning(String versionableEntityType) { //no need @@ -55,47 +52,47 @@ public class LicenseAgreementDaoZusammenImpl implements LicenseAgreementDao { @Override public void create(LicenseAgreementEntity licenseAgreement) { ZusammenElement licenseAgreementElement = - buildLicenseAgreementElement(licenseAgreement, Action.CREATE); + buildLicenseAgreementElement(licenseAgreement, Action.CREATE); ZusammenElement licenseAgreementsElement = - buildStructuralElement(ElementType.LicenseAgreements, Action.IGNORE); + buildStructuralElement(ElementType.LicenseAgreements, Action.IGNORE); licenseAgreementsElement.addSubElement(licenseAgreementElement); SessionContext context = createSessionContext(); Element licenseAgreementsSavedElement = zusammenAdaptor.saveElement(context, - new ElementContext(licenseAgreement.getVendorLicenseModelId(), - licenseAgreement.getVersion().getId()), licenseAgreementsElement, - "Create license agreement"); + new ElementContext(licenseAgreement.getVendorLicenseModelId(), + licenseAgreement.getVersion().getId()), licenseAgreementsElement, + "Create license agreement"); licenseAgreement - .setId(licenseAgreementsSavedElement.getSubElements().iterator().next().getElementId() - .getValue()); + .setId(licenseAgreementsSavedElement.getSubElements().iterator().next().getElementId() + .getValue()); } @Override public void update(LicenseAgreementEntity licenseAgreement) { ZusammenElement licenseAgreementElement = - buildLicenseAgreementElement(licenseAgreement, Action.UPDATE); + buildLicenseAgreementElement(licenseAgreement, Action.UPDATE); SessionContext context = createSessionContext(); zusammenAdaptor.saveElement(context, - new ElementContext(licenseAgreement.getVendorLicenseModelId(), - licenseAgreement.getVersion().getId()), licenseAgreementElement, - String.format("Update license agreement with id %s", licenseAgreement.getId())); + new ElementContext(licenseAgreement.getVendorLicenseModelId(), + licenseAgreement.getVersion().getId()), licenseAgreementElement, + String.format("Update license agreement with id %s", licenseAgreement.getId())); } @Override public LicenseAgreementEntity get(LicenseAgreementEntity licenseAgreement) { SessionContext context = createSessionContext(); ElementContext elementContext = new ElementContext(licenseAgreement.getVendorLicenseModelId(), - licenseAgreement.getVersion().getId()); + licenseAgreement.getVersion().getId()); ElementToLicenseAgreementConvertor convertor = new ElementToLicenseAgreementConvertor(); return zusammenAdaptor.getElementInfo(context, elementContext, new Id(licenseAgreement.getId())) - .map(elementInfo -> { - LicenseAgreementEntity entity = convertor.convert(elementInfo); - entity.setVendorLicenseModelId(licenseAgreement.getVendorLicenseModelId()); - entity.setVersion(licenseAgreement.getVersion()); - return entity; - }) - .orElse(null); + .map(elementInfo -> { + LicenseAgreementEntity entity = convertor.convert(elementInfo); + entity.setVendorLicenseModelId(licenseAgreement.getVendorLicenseModelId()); + entity.setVersion(licenseAgreement.getVersion()); + return entity; + }) + .orElse(null); } @Override @@ -104,9 +101,9 @@ public class LicenseAgreementDaoZusammenImpl implements LicenseAgreementDao { SessionContext context = createSessionContext(); ElementContext elementContext = new ElementContext(licenseAgreement.getVendorLicenseModelId(), - licenseAgreement.getVersion().getId()); + licenseAgreement.getVersion().getId()); zusammenAdaptor.saveElement(context, elementContext, zusammenElement, - "delete license agreement. id:" + licenseAgreement.getId() + "."); + "delete license agreement. id:" + licenseAgreement.getId() + "."); } @@ -114,29 +111,29 @@ public class LicenseAgreementDaoZusammenImpl implements LicenseAgreementDao { public Collection<LicenseAgreementEntity> list(LicenseAgreementEntity licenseAgreement) { SessionContext context = createSessionContext(); ElementContext elementContext = new ElementContext(licenseAgreement.getVendorLicenseModelId(), - licenseAgreement.getVersion().getId()); + licenseAgreement.getVersion().getId()); ElementToLicenseAgreementConvertor convertor = new ElementToLicenseAgreementConvertor(); return zusammenAdaptor - .listElementsByName(context, elementContext, null, - ElementType.LicenseAgreements.name()) - .stream().map(elementInfo -> { - LicenseAgreementEntity entity = convertor.convert(elementInfo); - entity.setVendorLicenseModelId(licenseAgreement.getVendorLicenseModelId()); - entity.setVersion(licenseAgreement.getVersion()); - return entity; - }) - .collect(Collectors.toList()); + .listElementsByName(context, elementContext, null, + ElementType.LicenseAgreements.name()) + .stream().map(elementInfo -> { + LicenseAgreementEntity entity = convertor.convert(elementInfo); + entity.setVendorLicenseModelId(licenseAgreement.getVendorLicenseModelId()); + entity.setVersion(licenseAgreement.getVersion()); + return entity; + }) + .collect(Collectors.toList()); } @Override public long count(LicenseAgreementEntity licenseAgreement) { SessionContext context = createSessionContext(); ElementContext elementContext = new ElementContext(licenseAgreement.getVendorLicenseModelId(), - licenseAgreement.getVersion().getId()); + licenseAgreement.getVersion().getId()); return zusammenAdaptor.listElementsByName(context, elementContext, null, - ElementType.LicenseAgreements.name()) - .size(); + ElementType.LicenseAgreements.name()) + .size(); } @Override @@ -148,16 +145,16 @@ public class LicenseAgreementDaoZusammenImpl implements LicenseAgreementDao { public void removeFeatureGroup(LicenseAgreementEntity licenseAgreement, String featureGroupId) { SessionContext context = createSessionContext(); ElementContext elementContext = new ElementContext(licenseAgreement.getVendorLicenseModelId(), - licenseAgreement.getVersion().getId()); + licenseAgreement.getVersion().getId()); Optional<ElementInfo> elementInfo = zusammenAdaptor.getElementInfo(context, - elementContext, new Id(licenseAgreement.getId())); + elementContext, new Id(licenseAgreement.getId())); if (elementInfo.isPresent()) { ZusammenElement zusammenElement = VlmZusammenUtil.getZusammenElement(elementInfo.get()); zusammenElement.setAction(Action.UPDATE); zusammenElement.setRelations(elementInfo.get().getRelations().stream() - .filter(relation -> !featureGroupId.equals(relation.getEdge2().getElementId().getValue())) - .collect(Collectors.toList())); + .filter(relation -> !featureGroupId.equals(relation.getEdge2().getElementId().getValue())) + .collect(Collectors.toList())); zusammenAdaptor.saveElement(context, elementContext, zusammenElement, "remove feature group"); } } @@ -167,17 +164,17 @@ public class LicenseAgreementDaoZusammenImpl implements LicenseAgreementDao { Set<String> addedFeatureGroupIds, Set<String> removedFeatureGroupIds) { ZusammenElement licenseAgreementElement = - buildLicenseAgreementElement(licenseAgreement, Action.UPDATE); + buildLicenseAgreementElement(licenseAgreement, Action.UPDATE); SessionContext context = createSessionContext(); ElementContext elementContext = new ElementContext(licenseAgreement.getVendorLicenseModelId(), - licenseAgreement.getVersion().getId()); + licenseAgreement.getVersion().getId()); ElementToLicenseAgreementConvertor convertor = new ElementToLicenseAgreementConvertor(); Optional<ElementInfo> elementInfo = - zusammenAdaptor.getElementInfo(context, elementContext, new Id(licenseAgreement.getId())); + zusammenAdaptor.getElementInfo(context, elementContext, new Id(licenseAgreement.getId())); if (elementInfo.isPresent()) { LicenseAgreementEntity currentLicenseAgreement = - convertor.convert(elementInfo.get()); + convertor.convert(elementInfo.get()); currentLicenseAgreement.setVendorLicenseModelId(licenseAgreement.getVendorLicenseModelId()); currentLicenseAgreement.setVersion(licenseAgreement.getVersion()); if (!(removedFeatureGroupIds == null)) { @@ -188,19 +185,19 @@ public class LicenseAgreementDaoZusammenImpl implements LicenseAgreementDao { currentLicenseAgreement.getFeatureGroupIds().addAll(addedFeatureGroupIds); } licenseAgreementElement.setRelations(currentLicenseAgreement.getFeatureGroupIds().stream() - .map(relation -> VlmZusammenUtil - .createRelation(RelationType.LicenseAgreementToFeatureGroup, relation)) - .collect(Collectors.toList())); + .map(relation -> VlmZusammenUtil + .createRelation(RelationType.LicenseAgreementToFeatureGroup, relation)) + .collect(Collectors.toList())); zusammenAdaptor.saveElement(context, elementContext, licenseAgreementElement, - "update license agreement"); + "update license agreement"); } } private ZusammenElement buildLicenseAgreementElement(LicenseAgreementEntity licenseAgreement, Action action) { ZusammenElement licenseAgreementElement = - buildElement(licenseAgreement.getId() == null ? null : new Id(licenseAgreement.getId()), - action); + buildElement(licenseAgreement.getId() == null ? null : new Id(licenseAgreement.getId()), + action); Info info = new Info(); info.setName(licenseAgreement.getName()); info.setDescription(licenseAgreement.getDescription()); @@ -210,11 +207,11 @@ public class LicenseAgreementDaoZusammenImpl implements LicenseAgreementDao { licenseAgreementElement.setInfo(info); if (licenseAgreement.getFeatureGroupIds() != null && - !licenseAgreement.getFeatureGroupIds().isEmpty()) { + !licenseAgreement.getFeatureGroupIds().isEmpty()) { licenseAgreementElement.setRelations(licenseAgreement.getFeatureGroupIds().stream() - .map(rel -> VlmZusammenUtil - .createRelation(RelationType.LicenseAgreementToFeatureGroup, rel)) - .collect(Collectors.toList())); + .map(rel -> VlmZusammenUtil + .createRelation(RelationType.LicenseAgreementToFeatureGroup, rel)) + .collect(Collectors.toList())); } return licenseAgreementElement; } 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/LicenseKeyGroupZusammenDaoImpl.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/LicenseKeyGroupZusammenDaoImpl.java index d9fa3d4cf7..e5a08ae93a 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/LicenseKeyGroupZusammenDaoImpl.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/LicenseKeyGroupZusammenDaoImpl.java @@ -27,6 +27,7 @@ import com.amdocs.zusammen.datatypes.SessionContext; import com.amdocs.zusammen.datatypes.item.Action; import com.amdocs.zusammen.datatypes.item.ElementContext; import com.amdocs.zusammen.datatypes.item.Info; +import lombok.AllArgsConstructor; import org.openecomp.core.zusammen.api.ZusammenAdaptor; import org.openecomp.sdc.datatypes.model.ElementType; import org.openecomp.sdc.vendorlicense.dao.LicenseKeyGroupDao; @@ -41,14 +42,10 @@ import java.util.stream.Collectors; import static org.openecomp.core.zusammen.api.ZusammenUtil.*; - +@AllArgsConstructor public class LicenseKeyGroupZusammenDaoImpl implements LicenseKeyGroupDao { private ZusammenAdaptor zusammenAdaptor; - public LicenseKeyGroupZusammenDaoImpl(ZusammenAdaptor zusammenAdaptor) { - this.zusammenAdaptor = zusammenAdaptor; - } - @Override public void registerVersioning(String versionableEntityType) { //no need |