diff --git a/.github/workflows/app-test.yml b/.github/workflows/app-test.yml deleted file mode 100644 index f101ae2..0000000 --- a/.github/workflows/app-test.yml +++ /dev/null @@ -1,82 +0,0 @@ -name: Test application (test + coverage) - -on: - workflow_dispatch: - pull_request: - paths: - - 'src/**' - -permissions: - id-token: write - statuses: write - checks: write - # may also be read - contents: write - pull-requests: write - actions: write - -jobs: - test-app: - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Set up Java 17 - uses: actions/setup-java@v3 - with: - distribution: 'temurin' - java-version: '17' - - - name: Setup .NET Core # Required to execute ReportGenerator - uses: actions/setup-dotnet@v3 - if: success() || failure() - with: - dotnet-version: 6.x - dotnet-quality: 'ga' - - - name: Setup Gradle - uses: gradle/gradle-build-action@v2 - - - name: Test app - run: ./gradlew test - - - name: Get coverage - if: success() || failure() - run: ./gradlew jacocoTestReport - - - name: Generate test report - uses: dorny/test-reporter@v1.6.0 - if: success() || failure() - with: - name: Test results - path: 'build/test-results/test/*.xml' - reporter: java-junit - fail-on-error: false - - - name: Generate code coverage report - uses: danielpalme/ReportGenerator-GitHub-Action@5.1.25 - if: success() || failure() - with: - reports: build/reports/xml/jacoco - targetdir: coveragereport - reporttypes: MarkdownSummaryGithub - sourcedirs: src/main/java - title: 'Code Coverage' - - - name: Publish code coverage report as job summary - if: success() || failure() - run: cat coveragereport/SummaryGithub.md >> $GITHUB_STEP_SUMMARY - - - name: Publish code coverage report as PR comment - uses: madrapps/jacoco-report@v1.6.1 - if: github.event_name == 'pull_request' && (success() || failure()) - with: - paths: | - ${{ github.workspace }}/build/reports/xml/jacoco - min-coverage-overall: 80 - min-coverage-changed-files: 80 - title: Coverage Report diff --git a/.github/workflows/test-application.yml b/.github/workflows/test-application.yml new file mode 100644 index 0000000..b15a121 --- /dev/null +++ b/.github/workflows/test-application.yml @@ -0,0 +1,82 @@ +name: Test application + +on: + workflow_dispatch: + pull_request: + paths: + - 'src/**' + +permissions: + id-token: write + statuses: write + checks: write + # may also be read + contents: write + pull-requests: write + actions: write + +jobs: + test-app: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set up Java 17 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '17' + + - name: Setup .NET Core # Required to execute ReportGenerator + uses: actions/setup-dotnet@v3 + if: success() || failure() + with: + dotnet-version: 6.x + dotnet-quality: 'ga' + + - name: Setup Gradle + uses: gradle/gradle-build-action@v2 + + - name: Test app + run: ./gradlew test + +# - name: Get coverage +# if: success() || failure() +# run: ./gradlew jacocoTestReport +# +# - name: Generate test report +# uses: dorny/test-reporter@v1.6.0 +# if: success() || failure() +# with: +# name: Test results +# path: 'build/test-results/test/*.xml' +# reporter: java-junit +# fail-on-error: false +# +# - name: Generate code coverage report +# uses: danielpalme/ReportGenerator-GitHub-Action@5.1.25 +# if: success() || failure() +# with: +# reports: build/reports/xml/jacoco +# targetdir: coveragereport +# reporttypes: MarkdownSummaryGithub +# sourcedirs: src/main/java +# title: 'Code Coverage' +# +# - name: Publish code coverage report as job summary +# if: success() || failure() +# run: cat coveragereport/SummaryGithub.md >> $GITHUB_STEP_SUMMARY +# +# - name: Publish code coverage report as PR comment +# uses: madrapps/jacoco-report@v1.6.1 +# if: github.event_name == 'pull_request' && (success() || failure()) +# with: +# paths: | +# ${{ github.workspace }}/build/reports/xml/jacoco +# min-coverage-overall: 80 +# min-coverage-changed-files: 80 +# title: Coverage Report \ No newline at end of file diff --git a/wizard-core/src/main/java/eu/gaiax/wizard/core/service/signer/SignerService.java b/wizard-core/src/main/java/eu/gaiax/wizard/core/service/signer/SignerService.java index e476629..77036ae 100644 --- a/wizard-core/src/main/java/eu/gaiax/wizard/core/service/signer/SignerService.java +++ b/wizard-core/src/main/java/eu/gaiax/wizard/core/service/signer/SignerService.java @@ -125,15 +125,14 @@ private Map prepareCredentialSubjectForLegalParticipant(Particip Map legalRegistrationNumber = this.mapper.convertValue(credential.get(LEGAL_REGISTRATION_NUMBER), typeReference); //Add @context in the credential legalParticipant.put(CONTEXT, this.contextConfig.participant()); - String participantJsonUrl = this.formParticipantJsonUrl(participant.getDomain(), participant.getId()); - legalParticipant.put(TYPE, List.of(VERIFIABLE_CREDENTIAL)); - legalParticipant.put(ID, participantJsonUrl + "#0"); + legalParticipant.put(ID, participant.getDid()); legalParticipant.put(ISSUER, participant.getDid()); String issuanceDate = LocalDateTime.now().atZone(ZoneOffset.UTC).format(DateTimeFormatter.ISO_OFFSET_DATE_TIME); legalParticipant.put(ISSUANCE_DATE, issuanceDate); Map participantCredentialSubject = this.mapper.convertValue(legalParticipant.get(CREDENTIAL_SUBJECT), typeReference); + String participantJsonUrl = this.formParticipantJsonUrl(participant.getDomain(), participant.getId()); participantCredentialSubject.put(ID, participantJsonUrl + "#0"); participantCredentialSubject.put(TYPE, GX_LEGAL_PARTICIPANT); String registrationId = participantJsonUrl + "#1"; @@ -148,7 +147,7 @@ private Map prepareCredentialSubjectForLegalParticipant(Particip Map tncVc = new TreeMap<>(); tncVc.put(CONTEXT, this.contextConfig.tnc()); tncVc.put(TYPE, List.of(VERIFIABLE_CREDENTIAL)); - tncVc.put(ID, participantJsonUrl + "#2"); + tncVc.put(ID, participant.getDid()); tncVc.put(ISSUER, participant.getDid()); tncVc.put(ISSUANCE_DATE, issuanceDate); @@ -289,7 +288,7 @@ public Map signService(Participant participant, CreateServiceOff .serviceOffering(VerifiableCredential.ServiceOffering.builder() .context(this.contextConfig.serviceOffer()) .type(StringPool.VERIFIABLE_CREDENTIAL) - .id(id) + .id(participant.getDid()) .issuer(participant.getDid()) .issuanceDate(issuanceDate) .credentialSubject(request.getCredentialSubject())