aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-be-plugins/etsi-nfv-nsd-csar-plugin/src/test/java/org/openecomp/sdc/be/plugins/etsi/nfv/nsd/generator/EtsiNfvNsCsarEntryGeneratorTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-be-plugins/etsi-nfv-nsd-csar-plugin/src/test/java/org/openecomp/sdc/be/plugins/etsi/nfv/nsd/generator/EtsiNfvNsCsarEntryGeneratorTest.java')
-rw-r--r--catalog-be-plugins/etsi-nfv-nsd-csar-plugin/src/test/java/org/openecomp/sdc/be/plugins/etsi/nfv/nsd/generator/EtsiNfvNsCsarEntryGeneratorTest.java25
1 files changed, 25 insertions, 0 deletions
diff --git a/catalog-be-plugins/etsi-nfv-nsd-csar-plugin/src/test/java/org/openecomp/sdc/be/plugins/etsi/nfv/nsd/generator/EtsiNfvNsCsarEntryGeneratorTest.java b/catalog-be-plugins/etsi-nfv-nsd-csar-plugin/src/test/java/org/openecomp/sdc/be/plugins/etsi/nfv/nsd/generator/EtsiNfvNsCsarEntryGeneratorTest.java
index d52bf5c7f0..72bc8247a4 100644
--- a/catalog-be-plugins/etsi-nfv-nsd-csar-plugin/src/test/java/org/openecomp/sdc/be/plugins/etsi/nfv/nsd/generator/EtsiNfvNsCsarEntryGeneratorTest.java
+++ b/catalog-be-plugins/etsi-nfv-nsd-csar-plugin/src/test/java/org/openecomp/sdc/be/plugins/etsi/nfv/nsd/generator/EtsiNfvNsCsarEntryGeneratorTest.java
@@ -80,6 +80,19 @@ class EtsiNfvNsCsarEntryGeneratorTest {
}
@Test
+ void successfullyEntryGenerationWithVersionFromModelNameTest() throws NsdException {
+ mockServiceComponentWithoutMetadata();
+ final NsdCsar nsdCsar = new NsdCsar(SERVICE_NORMALIZED_NAME);
+ nsdCsar.setCsarPackage(new byte[5]);
+ when(etsiNfvNsdCsarGenerator.generateNsdCsar(service)).thenReturn(nsdCsar);
+ final Map<String, byte[]> entryMap = etsiNfvNsCsarEntryGenerator.generateCsarEntries(service);
+ assertThat("Csar Entries should contain only one entry", entryMap.size(), is(1));
+ assertThat("Csar Entries should contain the expected entry", entryMap,
+ hasEntry(String.format(NSD_FILE_PATH_FORMAT, ETSI_PACKAGE, SERVICE_NORMALIZED_NAME, UNSIGNED_CSAR_EXTENSION),
+ nsdCsar.getCsarPackage()));
+ }
+
+ @Test
void knownNsdGenerationErrorTest() throws NsdException {
mockServiceComponent();
when(etsiNfvNsdCsarGenerator.generateNsdCsar(service)).thenThrow(new NsdException(""));
@@ -128,4 +141,16 @@ class EtsiNfvNsCsarEntryGeneratorTest {
categoryDefinitionList.add(nsComponentCategoryDefinition);
when(service.getCategories()).thenReturn(categoryDefinitionList);
}
+
+ private void mockServiceComponentWithoutMetadata() {
+ when(service.getName()).thenReturn("anyName");
+ when(service.getComponentType()).thenReturn(ComponentTypeEnum.SERVICE);
+ when(service.getNormalizedName()).thenReturn(SERVICE_NORMALIZED_NAME);
+ when(service.getModel()).thenReturn("Any Name with Version v2.5.1");
+ final List<CategoryDefinition> categoryDefinitionList = new ArrayList<>();
+ final CategoryDefinition nsComponentCategoryDefinition = new CategoryDefinition();
+ nsComponentCategoryDefinition.setName(CategoriesToGenerateNsd.ETSI_NS_COMPONENT_CATEGORY.getCategoryName());
+ categoryDefinitionList.add(nsComponentCategoryDefinition);
+ when(service.getCategories()).thenReturn(categoryDefinitionList);
+ }
}
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239