2 * Copyright © 2016-2018 European Support Limited
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org.openecomp.sdc.vendorlicense.dao.impl.zusammen.convertor;
18 import static org.junit.jupiter.api.Assertions.assertEquals;
20 import com.amdocs.zusammen.adaptor.inbound.api.types.item.ElementInfo;
21 import com.amdocs.zusammen.adaptor.inbound.api.types.item.ZusammenElement;
22 import com.amdocs.zusammen.datatypes.item.Info;
23 import org.junit.jupiter.api.Test;
24 import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.VendorLicenseModelDaoZusammenImpl;
25 import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity;
27 class ElementToVLMGeneralConvertorTest {
29 private static final String ENTITY_NAME = "entityTestName";
30 private static final String ENTITY_DESCRIPTION = "entityTestDesc";
32 private ElementToVLMGeneralConvertor converter = new ElementToVLMGeneralConvertor();
35 void shouldConvertElementToVendorLicenseModelEntity() {
36 ZusammenElement elementToConvert = new ZusammenElement();
37 Info info = new Info();
38 info.addProperty(VendorLicenseModelDaoZusammenImpl.InfoPropertyName.NAME.name(), ENTITY_NAME);
39 info.addProperty(VendorLicenseModelDaoZusammenImpl.InfoPropertyName.DESCRIPTION.name(), ENTITY_DESCRIPTION);
40 elementToConvert.setInfo(info);
41 VendorLicenseModelEntity result = converter.convert(elementToConvert);
42 assertEquals(ENTITY_NAME, result.getVendorName());
43 assertEquals(ENTITY_DESCRIPTION, result.getDescription());
47 void shouldConvertElementInfoToVendorLicenseModelEntity() {
48 ElementInfo elementInfo = new ElementInfo();
49 Info info = new Info();
50 info.addProperty(VendorLicenseModelDaoZusammenImpl.InfoPropertyName.NAME.name(), ENTITY_NAME);
51 info.addProperty(VendorLicenseModelDaoZusammenImpl.InfoPropertyName.DESCRIPTION.name(), ENTITY_DESCRIPTION);
52 elementInfo.setInfo(info);
53 VendorLicenseModelEntity result = converter.convert(elementInfo);
54 assertEquals(ENTITY_NAME, result.getVendorName());
55 assertEquals(ENTITY_DESCRIPTION, result.getDescription());