Skip to content
This repository has been archived by the owner on Feb 8, 2022. It is now read-only.

Commit

Permalink
changing execution result object
Browse files Browse the repository at this point in the history
  • Loading branch information
aaitor committed Sep 8, 2020
1 parent ce10cc2 commit c059957
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>io.keyko.nevermined</groupId>
<artifactId>api</artifactId>
<version>0.3.1</version>
<version>0.3.2</version>
<packaging>jar</packaging>
<name>Nevermined Data Platform Java SDK</name>
<url>https://github.com/keyko-io/nevermined-sdk-java</url>
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/io/keyko/nevermined/api/AssetsAPI.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.keyko.nevermined.api;

import io.keyko.nevermined.exceptions.*;
import io.keyko.nevermined.external.GatewayService;
import io.keyko.nevermined.models.DDO;
import io.keyko.nevermined.models.DID;
import io.keyko.nevermined.models.asset.AssetMetadata;
Expand Down Expand Up @@ -255,7 +256,7 @@ public interface AssetsAPI {
* @return an execution id
* @throws ServiceException ServiceException
*/
String execute(String agreementId, DID did, int index, DID workflowDID) throws ServiceException;
GatewayService.ServiceExecutionResult execute(String agreementId, DID did, int index, DID workflowDID) throws ServiceException;

/**
* Return the owner of the asset.
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/io/keyko/nevermined/api/impl/AssetsImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import io.keyko.nevermined.api.AssetsAPI;
import io.keyko.nevermined.exceptions.*;
import io.keyko.nevermined.external.GatewayService;
import io.keyko.nevermined.manager.AgreementsManager;
import io.keyko.nevermined.manager.AssetsManager;
import io.keyko.nevermined.manager.NeverminedManager;
Expand Down Expand Up @@ -170,7 +171,7 @@ public List<DID> consumerAssets(String consumerAddress) throws ServiceException
}

@Override
public String execute(String agreementId, DID did, int index, DID workflowDID) throws ServiceException {
public GatewayService.ServiceExecutionResult execute(String agreementId, DID did, int index, DID workflowDID) throws ServiceException {
return neverminedManager.executeComputeService(agreementId, did, index, workflowDID);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.web3j.crypto.CipherException;
import org.web3j.crypto.Hash;
import org.web3j.crypto.Keys;
import org.web3j.protocol.core.methods.response.TransactionReceipt;

Expand Down Expand Up @@ -969,7 +968,7 @@ public InputStream consumeBinary(String serviceAgreementId, DID did, int service
* @return an execution id
* @throws ServiceException ServiceException
*/
public String executeComputeService(String agreementId, DID did, int index, DID workflowDID) throws ServiceException {
public GatewayService.ServiceExecutionResult executeComputeService(String agreementId, DID did, int index, DID workflowDID) throws ServiceException {

DDO ddo;

Expand All @@ -995,7 +994,7 @@ public String executeComputeService(String agreementId, DID did, int index, DID
if (!result.getOk())
throw new ServiceException("There was a problem initializing the execution of the service. HTTP Code: " + result.getCode());

return result.getExecutionId();
return result;

} catch (DDOException e) {
throw new ServiceException("There was an error resolving the DID ", e);
Expand Down
5 changes: 3 additions & 2 deletions src/test/java/io/keyko/nevermined/api/AssetsApiIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import io.keyko.nevermined.contracts.EscrowAccessSecretStoreTemplate;
import io.keyko.nevermined.contracts.TemplateStoreManager;
import io.keyko.nevermined.exceptions.DDOException;
import io.keyko.nevermined.external.GatewayService;
import io.keyko.nevermined.manager.ManagerHelper;
import io.keyko.nevermined.models.Balance;
import io.keyko.nevermined.models.DDO;
Expand Down Expand Up @@ -313,7 +314,7 @@ public void orderAndExecuteComputeService() throws Exception {
assertNotNull(orderResult.getServiceAgreementId());

// 5. Execute
final String executionId = neverminedAPIConsumer.getAssetsAPI().execute(
GatewayService.ServiceExecutionResult executionResult = neverminedAPIConsumer.getAssetsAPI().execute(
EthereumHelper.add0x(orderResult.getServiceAgreementId()),
didComputeService,
Service.DEFAULT_COMPUTE_INDEX,
Expand All @@ -322,7 +323,7 @@ public void orderAndExecuteComputeService() throws Exception {
final long endTime = System.currentTimeMillis();
log.debug("Order method took " + (orderTime - startTime) + " milliseconds");
log.debug("Execution Request took " + (endTime - startTime) + " milliseconds");
assertNotNull(executionId);
assertNotNull(executionResult.getExecutionId());

}

Expand Down

0 comments on commit c059957

Please sign in to comment.