Search in sources :

Example 6 with AuthorizationInfo

use of org.eclipse.winery.accountability.model.authorization.AuthorizationInfo in project winery by eclipse.

the class AccountabilityManagerImplTest method validateBlockchainInputArguments.

private static Stream<Arguments> validateBlockchainInputArguments() throws Exception {
    String manifestFile = "TOSCA-Meta-Version: 1.0\n" + "CSAR-Version: 1.0\n" + "Created-By: Winery 3.0.0-SNAPSHOT\n" + "Entry-Definitions: Definitions/servicetemplates1__MyTinyToDo_Bare_Docker.tosca\n" + "\n" + "Name: myTestFile.tosca\n" + "Content-Type: application/vnd.oasis.tosca.definitions\n" + "SHA-256: 97193968948686d6947d4d760d3fe724b9981980056b8902be92e91fbe9e3eed\n" + "\n" + "Name: myTestFile2.tosca\n" + "Content-Type: application/vnd.oasis.tosca.definitions\n" + "SHA-256: a99c9a8e954355e34f11282a6dec25cc5e0b3aec2fd25d33daf2ca06267b477e\n";
    ModelProvenanceElement element = new ModelProvenanceElement();
    element.setFingerprint(manifestFile);
    element.setAuthorAddress("0x11111");
    Map<String, File> validFilesHashMap = new HashMap<>();
    validFilesHashMap.put("myTestFile.tosca", new File(ClassLoader.getSystemClassLoader().getResource("emptyDefinition.tosca").toURI()));
    validFilesHashMap.put("myTestFile2.tosca", new File(ClassLoader.getSystemClassLoader().getResource("secondDefinition.tosca").toURI()));
    validFilesHashMap.put("Tosca.meta", new File(ClassLoader.getSystemClassLoader().getResource("Tosca.meta").toURI()));
    AuthorizationElement authorizationElement = new AuthorizationElement();
    authorizationElement.setAuthorizerBlockchainAddress("0x11111");
    authorizationElement.setAuthorizedBlockchainAddress("0x11111");
    authorizationElement.setAuthorizedIdentity("Gharreb");
    authorizationElement.setTransactionHash("0x3215F23");
    List<AuthorizationElement> authList = Arrays.asList(authorizationElement);
    AuthorizationInfo authorizationInfo = new AuthorizationTree(authList);
    return Stream.of(Arguments.of(VERIFIED, Collections.singletonList(element), validFilesHashMap, authorizationInfo, "Simple valid file in manifest"));
}
Also used : HashMap(java.util.HashMap) ModelProvenanceElement(org.eclipse.winery.accountability.model.ModelProvenanceElement) AuthorizationTree(org.eclipse.winery.accountability.model.authorization.AuthorizationTree) AuthorizationElement(org.eclipse.winery.accountability.model.authorization.AuthorizationElement) File(java.io.File) AuthorizationInfo(org.eclipse.winery.accountability.model.authorization.AuthorizationInfo)

Aggregations

AuthorizationInfo (org.eclipse.winery.accountability.model.authorization.AuthorizationInfo)6 AuthorizationElement (org.eclipse.winery.accountability.model.authorization.AuthorizationElement)4 AuthorizationTree (org.eclipse.winery.accountability.model.authorization.AuthorizationTree)4 ModelProvenanceElement (org.eclipse.winery.accountability.model.ModelProvenanceElement)3 FileProvenanceElement (org.eclipse.winery.accountability.model.FileProvenanceElement)2 Disposable (io.reactivex.disposables.Disposable)1 File (java.io.File)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 CompletableFuture (java.util.concurrent.CompletableFuture)1 EthereumException (org.eclipse.winery.accountability.exceptions.EthereumException)1 Test (org.junit.jupiter.api.Test)1 TypeReference (org.web3j.abi.TypeReference)1 Event (org.web3j.abi.datatypes.Event)1 Utf8String (org.web3j.abi.datatypes.Utf8String)1 EthFilter (org.web3j.protocol.core.methods.request.EthFilter)1