use of org.eclipse.winery.accountability.model.ProvenanceVerification in project winery by eclipse.
the class AccountabilityManagerImplTest method verifyManifest.
@ParameterizedTest(name = "{index} => ''{3}''")
@MethodSource("verifyManifestArguments")
public void verifyManifest(ModelProvenanceElement historyElement, ProvenanceVerification expectedVerification, AuthorizationInfo authorizationInfo, String description) throws Exception {
String manifestId = "Tosca.meta";
List<ModelProvenanceElement> historyElementList = Objects.nonNull(historyElement) ? Arrays.asList(historyElement) : null;
Map<String, File> filesMap = new HashMap<>();
filesMap.put(manifestId, new File(ClassLoader.getSystemResource(manifestId).toURI()));
Map<String, ProvenanceVerification> verificationMap = new HashMap<>();
provenance.verifyManifest(historyElementList, manifestId, filesMap, verificationMap, authorizationInfo);
ProvenanceVerification verification = verificationMap.get(manifestId);
assertEquals(expectedVerification, verification);
}
use of org.eclipse.winery.accountability.model.ProvenanceVerification in project winery by eclipse.
the class CsarImporterValidationTest method testImportAndValidation.
@Test
public void testImportAndValidation() throws Exception {
try (InputStream input = new FileInputStream("src/test/resources/csar/ServiceTemplateWithAllReqCapVariants.csar")) {
CsarImportOptions options = new CsarImportOptions();
options.setOverwrite(true);
options.setAsyncWPDParsing(false);
options.setValidate(true);
ImportMetaInformation importMetaInformation = csarImporter.readCSAR(input, options);
assertEquals(ProvenanceVerification.VERIFIED, importMetaInformation.verificationMap.remove("TOSCA-Metadata/TOSCA.meta"));
for (Map.Entry<String, ProvenanceVerification> entry : importMetaInformation.verificationMap.entrySet()) {
assertEquals(ProvenanceVerification.VERIFIED, entry.getValue());
}
}
}
use of org.eclipse.winery.accountability.model.ProvenanceVerification in project winery by eclipse.
the class CsarImporterValidationTest method testImportAndInvalidValidation.
@Test
public void testImportAndInvalidValidation() throws Exception {
try (InputStream inputStream = new FileInputStream("src/test/resources/csar/ServiceTemplateWithAllReqCapVariants-Invalid.csar")) {
CsarImportOptions options = new CsarImportOptions();
options.setOverwrite(true);
options.setAsyncWPDParsing(false);
options.setValidate(true);
ImportMetaInformation importMetaInformation = csarImporter.readCSAR(inputStream, options);
ProvenanceVerification invalidDefinition = importMetaInformation.verificationMap.remove("Definitions/servicetemplates__ServiceTemplateWithAllReqCapVariants.tosca");
assertEquals(ProvenanceVerification.INVALID, invalidDefinition);
for (Map.Entry<String, ProvenanceVerification> entry : importMetaInformation.verificationMap.entrySet()) {
assertEquals(ProvenanceVerification.VERIFIED, entry.getValue());
}
}
}
use of org.eclipse.winery.accountability.model.ProvenanceVerification in project winery by eclipse.
the class CsarImporterValidationTest method testImportOfCsarWithoutAuthorship.
@Test
public void testImportOfCsarWithoutAuthorship() throws Exception {
try (InputStream inputStream = new FileInputStream("src/test/resources/csar/ProvenanceCsarWithoutAuthorizedAuthors_w1-wip1.csar")) {
CsarImportOptions options = new CsarImportOptions();
options.setOverwrite(true);
options.setAsyncWPDParsing(false);
options.setValidate(true);
ImportMetaInformation importMetaInformation = csarImporter.readCSAR(inputStream, options);
ProvenanceVerification verification = importMetaInformation.verificationMap.get("TOSCA-Metadata/TOSCA.meta");
assertEquals(ProvenanceVerification.NO_AUTHORIZATION_DATA_AVAILABLE, verification);
}
}
Aggregations