import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
-import java.util.List;
+import java.util.Set;
import java.util.UUID;
import org.apache.http.entity.ContentType;
import org.json.JSONException;
@SpringBootTest
@ContextConfiguration(classes = RappCsarConfigurationHandler.class)
-public class RappCsarConfigurationHandlerTest {
+class RappCsarConfigurationHandlerTest {
@Autowired
RappCsarConfigurationHandler rappCsarConfigurationHandler;
@Test
void testFileListing() {
File file = new File(validCsarFileLocation + validRappFile);
- List<String> fileListFromCsar =
- rappCsarConfigurationHandler.getFileListFromCsar(file, "Files/Sme/serviceapis/");
- assertThat(fileListFromCsar.size()).isEqualTo(2);
+ Set<String> fileListFromCsar = rappCsarConfigurationHandler.getFileListFromCsar(file, "Files/Sme/serviceapis/");
+ assertThat(fileListFromCsar).hasSize(2);
}
@Test
void testInvalidFileListing() {
File file = new File(validCsarFileLocation);
- List<String> fileListFromCsar = rappCsarConfigurationHandler.getFileListFromCsar(file, null);
- assertThat(fileListFromCsar.size()).isEqualTo(0);
+ Set<String> fileListFromCsar = rappCsarConfigurationHandler.getFileListFromCsar(file, null);
+ assertThat(fileListFromCsar).isEmpty();
}
@Test
RappResources rappResources = rappCsarConfigurationHandler.getRappResource(rapp);
assertThat(rappResources).isNotNull();
assertNotNull(rappResources.getAcm().getCompositionDefinitions());
- assertThat(rappResources.getAcm().getCompositionInstances().size()).isEqualTo(3);
- assertThat(rappResources.getSme().getProviderFunctions().size()).isEqualTo(4);
- assertThat(rappResources.getSme().getServiceApis().size()).isEqualTo(2);
- assertThat(rappResources.getSme().getInvokers().size()).isEqualTo(2);
+ assertThat(rappResources.getAcm().getCompositionInstances()).hasSize(3);
+ assertThat(rappResources.getSme().getProviderFunctions()).hasSize(4);
+ assertThat(rappResources.getSme().getServiceApis()).hasSize(2);
+ assertThat(rappResources.getSme().getInvokers()).hasSize(2);
}
@Test
UUID rappId = UUID.randomUUID();
RappResources rappResources = new RappResources();
rappResources.setAcm(RappResources.ACMResources.builder().compositionDefinitions("compositions")
- .compositionInstances(List.of()).build());
+ .compositionInstances(Set.of()).build());
Rapp rapp =
Rapp.builder().rappId(rappId).name("").packageName(validRappFile).packageLocation(validCsarFileLocation)
.rappResources(rappResources).build();
UUID rappId = UUID.randomUUID();
RappResources rappResources = new RappResources();
rappResources.setAcm(RappResources.ACMResources.builder().compositionDefinitions("invalidcomposition")
- .compositionInstances(List.of()).build());
+ .compositionInstances(Set.of()).build());
Rapp rapp =
Rapp.builder().rappId(rappId).name("").packageName(validRappFile).packageLocation(validCsarFileLocation)
.rappResources(rappResources).build();