Skip to content

Commit

Permalink
chore(bug): added debug in negotiation
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathias Brunkow Moser committed May 11, 2024
1 parent 050b8e0 commit 946caf8
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,7 @@ public void run() {
}

Policy policy = dataTransferService.buildOffer(dataset, set, providerBpn);
LogUtil.printMessage("DEBUG: Policy offer after"+ jsonUtil.toJson(policy, true) );
String builtDataEndpoint = CatenaXUtil.buildDataEndpoint(connectionUrl);
IdResponse negotiationResponse = dataTransferService.doContractNegotiation(policy, builtDataEndpoint);
if (negotiationResponse == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,11 @@ public Policy buildOfferById(Dataset dataset, String policyId, String bpn) {
*
*/
public Policy buildOffer(Dataset dataset, Set policy, String bpn) {
Policy policyOffer = jsonUtil.bind(policy, new TypeReference<>() {});
LogUtil.printMessage("DEBUG: Set before "+ jsonUtil.toJson(policy, true) );

Policy policyOffer = (Policy) policy;
LogUtil.printMessage("DEBUG: Policy offer before "+ jsonUtil.toJson(policyOffer, true) );

return policyOffer.setup(dataset.getAssetId(), bpn, "odrl:Offer");
}
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,7 @@ public Selection<Dataset, Set> selectValidContractAndPolicy(Map<String, Dataset>
List<Selection<Dataset,Set>> validContractSelections = new ArrayList<>(); // Array with possible selections
contracts.keySet().forEach(key -> {
Dataset contract = contracts.get(key); // Get the contract
LogUtil.printMessage("DEBUG: Dataset: " + jsonUtil.toJson(contract, true));

List<Set> policies = policyUtil.getValidPoliciesByConstraints(contract.getPolicy(), policyConfig); // Get all its valid policies
LogUtil.printMessage("DEBUG: list of valid policies: " + jsonUtil.toJson(policies, true));
// If policies are not null or are more than one
if(policies == null || policies.size() == 0){
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,6 @@ public List<Action> parseActions(JsonNode node){
LogUtil.printMessage("DEBUG: Node is not array " +jsonUtil.toJson(node, true));
return new ArrayList<>(){{add(jsonUtil.bind(node, new TypeReference<>(){}));}};
}
LogUtil.printMessage("DEBUG: Node is array " +jsonUtil.toJson(node, true));
// If node is array parse the action node as a list
return jsonUtil.bind(node, new TypeReference<>(){});
}
Expand Down

0 comments on commit 946caf8

Please sign in to comment.