Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: workflow for creating an offering #351

Merged
merged 37 commits into from
Jun 26, 2023

Conversation

ronjaquensel
Copy link
Contributor

Pull Request

Implements the workflow for creating an offering (asset, policy, contract definition) as stated in #182. Adds a model for policies to avoid polymorphism issues in the open-api.yaml. This model currently only supports permissions. Adds an API endpoint for creating an offering with a single API call.

How Has This Been Tested?

The new services have been tested using unit tests (JUnit, AssertJ, Mockito):

  • PolicyMappingServiceTest
  • OfferingServiceTest

In addition, an integration test for the new API endpoint has been added, that tests the Jersey integration as well as integration of the different services:

  • OfferingResourceTest

Linked Issue(s)

Checklist

  • I have formatted the title correctly and precisely
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas and public classes/methods
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings (performed checkstyle check locally)
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have added/updated copyright headers

steffen-biehs and others added 22 commits April 20, 2023 15:03
WIP: Test for empty string input
WIP: Test for empty string input
…into feat/182-create-offering-tests

# Conflicts:
#	extensions/wrapper/wrapper/build.gradle.kts
#	extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/WrapperExtensionContextBuilder.java
#	extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/offering/OfferingResource.java
#	extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/offering/model/CreateOfferingDto.java
#	extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/offering/model/PolicyDefinitionRequestDto.java
#	extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/offering/services/OfferingService.java
#	extensions/wrapper/wrapper/src/test/resources/offering/contract-offer-valid.json
@Schema(description = "Data for creating a policy definition request")
public class PolicyDefinitionRequestDto {
@Schema(description = "ID chosen by the user", requiredMode = Schema.RequiredMode.REQUIRED)
private String id;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be auto generated?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possible ideas:
idOverrideOrNull

Sum type object "PolicySelection": "existingPolicyId", "policyCreateDto"

@Schema(description = """
Expression types:
* `EMPTY` - No constraints for the policy
* `ATOMIC` - A single constraint for the policy
Copy link
Collaborator

@richardtreier richardtreier Jun 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

local consistency: Let's call it the same thing everywhere, e.g. AtomicConstraint, e.g. Literal, e.g. Constraint

transferProcess.setErrorMessage(transferProcessEntity.getErrorDetail());
return transferProcess;
}

@NotNull
private PolicyDto buildPolicyDto(@NonNull Policy policy) {
return new PolicyDto(policy);
var mapper = new ObjectMapper();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Klappt das auch in Randfällen? Brauchen wir keinen vorkonfigurierten Object Mapper vom Core-EDC?

Ggf. könnten ja manche Unterklassen, die uns jetzt nicht bekannt sind, nicht gemappt werden?

Oder wisst ihr, dass der Core-EDC so oder so nichts anderes machen würde?

import lombok.Setter;
import lombok.ToString;
import org.eclipse.edc.connector.api.management.asset.model.AssetEntryDto;
import org.eclipse.edc.connector.api.management.contractdefinition.model.ContractDefinitionRequestDto;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will be removed in 0.1.0

@ronjaquensel ronjaquensel marked this pull request as ready for review June 13, 2023 07:12
@ghost ghost requested a review from richardtreier June 13, 2023 07:13
Copy link
Collaborator

@richardtreier richardtreier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@richardtreier richardtreier merged commit e754e0d into main Jun 26, 2023
@richardtreier richardtreier deleted the feat/182-create-offering-tests branch June 26, 2023 06:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants