diff options
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/etsi/ETSIServiceImplTest.java')
1 files changed, 12 insertions, 0 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/etsi/ETSIServiceImplTest.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/etsi/ETSIServiceImplTest.java index f5570ae4e1..4254a56dcb 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/etsi/ETSIServiceImplTest.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/etsi/ETSIServiceImplTest.java @@ -30,6 +30,7 @@ import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; +import static org.openecomp.sdc.tosca.csar.CSARConstants.ETSI_VERSION_2_6_1; import java.io.File; import java.io.IOException; @@ -45,6 +46,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; + import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -57,6 +59,8 @@ import org.openecomp.sdc.tosca.csar.Manifest; import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel; import org.yaml.snakeyaml.Yaml; +import com.vdurmont.semver4j.Semver; + public class ETSIServiceImplTest { private ETSIService etsiService; @@ -291,6 +295,14 @@ public class ETSIServiceImplTest { containsString(file2Path.toString())); } + @Test + public void extractETSIPackageVersionTest() { + final List<String> versions = Arrays.asList("2.6.1", "2.7.1", "1.1.1", "3.3.1", "3.1.1", "1.1.2", "2.2.1"); + assertThat(versions.stream().map(Semver::new).max((v1, v2) -> v1.compareTo(v2)) + .orElse(new Semver(ETSI_VERSION_2_6_1)), + is(new Semver("3.3.1"))); + } + private <T> T convert(final String fullFileName, final Class<T> className) throws IOException { assertTrue((new File(fullFileName)).exists()); |