diff --git a/.github/ldes-discoverer.Dockerfile b/.github/ldes-discoverer.Dockerfile new file mode 100644 index 000000000..11322b92b --- /dev/null +++ b/.github/ldes-discoverer.Dockerfile @@ -0,0 +1,11 @@ +# syntax=docker/dockerfile:1 + +FROM amazoncorretto:21-alpine-jdk + +RUN adduser -D -u 2000 ldes-discoverer +USER ldes-discoverer +WORKDIR /ldes-discoverer + +COPY ./ldi-extensions/ldes-discoverer/target/ldes-discoverer.jar ./lib/ + +ENTRYPOINT ["java", "-jar", "./lib/ldes-discoverer.jar"] \ No newline at end of file diff --git a/.github/ldio.Dockerfile b/.github/ldio.Dockerfile new file mode 100644 index 000000000..52c5ce510 --- /dev/null +++ b/.github/ldio.Dockerfile @@ -0,0 +1,40 @@ +# syntax=docker/dockerfile:1 + +FROM amazoncorretto:21-alpine-jdk + +RUN adduser -D -u 2000 ldio +USER ldio +WORKDIR /ldio + +COPY ./ldi-orchestrator/ldio-application/target/ldio-application.jar ./ + +COPY ./ldi-orchestrator/ldio-connectors/ldio-http-in/target/ldio-http-in-jar-with-dependencies.jar ./lib/ +COPY ./ldi-orchestrator/ldio-connectors/ldio-http-in-poller/target/ldio-http-in-poller-jar-with-dependencies.jar ./lib/ +COPY ./ldi-orchestrator/ldio-connectors/ldio-ldes-client/target/ldio-ldes-client-jar-with-dependencies.jar ./lib/ +COPY ./ldi-orchestrator/ldio-connectors/ldio-ldes-client-connector/target/ldio-ldes-client-connector-jar-with-dependencies.jar ./lib/ +COPY ./ldi-orchestrator/ldio-connectors/ldio-kafka/target/ldio-kafka-jar-with-dependencies.jar ./lib/ +COPY ./ldi-orchestrator/ldio-connectors/ldio-amqp/target/ldio-amqp-jar-with-dependencies.jar ./lib/ + +COPY ./ldi-orchestrator/ldio-connectors/ldio-rdf-adapter/target/ldio-rdf-adapter-jar-with-dependencies.jar ./lib/ +COPY ./ldi-orchestrator/ldio-connectors/ldio-ngsiv2-to-ld-adapter/target/ldio-ngsiv2-to-ld-adapter-jar-with-dependencies.jar ./lib/ +COPY ./ldi-orchestrator/ldio-connectors/ldio-rml-adapter/target/ldio-rml-adapter-jar-with-dependencies.jar ./lib/ +COPY ./ldi-orchestrator/ldio-connectors/ldio-json-to-ld-adapter/target/ldio-json-to-ld-adapter-jar-with-dependencies.jar ./lib/ + +COPY ./ldi-orchestrator/ldio-connectors/ldio-sparql-construct/target/ldio-sparql-construct-jar-with-dependencies.jar ./lib/ +COPY ./ldi-orchestrator/ldio-connectors/ldio-version-materialiser/target/ldio-version-materialiser-jar-with-dependencies.jar ./lib/ +COPY ./ldi-orchestrator/ldio-connectors/ldio-version-object-creator/target/ldio-version-object-creator-jar-with-dependencies.jar ./lib/ +COPY ./ldi-orchestrator/ldio-connectors/ldio-version-object-creator/target/ldio-version-object-creator-jar-with-dependencies.jar ./lib/ +COPY ./ldi-orchestrator/ldio-connectors/ldio-geojson-to-wkt/target/ldio-geojson-to-wkt-jar-with-dependencies.jar ./lib/ +COPY ./ldi-orchestrator/ldio-connectors/ldio-http-enricher/target/ldio-http-enricher-jar-with-dependencies.jar ./lib/ +COPY ./ldi-orchestrator/ldio-connectors/ldio-change-detection-filter/target/ldio-change-detection-filter-jar-with-dependencies.jar ./lib/ + +COPY ./ldi-orchestrator/ldio-connectors/ldio-console-out/target/ldio-console-out-jar-with-dependencies.jar ./lib/ +COPY ./ldi-orchestrator/ldio-connectors/ldio-http-out/target/ldio-http-out-jar-with-dependencies.jar ./lib/ +COPY ./ldi-orchestrator/ldio-connectors/ldio-noop-out/target/ldio-noop-out-jar-with-dependencies.jar ./lib/ +COPY ./ldi-orchestrator/ldio-connectors/ldio-repository-sink/target/ldio-repository-sink-jar-with-dependencies.jar ./lib/ + + +RUN mkdir "state" +RUN chmod -R 777 ./state + +CMD ["java", "-cp", "ldio-application.jar", "-Dloader.path=lib/", "org.springframework.boot.loader.launch.PropertiesLauncher"] diff --git a/.github/workflows/1.a-build-pr.yml b/.github/workflows/1.a-build-pr.yml index 6fd6f9171..6e21247fc 100644 --- a/.github/workflows/1.a-build-pr.yml +++ b/.github/workflows/1.a-build-pr.yml @@ -14,7 +14,7 @@ on: jobs: build: - name: Build + name: build runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -39,3 +39,56 @@ jobs: - name: Build (Forks) # https://portal.productboard.com/sonarsource/1-sonarcloud/c/50-sonarcloud-analyzes-external-pull-request if: ${{ github.actor == 'dependabot[bot]' || github.event.pull_request.head.repo.fork }} run: mvn -B verify + - name: Upload JARs + uses: actions/upload-artifact@v4 + with: + name: artifacts + path: | + **/*with-dependencies.jar + **/*application.jar + **/ldes-discoverer.jar + + + build-ldio-image: + runs-on: ubuntu-latest + needs: build + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Download JARs + uses: actions/download-artifact@v4 + with: + name: artifacts + path: .github + - name: Build and push Docker image + uses: docker/build-push-action@v3 + with: + context: .github + push: false + file: .github/ldio.Dockerfile + + build-discoverer-image: + runs-on: ubuntu-latest + needs: build + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Download JARs + uses: actions/download-artifact@v4 + with: + name: artifacts + path: .github + - name: Build and push Docker image + uses: docker/build-push-action@v3 + with: + context: .github + push: false + file: .github/ldes-discoverer.Dockerfile diff --git a/.github/workflows/2.a-build-main.yml b/.github/workflows/2.a-build-main.yml deleted file mode 100644 index ce6f4354d..000000000 --- a/.github/workflows/2.a-build-main.yml +++ /dev/null @@ -1,61 +0,0 @@ -# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven - -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. - -name: 2.a Build Project - -on: - push: - branches: - - main - - develop - workflow_dispatch: - -jobs: - build: - name: Build - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - uses: actions/checkout@v4 - - name: Set up JDK 21 - uses: actions/setup-java@v4 - with: - distribution: zulu - java-version: 21 - - name: Cache SonarCloud packages - uses: actions/cache@v1 - with: - path: ~/.sonar/cache - key: ${{ runner.os }}-sonar - restore-keys: ${{ runner.os }}-sonar - - name: Cache Maven packages - uses: actions/cache@v1 - with: - path: ~/.m2 - key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} - restore-keys: ${{ runner.os }}-m2 - - name: Set up Maven Central Repository - uses: actions/setup-java@v4 - with: - java-version: '21' - distribution: 'zulu' - server-id: ossrh - server-username: MAVEN_USERNAME - server-password: MAVEN_PASSWORD - gpg-private-key: ${{ secrets.OSSRH_GPG_SECRET_KEY }} - gpg-passphrase: MAVEN_GPG_PASSPHRASE - - name: Build, analyze and deploy - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} - MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} - MAVEN_GPG_PASSPHRASE: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} - run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar deploy -Dsonar.projectKey=Informatievlaanderen_VSDS-Linked-Data-Interactions -Pcoverage,release diff --git a/.github/workflows/2.b-build-ldes-discoverer-docker.yml b/.github/workflows/2.b-build-ldes-discoverer-docker.yml deleted file mode 100644 index e9f8fcd5d..000000000 --- a/.github/workflows/2.b-build-ldes-discoverer-docker.yml +++ /dev/null @@ -1,83 +0,0 @@ -name: 2.b Build LDES Discoverer Docker - -on: - push: - branches: - - main - - develop - workflow_dispatch: - -env: - REGISTRY: ghcr.io - IMAGE_NAME: ldes-discoverer - -jobs: - build-docker-ldio: - name: Build and push LDI LDES Discoverer image - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - with: - # Temporary workaround for buildx problem - # See: https://github.com/docker/build-push-action/issues/761#issuecomment-1383822381 - driver-opts: | - image=moby/buildkit:v0.10.6 - - name: Set up JDK 21 - uses: actions/setup-java@v4 - with: - distribution: zulu - java-version: 21 - - name: Determine version - run: | - export VERSION=$(mvn help:evaluate -Dexpression="project.version" -q -DforceStdout) - echo "version=$VERSION" >> $GITHUB_ENV - - name: Define docker variables - run: | - if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then - echo "IMAGE_TAG=${{ env.version }}" >> $GITHUB_ENV - echo "IMAGES=ldes/${{ env.IMAGE_NAME }}" >> $GITHUB_ENV - if [[ "${{ env.version }}" != *"SNAPSHOT"* ]]; then - echo "LATEST=latest" >> $GITHUB_ENV - fi - else - echo "IMAGE_TAG=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV - echo "IMAGES=${{ env.REGISTRY }}/Informatievlaanderen/${{ env.IMAGE_NAME }}" >> $GITHUB_ENV - echo "LATEST=latest" >> $GITHUB_ENV - fi - - name: Log in to the DockerHub Container registry - if: github.ref_name == 'main' - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKER_USER }} - password: ${{ secrets.DOCKER_PASSWORD }} - - name: Log in to the GitHub Container registry - if: github.ref_name != 'main' - uses: docker/login-action@v2 - with: - registry: ${{ env.REGISTRY }} - username: Informatievlaanderen - password: ${{ secrets.GITHUB_TOKEN }} - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@v4 - with: - images: ${{ env.IMAGES }} - tags: | - type=raw,value=${{env.IMAGE_TAG}} - type=raw,value=${{env.LATEST}} - - name: Build and push Docker image - uses: docker/build-push-action@v3 - with: - context: . - push: true - file: ldes-discoverer.Dockerfile - tags: ${{ steps.meta.outputs.tags }} - platforms: linux/amd64,linux/arm64 diff --git a/.github/workflows/2.b-build-ldio-docker.yml b/.github/workflows/2.b-build-ldio-docker.yml deleted file mode 100644 index 2fea978e0..000000000 --- a/.github/workflows/2.b-build-ldio-docker.yml +++ /dev/null @@ -1,83 +0,0 @@ -name: 2.b Build LDIO Docker - -on: - push: - branches: - - main - - develop - workflow_dispatch: - -env: - REGISTRY: ghcr.io - IMAGE_NAME: ldi-orchestrator - -jobs: - build-docker-ldio: - name: Build and push LDIO image - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - with: - # Temporary workaround for buildx problem - # See: https://github.com/docker/build-push-action/issues/761#issuecomment-1383822381 - driver-opts: | - image=moby/buildkit:v0.10.6 - - name: Set up JDK 21 - uses: actions/setup-java@v4 - with: - distribution: zulu - java-version: 21 - - name: Determine version - run: | - export VERSION=$(mvn help:evaluate -Dexpression="project.version" -q -DforceStdout) - echo "version=$VERSION" >> $GITHUB_ENV - - name: Define docker variables - run: | - if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then - echo "IMAGE_TAG=${{ env.version }}" >> $GITHUB_ENV - echo "IMAGES=ldes/${{ env.IMAGE_NAME }}" >> $GITHUB_ENV - if [[ "${{ env.version }}" != *"SNAPSHOT"* ]]; then - echo "LATEST=latest" >> $GITHUB_ENV - fi - else - echo "IMAGE_TAG=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV - echo "IMAGES=${{ env.REGISTRY }}/Informatievlaanderen/${{ env.IMAGE_NAME }}" >> $GITHUB_ENV - echo "LATEST=latest" >> $GITHUB_ENV - fi - - name: Log in to the DockerHub Container registry - if: github.ref_name == 'main' - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKER_USER }} - password: ${{ secrets.DOCKER_PASSWORD }} - - name: Log in to the GitHub Container registry - if: github.ref_name != 'main' - uses: docker/login-action@v2 - with: - registry: ${{ env.REGISTRY }} - username: Informatievlaanderen - password: ${{ secrets.GITHUB_TOKEN }} - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@v4 - with: - images: ${{ env.IMAGES }} - tags: | - type=raw,value=${{env.IMAGE_TAG}} - type=raw,value=${{env.LATEST}} - - name: Build and push Docker image - uses: docker/build-push-action@v3 - with: - context: . - push: true - file: ldio.Dockerfile - tags: ${{ steps.meta.outputs.tags }} - platforms: linux/amd64,linux/arm64 diff --git a/.github/workflows/deploy-documentation-old.yml b/.github/workflows/deploy-documentation-old.yml new file mode 100644 index 000000000..29d002286 --- /dev/null +++ b/.github/workflows/deploy-documentation-old.yml @@ -0,0 +1,56 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +# Sample workflow for building and deploying a Jekyll site to GitHub Pages +name: Deploy Documentation to Pages + +on: + # Runs on pushes targeting the default branch + # push: + # branches: ["develop"] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + # Build job + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup Pages + uses: actions/configure-pages@v3 + - name: Build with Jekyll + uses: actions/jekyll-build-pages@v1 + with: + source: ./docs + destination: ./_site + - name: Upload artifact + uses: actions/upload-pages-artifact@v1 + + # Deployment job + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v2 diff --git a/.github/workflows/deploy-documentation.yml b/.github/workflows/deploy-documentation.yml index 90eb47f08..fa54df29b 100644 --- a/.github/workflows/deploy-documentation.yml +++ b/.github/workflows/deploy-documentation.yml @@ -1,56 +1,63 @@ -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. +# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created +# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages -# Sample workflow for building and deploying a Jekyll site to GitHub Pages -name: Deploy Documentation to Pages +name: Build Docs on: - # Runs on pushes targeting the default branch push: - branches: ["develop"] - - # Allows you to run this workflow manually from the Actions tab + branches: + - master + - develop workflow_dispatch: -# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages -permissions: - contents: read - pages: write - id-token: write - -# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. -# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. -concurrency: - group: "pages" - cancel-in-progress: false +env: + base_url: /VSDS-Linked-Data-Interactions + title: "Linked Data Interactions" jobs: - # Build job + build: runs-on: ubuntu-latest + permissions: + contents: read + packages: write steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Setup Pages - uses: actions/configure-pages@v3 + - uses: actions/checkout@v4 + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + distribution: zulu + java-version: 21 + - name: Determine version + id: version + run: | + export VERSION=$(mvn help:evaluate -Dexpression="project.version" -q -DforceStdout) + echo "version=$VERSION" >> $>> $GITHUB_OUTPUT + - name: Setup Ruby + uses: ruby/setup-ruby@0a29871fe2b0200a17a4497bae54fe5df0d973aa + with: + ruby-version: '3.0' # Not needed with a .ruby-version file + bundler-cache: true # runs 'bundle install' and caches installed gems automatically + cache-version: 0 # Increment this number if you need to re-download cached gems - name: Build with Jekyll - uses: actions/jekyll-build-pages@v1 + run: | + cd docs + bundle install + bundle exec jekyll build --baseurl "${{env.base_url}}/${{steps.version.outputs.version}}" -s "./" -d "./_site" + env: + JEKYLL_ENV: production + - uses: actions/setup-node@v3 with: - source: ./docs - destination: ./_site - - name: Upload artifact - uses: actions/upload-pages-artifact@v1 - - # Deployment job - deploy: - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - runs-on: ubuntu-latest - needs: build - steps: - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v2 + node-version: 16 + registry-url: https://npm.pkg.github.com/ + - run: npm i -g @koumoul/gh-pages-multi + - run: | + git config --global user.email "vsds@noreply.com" + git config --global user.name "VSDS CI" + git config --global url.https://${{ env.PAT }}@github.com/.insteadOf https://github.com/ + env: + PAT: ${{secrets.DEPLOY_DOCS_PAT}} + - run: | + gh-pages-multi deploy --title ${{env.title}} -t ${{steps.version.outputs.version}} -s docs/_site + env: + NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/.github/workflows/pr-merged.yml b/.github/workflows/pr-merged.yml new file mode 100644 index 000000000..066a532d9 --- /dev/null +++ b/.github/workflows/pr-merged.yml @@ -0,0 +1,201 @@ +name: 2. Build & Deploy Project + +on: + release: + types: + - published + push: + branches: + - main + - develop + workflow_dispatch: + +env: + REGISTRY: ghcr.io + LDIO_IMAGE_NAME: ldi-orchestrator + DISCOVERER_IMAGE_NAME: ldes-discoverer + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + outputs: + version: ${{ steps.determine-version.outputs.version }} + steps: + - uses: actions/checkout@v4 + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + distribution: zulu + java-version: 21 + - name: Cache SonarCloud packages + uses: actions/cache@v1 + with: + path: ~/.sonar/cache + key: ${{ runner.os }}-sonar + restore-keys: ${{ runner.os }}-sonar + - name: Cache Maven packages + uses: actions/cache@v1 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-m2 + # Maven + - name: Set up Maven Central Repository + uses: actions/setup-java@v4 + with: + java-version: 21 + distribution: 'zulu' + server-id: ossrh + server-username: MAVEN_USERNAME + server-password: MAVEN_PASSWORD + gpg-private-key: ${{ secrets.OSSRH_GPG_SECRET_KEY }} + gpg-passphrase: MAVEN_GPG_PASSPHRASE + + - name: Determine version + id: determine-version + run: | + export VERSION=$(mvn help:evaluate -Dexpression="project.version" -q -DforceStdout) + echo "::set-output name=version::$VERSION" + - name: Analyse & publish package + run: | + mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar deploy -Dsonar.projectKey=Informatievlaanderen_VSDS-Linked-Data-Interactions -Pcoverage,release -Dparallel=all -DperCoreThreadCount=true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} + MAVEN_GPG_PASSPHRASE: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} + + - name: Upload JARs + uses: actions/upload-artifact@v4 + with: + name: artifacts + path: | + **/*with-dependencies.jar + **/*application.jar + **/ldes-discoverer.jar + + + create-ldio-image: + name: Build and push LDIO image + runs-on: ubuntu-latest + needs: build + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Download JARs + uses: actions/download-artifact@v4 + with: + name: artifacts + path: .github + - name: Define docker variables + run: | + if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then + echo "IMAGE_TAG=${{ needs.build.outputs.version }}" >> $GITHUB_ENV + echo "IMAGES=ldes/${{ env.LDIO_IMAGE_NAME }}" >> $GITHUB_ENV + if [[ "${{ needs.build.outputs.version }}" != *"SNAPSHOT"* ]]; then + echo "LATEST=latest" >> $GITHUB_ENV + fi + else + echo "IMAGE_TAG=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV + echo "IMAGES=${{ env.REGISTRY }}/Informatievlaanderen/${{ env.LDIO_IMAGE_NAME }}" >> $GITHUB_ENV + echo "LATEST=latest" >> $GITHUB_ENV + fi + - name: Log in to the DockerHub Container registry + if: github.ref_name == 'main' + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USER }} + password: ${{ secrets.DOCKER_PASSWORD }} + - name: Log in to the GitHub Container registry + if: github.ref_name != 'main' + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: Informatievlaanderen + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.IMAGES }} + tags: | + type=raw,value=${{env.IMAGE_TAG}} + type=raw,value=${{env.LATEST}} + - name: Build and push Docker image + uses: docker/build-push-action@v3 + with: + context: .github + push: true + file: .github/ldio.Dockerfile + tags: ${{ steps.meta.outputs.tags }} + platforms: linux/amd64,linux/arm64 + + + create-discoverer-image: + name: Build and push LDES Discoverer image + runs-on: ubuntu-latest + needs: build + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Download JARs + uses: actions/download-artifact@v4 + with: + name: artifacts + path: .github + - name: Define docker variables + run: | + if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then + echo "IMAGE_TAG=${{ needs.build.outputs.version }}" >> $GITHUB_ENV + echo "IMAGES=ldes/${{ env.DISCOVERER_IMAGE_NAME }}" >> $GITHUB_ENV + if [[ "${{ needs.build.outputs.version }}" != *"SNAPSHOT"* ]]; then + echo "LATEST=latest" >> $GITHUB_ENV + fi + else + echo "IMAGE_TAG=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV + echo "IMAGES=${{ env.REGISTRY }}/Informatievlaanderen/${{ env.DISCOVERER_IMAGE_NAME }}" >> $GITHUB_ENV + echo "LATEST=latest" >> $GITHUB_ENV + fi + - name: Log in to the DockerHub Container registry + if: github.ref_name == 'main' + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USER }} + password: ${{ secrets.DOCKER_PASSWORD }} + - name: Log in to the GitHub Container registry + if: github.ref_name != 'main' + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: Informatievlaanderen + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.IMAGES }} + tags: | + type=raw,value=${{env.IMAGE_TAG}} + type=raw,value=${{env.LATEST}} + - name: Build and push Docker image + uses: docker/build-push-action@v3 + with: + context: .github + push: true + file: .github/ldes-discoverer.Dockerfile + tags: ${{ steps.meta.outputs.tags }} + platforms: linux/amd64,linux/arm64 \ No newline at end of file diff --git a/docs/_ldio/examples/ex3-enrich-model.md b/docs/_ldio/examples/ex3-enrich-model.md index cd445b59b..a34402bc4 100644 --- a/docs/_ldio/examples/ex3-enrich-model.md +++ b/docs/_ldio/examples/ex3-enrich-model.md @@ -16,7 +16,7 @@ We will later use that data to extend our user data Model to include the Car dat - [Http In](../ldio-inputs/ldio-http-in) - [RDF Adapter](../ldio-adapters/ldio-rdf-adapter.md) - [Console Out](../ldio-outputs/ldio-console-out) -- [Repository Materialiser](../ldio-outputs/ldio-repository-materialiser) +- [Repository Sink](../ldio-outputs/ldio-repository-sink) ## Setup diff --git a/docs/_ldio/ldio-inputs/ldio-ldes-client.md b/docs/_ldio/ldio-inputs/ldio-ldes-client.md index eec191826..bab3fcaf1 100644 --- a/docs/_ldio/ldio-inputs/ldio-ldes-client.md +++ b/docs/_ldio/ldio-inputs/ldio-ldes-client.md @@ -45,6 +45,8 @@ To have the possibility to filter out already received members, the "exactly-onc The IDs of all processed members will be remembered by the filter and when a duplicate member is processed, it will be filtered out before sending it to the output of the Client. +Note that this filter can not be enabled with version materialisation. + #### Latest-state-filter When version materialisation is enabled, state objects that does not represent the latest state can be filter out by @@ -177,4 +179,4 @@ this filter to work properly! - When paused, the LDES Client will stop processing the current fragment and will not request new fragments from the server. - When resumed, the LDES Client will continue processing the fragment where it has stopped and it will request new - fragments form the server. \ No newline at end of file + fragments form the server. diff --git a/docs/_ldio/ldio-outputs/ldio-repository-materialiser.md b/docs/_ldio/ldio-outputs/ldio-repository-sink.md similarity index 92% rename from docs/_ldio/ldio-outputs/ldio-repository-materialiser.md rename to docs/_ldio/ldio-outputs/ldio-repository-sink.md index 18d08ff8b..0805b9146 100644 --- a/docs/_ldio/ldio-outputs/ldio-repository-materialiser.md +++ b/docs/_ldio/ldio-outputs/ldio-repository-sink.md @@ -1,14 +1,14 @@ --- layout: default parent: LDIO Outputs -title: Repository Materialiser +title: Repository Sink --- -# Repository Materialiser +# Repository Sink -***Ldio:RepositoryMaterialiser*** +***Ldio:RepositorySink*** -The repository materialiser is used to materialise an LDES stream into a triplestore. +The repository Sink is used to flush an LDES stream into a triplestore. Any triplestore that supports the RDF4J remote repository API can be used. ## Config diff --git a/docs/_ldio/ldio-transformers/ldio-version-object-creator.md b/docs/_ldio/ldio-transformers/ldio-version-object-creator.md index 78837b9ed..83e5810bc 100644 --- a/docs/_ldio/ldio-transformers/ldio-version-object-creator.md +++ b/docs/_ldio/ldio-transformers/ldio-version-object-creator.md @@ -15,9 +15,9 @@ The Version Object Creator will transform a State Object to a Version Object. | Property | Description | Required | Default | Example | Supported values | |:-------------------------|:-------------------------------------------------------------------------------------------------------------------------------|:---------|:------------------------------------------|:------------------------------------------|:-----------------| | _date-observed-property_ | Property path (IRI format '<>') that points to a literal which should be used as timestampPath. Defaults to current timestamp. | No | Current Timestamp | \ | String | -| _member-type_ | Defines the RDF type of the version object | No | N/A | https://example.org/Person | String | +| _member-type_ | Defines the RDF type of the object to be transformed to a version object. | Yes | N/A | https://example.org/Person | String | | _delimiter_ | Defines how the version object id will be constructed. (versionOf + delimiter + dateObserved) | No | / | / | String | -| _generatedAt-property_ | A statement will be added to the model with the observedAt value and the given property. | No | http://www.w3.org/ns/prov#generatedAtTime | http://www.w3.org/ns/prov#generatedAtTime | String | +| _generatedAt-property_ | A statement will be added to the model with the generatedAt value and the given property. | No | http://www.w3.org/ns/prov#generatedAtTime | http://www.w3.org/ns/prov#generatedAtTime | String | | _versionOf-property_ | A statement will be added to the model with the versionOf value and the given property. | No | http://purl.org/dc/terms/isVersionOf | http://purl.org/dc/terms/isVersionOf | String | ## Example @@ -82,7 +82,9 @@ The YAML configuration of this example would be as follows: transformers: - name: Ldio:VersionObjectCreator config: - member-type: http://example.org/Something + member-type: + - http://example.org/Something + - http://example.org/SomethingElse delimiter: "#" date-observed-property: / generatedAt-property: http://www.w3.org/ns/prov#generatedAtTime diff --git a/ldes-discoverer.Dockerfile b/ldes-discoverer.Dockerfile deleted file mode 100644 index 1e96b2019..000000000 --- a/ldes-discoverer.Dockerfile +++ /dev/null @@ -1,24 +0,0 @@ -# syntax=docker/dockerfile:1 - -# -# INSTALL MAVEN DEPENDENCIES -# -FROM maven:3.9.6-amazoncorretto-21 AS builder - -# MAVEN: application -FROM builder AS app-stage -COPY . . -RUN mvn clean install -DskipTests - -# -# RUN THE APPLICATION -# -FROM amazoncorretto:21-alpine-jdk - -RUN adduser -D -u 2000 ldes-discoverer -USER ldes-discoverer -WORKDIR /ldes-discoverer - -COPY --from=app-stage ldi-extensions/ldes-discoverer/target/ldes-discoverer.jar ./lib/ - -ENTRYPOINT ["java", "-jar", "./lib/ldes-discoverer.jar"] \ No newline at end of file diff --git a/ldi-api/pom.xml b/ldi-api/pom.xml index cf00179bf..9b62d0dbb 100644 --- a/ldi-api/pom.xml +++ b/ldi-api/pom.xml @@ -3,7 +3,7 @@ be.vlaanderen.informatievlaanderen.ldes linked-data-interactions - 2.7.0-SNAPSHOT + 2.9.0 4.0.0 diff --git a/ldi-core/README.md b/ldi-core/README.md index 091b5ebd2..082487f8e 100644 --- a/ldi-core/README.md +++ b/ldi-core/README.md @@ -37,6 +37,6 @@ To support the ingestion of input data in [NGSI V2 format](https://fiware-tutori the NgsiV2ToLd processor will take the inputted NGSI V2 data and transform it to [NGSI LD](https://vloca-kennishub.vlaanderen.be/NGSI_(LD)). More information can be found [here](ngsiv2-to-ld-adapter/README.md). -## 6. Repository materialiser +## 6. Repository Sink Allows an eventstream to be materialised in a triple store. More information can be found [here](repository-materialiser/README.md). \ No newline at end of file diff --git a/ldi-core/change-detection-filter/pom.xml b/ldi-core/change-detection-filter/pom.xml index ec37f0188..79c37f102 100644 --- a/ldi-core/change-detection-filter/pom.xml +++ b/ldi-core/change-detection-filter/pom.xml @@ -6,7 +6,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi ldi-core - 2.7.0-SNAPSHOT + 2.9.0 change-detection-filter diff --git a/ldi-core/change-detection-filter/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/repositories/HashedStateMemberRepository.java b/ldi-core/change-detection-filter/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/repositories/HashedStateMemberRepository.java index 722e2eb34..69928c3ac 100644 --- a/ldi-core/change-detection-filter/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/repositories/HashedStateMemberRepository.java +++ b/ldi-core/change-detection-filter/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/repositories/HashedStateMemberRepository.java @@ -15,7 +15,6 @@ public interface HashedStateMemberRepository { boolean containsHashedStateMember(HashedStateMember hashedStateMember); void saveHashedStateMember(HashedStateMember hashedStateMember); - /** * Clean up the resources, should be called when the repository is not used anymore */ diff --git a/ldi-core/file-archiving/pom.xml b/ldi-core/file-archiving/pom.xml index 5a1ad2cf9..8462df169 100644 --- a/ldi-core/file-archiving/pom.xml +++ b/ldi-core/file-archiving/pom.xml @@ -6,7 +6,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi ldi-core - 2.7.0-SNAPSHOT + 2.9.0 file-archiving diff --git a/ldi-core/geojson-to-wkt/pom.xml b/ldi-core/geojson-to-wkt/pom.xml index 41168098c..ebaf3f392 100644 --- a/ldi-core/geojson-to-wkt/pom.xml +++ b/ldi-core/geojson-to-wkt/pom.xml @@ -6,7 +6,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi ldi-core - 2.7.0-SNAPSHOT + 2.9.0 geojson-to-wkt diff --git a/ldi-core/json-to-ld-adapter/pom.xml b/ldi-core/json-to-ld-adapter/pom.xml index c7ca51a5d..555105a31 100644 --- a/ldi-core/json-to-ld-adapter/pom.xml +++ b/ldi-core/json-to-ld-adapter/pom.xml @@ -6,7 +6,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi ldi-core - 2.7.0-SNAPSHOT + 2.9.0 json-to-ld-adapter diff --git a/ldi-core/ldes-client/pom.xml b/ldi-core/ldes-client/pom.xml index 5541d4fea..af562584a 100644 --- a/ldi-core/ldes-client/pom.xml +++ b/ldi-core/ldes-client/pom.xml @@ -5,7 +5,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi ldi-core - 2.7.0-SNAPSHOT + 2.9.0 4.0.0 diff --git a/ldi-core/ldes-client/starting-node/pom.xml b/ldi-core/ldes-client/starting-node/pom.xml index 3cad5c7aa..c427d2ff2 100644 --- a/ldi-core/ldes-client/starting-node/pom.xml +++ b/ldi-core/ldes-client/starting-node/pom.xml @@ -5,7 +5,7 @@ ldes-client be.vlaanderen.informatievlaanderen.ldes.client - 2.7.0-SNAPSHOT + 2.9.0 4.0.0 starting-node diff --git a/ldi-core/ldes-client/tree-node-fetcher/pom.xml b/ldi-core/ldes-client/tree-node-fetcher/pom.xml index f9ece0352..3d9b1e2dd 100644 --- a/ldi-core/ldes-client/tree-node-fetcher/pom.xml +++ b/ldi-core/ldes-client/tree-node-fetcher/pom.xml @@ -5,7 +5,7 @@ ldes-client be.vlaanderen.informatievlaanderen.ldes.client - 2.7.0-SNAPSHOT + 2.9.0 diff --git a/ldi-core/ldes-client/tree-node-relations-fetcher/pom.xml b/ldi-core/ldes-client/tree-node-relations-fetcher/pom.xml index cf333374a..ba2f30a4d 100644 --- a/ldi-core/ldes-client/tree-node-relations-fetcher/pom.xml +++ b/ldi-core/ldes-client/tree-node-relations-fetcher/pom.xml @@ -5,7 +5,7 @@ ldes-client be.vlaanderen.informatievlaanderen.ldes.client - 2.7.0-SNAPSHOT + 2.9.0 4.0.0 diff --git a/ldi-core/ldes-client/tree-node-supplier/pom.xml b/ldi-core/ldes-client/tree-node-supplier/pom.xml index 43f32806d..b1dd16eee 100644 --- a/ldi-core/ldes-client/tree-node-supplier/pom.xml +++ b/ldi-core/ldes-client/tree-node-supplier/pom.xml @@ -5,7 +5,7 @@ ldes-client be.vlaanderen.informatievlaanderen.ldes.client - 2.7.0-SNAPSHOT + 2.9.0 4.0.0 tree-node-supplier diff --git a/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/TreeNodeProcessor.java b/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/TreeNodeProcessor.java index 98d5c2b0c..6d4465123 100644 --- a/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/TreeNodeProcessor.java +++ b/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/TreeNodeProcessor.java @@ -14,9 +14,12 @@ import java.time.LocalDateTime; import java.time.temporal.ChronoUnit; import java.util.List; +import java.util.Objects; import java.util.Optional; +import java.util.function.Consumer; import static java.lang.Thread.sleep; +import static ldes.client.treenodesupplier.domain.valueobject.ClientStatus.*; public class TreeNodeProcessor { @@ -25,13 +28,16 @@ public class TreeNodeProcessor { private final TreeNodeFetcher treeNodeFetcher; private final LdesMetaData ldesMetaData; private final RequestExecutor requestExecutor; + private final Consumer clientStatusConsumer; private MemberRecord memberRecord; public TreeNodeProcessor(LdesMetaData ldesMetaData, StatePersistence statePersistence, - RequestExecutor requestExecutor, TimestampExtractor timestampExtractor) { + RequestExecutor requestExecutor, TimestampExtractor timestampExtractor, + Consumer clientStatusConsumer) { this.treeNodeRecordRepository = statePersistence.getTreeNodeRecordRepository(); this.memberRepository = statePersistence.getMemberRepository(); this.requestExecutor = requestExecutor; + this.clientStatusConsumer = clientStatusConsumer; this.treeNodeFetcher = new TreeNodeFetcher(requestExecutor, timestampExtractor); this.ldesMetaData = ldesMetaData; } @@ -99,11 +105,24 @@ private void saveNewRelations(TreeNodeResponse treeNodeResponse) { } private TreeNodeRecord getNextTreeNode() { - return treeNodeRecordRepository + TreeNodeRecord treeNodeRecord = treeNodeRecordRepository .getTreeNodeRecordWithStatusAndEarliestNextVisit(TreeNodeStatus.IMMUTABLE_WITH_UNPROCESSED_MEMBERS) .orElseGet(() -> treeNodeRecordRepository.getTreeNodeRecordWithStatusAndEarliestNextVisit(TreeNodeStatus.NOT_VISITED) .orElseGet(() -> treeNodeRecordRepository.getTreeNodeRecordWithStatusAndEarliestNextVisit(TreeNodeStatus.MUTABLE_AND_ACTIVE) - .orElseThrow(() -> new EndOfLdesException("No fragments to mutable or new fragments to process -> LDES ends.")))); + .orElseThrow(() -> { + clientStatusConsumer.accept(COMPLETED); + return new EndOfLdesException("No fragments to mutable or new fragments to process -> LDES ends."); + }))); + + if (Objects.requireNonNull(treeNodeRecord.getTreeNodeStatus()) == TreeNodeStatus.IMMUTABLE_WITH_UNPROCESSED_MEMBERS || + treeNodeRecord.getTreeNodeStatus() == TreeNodeStatus.IMMUTABLE_WITHOUT_UNPROCESSED_MEMBERS || + treeNodeRecord.getTreeNodeStatus() == TreeNodeStatus.NOT_VISITED) { + clientStatusConsumer.accept(REPLICATING); + } else if (treeNodeRecord.getTreeNodeStatus() == TreeNodeStatus.MUTABLE_AND_ACTIVE) { + clientStatusConsumer.accept(SYNCHRONISING); + } + + return treeNodeRecord; } private void waitUntilNextVisit(TreeNodeRecord treeNodeRecord) { diff --git a/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/domain/valueobject/ClientStatus.java b/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/domain/valueobject/ClientStatus.java new file mode 100644 index 000000000..b2dc3c64c --- /dev/null +++ b/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/domain/valueobject/ClientStatus.java @@ -0,0 +1,5 @@ +package ldes.client.treenodesupplier.domain.valueobject; + +public enum ClientStatus { + REPLICATING, SYNCHRONISING, COMPLETED, ERROR +} diff --git a/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/filters/ExactlyOnceFilter.java b/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/filters/ExactlyOnceFilter.java index 977ac3be4..e5ee8e427 100644 --- a/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/filters/ExactlyOnceFilter.java +++ b/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/filters/ExactlyOnceFilter.java @@ -20,13 +20,8 @@ public ExactlyOnceFilter(MemberIdRepository memberIdRepository, boolean keepStat } @Override - public boolean isAllowed(SuppliedMember member) { - return !memberIdRepository.contains(member.getId()); - } - - @Override - public void saveAllowedMember(SuppliedMember member) { - memberIdRepository.addMemberId(member.getId()); + public boolean saveMemberIfAllowed(SuppliedMember member) { + return memberIdRepository.addMemberIdIfNotExists(member.getId()); } /** diff --git a/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/filters/LatestStateFilter.java b/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/filters/LatestStateFilter.java index b9b4e3a50..d13d8982b 100644 --- a/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/filters/LatestStateFilter.java +++ b/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/filters/LatestStateFilter.java @@ -36,18 +36,16 @@ public LatestStateFilter(MemberVersionRepository memberVersionRepository, boolea this.versionOfPath = versionOfPath; } - @Override - public boolean isAllowed(SuppliedMember member) { - final String versionOf = extractVersionOf(member); - final LocalDateTime timestamp = extractTimestampWithSubject(member); - return memberVersionRepository.isVersionAfterTimestamp(new MemberVersionRecord(versionOf, timestamp)); - } @Override - public void saveAllowedMember(SuppliedMember member) { + public boolean saveMemberIfAllowed(SuppliedMember member) { final String versionOf = extractVersionOf(member); final LocalDateTime timestamp = extractTimestampWithSubject(member); - memberVersionRepository.addMemberVersion(new MemberVersionRecord(versionOf, timestamp)); + final boolean isAllowed = memberVersionRepository.isVersionAfterTimestamp(new MemberVersionRecord(versionOf, timestamp)); + if (isAllowed) { + memberVersionRepository.addMemberVersion(new MemberVersionRecord(versionOf, timestamp)); + } + return isAllowed; } /** diff --git a/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/filters/MemberFilter.java b/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/filters/MemberFilter.java index b8f58358a..97e960a62 100644 --- a/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/filters/MemberFilter.java +++ b/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/filters/MemberFilter.java @@ -7,19 +7,12 @@ */ public interface MemberFilter { /** - * Checks whether the supplied member can go through the filter + * Saves the member if it is allowed to supply the member * - * @param member member under filtration test - * @return true if the member can go through the filter, otherwise false + * @param member the members that will be checked if it is allowed to supply and saves it if so + * @return whether the member is allowed and saved */ - boolean isAllowed(SuppliedMember member); - - /** - * Saves the newly allowed member, as this can affect the filtration process - * - * @param member member to be saved - */ - void saveAllowedMember(SuppliedMember member); + boolean saveMemberIfAllowed(SuppliedMember member); /** * Release resources when the filter is not required anymore diff --git a/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/membersuppliers/FilteredMemberSupplier.java b/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/membersuppliers/FilteredMemberSupplier.java index e05ed01d1..70395c965 100644 --- a/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/membersuppliers/FilteredMemberSupplier.java +++ b/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/membersuppliers/FilteredMemberSupplier.java @@ -28,11 +28,10 @@ public FilteredMemberSupplier(MemberSupplier memberSupplier, MemberFilter filter @Override public SuppliedMember get() { SuppliedMember member = super.get(); - while (!filter.isAllowed(member)) { + while (!filter.saveMemberIfAllowed(member)) { log.debug("Member {} has been ignored by the {}", member.getId(), filter.getClass().getSimpleName()); member = super.get(); } - filter.saveAllowedMember(member); return member; } diff --git a/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/repository/MemberIdRepository.java b/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/repository/MemberIdRepository.java index 515d9e53a..e38fbdc02 100644 --- a/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/repository/MemberIdRepository.java +++ b/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/repository/MemberIdRepository.java @@ -4,19 +4,14 @@ * Repository that keeps track of the id of the processed members */ public interface MemberIdRepository { + /** - * Saves the memberId to the database + * Saves the memberId to the database if it does not already contain it * * @param memberId id of the member to save + * @return true if the member has already been saved, otherwise false */ - void addMemberId(String memberId); - - /** - * Checks whether the id of the member already has been processed - * @param memberId id of the member to be checked - * @return true if the member already has been saved, otherwise false - */ - boolean contains(String memberId); + boolean addMemberIdIfNotExists(String memberId); /** * Cleans the database diff --git a/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/repository/inmemory/InMemoryMemberIdRepository.java b/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/repository/inmemory/InMemoryMemberIdRepository.java index ce63d8f65..7f989cdae 100644 --- a/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/repository/inmemory/InMemoryMemberIdRepository.java +++ b/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/repository/inmemory/InMemoryMemberIdRepository.java @@ -9,13 +9,12 @@ public class InMemoryMemberIdRepository implements MemberIdRepository { private final List memberIds = new ArrayList<>(); @Override - public void addMemberId(String memberId) { + public boolean addMemberIdIfNotExists(String memberId) { + if (memberIds.contains(memberId)) { + return false; + } memberIds.add(memberId); - } - - @Override - public boolean contains(String memberId) { - return memberIds.contains(memberId); + return true; } @Override diff --git a/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/repository/mapper/MemberRecordEntityMapper.java b/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/repository/mapper/MemberRecordEntityMapper.java index 2e2456145..d74e9feea 100644 --- a/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/repository/mapper/MemberRecordEntityMapper.java +++ b/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/repository/mapper/MemberRecordEntityMapper.java @@ -4,21 +4,27 @@ import ldes.client.treenodesupplier.domain.entities.MemberRecord; import org.apache.jena.rdf.model.Model; import org.apache.jena.riot.Lang; -import org.apache.jena.riot.RDFParserBuilder; +import org.apache.jena.riot.RDFParser; import org.apache.jena.riot.RDFWriter; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; + public class MemberRecordEntityMapper { private MemberRecordEntityMapper() { } public static MemberRecordEntity fromMemberRecord(MemberRecord treeMember) { final Model model = treeMember.getModel(); - final String localModalString = model != null ? RDFWriter.source(model).lang(Lang.TURTLE).asString() : null; - return new MemberRecordEntity(treeMember.getMemberId(), treeMember.getCreatedAt(), localModalString); + ByteArrayOutputStream stream = new ByteArrayOutputStream(); + RDFWriter.source(model).lang(Lang.RDFPROTO).output(stream); + final byte[] bytes = stream.toByteArray(); + return new MemberRecordEntity(treeMember.getMemberId(), treeMember.getCreatedAt(), bytes); } public static MemberRecord toMemberRecord(MemberRecordEntity memberRecordEntity) { - final Model model = RDFParserBuilder.create().fromString(memberRecordEntity.getModelAsString()).lang(Lang.TURTLE).toModel(); + final byte[] bytes = memberRecordEntity.getModelAsBytes(); + final Model model = RDFParser.source(new ByteArrayInputStream(bytes)).lang(Lang.RDFPROTO).toModel(); return new MemberRecord(memberRecordEntity.getMemberId(), model, memberRecordEntity.getCreatedAt()); } } diff --git a/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/repository/sql/SqlMemberIdRepository.java b/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/repository/sql/SqlMemberIdRepository.java index 2f57bfdab..7fd149f2b 100644 --- a/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/repository/sql/SqlMemberIdRepository.java +++ b/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/repository/sql/SqlMemberIdRepository.java @@ -1,39 +1,30 @@ package ldes.client.treenodesupplier.repository.sql; import be.vlaanderen.informatievlaanderen.ldes.ldi.EntityManagerFactory; -import be.vlaanderen.informatievlaanderen.ldes.ldi.entities.MemberIdRecordEntity; import ldes.client.treenodesupplier.repository.MemberIdRepository; -import javax.persistence.EntityManager; +import javax.transaction.Transactional; public class SqlMemberIdRepository implements MemberIdRepository { - final EntityManagerFactory entityManagerFactory; - private final EntityManager entityManager; - private final String instanceName; + private final EntityManagerFactory entityManagerFactory; + private final String instanceName; - public SqlMemberIdRepository(String instanceName, EntityManagerFactory entityManagerFactory) { - this.entityManagerFactory = entityManagerFactory; - this.entityManager = entityManagerFactory.getEntityManager(); - this.instanceName = instanceName; - } + public SqlMemberIdRepository(String instanceName, EntityManagerFactory entityManagerFactory) { + this.entityManagerFactory = entityManagerFactory; + this.instanceName = instanceName; + } - @Override - public void addMemberId(String memberId) { - MemberIdRecordEntity memberRecordEntity = MemberIdRecordEntity.fromId(memberId); - entityManager.getTransaction().begin(); - entityManager.persist(memberRecordEntity); - entityManager.getTransaction().commit(); - } + @Transactional + @Override + public boolean addMemberIdIfNotExists(String memberId) { + return entityManagerFactory.executeStatelessQuery(session -> session + .createNamedQuery("MemberId.insert") + .setParameter("memberId", memberId) + .executeUpdate()) > 0; + } - @Override - public boolean contains(String memberId) { - return entityManager.createNamedQuery("MemberId.get", MemberIdRecordEntity.class) - .setParameter("id", memberId) - .getResultStream() - .findAny().isPresent(); - } - @Override - public void destroyState() { - entityManagerFactory.destroyState(instanceName); - } + @Override + public void destroyState() { + entityManagerFactory.destroyState(instanceName); + } } diff --git a/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/repository/sql/SqlMemberRepository.java b/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/repository/sql/SqlMemberRepository.java index 8befe7c86..a1f9653ee 100644 --- a/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/repository/sql/SqlMemberRepository.java +++ b/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/repository/sql/SqlMemberRepository.java @@ -9,46 +9,39 @@ import java.util.Optional; import java.util.stream.Stream; -import javax.persistence.EntityManager; - public class SqlMemberRepository implements MemberRepository { - final EntityManagerFactory entityManagerFactory; - private final EntityManager entityManager; + private final EntityManagerFactory entityManagerFactory; private final String instanceName; public SqlMemberRepository(String instanceName, EntityManagerFactory entityManagerFactory) { this.entityManagerFactory = entityManagerFactory; - this.entityManager = entityManagerFactory.getEntityManager(); this.instanceName = instanceName; } @Override public Optional getTreeMember() { - - return entityManager - .createNamedQuery("Member.getFirst", MemberRecordEntity.class) + return entityManagerFactory.getEntityManager() + .createNamedQuery("Member.getAllOrderedByCreation", MemberRecordEntity.class) + .setMaxResults(1) .getResultStream() - .map(MemberRecordEntityMapper::toMemberRecord) - .findFirst(); - + .findFirst() + .map(MemberRecordEntityMapper::toMemberRecord); } @Override public void deleteMember(MemberRecord member) { - entityManager.getTransaction().begin(); - entityManager + entityManagerFactory.executeStatelessQuery(session -> session .createNamedQuery("Member.deleteByMemberId") .setParameter("memberId", member.getMemberId()) - .executeUpdate(); - entityManager.getTransaction().commit(); + .executeUpdate()); } @Override public void saveTreeMembers(Stream treeMemberStream) { - entityManager.getTransaction().begin(); + entityManagerFactory.getEntityManager().getTransaction().begin(); treeMemberStream.map(MemberRecordEntityMapper::fromMemberRecord) - .forEach(entityManager::merge); - entityManager.getTransaction().commit(); + .forEach(entityManagerFactory.getEntityManager()::merge); + entityManagerFactory.getEntityManager().getTransaction().commit(); } @Override diff --git a/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/repository/sql/SqlMemberVersionRepository.java b/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/repository/sql/SqlMemberVersionRepository.java index da729f726..0e1b54011 100644 --- a/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/repository/sql/SqlMemberVersionRepository.java +++ b/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/repository/sql/SqlMemberVersionRepository.java @@ -6,29 +6,26 @@ import ldes.client.treenodesupplier.repository.MemberVersionRepository; import ldes.client.treenodesupplier.repository.mapper.MemberVersionRecordEntityMapper; -import javax.persistence.EntityManager; - public class SqlMemberVersionRepository implements MemberVersionRepository { private final EntityManagerFactory entityManagerFactory; - private final EntityManager entityManager; private final String instanceName; - public SqlMemberVersionRepository(EntityManagerFactory entityManagerFactory, - String instanceName) { + public SqlMemberVersionRepository(EntityManagerFactory entityManagerFactory, String instanceName) { this.entityManagerFactory = entityManagerFactory; - this.entityManager = entityManagerFactory.getEntityManager(); this.instanceName = instanceName; } @Override public void addMemberVersion(MemberVersionRecord memberVersion) { - entityManager.merge(MemberVersionRecordEntityMapper.fromMemberVersionRecord(memberVersion)); + entityManagerFactory.getEntityManager() + .merge(MemberVersionRecordEntityMapper.fromMemberVersionRecord(memberVersion)); } @Override public boolean isVersionAfterTimestamp(MemberVersionRecord memberVersion) { - return entityManager.createNamedQuery("MemberVersion.findMemberVersionAfterTimestamp", MemberVersionRecordEntity.class) + return entityManagerFactory.getEntityManager() + .createNamedQuery("MemberVersion.findMemberVersionAfterTimestamp", MemberVersionRecordEntity.class) .setParameter("versionOf", memberVersion.getVersionOf()) .setParameter("timestamp", memberVersion.getTimestamp()) .getResultStream() @@ -40,5 +37,4 @@ public boolean isVersionAfterTimestamp(MemberVersionRecord memberVersion) { public void destroyState() { entityManagerFactory.destroyState(instanceName); } - } diff --git a/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/repository/sql/SqlTreeNodeRepository.java b/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/repository/sql/SqlTreeNodeRepository.java index 85be0ce4c..7ecc64f2d 100644 --- a/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/repository/sql/SqlTreeNodeRepository.java +++ b/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/repository/sql/SqlTreeNodeRepository.java @@ -34,19 +34,20 @@ public void saveTreeNodeRecord(TreeNodeRecord treeNodeRecord) { @Override public boolean existsById(String treeNodeId) { return entityManager - .createNamedQuery("TreeNode.countById", Long.class) + .createNamedQuery("TreeNode.getById", TreeNodeRecordEntity.class) .setParameter("id", treeNodeId) - .getSingleResult() > 0; + .setMaxResults(1) + .getResultStream() + .findFirst() + .isPresent(); } @Override public Optional getTreeNodeRecordWithStatusAndEarliestNextVisit(TreeNodeStatus treeNodeStatus) { return entityManager - .createQuery("SELECT t FROM TreeNodeRecordEntity t" + - " WHERE t.treeNodeStatus = :treeNodeStatus" + - " ORDER BY t.earliestNextVisit", - TreeNodeRecordEntity.class) + .createNamedQuery("TreeNode.getByStatusAndDate", TreeNodeRecordEntity.class) .setParameter("treeNodeStatus", treeNodeStatus.name()) + .setMaxResults(1) .getResultStream() .findFirst() .map(TreeNodeRecordEntityMapper::toTreeNode); @@ -54,11 +55,14 @@ public Optional getTreeNodeRecordWithStatusAndEarliestNextVisit( @Override public boolean existsByIdAndStatus(String treeNodeId, TreeNodeStatus treeNodeStatus) { - return ((Number) entityManager - .createNamedQuery("TreeNode.countByIdAndStatus") + return entityManager + .createNamedQuery("TreeNode.getByIdAndStatus", TreeNodeRecordEntity.class) .setParameter("id", treeNodeId) .setParameter("treeNodeStatus", treeNodeStatus.name()) - .getSingleResult()).longValue() > 0; + .setMaxResults(1) + .getResultStream() + .findFirst() + .isPresent(); } @Override @@ -69,8 +73,11 @@ public void destroyState() { @Override public boolean containsTreeNodeRecords() { return entityManager - .createNamedQuery("TreeNode.count", Long.class) - .getSingleResult() > 0; + .createNamedQuery("TreeNode.getAll", TreeNodeRecordEntity.class) + .setMaxResults(1) + .getResultStream() + .findFirst() + .isPresent(); } @Override diff --git a/ldi-core/ldes-client/tree-node-supplier/src/test/java/ldes/client/performance/TreeNodeProcessorFactory.java b/ldi-core/ldes-client/tree-node-supplier/src/test/java/ldes/client/performance/TreeNodeProcessorFactory.java index db301dbea..311f71e4a 100644 --- a/ldi-core/ldes-client/tree-node-supplier/src/test/java/ldes/client/performance/TreeNodeProcessorFactory.java +++ b/ldi-core/ldes-client/tree-node-supplier/src/test/java/ldes/client/performance/TreeNodeProcessorFactory.java @@ -19,9 +19,11 @@ import ldes.client.treenodesupplier.repository.MemberVersionRepository; import ldes.client.treenodesupplier.repository.TreeNodeRecordRepository; import org.apache.jena.riot.Lang; +import org.mockito.Mockito; import org.testcontainers.containers.PostgreSQLContainer; import java.util.List; +import java.util.function.Consumer; class TreeNodeProcessorFactory { @@ -36,7 +38,7 @@ TreeNodeProcessor createTreeNodeProcessor(StatePersistenceStrategy statePersiste }; final RequestExecutor requestExecutor = requestExecutorFactory.createNoAuthExecutor(); final TimestampExtractor timestampExtractor = new TimestampFromCurrentTimeExtractor(); - return new TreeNodeProcessor(ldesMetaData, statePersistence, requestExecutor, timestampExtractor); + return new TreeNodeProcessor(ldesMetaData, statePersistence, requestExecutor, timestampExtractor, Mockito.mock(Consumer.class)); } private PostgreSQLContainer startPostgresContainer() { diff --git a/ldi-core/ldes-client/tree-node-supplier/src/test/java/ldes/client/treenodesupplier/MemberSupplierSteps.java b/ldi-core/ldes-client/tree-node-supplier/src/test/java/ldes/client/treenodesupplier/MemberSupplierSteps.java index 8856e5529..0c5c84ab8 100644 --- a/ldi-core/ldes-client/tree-node-supplier/src/test/java/ldes/client/treenodesupplier/MemberSupplierSteps.java +++ b/ldi-core/ldes-client/tree-node-supplier/src/test/java/ldes/client/treenodesupplier/MemberSupplierSteps.java @@ -15,10 +15,7 @@ import ldes.client.treenodesupplier.domain.services.MemberRepositoryFactory; import ldes.client.treenodesupplier.domain.services.MemberVersionRepositoryFactory; import ldes.client.treenodesupplier.domain.services.TreeNodeRecordRepositoryFactory; -import ldes.client.treenodesupplier.domain.valueobject.LdesMetaData; -import ldes.client.treenodesupplier.domain.valueobject.StatePersistence; -import ldes.client.treenodesupplier.domain.valueobject.SuppliedMember; -import ldes.client.treenodesupplier.domain.valueobject.TreeNodeStatus; +import ldes.client.treenodesupplier.domain.valueobject.*; import ldes.client.treenodesupplier.filters.ExactlyOnceFilter; import ldes.client.treenodesupplier.filters.LatestStateFilter; import ldes.client.treenodesupplier.filters.MemberFilter; @@ -31,9 +28,11 @@ import ldes.client.treenodesupplier.repository.TreeNodeRecordRepository; import org.apache.jena.riot.Lang; import org.junit.After; +import org.mockito.Mockito; import org.testcontainers.containers.PostgreSQLContainer; import java.util.List; +import java.util.function.Consumer; import static org.apache.jena.rdf.model.ResourceFactory.createProperty; import static org.assertj.core.api.Assertions.assertThat; @@ -50,6 +49,7 @@ public class MemberSupplierSteps { private LdesMetaData ldesMetaData; private SuppliedMember suppliedMember; private PostgreSQLContainer postgreSQLContainer; + private final Consumer clientStatusConsumer = Mockito.mock(Consumer.class); // Multi MemberSupplier private final MemberSupplier[] memberSuppliers = new MemberSupplier[2]; @@ -105,7 +105,8 @@ public void iCreateAProcessor() { treeNodeProcessor = new TreeNodeProcessor(ldesMetaData, new StatePersistence(memberRepository, memberIdRepository, treeNodeRecordRepository, memberVersionRepository), requestExecutorFactory.createNoAuthExecutor(), - timestampPath.isEmpty() ? new TimestampFromCurrentTimeExtractor() : new TimestampFromPathExtractor(createProperty(timestampPath))); + timestampPath.isEmpty() ? new TimestampFromCurrentTimeExtractor() : new TimestampFromPathExtractor(createProperty(timestampPath)), + clientStatusConsumer); } @Then("Member {string} is processed") @@ -206,11 +207,11 @@ public void aStatePersistenceStrategyProcessorAndAStatePersistenceStrategyProces memberSuppliers[0] = new MemberSupplierImpl(new TreeNodeProcessor(ldesMetaData, defineStatePersistence(arg0), requestExecutorFactory.createNoAuthExecutor(), - new TimestampFromPathExtractor(createProperty(timestampPath))), false); + new TimestampFromPathExtractor(createProperty(timestampPath)), clientStatusConsumer), false); memberSuppliers[1] = new MemberSupplierImpl(new TreeNodeProcessor(ldesMetaData, defineStatePersistence(arg1), requestExecutorFactory.createNoAuthExecutor(), - new TimestampFromPathExtractor(createProperty(timestampPath))), false); + new TimestampFromPathExtractor(createProperty(timestampPath)), clientStatusConsumer), false); } @When("I request one member from the MemberSuppliers") diff --git a/ldi-core/ldes-client/tree-node-supplier/src/test/java/ldes/client/treenodesupplier/domain/valueobject/SuppliedMemberTest.java b/ldi-core/ldes-client/tree-node-supplier/src/test/java/ldes/client/treenodesupplier/domain/valueobject/SuppliedMemberTest.java index 7e324ac35..38e13e4cf 100644 --- a/ldi-core/ldes-client/tree-node-supplier/src/test/java/ldes/client/treenodesupplier/domain/valueobject/SuppliedMemberTest.java +++ b/ldi-core/ldes-client/tree-node-supplier/src/test/java/ldes/client/treenodesupplier/domain/valueobject/SuppliedMemberTest.java @@ -4,7 +4,7 @@ import org.apache.jena.rdf.model.ModelFactory; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.*; +import static org.assertj.core.api.Assertions.assertThat; class SuppliedMemberTest { @@ -13,8 +13,9 @@ void when_SuppliedMemberIsCreated_ModelIsDeepCopied() { Model model = ModelFactory.createDefaultModel(); SuppliedMember suppliedMember = new SuppliedMember("id", model); - model = null; - assertNotNull(suppliedMember.getModel()); + assertThat(suppliedMember.getModel()) + .isNotNull() + .matches(Model::isEmpty); } } \ No newline at end of file diff --git a/ldi-core/ldes-client/tree-node-supplier/src/test/java/ldes/client/treenodesupplier/filters/LatestStateFilterTest.java b/ldi-core/ldes-client/tree-node-supplier/src/test/java/ldes/client/treenodesupplier/filters/LatestStateFilterTest.java index 3336e6f8a..9f53ca718 100644 --- a/ldi-core/ldes-client/tree-node-supplier/src/test/java/ldes/client/treenodesupplier/filters/LatestStateFilterTest.java +++ b/ldi-core/ldes-client/tree-node-supplier/src/test/java/ldes/client/treenodesupplier/filters/LatestStateFilterTest.java @@ -41,9 +41,10 @@ void given_OlderVersionObjectInRepo_when_IsAllowed_then_ReturnTrue() { final SuppliedMember newerMember = new SuppliedMember(memberId, newerModel); when(memberVersionRepository.isVersionAfterTimestamp(new MemberVersionRecord(VERSION_OF, newerTimestamp))).thenReturn(true); - final boolean actual = latestStateFilter.isAllowed(newerMember); + final boolean actual = latestStateFilter.saveMemberIfAllowed(newerMember); assertThat(actual).isTrue(); + verify(memberVersionRepository).addMemberVersion(new MemberVersionRecord(VERSION_OF, any())); } @Test @@ -52,16 +53,19 @@ void given_NewerVersionObjectInRepo_when_IsAllowed_then_ReturnFalse() { final SuppliedMember olderMember = new SuppliedMember(memberId, createModel()); when(memberVersionRepository.isVersionAfterTimestamp(new MemberVersionRecord(VERSION_OF, olderTimestamp))).thenReturn(false); - final boolean actual = latestStateFilter.isAllowed(olderMember); + final boolean actual = latestStateFilter.saveMemberIfAllowed(olderMember); assertThat(actual).isFalse(); + verify(memberVersionRepository, never()).addMemberVersion(new MemberVersionRecord(VERSION_OF, any())); } @Test void test_saveAllowedMember() { final SuppliedMember member = new SuppliedMember(memberId, createModel()); + when(memberVersionRepository.isVersionAfterTimestamp(any())).thenReturn(true); + - latestStateFilter.saveAllowedMember(member); + latestStateFilter.saveMemberIfAllowed(member); verify(memberVersionRepository).addMemberVersion(new MemberVersionRecord(VERSION_OF, any())); diff --git a/ldi-core/ldes-client/tree-node-supplier/src/test/java/ldes/client/treenodesupplier/repository/sql/SqlMemberVersionRepositoryTest.java b/ldi-core/ldes-client/tree-node-supplier/src/test/java/ldes/client/treenodesupplier/repository/sql/SqlMemberVersionRepositoryTest.java index e8ae47627..d8e8dab0d 100644 --- a/ldi-core/ldes-client/tree-node-supplier/src/test/java/ldes/client/treenodesupplier/repository/sql/SqlMemberVersionRepositoryTest.java +++ b/ldi-core/ldes-client/tree-node-supplier/src/test/java/ldes/client/treenodesupplier/repository/sql/SqlMemberVersionRepositoryTest.java @@ -35,12 +35,12 @@ class SqlMemberVersionRepositoryTest { @BeforeEach void setUp() { - when(entityManagerFactory.getEntityManager()).thenReturn(entityManager); repository = new SqlMemberVersionRepository(entityManagerFactory, instanceName); } @Test void test_addMemberVersion() { + when(entityManagerFactory.getEntityManager()).thenReturn(entityManager); MemberVersionRecord actual = new MemberVersionRecord("versionOf", LocalDateTime.now()); MemberVersionRecordEntity entity = MemberVersionRecordEntityMapper.fromMemberVersionRecord(actual); @@ -51,7 +51,8 @@ void test_addMemberVersion() { @Test void whenNoOlderVersionPresent_isVersionAfterTimestampIsTrue() { - TypedQuery mockedQuery = mock(TypedQuery.class); + when(entityManagerFactory.getEntityManager()).thenReturn(entityManager); + TypedQuery mockedQuery = mock(); when(entityManager.createNamedQuery("MemberVersion.findMemberVersionAfterTimestamp", MemberVersionRecordEntity.class)).thenReturn(mockedQuery); when(mockedQuery.setParameter(anyString(), any())).thenReturn(mockedQuery); @@ -64,6 +65,7 @@ void whenNoOlderVersionPresent_isVersionAfterTimestampIsTrue() { @Test void whenOlderVersionIsPresent_isVersionAfterTimestampIsFalse() { + when(entityManagerFactory.getEntityManager()).thenReturn(entityManager); final String versionOf = "versionOf"; MemberVersionRecordEntity olderVersion = new MemberVersionRecordEntity(versionOf, LocalDateTime.now().minusDays(1)); MemberVersionRecord memberVersion = new MemberVersionRecord(versionOf, LocalDateTime.now()); diff --git a/ldi-core/ldi-common/pom.xml b/ldi-core/ldi-common/pom.xml index 919814076..86ed95483 100644 --- a/ldi-core/ldi-common/pom.xml +++ b/ldi-core/ldi-common/pom.xml @@ -6,7 +6,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi ldi-core - 2.7.0-SNAPSHOT + 2.9.0 ldi-common diff --git a/ldi-core/ldi-infra-sql/pom.xml b/ldi-core/ldi-infra-sql/pom.xml index 793064339..dbee70e91 100644 --- a/ldi-core/ldi-infra-sql/pom.xml +++ b/ldi-core/ldi-infra-sql/pom.xml @@ -6,7 +6,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi ldi-core - 2.7.0-SNAPSHOT + 2.9.0 ldi-infra-sql diff --git a/ldi-core/ldi-infra-sql/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/AbstractEntityManagerFactory.java b/ldi-core/ldi-infra-sql/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/AbstractEntityManagerFactory.java new file mode 100644 index 000000000..655706ee7 --- /dev/null +++ b/ldi-core/ldi-infra-sql/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/AbstractEntityManagerFactory.java @@ -0,0 +1,37 @@ +package be.vlaanderen.informatievlaanderen.ldes.ldi; + +import org.hibernate.Session; +import org.hibernate.StatelessSession; + +import javax.persistence.EntityManager; + +public abstract class AbstractEntityManagerFactory implements EntityManagerFactory { + private final javax.persistence.EntityManagerFactory entityManagerFactory; + private final EntityManager entityManager; + + protected AbstractEntityManagerFactory(javax.persistence.EntityManagerFactory entityManagerFactory) { + this.entityManagerFactory = entityManagerFactory; + this.entityManager = entityManagerFactory.createEntityManager(); + } + + @Override + public EntityManager getEntityManager() { + return entityManager; + } + + @Override + public int executeStatelessQuery(StatelessQueryExecutor queryExecutor) { + final Session session = entityManager.unwrap(Session.class); + return session.doReturningWork(connection -> { + try (final StatelessSession statelessSession = session.getSessionFactory().openStatelessSession(connection)) { + return queryExecutor.execute(statelessSession); + } + }); + } + + @Override + public void destroyState(String instanceName) { + entityManager.close(); + entityManagerFactory.close(); + } +} diff --git a/ldi-core/ldi-infra-sql/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/EntityManagerFactory.java b/ldi-core/ldi-infra-sql/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/EntityManagerFactory.java index 38dc1c0ac..b9822568e 100644 --- a/ldi-core/ldi-infra-sql/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/EntityManagerFactory.java +++ b/ldi-core/ldi-infra-sql/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/EntityManagerFactory.java @@ -11,6 +11,8 @@ public interface EntityManagerFactory { */ EntityManager getEntityManager(); + int executeStatelessQuery(StatelessQueryExecutor queryExecutor); + /** * Destroy the EntityManager and EntityManagerFactory from the javax library for the specified instanceName * diff --git a/ldi-core/ldi-infra-sql/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/StatelessQueryExecutor.java b/ldi-core/ldi-infra-sql/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/StatelessQueryExecutor.java new file mode 100644 index 000000000..88d0953d7 --- /dev/null +++ b/ldi-core/ldi-infra-sql/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/StatelessQueryExecutor.java @@ -0,0 +1,15 @@ +package be.vlaanderen.informatievlaanderen.ldes.ldi; + +import org.hibernate.StatelessSession; + +/** + * Interface to execute any Hibernate query via a stateless session + */ +@FunctionalInterface +public interface StatelessQueryExecutor { + /** + * @param session StatelessSession where on the Hibernate query must be executed + * @return Number of rows affected + */ + int execute(StatelessSession session); +} diff --git a/ldi-core/ldi-infra-sql/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/entities/HashedStateMemberEntity.java b/ldi-core/ldi-infra-sql/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/entities/HashedStateMemberEntity.java index befbdbb97..57af6cf72 100644 --- a/ldi-core/ldi-infra-sql/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/entities/HashedStateMemberEntity.java +++ b/ldi-core/ldi-infra-sql/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/entities/HashedStateMemberEntity.java @@ -5,6 +5,7 @@ @Entity @Table @NamedQuery(name = "HashedStateMember.findMember", query = "FROM HashedStateMemberEntity m WHERE m.id = :memberId AND m.hash = :memberHash") +@NamedNativeQuery(name = "HashedStateMember.insert", query = "INSERT INTO HashedStateMemberEntity(id, hash) VALUES (?, ?) ON CONFLICT DO NOTHING") public class HashedStateMemberEntity { @Id private String id; diff --git a/ldi-core/ldi-infra-sql/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/entities/MemberIdRecordEntity.java b/ldi-core/ldi-infra-sql/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/entities/MemberIdRecordEntity.java index cda8057fc..1812d3c5d 100644 --- a/ldi-core/ldi-infra-sql/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/entities/MemberIdRecordEntity.java +++ b/ldi-core/ldi-infra-sql/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/entities/MemberIdRecordEntity.java @@ -1,21 +1,14 @@ package be.vlaanderen.informatievlaanderen.ldes.ldi.entities; -import javax.persistence.*; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.NamedNativeQuery; +import javax.persistence.Table; @Entity -@Table() -@NamedQuery(name = "MemberId.get", query = "SELECT m FROM MemberIdRecordEntity m WHERE m.id = :id") +@Table +@NamedNativeQuery(name = "MemberId.insert", query = "INSERT INTO MemberIdRecordEntity(id) VALUES (:memberId) ON CONFLICT DO NOTHING") public class MemberIdRecordEntity { - @Id - private String id; - - public MemberIdRecordEntity() { - } - public MemberIdRecordEntity(String id) { - this.id = id; - } - - public static MemberIdRecordEntity fromId(String id) { - return new MemberIdRecordEntity(id); - } + @Id + private String id; } diff --git a/ldi-core/ldi-infra-sql/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/entities/MemberRecordEntity.java b/ldi-core/ldi-infra-sql/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/entities/MemberRecordEntity.java index 7d0f79116..94359b4f0 100644 --- a/ldi-core/ldi-infra-sql/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/entities/MemberRecordEntity.java +++ b/ldi-core/ldi-infra-sql/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/entities/MemberRecordEntity.java @@ -5,9 +5,10 @@ @Entity @Table(indexes = { - @Index(name = "fn_index", columnList = "createdAt") + @Index(name = "idx_members_created_at", columnList = "createdAt"), + @Index(name = "idx_members_member_id", columnList = "memberId") }) -@NamedQuery(name = "Member.getFirst", query = "SELECT m FROM MemberRecordEntity m ORDER BY m.createdAt") +@NamedQuery(name = "Member.getAllOrderedByCreation", query = "SELECT m FROM MemberRecordEntity m ORDER BY m.createdAt") @NamedQuery(name = "Member.deleteByMemberId", query = "DELETE FROM MemberRecordEntity WHERE memberId = :memberId") public class MemberRecordEntity { @@ -18,16 +19,16 @@ public class MemberRecordEntity { private String memberId; private LocalDateTime createdAt; - @Column(name = "model", columnDefinition = "text", length = 10485760) - private String modelAsString; + @Column(name = "model", columnDefinition = "bytea", nullable = false) + private byte[] bytes; public MemberRecordEntity() { } - public MemberRecordEntity(String memberId, LocalDateTime dateCreated, String modelAsString) { + public MemberRecordEntity(String memberId, LocalDateTime dateCreated, byte[] bytes) { this.memberId = memberId; this.createdAt = dateCreated; - this.modelAsString = modelAsString; + this.bytes = bytes; } public int getId() { @@ -42,7 +43,7 @@ public LocalDateTime getCreatedAt() { return createdAt; } - public String getModelAsString() { - return modelAsString; + public byte[] getModelAsBytes() { + return bytes; } } diff --git a/ldi-core/ldi-infra-sql/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/entities/TreeNodeRecordEntity.java b/ldi-core/ldi-infra-sql/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/entities/TreeNodeRecordEntity.java index f034fbf9c..cd2c6e09d 100644 --- a/ldi-core/ldi-infra-sql/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/entities/TreeNodeRecordEntity.java +++ b/ldi-core/ldi-infra-sql/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/entities/TreeNodeRecordEntity.java @@ -1,15 +1,18 @@ package be.vlaanderen.informatievlaanderen.ldes.ldi.entities; +import javax.persistence.*; import java.time.LocalDateTime; import java.util.List; -import javax.persistence.*; - @Entity -@NamedQuery(name = "TreeNode.count", query = "SELECT COUNT(t) FROM TreeNodeRecordEntity t") -@NamedQuery(name = "TreeNode.countById", query = "SELECT COUNT(t) FROM TreeNodeRecordEntity t WHERE t.id = :id") -@NamedQuery(name = "TreeNode.countByIdAndStatus", query = "SELECT COUNT(t) FROM TreeNodeRecordEntity t WHERE t.id = :id and t.treeNodeStatus = :treeNodeStatus") -@NamedQuery(name = "TreeNode.getByTreeNodeStatus", query = "SELECT t FROM TreeNodeRecordEntity t WHERE t.treeNodeStatus = :treeNodeStatus") +@Table(indexes = { + @Index(name="treenoderecordentity_treenodeurl_treenodestatus", columnList = "treeNodeUrl,treeNodeStatus"), + @Index(name="treenoderecordentity_treenodestatus_earliestnextvisit", columnList = "treeNodeStatus,earliestNextVisit") +}) +@NamedQuery(name = "TreeNode.getAll", query = "SELECT t FROM TreeNodeRecordEntity t") +@NamedQuery(name = "TreeNode.getById", query = "SELECT t FROM TreeNodeRecordEntity t WHERE t.id = :id") +@NamedQuery(name = "TreeNode.getByIdAndStatus", query = "SELECT t FROM TreeNodeRecordEntity t WHERE t.id = :id and t.treeNodeStatus = :treeNodeStatus") +@NamedQuery(name = "TreeNode.getByStatusAndDate", query = "SELECT t FROM TreeNodeRecordEntity t WHERE t.treeNodeStatus = :treeNodeStatus ORDER BY t.earliestNextVisit") public class TreeNodeRecordEntity { @Id diff --git a/ldi-core/ldi-infra-sql/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/postgres/PostgresEntityManagerFactory.java b/ldi-core/ldi-infra-sql/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/postgres/PostgresEntityManagerFactory.java index 29141ceb6..378c136c4 100644 --- a/ldi-core/ldi-infra-sql/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/postgres/PostgresEntityManagerFactory.java +++ b/ldi-core/ldi-infra-sql/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/postgres/PostgresEntityManagerFactory.java @@ -1,37 +1,28 @@ package be.vlaanderen.informatievlaanderen.ldes.ldi.postgres; -import be.vlaanderen.informatievlaanderen.ldes.ldi.EntityManagerFactory; +import be.vlaanderen.informatievlaanderen.ldes.ldi.AbstractEntityManagerFactory; -import javax.persistence.EntityManager; import javax.persistence.Persistence; import java.util.HashMap; import java.util.Map; -public class PostgresEntityManagerFactory implements EntityManagerFactory { - +public class PostgresEntityManagerFactory extends AbstractEntityManagerFactory { public static final String PERSISTENCE_UNIT_NAME = "pu-postgres-jpa"; private static final Map instances = new HashMap<>(); - private final EntityManager em; - private final javax.persistence.EntityManagerFactory emf; + private PostgresEntityManagerFactory(Map properties) { - emf = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME, properties); - em = emf.createEntityManager(); + super(Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME, properties)); } public static synchronized PostgresEntityManagerFactory getInstance(String instanceName, Map properties) { return instances.computeIfAbsent(instanceName, s -> new PostgresEntityManagerFactory(properties)); } - @Override - public EntityManager getEntityManager() { - return em; - } @Override public void destroyState(String instanceName) { - em.close(); - emf.close(); + super.destroyState(instanceName); instances.remove(instanceName); // DELETE tables } diff --git a/ldi-core/ldi-infra-sql/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/sqlite/SqliteEntityManagerFactory.java b/ldi-core/ldi-infra-sql/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/sqlite/SqliteEntityManagerFactory.java index 8df74952f..f01ac2d43 100644 --- a/ldi-core/ldi-infra-sql/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/sqlite/SqliteEntityManagerFactory.java +++ b/ldi-core/ldi-infra-sql/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/sqlite/SqliteEntityManagerFactory.java @@ -1,10 +1,9 @@ package be.vlaanderen.informatievlaanderen.ldes.ldi.sqlite; -import be.vlaanderen.informatievlaanderen.ldes.ldi.EntityManagerFactory; +import be.vlaanderen.informatievlaanderen.ldes.ldi.AbstractEntityManagerFactory; import be.vlaanderen.informatievlaanderen.ldes.ldi.HibernateProperties; import org.apache.commons.io.FileUtils; -import javax.persistence.EntityManager; import javax.persistence.Persistence; import java.io.File; import java.io.IOException; @@ -13,19 +12,14 @@ import java.util.HashMap; import java.util.Map; -@SuppressWarnings("java:S2696") -public class SqliteEntityManagerFactory implements EntityManagerFactory { - +public class SqliteEntityManagerFactory extends AbstractEntityManagerFactory { public static final String PERSISTENCE_UNIT_NAME = "pu-sqlite-jpa"; private final SqliteProperties properties; private static final Map instances = new HashMap<>(); - private final EntityManager em; - private final javax.persistence.EntityManagerFactory emf; private SqliteEntityManagerFactory(SqliteProperties properties) { + super(Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME, properties.getProperties())); this.properties = properties; - emf = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME, properties.getProperties()); - em = emf.createEntityManager(); } public static synchronized SqliteEntityManagerFactory getInstance(HibernateProperties hibernateProperties) { @@ -42,15 +36,9 @@ public static synchronized SqliteEntityManagerFactory getInstance(HibernatePrope }); } - @Override - public EntityManager getEntityManager() { - return em; - } - @Override public void destroyState(String instanceName) { - em.close(); - emf.close(); + super.destroyState(instanceName); instances.remove(instanceName); FileUtils.deleteQuietly(new File(properties.getDatabaseDirectory(), properties.getDatabaseName())); } diff --git a/ldi-core/ngsiv2-to-ld-adapter/pom.xml b/ldi-core/ngsiv2-to-ld-adapter/pom.xml index 8f411ab0c..1aaa737aa 100644 --- a/ldi-core/ngsiv2-to-ld-adapter/pom.xml +++ b/ldi-core/ngsiv2-to-ld-adapter/pom.xml @@ -6,7 +6,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi ldi-core - 2.7.0-SNAPSHOT + 2.9.0 ngsiv2-to-ld-adapter diff --git a/ldi-core/pom.xml b/ldi-core/pom.xml index 6f2976a9a..83161e338 100644 --- a/ldi-core/pom.xml +++ b/ldi-core/pom.xml @@ -3,7 +3,7 @@ linked-data-interactions be.vlaanderen.informatievlaanderen.ldes - 2.7.0-SNAPSHOT + 2.9.0 4.0.0 @@ -23,7 +23,7 @@ rml-adapter json-to-ld-adapter file-archiving - repository-materialiser + repository-sink ldi-common change-detection-filter ldi-infra-sql diff --git a/ldi-core/rdf-adapter/pom.xml b/ldi-core/rdf-adapter/pom.xml index 7a66a1e1e..313745a21 100644 --- a/ldi-core/rdf-adapter/pom.xml +++ b/ldi-core/rdf-adapter/pom.xml @@ -5,7 +5,7 @@ ldi-core be.vlaanderen.informatievlaanderen.ldes.ldi - 2.7.0-SNAPSHOT + 2.9.0 4.0.0 diff --git a/ldi-core/repository-materialiser/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/exceptions/MaterialisationFailedException.java b/ldi-core/repository-materialiser/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/exceptions/MaterialisationFailedException.java deleted file mode 100644 index 671186f4d..000000000 --- a/ldi-core/repository-materialiser/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/exceptions/MaterialisationFailedException.java +++ /dev/null @@ -1,12 +0,0 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldi.exceptions; - -public class MaterialisationFailedException extends RuntimeException { - public MaterialisationFailedException(Exception e) { - super(e); - } - - @Override - public String getMessage() { - return "Materialisation to triples store failed: %s".formatted(getCause().getMessage()); - } -} diff --git a/ldi-core/repository-materialiser/README.md b/ldi-core/repository-sink/README.md similarity index 91% rename from ldi-core/repository-materialiser/README.md rename to ldi-core/repository-sink/README.md index a41021a60..3cda0886a 100644 --- a/ldi-core/repository-materialiser/README.md +++ b/ldi-core/repository-sink/README.md @@ -1,4 +1,4 @@ -# Repository materialiser +# Repository Sink This component allows an eventstream to be materialised into a repository with a SPARQL endpoint. diff --git a/ldi-core/repository-materialiser/pom.xml b/ldi-core/repository-sink/pom.xml similarity index 97% rename from ldi-core/repository-materialiser/pom.xml rename to ldi-core/repository-sink/pom.xml index b65dcee63..8440a6d32 100644 --- a/ldi-core/repository-materialiser/pom.xml +++ b/ldi-core/repository-sink/pom.xml @@ -6,7 +6,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi ldi-core - 2.7.0-SNAPSHOT + 2.9.0 @@ -16,7 +16,7 @@ 4.3.6 - repository-materialiser + repository-sink diff --git a/ldi-core/repository-materialiser/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/Materialiser.java b/ldi-core/repository-sink/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/RepositorySink.java similarity index 56% rename from ldi-core/repository-materialiser/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/Materialiser.java rename to ldi-core/repository-sink/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/RepositorySink.java index 0c5cfe7b8..32b65a8d7 100644 --- a/ldi-core/repository-materialiser/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/Materialiser.java +++ b/ldi-core/repository-sink/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/RepositorySink.java @@ -1,9 +1,9 @@ package be.vlaanderen.informatievlaanderen.ldes.ldi; -import be.vlaanderen.informatievlaanderen.ldes.ldi.exceptions.MaterialisationFailedException; +import be.vlaanderen.informatievlaanderen.ldes.ldi.exceptions.SinkFailedException; import be.vlaanderen.informatievlaanderen.ldes.ldi.services.JenaToRDF4JConverter; import be.vlaanderen.informatievlaanderen.ldes.ldi.services.ModelSubjectsExtractor; -import be.vlaanderen.informatievlaanderen.ldes.ldi.valueobjects.MaterialiserConnection; +import be.vlaanderen.informatievlaanderen.ldes.ldi.valueobjects.RepositorySinkConnection; import org.apache.jena.rdf.model.Model; import org.eclipse.rdf4j.model.Resource; import org.eclipse.rdf4j.model.Value; @@ -14,56 +14,53 @@ import java.util.Deque; import java.util.List; import java.util.Set; -import java.util.concurrent.CompletableFuture; +import java.util.regex.Pattern; /** * Component that will write linked data models to a specified triples store or RDF repository */ -public class Materialiser { - private final MaterialiserConnection materialiserConnection; +public class RepositorySink { + private static final Pattern SKOLEM_PATTERN = Pattern.compile(".*/.well-known/genid/.*"); + private final RepositorySinkConnection repositorySinkConnection; - public Materialiser(String hostUrl, String repositoryId, String namedGraph) { + public RepositorySink(String hostUrl, String repositoryId, String namedGraph) { this(new RemoteRepositoryManager(hostUrl), repositoryId, namedGraph); } - public Materialiser(RepositoryManager repositoryManager, String repositoryId, String namedGraph) { - this.materialiserConnection = new MaterialiserConnection(repositoryManager, repositoryId, namedGraph); + public RepositorySink(RepositoryManager repositoryManager, String repositoryId, String namedGraph) { + this.repositorySinkConnection = new RepositorySinkConnection(repositoryManager, repositoryId, namedGraph); } - protected MaterialiserConnection getMaterialiserConnection() { - return materialiserConnection; + protected RepositorySinkConnection getRepositoryConnection() { + return repositorySinkConnection; } public void process(List jenaModels) { - synchronized (materialiserConnection) { + synchronized (repositorySinkConnection) { try { jenaModels.stream().map(JenaToRDF4JConverter::convert).forEach(updateModel -> { deleteEntity(updateModel); - materialiserConnection.add(updateModel); + repositorySinkConnection.add(updateModel); }); - materialiserConnection.commit(); + repositorySinkConnection.commit(); } catch (Exception e) { - materialiserConnection.rollback(); - throw new MaterialisationFailedException(e); + repositorySinkConnection.rollback(); + throw new SinkFailedException(e); } } } - public CompletableFuture processAsync(List jenaModels) { - return CompletableFuture.runAsync(() -> process(jenaModels)); - } - public void closeConnection() { - materialiserConnection.close(); + repositorySinkConnection.close(); } public void shutdown() { - materialiserConnection.shutdown(); + repositorySinkConnection.shutdown(); } protected void deleteEntity(org.eclipse.rdf4j.model.Model model) { getAllSubjectsFromModel(model) - .forEach(subject -> materialiserConnection.remove(subject, null, null)); + .forEach(subject -> repositorySinkConnection.remove(subject, null, null)); } private Set getAllSubjectsFromModel(org.eclipse.rdf4j.model.Model model) { @@ -73,13 +70,18 @@ private Set getAllSubjectsFromModel(org.eclipse.rdf4j.model.Model mode while (!subjectStack.isEmpty()) { Resource subject = subjectStack.pop(); - materialiserConnection.getStatements(subject, null, null).forEach(statement -> { + repositorySinkConnection.getStatements(subject, null, null).forEach(statement -> { Value object = statement.getObject(); if (object.isBNode()) { Resource bnode = (Resource) object; subjectStack.push(bnode); subjects.add(bnode); } + if (SKOLEM_PATTERN.matcher(object.stringValue()).matches()) { + Resource bnode = (Resource) object; + subjectStack.push(bnode); + subjects.add(bnode); + } }); } diff --git a/ldi-core/repository-sink/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/exceptions/SinkFailedException.java b/ldi-core/repository-sink/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/exceptions/SinkFailedException.java new file mode 100644 index 000000000..0dc8284f2 --- /dev/null +++ b/ldi-core/repository-sink/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/exceptions/SinkFailedException.java @@ -0,0 +1,12 @@ +package be.vlaanderen.informatievlaanderen.ldes.ldi.exceptions; + +public class SinkFailedException extends RuntimeException { + public SinkFailedException(Exception e) { + super(e); + } + + @Override + public String getMessage() { + return "Flushing to triples store failed: %s".formatted(getCause().getMessage()); + } +} diff --git a/ldi-core/repository-materialiser/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/services/JenaToRDF4JConverter.java b/ldi-core/repository-sink/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/services/JenaToRDF4JConverter.java similarity index 91% rename from ldi-core/repository-materialiser/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/services/JenaToRDF4JConverter.java rename to ldi-core/repository-sink/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/services/JenaToRDF4JConverter.java index 57a35e862..5da60bf2f 100644 --- a/ldi-core/repository-materialiser/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/services/JenaToRDF4JConverter.java +++ b/ldi-core/repository-sink/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/services/JenaToRDF4JConverter.java @@ -2,7 +2,10 @@ import org.apache.jena.rdf.model.Literal; import org.apache.jena.rdf.model.RDFNode; -import org.eclipse.rdf4j.model.*; +import org.eclipse.rdf4j.model.IRI; +import org.eclipse.rdf4j.model.Model; +import org.eclipse.rdf4j.model.Resource; +import org.eclipse.rdf4j.model.Value; import org.eclipse.rdf4j.model.impl.LinkedHashModel; import org.eclipse.rdf4j.model.impl.SimpleValueFactory; diff --git a/ldi-core/repository-materialiser/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/services/ModelSubjectsExtractor.java b/ldi-core/repository-sink/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/services/ModelSubjectsExtractor.java similarity index 100% rename from ldi-core/repository-materialiser/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/services/ModelSubjectsExtractor.java rename to ldi-core/repository-sink/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/services/ModelSubjectsExtractor.java diff --git a/ldi-core/repository-materialiser/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/valueobjects/RepositoryConnectionHolder.java b/ldi-core/repository-sink/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/valueobjects/RepositoryConnectionHolder.java similarity index 100% rename from ldi-core/repository-materialiser/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/valueobjects/RepositoryConnectionHolder.java rename to ldi-core/repository-sink/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/valueobjects/RepositoryConnectionHolder.java diff --git a/ldi-core/repository-materialiser/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/valueobjects/MaterialiserConnection.java b/ldi-core/repository-sink/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/valueobjects/RepositorySinkConnection.java similarity index 83% rename from ldi-core/repository-materialiser/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/valueobjects/MaterialiserConnection.java rename to ldi-core/repository-sink/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/valueobjects/RepositorySinkConnection.java index 177d5e336..55cb9ec4c 100644 --- a/ldi-core/repository-materialiser/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/valueobjects/MaterialiserConnection.java +++ b/ldi-core/repository-sink/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/valueobjects/RepositorySinkConnection.java @@ -12,11 +12,11 @@ * Wrapper around the RepositoryConnectionHolder, to make more an abstraction of the actions that can be done * through the RepositoryConnection and already handling with some overhead of the named graph */ -public class MaterialiserConnection { +public class RepositorySinkConnection { private final String namedGraph; private final RepositoryConnectionHolder holder; - public MaterialiserConnection(RepositoryManager repositoryManager, String repositoryId, String namedGraph) { + public RepositorySinkConnection(RepositoryManager repositoryManager, String repositoryId, String namedGraph) { this.namedGraph = namedGraph; this.holder = new RepositoryConnectionHolder(repositoryManager, repositoryId); } @@ -41,15 +41,15 @@ public void remove(Resource subject, IRI predicate, Value object) { } public void commit() { - final RepositoryConnection connection = holder.getConnection(); - connection.commit(); - connection.close(); + try (RepositoryConnection connection = holder.getConnection()) { + connection.commit(); + } } public void rollback() { - final RepositoryConnection connection = holder.getConnection(); - connection.rollback(); - connection.close(); + try (RepositoryConnection connection = holder.getConnection()) { + connection.rollback(); + } } public void close() { diff --git a/ldi-core/repository-materialiser/src/main/java/org/eclipse/rdf4j/repository/http/CustomHTTPRepositoryConnection.java b/ldi-core/repository-sink/src/main/java/org/eclipse/rdf4j/repository/http/CustomHTTPRepositoryConnection.java similarity index 100% rename from ldi-core/repository-materialiser/src/main/java/org/eclipse/rdf4j/repository/http/CustomHTTPRepositoryConnection.java rename to ldi-core/repository-sink/src/main/java/org/eclipse/rdf4j/repository/http/CustomHTTPRepositoryConnection.java diff --git a/ldi-core/repository-materialiser/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/MaterialiserIT.java b/ldi-core/repository-sink/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/RepositorySinkIT.java similarity index 72% rename from ldi-core/repository-materialiser/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/MaterialiserIT.java rename to ldi-core/repository-sink/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/RepositorySinkIT.java index 42a1281cc..1e65f5437 100644 --- a/ldi-core/repository-materialiser/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/MaterialiserIT.java +++ b/ldi-core/repository-sink/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/RepositorySinkIT.java @@ -33,9 +33,9 @@ import static org.assertj.core.api.Assertions.assertThat; -class MaterialiserIT { +class RepositorySinkIT { private static final String LOCAL_REPOSITORY_ID = "test"; - private static Materialiser materialiser; + private static RepositorySink repositorySink; private RepositoryManager subject; @TempDir File dataDir; @@ -51,22 +51,22 @@ public void setUp() { @AfterEach public void tearDown() { - materialiser.shutdown(); + repositorySink.shutdown(); } @ParameterizedTest @ArgumentsSource(NamedGraphProvider.class) void when_DeleteEntities_Then_EntitiesRemovedFromStore(String namedGraph) throws Exception { - materialiser = new Materialiser(subject, LOCAL_REPOSITORY_ID, namedGraph); + repositorySink = new RepositorySink(subject, LOCAL_REPOSITORY_ID, namedGraph); final int statementOfModel2And3Count = 9; final List testFiles = IntStream.range(1, 4).mapToObj("src/test/resources/people/%d.nq"::formatted).toList(); populateAndCheckRepository(testFiles, namedGraph); final Model modelToDelete = Rio.parse(new FileInputStream("src/test/resources/people/1.nq"), "", RDFFormat.NQUADS); - materialiser.deleteEntity(modelToDelete); + repositorySink.deleteEntity(modelToDelete); - List statements = materialiser.getMaterialiserConnection() + List statements = repositorySink.getRepositoryConnection() .getStatements(null, null, null).stream().toList(); assertThat(statements).hasSize(statementOfModel2And3Count); @@ -75,47 +75,52 @@ void when_DeleteEntities_Then_EntitiesRemovedFromStore(String namedGraph) throws @ParameterizedTest @ArgumentsSource(NamedGraphProvider.class) void when_UpdateEntities_Then_OldTriplesRemoved(String namedGraph) throws Exception { - materialiser = new Materialiser(subject, LOCAL_REPOSITORY_ID, namedGraph); + repositorySink = new RepositorySink(subject, LOCAL_REPOSITORY_ID, namedGraph); - final List testFiles = IntStream.range(1, 6).mapToObj("src/test/resources/people/%d.nq"::formatted).toList(); + final List testFiles = IntStream.rangeClosed(1, 6).mapToObj("src/test/resources/people/%d.nq"::formatted).toList(); populateAndCheckRepository(testFiles, namedGraph); List models = List.of(RDFParser.source("people/5-updated.nq").toModel()); - materialiser.process(models); + repositorySink.process(models); - List statements = materialiser.getMaterialiserConnection() + models = List.of(RDFParser.source("people/6-updated.nq").toModel()); + repositorySink.process(models); + + List statements = repositorySink.getRepositoryConnection() .getStatements(null, null, null).stream().toList(); assertThat(statements) - .hasSize(21) + .hasSize(26) .anyMatch(statement -> statement.getObject().stringValue().equals("CHANGED")) - .noneMatch(statement -> statement.getObject().stringValue().equals("Taylor")); + .noneMatch(statement -> statement.getObject().stringValue().equals("Taylor")) + .noneMatch(statement -> statement.getObject().stringValue().equals("Twift")) + .noneMatch(statement -> statement.getPredicate().stringValue().equals("http://www.w3.org/2001/vcard-rdf/3.0#Nickname")); } @Test void given_TwoDifferentNamedGraphs_when_processModelsWithSameSubjects_then_ExpectNoChangesInOtherNamedGraph() { - materialiser = new Materialiser(subject, LOCAL_REPOSITORY_ID, "http://example.org/named-graph-1"); - final Materialiser secondMaterialiser = new Materialiser(subject, LOCAL_REPOSITORY_ID, "http://example.org/named-graph-2"); + repositorySink = new RepositorySink(subject, LOCAL_REPOSITORY_ID, "http://example.org/named-graph-1"); + final RepositorySink secondRepositorySink = new RepositorySink(subject, LOCAL_REPOSITORY_ID, "http://example.org/named-graph-2"); final org.apache.jena.rdf.model.Model firstJenaModel = RDFParser.source("movies/1.ttl").toModel(); final org.apache.jena.rdf.model.Model secondJenaModel = RDFParser.source("movies/2.ttl").toModel(); - materialiser.process(List.of(firstJenaModel)); - secondMaterialiser.process(List.of(secondJenaModel)); + repositorySink.process(List.of(firstJenaModel)); + secondRepositorySink.process(List.of(secondJenaModel)); Model firstModel = new LinkedHashModel(); Model secondModel = new LinkedHashModel(); - materialiser.getMaterialiserConnection() + repositorySink.getRepositoryConnection() .getStatements(null, null, null) .stream() - .map(MaterialiserIT::deleteContextFromStatement) + .map(RepositorySinkIT::deleteContextFromStatement) .forEach(firstModel::add); - secondMaterialiser.getMaterialiserConnection() + secondRepositorySink.getRepositoryConnection() .getStatements(null, null, null) .stream() - .map(MaterialiserIT::deleteContextFromStatement) + .map(RepositorySinkIT::deleteContextFromStatement) .forEach(secondModel::add); assertThat(firstModel) @@ -124,28 +129,28 @@ void given_TwoDifferentNamedGraphs_when_processModelsWithSameSubjects_then_Expec assertThat(secondModel) .hasSize((int) secondJenaModel.size()); - materialiser.closeConnection(); - secondMaterialiser.closeConnection(); + repositorySink.closeConnection(); + secondRepositorySink.closeConnection(); } @ParameterizedTest @ArgumentsSource(NamedGraphProvider.class) void given_ComplexModelToUpdate_test_Process(String namedGraph) throws IOException { - materialiser = new Materialiser(subject, LOCAL_REPOSITORY_ID, namedGraph); + repositorySink = new RepositorySink(subject, LOCAL_REPOSITORY_ID, namedGraph); final org.apache.jena.rdf.model.Model originalModel = RDFParser.source("movies/1.ttl").toModel(); - materialiser.process(List.of(originalModel)); + repositorySink.process(List.of(originalModel)); final org.apache.jena.rdf.model.Model updatedJenaModel = RDFParser.source("movies/2.ttl").toModel(); final Model updatedRdfModel = Rio.parse(new FileInputStream("src/test/resources/movies/2.ttl"), "", RDFFormat.TURTLE); - materialiser.process(List.of(updatedJenaModel)); + repositorySink.process(List.of(updatedJenaModel)); Model updatedDbModel = new LinkedHashModel(); - materialiser.getMaterialiserConnection() + repositorySink.getRepositoryConnection() .getStatements(null, null, null) .stream() - .map(MaterialiserIT::deleteContextFromStatement) + .map(RepositorySinkIT::deleteContextFromStatement) .forEach(updatedDbModel::add); assertThat(Models.isomorphic(updatedDbModel, updatedRdfModel)).isTrue(); @@ -154,16 +159,16 @@ void given_ComplexModelToUpdate_test_Process(String namedGraph) throws IOExcepti @ParameterizedTest @ArgumentsSource(NamedGraphProvider.class) void given_geoData_when_processModel_then_addValidGeoDataToRepo(String namedGraph) throws IOException { - materialiser = new Materialiser(subject, LOCAL_REPOSITORY_ID, namedGraph); + repositorySink = new RepositorySink(subject, LOCAL_REPOSITORY_ID, namedGraph); final Model expectedModel = Rio.parse(new FileInputStream("src/test/resources/geo/measurement.ttl"), "", RDFFormat.TURTLE); final org.apache.jena.rdf.model.Model inputModel = RDFParser.source("geo/measurement.ttl").toModel(); - materialiser.process(List.of(inputModel)); + repositorySink.process(List.of(inputModel)); Model dbModel = new LinkedHashModel(); - materialiser.getMaterialiserConnection() + repositorySink.getRepositoryConnection() .getStatements(null, null, null) .stream() - .map(MaterialiserIT::deleteContextFromStatement) + .map(RepositorySinkIT::deleteContextFromStatement) .forEach(dbModel::add); assertThat(Models.isomorphic(expectedModel, dbModel)).isTrue(); @@ -173,14 +178,14 @@ void populateAndCheckRepository(List files, String namedGraph) throws IO List models = new ArrayList<>(); for (String testFile : files) { var model = Rio.parse(new FileInputStream(testFile), "", RDFFormat.NQUADS); - materialiser.getMaterialiserConnection().add(model); + repositorySink.getRepositoryConnection().add(model); models.add(model); } - List statements = materialiser.getMaterialiserConnection().getStatements(null, null, null).stream().toList(); + List statements = repositorySink.getRepositoryConnection().getStatements(null, null, null).stream().toList(); if (!namedGraph.isEmpty()) { statements = statements.stream() - .map(MaterialiserIT::deleteContextFromStatement) + .map(RepositorySinkIT::deleteContextFromStatement) .toList(); } diff --git a/ldi-core/repository-materialiser/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/MaterialiserTest.java b/ldi-core/repository-sink/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/RepositorySinkTest.java similarity index 89% rename from ldi-core/repository-materialiser/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/MaterialiserTest.java rename to ldi-core/repository-sink/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/RepositorySinkTest.java index f056a4d18..12b927ae7 100644 --- a/ldi-core/repository-materialiser/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/MaterialiserTest.java +++ b/ldi-core/repository-sink/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/RepositorySinkTest.java @@ -1,13 +1,12 @@ package be.vlaanderen.informatievlaanderen.ldes.ldi; -import be.vlaanderen.informatievlaanderen.ldes.ldi.exceptions.MaterialisationFailedException; +import be.vlaanderen.informatievlaanderen.ldes.ldi.exceptions.SinkFailedException; import org.apache.jena.rdf.model.ModelFactory; import org.apache.jena.riot.Lang; import org.apache.jena.riot.RDFParser; import org.eclipse.rdf4j.model.Model; import org.eclipse.rdf4j.model.Resource; import org.eclipse.rdf4j.model.impl.SimpleValueFactory; -import org.eclipse.rdf4j.query.Update; import org.eclipse.rdf4j.repository.Repository; import org.eclipse.rdf4j.repository.RepositoryConnection; import org.eclipse.rdf4j.repository.RepositoryException; @@ -33,7 +32,7 @@ import static org.mockito.Mockito.*; @ExtendWith(MockitoExtension.class) -class MaterialiserTest { +class RepositorySinkTest { private static final String CHANGED_FILE = "src/test/resources/people_data_03.nq"; private static final String REPOSITORY_ID = "repo-id"; @@ -43,18 +42,18 @@ class MaterialiserTest { private RepositoryManager repositoryManager; @Mock private Repository repository; - private Materialiser materialiser; + private RepositorySink repositorySink; @BeforeEach void setUp() { when(repositoryManager.getRepository(REPOSITORY_ID)).thenReturn(repository); when(repository.getConnection()).thenReturn(connection); - materialiser = new Materialiser(repositoryManager, REPOSITORY_ID, ""); + repositorySink = new RepositorySink(repositoryManager, REPOSITORY_ID, ""); } @AfterEach void tearDown() { - materialiser.shutdown(); + repositorySink.shutdown(); } @Test @@ -70,7 +69,7 @@ void when_DeleteEntities_Then_EntitiesRemovedFromStore() throws Exception { Model modelToDelete = Rio.parse(new FileInputStream(CHANGED_FILE), "", RDFFormat.NQUADS); - materialiser.deleteEntity(modelToDelete); + repositorySink.deleteEntity(modelToDelete); entityIds.forEach(subjectIri -> { verify(connection).getStatements(subjectIri, null, null); verify(connection).remove(subjectIri, null, null); @@ -85,7 +84,7 @@ void given_RepositoryContainingData_when_UpdateSingleModel_Then_OldTriplesRemove .thenReturn(new RepositoryResult<>(new CollectionIteration<>(Set.of()))); Model changedModel = Rio.parse(new FileInputStream(CHANGED_FILE), "", RDFFormat.NQUADS); - materialiser.process(List.of(RDFParser.source(CHANGED_FILE).toModel())); + repositorySink.process(List.of(RDFParser.source(CHANGED_FILE).toModel())); verify(connection).remove(SimpleValueFactory.getInstance().createIRI("http://somewhere/DickJones/"), null, null); verify(connection).remove(SimpleValueFactory.getInstance().createIRI("http://somewhere/SarahJones/"), null, null); @@ -102,7 +101,7 @@ void given_ValidListOfMembers_when_ProcessList_then_CommitToRepository() { List models = readTenModelsFromFile().toList(); - materialiser.process(models); + repositorySink.process(models); verify(connection, times(10)).remove(any(Resource.class), isNull(), isNull()); verify(connection, times(10)).add(any(Model.class)); @@ -119,8 +118,8 @@ void given_ValidList_when_ProcessList_and_CommitFails_then_RollbackConnection() List models = readTenModelsFromFile().toList(); - assertThatThrownBy(() -> materialiser.process(models)) - .isInstanceOf(MaterialisationFailedException.class) + assertThatThrownBy(() -> repositorySink.process(models)) + .isInstanceOf(SinkFailedException.class) .hasCauseInstanceOf(RepositoryException.class); verify(connection, times(10)).add(any(Model.class)); @@ -138,8 +137,8 @@ void given_ListOfMembers_when_ProcessList_and_AddModelToConnectionFails_then_Sto List models = readTenModelsFromFile().toList(); - assertThatThrownBy(() -> materialiser.process(models)) - .isInstanceOf(MaterialisationFailedException.class) + assertThatThrownBy(() -> repositorySink.process(models)) + .isInstanceOf(SinkFailedException.class) .hasCauseInstanceOf(RepositoryException.class); verify(connection, times(3)).add(any(Model.class)); @@ -157,8 +156,8 @@ void given_ListOfMembers_when_ProcessList_and_GetStatementsFails_then_StopAdditi List models = readTenModelsFromFile().toList(); - assertThatThrownBy(() -> materialiser.process(models)) - .isInstanceOf(MaterialisationFailedException.class) + assertThatThrownBy(() -> repositorySink.process(models)) + .isInstanceOf(SinkFailedException.class) .hasCauseInstanceOf(RepositoryException.class); verify(connection, times(4)).getStatements(any(), isNull(), isNull()); diff --git a/ldi-core/repository-materialiser/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/services/ModelSubjectsExtractorTest.java b/ldi-core/repository-sink/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/services/ModelSubjectsExtractorTest.java similarity index 100% rename from ldi-core/repository-materialiser/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/services/ModelSubjectsExtractorTest.java rename to ldi-core/repository-sink/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/services/ModelSubjectsExtractorTest.java diff --git a/ldi-core/repository-materialiser/src/test/resources/10_people_data.nq b/ldi-core/repository-sink/src/test/resources/10_people_data.nq similarity index 100% rename from ldi-core/repository-materialiser/src/test/resources/10_people_data.nq rename to ldi-core/repository-sink/src/test/resources/10_people_data.nq diff --git a/ldi-core/repository-materialiser/src/test/resources/geo/measurement.ttl b/ldi-core/repository-sink/src/test/resources/geo/measurement.ttl similarity index 100% rename from ldi-core/repository-materialiser/src/test/resources/geo/measurement.ttl rename to ldi-core/repository-sink/src/test/resources/geo/measurement.ttl diff --git a/ldi-core/repository-materialiser/src/test/resources/movies/1.ttl b/ldi-core/repository-sink/src/test/resources/movies/1.ttl similarity index 100% rename from ldi-core/repository-materialiser/src/test/resources/movies/1.ttl rename to ldi-core/repository-sink/src/test/resources/movies/1.ttl diff --git a/ldi-core/repository-materialiser/src/test/resources/movies/2.ttl b/ldi-core/repository-sink/src/test/resources/movies/2.ttl similarity index 100% rename from ldi-core/repository-materialiser/src/test/resources/movies/2.ttl rename to ldi-core/repository-sink/src/test/resources/movies/2.ttl diff --git a/ldi-core/repository-materialiser/src/test/resources/people/1.nq b/ldi-core/repository-sink/src/test/resources/people/1.nq similarity index 100% rename from ldi-core/repository-materialiser/src/test/resources/people/1.nq rename to ldi-core/repository-sink/src/test/resources/people/1.nq diff --git a/ldi-core/repository-materialiser/src/test/resources/people/2.nq b/ldi-core/repository-sink/src/test/resources/people/2.nq similarity index 100% rename from ldi-core/repository-materialiser/src/test/resources/people/2.nq rename to ldi-core/repository-sink/src/test/resources/people/2.nq diff --git a/ldi-core/repository-materialiser/src/test/resources/people/3.nq b/ldi-core/repository-sink/src/test/resources/people/3.nq similarity index 100% rename from ldi-core/repository-materialiser/src/test/resources/people/3.nq rename to ldi-core/repository-sink/src/test/resources/people/3.nq diff --git a/ldi-core/repository-materialiser/src/test/resources/people/4.nq b/ldi-core/repository-sink/src/test/resources/people/4.nq similarity index 100% rename from ldi-core/repository-materialiser/src/test/resources/people/4.nq rename to ldi-core/repository-sink/src/test/resources/people/4.nq diff --git a/ldi-core/repository-materialiser/src/test/resources/people/5-updated.nq b/ldi-core/repository-sink/src/test/resources/people/5-updated.nq similarity index 100% rename from ldi-core/repository-materialiser/src/test/resources/people/5-updated.nq rename to ldi-core/repository-sink/src/test/resources/people/5-updated.nq diff --git a/ldi-core/repository-materialiser/src/test/resources/people/5.nq b/ldi-core/repository-sink/src/test/resources/people/5.nq similarity index 100% rename from ldi-core/repository-materialiser/src/test/resources/people/5.nq rename to ldi-core/repository-sink/src/test/resources/people/5.nq diff --git a/ldi-core/repository-sink/src/test/resources/people/6-updated.nq b/ldi-core/repository-sink/src/test/resources/people/6-updated.nq new file mode 100644 index 000000000..1305f827e --- /dev/null +++ b/ldi-core/repository-sink/src/test/resources/people/6-updated.nq @@ -0,0 +1,5 @@ + "Saylor Swiffer" . + . + "Saylor" . + . + "Swiffer" . diff --git a/ldi-core/repository-sink/src/test/resources/people/6.nq b/ldi-core/repository-sink/src/test/resources/people/6.nq new file mode 100644 index 000000000..aaa4bf10e --- /dev/null +++ b/ldi-core/repository-sink/src/test/resources/people/6.nq @@ -0,0 +1,6 @@ + "Saylor Twift" . + . + "Saylor" . + . + "1Saylor" . + "Twift" . \ No newline at end of file diff --git a/ldi-core/repository-materialiser/src/test/resources/people/all-updated.nq b/ldi-core/repository-sink/src/test/resources/people/all-updated.nq similarity index 100% rename from ldi-core/repository-materialiser/src/test/resources/people/all-updated.nq rename to ldi-core/repository-sink/src/test/resources/people/all-updated.nq diff --git a/ldi-core/repository-materialiser/src/test/resources/people/all.nq b/ldi-core/repository-sink/src/test/resources/people/all.nq similarity index 100% rename from ldi-core/repository-materialiser/src/test/resources/people/all.nq rename to ldi-core/repository-sink/src/test/resources/people/all.nq diff --git a/ldi-core/repository-materialiser/src/test/resources/people_data_03.nq b/ldi-core/repository-sink/src/test/resources/people_data_03.nq similarity index 100% rename from ldi-core/repository-materialiser/src/test/resources/people_data_03.nq rename to ldi-core/repository-sink/src/test/resources/people_data_03.nq diff --git a/ldi-core/request-executor/pom.xml b/ldi-core/request-executor/pom.xml index 7bbf7317a..0df49643a 100644 --- a/ldi-core/request-executor/pom.xml +++ b/ldi-core/request-executor/pom.xml @@ -5,7 +5,7 @@ ldi-core be.vlaanderen.informatievlaanderen.ldes.ldi - 2.7.0-SNAPSHOT + 2.9.0 4.0.0 request-executor diff --git a/ldi-core/request-executor/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/RequestExecutorSteps.java b/ldi-core/request-executor/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/RequestExecutorSteps.java index a727af65e..ba7fcf72d 100644 --- a/ldi-core/request-executor/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/RequestExecutorSteps.java +++ b/ldi-core/request-executor/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/RequestExecutorSteps.java @@ -136,14 +136,14 @@ public void iHaveARequestExecutorWithRateLimiter() { @Then("It takes approximately {int} ms to execute the request {int} times") public void itTakesSecondsToExecuteTheRequestTimes(int ms, int requestCount) { - LocalDateTime start = LocalDateTime.now(); + LocalDateTime startTime = LocalDateTime.now(); for (int i = 0; i < requestCount; i++) { response = requestExecutor.execute(request); } - LocalDateTime end = LocalDateTime.now(); + LocalDateTime endTime = LocalDateTime.now(); - assertTrue(Duration.between(start, end).toMillis() > ms - 250); - assertTrue(Duration.between(start, end).toMillis() < ms + 250); + assertTrue(Duration.between(startTime, endTime).toMillis() > ms - 250); + assertTrue(Duration.between(startTime, endTime).toMillis() < ms + 250); } @Given("I have a requestExecutor which does {int} retries with custom http status code {int} and limits requests") diff --git a/ldi-core/rml-adapter/pom.xml b/ldi-core/rml-adapter/pom.xml index 538ab0ac9..aed2956ca 100644 --- a/ldi-core/rml-adapter/pom.xml +++ b/ldi-core/rml-adapter/pom.xml @@ -5,7 +5,7 @@ ldi-core be.vlaanderen.informatievlaanderen.ldes.ldi - 2.7.0-SNAPSHOT + 2.9.0 4.0.0 diff --git a/ldi-core/sparql-construct/pom.xml b/ldi-core/sparql-construct/pom.xml index 281c30524..d9516707f 100644 --- a/ldi-core/sparql-construct/pom.xml +++ b/ldi-core/sparql-construct/pom.xml @@ -3,7 +3,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi ldi-core - 2.7.0-SNAPSHOT + 2.9.0 4.0.0 diff --git a/ldi-core/sparql-construct/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/SparqlConstructTransformerTest.java b/ldi-core/sparql-construct/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/SparqlConstructTransformerTest.java index 862500a15..147ca99d0 100644 --- a/ldi-core/sparql-construct/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/SparqlConstructTransformerTest.java +++ b/ldi-core/sparql-construct/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/SparqlConstructTransformerTest.java @@ -26,7 +26,7 @@ class SparqlConstructTransformerTest { private final static Model INIT_MODEL = ModelFactory.createDefaultModel(); - private final static String constructQuery = """ + private final static String defaultConstructQuery = """ CONSTRUCT { "Transformed data" } @@ -60,7 +60,7 @@ class SparqlConstructTransformerTest { @Test void when_executeTransform_ExpectTransformedModel() { SparqlConstructTransformer sparqlConstructTransformer = new SparqlConstructTransformer( - QueryFactory.create(constructQuery), false); + QueryFactory.create(defaultConstructQuery), false); Model model = ModelFactory.createDefaultModel().add(originalData); @@ -74,7 +74,7 @@ void when_executeTransform_ExpectTransformedModel() { @Test void when_executeTransform_includeOriginal_ExpectTransformedModelWithOriginal() { SparqlConstructTransformer sparqlConstructTransformer = new SparqlConstructTransformer( - QueryFactory.create(constructQuery), true); + QueryFactory.create(defaultConstructQuery), true); Model model = ModelFactory.createDefaultModel().add(originalData); @@ -155,9 +155,7 @@ private void assertModels(List expectedModelPaths, Collection res @Test void initGeoFunctionsTest() { - - SparqlConstructTransformer sparqlConstructTransformer = new SparqlConstructTransformer( - QueryFactory.create(geoConstructFirstCoordinateQuery), false); + new SparqlConstructTransformer(QueryFactory.create(geoConstructFirstCoordinateQuery), false); FunctionRegistry registry = FunctionRegistry.get(); diff --git a/ldi-core/version-materialiser/pom.xml b/ldi-core/version-materialiser/pom.xml index 7f452e6c8..cf6cc68c8 100644 --- a/ldi-core/version-materialiser/pom.xml +++ b/ldi-core/version-materialiser/pom.xml @@ -3,7 +3,7 @@ ldi-core be.vlaanderen.informatievlaanderen.ldes.ldi - 2.7.0-SNAPSHOT + 2.9.0 4.0.0 diff --git a/ldi-core/version-object-creator/pom.xml b/ldi-core/version-object-creator/pom.xml index 0ed0efd86..5b9d08d7b 100644 --- a/ldi-core/version-object-creator/pom.xml +++ b/ldi-core/version-object-creator/pom.xml @@ -3,7 +3,7 @@ ldi-core be.vlaanderen.informatievlaanderen.ldes.ldi - 2.7.0-SNAPSHOT + 2.9.0 4.0.0 diff --git a/ldi-core/version-object-creator/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/VersionObjectCreator.java b/ldi-core/version-object-creator/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/VersionObjectCreator.java index 9acfe85f5..549e02423 100644 --- a/ldi-core/version-object-creator/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/VersionObjectCreator.java +++ b/ldi-core/version-object-creator/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/VersionObjectCreator.java @@ -41,7 +41,7 @@ public class VersionObjectCreator implements LdiOneToOneTransformer { /** * Representation of the member type resource that the state object represents */ - private final Resource memberTypeResource; + private final List memberTypeResources; /** * Represents that needs to be used to expand the named subject of the member to a version object member id */ @@ -55,11 +55,11 @@ public class VersionObjectCreator implements LdiOneToOneTransformer { */ private final Property versionOfProperty; - public VersionObjectCreator(PropertyExtractor dateObservedPropertyExtractor, Resource memberTypeResource, - String delimiter, - Property generatedAtTimeProperty, Property versionOfProperty) { + public VersionObjectCreator(PropertyExtractor dateObservedPropertyExtractor, List memberTypeResources, + String delimiter, + Property generatedAtTimeProperty, Property versionOfProperty) { this.dateObservedPropertyExtractor = dateObservedPropertyExtractor; - this.memberTypeResource = memberTypeResource; + this.memberTypeResources = memberTypeResources; this.delimiter = delimiter; this.generatedAtTimeProperty = generatedAtTimeProperty; this.versionOfProperty = versionOfProperty; @@ -83,7 +83,8 @@ public Model transform(Model linkedDataModel) { } private Optional extractMemberInfo(Model linkedDataModel) { - return linkedDataModel.listStatements(null, SYNTAX_TYPE, memberTypeResource) + return linkedDataModel.listStatements(null, SYNTAX_TYPE, (RDFNode) null) + .filterKeep(statement -> memberTypeResources.contains(statement.getResource())) .nextOptional() .map(Statement::getSubject) .map(Resource::asNode) diff --git a/ldi-core/version-object-creator/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/VersionObjectCreatorTest.java b/ldi-core/version-object-creator/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/VersionObjectCreatorTest.java index b69595439..6d5f89052 100644 --- a/ldi-core/version-object-creator/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/VersionObjectCreatorTest.java +++ b/ldi-core/version-object-creator/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/VersionObjectCreatorTest.java @@ -131,13 +131,13 @@ void when_dateObservedPropertyIsNested_thenAPropertyPathCanBeProvided() { @ParameterizedTest @ArgumentsSource(JsonLDFileArgumentsProvider.class) - void shouldMatchCountOfObjects(String fileName, String expectedId, LocalDateTime startTestTime, String memberType) + void shouldMatchCountOfObjects(String fileName, String expectedId, LocalDateTime startTestTime, List memberTypes) throws IOException, URISyntaxException { Model model = RDFParserBuilder.create().fromString(getJsonString(fileName)).lang(Lang.JSONLD).toModel(); VersionObjectCreator versionObjectCreator = new VersionObjectCreator(new EmptyPropertyExtractor(), - model.createResource(memberType), + memberTypes.stream().map(model::createResource).toList(), DEFAULT_DELIMITER, null, null); Model versionObject = versionObjectCreator.transform(model); @@ -151,6 +151,25 @@ void shouldMatchCountOfObjects(String fileName, String expectedId, LocalDateTime stmt.getSubject().toString().contains(expectedId + minuteAfterTheTestStarted))); } + @Test + void when_EmptyList_Then_ShouldNotMatch() throws URISyntaxException, IOException { + final LocalDateTime now = LocalDateTime.now(); + Model model = RDFParserBuilder.create().fromString(getJsonString("example-waterqualityobserved.json")).lang(Lang.JSONLD).toModel(); + VersionObjectCreator versionObjectCreator = new VersionObjectCreator(new EmptyPropertyExtractor(), + List.of(), + DEFAULT_DELIMITER, null, null); + + Model versionObject = versionObjectCreator.transform(model); + + final String minuteTheTestStarted = getPartOfLocalDateTime(now); + final String minuteAfterTheTestStarted = getPartOfLocalDateTime(now.plusMinutes(1)); + assertTrue(versionObject.listStatements() + .toList() + .stream() + .noneMatch(stmt -> stmt.getSubject().toString().contains(minuteTheTestStarted) || + stmt.getSubject().toString().contains(minuteAfterTheTestStarted))); + } + @Test void when_memberInfoExtractionFails_warningMessageIsLogged() { ListAppender listAppender = createListAppender(); @@ -229,14 +248,14 @@ private String getJsonString(String resource) throws URISyntaxException, IOExcep } private VersionObjectCreator createVersionObjectCreator(Model inputModel, String dateObservedPath) { - Resource memberType = inputModel.createResource("http://example.org/Something"); + List memberTypes = List.of(inputModel.createResource("http://example.org/Something")); PropertyExtractor dateObservedPropertyExtractor = PropertyPathExtractor.from(dateObservedPath); Property generatedAtTimeProperty = inputModel.createProperty("http://www.w3.org/ns/prov#generatedAtTime"); Property versionOfProperty = inputModel.createProperty("http://purl.org/dc/terms/isVersionOf"); return new VersionObjectCreator( dateObservedPropertyExtractor, - memberType, + memberTypes, DEFAULT_DELIMITER, generatedAtTimeProperty, versionOfProperty @@ -260,15 +279,21 @@ public Stream provideArguments(ExtensionContext context) { Arguments.of("example-waterqualityobserved.json", "urn:ngsi-v2:cot-imec-be:WaterQualityObserved:imec-iow-3orY3reQDK5n3TMpPnLVYR/", now, - "https://uri.etsi.org/ngsi-ld/default-context/WaterQualityObserved"), + List.of("https://uri.etsi.org/ngsi-ld/default-context/WaterQualityObserved")), Arguments.of("example-device.json", "urn:ngsi-v2:cot-imec-be:Device:imec-iow-UR5gEycRuaafxnhvjd9jnU/", now, - "https://uri.etsi.org/ngsi-ld/default-context/Device"), + List.of("https://uri.etsi.org/ngsi-ld/default-context/Device")), + Arguments.of("example-device-model.json", + "urn:ngsi-v2:cot-imec-be:devicemodel:imec-iow-sensor-v0005/", + now, + List.of("https://uri.etsi.org/ngsi-ld/default-context/DeviceModel")), Arguments.of("example-device-model.json", "urn:ngsi-v2:cot-imec-be:devicemodel:imec-iow-sensor-v0005/", now, - "https://uri.etsi.org/ngsi-ld/default-context/DeviceModel")); + List.of("https://www.test.org", + "https://uri.etsi.org/ngsi-ld/default-context/DeviceModel", + "https://www.something.org"))); } } diff --git a/ldi-extensions/ldes-discoverer/pom.xml b/ldi-extensions/ldes-discoverer/pom.xml index ccab8a0d6..aee2fd9ee 100644 --- a/ldi-extensions/ldes-discoverer/pom.xml +++ b/ldi-extensions/ldes-discoverer/pom.xml @@ -6,7 +6,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi ldi-extensions - 2.7.0-SNAPSHOT + 2.9.0 ldes-discoverer diff --git a/ldi-extensions/ldes-discoverer/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/discoverer/valueobjects/HeadersTest.java b/ldi-extensions/ldes-discoverer/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/discoverer/valueobjects/HeadersTest.java index ac477823c..e5a1f2fdd 100644 --- a/ldi-extensions/ldes-discoverer/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/discoverer/valueobjects/HeadersTest.java +++ b/ldi-extensions/ldes-discoverer/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/discoverer/valueobjects/HeadersTest.java @@ -2,7 +2,6 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.discoverer.HeadersMatcher; import org.apache.http.Header; -import org.apache.http.message.BasicHeader; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; @@ -13,9 +12,7 @@ import java.util.Collection; import java.util.List; -import static be.vlaanderen.informatievlaanderen.ldes.ldi.discoverer.HeadersMatcher.containsAllHeaders; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.when; @ExtendWith(MockitoExtension.class) diff --git a/ldi-extensions/pom.xml b/ldi-extensions/pom.xml index f01ef2099..e082942b6 100644 --- a/ldi-extensions/pom.xml +++ b/ldi-extensions/pom.xml @@ -6,7 +6,7 @@ be.vlaanderen.informatievlaanderen.ldes linked-data-interactions - 2.7.0-SNAPSHOT + 2.9.0 be.vlaanderen.informatievlaanderen.ldes.ldi diff --git a/ldi-nifi.Dockerfile b/ldi-nifi.Dockerfile deleted file mode 100644 index 7ee77cd6b..000000000 --- a/ldi-nifi.Dockerfile +++ /dev/null @@ -1,28 +0,0 @@ -ARG NIFI_DOCKER_IMAGE_VERSION - -# -# INSTALL MAVEN DEPENDENCIES -# -FROM maven:3.9.6-amazoncorretto-21 AS builder - -# MAVEN: application -FROM builder AS app-stage -COPY . . -RUN mvn clean install -DskipTests - -FROM ldes/nifi:${NIFI_DOCKER_IMAGE_VERSION} AS packaging-stage - -COPY --from=app-stage --chown=nifi:nifi ldi-nifi/ldi-nifi-processors/create-version-object-processor/target/*.nar /opt/nifi/nifi-current/lib/ -COPY --from=app-stage --chown=nifi:nifi ldi-nifi/ldi-nifi-processors/ldes-client-processor/target/*.nar /opt/nifi/nifi-current/lib/ -COPY --from=app-stage --chown=nifi:nifi ldi-nifi/ldi-nifi-processors/sparql-interactions-processor/target/*.nar /opt/nifi/nifi-current/lib/ -COPY --from=app-stage --chown=nifi:nifi ldi-nifi/ldi-nifi-processors/version-materialisation-processor/target/*.nar /opt/nifi/nifi-current/lib/ -COPY --from=app-stage --chown=nifi:nifi ldi-nifi/ldi-nifi-processors/ngsiv2-to-ld-processor/target/*.nar /opt/nifi/nifi-current/lib/ -COPY --from=app-stage --chown=nifi:nifi ldi-nifi/ldi-nifi-processors/json-to-ld-processor/target/*.nar /opt/nifi/nifi-current/lib/ -COPY --from=app-stage --chown=nifi:nifi ldi-nifi/ldi-nifi-processors/rdf4j-repository-materialisation-processor/target/*.nar /opt/nifi/nifi-current/lib/ -COPY --from=app-stage --chown=nifi:nifi ldi-nifi/ldi-nifi-processors/geojson-to-wkt-processor/target/*.nar /opt/nifi/nifi-current/lib/ -COPY --from=app-stage --chown=nifi:nifi ldi-nifi/ldi-nifi-processors/archive-file-out/target/*.nar /opt/nifi/nifi-current/lib/ -COPY --from=app-stage --chown=nifi:nifi ldi-nifi/ldi-nifi-processors/archive-file-in/target/*.nar /opt/nifi/nifi-current/lib/ - -RUN rm -rf *.db *.db-* ldes-client-processor/*.db ldes-client-processor/*.db-* -RUN chmod -R 664 /opt/nifi/nifi-current/lib/*.nar -USER nifi diff --git a/ldi-nifi/ldi-nifi-common/pom.xml b/ldi-nifi/ldi-nifi-common/pom.xml index df59af287..346b92822 100644 --- a/ldi-nifi/ldi-nifi-common/pom.xml +++ b/ldi-nifi/ldi-nifi-common/pom.xml @@ -3,7 +3,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi ldi-nifi - 2.7.0-SNAPSHOT + 2.9.0 4.0.0 diff --git a/ldi-nifi/ldi-nifi-processors/archive-file-in/pom.xml b/ldi-nifi/ldi-nifi-processors/archive-file-in/pom.xml index 863310ba0..1a2608782 100644 --- a/ldi-nifi/ldi-nifi-processors/archive-file-in/pom.xml +++ b/ldi-nifi/ldi-nifi-processors/archive-file-in/pom.xml @@ -6,7 +6,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi.nifi ldi-nifi-processors - 2.7.0-SNAPSHOT + 2.9.0 archive-file-in diff --git a/ldi-nifi/ldi-nifi-processors/archive-file-out/pom.xml b/ldi-nifi/ldi-nifi-processors/archive-file-out/pom.xml index 7a822b702..f8c0b3395 100644 --- a/ldi-nifi/ldi-nifi-processors/archive-file-out/pom.xml +++ b/ldi-nifi/ldi-nifi-processors/archive-file-out/pom.xml @@ -6,7 +6,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi.nifi ldi-nifi-processors - 2.7.0-SNAPSHOT + 2.9.0 archive-file-out diff --git a/ldi-nifi/ldi-nifi-processors/change-detection-processor/pom.xml b/ldi-nifi/ldi-nifi-processors/change-detection-processor/pom.xml index 2b03e7626..66ba891c4 100644 --- a/ldi-nifi/ldi-nifi-processors/change-detection-processor/pom.xml +++ b/ldi-nifi/ldi-nifi-processors/change-detection-processor/pom.xml @@ -6,7 +6,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi.nifi ldi-nifi-processors - 2.7.0-SNAPSHOT + 2.9.0 change-detection-processor diff --git a/ldi-nifi/ldi-nifi-processors/create-version-object-processor/pom.xml b/ldi-nifi/ldi-nifi-processors/create-version-object-processor/pom.xml index 1aa5686eb..f32a67f0b 100644 --- a/ldi-nifi/ldi-nifi-processors/create-version-object-processor/pom.xml +++ b/ldi-nifi/ldi-nifi-processors/create-version-object-processor/pom.xml @@ -3,7 +3,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi.nifi ldi-nifi-processors - 2.7.0-SNAPSHOT + 2.9.0 4.0.0 diff --git a/ldi-nifi/ldi-nifi-processors/create-version-object-processor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/processors/CreateVersionObjectProcessor.java b/ldi-nifi/ldi-nifi-processors/create-version-object-processor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/processors/CreateVersionObjectProcessor.java index d85672284..7112fddf8 100644 --- a/ldi-nifi/ldi-nifi-processors/create-version-object-processor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/processors/CreateVersionObjectProcessor.java +++ b/ldi-nifi/ldi-nifi-processors/create-version-object-processor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/processors/CreateVersionObjectProcessor.java @@ -80,13 +80,13 @@ public void onScheduled(final ProcessContext context) { PropertyExtractor dateObservedPropertyExtractor = dateObservedProperty != null ? PropertyPathExtractor.from(dateObservedProperty) : new EmptyPropertyExtractor(); - Resource memberType = getMemberRdfSyntaxType(context); + List memberTypes = getMemberRdfSyntaxTypes(context); String delimiter = getDelimiter(context); Property versionOfKey = getVersionOfKey(context); Property generatedAtTimeProperty = getGeneratedAtTimeProperty(context); dataDestinationFormat = getDataDestinationFormat(context); - versionObjectCreator = new VersionObjectCreator(dateObservedPropertyExtractor, memberType, delimiter, + versionObjectCreator = new VersionObjectCreator(dateObservedPropertyExtractor, memberTypes, delimiter, generatedAtTimeProperty, versionOfKey); } diff --git a/ldi-nifi/ldi-nifi-processors/create-version-object-processor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/processors/config/CreateVersionObjectProcessorPropertyDescriptors.java b/ldi-nifi/ldi-nifi-processors/create-version-object-processor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/processors/config/CreateVersionObjectProcessorPropertyDescriptors.java index 2fa5b31de..6052224be 100644 --- a/ldi-nifi/ldi-nifi-processors/create-version-object-processor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/processors/config/CreateVersionObjectProcessorPropertyDescriptors.java +++ b/ldi-nifi/ldi-nifi-processors/create-version-object-processor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/processors/config/CreateVersionObjectProcessorPropertyDescriptors.java @@ -9,6 +9,9 @@ import org.apache.nifi.processor.ProcessContext; import org.apache.nifi.processor.util.StandardValidators; +import java.util.Arrays; +import java.util.List; + public final class CreateVersionObjectProcessorPropertyDescriptors { private static final String DEFAULT_DATE_OBSERVED_VALUE_RDF_PROPERTY = "https://uri.etsi.org/ngsi-ld/observedAt"; private static final String DEFAULT_DELIMITER = "/"; @@ -21,10 +24,10 @@ private CreateVersionObjectProcessorPropertyDescriptors() { public static final PropertyDescriptor MEMBER_RDF_SYNTAX_TYPE = new PropertyDescriptor.Builder() .name("MEMBER_RDF_SYNTAX_TYPE") - .displayName("IRI to member RDF syntax type") - .description("IRI that declares a http://www.w3.org/1999/02/22-rdf-syntax-ns#type") + .displayName("IRIs to member RDF syntax type") + .description("Comma separated list of IRIs that declare a http://www.w3.org/1999/02/22-rdf-syntax-ns#type of all possible members") .required(true) - .addValidator(StandardValidators.NON_EMPTY_VALIDATOR) + .addValidator(StandardValidators.NON_BLANK_VALIDATOR) .build(); public static final PropertyDescriptor DELIMITER = new PropertyDescriptor.Builder() @@ -78,8 +81,11 @@ public static String getDateObservedValue(ProcessContext context) { return context.getProperty(DATE_OBSERVED_VALUE_RDF_PROPERTY).getValue(); } - public static Resource getMemberRdfSyntaxType(ProcessContext context) { - return ResourceFactory.createResource(context.getProperty(MEMBER_RDF_SYNTAX_TYPE).getValue()); + public static List getMemberRdfSyntaxTypes(ProcessContext context) { + return Arrays.stream(context.getProperty(MEMBER_RDF_SYNTAX_TYPE).getValue().split(",")) + .map(String::trim) + .map(ResourceFactory::createResource) + .toList(); } public static String getDelimiter(ProcessContext context) { diff --git a/ldi-nifi/ldi-nifi-processors/geojson-to-wkt-processor/pom.xml b/ldi-nifi/ldi-nifi-processors/geojson-to-wkt-processor/pom.xml index 75be8f3e3..6d6fc894e 100644 --- a/ldi-nifi/ldi-nifi-processors/geojson-to-wkt-processor/pom.xml +++ b/ldi-nifi/ldi-nifi-processors/geojson-to-wkt-processor/pom.xml @@ -6,7 +6,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi.nifi ldi-nifi-processors - 2.7.0-SNAPSHOT + 2.9.0 geojson-to-wkt-processor diff --git a/ldi-nifi/ldi-nifi-processors/json-to-ld-processor/pom.xml b/ldi-nifi/ldi-nifi-processors/json-to-ld-processor/pom.xml index 96e0f2bcb..db8f38621 100644 --- a/ldi-nifi/ldi-nifi-processors/json-to-ld-processor/pom.xml +++ b/ldi-nifi/ldi-nifi-processors/json-to-ld-processor/pom.xml @@ -6,7 +6,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi.nifi ldi-nifi-processors - 2.7.0-SNAPSHOT + 2.9.0 json-to-ld-processor diff --git a/ldi-nifi/ldi-nifi-processors/ldes-client-processor/pom.xml b/ldi-nifi/ldi-nifi-processors/ldes-client-processor/pom.xml index 26c10ba6c..4b537ccc0 100644 --- a/ldi-nifi/ldi-nifi-processors/ldes-client-processor/pom.xml +++ b/ldi-nifi/ldi-nifi-processors/ldes-client-processor/pom.xml @@ -3,7 +3,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi.nifi ldi-nifi-processors - 2.7.0-SNAPSHOT + 2.9.0 4.0.0 diff --git a/ldi-nifi/ldi-nifi-processors/ldes-client-processor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/processors/LdesClientProcessor.java b/ldi-nifi/ldi-nifi-processors/ldes-client-processor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/processors/LdesClientProcessor.java index 22bfb1163..ffe7745e2 100644 --- a/ldi-nifi/ldi-nifi-processors/ldes-client-processor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/processors/LdesClientProcessor.java +++ b/ldi-nifi/ldi-nifi-processors/ldes-client-processor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/processors/LdesClientProcessor.java @@ -14,10 +14,7 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.timestampextractor.TimestampFromPathExtractor; import io.github.resilience4j.retry.Retry; import ldes.client.treenodesupplier.TreeNodeProcessor; -import ldes.client.treenodesupplier.domain.valueobject.EndOfLdesException; -import ldes.client.treenodesupplier.domain.valueobject.LdesMetaData; -import ldes.client.treenodesupplier.domain.valueobject.StatePersistence; -import ldes.client.treenodesupplier.domain.valueobject.SuppliedMember; +import ldes.client.treenodesupplier.domain.valueobject.*; import ldes.client.treenodesupplier.filters.ExactlyOnceFilter; import ldes.client.treenodesupplier.filters.LatestStateFilter; import ldes.client.treenodesupplier.membersuppliers.FilteredMemberSupplier; @@ -47,6 +44,7 @@ import java.util.List; import java.util.Set; +import java.util.function.Consumer; import static be.vlaanderen.informatievlaanderen.ldes.ldi.processors.config.CommonProperties.DATA_DESTINATION_FORMAT; import static be.vlaanderen.informatievlaanderen.ldes.ldi.processors.config.LdesProcessorProperties.*; @@ -115,7 +113,8 @@ public void onScheduled(final ProcessContext context) { String timestampPath = LdesProcessorProperties.getTimestampPath(context); TimestampExtractor timestampExtractor = timestampPath.isBlank() ? new TimestampFromCurrentTimeExtractor() : new TimestampFromPathExtractor(createProperty(timestampPath)); - TreeNodeProcessor treeNodeProcessor = new TreeNodeProcessor(ldesMetaData, statePersistence, requestExecutor, timestampExtractor); + TreeNodeProcessor treeNodeProcessor = new TreeNodeProcessor(ldesMetaData, statePersistence, requestExecutor, + timestampExtractor, clientStatusConsumer()); keepState = stateKept(context); final MemberSupplierImpl baseMemberSupplier = new MemberSupplierImpl(treeNodeProcessor, keepState); @@ -231,4 +230,8 @@ public static String convertModelToString(Model model, Lang dataDestinationForma return RDFWriter.source(model).lang(dataDestinationFormat).asString(); } + private Consumer clientStatusConsumer() { + return status -> LOGGER.info("LDES Client is now {}", status); + } + } diff --git a/ldi-nifi/ldi-nifi-processors/ldi-processors-bundle/pom.xml b/ldi-nifi/ldi-nifi-processors/ldi-processors-bundle/pom.xml index 7ce312654..e4ebc3169 100644 --- a/ldi-nifi/ldi-nifi-processors/ldi-processors-bundle/pom.xml +++ b/ldi-nifi/ldi-nifi-processors/ldi-processors-bundle/pom.xml @@ -6,7 +6,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi.nifi ldi-nifi-processors - 2.7.0-SNAPSHOT + 2.9.0 ldi-processors-bundle @@ -45,7 +45,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi.nifi - rdf4j-repository-materialisation-processor + rdf4j-repository-sink-processor ${project.version} nar diff --git a/ldi-nifi/ldi-nifi-processors/ngsiv2-to-ld-processor/pom.xml b/ldi-nifi/ldi-nifi-processors/ngsiv2-to-ld-processor/pom.xml index 60562b260..7d293be04 100644 --- a/ldi-nifi/ldi-nifi-processors/ngsiv2-to-ld-processor/pom.xml +++ b/ldi-nifi/ldi-nifi-processors/ngsiv2-to-ld-processor/pom.xml @@ -7,7 +7,7 @@ ldi-nifi-processors be.vlaanderen.informatievlaanderen.ldes.ldi.nifi - 2.7.0-SNAPSHOT + 2.9.0 ngsiv2-to-ld-processor diff --git a/ldi-nifi/ldi-nifi-processors/pom.xml b/ldi-nifi/ldi-nifi-processors/pom.xml index eac8ff20b..3c0152024 100644 --- a/ldi-nifi/ldi-nifi-processors/pom.xml +++ b/ldi-nifi/ldi-nifi-processors/pom.xml @@ -3,7 +3,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi ldi-nifi - 2.7.0-SNAPSHOT + 2.9.0 4.0.0 @@ -17,7 +17,7 @@ sparql-interactions-processor version-materialisation-processor ngsiv2-to-ld-processor - rdf4j-repository-materialisation-processor + rdf4j-repository-sink-processor geojson-to-wkt-processor json-to-ld-processor archive-file-out diff --git a/ldi-nifi/ldi-nifi-processors/rdf4j-repository-materialisation-processor/README.md b/ldi-nifi/ldi-nifi-processors/rdf4j-repository-sink-processor/README.md similarity index 96% rename from ldi-nifi/ldi-nifi-processors/rdf4j-repository-materialisation-processor/README.md rename to ldi-nifi/ldi-nifi-processors/rdf4j-repository-sink-processor/README.md index 63e337198..ad263bc5d 100644 --- a/ldi-nifi/ldi-nifi-processors/rdf4j-repository-materialisation-processor/README.md +++ b/ldi-nifi/ldi-nifi-processors/rdf4j-repository-sink-processor/README.md @@ -1,4 +1,4 @@ -# RDF4J repository materialisation processor +# RDF4J repository sink processor ## About An Apache NiFi processor that materialises an LDES stream into a triplestore. Any triplestore that supports the RDF4J remote repository API can be used. diff --git a/ldi-nifi/ldi-nifi-processors/rdf4j-repository-materialisation-processor/pom.xml b/ldi-nifi/ldi-nifi-processors/rdf4j-repository-sink-processor/pom.xml similarity index 89% rename from ldi-nifi/ldi-nifi-processors/rdf4j-repository-materialisation-processor/pom.xml rename to ldi-nifi/ldi-nifi-processors/rdf4j-repository-sink-processor/pom.xml index 079f4d3f6..8d462ca17 100644 --- a/ldi-nifi/ldi-nifi-processors/rdf4j-repository-materialisation-processor/pom.xml +++ b/ldi-nifi/ldi-nifi-processors/rdf4j-repository-sink-processor/pom.xml @@ -6,10 +6,10 @@ be.vlaanderen.informatievlaanderen.ldes.ldi.nifi ldi-nifi-processors - 2.7.0-SNAPSHOT + 2.9.0 - rdf4j-repository-materialisation-processor + rdf4j-repository-sink-processor nar @@ -21,7 +21,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi - repository-materialiser + repository-sink ${project.version} compile diff --git a/ldi-nifi/ldi-nifi-processors/rdf4j-repository-materialisation-processor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/processors/RDF4JRepositoryMaterialisationProcessor.java b/ldi-nifi/ldi-nifi-processors/rdf4j-repository-sink-processor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/processors/RDF4JRepositorySinkProcessor.java similarity index 89% rename from ldi-nifi/ldi-nifi-processors/rdf4j-repository-materialisation-processor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/processors/RDF4JRepositoryMaterialisationProcessor.java rename to ldi-nifi/ldi-nifi-processors/rdf4j-repository-sink-processor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/processors/RDF4JRepositorySinkProcessor.java index 5e019c935..f638c11a3 100644 --- a/ldi-nifi/ldi-nifi-processors/rdf4j-repository-materialisation-processor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/processors/RDF4JRepositoryMaterialisationProcessor.java +++ b/ldi-nifi/ldi-nifi-processors/rdf4j-repository-sink-processor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/processors/RDF4JRepositorySinkProcessor.java @@ -1,6 +1,6 @@ package be.vlaanderen.informatievlaanderen.ldes.ldi.processors; -import be.vlaanderen.informatievlaanderen.ldes.ldi.Materialiser; +import be.vlaanderen.informatievlaanderen.ldes.ldi.RepositorySink; import be.vlaanderen.informatievlaanderen.ldes.ldi.processors.services.FlowManager; import be.vlaanderen.informatievlaanderen.ldes.ldi.rdf.parser.JenaContextProvider; import org.apache.jena.rdf.model.Model; @@ -27,7 +27,7 @@ import static be.vlaanderen.informatievlaanderen.ldes.ldi.processors.config.CommonProperties.DATA_SOURCE_FORMAT; import static be.vlaanderen.informatievlaanderen.ldes.ldi.processors.config.CommonProperties.getDataSourceFormat; -import static be.vlaanderen.informatievlaanderen.ldes.ldi.processors.config.RDF4JRepositoryMaterialisationProcessorProperties.*; +import static be.vlaanderen.informatievlaanderen.ldes.ldi.processors.config.RDF4JRepositorySinkProcessorProperties.*; import static be.vlaanderen.informatievlaanderen.ldes.ldi.processors.services.FlowManager.FAILURE; import static be.vlaanderen.informatievlaanderen.ldes.ldi.processors.services.FlowManager.SUCCESS; @@ -35,9 +35,9 @@ @Tags({"ldes, rdf4j-repository, vsds"}) @CapabilityDescription("Materialises LDES events into an RDF4J repository") @InputRequirement(InputRequirement.Requirement.INPUT_REQUIRED) -public class RDF4JRepositoryMaterialisationProcessor extends AbstractProcessor { +public class RDF4JRepositorySinkProcessor extends AbstractProcessor { - private Materialiser materialiser; + private RepositorySink repositorySink; private Context jenaContext; @Override @@ -61,8 +61,8 @@ protected List getSupportedPropertyDescriptors() { @OnScheduled public void onScheduled(final ProcessContext context) { - if (materialiser == null) { - materialiser = new Materialiser(context.getProperty(SPARQL_HOST).getValue(), + if (repositorySink == null) { + repositorySink = new RepositorySink(context.getProperty(SPARQL_HOST).getValue(), context.getProperty(REPOSITORY_ID).getValue(), context.getProperty(NAMED_GRAPH).getValue()); } @@ -87,7 +87,7 @@ public void onTrigger(ProcessContext context, ProcessSession session) throws Pro .map(content -> RDFParser.fromString(content).context(jenaContext).lang(dataSourceFormat).toModel()) .toList(); - materialiser.process(models); + repositorySink.process(models); session.transfer(flowFiles, SUCCESS); } catch (Exception e) { @@ -98,6 +98,6 @@ public void onTrigger(ProcessContext context, ProcessSession session) throws Pro @OnRemoved public void onRemoved() { - materialiser.shutdown(); + repositorySink.shutdown(); } } diff --git a/ldi-nifi/ldi-nifi-processors/rdf4j-repository-materialisation-processor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/processors/config/RDF4JRepositoryMaterialisationProcessorProperties.java b/ldi-nifi/ldi-nifi-processors/rdf4j-repository-sink-processor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/processors/config/RDF4JRepositorySinkProcessorProperties.java similarity index 92% rename from ldi-nifi/ldi-nifi-processors/rdf4j-repository-materialisation-processor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/processors/config/RDF4JRepositoryMaterialisationProcessorProperties.java rename to ldi-nifi/ldi-nifi-processors/rdf4j-repository-sink-processor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/processors/config/RDF4JRepositorySinkProcessorProperties.java index 7ea25eb0d..952d809c8 100644 --- a/ldi-nifi/ldi-nifi-processors/rdf4j-repository-materialisation-processor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/processors/config/RDF4JRepositoryMaterialisationProcessorProperties.java +++ b/ldi-nifi/ldi-nifi-processors/rdf4j-repository-sink-processor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/processors/config/RDF4JRepositorySinkProcessorProperties.java @@ -3,9 +3,9 @@ import org.apache.nifi.components.PropertyDescriptor; import org.apache.nifi.processor.util.StandardValidators; -public final class RDF4JRepositoryMaterialisationProcessorProperties { +public final class RDF4JRepositorySinkProcessorProperties { - private RDF4JRepositoryMaterialisationProcessorProperties() { + private RDF4JRepositorySinkProcessorProperties() { } public static final int SIMULTANEOUS_FLOWFILE_COUNT = 50; diff --git a/ldi-nifi/ldi-nifi-processors/rdf4j-repository-materialisation-processor/src/main/resources/META-INF/services/org.apache.nifi.processor.Processor b/ldi-nifi/ldi-nifi-processors/rdf4j-repository-sink-processor/src/main/resources/META-INF/services/org.apache.nifi.processor.Processor similarity index 68% rename from ldi-nifi/ldi-nifi-processors/rdf4j-repository-materialisation-processor/src/main/resources/META-INF/services/org.apache.nifi.processor.Processor rename to ldi-nifi/ldi-nifi-processors/rdf4j-repository-sink-processor/src/main/resources/META-INF/services/org.apache.nifi.processor.Processor index 55e645070..e00fb0502 100644 --- a/ldi-nifi/ldi-nifi-processors/rdf4j-repository-materialisation-processor/src/main/resources/META-INF/services/org.apache.nifi.processor.Processor +++ b/ldi-nifi/ldi-nifi-processors/rdf4j-repository-sink-processor/src/main/resources/META-INF/services/org.apache.nifi.processor.Processor @@ -1 +1 @@ -be.vlaanderen.informatievlaanderen.ldes.ldi.processors.RDF4JRepositoryMaterialisationProcessor \ No newline at end of file +be.vlaanderen.informatievlaanderen.ldes.ldi.processors.RDF4JRepositorySinkProcessor \ No newline at end of file diff --git a/ldi-nifi/ldi-nifi-processors/rdf4j-repository-materialisation-processor/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/processors/RDF4JRepositoryMaterialisationProcessorTest.java b/ldi-nifi/ldi-nifi-processors/rdf4j-repository-sink-processor/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/processors/RDF4JRepositorySinkProcessorTest.java similarity index 94% rename from ldi-nifi/ldi-nifi-processors/rdf4j-repository-materialisation-processor/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/processors/RDF4JRepositoryMaterialisationProcessorTest.java rename to ldi-nifi/ldi-nifi-processors/rdf4j-repository-sink-processor/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/processors/RDF4JRepositorySinkProcessorTest.java index 62ea054cc..3a91b491f 100644 --- a/ldi-nifi/ldi-nifi-processors/rdf4j-repository-materialisation-processor/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/processors/RDF4JRepositoryMaterialisationProcessorTest.java +++ b/ldi-nifi/ldi-nifi-processors/rdf4j-repository-sink-processor/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/processors/RDF4JRepositorySinkProcessorTest.java @@ -21,7 +21,7 @@ import static be.vlaanderen.informatievlaanderen.ldes.ldi.processors.services.FlowManager.SUCCESS; import static org.assertj.core.api.Assertions.assertThat; -class RDF4JRepositoryMaterialisationProcessorTest { +class RDF4JRepositorySinkProcessorTest { private static final String REPOSITORY_ID = "test"; private static final int EXPOSED_PORT = 8080; private static GenericContainer rdf4jContainer; @@ -59,12 +59,12 @@ static void afterAll() { @BeforeEach void setUp() { - testRunner = TestRunners.newTestRunner(RDF4JRepositoryMaterialisationProcessor.class); + testRunner = TestRunners.newTestRunner(RDF4JRepositorySinkProcessor.class); } @AfterEach void tearDown() { - ((RDF4JRepositoryMaterialisationProcessor) testRunner.getProcessor()).onRemoved(); + ((RDF4JRepositorySinkProcessor) testRunner.getProcessor()).onRemoved(); } @Test diff --git a/ldi-nifi/ldi-nifi-processors/rdf4j-repository-materialisation-processor/src/test/resources/people_data.nq b/ldi-nifi/ldi-nifi-processors/rdf4j-repository-sink-processor/src/test/resources/people_data.nq similarity index 100% rename from ldi-nifi/ldi-nifi-processors/rdf4j-repository-materialisation-processor/src/test/resources/people_data.nq rename to ldi-nifi/ldi-nifi-processors/rdf4j-repository-sink-processor/src/test/resources/people_data.nq diff --git a/ldi-nifi/ldi-nifi-processors/rdf4j-repository-materialisation-processor/src/test/resources/repo-definition.ttl b/ldi-nifi/ldi-nifi-processors/rdf4j-repository-sink-processor/src/test/resources/repo-definition.ttl similarity index 100% rename from ldi-nifi/ldi-nifi-processors/rdf4j-repository-materialisation-processor/src/test/resources/repo-definition.ttl rename to ldi-nifi/ldi-nifi-processors/rdf4j-repository-sink-processor/src/test/resources/repo-definition.ttl diff --git a/ldi-nifi/ldi-nifi-processors/rml-adapter-processor/pom.xml b/ldi-nifi/ldi-nifi-processors/rml-adapter-processor/pom.xml index 40126dc14..9dbd1bd57 100644 --- a/ldi-nifi/ldi-nifi-processors/rml-adapter-processor/pom.xml +++ b/ldi-nifi/ldi-nifi-processors/rml-adapter-processor/pom.xml @@ -6,7 +6,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi.nifi ldi-nifi-processors - 2.7.0-SNAPSHOT + 2.9.0 rml-adapter-processor diff --git a/ldi-nifi/ldi-nifi-processors/sparql-interactions-processor/pom.xml b/ldi-nifi/ldi-nifi-processors/sparql-interactions-processor/pom.xml index 0893c078e..3722ce88d 100644 --- a/ldi-nifi/ldi-nifi-processors/sparql-interactions-processor/pom.xml +++ b/ldi-nifi/ldi-nifi-processors/sparql-interactions-processor/pom.xml @@ -3,7 +3,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi.nifi ldi-nifi-processors - 2.7.0-SNAPSHOT + 2.9.0 4.0.0 diff --git a/ldi-nifi/ldi-nifi-processors/version-materialisation-processor/pom.xml b/ldi-nifi/ldi-nifi-processors/version-materialisation-processor/pom.xml index 49a6ef38d..e55a97bd0 100644 --- a/ldi-nifi/ldi-nifi-processors/version-materialisation-processor/pom.xml +++ b/ldi-nifi/ldi-nifi-processors/version-materialisation-processor/pom.xml @@ -3,7 +3,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi.nifi ldi-nifi-processors - 2.7.0-SNAPSHOT + 2.9.0 4.0.0 diff --git a/ldi-nifi/pom.xml b/ldi-nifi/pom.xml index 8472159eb..e93caa145 100644 --- a/ldi-nifi/pom.xml +++ b/ldi-nifi/pom.xml @@ -3,7 +3,7 @@ linked-data-interactions be.vlaanderen.informatievlaanderen.ldes - 2.7.0-SNAPSHOT + 2.9.0 4.0.0 pom diff --git a/ldi-orchestrator/ldio-application/pom.xml b/ldi-orchestrator/ldio-application/pom.xml index dbba854b1..78e384f7f 100644 --- a/ldi-orchestrator/ldio-application/pom.xml +++ b/ldi-orchestrator/ldio-application/pom.xml @@ -3,7 +3,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi ldi-orchestrator - 2.7.0-SNAPSHOT + 2.9.0 4.0.0 @@ -11,6 +11,15 @@ ldio-application + + org.springframework.modulith + spring-modulith-starter-core + + + org.springframework.modulith + spring-modulith-runtime + runtime + org.springframework.boot spring-boot-starter @@ -103,8 +112,26 @@ ${cucumber.version} test + + org.springframework.boot + spring-boot-starter-webflux + ${spring-boot.version} + test + + + + + org.springframework.modulith + spring-modulith-bom + ${spring-modulith.version} + import + pom + + + + @@ -327,7 +354,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldio - ldio-repository-materialiser + ldio-repository-sink ${project.version} diff --git a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/OpenApiConfig.java b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/OpenApiConfig.java similarity index 73% rename from ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/OpenApiConfig.java rename to ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/OpenApiConfig.java index 4e2923036..596116a7a 100644 --- a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/OpenApiConfig.java +++ b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/OpenApiConfig.java @@ -1,4 +1,4 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.config; +package be.vlaanderen.informatievlaanderen.ldes.ldio; import io.swagger.v3.oas.annotations.ExternalDocumentation; import io.swagger.v3.oas.annotations.OpenAPIDefinition; @@ -18,7 +18,10 @@ public class OpenApiConfig { public GroupedOpenApi publicApi() { return GroupedOpenApi.builder() .group("management") - .packagesToScan("be.vlaanderen.informatievlaanderen.ldes.ldio.management") + .packagesToScan("be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline", + "be.vlaanderen.informatievlaanderen.ldes.ldio.catalog", + "be.vlaanderen.informatievlaanderen.ldes.ldio.status", + "be.vlaanderen.informatievlaanderen.ldes.ldio.management") .build(); } diff --git a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/WebConfig.java b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/WebConfig.java similarity index 94% rename from ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/WebConfig.java rename to ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/WebConfig.java index 34a600830..d6c33545c 100644 --- a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/WebConfig.java +++ b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/WebConfig.java @@ -1,5 +1,6 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.config; +package be.vlaanderen.informatievlaanderen.ldes.ldio; +import com.fasterxml.jackson.dataformat.yaml.YAMLMapper; import org.springframework.context.annotation.Configuration; import org.springframework.http.MediaType; import org.springframework.http.converter.HttpMessageConverter; @@ -9,8 +10,6 @@ import java.util.List; -import com.fasterxml.jackson.dataformat.yaml.YAMLMapper; - /** * Configurer that adds the right HttpRequest and HttpResponse body converters to the application */ diff --git a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/CatalogController.java b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/catalog/CatalogController.java similarity index 75% rename from ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/CatalogController.java rename to ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/catalog/CatalogController.java index 34d558ebe..aab2d3b63 100644 --- a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/CatalogController.java +++ b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/catalog/CatalogController.java @@ -1,9 +1,9 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.management; +package be.vlaanderen.informatievlaanderen.ldes.ldio.catalog; -import be.vlaanderen.informatievlaanderen.ldes.ldio.configurator.LdioAdapterConfigurator; -import be.vlaanderen.informatievlaanderen.ldes.ldio.configurator.LdioInputConfigurator; -import be.vlaanderen.informatievlaanderen.ldes.ldio.configurator.LdioOutputConfigurator; -import be.vlaanderen.informatievlaanderen.ldes.ldio.configurator.LdioTransformerConfigurator; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioAdapterConfigurator; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioInputConfigurator; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioOutputConfigurator; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioTransformerConfigurator; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.GetMapping; diff --git a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/OpenApiCatalogController.java b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/catalog/OpenApiCatalogController.java similarity index 92% rename from ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/OpenApiCatalogController.java rename to ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/catalog/OpenApiCatalogController.java index 6a35d9fd2..00389a17c 100644 --- a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/OpenApiCatalogController.java +++ b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/catalog/OpenApiCatalogController.java @@ -1,4 +1,4 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.management; +package be.vlaanderen.informatievlaanderen.ldes.ldio.catalog; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Content; diff --git a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioMediaType.java b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioMediaType.java deleted file mode 100644 index b27d6eab1..000000000 --- a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioMediaType.java +++ /dev/null @@ -1,10 +0,0 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.config; - -public class LdioMediaType { - - private LdioMediaType() { - } - - public static final String APPLICATION_YAML_VALUE = "application/yaml"; - -} diff --git a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/events/SenderCreatedEvent.java b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/events/SenderCreatedEvent.java deleted file mode 100644 index fbe2dde12..000000000 --- a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/events/SenderCreatedEvent.java +++ /dev/null @@ -1,6 +0,0 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.events; - -import be.vlaanderen.informatievlaanderen.ldes.ldio.components.LdioSender; - -public record SenderCreatedEvent(String pipelineName, LdioSender ldioSender) { -} diff --git a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/services/PipelineService.java b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/PipelineService.java similarity index 83% rename from ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/services/PipelineService.java rename to ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/PipelineService.java index a5653f792..c7d821659 100644 --- a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/services/PipelineService.java +++ b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/PipelineService.java @@ -1,7 +1,6 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.services; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline; -import be.vlaanderen.informatievlaanderen.ldes.ldio.config.PipelineConfig; -import be.vlaanderen.informatievlaanderen.ldes.ldio.exception.PipelineException; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.exception.PipelineException; import java.io.File; diff --git a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/services/PipelineServiceImpl.java b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/PipelineServiceImpl.java similarity index 77% rename from ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/services/PipelineServiceImpl.java rename to ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/PipelineServiceImpl.java index 29ab68229..3997651f9 100644 --- a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/services/PipelineServiceImpl.java +++ b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/PipelineServiceImpl.java @@ -1,11 +1,12 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.services; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline; -import be.vlaanderen.informatievlaanderen.ldes.ldio.config.PipelineConfig; -import be.vlaanderen.informatievlaanderen.ldes.ldio.events.PipelineShutdownEvent; -import be.vlaanderen.informatievlaanderen.ldes.ldio.exception.PipelineAlreadyExistsException; -import be.vlaanderen.informatievlaanderen.ldes.ldio.exception.PipelineException; -import be.vlaanderen.informatievlaanderen.ldes.ldio.repositories.PipelineRepository; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.PipelineTO; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.PipelineCreatorService; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.events.PipelineShutdownEvent; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.exception.PipelineAlreadyExistsException; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.exception.PipelineException; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.persistence.PipelineRepository; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status.PipelineStatusService; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.web.dto.PipelineTO; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.event.EventListener; @@ -22,7 +23,7 @@ public class PipelineServiceImpl implements PipelineService { private final PipelineRepository pipelineRepository; public PipelineServiceImpl(PipelineCreatorService pipelineCreatorService, PipelineStatusService pipelineStatusService, - PipelineRepository pipelineRepository) { + PipelineRepository pipelineRepository) { this.pipelineCreatorService = pipelineCreatorService; this.pipelineStatusService = pipelineStatusService; this.pipelineRepository = pipelineRepository; diff --git a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/services/PipelineCreatorService.java b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/PipelineCreatorService.java similarity index 81% rename from ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/services/PipelineCreatorService.java rename to ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/PipelineCreatorService.java index d63da6ef4..981b103ec 100644 --- a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/services/PipelineCreatorService.java +++ b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/PipelineCreatorService.java @@ -1,24 +1,18 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.services; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation; import be.vlaanderen.informatievlaanderen.ldes.ldi.services.ComponentExecutor; import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiAdapter; import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiComponent; import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiOutput; -import be.vlaanderen.informatievlaanderen.ldes.ldio.components.*; -import be.vlaanderen.informatievlaanderen.ldes.ldio.config.OrchestratorConfig; -import be.vlaanderen.informatievlaanderen.ldes.ldio.config.PipelineConfig; -import be.vlaanderen.informatievlaanderen.ldes.ldio.configurator.LdioConfigurator; -import be.vlaanderen.informatievlaanderen.ldes.ldio.configurator.LdioInputConfigurator; -import be.vlaanderen.informatievlaanderen.ldes.ldio.configurator.LdioTransformerConfigurator; -import be.vlaanderen.informatievlaanderen.ldes.ldio.events.InputCreatedEvent; -import be.vlaanderen.informatievlaanderen.ldes.ldio.events.SenderCreatedEvent; -import be.vlaanderen.informatievlaanderen.ldes.ldio.exception.InvalidComponentException; -import be.vlaanderen.informatievlaanderen.ldes.ldio.exception.InvalidPipelineNameException; -import be.vlaanderen.informatievlaanderen.ldes.ldio.exception.LdiAdapterMissingException; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioInput; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioTransformer; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentDefinition; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.OrchestratorConfig; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.PipelineConfig; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.events.InputCreatedEvent; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.model.*; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentDefinition; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.exception.InvalidComponentException; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.exception.InvalidPipelineNameException; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.exception.LdiAdapterMissingException; import io.micrometer.observation.ObservationRegistry; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -32,9 +26,9 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -import static be.vlaanderen.informatievlaanderen.ldes.ldio.config.OrchestratorConfig.DEBUG; -import static be.vlaanderen.informatievlaanderen.ldes.ldio.config.OrchestratorConfig.ORCHESTRATOR_NAME; -import static be.vlaanderen.informatievlaanderen.ldes.ldio.config.PipelineConfig.NAME_PATTERN; +import static be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.OrchestratorConfig.DEBUG; +import static be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.OrchestratorConfig.ORCHESTRATOR_NAME; +import static be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.PipelineConfig.NAME_PATTERN; @Service public class PipelineCreatorService { @@ -96,7 +90,7 @@ private static void verifyAdapter(PipelineConfig config, LdioInputConfigurator c throw new LdiAdapterMissingException(config.getName(), config.getInput().getName()); } if (!configurator.isAdapterRequired() && adapter != null) { - log.warn("Pipeline \"{}\": Input: \"{}\": \"{}\" ignored", config.getName(), config.getInput().getName(), adapter.getName()); + log.warn("Pipeline \"{}\": Input: \"{}\": \"{}\" ignored", normalise(config.getName()), normalise(config.getInput().getName()), normalise(adapter.getName())); } } @@ -201,4 +195,8 @@ private ComponentDefinition addPipelineNameIfMissingToComponentDefinition(Compon } return componentDefinition; } + + private static String normalise(String input) { + return input.replaceAll("[\n\r]", "_"); + } } diff --git a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/SenderCreatedEvent.java b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/SenderCreatedEvent.java new file mode 100644 index 000000000..37d3b729b --- /dev/null +++ b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/SenderCreatedEvent.java @@ -0,0 +1,6 @@ +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation; + +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.model.LdioSender; + +public record SenderCreatedEvent(String pipelineName, LdioSender ldioSender) { +} diff --git a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/components/AdapterDebugger.java b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/model/AdapterDebugger.java similarity index 89% rename from ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/components/AdapterDebugger.java rename to ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/model/AdapterDebugger.java index bfc11ab0c..58e9ac18b 100644 --- a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/components/AdapterDebugger.java +++ b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/model/AdapterDebugger.java @@ -1,4 +1,4 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.components; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.model; import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiAdapter; import org.apache.jena.rdf.model.Model; diff --git a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/components/ComponentExecutorImpl.java b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/model/ComponentExecutorImpl.java similarity index 75% rename from ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/components/ComponentExecutorImpl.java rename to ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/model/ComponentExecutorImpl.java index 34b1589cc..a5b8a13ec 100644 --- a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/components/ComponentExecutorImpl.java +++ b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/model/ComponentExecutorImpl.java @@ -1,7 +1,7 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.components; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.model; import be.vlaanderen.informatievlaanderen.ldes.ldi.services.ComponentExecutor; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioTransformer; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioTransformer; import org.apache.jena.rdf.model.Model; public class ComponentExecutorImpl implements ComponentExecutor { diff --git a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/components/LdiOutputLogger.java b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/model/LdiOutputLogger.java similarity index 87% rename from ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/components/LdiOutputLogger.java rename to ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/model/LdiOutputLogger.java index 1d26bbce1..b1eb56bd5 100644 --- a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/components/LdiOutputLogger.java +++ b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/model/LdiOutputLogger.java @@ -1,7 +1,7 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.components; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.model; import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiOutput; -import be.vlaanderen.informatievlaanderen.ldes.ldio.config.ObserveConfiguration; +import be.vlaanderen.informatievlaanderen.ldes.ldio.ObserveConfiguration; import io.micrometer.observation.Observation; import io.micrometer.observation.ObservationRegistry; import org.apache.jena.rdf.model.Model; diff --git a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/components/LdioSender.java b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/model/LdioSender.java similarity index 80% rename from ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/components/LdioSender.java rename to ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/model/LdioSender.java index 168299404..9faa6ffe3 100644 --- a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/components/LdioSender.java +++ b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/model/LdioSender.java @@ -1,13 +1,13 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.components; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.model; import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiOutput; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioTransformer; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioTransformer; import io.micrometer.core.instrument.Metrics; import org.apache.jena.rdf.model.Model; import java.util.List; -import static be.vlaanderen.informatievlaanderen.ldes.ldio.config.PipelineConfig.PIPELINE_NAME; +import static be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.PipelineConfig.PIPELINE_NAME; /** * Important implementation of the LdioTransformer which must be added at the end of every transformer chains of @@ -29,7 +29,7 @@ public LdioSender(String pipelineName, @Override public void apply(Model model) { - Metrics.counter(LDIO_DATA_OUT, PIPELINE_NAME, pipelineName).increment(); ldiOutputs.parallelStream().forEach(ldiOutput -> ldiOutput.accept(model)); + Metrics.counter(LDIO_DATA_OUT, PIPELINE_NAME, pipelineName).increment(); } } diff --git a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/components/OutputDebugger.java b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/model/OutputDebugger.java similarity index 90% rename from ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/components/OutputDebugger.java rename to ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/model/OutputDebugger.java index f44d4573e..d078cd5d8 100644 --- a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/components/OutputDebugger.java +++ b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/model/OutputDebugger.java @@ -1,4 +1,4 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.components; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.model; import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiOutput; import org.apache.jena.rdf.model.Model; diff --git a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/components/TransformerDebugger.java b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/model/TransformerDebugger.java similarity index 79% rename from ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/components/TransformerDebugger.java rename to ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/model/TransformerDebugger.java index 0ec97f874..82681928d 100644 --- a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/components/TransformerDebugger.java +++ b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/model/TransformerDebugger.java @@ -1,6 +1,6 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.components; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.model; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioTransformer; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioTransformer; import org.apache.jena.rdf.model.Model; import org.apache.jena.riot.Lang; import org.apache.jena.riot.RDFWriter; diff --git a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/services/initializer/ConfigPipelineInitializer.java b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/initializer/ConfigPipelineInitializer.java similarity index 76% rename from ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/services/initializer/ConfigPipelineInitializer.java rename to ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/initializer/ConfigPipelineInitializer.java index c8c5d45ae..a4fbe71ce 100644 --- a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/services/initializer/ConfigPipelineInitializer.java +++ b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/initializer/ConfigPipelineInitializer.java @@ -1,10 +1,10 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.services.initializer; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.initializer; -import be.vlaanderen.informatievlaanderen.ldes.ldio.config.OrchestratorConfig; -import be.vlaanderen.informatievlaanderen.ldes.ldio.config.PipelineConfig; -import be.vlaanderen.informatievlaanderen.ldes.ldio.exception.PipelineAlreadyExistsException; -import be.vlaanderen.informatievlaanderen.ldes.ldio.exception.PipelineException; -import be.vlaanderen.informatievlaanderen.ldes.ldio.services.PipelineService; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.OrchestratorConfig; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.PipelineConfig; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.PipelineService; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.exception.PipelineAlreadyExistsException; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.exception.PipelineException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; diff --git a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/services/initializer/FileStoredPipelineInitializer.java b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/initializer/FileStoredPipelineInitializer.java similarity index 73% rename from ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/services/initializer/FileStoredPipelineInitializer.java rename to ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/initializer/FileStoredPipelineInitializer.java index 075780e93..3410ed234 100644 --- a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/services/initializer/FileStoredPipelineInitializer.java +++ b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/initializer/FileStoredPipelineInitializer.java @@ -1,10 +1,10 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.services.initializer; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.initializer; -import be.vlaanderen.informatievlaanderen.ldes.ldio.config.PipelineConfig; -import be.vlaanderen.informatievlaanderen.ldes.ldio.exception.PipelineException; -import be.vlaanderen.informatievlaanderen.ldes.ldio.repositories.PipelineFileRepository; -import be.vlaanderen.informatievlaanderen.ldes.ldio.services.PipelineService; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.PipelineConfigTO; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.PipelineConfig; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.PipelineService; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.exception.PipelineException; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.persistence.PipelineFileRepository; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.web.dto.PipelineConfigTO; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; diff --git a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/initializer/PipelineInitializer.java b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/initializer/PipelineInitializer.java new file mode 100644 index 000000000..c05cae633 --- /dev/null +++ b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/initializer/PipelineInitializer.java @@ -0,0 +1,11 @@ +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.initializer; + +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.PipelineConfig; + +import java.util.List; + +public interface PipelineInitializer { + String name(); + + List initPipelines(); +} diff --git a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/services/PipelineStartupService.java b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/initializer/PipelineStartupService.java similarity index 61% rename from ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/services/PipelineStartupService.java rename to ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/initializer/PipelineStartupService.java index 1e2299b6e..6260585bc 100644 --- a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/services/PipelineStartupService.java +++ b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/initializer/PipelineStartupService.java @@ -1,18 +1,14 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.services; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.initializer; -import be.vlaanderen.informatievlaanderen.ldes.ldio.services.initializer.ConfigPipelineInitializer; -import be.vlaanderen.informatievlaanderen.ldes.ldio.services.initializer.FileStoredPipelineInitializer; -import be.vlaanderen.informatievlaanderen.ldes.ldio.services.initializer.PipelineInitializer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.context.event.ContextRefreshedEvent; -import org.springframework.context.event.EventListener; +import org.springframework.modulith.ApplicationModuleInitializer; import org.springframework.stereotype.Service; import java.util.stream.Stream; @Service -public class PipelineStartupService { +public class PipelineStartupService implements ApplicationModuleInitializer { private final Logger log = LoggerFactory.getLogger(PipelineStartupService.class); private final Stream pipelineInitiators; @@ -22,8 +18,8 @@ public PipelineStartupService(ConfigPipelineInitializer configPipelineInitialize this.pipelineInitiators = Stream.of(fileStoredPipelineInitializer, configPipelineInitializer); } - @EventListener - public void initPipelines(ContextRefreshedEvent ignored) { + @Override + public void initialize() { pipelineInitiators.forEach(initializer -> { log.info("=== Processing pipelines with {} ===", initializer.name()); var pipelines = initializer.initPipelines(); diff --git a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/repositories/PipelineFileRepository.java b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/persistence/PipelineFileRepository.java similarity index 90% rename from ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/repositories/PipelineFileRepository.java rename to ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/persistence/PipelineFileRepository.java index 9e5f7fe3d..ebcd6e8dc 100644 --- a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/repositories/PipelineFileRepository.java +++ b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/persistence/PipelineFileRepository.java @@ -1,10 +1,15 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.repositories; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.persistence; -import be.vlaanderen.informatievlaanderen.ldes.ldio.config.OrchestratorConfig; -import be.vlaanderen.informatievlaanderen.ldes.ldio.config.PipelineConfig; -import be.vlaanderen.informatievlaanderen.ldes.ldio.exception.PipelineAlreadyExistsException; -import be.vlaanderen.informatievlaanderen.ldes.ldio.exception.PipelineParsingException; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.PipelineConfigTO; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.OrchestratorConfig; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.PipelineConfig; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.exception.PipelineAlreadyExistsException; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.exception.PipelineParsingException; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.web.dto.PipelineConfigTO; +import com.fasterxml.jackson.core.util.DefaultPrettyPrinter; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.ObjectReader; +import com.fasterxml.jackson.databind.ObjectWriter; +import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; @@ -19,13 +24,7 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import com.fasterxml.jackson.core.util.DefaultPrettyPrinter; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.ObjectReader; -import com.fasterxml.jackson.databind.ObjectWriter; -import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; - -import static be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.PipelineConfigTO.fromPipelineConfig; +import static be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.web.dto.PipelineConfigTO.fromPipelineConfig; import static java.util.Optional.ofNullable; @Service diff --git a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/repositories/PipelineRepository.java b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/persistence/PipelineRepository.java similarity index 83% rename from ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/repositories/PipelineRepository.java rename to ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/persistence/PipelineRepository.java index 7a709da18..deaa95633 100644 --- a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/repositories/PipelineRepository.java +++ b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/persistence/PipelineRepository.java @@ -1,7 +1,7 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.repositories; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.persistence; -import be.vlaanderen.informatievlaanderen.ldes.ldio.config.PipelineConfig; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.PipelineConfigTO; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.PipelineConfig; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.web.dto.PipelineConfigTO; import java.io.File; import java.util.List; diff --git a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/services/PipelineStatusService.java b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/status/PipelineStatusService.java similarity index 85% rename from ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/services/PipelineStatusService.java rename to ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/status/PipelineStatusService.java index 5b27c91be..b42b5337a 100644 --- a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/services/PipelineStatusService.java +++ b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/status/PipelineStatusService.java @@ -1,7 +1,4 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.services; - -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.PipelineStatus; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.StatusChangeSource; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status; import java.util.Map; diff --git a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/services/PipelineStatusServiceImpl.java b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/status/PipelineStatusServiceImpl.java similarity index 80% rename from ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/services/PipelineStatusServiceImpl.java rename to ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/status/PipelineStatusServiceImpl.java index ea6aae526..62fd472a8 100644 --- a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/services/PipelineStatusServiceImpl.java +++ b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/status/PipelineStatusServiceImpl.java @@ -1,12 +1,10 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.services; - -import be.vlaanderen.informatievlaanderen.ldes.ldio.events.InputCreatedEvent; -import be.vlaanderen.informatievlaanderen.ldes.ldio.events.PipelineDeletedEvent; -import be.vlaanderen.informatievlaanderen.ldes.ldio.events.PipelineStatusEvent; -import be.vlaanderen.informatievlaanderen.ldes.ldio.exception.PipelineDoesNotExistException; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioInput; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.PipelineStatus; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.StatusChangeSource; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status; + +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioInput; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.events.InputCreatedEvent; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.events.PipelineDeletedEvent; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.exception.PipelineDoesNotExistException; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status.events.PipelineStatusEvent; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.ApplicationEventPublisher; @@ -18,9 +16,9 @@ import java.util.Optional; import java.util.stream.Collectors; -import static be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.PipelineStatus.*; -import static be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.PipelineStatusTrigger.*; -import static be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.StatusChangeSource.AUTO; +import static be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status.PipelineStatus.*; +import static be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status.PipelineStatusTrigger.*; +import static be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status.StatusChangeSource.AUTO; @Component public class PipelineStatusServiceImpl implements PipelineStatusService { diff --git a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/OpenApiPipelineStatusController.java b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/status/web/OpenApiPipelineStatusController.java similarity index 92% rename from ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/OpenApiPipelineStatusController.java rename to ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/status/web/OpenApiPipelineStatusController.java index 435785369..43e913352 100644 --- a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/OpenApiPipelineStatusController.java +++ b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/status/web/OpenApiPipelineStatusController.java @@ -1,6 +1,6 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.management; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status.web; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.PipelineStatus; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status.PipelineStatus; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; diff --git a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/PipelineStatusController.java b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/status/web/PipelineStatusController.java similarity index 86% rename from ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/PipelineStatusController.java rename to ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/status/web/PipelineStatusController.java index 5210d74a1..07b97b863 100644 --- a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/PipelineStatusController.java +++ b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/status/web/PipelineStatusController.java @@ -1,7 +1,7 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.management; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status.web; -import be.vlaanderen.informatievlaanderen.ldes.ldio.services.PipelineStatusService; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.PipelineStatus; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status.PipelineStatus; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status.PipelineStatusService; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.*; diff --git a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/converters/PipelineStatusConverter.java b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/status/web/PipelineStatusConverter.java similarity index 90% rename from ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/converters/PipelineStatusConverter.java rename to ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/status/web/PipelineStatusConverter.java index c54cc59b3..5ac8cd76b 100644 --- a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/converters/PipelineStatusConverter.java +++ b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/status/web/PipelineStatusConverter.java @@ -1,6 +1,6 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.converters; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status.web; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.PipelineStatus; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status.PipelineStatus; import org.springframework.http.HttpInputMessage; import org.springframework.http.HttpOutputMessage; import org.springframework.http.MediaType; diff --git a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/converters/FlattenDeserializer.java b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/web/FlattenDeserializer.java similarity index 96% rename from ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/converters/FlattenDeserializer.java rename to ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/web/FlattenDeserializer.java index b49c6e780..a2352ebd7 100644 --- a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/converters/FlattenDeserializer.java +++ b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/web/FlattenDeserializer.java @@ -1,4 +1,4 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.converters; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.web; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.DeserializationContext; diff --git a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/OpenApiPipelineController.java b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/web/OpenApiPipelineController.java similarity index 72% rename from ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/OpenApiPipelineController.java rename to ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/web/OpenApiPipelineController.java index 2f4b27359..4d5579b50 100644 --- a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/OpenApiPipelineController.java +++ b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/web/OpenApiPipelineController.java @@ -1,8 +1,7 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.management; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.web; -import be.vlaanderen.informatievlaanderen.ldes.ldio.config.LdioMediaType; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.PipelineConfigTO; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.PipelineTO; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.web.dto.PipelineConfigTO; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.web.dto.PipelineTO; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; @@ -19,10 +18,11 @@ @Tag(name = "Pipeline controller") public interface OpenApiPipelineController { + String APPLICATION_YAML_VALUE = "application/yaml"; @ApiResponse(responseCode = "200", description = "A list of all active pipelines is shown.", content = { @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, schema = @Schema(implementation = PipelineTO.class)), - @Content(mediaType = LdioMediaType.APPLICATION_YAML_VALUE, schema = @Schema(implementation = PipelineTO.class)) + @Content(mediaType = APPLICATION_YAML_VALUE, schema = @Schema(implementation = PipelineTO.class)) }) @Operation(summary = "Get a list of all active pipelines.") @GetMapping @@ -30,13 +30,13 @@ public interface OpenApiPipelineController { @ApiResponse(responseCode = "201", description = "The new pipeline is returned.", content = { @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, schema = @Schema(implementation = PipelineTO.class)), - @Content(mediaType = LdioMediaType.APPLICATION_YAML_VALUE, schema = @Schema(implementation = PipelineTO.class)) + @Content(mediaType = APPLICATION_YAML_VALUE, schema = @Schema(implementation = PipelineTO.class)) }) @Operation(summary = "Create a new pipeline.") @PostMapping PipelineTO addPipeline(@RequestBody(description = "The pipeline configuration", content = { @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, schema = @Schema(implementation = PipelineConfigTO.class)), - @Content(mediaType = LdioMediaType.APPLICATION_YAML_VALUE, schema = @Schema(implementation = PipelineConfigTO.class)) + @Content(mediaType = APPLICATION_YAML_VALUE, schema = @Schema(implementation = PipelineConfigTO.class)) }) PipelineConfigTO config); @ApiResponse(responseCode = "202") diff --git a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/PipelineController.java b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/web/PipelineController.java similarity index 75% rename from ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/PipelineController.java rename to ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/web/PipelineController.java index fe4eae20d..1c6299c74 100644 --- a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/PipelineController.java +++ b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/web/PipelineController.java @@ -1,10 +1,9 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.management; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.web; -import be.vlaanderen.informatievlaanderen.ldes.ldio.config.LdioMediaType; -import be.vlaanderen.informatievlaanderen.ldes.ldio.services.PipelineServiceImpl; -import be.vlaanderen.informatievlaanderen.ldes.ldio.services.PipelineStatusService; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.PipelineConfigTO; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.PipelineTO; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.PipelineServiceImpl; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status.PipelineStatusService; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.web.dto.PipelineConfigTO; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.web.dto.PipelineTO; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; @@ -15,7 +14,6 @@ @RestController @RequestMapping(path = "/admin/api/v1/pipeline") public class PipelineController implements OpenApiPipelineController { - private final PipelineServiceImpl pipelineService; private final PipelineStatusService pipelineStatusService; @@ -30,7 +28,7 @@ public PipelineController(PipelineServiceImpl pipelineService, PipelineStatusSer * @return A list of pipeline objects that containing the configuration and its current state. */ @Override - @GetMapping(produces = {MediaType.APPLICATION_JSON_VALUE, LdioMediaType.APPLICATION_YAML_VALUE}) + @GetMapping(produces = {MediaType.APPLICATION_JSON_VALUE, APPLICATION_YAML_VALUE}) public List overview() { return pipelineService.getPipelines(); } @@ -43,7 +41,7 @@ public List overview() { */ @Override @ResponseStatus(code = HttpStatus.CREATED) - @PostMapping(consumes = {MediaType.APPLICATION_JSON_VALUE, LdioMediaType.APPLICATION_YAML_VALUE}, produces = {MediaType.APPLICATION_JSON_VALUE, LdioMediaType.APPLICATION_YAML_VALUE}) + @PostMapping(consumes = {MediaType.APPLICATION_JSON_VALUE, APPLICATION_YAML_VALUE}, produces = {MediaType.APPLICATION_JSON_VALUE, APPLICATION_YAML_VALUE}) public PipelineTO addPipeline(@RequestBody PipelineConfigTO config) { var pipelineConfig = PipelineConfigTO.fromPipelineConfig(pipelineService.addPipeline(config.toPipelineConfig())); diff --git a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/PipelineExceptionHandler.java b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/web/PipelineExceptionHandler.java similarity index 89% rename from ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/PipelineExceptionHandler.java rename to ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/web/PipelineExceptionHandler.java index 6b78f5bb9..207850076 100644 --- a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/PipelineExceptionHandler.java +++ b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/web/PipelineExceptionHandler.java @@ -1,6 +1,6 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.management; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.web; -import be.vlaanderen.informatievlaanderen.ldes.ldio.exception.*; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.exception.*; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; diff --git a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/valueobjects/ComponentDefinitionTO.java b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/web/dto/ComponentDefinitionTO.java similarity index 68% rename from ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/valueobjects/ComponentDefinitionTO.java rename to ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/web/dto/ComponentDefinitionTO.java index 8f30e8fb8..d447cc501 100644 --- a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/valueobjects/ComponentDefinitionTO.java +++ b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/web/dto/ComponentDefinitionTO.java @@ -1,11 +1,11 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.web.dto; -import be.vlaanderen.informatievlaanderen.ldes.ldio.converters.FlattenDeserializer; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentDefinition; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.web.FlattenDeserializer; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import java.util.Map; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; - public record ComponentDefinitionTO(String name, @JsonDeserialize(using = FlattenDeserializer.class) Map config) { public ComponentDefinitionTO(String name, Map config) { diff --git a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/valueobjects/InputComponentDefinitionTO.java b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/web/dto/InputComponentDefinitionTO.java similarity index 92% rename from ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/valueobjects/InputComponentDefinitionTO.java rename to ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/web/dto/InputComponentDefinitionTO.java index 172b86b4f..8eb653573 100644 --- a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/valueobjects/InputComponentDefinitionTO.java +++ b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/web/dto/InputComponentDefinitionTO.java @@ -1,17 +1,16 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects; - -import be.vlaanderen.informatievlaanderen.ldes.ldio.converters.FlattenDeserializer; - -import java.util.Map; -import java.util.Objects; -import java.util.Optional; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.web.dto; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.web.FlattenDeserializer; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + public final class InputComponentDefinitionTO { private final String name; @JsonProperty diff --git a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/valueobjects/PipelineConfigTO.java b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/web/dto/PipelineConfigTO.java similarity index 86% rename from ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/valueobjects/PipelineConfigTO.java rename to ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/web/dto/PipelineConfigTO.java index 47c235933..96fc1de87 100644 --- a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/valueobjects/PipelineConfigTO.java +++ b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/web/dto/PipelineConfigTO.java @@ -1,6 +1,8 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.web.dto; -import be.vlaanderen.informatievlaanderen.ldes.ldio.config.PipelineConfig; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.PipelineConfig; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentDefinition; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.InputComponentDefinition; import java.util.List; diff --git a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/valueobjects/PipelineTO.java b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/web/dto/PipelineTO.java similarity index 86% rename from ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/valueobjects/PipelineTO.java rename to ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/web/dto/PipelineTO.java index 489d8c00b..b16dfa162 100644 --- a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/valueobjects/PipelineTO.java +++ b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/web/dto/PipelineTO.java @@ -1,4 +1,7 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.web.dto; + +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status.PipelineStatus; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status.StatusChangeSource; import java.util.Collections; import java.util.List; diff --git a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/services/initializer/PipelineInitializer.java b/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/services/initializer/PipelineInitializer.java deleted file mode 100644 index 424fa80cb..000000000 --- a/ldi-orchestrator/ldio-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/services/initializer/PipelineInitializer.java +++ /dev/null @@ -1,11 +0,0 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.services.initializer; - -import be.vlaanderen.informatievlaanderen.ldes.ldio.config.PipelineConfig; - -import java.util.List; - -public interface PipelineInitializer { - String name(); - - List initPipelines(); -} diff --git a/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioStepdefs.java b/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioStepdefs.java index bd9522d9a..bc25f4a54 100644 --- a/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioStepdefs.java +++ b/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioStepdefs.java @@ -1,12 +1,15 @@ package be.vlaanderen.informatievlaanderen.ldes.ldio; -import be.vlaanderen.informatievlaanderen.ldes.ldio.repositories.PipelineFileRepository; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.PipelineConfigTO; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.persistence.PipelineFileRepository; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.web.dto.PipelineConfigTO; import io.cucumber.java.After; import io.cucumber.java.en.And; import io.cucumber.java.en.When; import io.cucumber.spring.CucumberContextConfiguration; import org.apache.commons.io.IOUtils; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.WebApplicationType; +import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.http.MediaType; import org.springframework.test.web.reactive.server.WebTestClient; import org.springframework.test.web.servlet.client.MockMvcWebTestClient; @@ -19,7 +22,7 @@ import java.net.URISyntaxException; import java.util.Map; -import static be.vlaanderen.informatievlaanderen.ldes.ldio.repositories.PipelineFileRepositoryTest.getInitialFiles; +import static be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.persistence.PipelineFileRepositoryTest.getInitialFiles; import static org.junit.Assert.assertEquals; @CucumberContextConfiguration @@ -115,7 +118,7 @@ public void theExpectedPipelineHasOneTransformer(int count) { } private void postPipeline(String filePath, String contentType, int statusCode) throws IOException { - var content = IOUtils.toString(new FileInputStream(filePath)); + var content = IOUtils.toByteArray(new FileInputStream(filePath)); client.post() .uri(managementURI) .contentType(MediaType.valueOf(contentType)) @@ -124,4 +127,17 @@ private void postPipeline(String filePath, String contentType, int statusCode) t .expectStatus() .isEqualTo(statusCode); } + + static class MinStarterLdioApp { + static ConfigurableWebApplicationContext setupApp(String file) { + System.setProperty("spring.main.allow-bean-definition-overriding", "true"); + + SpringApplication app = new SpringApplicationBuilder(Application.class) + .web(WebApplicationType.SERVLET) + .properties("spring.config.location=classpath:/startup/" + file + ".yml") + .build(); + + return (ConfigurableWebApplicationContext) app.run(); + } + } } diff --git a/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/MinStarterLdioApp.java b/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/MinStarterLdioApp.java deleted file mode 100644 index 29e5cf2bb..000000000 --- a/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/MinStarterLdioApp.java +++ /dev/null @@ -1,19 +0,0 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.WebApplicationType; -import org.springframework.boot.builder.SpringApplicationBuilder; -import org.springframework.web.context.ConfigurableWebApplicationContext; - -public class MinStarterLdioApp { - static ConfigurableWebApplicationContext setupApp(String file) { - System.setProperty("spring.main.allow-bean-definition-overriding", "true"); - - SpringApplication app = new SpringApplicationBuilder(Application.class) - .web(WebApplicationType.SERVLET) - .properties("spring.config.location=classpath:/startup/" + file + ".yml") - .build(); - - return (ConfigurableWebApplicationContext) app.run(); - } -} diff --git a/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/MockFlowConfiguration.java b/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/MockFlowConfiguration.java index f139b5584..b606c9008 100644 --- a/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/MockFlowConfiguration.java +++ b/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/MockFlowConfiguration.java @@ -3,13 +3,8 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.services.ComponentExecutor; import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiAdapter; import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiOutput; -import be.vlaanderen.informatievlaanderen.ldes.ldio.configurator.LdioConfigurator; -import be.vlaanderen.informatievlaanderen.ldes.ldio.configurator.LdioInputConfigurator; -import be.vlaanderen.informatievlaanderen.ldes.ldio.configurator.LdioTransformerConfigurator; -import be.vlaanderen.informatievlaanderen.ldes.ldio.modules.*; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioInput; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioTransformer; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.*; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.ApplicationEventPublisher; diff --git a/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/PipelineIntegrationTest.java b/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/PipelineIntegrationTest.java index c9a0e76b2..e13058ce4 100644 --- a/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/PipelineIntegrationTest.java +++ b/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/PipelineIntegrationTest.java @@ -1,7 +1,7 @@ package be.vlaanderen.informatievlaanderen.ldes.ldio; -import be.vlaanderen.informatievlaanderen.ldes.ldio.modules.DummyIn; -import be.vlaanderen.informatievlaanderen.ldes.ldio.modules.MockVault; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.DummyIn; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.MockVault; import org.apache.jena.rdf.model.Model; import org.apache.jena.riot.Lang; import org.apache.jena.riot.RDFParserBuilder; diff --git a/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/services/PipelineServiceTest.java b/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/PipelineServiceTest.java similarity index 78% rename from ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/services/PipelineServiceTest.java rename to ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/PipelineServiceTest.java index c4f993417..505341175 100644 --- a/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/services/PipelineServiceTest.java +++ b/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/PipelineServiceTest.java @@ -1,7 +1,10 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.services; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline; -import be.vlaanderen.informatievlaanderen.ldes.ldio.events.PipelineShutdownEvent; -import be.vlaanderen.informatievlaanderen.ldes.ldio.repositories.PipelineFileRepository; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.PipelineCreatorService; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.events.PipelineShutdownEvent; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.persistence.PipelineFileRepository; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status.PipelineStatusService; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status.PipelineStatusServiceImpl; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; diff --git a/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/modules/DummyAdapt.java b/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/DummyAdapt.java similarity index 87% rename from ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/modules/DummyAdapt.java rename to ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/DummyAdapt.java index c2c8d8b00..2b24200da 100644 --- a/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/modules/DummyAdapt.java +++ b/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/DummyAdapt.java @@ -1,4 +1,4 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.modules; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation; import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiAdapter; import org.apache.jena.rdf.model.Model; diff --git a/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/modules/DummyIn.java b/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/DummyIn.java similarity index 72% rename from ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/modules/DummyIn.java rename to ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/DummyIn.java index 0d14d6b7a..5b227b2df 100644 --- a/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/modules/DummyIn.java +++ b/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/DummyIn.java @@ -1,12 +1,10 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.modules; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation; import be.vlaanderen.informatievlaanderen.ldes.ldi.services.ComponentExecutor; import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiAdapter; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioInput; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioObserver; import org.springframework.context.ApplicationEventPublisher; -import static be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.PipelineStatusTrigger.START; +import static be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status.PipelineStatusTrigger.START; public class DummyIn extends LdioInput { private int counter = 0; @@ -24,15 +22,16 @@ public void sendData() { @Override public void shutdown() { + // No implementation needed for this test class } @Override protected void resume() { - + // No implementation needed for this test class } @Override protected void pause() { - + // No implementation needed for this test class } } diff --git a/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/modules/DummyOut.java b/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/DummyOut.java similarity index 83% rename from ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/modules/DummyOut.java rename to ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/DummyOut.java index 35a617910..dbf4f9aa6 100644 --- a/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/modules/DummyOut.java +++ b/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/DummyOut.java @@ -1,4 +1,4 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.modules; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation; import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiOutput; import org.apache.jena.rdf.model.Model; diff --git a/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/modules/DummyTransform.java b/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/DummyTransform.java similarity index 80% rename from ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/modules/DummyTransform.java rename to ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/DummyTransform.java index fcb7e3b9b..ec62d456d 100644 --- a/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/modules/DummyTransform.java +++ b/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/DummyTransform.java @@ -1,7 +1,6 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.modules; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation; import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiOneToOneTransformer; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioTransformer; import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.Resource; diff --git a/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/modules/MockVault.java b/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/MockVault.java similarity index 84% rename from ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/modules/MockVault.java rename to ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/MockVault.java index 3db4695c6..0a7c3a41a 100644 --- a/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/modules/MockVault.java +++ b/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/MockVault.java @@ -1,4 +1,4 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.modules; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation; import org.apache.jena.rdf.model.Model; import org.springframework.stereotype.Component; diff --git a/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/services/PipelineCreatorServiceTest.java b/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/PipelineCreatorServiceTest.java similarity index 80% rename from ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/services/PipelineCreatorServiceTest.java rename to ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/PipelineCreatorServiceTest.java index f440a6a45..064a92d6c 100644 --- a/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/services/PipelineCreatorServiceTest.java +++ b/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/PipelineCreatorServiceTest.java @@ -1,11 +1,11 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.services; - -import be.vlaanderen.informatievlaanderen.ldes.ldio.config.OrchestratorConfig; -import be.vlaanderen.informatievlaanderen.ldes.ldio.config.PipelineConfig; -import be.vlaanderen.informatievlaanderen.ldes.ldio.exception.LdiAdapterMissingException; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentDefinitionTO; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.InputComponentDefinitionTO; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.PipelineConfigTO; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation; + +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.OrchestratorConfig; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.PipelineConfig; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.exception.LdiAdapterMissingException; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.web.dto.ComponentDefinitionTO; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.web.dto.InputComponentDefinitionTO; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.web.dto.PipelineConfigTO; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; diff --git a/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/repositories/PipelineFileRepositoryTest.java b/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/persistence/PipelineFileRepositoryTest.java similarity index 86% rename from ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/repositories/PipelineFileRepositoryTest.java rename to ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/persistence/PipelineFileRepositoryTest.java index 40da048cd..1b743bef7 100644 --- a/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/repositories/PipelineFileRepositoryTest.java +++ b/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/persistence/PipelineFileRepositoryTest.java @@ -1,12 +1,12 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.repositories; - -import be.vlaanderen.informatievlaanderen.ldes.ldio.config.OrchestratorConfig; -import be.vlaanderen.informatievlaanderen.ldes.ldio.config.PipelineConfig; -import be.vlaanderen.informatievlaanderen.ldes.ldio.exception.PipelineAlreadyExistsException; -import be.vlaanderen.informatievlaanderen.ldes.ldio.exception.PipelineParsingException; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentDefinition; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.InputComponentDefinition; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.PipelineConfigTO; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.persistence; + +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.OrchestratorConfig; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.PipelineConfig; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentDefinition; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.InputComponentDefinition; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.exception.PipelineAlreadyExistsException; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.exception.PipelineParsingException; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.web.dto.PipelineConfigTO; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectReader; import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; @@ -23,8 +23,8 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import static be.vlaanderen.informatievlaanderen.ldes.ldio.repositories.PipelineFileRepository.EXTENSION_YAML; -import static be.vlaanderen.informatievlaanderen.ldes.ldio.repositories.PipelineFileRepository.EXTENSION_YML; +import static be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.persistence.PipelineFileRepository.EXTENSION_YAML; +import static be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.persistence.PipelineFileRepository.EXTENSION_YML; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.jupiter.api.Assertions.*; diff --git a/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/services/PipelineStatusServiceTest.java b/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/status/PipelineStatusServiceTest.java similarity index 72% rename from ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/services/PipelineStatusServiceTest.java rename to ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/status/PipelineStatusServiceTest.java index 917416591..bb25e7e60 100644 --- a/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/services/PipelineStatusServiceTest.java +++ b/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/status/PipelineStatusServiceTest.java @@ -1,10 +1,8 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.services; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status; -import be.vlaanderen.informatievlaanderen.ldes.ldio.events.InputCreatedEvent; -import be.vlaanderen.informatievlaanderen.ldes.ldio.events.PipelineDeletedEvent; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioInput; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.PipelineStatus; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.PipelineStatusTrigger; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioInput; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.events.InputCreatedEvent; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.events.PipelineDeletedEvent; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.context.ApplicationEventPublisher; diff --git a/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/converters/FlattenDeserializerTest.java b/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/web/FlattenDeserializerTest.java similarity index 97% rename from ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/converters/FlattenDeserializerTest.java rename to ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/web/FlattenDeserializerTest.java index 94834c0fe..cedffcf63 100644 --- a/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/converters/FlattenDeserializerTest.java +++ b/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/web/FlattenDeserializerTest.java @@ -1,5 +1,8 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.converters; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.web; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.ObjectMapper; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -9,10 +12,6 @@ import java.nio.charset.StandardCharsets; import java.util.Map; -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.ObjectMapper; - import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; diff --git a/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/PipelineControllerTest.java b/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/web/PipelineControllerTest.java similarity index 97% rename from ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/PipelineControllerTest.java rename to ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/web/PipelineControllerTest.java index 8c4e161b0..c547d38e4 100644 --- a/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/PipelineControllerTest.java +++ b/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/web/PipelineControllerTest.java @@ -1,4 +1,4 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.management; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.web; import org.apache.commons.io.FileUtils; import org.junit.jupiter.api.Test; diff --git a/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/valueobjects/PipelineTOTest.java b/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/web/dto/PipelineTOTest.java similarity index 87% rename from ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/valueobjects/PipelineTOTest.java rename to ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/web/dto/PipelineTOTest.java index 5f84c563c..acb347592 100644 --- a/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/valueobjects/PipelineTOTest.java +++ b/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/web/dto/PipelineTOTest.java @@ -1,12 +1,12 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.web.dto; import org.junit.jupiter.api.Test; import java.util.List; import java.util.Map; -import static be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.PipelineStatus.RUNNING; -import static be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.StatusChangeSource.AUTO; +import static be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status.PipelineStatus.RUNNING; +import static be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status.StatusChangeSource.AUTO; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; diff --git a/ldi-orchestrator/ldio-common/pom.xml b/ldi-orchestrator/ldio-common/pom.xml index c8c08c06b..29732b0eb 100644 --- a/ldi-orchestrator/ldio-common/pom.xml +++ b/ldi-orchestrator/ldio-common/pom.xml @@ -5,7 +5,7 @@ ldi-orchestrator be.vlaanderen.informatievlaanderen.ldes.ldi - 2.7.0-SNAPSHOT + 2.9.0 4.0.0 diff --git a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/ObserveConfiguration.java b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/ObserveConfiguration.java similarity index 86% rename from ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/ObserveConfiguration.java rename to ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/ObserveConfiguration.java index 2bd18f8e7..27e928efd 100644 --- a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/ObserveConfiguration.java +++ b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/ObserveConfiguration.java @@ -1,4 +1,4 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.config; +package be.vlaanderen.informatievlaanderen.ldes.ldio; import io.micrometer.observation.ObservationRegistry; import org.springframework.context.annotation.Bean; diff --git a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/events/InputCreatedEvent.java b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/events/InputCreatedEvent.java deleted file mode 100644 index ba7d9d77f..000000000 --- a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/events/InputCreatedEvent.java +++ /dev/null @@ -1,6 +0,0 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.events; - -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioInput; - -public record InputCreatedEvent(String pipelineName, LdioInput ldioInput) { -} diff --git a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/events/PipelineDeletedEvent.java b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/events/PipelineDeletedEvent.java deleted file mode 100644 index 17fc938e6..000000000 --- a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/events/PipelineDeletedEvent.java +++ /dev/null @@ -1,4 +0,0 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.events; - -public record PipelineDeletedEvent(String pipelineId) { -} diff --git a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/events/PipelineShutdownEvent.java b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/events/PipelineShutdownEvent.java deleted file mode 100644 index 67d3882d6..000000000 --- a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/events/PipelineShutdownEvent.java +++ /dev/null @@ -1,4 +0,0 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.events; - -public record PipelineShutdownEvent(String pipelineId) { -} diff --git a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/events/PipelineStatusEvent.java b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/events/PipelineStatusEvent.java deleted file mode 100644 index 0518ee700..000000000 --- a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/events/PipelineStatusEvent.java +++ /dev/null @@ -1,7 +0,0 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.events; - -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.PipelineStatus; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.StatusChangeSource; - -public record PipelineStatusEvent(String pipelineId, PipelineStatus status, StatusChangeSource statusChangeSource) { -} diff --git a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/exception/PipelineException.java b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/exception/PipelineException.java deleted file mode 100644 index 7f22eeab3..000000000 --- a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/exception/PipelineException.java +++ /dev/null @@ -1,4 +0,0 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.exception; - -public abstract class PipelineException extends RuntimeException { -} diff --git a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/OrchestratorConfig.java b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/OrchestratorConfig.java similarity index 93% rename from ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/OrchestratorConfig.java rename to ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/OrchestratorConfig.java index d6f19cd4e..8a7fa8702 100644 --- a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/OrchestratorConfig.java +++ b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/OrchestratorConfig.java @@ -1,4 +1,4 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.config; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Configuration; diff --git a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/PipelineConfig.java b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/PipelineConfig.java similarity index 81% rename from ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/PipelineConfig.java rename to ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/PipelineConfig.java index 06ab49238..e5468e239 100644 --- a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/PipelineConfig.java +++ b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/PipelineConfig.java @@ -1,7 +1,7 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.config; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentDefinition; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.InputComponentDefinition; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentDefinition; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.InputComponentDefinition; import java.util.LinkedList; import java.util.List; diff --git a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/configurator/LdioAdapterConfigurator.java b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/LdioAdapterConfigurator.java similarity index 85% rename from ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/configurator/LdioAdapterConfigurator.java rename to ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/LdioAdapterConfigurator.java index c1f904108..0292d961c 100644 --- a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/configurator/LdioAdapterConfigurator.java +++ b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/LdioAdapterConfigurator.java @@ -1,4 +1,4 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.configurator; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation; import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiAdapter; diff --git a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/configurator/LdioConfigurator.java b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/LdioConfigurator.java similarity index 60% rename from ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/configurator/LdioConfigurator.java rename to ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/LdioConfigurator.java index 938939e1c..38c5d5fa4 100644 --- a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/configurator/LdioConfigurator.java +++ b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/LdioConfigurator.java @@ -1,10 +1,10 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.configurator; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation; import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiComponent; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; /** - * Base interface to configure all LDIO components except for the {@link be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioInput} + * Base interface to configure all LDIO components except for the {@link LdioInput} */ @FunctionalInterface public interface LdioConfigurator { diff --git a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/types/LdioInput.java b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/LdioInput.java similarity index 83% rename from ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/types/LdioInput.java rename to ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/LdioInput.java index 11e6ebe72..728988467 100644 --- a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/types/LdioInput.java +++ b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/LdioInput.java @@ -1,11 +1,11 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.types; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation; import be.vlaanderen.informatievlaanderen.ldes.ldi.services.ComponentExecutor; import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiAdapter; import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiComponent; -import be.vlaanderen.informatievlaanderen.ldes.ldio.events.PipelineStatusEvent; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.PipelineStatus; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.PipelineStatusTrigger; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status.PipelineStatus; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status.PipelineStatusTrigger; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status.events.PipelineStatusEvent; import org.apache.jena.rdf.model.Model; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -13,9 +13,9 @@ import java.util.function.Supplier; -import static be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.PipelineStatus.*; -import static be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.PipelineStatusTrigger.START; -import static be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.StatusChangeSource.MANUAL; +import static be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status.PipelineStatus.*; +import static be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status.PipelineStatusTrigger.START; +import static be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status.StatusChangeSource.MANUAL; /** * Base class for the start of a LDIO workflow. @@ -65,6 +65,7 @@ protected void processModel(Model model) { public abstract void shutdown(); + @SuppressWarnings("java:S6916") public PipelineStatus updateStatus(PipelineStatusTrigger trigger) { switch (trigger) { case START -> this.pipelineStatus = RUNNING; diff --git a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/configurator/LdioInputConfigurator.java b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/LdioInputConfigurator.java similarity index 75% rename from ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/configurator/LdioInputConfigurator.java rename to ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/LdioInputConfigurator.java index 15471db13..4ee4d2651 100644 --- a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/configurator/LdioInputConfigurator.java +++ b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/LdioInputConfigurator.java @@ -1,9 +1,8 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.configurator; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation; import be.vlaanderen.informatievlaanderen.ldes.ldi.services.ComponentExecutor; import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiAdapter; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioInput; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; import org.springframework.context.ApplicationEventPublisher; /** diff --git a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/types/LdioObserver.java b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/LdioObserver.java similarity index 93% rename from ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/types/LdioObserver.java rename to ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/LdioObserver.java index 1aacc1450..1dc4d88d2 100644 --- a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/types/LdioObserver.java +++ b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/LdioObserver.java @@ -1,6 +1,6 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.types; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation; -import be.vlaanderen.informatievlaanderen.ldes.ldio.config.ObserveConfiguration; +import be.vlaanderen.informatievlaanderen.ldes.ldio.ObserveConfiguration; import io.micrometer.core.instrument.Metrics; import io.micrometer.observation.Observation; import io.micrometer.observation.ObservationRegistry; @@ -10,7 +10,7 @@ import java.util.Arrays; import java.util.function.Supplier; -import static be.vlaanderen.informatievlaanderen.ldes.ldio.config.PipelineConfig.PIPELINE_NAME; +import static be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.PipelineConfig.PIPELINE_NAME; /** * Observer that is dealing with errors and metrics from ldio actions diff --git a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/configurator/LdioOutputConfigurator.java b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/LdioOutputConfigurator.java similarity index 85% rename from ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/configurator/LdioOutputConfigurator.java rename to ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/LdioOutputConfigurator.java index 57c1153e2..25da0edcf 100644 --- a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/configurator/LdioOutputConfigurator.java +++ b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/LdioOutputConfigurator.java @@ -1,4 +1,4 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.configurator; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation; import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiOutput; diff --git a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/types/LdioTransformer.java b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/LdioTransformer.java similarity index 89% rename from ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/types/LdioTransformer.java rename to ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/LdioTransformer.java index 2912e78f1..2eb9c81d4 100644 --- a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/types/LdioTransformer.java +++ b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/LdioTransformer.java @@ -1,7 +1,7 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.types; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation; import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiComponent; -import be.vlaanderen.informatievlaanderen.ldes.ldio.config.ObserveConfiguration; +import be.vlaanderen.informatievlaanderen.ldes.ldio.ObserveConfiguration; import io.micrometer.observation.annotation.Observed; import org.apache.jena.rdf.model.Model; import org.slf4j.Logger; diff --git a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/configurator/LdioTransformerConfigurator.java b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/LdioTransformerConfigurator.java similarity index 66% rename from ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/configurator/LdioTransformerConfigurator.java rename to ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/LdioTransformerConfigurator.java index 734d12862..6f7771766 100644 --- a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/configurator/LdioTransformerConfigurator.java +++ b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/LdioTransformerConfigurator.java @@ -1,7 +1,6 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.configurator; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioTransformer; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; /** * Interface to manage the configuration of the {@link LdioTransformer} diff --git a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/types/LdioVaultTransformer.java b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/LdioVaultTransformer.java similarity index 86% rename from ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/types/LdioVaultTransformer.java rename to ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/LdioVaultTransformer.java index 790e913ec..2b21ef1bc 100644 --- a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/types/LdioVaultTransformer.java +++ b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/LdioVaultTransformer.java @@ -1,4 +1,4 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.types; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation; import org.apache.jena.rdf.model.Model; diff --git a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/events/InputCreatedEvent.java b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/events/InputCreatedEvent.java new file mode 100644 index 000000000..36fe973bb --- /dev/null +++ b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/events/InputCreatedEvent.java @@ -0,0 +1,6 @@ +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.events; + +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioInput; + +public record InputCreatedEvent(String pipelineName, LdioInput ldioInput) { +} diff --git a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/events/PipelineDeletedEvent.java b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/events/PipelineDeletedEvent.java new file mode 100644 index 000000000..205640ce5 --- /dev/null +++ b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/events/PipelineDeletedEvent.java @@ -0,0 +1,4 @@ +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.events; + +public record PipelineDeletedEvent(String pipelineId) { +} diff --git a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/events/PipelineShutdownEvent.java b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/events/PipelineShutdownEvent.java new file mode 100644 index 000000000..0b9b3aade --- /dev/null +++ b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/events/PipelineShutdownEvent.java @@ -0,0 +1,4 @@ +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.events; + +public record PipelineShutdownEvent(String pipelineId) { +} diff --git a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/valueobjects/ComponentDefinition.java b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/valueobjects/ComponentDefinition.java similarity index 87% rename from ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/valueobjects/ComponentDefinition.java rename to ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/valueobjects/ComponentDefinition.java index 595fe83fa..95e2520c7 100644 --- a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/valueobjects/ComponentDefinition.java +++ b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/valueobjects/ComponentDefinition.java @@ -1,4 +1,4 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects; import java.util.Map; diff --git a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/valueobjects/ComponentProperties.java b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/valueobjects/ComponentProperties.java similarity index 96% rename from ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/valueobjects/ComponentProperties.java rename to ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/valueobjects/ComponentProperties.java index c504d0a87..42ce1ccc5 100644 --- a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/valueobjects/ComponentProperties.java +++ b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/valueobjects/ComponentProperties.java @@ -1,6 +1,6 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects; -import be.vlaanderen.informatievlaanderen.ldes.ldio.exception.ConfigPropertyMissingException; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.exception.ConfigPropertyMissingException; import java.io.IOException; import java.nio.file.Files; diff --git a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/valueobjects/InputComponentDefinition.java b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/valueobjects/InputComponentDefinition.java similarity index 85% rename from ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/valueobjects/InputComponentDefinition.java rename to ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/valueobjects/InputComponentDefinition.java index 0c6280b02..85555f43a 100644 --- a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/valueobjects/InputComponentDefinition.java +++ b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/valueobjects/InputComponentDefinition.java @@ -1,4 +1,4 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects; import java.util.Map; diff --git a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/exception/ConfigPropertyMissingException.java b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/exception/ConfigPropertyMissingException.java similarity index 87% rename from ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/exception/ConfigPropertyMissingException.java rename to ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/exception/ConfigPropertyMissingException.java index b90416eb2..081aa0379 100644 --- a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/exception/ConfigPropertyMissingException.java +++ b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/exception/ConfigPropertyMissingException.java @@ -1,4 +1,4 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.exception; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.exception; public class ConfigPropertyMissingException extends PipelineException { private final String pipeline; diff --git a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/exception/InvalidComponentException.java b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/exception/InvalidComponentException.java similarity index 86% rename from ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/exception/InvalidComponentException.java rename to ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/exception/InvalidComponentException.java index 57faf0f3e..63b9a5449 100644 --- a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/exception/InvalidComponentException.java +++ b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/exception/InvalidComponentException.java @@ -1,4 +1,4 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.exception; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.exception; public class InvalidComponentException extends PipelineException { private final String pipeline; diff --git a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/exception/InvalidConfigException.java b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/exception/InvalidConfigException.java similarity index 80% rename from ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/exception/InvalidConfigException.java rename to ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/exception/InvalidConfigException.java index ddc8b2971..d70edcc98 100644 --- a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/exception/InvalidConfigException.java +++ b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/exception/InvalidConfigException.java @@ -1,4 +1,4 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.exception; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.exception; public class InvalidConfigException extends PipelineException { private final String cause; diff --git a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/exception/InvalidPipelineNameException.java b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/exception/InvalidPipelineNameException.java similarity index 66% rename from ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/exception/InvalidPipelineNameException.java rename to ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/exception/InvalidPipelineNameException.java index 735d97b27..21fb53b8a 100644 --- a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/exception/InvalidPipelineNameException.java +++ b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/exception/InvalidPipelineNameException.java @@ -1,6 +1,6 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.exception; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.exception; -import static be.vlaanderen.informatievlaanderen.ldes.ldio.config.PipelineConfig.NAME_PATTERN; +import static be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.PipelineConfig.NAME_PATTERN; public class InvalidPipelineNameException extends PipelineException { private final String pipeline; diff --git a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/exception/LdiAdapterMissingException.java b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/exception/LdiAdapterMissingException.java similarity index 85% rename from ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/exception/LdiAdapterMissingException.java rename to ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/exception/LdiAdapterMissingException.java index 2c243864c..b7e3e1921 100644 --- a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/exception/LdiAdapterMissingException.java +++ b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/exception/LdiAdapterMissingException.java @@ -1,4 +1,4 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.exception; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.exception; public class LdiAdapterMissingException extends PipelineException { private final String pipelineName; diff --git a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/exception/PipelineAlreadyExistsException.java b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/exception/PipelineAlreadyExistsException.java similarity index 82% rename from ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/exception/PipelineAlreadyExistsException.java rename to ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/exception/PipelineAlreadyExistsException.java index 82d43b208..395b3ef5b 100644 --- a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/exception/PipelineAlreadyExistsException.java +++ b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/exception/PipelineAlreadyExistsException.java @@ -1,4 +1,4 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.exception; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.exception; public class PipelineAlreadyExistsException extends PipelineException { private final String pipeline; diff --git a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/exception/PipelineDoesNotExistException.java b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/exception/PipelineDoesNotExistException.java similarity index 81% rename from ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/exception/PipelineDoesNotExistException.java rename to ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/exception/PipelineDoesNotExistException.java index fe6622bd2..1eda57c4f 100644 --- a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/exception/PipelineDoesNotExistException.java +++ b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/exception/PipelineDoesNotExistException.java @@ -1,4 +1,4 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.exception; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.exception; public class PipelineDoesNotExistException extends PipelineException { private final String pipeline; diff --git a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/exception/PipelineException.java b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/exception/PipelineException.java new file mode 100644 index 000000000..1154e6037 --- /dev/null +++ b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/exception/PipelineException.java @@ -0,0 +1,4 @@ +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.exception; + +public abstract class PipelineException extends RuntimeException { +} diff --git a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/exception/PipelineParsingException.java b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/exception/PipelineParsingException.java similarity index 81% rename from ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/exception/PipelineParsingException.java rename to ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/exception/PipelineParsingException.java index a462ffd13..bba038a76 100644 --- a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/exception/PipelineParsingException.java +++ b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/exception/PipelineParsingException.java @@ -1,4 +1,4 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.exception; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.exception; public class PipelineParsingException extends PipelineException { private final String pipeline; diff --git a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/persistence/PersistenceProperties.java b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/persistence/PersistenceProperties.java similarity index 86% rename from ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/persistence/PersistenceProperties.java rename to ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/persistence/PersistenceProperties.java index ace50c39c..062a4198f 100644 --- a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/persistence/PersistenceProperties.java +++ b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/persistence/PersistenceProperties.java @@ -1,4 +1,4 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.persistence; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.persistence; /** * LDIO properties for managing the persistence diff --git a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/types/LdioPipelineEventsListener.java b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/status/LdioPipelineEventsListener.java similarity index 90% rename from ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/types/LdioPipelineEventsListener.java rename to ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/status/LdioPipelineEventsListener.java index 070cd2b43..84396b471 100644 --- a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/types/LdioPipelineEventsListener.java +++ b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/status/LdioPipelineEventsListener.java @@ -1,9 +1,9 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.types; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status; import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiComponent; -import be.vlaanderen.informatievlaanderen.ldes.ldio.events.InputCreatedEvent; -import be.vlaanderen.informatievlaanderen.ldes.ldio.events.PipelineDeletedEvent; -import be.vlaanderen.informatievlaanderen.ldes.ldio.events.PipelineStatusEvent; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.events.InputCreatedEvent; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.events.PipelineDeletedEvent; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status.events.PipelineStatusEvent; import org.springframework.context.event.EventListener; import java.util.HashMap; diff --git a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/status/PipelineStatus.java b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/status/PipelineStatus.java new file mode 100644 index 000000000..62cde6095 --- /dev/null +++ b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/status/PipelineStatus.java @@ -0,0 +1,5 @@ +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status; + +public enum PipelineStatus { + INIT, RUNNING, HALTED, STOPPED +} diff --git a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/types/PipelineStatusChangedBehavior.java b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/status/PipelineStatusChangedBehavior.java similarity index 80% rename from ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/types/PipelineStatusChangedBehavior.java rename to ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/status/PipelineStatusChangedBehavior.java index 9f9670d7a..db04b8fc1 100644 --- a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/types/PipelineStatusChangedBehavior.java +++ b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/status/PipelineStatusChangedBehavior.java @@ -1,4 +1,4 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.types; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status; import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiComponent; diff --git a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/status/PipelineStatusTrigger.java b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/status/PipelineStatusTrigger.java new file mode 100644 index 000000000..b3c5b8714 --- /dev/null +++ b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/status/PipelineStatusTrigger.java @@ -0,0 +1,5 @@ +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status; + +public enum PipelineStatusTrigger { + START, HALT, RESUME, STOP +} diff --git a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/valueobjects/StatusChangeSource.java b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/status/StatusChangeSource.java similarity index 81% rename from ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/valueobjects/StatusChangeSource.java rename to ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/status/StatusChangeSource.java index 7e4eab38d..e9a6ff2d3 100644 --- a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/valueobjects/StatusChangeSource.java +++ b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/status/StatusChangeSource.java @@ -1,4 +1,4 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status; /** * Representation where the pipeline status has changed diff --git a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/status/events/PipelineStatusEvent.java b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/status/events/PipelineStatusEvent.java new file mode 100644 index 000000000..527fee3b8 --- /dev/null +++ b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/status/events/PipelineStatusEvent.java @@ -0,0 +1,7 @@ +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status.events; + +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status.PipelineStatus; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status.StatusChangeSource; + +public record PipelineStatusEvent(String pipelineId, PipelineStatus status, StatusChangeSource statusChangeSource) { +} diff --git a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/valueobjects/PipelineStatus.java b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/valueobjects/PipelineStatus.java deleted file mode 100644 index c5c1cb28a..000000000 --- a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/valueobjects/PipelineStatus.java +++ /dev/null @@ -1,5 +0,0 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects; - -public enum PipelineStatus { - INIT, RUNNING, HALTED, STOPPED -} diff --git a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/valueobjects/PipelineStatusTrigger.java b/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/valueobjects/PipelineStatusTrigger.java deleted file mode 100644 index 9f792486d..000000000 --- a/ldi-orchestrator/ldio-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/valueobjects/PipelineStatusTrigger.java +++ /dev/null @@ -1,7 +0,0 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects; - -public enum PipelineStatusTrigger { - - START, HALT, RESUME, STOP - -} diff --git a/ldi-orchestrator/ldio-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/valueobjects/ComponentPropertiesTest.java b/ldi-orchestrator/ldio-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/ComponentPropertiesTest.java similarity index 63% rename from ldi-orchestrator/ldio-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/valueobjects/ComponentPropertiesTest.java rename to ldi-orchestrator/ldio-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/ComponentPropertiesTest.java index 7b71c5aeb..2b38b8c1e 100644 --- a/ldi-orchestrator/ldio-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/valueobjects/ComponentPropertiesTest.java +++ b/ldi-orchestrator/ldio-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/ComponentPropertiesTest.java @@ -1,50 +1,52 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation; -import be.vlaanderen.informatievlaanderen.ldes.ldio.exception.ConfigPropertyMissingException; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.exception.ConfigPropertyMissingException; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; import java.io.IOException; import java.nio.file.Files; import java.util.Map; -import java.util.Optional; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.jupiter.api.Assertions.*; class ComponentPropertiesTest { - private static final String pipelineName = "Pname"; - private static final String componentName = "Cname"; + private static final String PIPELINE_NAME = "Pname"; + private static final String COMPONENT_NAME = "Cname"; @Nested class GetPropertyList { - private static final String key = "url"; + private static final String KEY = "url"; @Test void ShouldReturnProperty_WhenNotAnArray() { - ComponentProperties properties = new ComponentProperties(pipelineName, componentName, Map.of(key, "example.com")); + ComponentProperties properties = new ComponentProperties(PIPELINE_NAME, COMPONENT_NAME, Map.of(KEY, "example.com")); - assertEquals(1, properties.getPropertyList(key).size()); - assertEquals("example.com", properties.getPropertyList(key).get(0)); + assertEquals(1, properties.getPropertyList(KEY).size()); + assertEquals("example.com", properties.getPropertyList(KEY).get(0)); } @Test void ShouldReturnAllProperties_WhenAnArray() { - ComponentProperties properties = new ComponentProperties(pipelineName, componentName, + ComponentProperties properties = new ComponentProperties(PIPELINE_NAME, COMPONENT_NAME, Map.of("url.0", "example.com", "url.1", "other-example.com")); - assertEquals(2, properties.getPropertyList(key).size()); - assertEquals("example.com", properties.getPropertyList(key).get(0)); - assertEquals("other-example.com", properties.getPropertyList(key).get(1)); + assertEquals(2, properties.getPropertyList(KEY).size()); + assertEquals("example.com", properties.getPropertyList(KEY).get(0)); + assertEquals("other-example.com", properties.getPropertyList(KEY).get(1)); } @Test void ShouldReturnEmpty_WhenPropertyNotFound() { - ComponentProperties properties = new ComponentProperties(pipelineName, componentName, Map.of()); + ComponentProperties properties = new ComponentProperties(PIPELINE_NAME, COMPONENT_NAME, Map.of()); - assertTrue(properties.getPropertyList(key).isEmpty()); + assertTrue(properties.getPropertyList(KEY).isEmpty()); } } @@ -53,7 +55,7 @@ class ExtractNestedProperties { @Test void shouldReturnNestedProperties_whenFound() { - ComponentProperties properties = new ComponentProperties(pipelineName, componentName, + ComponentProperties properties = new ComponentProperties(PIPELINE_NAME, COMPONENT_NAME, Map.of("adapter.name", "my-adapter", "adapter.config.context", "example.com", "adapter.config.alt", "alternative")); @@ -67,7 +69,7 @@ void shouldReturnNestedProperties_whenFound() { @Test void shouldReturnEmpty_whenNotFound() { - ComponentProperties properties = new ComponentProperties(pipelineName, componentName, Map.of("foo", "bar")); + ComponentProperties properties = new ComponentProperties(PIPELINE_NAME, COMPONENT_NAME, Map.of("foo", "bar")); ComponentProperties nestedProperties = properties.extractNestedProperties("adapter.config"); @@ -76,7 +78,7 @@ void shouldReturnEmpty_whenNotFound() { @Test void shouldReturnEmpty_whenThereAreNoProperties() { - ComponentProperties properties = new ComponentProperties(pipelineName, componentName); + ComponentProperties properties = new ComponentProperties(PIPELINE_NAME, COMPONENT_NAME); ComponentProperties nestedProperties = properties.extractNestedProperties("adapter.config"); @@ -85,7 +87,7 @@ void shouldReturnEmpty_whenThereAreNoProperties() { @Test void shouldReturnEmpty_whenKeyIsNullOrEmpty() { - ComponentProperties properties = new ComponentProperties(pipelineName, componentName, Map.of("a", "b")); + ComponentProperties properties = new ComponentProperties(PIPELINE_NAME, COMPONENT_NAME, Map.of("a", "b")); assertTrue(properties.extractNestedProperties(null).getConfig().isEmpty()); assertTrue(properties.extractNestedProperties("").getConfig().isEmpty()); @@ -93,7 +95,7 @@ void shouldReturnEmpty_whenKeyIsNullOrEmpty() { @Test void shouldReturnEmpty_whenKeyMatchesValueInsteadOfNestedStructure() { - ComponentProperties properties = new ComponentProperties(pipelineName, componentName, Map.of("a", "b")); + ComponentProperties properties = new ComponentProperties(PIPELINE_NAME, COMPONENT_NAME, Map.of("a", "b")); assertTrue(properties.extractNestedProperties("a").getConfig().isEmpty()); } } @@ -105,14 +107,14 @@ class GetConfig { @Test void shouldHaveEmptyConfigWithNoArgumentConstructor() { - ComponentProperties componentProperties = new ComponentProperties(pipelineName, componentName); + ComponentProperties componentProperties = new ComponentProperties(PIPELINE_NAME, COMPONENT_NAME); assertTrue(componentProperties.getConfig().isEmpty()); } @Test void shouldHaveConfigWithArgumentConstructor() { - ComponentProperties componentProperties = new ComponentProperties(pipelineName, componentName, config); + ComponentProperties componentProperties = new ComponentProperties(PIPELINE_NAME, COMPONENT_NAME, config); assertEquals(config, componentProperties.getConfig()); } @@ -122,7 +124,7 @@ void shouldHaveConfigWithArgumentConstructor() { class GetProperty { @Test void test() { - ComponentProperties componentProperties = new ComponentProperties(pipelineName, componentName, + ComponentProperties componentProperties = new ComponentProperties(PIPELINE_NAME, COMPONENT_NAME, Map.of("key", "value", "keyTwo", "valueTwo")); assertEquals("value", componentProperties.getProperty("key")); @@ -134,7 +136,7 @@ void test() { @Nested class GetOptionalBoolean { - ComponentProperties componentProperties = new ComponentProperties(pipelineName, componentName, + ComponentProperties componentProperties = new ComponentProperties(PIPELINE_NAME, COMPONENT_NAME, Map.of("string", "string", "trueLowerCase", "true", "trueMixedCase", "TrUe", "trueUpperCase", "TRUE")); @@ -158,7 +160,7 @@ void shouldReturnEmptyWhenPropertyIsMissing() { @Nested class GetOptionalInteger { - ComponentProperties componentProperties = new ComponentProperties(pipelineName, componentName, + ComponentProperties componentProperties = new ComponentProperties(PIPELINE_NAME, COMPONENT_NAME, Map.of("string", "string", "integer", "2")); @Test @@ -180,32 +182,38 @@ void shouldReturnEmptyWhenPropertyIsMissing() { @Nested class GetOptionalPropertyFromFile { - ComponentProperties componentProperties = new ComponentProperties(pipelineName, componentName, Map.of( - "non-existant", "non-existant-file", - "query", "src/test/resources/query.rq")); + ComponentProperties componentProperties; @Test void shouldReturnEmptyIfFileMissing() { - assertTrue(componentProperties.getOptionalPropertyFromFile("non-existant").isEmpty()); + componentProperties = new ComponentProperties(PIPELINE_NAME, COMPONENT_NAME, Map.of( + "non-existant", "non-existant-file", + "query", "src/test/resources/query.rq")); + + assertThat(componentProperties.getOptionalPropertyFromFile("non-existant")).isEmpty(); } @Test void shouldThrowExceptionIfUnreadableFile() throws IOException { - ComponentProperties componentProperties = new ComponentProperties(pipelineName, componentName, + componentProperties = new ComponentProperties(PIPELINE_NAME, COMPONENT_NAME, Map.of("non-regular-file", Files.createTempDirectory("queryDir").toFile().getAbsolutePath())); - assertThrows(IllegalArgumentException.class, - () -> componentProperties.getOptionalPropertyFromFile("non-regular-file")); + assertThatThrownBy(() -> componentProperties.getOptionalPropertyFromFile("non-regular-file")) + .isInstanceOf(IllegalArgumentException.class); } @Test void shouldReturnFileContentsWhenFileExistsAndIsReadable() { - assertEquals("sparql", componentProperties.getOptionalPropertyFromFile("query").get()); + componentProperties = new ComponentProperties(PIPELINE_NAME, COMPONENT_NAME, Map.of( + "non-existant", "non-existant-file", + "query", "src/test/resources/query.rq")); + + assertThat(componentProperties.getOptionalPropertyFromFile("query")).contains("sparql"); } @Test void shouldReturnEmptyIfNotFilePath() { - ComponentProperties componentProperties = new ComponentProperties(pipelineName, componentName, + componentProperties = new ComponentProperties(PIPELINE_NAME, COMPONENT_NAME, Map.of("query", """ PREFIX schema: @@ -218,7 +226,7 @@ void shouldReturnEmptyIfNotFilePath() { } """)); - assertEquals(Optional.empty(), componentProperties.getOptionalPropertyFromFile("query")); + assertThat(componentProperties.getOptionalPropertyFromFile("query")).isEmpty(); } } diff --git a/ldi-orchestrator/ldio-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/types/LdioObserverTest.java b/ldi-orchestrator/ldio-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/LdioObserverTest.java similarity index 94% rename from ldi-orchestrator/ldio-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/types/LdioObserverTest.java rename to ldi-orchestrator/ldio-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/LdioObserverTest.java index 485a9e889..dd2be56ce 100644 --- a/ldi-orchestrator/ldio-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/types/LdioObserverTest.java +++ b/ldi-orchestrator/ldio-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/creation/LdioObserverTest.java @@ -1,4 +1,4 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.types; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; diff --git a/ldi-orchestrator/ldio-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/types/LdioPipelineEventsListenerTest.java b/ldi-orchestrator/ldio-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/status/LdioPipelineEventsListenerTest.java similarity index 90% rename from ldi-orchestrator/ldio-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/types/LdioPipelineEventsListenerTest.java rename to ldi-orchestrator/ldio-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/status/LdioPipelineEventsListenerTest.java index 6184cc7a9..e07824107 100644 --- a/ldi-orchestrator/ldio-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/types/LdioPipelineEventsListenerTest.java +++ b/ldi-orchestrator/ldio-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/pipeline/status/LdioPipelineEventsListenerTest.java @@ -1,11 +1,9 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.types; +package be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status; import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiComponent; -import be.vlaanderen.informatievlaanderen.ldes.ldio.events.InputCreatedEvent; -import be.vlaanderen.informatievlaanderen.ldes.ldio.events.PipelineDeletedEvent; -import be.vlaanderen.informatievlaanderen.ldes.ldio.events.PipelineStatusEvent; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.PipelineStatus; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.StatusChangeSource; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.events.InputCreatedEvent; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.events.PipelineDeletedEvent; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status.events.PipelineStatusEvent; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; diff --git a/ldi-orchestrator/ldio-connectors/ldio-amqp/pom.xml b/ldi-orchestrator/ldio-connectors/ldio-amqp/pom.xml index 669d201a8..ac0cb466c 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-amqp/pom.xml +++ b/ldi-orchestrator/ldio-connectors/ldio-amqp/pom.xml @@ -6,7 +6,7 @@ ldio-connectors be.vlaanderen.informatievlaanderen.ldes.ldio - 2.7.0-SNAPSHOT + 2.9.0 ldio-amqp diff --git a/ldi-orchestrator/ldio-connectors/ldio-amqp/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioAmqpIn.java b/ldi-orchestrator/ldio-connectors/ldio-amqp/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioAmqpIn.java index 403c09ac6..b05fc169f 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-amqp/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioAmqpIn.java +++ b/ldi-orchestrator/ldio-connectors/ldio-amqp/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioAmqpIn.java @@ -4,8 +4,8 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiAdapter; import be.vlaanderen.informatievlaanderen.ldes.ldio.config.LdioAmqpInRegistrator; import be.vlaanderen.informatievlaanderen.ldes.ldio.exceptions.InvalidAmqpMessageException; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioInput; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioObserver; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioInput; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioObserver; import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.LdioAmpqInProperties; import jakarta.jms.JMSException; import jakarta.jms.Message; diff --git a/ldi-orchestrator/ldio-connectors/ldio-amqp/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioAmqpInAutoConfig.java b/ldi-orchestrator/ldio-connectors/ldio-amqp/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioAmqpInAutoConfig.java index b979fc3a9..96316bc3a 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-amqp/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioAmqpInAutoConfig.java +++ b/ldi-orchestrator/ldio-connectors/ldio-amqp/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioAmqpInAutoConfig.java @@ -3,10 +3,10 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.services.ComponentExecutor; import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiAdapter; import be.vlaanderen.informatievlaanderen.ldes.ldio.LdioAmqpIn; -import be.vlaanderen.informatievlaanderen.ldes.ldio.configurator.LdioInputConfigurator; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioInput; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioObserver; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioInput; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioInputConfigurator; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioObserver; import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.LdioAmpqInProperties; import io.micrometer.observation.ObservationRegistry; import org.apache.jena.riot.Lang; diff --git a/ldi-orchestrator/ldio-connectors/ldio-amqp/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioAmqpOutAutoConfig.java b/ldi-orchestrator/ldio-connectors/ldio-amqp/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioAmqpOutAutoConfig.java index 7aac96a56..7f4173d2b 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-amqp/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioAmqpOutAutoConfig.java +++ b/ldi-orchestrator/ldio-connectors/ldio-amqp/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioAmqpOutAutoConfig.java @@ -4,8 +4,8 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.rdf.formatter.LdiRdfWriterProperties; import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiComponent; import be.vlaanderen.informatievlaanderen.ldes.ldio.LdioAmqpOut; -import be.vlaanderen.informatievlaanderen.ldes.ldio.configurator.LdioOutputConfigurator; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioOutputConfigurator; import org.apache.qpid.jms.JmsConnectionFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/ldi-orchestrator/ldio-connectors/ldio-amqp/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/RemoteUrlExtractor.java b/ldi-orchestrator/ldio-connectors/ldio-amqp/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/RemoteUrlExtractor.java index 8e764a7a3..4a0c72621 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-amqp/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/RemoteUrlExtractor.java +++ b/ldi-orchestrator/ldio-connectors/ldio-amqp/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/RemoteUrlExtractor.java @@ -1,6 +1,6 @@ package be.vlaanderen.informatievlaanderen.ldes.ldio.config; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; import java.util.regex.Matcher; import java.util.regex.Pattern; diff --git a/ldi-orchestrator/ldio-connectors/ldio-amqp/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/AmqpInIntegrationTestSteps.java b/ldi-orchestrator/ldio-connectors/ldio-amqp/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/AmqpInIntegrationTestSteps.java index bc64a92d5..400cb0de8 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-amqp/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/AmqpInIntegrationTestSteps.java +++ b/ldi-orchestrator/ldio-connectors/ldio-amqp/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/AmqpInIntegrationTestSteps.java @@ -5,9 +5,9 @@ import be.vlaanderen.informatievlaanderen.ldes.ldio.config.AmqpConfig; import be.vlaanderen.informatievlaanderen.ldes.ldio.config.LdioAmqpInAutoConfig; import be.vlaanderen.informatievlaanderen.ldes.ldio.config.LdioAmqpInRegistrator; -import be.vlaanderen.informatievlaanderen.ldes.ldio.config.OrchestratorConfig; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioInput; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.OrchestratorConfig; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioInput; import io.cucumber.java.After; import io.cucumber.java.ParameterType; import io.cucumber.java.en.And; @@ -30,8 +30,8 @@ import java.util.stream.Stream; import static be.vlaanderen.informatievlaanderen.ldes.ldio.LdioAmqpIn.NAME; -import static be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.PipelineStatusTrigger.HALT; -import static be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.PipelineStatusTrigger.RESUME; +import static be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status.PipelineStatusTrigger.HALT; +import static be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status.PipelineStatusTrigger.RESUME; import static org.apache.jena.riot.RDFLanguages.contentTypeToLang; import static org.apache.jena.riot.RDFLanguages.nameToLang; import static org.awaitility.Awaitility.await; diff --git a/ldi-orchestrator/ldio-connectors/ldio-amqp/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/AmqpOutIntegrationTestSteps.java b/ldi-orchestrator/ldio-connectors/ldio-amqp/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/AmqpOutIntegrationTestSteps.java index 5f5b73224..fe9be03f3 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-amqp/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/AmqpOutIntegrationTestSteps.java +++ b/ldi-orchestrator/ldio-connectors/ldio-amqp/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/AmqpOutIntegrationTestSteps.java @@ -4,7 +4,7 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiOutput; import be.vlaanderen.informatievlaanderen.ldes.ldio.config.AmqpConfig; import be.vlaanderen.informatievlaanderen.ldes.ldio.config.LdioAmqpOutAutoConfig; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; import io.cucumber.java.en.And; import io.cucumber.java.en.Then; import jakarta.jms.JMSException; diff --git a/ldi-orchestrator/ldio-connectors/ldio-amqp/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioAmqpInAutoConfigTest.java b/ldi-orchestrator/ldio-connectors/ldio-amqp/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioAmqpInAutoConfigTest.java index 26cef4ee6..225377bc6 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-amqp/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioAmqpInAutoConfigTest.java +++ b/ldi-orchestrator/ldio-connectors/ldio-amqp/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioAmqpInAutoConfigTest.java @@ -1,6 +1,6 @@ package be.vlaanderen.informatievlaanderen.ldes.ldio.config; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; import io.micrometer.observation.ObservationRegistry; import org.junit.jupiter.api.Test; import org.springframework.context.ApplicationEventPublisher; @@ -10,12 +10,13 @@ import java.util.stream.Stream; import static be.vlaanderen.informatievlaanderen.ldes.ldio.LdioAmqpIn.NAME; -import static be.vlaanderen.informatievlaanderen.ldes.ldio.config.OrchestratorConfig.ORCHESTRATOR_NAME; +import static be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.OrchestratorConfig.ORCHESTRATOR_NAME; import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.mock; class LdioAmqpInAutoConfigTest { private ApplicationEventPublisher applicationEventPublisher = mock(ApplicationEventPublisher.class); + @Test void shouldThrowExceptionWhenInvalidUrlConfig() { var configurator = new LdioAmqpInAutoConfig.LdioJmsInConfigurator( @@ -26,11 +27,11 @@ void shouldThrowExceptionWhenInvalidUrlConfig() { ComponentProperties componentProperties = new ComponentProperties("pipelineName", NAME, config); IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, - () -> configurator.configure((content) -> Stream.of(), null, applicationEventPublisher, componentProperties)); + () -> configurator.configure(content -> Stream.of(), null, applicationEventPublisher, componentProperties)); assertEquals("Property remote-url is not in format of either " + - "'amqp[s]://hostname:port[?option=value[&option2=value...]]' or " + - "'amqpws[s]://hostname:port[/path][?option=value[&option2=value...]]", exception.getMessage()); + "'amqp[s]://hostname:port[?option=value[&option2=value...]]' or " + + "'amqpws[s]://hostname:port[/path][?option=value[&option2=value...]]", exception.getMessage()); } @Test @@ -41,7 +42,7 @@ void shouldNotThrowExceptionWhenNoUrlConfig() { Map config = getBasicConfig(); assertDoesNotThrow( - () -> configurator.configure((content) -> Stream.of(), null, applicationEventPublisher, new ComponentProperties("pipelineName", NAME, config))); + () -> configurator.configure(content -> Stream.of(), null, applicationEventPublisher, new ComponentProperties("pipelineName", NAME, config))); } private Map getBasicConfig() { diff --git a/ldi-orchestrator/ldio-connectors/ldio-archive-file-in/pom.xml b/ldi-orchestrator/ldio-connectors/ldio-archive-file-in/pom.xml index 172ddfbf6..333342c02 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-archive-file-in/pom.xml +++ b/ldi-orchestrator/ldio-connectors/ldio-archive-file-in/pom.xml @@ -6,7 +6,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldio ldio-connectors - 2.7.0-SNAPSHOT + 2.9.0 ldio-archive-file-in diff --git a/ldi-orchestrator/ldio-connectors/ldio-archive-file-in/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioArchiveFileIn.java b/ldi-orchestrator/ldio-connectors/ldio-archive-file-in/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioArchiveFileIn.java index 67c9e3cc7..bd97ea8ab 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-archive-file-in/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioArchiveFileIn.java +++ b/ldi-orchestrator/ldio-connectors/ldio-archive-file-in/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioArchiveFileIn.java @@ -1,8 +1,8 @@ package be.vlaanderen.informatievlaanderen.ldes.ldio; import be.vlaanderen.informatievlaanderen.ldes.ldi.services.ComponentExecutor; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioInput; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioObserver; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioInput; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioObserver; import io.micrometer.observation.ObservationRegistry; import org.apache.jena.rdf.model.Model; import org.apache.jena.riot.Lang; diff --git a/ldi-orchestrator/ldio-connectors/ldio-archive-file-in/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioArchiveFileInAutoConfig.java b/ldi-orchestrator/ldio-connectors/ldio-archive-file-in/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioArchiveFileInAutoConfig.java index bc9451394..dd7351407 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-archive-file-in/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioArchiveFileInAutoConfig.java +++ b/ldi-orchestrator/ldio-connectors/ldio-archive-file-in/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioArchiveFileInAutoConfig.java @@ -4,9 +4,9 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiAdapter; import be.vlaanderen.informatievlaanderen.ldes.ldio.ArchiveFileCrawler; import be.vlaanderen.informatievlaanderen.ldes.ldio.LdioArchiveFileIn; -import be.vlaanderen.informatievlaanderen.ldes.ldio.configurator.LdioInputConfigurator; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioInput; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioInput; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioInputConfigurator; import io.micrometer.observation.ObservationRegistry; import org.apache.jena.riot.Lang; import org.apache.jena.riot.RDFLanguages; diff --git a/ldi-orchestrator/ldio-connectors/ldio-archive-file-in/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/ArchiveFileInITSteps.java b/ldi-orchestrator/ldio-connectors/ldio-archive-file-in/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/ArchiveFileInITSteps.java index aed80d3ff..3cb1ee96d 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-archive-file-in/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/ArchiveFileInITSteps.java +++ b/ldi-orchestrator/ldio-connectors/ldio-archive-file-in/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/ArchiveFileInITSteps.java @@ -2,7 +2,7 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.services.ComponentExecutor; import be.vlaanderen.informatievlaanderen.ldes.ldio.config.LdioArchiveFileInAutoConfig; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; import io.cucumber.java.en.Given; import io.cucumber.java.en.Then; import io.micrometer.observation.ObservationRegistry; diff --git a/ldi-orchestrator/ldio-connectors/ldio-azure-blob-out/pom.xml b/ldi-orchestrator/ldio-connectors/ldio-azure-blob-out/pom.xml index 50bc9d216..41ee15d67 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-azure-blob-out/pom.xml +++ b/ldi-orchestrator/ldio-connectors/ldio-azure-blob-out/pom.xml @@ -6,7 +6,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldio ldio-connectors - 2.7.0-SNAPSHOT + 2.9.0 diff --git a/ldi-orchestrator/ldio-connectors/ldio-azure-blob-out/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioAzureBlobOutAutoConfig.java b/ldi-orchestrator/ldio-connectors/ldio-azure-blob-out/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioAzureBlobOutAutoConfig.java index 684442879..6402fea50 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-azure-blob-out/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioAzureBlobOutAutoConfig.java +++ b/ldi-orchestrator/ldio-connectors/ldio-azure-blob-out/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioAzureBlobOutAutoConfig.java @@ -2,8 +2,8 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiOutput; import be.vlaanderen.informatievlaanderen.ldes.ldio.LdiAzureBlobOut; -import be.vlaanderen.informatievlaanderen.ldes.ldio.configurator.LdioOutputConfigurator; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioOutputConfigurator; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/ldi-orchestrator/ldio-connectors/ldio-azure-blob-out/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioAzureBlobOutAutoConfigTest.java b/ldi-orchestrator/ldio-connectors/ldio-azure-blob-out/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioAzureBlobOutAutoConfigTest.java index 60fa23ba9..0b8300962 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-azure-blob-out/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioAzureBlobOutAutoConfigTest.java +++ b/ldi-orchestrator/ldio-connectors/ldio-azure-blob-out/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioAzureBlobOutAutoConfigTest.java @@ -2,7 +2,7 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiComponent; import be.vlaanderen.informatievlaanderen.ldes.ldio.LdiAzureBlobOut; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; import org.junit.jupiter.api.Test; import java.util.Map; diff --git a/ldi-orchestrator/ldio-connectors/ldio-change-detection-filter/pom.xml b/ldi-orchestrator/ldio-connectors/ldio-change-detection-filter/pom.xml index ac6a13b5f..896af207a 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-change-detection-filter/pom.xml +++ b/ldi-orchestrator/ldio-connectors/ldio-change-detection-filter/pom.xml @@ -6,7 +6,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldio ldio-connectors - 2.7.0-SNAPSHOT + 2.9.0 ldio-change-detection-filter diff --git a/ldi-orchestrator/ldio-connectors/ldio-change-detection-filter/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioChangeDetectionFilter.java b/ldi-orchestrator/ldio-connectors/ldio-change-detection-filter/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioChangeDetectionFilter.java index 5fa1f2d16..0a879178f 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-change-detection-filter/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioChangeDetectionFilter.java +++ b/ldi-orchestrator/ldio-connectors/ldio-change-detection-filter/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioChangeDetectionFilter.java @@ -1,7 +1,7 @@ package be.vlaanderen.informatievlaanderen.ldes.ldio; import be.vlaanderen.informatievlaanderen.ldes.ldi.ChangeDetectionFilter; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioTransformer; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioTransformer; import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.Resource; import org.slf4j.Logger; diff --git a/ldi-orchestrator/ldio-connectors/ldio-change-detection-filter/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/HasedStateMemberRepositoryFactory.java b/ldi-orchestrator/ldio-connectors/ldio-change-detection-filter/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/HasedStateMemberRepositoryFactory.java index 27eff5d1c..ebeb5b923 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-change-detection-filter/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/HasedStateMemberRepositoryFactory.java +++ b/ldi-orchestrator/ldio-connectors/ldio-change-detection-filter/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/HasedStateMemberRepositoryFactory.java @@ -8,8 +8,8 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.sqlite.SqliteEntityManagerFactory; import be.vlaanderen.informatievlaanderen.ldes.ldi.sqlite.SqliteProperties; import be.vlaanderen.informatievlaanderen.ldes.ldi.valueobjects.StatePersistenceStrategy; -import be.vlaanderen.informatievlaanderen.ldes.ldio.persistence.PersistenceProperties; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.persistence.PersistenceProperties; import java.util.Map; diff --git a/ldi-orchestrator/ldio-connectors/ldio-change-detection-filter/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioChangeDetectionEventsListenerConfig.java b/ldi-orchestrator/ldio-connectors/ldio-change-detection-filter/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioChangeDetectionEventsListenerConfig.java index 0d1ccd1b3..72fe5a1b5 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-change-detection-filter/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioChangeDetectionEventsListenerConfig.java +++ b/ldi-orchestrator/ldio-connectors/ldio-change-detection-filter/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioChangeDetectionEventsListenerConfig.java @@ -1,7 +1,7 @@ package be.vlaanderen.informatievlaanderen.ldes.ldio.config; import be.vlaanderen.informatievlaanderen.ldes.ldio.LdioChangeDetectionFilter; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioPipelineEventsListener; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status.LdioPipelineEventsListener; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/ldi-orchestrator/ldio-connectors/ldio-change-detection-filter/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioChangeDetectionFilterAutoConfig.java b/ldi-orchestrator/ldio-connectors/ldio-change-detection-filter/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioChangeDetectionFilterAutoConfig.java index 3fdb94442..8705743e7 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-change-detection-filter/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioChangeDetectionFilterAutoConfig.java +++ b/ldi-orchestrator/ldio-connectors/ldio-change-detection-filter/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioChangeDetectionFilterAutoConfig.java @@ -3,10 +3,10 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.ChangeDetectionFilter; import be.vlaanderen.informatievlaanderen.ldes.ldi.repositories.HashedStateMemberRepository; import be.vlaanderen.informatievlaanderen.ldes.ldio.LdioChangeDetectionFilter; -import be.vlaanderen.informatievlaanderen.ldes.ldio.configurator.LdioTransformerConfigurator; -import be.vlaanderen.informatievlaanderen.ldes.ldio.persistence.PersistenceProperties; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioTransformer; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioTransformer; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioTransformerConfigurator; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.persistence.PersistenceProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/ldi-orchestrator/ldio-connectors/ldio-change-detection-filter/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioChangeDetectionEventsListenerTest.java b/ldi-orchestrator/ldio-connectors/ldio-change-detection-filter/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioChangeDetectionEventsListenerTest.java index af4c6d0e7..405a3585b 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-change-detection-filter/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioChangeDetectionEventsListenerTest.java +++ b/ldi-orchestrator/ldio-connectors/ldio-change-detection-filter/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioChangeDetectionEventsListenerTest.java @@ -2,11 +2,11 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.ChangeDetectionFilter; import be.vlaanderen.informatievlaanderen.ldes.ldio.config.LdioChangeDetectionEventsListenerConfig; -import be.vlaanderen.informatievlaanderen.ldes.ldio.events.PipelineDeletedEvent; -import be.vlaanderen.informatievlaanderen.ldes.ldio.events.PipelineStatusEvent; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioPipelineEventsListener; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.PipelineStatus; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.StatusChangeSource; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.events.PipelineDeletedEvent; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status.LdioPipelineEventsListener; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status.PipelineStatus; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status.StatusChangeSource; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status.events.PipelineStatusEvent; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; diff --git a/ldi-orchestrator/ldio-connectors/ldio-change-detection-filter/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioChangeDetectionFilterSteps.java b/ldi-orchestrator/ldio-connectors/ldio-change-detection-filter/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioChangeDetectionFilterSteps.java index 0cd45570d..696fc38e4 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-change-detection-filter/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioChangeDetectionFilterSteps.java +++ b/ldi-orchestrator/ldio-connectors/ldio-change-detection-filter/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioChangeDetectionFilterSteps.java @@ -1,9 +1,9 @@ package be.vlaanderen.informatievlaanderen.ldes.ldio; import be.vlaanderen.informatievlaanderen.ldes.ldio.config.LdioChangeDetectionFilterAutoConfig; -import be.vlaanderen.informatievlaanderen.ldes.ldio.configurator.LdioTransformerConfigurator; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioVaultTransformer; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioTransformerConfigurator; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioVaultTransformer; import io.cucumber.java.en.Given; import io.cucumber.java.en.Then; import io.cucumber.java.en.When; @@ -16,7 +16,7 @@ import java.util.List; import java.util.Map; -import static be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioTransformer.link; +import static be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioTransformer.link; import static org.assertj.core.api.Assertions.assertThat; public class LdioChangeDetectionFilterSteps { diff --git a/ldi-orchestrator/ldio-connectors/ldio-console-out/pom.xml b/ldi-orchestrator/ldio-connectors/ldio-console-out/pom.xml index 547c6e2a4..7446acf27 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-console-out/pom.xml +++ b/ldi-orchestrator/ldio-connectors/ldio-console-out/pom.xml @@ -3,7 +3,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldio ldio-connectors - 2.7.0-SNAPSHOT + 2.9.0 4.0.0 diff --git a/ldi-orchestrator/ldio-connectors/ldio-console-out/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioConsoleOutAutoConfig.java b/ldi-orchestrator/ldio-connectors/ldio-console-out/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioConsoleOutAutoConfig.java index 91327b72d..6c56a5a77 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-console-out/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioConsoleOutAutoConfig.java +++ b/ldi-orchestrator/ldio-connectors/ldio-console-out/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioConsoleOutAutoConfig.java @@ -3,8 +3,8 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.rdf.formatter.LdiRdfWriterProperties; import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiComponent; import be.vlaanderen.informatievlaanderen.ldes.ldio.LdiConsoleOut; -import be.vlaanderen.informatievlaanderen.ldes.ldio.configurator.LdioOutputConfigurator; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioOutputConfigurator; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/ldi-orchestrator/ldio-connectors/ldio-file-out/pom.xml b/ldi-orchestrator/ldio-connectors/ldio-file-out/pom.xml index bf18e09d4..33335a7d2 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-file-out/pom.xml +++ b/ldi-orchestrator/ldio-connectors/ldio-file-out/pom.xml @@ -6,7 +6,7 @@ ldio-connectors be.vlaanderen.informatievlaanderen.ldes.ldio - 2.7.0-SNAPSHOT + 2.9.0 ldio-file-out diff --git a/ldi-orchestrator/ldio-connectors/ldio-file-out/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioFileOutAutoConfig.java b/ldi-orchestrator/ldio-connectors/ldio-file-out/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioFileOutAutoConfig.java index b06fc71b7..4ef207a25 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-file-out/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioFileOutAutoConfig.java +++ b/ldi-orchestrator/ldio-connectors/ldio-file-out/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioFileOutAutoConfig.java @@ -5,8 +5,8 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.timestampextractor.TimestampFromPathExtractor; import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiComponent; import be.vlaanderen.informatievlaanderen.ldes.ldio.LdioFileOut; -import be.vlaanderen.informatievlaanderen.ldes.ldio.configurator.LdioOutputConfigurator; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioOutputConfigurator; import org.apache.jena.rdf.model.ResourceFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/ldi-orchestrator/ldio-connectors/ldio-file-out/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/FileOutIntegrationTestSteps.java b/ldi-orchestrator/ldio-connectors/ldio-file-out/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/FileOutIntegrationTestSteps.java index 174f5f507..a4b89cc60 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-file-out/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/FileOutIntegrationTestSteps.java +++ b/ldi-orchestrator/ldio-connectors/ldio-file-out/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/FileOutIntegrationTestSteps.java @@ -2,7 +2,7 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiOutput; import be.vlaanderen.informatievlaanderen.ldes.ldio.config.LdioFileOutAutoConfig; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; import io.cucumber.java.en.And; import io.cucumber.java.en.Given; import io.cucumber.java.en.Then; diff --git a/ldi-orchestrator/ldio-connectors/ldio-geojson-to-wkt/pom.xml b/ldi-orchestrator/ldio-connectors/ldio-geojson-to-wkt/pom.xml index 0a73625f7..d5b0c113f 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-geojson-to-wkt/pom.xml +++ b/ldi-orchestrator/ldio-connectors/ldio-geojson-to-wkt/pom.xml @@ -6,7 +6,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldio ldio-connectors - 2.7.0-SNAPSHOT + 2.9.0 ldio-geojson-to-wkt diff --git a/ldi-orchestrator/ldio-connectors/ldio-geojson-to-wkt/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioGeoJsonToWkt.java b/ldi-orchestrator/ldio-connectors/ldio-geojson-to-wkt/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioGeoJsonToWkt.java index d4fc3ba42..31a3e3a77 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-geojson-to-wkt/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioGeoJsonToWkt.java +++ b/ldi-orchestrator/ldio-connectors/ldio-geojson-to-wkt/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioGeoJsonToWkt.java @@ -1,7 +1,7 @@ package be.vlaanderen.informatievlaanderen.ldes.ldio; import be.vlaanderen.informatievlaanderen.ldes.ldi.GeoJsonToWktTransformer; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioTransformer; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioTransformer; import org.apache.jena.rdf.model.Model; public class LdioGeoJsonToWkt extends LdioTransformer { diff --git a/ldi-orchestrator/ldio-connectors/ldio-geojson-to-wkt/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioGeoJsonToWktAutoConfig.java b/ldi-orchestrator/ldio-connectors/ldio-geojson-to-wkt/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioGeoJsonToWktAutoConfig.java index c195d529d..a577333ab 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-geojson-to-wkt/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioGeoJsonToWktAutoConfig.java +++ b/ldi-orchestrator/ldio-connectors/ldio-geojson-to-wkt/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioGeoJsonToWktAutoConfig.java @@ -1,9 +1,9 @@ package be.vlaanderen.informatievlaanderen.ldes.ldio.config; import be.vlaanderen.informatievlaanderen.ldes.ldio.LdioGeoJsonToWkt; -import be.vlaanderen.informatievlaanderen.ldes.ldio.configurator.LdioTransformerConfigurator; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioTransformer; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioTransformer; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioTransformerConfigurator; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/ldi-orchestrator/ldio-connectors/ldio-http-enricher/pom.xml b/ldi-orchestrator/ldio-connectors/ldio-http-enricher/pom.xml index 421f75b37..9d7094a7b 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-http-enricher/pom.xml +++ b/ldi-orchestrator/ldio-connectors/ldio-http-enricher/pom.xml @@ -5,7 +5,7 @@ ldio-connectors be.vlaanderen.informatievlaanderen.ldes.ldio - 2.7.0-SNAPSHOT + 2.9.0 4.0.0 diff --git a/ldi-orchestrator/ldio-connectors/ldio-http-enricher/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioHttpEnricher.java b/ldi-orchestrator/ldio-connectors/ldio-http-enricher/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioHttpEnricher.java index 605b2b0ab..21adf508e 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-http-enricher/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioHttpEnricher.java +++ b/ldi-orchestrator/ldio-connectors/ldio-http-enricher/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioHttpEnricher.java @@ -3,7 +3,7 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.executor.RequestExecutor; import be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.valueobjects.*; import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiAdapter; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioTransformer; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioTransformer; import org.apache.commons.text.StringEscapeUtils; import org.apache.http.HttpHeaders; import org.apache.http.entity.ContentType; diff --git a/ldi-orchestrator/ldio-connectors/ldio-http-enricher/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioHttpEnricherAutoConfig.java b/ldi-orchestrator/ldio-connectors/ldio-http-enricher/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioHttpEnricherAutoConfig.java index cc16eb6d5..961a34ccf 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-http-enricher/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioHttpEnricherAutoConfig.java +++ b/ldi-orchestrator/ldio-connectors/ldio-http-enricher/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioHttpEnricherAutoConfig.java @@ -4,10 +4,10 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiAdapter; import be.vlaanderen.informatievlaanderen.ldes.ldio.LdioHttpEnricher; import be.vlaanderen.informatievlaanderen.ldes.ldio.RequestPropertyPathExtractors; -import be.vlaanderen.informatievlaanderen.ldes.ldio.configurator.LdioAdapterConfigurator; -import be.vlaanderen.informatievlaanderen.ldes.ldio.configurator.LdioTransformerConfigurator; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioAdapterConfigurator; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioTransformerConfigurator; import be.vlaanderen.informatievlaanderen.ldes.ldio.requestexecutor.LdioRequestExecutorSupplier; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/ldi-orchestrator/ldio-connectors/ldio-http-enricher/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/PropertyPathExtractorConverter.java b/ldi-orchestrator/ldio-connectors/ldio-http-enricher/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/PropertyPathExtractorConverter.java index 17318025c..5b1378e3b 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-http-enricher/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/PropertyPathExtractorConverter.java +++ b/ldi-orchestrator/ldio-connectors/ldio-http-enricher/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/PropertyPathExtractorConverter.java @@ -4,10 +4,9 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.extractor.PropertyExtractor; import be.vlaanderen.informatievlaanderen.ldes.ldi.extractor.PropertyPathExtractor; import be.vlaanderen.informatievlaanderen.ldes.ldio.RequestPropertyPathExtractors; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; import static be.vlaanderen.informatievlaanderen.ldes.ldio.config.LdioHttpEnricherProperties.*; -import static be.vlaanderen.informatievlaanderen.ldes.ldio.config.LdioHttpEnricherProperties.HTTP_METHOD_PROPERTY_PATH; class PropertyPathExtractorConverter { diff --git a/ldi-orchestrator/ldio-connectors/ldio-http-enricher/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/HttpEnricherSteps.java b/ldi-orchestrator/ldio-connectors/ldio-http-enricher/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/HttpEnricherSteps.java index 6cc81db3c..d651de717 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-http-enricher/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/HttpEnricherSteps.java +++ b/ldi-orchestrator/ldio-connectors/ldio-http-enricher/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/HttpEnricherSteps.java @@ -6,8 +6,8 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.executor.RequestExecutor; import be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.services.RequestExecutorFactory; import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiAdapter; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioTransformer; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioVaultTransformer; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioTransformer; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioVaultTransformer; import io.cucumber.java.en.And; import io.cucumber.java.en.Given; import io.cucumber.java.en.Then; @@ -20,7 +20,7 @@ import java.util.List; import java.util.stream.Stream; -import static be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioTransformer.link; +import static be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioTransformer.link; import static org.apache.jena.rdf.model.ResourceFactory.createProperty; import static org.apache.jena.rdf.model.ResourceFactory.createResource; import static org.apache.jena.riot.RDFLanguages.nameToLang; diff --git a/ldi-orchestrator/ldio-connectors/ldio-http-enricher/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/PropertyPathExtractorConverterTest.java b/ldi-orchestrator/ldio-connectors/ldio-http-enricher/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/PropertyPathExtractorConverterTest.java index 6509fd832..e721cd20e 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-http-enricher/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/PropertyPathExtractorConverterTest.java +++ b/ldi-orchestrator/ldio-connectors/ldio-http-enricher/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/PropertyPathExtractorConverterTest.java @@ -1,7 +1,7 @@ package be.vlaanderen.informatievlaanderen.ldes.ldio.config; import be.vlaanderen.informatievlaanderen.ldes.ldio.RequestPropertyPathExtractors; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.ModelFactory; import org.apache.jena.rdf.model.ResourceFactory; diff --git a/ldi-orchestrator/ldio-connectors/ldio-http-in-poller/pom.xml b/ldi-orchestrator/ldio-connectors/ldio-http-in-poller/pom.xml index 55c38bf0a..a864c3f9e 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-http-in-poller/pom.xml +++ b/ldi-orchestrator/ldio-connectors/ldio-http-in-poller/pom.xml @@ -6,7 +6,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldio ldio-connectors - 2.7.0-SNAPSHOT + 2.9.0 ldio-http-in-poller diff --git a/ldi-orchestrator/ldio-connectors/ldio-http-in-poller/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioHttpInputPoller.java b/ldi-orchestrator/ldio-connectors/ldio-http-in-poller/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioHttpInputPoller.java index a9daf1740..7d7e8c326 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-http-in-poller/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioHttpInputPoller.java +++ b/ldi-orchestrator/ldio-connectors/ldio-http-in-poller/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioHttpInputPoller.java @@ -8,8 +8,8 @@ import be.vlaanderen.informatievlaanderen.ldes.ldio.config.LdioHttpInputPollerProperties; import be.vlaanderen.informatievlaanderen.ldes.ldio.exceptions.MissingHeaderException; import be.vlaanderen.informatievlaanderen.ldes.ldio.exceptions.UnsuccesfulPollingException; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioInput; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioObserver; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioInput; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioObserver; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.ApplicationEventPublisher; diff --git a/ldi-orchestrator/ldio-connectors/ldio-http-in-poller/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioHttpInputPollerAutoConfig.java b/ldi-orchestrator/ldio-connectors/ldio-http-in-poller/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioHttpInputPollerAutoConfig.java index 5a5b85cc6..3da435bef 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-http-in-poller/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioHttpInputPollerAutoConfig.java +++ b/ldi-orchestrator/ldio-connectors/ldio-http-in-poller/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioHttpInputPollerAutoConfig.java @@ -3,10 +3,10 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.services.ComponentExecutor; import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiAdapter; import be.vlaanderen.informatievlaanderen.ldes.ldio.LdioHttpInputPoller; -import be.vlaanderen.informatievlaanderen.ldes.ldio.configurator.LdioInputConfigurator; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioInputConfigurator; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioObserver; import be.vlaanderen.informatievlaanderen.ldes.ldio.requestexecutor.LdioRequestExecutorSupplier; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioObserver; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; import io.micrometer.observation.ObservationRegistry; import org.springframework.context.ApplicationEventPublisher; import org.springframework.context.annotation.Bean; diff --git a/ldi-orchestrator/ldio-connectors/ldio-http-in-poller/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioHttpInputPollerProperties.java b/ldi-orchestrator/ldio-connectors/ldio-http-in-poller/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioHttpInputPollerProperties.java index 789717c10..aaa35e825 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-http-in-poller/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioHttpInputPollerProperties.java +++ b/ldi-orchestrator/ldio-connectors/ldio-http-in-poller/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioHttpInputPollerProperties.java @@ -2,8 +2,8 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.valueobjects.GetRequest; import be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.valueobjects.RequestHeaders; -import be.vlaanderen.informatievlaanderen.ldes.ldio.exception.ConfigPropertyMissingException; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.exception.ConfigPropertyMissingException; import java.util.List; diff --git a/ldi-orchestrator/ldio-connectors/ldio-http-in-poller/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioHttpInputPollerTest.java b/ldi-orchestrator/ldio-connectors/ldio-http-in-poller/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioHttpInputPollerTest.java index 7aa6ec067..dc99431ee 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-http-in-poller/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioHttpInputPollerTest.java +++ b/ldi-orchestrator/ldio-connectors/ldio-http-in-poller/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioHttpInputPollerTest.java @@ -7,7 +7,7 @@ import be.vlaanderen.informatievlaanderen.ldes.ldio.config.LdioHttpInputPollerProperties; import be.vlaanderen.informatievlaanderen.ldes.ldio.config.PollingInterval; import be.vlaanderen.informatievlaanderen.ldes.ldio.exceptions.MissingHeaderException; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioObserver; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioObserver; import com.github.tomakehurst.wiremock.client.CountMatchingStrategy; import com.github.tomakehurst.wiremock.client.WireMock; import com.github.tomakehurst.wiremock.junit5.WireMockTest; diff --git a/ldi-orchestrator/ldio-connectors/ldio-http-in-poller/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioLdioHttpInputPollerAutoConfigTest.java b/ldi-orchestrator/ldio-connectors/ldio-http-in-poller/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioLdioHttpInputPollerAutoConfigTest.java index 29fd10c9b..500ccc15a 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-http-in-poller/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioLdioHttpInputPollerAutoConfigTest.java +++ b/ldi-orchestrator/ldio-connectors/ldio-http-in-poller/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioLdioHttpInputPollerAutoConfigTest.java @@ -6,8 +6,8 @@ import be.vlaanderen.informatievlaanderen.ldes.ldio.PollingIntervalTest.InvalidIntervalArgumentsProvider; import be.vlaanderen.informatievlaanderen.ldes.ldio.config.LdioHttpInputPollerAutoConfig; import be.vlaanderen.informatievlaanderen.ldes.ldio.config.LdioHttpInputPollerProperties; -import be.vlaanderen.informatievlaanderen.ldes.ldio.exception.ConfigPropertyMissingException; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.exception.ConfigPropertyMissingException; import org.assertj.core.api.ThrowableAssert; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtensionContext; diff --git a/ldi-orchestrator/ldio-connectors/ldio-http-in/pom.xml b/ldi-orchestrator/ldio-connectors/ldio-http-in/pom.xml index 54a3f3d15..c0927e5d3 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-http-in/pom.xml +++ b/ldi-orchestrator/ldio-connectors/ldio-http-in/pom.xml @@ -4,7 +4,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldio ldio-connectors - 2.7.0-SNAPSHOT + 2.9.0 4.0.0 diff --git a/ldi-orchestrator/ldio-connectors/ldio-http-in/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioHttpInController.java b/ldi-orchestrator/ldio-connectors/ldio-http-in/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioHttpInController.java index 51b176991..dcc696e87 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-http-in/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioHttpInController.java +++ b/ldi-orchestrator/ldio-connectors/ldio-http-in/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioHttpInController.java @@ -1,8 +1,8 @@ package be.vlaanderen.informatievlaanderen.ldes.ldio; import be.vlaanderen.informatievlaanderen.ldes.ldio.event.HttpInPipelineCreatedEvent; -import be.vlaanderen.informatievlaanderen.ldes.ldio.events.PipelineDeletedEvent; -import be.vlaanderen.informatievlaanderen.ldes.ldio.exception.PipelineDoesNotExistException; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.events.PipelineDeletedEvent; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.exception.PipelineDoesNotExistException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.event.EventListener; diff --git a/ldi-orchestrator/ldio-connectors/ldio-http-in/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioHttpInProcess.java b/ldi-orchestrator/ldio-connectors/ldio-http-in/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioHttpInProcess.java index e143f1f48..8e99b0d63 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-http-in/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioHttpInProcess.java +++ b/ldi-orchestrator/ldio-connectors/ldio-http-in/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioHttpInProcess.java @@ -2,8 +2,8 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.services.ComponentExecutor; import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiAdapter; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioInput; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioObserver; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioInput; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioObserver; import org.springframework.context.ApplicationEventPublisher; public class LdioHttpInProcess extends LdioInput { diff --git a/ldi-orchestrator/ldio-connectors/ldio-http-in/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioHttpInAutoConfig.java b/ldi-orchestrator/ldio-connectors/ldio-http-in/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioHttpInAutoConfig.java index 9bd68a784..993445f0c 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-http-in/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioHttpInAutoConfig.java +++ b/ldi-orchestrator/ldio-connectors/ldio-http-in/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioHttpInAutoConfig.java @@ -3,11 +3,11 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.services.ComponentExecutor; import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiAdapter; import be.vlaanderen.informatievlaanderen.ldes.ldio.LdioHttpInProcess; -import be.vlaanderen.informatievlaanderen.ldes.ldio.configurator.LdioInputConfigurator; import be.vlaanderen.informatievlaanderen.ldes.ldio.event.HttpInPipelineCreatedEvent; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioInput; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioObserver; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioInput; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioInputConfigurator; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioObserver; import io.micrometer.observation.ObservationRegistry; import org.springframework.context.ApplicationEventPublisher; import org.springframework.context.annotation.Bean; diff --git a/ldi-orchestrator/ldio-connectors/ldio-http-in/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioHttpInputTest.java b/ldi-orchestrator/ldio-connectors/ldio-http-in/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioHttpInputTest.java index 81c34803b..a4a9873b9 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-http-in/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioHttpInputTest.java +++ b/ldi-orchestrator/ldio-connectors/ldio-http-in/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioHttpInputTest.java @@ -3,8 +3,8 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.services.ComponentExecutor; import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiAdapter; import be.vlaanderen.informatievlaanderen.ldes.ldio.config.LdioHttpInAutoConfig; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioInput; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioInput; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.Mockito; @@ -17,8 +17,8 @@ import java.util.stream.Stream; import static be.vlaanderen.informatievlaanderen.ldes.ldio.LdioHttpInProcess.NAME; -import static be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.PipelineStatusTrigger.HALT; -import static be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.PipelineStatusTrigger.RESUME; +import static be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status.PipelineStatusTrigger.HALT; +import static be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status.PipelineStatusTrigger.RESUME; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.*; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; diff --git a/ldi-orchestrator/ldio-connectors/ldio-http-out/pom.xml b/ldi-orchestrator/ldio-connectors/ldio-http-out/pom.xml index c9db4720f..148849106 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-http-out/pom.xml +++ b/ldi-orchestrator/ldio-connectors/ldio-http-out/pom.xml @@ -3,7 +3,7 @@ ldio-connectors be.vlaanderen.informatievlaanderen.ldes.ldio - 2.7.0-SNAPSHOT + 2.9.0 4.0.0 diff --git a/ldi-orchestrator/ldio-connectors/ldio-http-out/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioHttpOutAutoConfig.java b/ldi-orchestrator/ldio-connectors/ldio-http-out/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioHttpOutAutoConfig.java index 6dd8ed934..a625bf301 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-http-out/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioHttpOutAutoConfig.java +++ b/ldi-orchestrator/ldio-connectors/ldio-http-out/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioHttpOutAutoConfig.java @@ -4,9 +4,9 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.executor.RequestExecutor; import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiComponent; import be.vlaanderen.informatievlaanderen.ldes.ldio.LdioHttpOut; -import be.vlaanderen.informatievlaanderen.ldes.ldio.configurator.LdioOutputConfigurator; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioOutputConfigurator; import be.vlaanderen.informatievlaanderen.ldes.ldio.requestexecutor.LdioRequestExecutorSupplier; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/ldi-orchestrator/ldio-connectors/ldio-json-to-ld-adapter/pom.xml b/ldi-orchestrator/ldio-connectors/ldio-json-to-ld-adapter/pom.xml index 774198530..79570bbd5 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-json-to-ld-adapter/pom.xml +++ b/ldi-orchestrator/ldio-connectors/ldio-json-to-ld-adapter/pom.xml @@ -5,7 +5,7 @@ ldio-connectors be.vlaanderen.informatievlaanderen.ldes.ldio - 2.7.0-SNAPSHOT + 2.9.0 4.0.0 diff --git a/ldi-orchestrator/ldio-connectors/ldio-json-to-ld-adapter/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioJsonToLdAdapterAutoConfig.java b/ldi-orchestrator/ldio-connectors/ldio-json-to-ld-adapter/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioJsonToLdAdapterAutoConfig.java index e80dfdad4..36d7aaa29 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-json-to-ld-adapter/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioJsonToLdAdapterAutoConfig.java +++ b/ldi-orchestrator/ldio-connectors/ldio-json-to-ld-adapter/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioJsonToLdAdapterAutoConfig.java @@ -3,8 +3,8 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.JsonToLdAdapter; import be.vlaanderen.informatievlaanderen.ldes.ldi.rdf.parser.JenaContextProvider; import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiComponent; -import be.vlaanderen.informatievlaanderen.ldes.ldio.configurator.LdioAdapterConfigurator; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioAdapterConfigurator; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/ldi-orchestrator/ldio-connectors/ldio-json-to-ld-adapter/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/JsonToLdIntegrationSteps.java b/ldi-orchestrator/ldio-connectors/ldio-json-to-ld-adapter/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/JsonToLdIntegrationSteps.java index d50d777b7..ca7a5ff15 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-json-to-ld-adapter/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/JsonToLdIntegrationSteps.java +++ b/ldi-orchestrator/ldio-connectors/ldio-json-to-ld-adapter/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/JsonToLdIntegrationSteps.java @@ -2,7 +2,7 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiAdapter; import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiComponent; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; import io.cucumber.java.en.And; import io.cucumber.java.en.Given; import io.cucumber.java.en.Then; diff --git a/ldi-orchestrator/ldio-connectors/ldio-kafka/pom.xml b/ldi-orchestrator/ldio-connectors/ldio-kafka/pom.xml index c95aa4db5..335ddc9d3 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-kafka/pom.xml +++ b/ldi-orchestrator/ldio-connectors/ldio-kafka/pom.xml @@ -5,7 +5,7 @@ ldio-connectors be.vlaanderen.informatievlaanderen.ldes.ldio - 2.7.0-SNAPSHOT + 2.9.0 4.0.0 diff --git a/ldi-orchestrator/ldio-connectors/ldio-kafka/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioKafkaIn.java b/ldi-orchestrator/ldio-connectors/ldio-kafka/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioKafkaIn.java index 7981ebf64..127268147 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-kafka/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioKafkaIn.java +++ b/ldi-orchestrator/ldio-connectors/ldio-kafka/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioKafkaIn.java @@ -6,9 +6,9 @@ import be.vlaanderen.informatievlaanderen.ldes.ldio.auth.SaslSslPlainConfigProvider; import be.vlaanderen.informatievlaanderen.ldes.ldio.exceptions.SecurityProtocolNotSupportedException; import be.vlaanderen.informatievlaanderen.ldes.ldio.listener.LdioKafkaInListener; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioInput; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioObserver; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioInput; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioObserver; import org.apache.jena.riot.Lang; import org.apache.jena.riot.RDFLanguages; import org.apache.kafka.clients.consumer.ConsumerConfig; @@ -22,8 +22,7 @@ import java.util.Map; import static be.vlaanderen.informatievlaanderen.ldes.ldio.config.KafkaInConfigKeys.*; -import static be.vlaanderen.informatievlaanderen.ldes.ldio.config.KafkaInConfigKeys.SASL_JAAS_PASSWORD; -import static be.vlaanderen.informatievlaanderen.ldes.ldio.config.OrchestratorConfig.ORCHESTRATOR_NAME; +import static be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.OrchestratorConfig.ORCHESTRATOR_NAME; public class LdioKafkaIn extends LdioInput { public static final String NAME = "Ldio:KafkaIn"; diff --git a/ldi-orchestrator/ldio-connectors/ldio-kafka/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioKafkaInAutoConfig.java b/ldi-orchestrator/ldio-connectors/ldio-kafka/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioKafkaInAutoConfig.java index 7c561aa17..0fd17b66a 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-kafka/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioKafkaInAutoConfig.java +++ b/ldi-orchestrator/ldio-connectors/ldio-kafka/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioKafkaInAutoConfig.java @@ -3,10 +3,10 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.services.ComponentExecutor; import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiAdapter; import be.vlaanderen.informatievlaanderen.ldes.ldio.LdioKafkaIn; -import be.vlaanderen.informatievlaanderen.ldes.ldio.configurator.LdioInputConfigurator; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioInput; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioObserver; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioInput; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioInputConfigurator; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioObserver; import io.micrometer.observation.ObservationRegistry; import org.springframework.context.ApplicationEventPublisher; import org.springframework.context.annotation.Bean; diff --git a/ldi-orchestrator/ldio-connectors/ldio-kafka/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioKafkaOutAutoConfig.java b/ldi-orchestrator/ldio-connectors/ldio-kafka/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioKafkaOutAutoConfig.java index 2e121ef31..93788d413 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-kafka/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioKafkaOutAutoConfig.java +++ b/ldi-orchestrator/ldio-connectors/ldio-kafka/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioKafkaOutAutoConfig.java @@ -1,6 +1,6 @@ package be.vlaanderen.informatievlaanderen.ldes.ldio.config; -import be.vlaanderen.informatievlaanderen.ldes.ldio.configurator.LdioOutputConfigurator; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioOutputConfigurator; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/ldi-orchestrator/ldio-connectors/ldio-kafka/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioKafkaOutProcessorConfigurator.java b/ldi-orchestrator/ldio-connectors/ldio-kafka/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioKafkaOutProcessorConfigurator.java index c0383837d..65f49fd87 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-kafka/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioKafkaOutProcessorConfigurator.java +++ b/ldi-orchestrator/ldio-connectors/ldio-kafka/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioKafkaOutProcessorConfigurator.java @@ -6,10 +6,10 @@ import be.vlaanderen.informatievlaanderen.ldes.ldio.LdioKafkaOut; import be.vlaanderen.informatievlaanderen.ldes.ldio.auth.KafkaAuthStrategy; import be.vlaanderen.informatievlaanderen.ldes.ldio.auth.SaslSslPlainConfigProvider; -import be.vlaanderen.informatievlaanderen.ldes.ldio.configurator.LdioOutputConfigurator; import be.vlaanderen.informatievlaanderen.ldes.ldio.exceptions.SecurityProtocolNotSupportedException; import be.vlaanderen.informatievlaanderen.ldes.ldio.keyextractor.KafkaKeyExtractor; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioOutputConfigurator; import org.apache.jena.rdf.model.RDFNode; import org.apache.kafka.clients.producer.ProducerConfig; import org.apache.kafka.common.serialization.StringSerializer; diff --git a/ldi-orchestrator/ldio-connectors/ldio-kafka/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/KafkaInIntegrationTestSteps.java b/ldi-orchestrator/ldio-connectors/ldio-kafka/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/KafkaInIntegrationTestSteps.java index 252d662a8..090564f3a 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-kafka/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/KafkaInIntegrationTestSteps.java +++ b/ldi-orchestrator/ldio-connectors/ldio-kafka/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/KafkaInIntegrationTestSteps.java @@ -2,9 +2,11 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.services.ComponentExecutor; import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiAdapter; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioInput; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.PipelineStatusTrigger; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.OrchestratorConfig; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.PipelineConfig; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioInput; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status.PipelineStatusTrigger; import io.cucumber.java.en.And; import io.cucumber.java.en.Then; import io.cucumber.java.en.When; @@ -55,7 +57,6 @@ public void iPrepareTheResultLists() { componentExecutorResult = new ArrayList<>(); } - @SuppressWarnings("unchecked") @And("I start a listener with an LdioKafkaIn component") public void iCreateAnLdioKafkaInComponent() { ComponentProperties properties = new ComponentProperties("pipelineName", NAME, config); @@ -112,7 +113,7 @@ public void theListenerWillWaitForTheMessage() { } @Then("Wait for a grace period") - public void theListenerWillWaitForPeriod() throws InterruptedException { + public void theListenerWillWaitForPeriod() { Awaitility.waitAtMost(1500, TimeUnit.MILLISECONDS); } diff --git a/ldi-orchestrator/ldio-connectors/ldio-kafka/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/KafkaOutIntegrationTestSteps.java b/ldi-orchestrator/ldio-connectors/ldio-kafka/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/KafkaOutIntegrationTestSteps.java index 612b63c1f..2fc596ee2 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-kafka/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/KafkaOutIntegrationTestSteps.java +++ b/ldi-orchestrator/ldio-connectors/ldio-kafka/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/KafkaOutIntegrationTestSteps.java @@ -1,7 +1,7 @@ package be.vlaanderen.informatievlaanderen.ldes.ldio.config; import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiOutput; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; import io.cucumber.java.en.And; import io.cucumber.java.en.Then; import org.apache.jena.rdf.model.Model; diff --git a/ldi-orchestrator/ldio-connectors/ldio-kafka/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/config/LdioKafkaInAutoConfigTest.java b/ldi-orchestrator/ldio-connectors/ldio-kafka/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/config/LdioKafkaInAutoConfigTest.java index 6a0995eca..f6611f78e 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-kafka/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/config/LdioKafkaInAutoConfigTest.java +++ b/ldi-orchestrator/ldio-connectors/ldio-kafka/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/config/LdioKafkaInAutoConfigTest.java @@ -3,7 +3,7 @@ import be.vlaanderen.informatievlaanderen.ldes.ldio.auth.KafkaAuthStrategy; import be.vlaanderen.informatievlaanderen.ldes.ldio.config.KafkaInConfigKeys; import be.vlaanderen.informatievlaanderen.ldes.ldio.config.LdioKafkaInAutoConfig; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; import io.micrometer.observation.ObservationRegistry; import org.junit.jupiter.api.Test; import org.springframework.context.ApplicationEventPublisher; @@ -14,7 +14,7 @@ import java.util.stream.Stream; import static be.vlaanderen.informatievlaanderen.ldes.ldio.LdioKafkaIn.NAME; -import static be.vlaanderen.informatievlaanderen.ldes.ldio.config.OrchestratorConfig.ORCHESTRATOR_NAME; +import static be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.OrchestratorConfig.ORCHESTRATOR_NAME; import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.mock; @@ -33,7 +33,7 @@ void shouldThrowExceptionWhenInvalidAuthConfig() { ComponentProperties componentProperties = new ComponentProperties("pipelineName", NAME, config); IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, - () -> configurator.configure((content) -> Stream.of(), null, applicationEventPublisher, componentProperties)); + () -> configurator.configure(content -> Stream.of(), null, applicationEventPublisher, componentProperties)); assertEquals("java.lang.IllegalArgumentException: Invalid 'security-protocol', " + "the supported protocols are: [NO_AUTH, SASL_SSL_PLAIN]", exception.getMessage()); @@ -46,7 +46,7 @@ void shouldNotThrowExceptionWhenNoAuthConfig() { Map config = getBasicConfig(); assertDoesNotThrow( - () -> configurator.configure((content) -> Stream.of(), null, applicationEventPublisher, new ComponentProperties("pipelineName", NAME, config))); + () -> configurator.configure(content -> Stream.of(), null, applicationEventPublisher, new ComponentProperties("pipelineName", NAME, config))); } @Test @@ -59,7 +59,7 @@ void shouldNotThrowExceptionWhenSaslSslPlain() { config.put(KafkaInConfigKeys.SASL_JAAS_PASSWORD, "secret"); assertDoesNotThrow( - () -> configurator.configure((content) -> Stream.of(), null, applicationEventPublisher, new ComponentProperties("pipelineName", NAME, config))); + () -> configurator.configure(content -> Stream.of(), null, applicationEventPublisher, new ComponentProperties("pipelineName", NAME, config))); } private Map getBasicConfig() { diff --git a/ldi-orchestrator/ldio-connectors/ldio-kafka/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/config/LdioKafkaOutAutoConfigTest.java b/ldi-orchestrator/ldio-connectors/ldio-kafka/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/config/LdioKafkaOutAutoConfigTest.java index 2252b5ee1..a421d1e32 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-kafka/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/config/LdioKafkaOutAutoConfigTest.java +++ b/ldi-orchestrator/ldio-connectors/ldio-kafka/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/config/LdioKafkaOutAutoConfigTest.java @@ -3,14 +3,14 @@ import be.vlaanderen.informatievlaanderen.ldes.ldio.auth.KafkaAuthStrategy; import be.vlaanderen.informatievlaanderen.ldes.ldio.config.KafkaOutConfigKeys; import be.vlaanderen.informatievlaanderen.ldes.ldio.config.LdioKafkaOutAutoConfig; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; import org.junit.jupiter.api.Test; import java.util.HashMap; import java.util.Map; import static be.vlaanderen.informatievlaanderen.ldes.ldio.LdioKafkaOut.NAME; -import static be.vlaanderen.informatievlaanderen.ldes.ldio.config.OrchestratorConfig.ORCHESTRATOR_NAME; +import static be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.OrchestratorConfig.ORCHESTRATOR_NAME; import static org.junit.jupiter.api.Assertions.*; class LdioKafkaOutAutoConfigTest { diff --git a/ldi-orchestrator/ldio-connectors/ldio-ldes-client-connector/pom.xml b/ldi-orchestrator/ldio-connectors/ldio-ldes-client-connector/pom.xml index 8b6c88338..8146da315 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-ldes-client-connector/pom.xml +++ b/ldi-orchestrator/ldio-connectors/ldio-ldes-client-connector/pom.xml @@ -5,7 +5,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldio ldio-connectors - 2.7.0-SNAPSHOT + 2.9.0 4.0.0 diff --git a/ldi-orchestrator/ldio-connectors/ldio-ldes-client-connector/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioLdesClientConnectorApi.java b/ldi-orchestrator/ldio-connectors/ldio-ldes-client-connector/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioLdesClientConnectorApi.java index feeb37f2c..b89c83611 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-ldes-client-connector/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioLdesClientConnectorApi.java +++ b/ldi-orchestrator/ldio-connectors/ldio-ldes-client-connector/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioLdesClientConnectorApi.java @@ -3,7 +3,7 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.executor.edc.services.TokenService; import be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.executor.edc.services.TransferService; -import static be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.PipelineStatusTrigger.START; +import static be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status.PipelineStatusTrigger.START; public class LdioLdesClientConnectorApi { private final TransferService transferService; diff --git a/ldi-orchestrator/ldio-connectors/ldio-ldes-client-connector/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioLdesClientConnectorApiController.java b/ldi-orchestrator/ldio-connectors/ldio-ldes-client-connector/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioLdesClientConnectorApiController.java index d8f15c58e..7ea7c3a4d 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-ldes-client-connector/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioLdesClientConnectorApiController.java +++ b/ldi-orchestrator/ldio-connectors/ldio-ldes-client-connector/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioLdesClientConnectorApiController.java @@ -2,8 +2,8 @@ import be.vlaanderen.informatievlaanderen.ldes.ldio.collection.LdioLdesClientConnectorApiCollection; import be.vlaanderen.informatievlaanderen.ldes.ldio.event.LdesClientConnectorApiCreatedEvent; -import be.vlaanderen.informatievlaanderen.ldes.ldio.events.PipelineDeletedEvent; -import be.vlaanderen.informatievlaanderen.ldes.ldio.events.PipelineStatusEvent; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.events.PipelineDeletedEvent; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status.events.PipelineStatusEvent; import org.springframework.context.event.EventListener; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PathVariable; diff --git a/ldi-orchestrator/ldio-connectors/ldio-ldes-client-connector/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioLdesClientConnectorAutoConfig.java b/ldi-orchestrator/ldio-connectors/ldio-ldes-client-connector/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioLdesClientConnectorAutoConfig.java index a1e3cdd96..668619b83 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-ldes-client-connector/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioLdesClientConnectorAutoConfig.java +++ b/ldi-orchestrator/ldio-connectors/ldio-ldes-client-connector/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioLdesClientConnectorAutoConfig.java @@ -10,18 +10,20 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiAdapter; import be.vlaanderen.informatievlaanderen.ldes.ldio.LdioLdesClient; import be.vlaanderen.informatievlaanderen.ldes.ldio.LdioLdesClientConnectorApi; -import be.vlaanderen.informatievlaanderen.ldes.ldio.configurator.LdioInputConfigurator; import be.vlaanderen.informatievlaanderen.ldes.ldio.event.LdesClientConnectorApiCreatedEvent; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioInput; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioObserver; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.management.status.ClientStatusConsumer; +import be.vlaanderen.informatievlaanderen.ldes.ldio.management.status.ClientStatusService; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioInput; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioInputConfigurator; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioObserver; import io.micrometer.observation.ObservationRegistry; import ldes.client.treenodesupplier.membersuppliers.MemberSupplier; import org.springframework.context.ApplicationEventPublisher; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import static be.vlaanderen.informatievlaanderen.ldes.ldio.persistence.PersistenceProperties.KEEP_STATE; +import static be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.persistence.PersistenceProperties.KEEP_STATE; @SuppressWarnings("java:S6830") @@ -32,8 +34,9 @@ public class LdioLdesClientConnectorAutoConfig { @Bean(NAME) public LdioInputConfigurator ldioConfigurator(ApplicationEventPublisher eventPublisher, + ClientStatusService clientStatusService, ObservationRegistry observationRegistry) { - return new LdioClientConnectorConfigurator(eventPublisher, observationRegistry); + return new LdioClientConnectorConfigurator(eventPublisher, clientStatusService, observationRegistry); } public static class LdioClientConnectorConfigurator implements LdioInputConfigurator { @@ -42,12 +45,15 @@ public static class LdioClientConnectorConfigurator implements LdioInputConfigur public static final String PROXY_URL_TO_REPLACE = "proxy-url-to-replace"; public static final String PROXY_URL_REPLACEMENT = "proxy-url-replacement"; private final ApplicationEventPublisher eventPublisher; + private final ClientStatusService clientStatusService; private final ObservationRegistry observationRegistry; private final RequestExecutorFactory requestExecutorFactory = new RequestExecutorFactory(false); private final RequestExecutor baseRequestExecutor = requestExecutorFactory.createNoAuthExecutor(); - public LdioClientConnectorConfigurator(ApplicationEventPublisher eventPublisher, ObservationRegistry observationRegistry) { + public LdioClientConnectorConfigurator(ApplicationEventPublisher eventPublisher, ClientStatusService clientStatusService, + ObservationRegistry observationRegistry) { this.eventPublisher = eventPublisher; + this.clientStatusService = clientStatusService; this.observationRegistry = observationRegistry; } @@ -62,11 +68,13 @@ public LdioInput configure(LdiAdapter adapter, ComponentExecutor executor, Appli final var urlProxy = getEdcUrlProxy(properties); final var edcRequestExecutor = requestExecutorFactory.createEdcExecutor(baseRequestExecutor, tokenService, urlProxy); - final MemberSupplier memberSupplier = new MemberSupplierFactory(properties, edcRequestExecutor).getMemberSupplier(); + final var clientStatusConsumer = new ClientStatusConsumer(pipelineName, clientStatusService); + final MemberSupplier memberSupplier = new MemberSupplierFactory(properties, edcRequestExecutor, + clientStatusConsumer).getMemberSupplier(); final boolean keepState = properties.getOptionalBoolean(KEEP_STATE).orElse(false); final LdioObserver ldioObserver = LdioObserver.register(NAME, pipelineName, observationRegistry); final var ldesClient = new LdioLdesClient(executor, ldioObserver, memberSupplier, - applicationEventPublisher, keepState); + applicationEventPublisher, keepState, clientStatusConsumer); eventPublisher.publishEvent(new LdesClientConnectorApiCreatedEvent(pipelineName, new LdioLdesClientConnectorApi(transferService, tokenService, ldesClient))); ldesClient.start(); diff --git a/ldi-orchestrator/ldio-connectors/ldio-ldes-client-connector/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioLdesClientConnectorTest.java b/ldi-orchestrator/ldio-connectors/ldio-ldes-client-connector/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioLdesClientConnectorTest.java index 74d6653e9..34662b7eb 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-ldes-client-connector/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioLdesClientConnectorTest.java +++ b/ldi-orchestrator/ldio-connectors/ldio-ldes-client-connector/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioLdesClientConnectorTest.java @@ -4,7 +4,7 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.executor.edc.services.TransferService; import be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.valueobjects.Response; import be.vlaanderen.informatievlaanderen.ldes.ldio.event.LdesClientConnectorApiCreatedEvent; -import be.vlaanderen.informatievlaanderen.ldes.ldio.events.PipelineDeletedEvent; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.events.PipelineDeletedEvent; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; diff --git a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/pom.xml b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/pom.xml index d68148628..61735c543 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/pom.xml +++ b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/pom.xml @@ -3,7 +3,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldio ldio-connectors - 2.7.0-SNAPSHOT + 2.9.0 4.0.0 @@ -68,5 +68,10 @@ ldi-infra-sql ${project.version} + + org.springdoc + springdoc-openapi-starter-webmvc-ui + ${springdoc-openapi.version} + \ No newline at end of file diff --git a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioLdesClient.java b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioLdesClient.java index fb0bf0d79..fc78f6826 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioLdesClient.java +++ b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioLdesClient.java @@ -1,10 +1,12 @@ package be.vlaanderen.informatievlaanderen.ldes.ldio; import be.vlaanderen.informatievlaanderen.ldes.ldi.services.ComponentExecutor; -import be.vlaanderen.informatievlaanderen.ldes.ldio.events.PipelineShutdownEvent; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioInput; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioObserver; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.PipelineStatusTrigger; +import be.vlaanderen.informatievlaanderen.ldes.ldio.management.status.ClientStatusConsumer; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioInput; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioObserver; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.events.PipelineShutdownEvent; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status.PipelineStatusTrigger; +import ldes.client.treenodesupplier.domain.valueobject.ClientStatus; import ldes.client.treenodesupplier.domain.valueobject.EndOfLdesException; import ldes.client.treenodesupplier.membersuppliers.MemberSupplier; import org.slf4j.Logger; @@ -26,16 +28,18 @@ public class LdioLdesClient extends LdioInput { private boolean paused = false; private final boolean keepState; private final String pipelineName; + private final ClientStatusConsumer clientStatusConsumer; public LdioLdesClient(ComponentExecutor componentExecutor, - LdioObserver ldioObserver, - MemberSupplier memberSupplier, - ApplicationEventPublisher applicationEventPublisher, - boolean keepState) { + LdioObserver ldioObserver, + MemberSupplier memberSupplier, + ApplicationEventPublisher applicationEventPublisher, + boolean keepState, ClientStatusConsumer clientStatusConsumer) { super(componentExecutor, null, ldioObserver, applicationEventPublisher); this.pipelineName = ldioObserver.getPipelineName(); this.memberSupplier = memberSupplier; this.keepState = keepState; + this.clientStatusConsumer = clientStatusConsumer; } @Override @@ -64,6 +68,7 @@ private synchronized void run() { } catch (EndOfLdesException e) { shutdownPipeline(); } catch (Exception e) { + clientStatusConsumer.accept(ClientStatus.ERROR); log.error("LdesClientRunner FAILURE: {}", e.getMessage()); } } diff --git a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioLdesClientAutoConfig.java b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioLdesClientAutoConfig.java index 6dc7728cd..6e0189ef5 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioLdesClientAutoConfig.java +++ b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioLdesClientAutoConfig.java @@ -4,32 +4,36 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.services.ComponentExecutor; import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiAdapter; import be.vlaanderen.informatievlaanderen.ldes.ldio.LdioLdesClient; -import be.vlaanderen.informatievlaanderen.ldes.ldio.configurator.LdioInputConfigurator; +import be.vlaanderen.informatievlaanderen.ldes.ldio.management.status.ClientStatusConsumer; +import be.vlaanderen.informatievlaanderen.ldes.ldio.management.status.ClientStatusService; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioInput; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioInputConfigurator; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioObserver; import be.vlaanderen.informatievlaanderen.ldes.ldio.requestexecutor.LdioRequestExecutorSupplier; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioInput; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioObserver; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; import io.micrometer.observation.ObservationRegistry; import ldes.client.treenodesupplier.membersuppliers.MemberSupplier; import org.springframework.context.ApplicationEventPublisher; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import static be.vlaanderen.informatievlaanderen.ldes.ldio.persistence.PersistenceProperties.KEEP_STATE; +import static be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.persistence.PersistenceProperties.KEEP_STATE; @Configuration public class LdioLdesClientAutoConfig { @SuppressWarnings("java:S6830") @Bean(LdioLdesClient.NAME) - public LdioInputConfigurator ldioConfigurator(ObservationRegistry observationRegistry) { - return new LdioLdesClientConfigurator(observationRegistry); + public LdioInputConfigurator ldioConfigurator(ClientStatusService clientStatusService, ObservationRegistry observationRegistry) { + return new LdioLdesClientConfigurator(clientStatusService, observationRegistry); } public static class LdioLdesClientConfigurator implements LdioInputConfigurator { + private final ClientStatusService clientStatusService; private final ObservationRegistry observationRegistry; - public LdioLdesClientConfigurator(ObservationRegistry observationRegistry) { + public LdioLdesClientConfigurator(ClientStatusService clientStatusService, ObservationRegistry observationRegistry) { + this.clientStatusService = clientStatusService; this.observationRegistry = observationRegistry; } @@ -40,10 +44,11 @@ public LdioInput configure(LdiAdapter adapter, ComponentExecutor componentExecut String pipelineName = properties.getPipelineName(); final var requestExecutorFactory = new RequestExecutorFactory(false); final var requestExecutor = new LdioRequestExecutorSupplier(requestExecutorFactory).getRequestExecutor(properties); - final MemberSupplier memberSupplier = new MemberSupplierFactory(properties, requestExecutor).getMemberSupplier(); + final var clientStatusConsumer = new ClientStatusConsumer(pipelineName, clientStatusService); + final MemberSupplier memberSupplier = new MemberSupplierFactory(properties, requestExecutor, clientStatusConsumer).getMemberSupplier(); final boolean keepState = properties.getOptionalBoolean(KEEP_STATE).orElse(false); final LdioObserver ldioObserver = LdioObserver.register(LdioLdesClient.NAME, pipelineName, observationRegistry); - final var ldesClient = new LdioLdesClient(componentExecutor, ldioObserver, memberSupplier, applicationEventPublisher, keepState); + final var ldesClient = new LdioLdesClient(componentExecutor, ldioObserver, memberSupplier, applicationEventPublisher, keepState, clientStatusConsumer); ldesClient.start(); return ldesClient; } diff --git a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/MemberSupplierFactory.java b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/MemberSupplierFactory.java index 258b1cd6b..0783a68f4 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/MemberSupplierFactory.java +++ b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/MemberSupplierFactory.java @@ -5,10 +5,11 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.timestampextractor.TimestampExtractor; import be.vlaanderen.informatievlaanderen.ldes.ldi.timestampextractor.TimestampFromCurrentTimeExtractor; import be.vlaanderen.informatievlaanderen.ldes.ldi.timestampextractor.TimestampFromPathExtractor; -import be.vlaanderen.informatievlaanderen.ldes.ldio.exception.ConfigPropertyMissingException; -import be.vlaanderen.informatievlaanderen.ldes.ldio.exception.InvalidConfigException; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.exception.ConfigPropertyMissingException; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.exception.InvalidConfigException; import ldes.client.treenodesupplier.TreeNodeProcessor; +import ldes.client.treenodesupplier.domain.valueobject.ClientStatus; import ldes.client.treenodesupplier.domain.valueobject.LdesMetaData; import ldes.client.treenodesupplier.domain.valueobject.StatePersistence; import ldes.client.treenodesupplier.filters.ExactlyOnceFilter; @@ -26,9 +27,10 @@ import java.util.List; import java.util.Optional; +import java.util.function.Consumer; import static be.vlaanderen.informatievlaanderen.ldes.ldio.LdioLdesClientProperties.*; -import static be.vlaanderen.informatievlaanderen.ldes.ldio.persistence.PersistenceProperties.KEEP_STATE; +import static be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.persistence.PersistenceProperties.KEEP_STATE; import static org.apache.jena.rdf.model.ResourceFactory.createProperty; public class MemberSupplierFactory { @@ -40,10 +42,13 @@ public class MemberSupplierFactory { private final ComponentProperties properties; private final RequestExecutor requestExecutor; + private final Consumer clientStatusConsumer; - public MemberSupplierFactory(ComponentProperties properties, RequestExecutor requestExecutor) { + public MemberSupplierFactory(ComponentProperties properties, RequestExecutor requestExecutor, + Consumer clientStatusConsumer) { this.properties = properties; this.requestExecutor = requestExecutor; + this.clientStatusConsumer = clientStatusConsumer; } public MemberSupplier getMemberSupplier() { @@ -86,7 +91,7 @@ private TreeNodeProcessor getTreeNodeProcessor() { .map(timestampPath -> (TimestampExtractor) new TimestampFromPathExtractor(createProperty(timestampPath))) .orElseGet(TimestampFromCurrentTimeExtractor::new); - return new TreeNodeProcessor(ldesMetaData, getStatePersistence(), requestExecutor, timestampExtractor); + return new TreeNodeProcessor(ldesMetaData, getStatePersistence(), requestExecutor, timestampExtractor, clientStatusConsumer); } private StatePersistence getStatePersistence() { diff --git a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/StatePersistenceFactory.java b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/StatePersistenceFactory.java index 3347861a1..25c4dee70 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/StatePersistenceFactory.java +++ b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/StatePersistenceFactory.java @@ -4,8 +4,8 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.postgres.PostgresProperties; import be.vlaanderen.informatievlaanderen.ldes.ldi.sqlite.SqliteProperties; import be.vlaanderen.informatievlaanderen.ldes.ldi.valueobjects.StatePersistenceStrategy; -import be.vlaanderen.informatievlaanderen.ldes.ldio.persistence.PersistenceProperties; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.persistence.PersistenceProperties; import ldes.client.treenodesupplier.domain.valueobject.StatePersistence; import java.util.Map; diff --git a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/status/ClientStatusConsumer.java b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/status/ClientStatusConsumer.java new file mode 100644 index 000000000..036160b93 --- /dev/null +++ b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/status/ClientStatusConsumer.java @@ -0,0 +1,28 @@ +package be.vlaanderen.informatievlaanderen.ldes.ldio.management.status; + +import ldes.client.treenodesupplier.domain.valueobject.ClientStatus; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.function.Consumer; + +public class ClientStatusConsumer implements Consumer { + private final Logger log = LoggerFactory.getLogger(ClientStatusConsumer.class); + private final String pipelineId; + private final ClientStatusService statusService; + private ClientStatus previousState; + + public ClientStatusConsumer(String pipelineId, ClientStatusService statusService) { + this.pipelineId = pipelineId; + this.statusService = statusService; + } + + @Override + public void accept(ClientStatus clientStatus) { + if (clientStatus != previousState) { + log.info("LDES Client pipeline '{}' has status {}", pipelineId, clientStatus); + statusService.updateStatus(pipelineId, clientStatus); + previousState = clientStatus; + } + } +} diff --git a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/status/ClientStatusController.java b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/status/ClientStatusController.java new file mode 100644 index 000000000..0269d9261 --- /dev/null +++ b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/status/ClientStatusController.java @@ -0,0 +1,51 @@ +package be.vlaanderen.informatievlaanderen.ldes.ldio.management.status; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.tags.Tag; +import ldes.client.treenodesupplier.domain.valueobject.ClientStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@RestController +@Tag(name = "LDES Client Status") +@RequestMapping("/admin/api/v1/pipeline/ldes-client") +public class ClientStatusController { + private final ClientStatusService clientStatusService; + + public ClientStatusController(ClientStatusService clientStatusService) { + this.clientStatusService = clientStatusService; + } + + @GetMapping() + @ApiResponse(responseCode = "200", description = "A list statuses of all active LDES Client pipelines.", content = { + @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, array = @ArraySchema(schema = @Schema(implementation = ClientStatusTo.class))), + }) + @Operation(summary = "Get a list of all LDES Client statuses pipelines.") + public List getStatusses() { + return clientStatusService.getClientStatuses(); + } + + @GetMapping(path = "{pipeline}", produces = "application/json") + @ApiResponse(responseCode = "200", description = "Status of a requested pipeline", content = { + @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, schema = @Schema(implementation = ClientStatus.class)), + }) + @ApiResponse(responseCode = "404", description = "No LDES Client pipeline exists by that name", content = { + @Content(schema = @Schema()), + }) + @Operation(summary = "Get the status of a requested LDES Client pipeline.") + public ResponseEntity getPipelineStatus(@PathVariable("pipeline") String pipeline) { + return clientStatusService.getClientStatus(pipeline) + .map(ResponseEntity::ok) + .orElse(ResponseEntity.notFound().build()); + } +} diff --git a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/status/ClientStatusService.java b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/status/ClientStatusService.java new file mode 100644 index 000000000..984a989f4 --- /dev/null +++ b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/status/ClientStatusService.java @@ -0,0 +1,40 @@ +package be.vlaanderen.informatievlaanderen.ldes.ldio.management.status; + +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.events.PipelineDeletedEvent; +import ldes.client.treenodesupplier.domain.valueobject.ClientStatus; +import org.springframework.context.event.EventListener; +import org.springframework.stereotype.Component; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +@Component +public class ClientStatusService { + private final Map clientStatuses; + + public ClientStatusService() { + this.clientStatuses = new HashMap<>(); + } + + public void updateStatus(String pipelineId, ClientStatus status) { + clientStatuses.put(pipelineId, status); + } + + public List getClientStatuses() { + return clientStatuses.entrySet() + .stream() + .map(entry -> new ClientStatusTo(entry.getKey(), entry.getValue())) + .toList(); + } + + public Optional getClientStatus(String pipelineId) { + return Optional.ofNullable(clientStatuses.get(pipelineId)); + } + + @EventListener + public void pipelineDeletedEventHandler(PipelineDeletedEvent event) { + clientStatuses.remove(event.pipelineId()); + } +} diff --git a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/status/ClientStatusTo.java b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/status/ClientStatusTo.java new file mode 100644 index 000000000..966c133df --- /dev/null +++ b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/status/ClientStatusTo.java @@ -0,0 +1,6 @@ +package be.vlaanderen.informatievlaanderen.ldes.ldio.management.status; + +import ldes.client.treenodesupplier.domain.valueobject.ClientStatus; + +public record ClientStatusTo(String pipeline, ClientStatus status) { +} diff --git a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioLdesClientTest.java b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioLdesClientTest.java index 52d5dad91..1aae66552 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioLdesClientTest.java +++ b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioLdesClientTest.java @@ -1,11 +1,12 @@ package be.vlaanderen.informatievlaanderen.ldes.ldio; import be.vlaanderen.informatievlaanderen.ldes.ldi.services.ComponentExecutor; -import be.vlaanderen.informatievlaanderen.ldes.ldio.events.PipelineShutdownEvent; -import be.vlaanderen.informatievlaanderen.ldes.ldio.events.PipelineStatusEvent; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioObserver; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.PipelineStatus; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.StatusChangeSource; +import be.vlaanderen.informatievlaanderen.ldes.ldio.management.status.ClientStatusConsumer; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioObserver; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.events.PipelineShutdownEvent; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status.PipelineStatus; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status.StatusChangeSource; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status.events.PipelineStatusEvent; import ldes.client.treenodesupplier.domain.valueobject.EndOfLdesException; import ldes.client.treenodesupplier.membersuppliers.MemberSupplier; import org.junit.jupiter.api.AfterEach; @@ -36,6 +37,9 @@ class LdioLdesClientTest { @Mock private ApplicationEventPublisher eventPublisher; + @Mock + private ClientStatusConsumer clientStatusConsumer; + private LdioLdesClient client; private final String pipelineName = "pipeline"; @@ -47,8 +51,8 @@ void setUp() { observer, supplier, eventPublisher, - false - ); + false, + clientStatusConsumer); } @AfterEach diff --git a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioLdesClientITSteps.java b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioLdesClientITSteps.java index 0d216a8a7..23d46a6a1 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioLdesClientITSteps.java +++ b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioLdesClientITSteps.java @@ -2,13 +2,15 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.services.ComponentExecutor; import be.vlaanderen.informatievlaanderen.ldes.ldio.LdioLdesClientProperties; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.management.status.ClientStatusService; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; import com.github.tomakehurst.wiremock.WireMockServer; import io.cucumber.java.BeforeAll; import io.cucumber.java.en.And; import io.cucumber.java.en.Given; import io.cucumber.java.en.Then; import io.cucumber.java.en.When; +import ldes.client.treenodesupplier.domain.valueobject.ClientStatus; import org.apache.jena.rdf.model.Model; import org.springframework.context.ApplicationEventPublisher; @@ -23,14 +25,15 @@ import static be.vlaanderen.informatievlaanderen.ldes.ldio.LdioLdesClientProperties.URLS; import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options; import static org.awaitility.Awaitility.await; +import static org.mockito.Mockito.*; public class LdioLdesClientITSteps extends LdesClientInIT { private final static WireMockServer wireMockServer = new WireMockServer(options().port(10101)); - + private final String pipelineName = "pipelineName"; private final ApplicationEventPublisher applicationEventPublisher = applicationEventPublisher(); private final Map componentPropsMap = new HashMap<>(); private final List members = new ArrayList<>(); - + private final ClientStatusService statusService = mock(ClientStatusService.class); @BeforeAll public static void before_all() { @@ -57,8 +60,8 @@ public void iStartAnLdesLdioInComponentWithUrl() { members.clear(); ComponentExecutor componentExecutor = members::add; - var props = new ComponentProperties("pipelineName", NAME, componentPropsMap); - var ldioInputConfigurator = new LdioLdesClientAutoConfig().ldioConfigurator(null); + var props = new ComponentProperties(pipelineName, NAME, componentPropsMap); + var ldioInputConfigurator = new LdioLdesClientAutoConfig().ldioConfigurator(statusService, null); ldioInputConfigurator.configure(null, componentExecutor, applicationEventPublisher, props); } @@ -74,4 +77,11 @@ public void allMembersFromTheStreamArePassedToThePipeline(int memberCount) { public void iWantToConfigureTheFollowingProperties(Map properties) { this.componentPropsMap.putAll(properties); } + + @And("I expect {int} REPLICATING, {int} SYNCHRONISING and {int} COMPLETED updates") + public void iExpectREPLICATINGSYNCHRONISINGAndCOMPLETEDUpdates(int replicatingTimes, int synchronisingTimes, int completedTimes) { + verify(statusService, times(replicatingTimes)).updateStatus(pipelineName, ClientStatus.REPLICATING); + verify(statusService, times(synchronisingTimes)).updateStatus(pipelineName, ClientStatus.SYNCHRONISING); + verify(statusService, times(completedTimes)).updateStatus(pipelineName, ClientStatus.COMPLETED); + } } diff --git a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/MemberSupplierFactoryTest.java b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/MemberSupplierFactoryTest.java index ea8af4fc0..6b8968578 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/MemberSupplierFactoryTest.java +++ b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/MemberSupplierFactoryTest.java @@ -1,7 +1,8 @@ package be.vlaanderen.informatievlaanderen.ldes.ldio.config; -import be.vlaanderen.informatievlaanderen.ldes.ldio.exception.ConfigPropertyMissingException; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.management.status.ClientStatusConsumer; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.exception.ConfigPropertyMissingException; import ldes.client.treenodesupplier.filters.LatestStateFilter; import ldes.client.treenodesupplier.membersuppliers.FilteredMemberSupplier; import ldes.client.treenodesupplier.membersuppliers.MemberSupplier; @@ -16,10 +17,12 @@ import static be.vlaanderen.informatievlaanderen.ldes.ldio.LdioLdesClientProperties.*; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.mockito.Mockito.mock; class MemberSupplierFactoryTest { private Map defaultInputConfig; + private final ClientStatusConsumer statusConsumer = mock(ClientStatusConsumer.class); @BeforeEach void setUp() { @@ -32,7 +35,7 @@ void when_VersionMaterialisationIsEnabled_then_VersionMaterialisedMemberSupplier defaultInputConfig.put(USE_VERSION_MATERIALISATION, "true"); final var componentProperties = new ComponentProperties("pipelineName", "cName", defaultInputConfig); - MemberSupplier memberSupplier = new MemberSupplierFactory(componentProperties, null).getMemberSupplier(); + MemberSupplier memberSupplier = new MemberSupplierFactory(componentProperties, null, statusConsumer).getMemberSupplier(); assertThat(memberSupplier).isInstanceOf(VersionMaterialisedMemberSupplier.class); } @@ -42,7 +45,7 @@ void when_VersionMaterialisationAndOnlyOnceFilterAreNotEnabled_then_MemberSuppli defaultInputConfig.put(USE_EXACTLY_ONCE_FILTER, "false"); final var componentProperties = new ComponentProperties("pipelineName", "cName", defaultInputConfig); - MemberSupplier memberSupplier = new MemberSupplierFactory(componentProperties, null).getMemberSupplier(); + MemberSupplier memberSupplier = new MemberSupplierFactory(componentProperties, null, statusConsumer).getMemberSupplier(); assertThat(memberSupplier).isInstanceOf(MemberSupplierImpl.class); } @@ -50,7 +53,7 @@ void when_VersionMaterialisationAndOnlyOnceFilterAreNotEnabled_then_MemberSuppli void when_VersionMaterialisationIsNotEnabled_then_OnlyOnceMemberSupplierIsReturned() { final var componentProperties = new ComponentProperties("pipelineName", "cName", defaultInputConfig); - MemberSupplier memberSupplier = new MemberSupplierFactory(componentProperties, null).getMemberSupplier(); + MemberSupplier memberSupplier = new MemberSupplierFactory(componentProperties, null, statusConsumer).getMemberSupplier(); assertThat(memberSupplier).isInstanceOf(FilteredMemberSupplier.class); } @@ -61,7 +64,7 @@ void when_LatestStateFilterIsEnabled_then_returnVersionMaterialisedMemberSupplie defaultInputConfig.put(USE_LATEST_STATE_FILTER, "true"); final var componentProperties = new ComponentProperties("pipelineName", "cName", defaultInputConfig); - MemberSupplier memberSupplier = new MemberSupplierFactory(componentProperties, null).getMemberSupplier(); + MemberSupplier memberSupplier = new MemberSupplierFactory(componentProperties, null, statusConsumer).getMemberSupplier(); assertThat(memberSupplier) .isInstanceOf(VersionMaterialisedMemberSupplier.class) @@ -75,7 +78,7 @@ void when_LatestStateFilterIsDisabled_then_returnVersionMaterialisedMemberSuppli defaultInputConfig.put(USE_LATEST_STATE_FILTER, "false"); final var componentProperties = new ComponentProperties("pipelineName", "cName", defaultInputConfig); - MemberSupplier memberSupplier = new MemberSupplierFactory(componentProperties, null).getMemberSupplier(); + MemberSupplier memberSupplier = new MemberSupplierFactory(componentProperties, null, statusConsumer).getMemberSupplier(); assertThat(memberSupplier) .isInstanceOf(VersionMaterialisedMemberSupplier.class) @@ -89,7 +92,7 @@ void when_LatestStateFilterIsEnabledWithoutMaterialisation_then_returnMemberSupp defaultInputConfig.put(USE_LATEST_STATE_FILTER, "true"); final var componentProperties = new ComponentProperties("pipelineName", "cName", defaultInputConfig); - MemberSupplier memberSupplier = new MemberSupplierFactory(componentProperties, null).getMemberSupplier(); + MemberSupplier memberSupplier = new MemberSupplierFactory(componentProperties, null, statusConsumer).getMemberSupplier(); assertThat(memberSupplier).isInstanceOf(MemberSupplierImpl.class); } @@ -98,7 +101,7 @@ void when_LatestStateFilterIsEnabledWithoutMaterialisation_then_returnMemberSupp void when_NoUrlsAreConfigured_then_ThrowException() { final String expectedErrorMessage = "Pipeline \"pipelineName\": \"cName\" : Missing value for property \"urls\" ."; final var componentProperties = new ComponentProperties("pipelineName", "cName", Map.of("url", "http://localhost:8080/ldes")); - final MemberSupplierFactory memberSupplierFactory = new MemberSupplierFactory(componentProperties, null); + final MemberSupplierFactory memberSupplierFactory = new MemberSupplierFactory(componentProperties, null, statusConsumer); assertThatThrownBy(memberSupplierFactory::getMemberSupplier) .isInstanceOf(ConfigPropertyMissingException.class) .hasMessage(expectedErrorMessage); diff --git a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/StatePersistenceFactoryTest.java b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/StatePersistenceFactoryTest.java index 88e188457..b43a44edf 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/StatePersistenceFactoryTest.java +++ b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/StatePersistenceFactoryTest.java @@ -1,7 +1,7 @@ package be.vlaanderen.informatievlaanderen.ldes.ldio.config; -import be.vlaanderen.informatievlaanderen.ldes.ldio.exception.ConfigPropertyMissingException; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.exception.ConfigPropertyMissingException; import ldes.client.treenodesupplier.domain.valueobject.StatePersistence; import ldes.client.treenodesupplier.repository.MemberRepository; import ldes.client.treenodesupplier.repository.TreeNodeRecordRepository; @@ -22,7 +22,7 @@ import java.util.Map; import java.util.stream.Stream; -import static be.vlaanderen.informatievlaanderen.ldes.ldio.persistence.PersistenceProperties.*; +import static be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.persistence.PersistenceProperties.*; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; diff --git a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/status/ClientStatusServiceTest.java b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/status/ClientStatusServiceTest.java new file mode 100644 index 000000000..45e79575a --- /dev/null +++ b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/status/ClientStatusServiceTest.java @@ -0,0 +1,37 @@ +package be.vlaanderen.informatievlaanderen.ldes.ldio.management.status; + +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.events.PipelineDeletedEvent; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.context.ApplicationEventPublisher; + +import static ldes.client.treenodesupplier.domain.valueobject.ClientStatus.REPLICATING; +import static org.assertj.core.api.Assertions.assertThat; + +@SpringBootTest(classes = ClientStatusService.class) +class ClientStatusServiceTest { + @Autowired + private ClientStatusService clientStatusService; + + @Autowired + private ApplicationEventPublisher eventPublisher; + + @Test + void test_baseFlow() { + String pipelineId = "1"; + + var status = clientStatusService.getClientStatus(pipelineId); + + assertThat(status).isEmpty(); + + clientStatusService.updateStatus(pipelineId, REPLICATING); + + assertThat(clientStatusService.getClientStatuses()).contains(new ClientStatusTo(pipelineId, REPLICATING)); + assertThat(clientStatusService.getClientStatus(pipelineId)).isNotEmpty(); + + eventPublisher.publishEvent(new PipelineDeletedEvent(pipelineId)); + + assertThat(clientStatusService.getClientStatus(pipelineId)).isEmpty(); + } +} diff --git a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/test/resources/features/ldes-client-in.feature b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/test/resources/features/ldes-client-in.feature index 623703306..6a3617e39 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/test/resources/features/ldes-client-in.feature +++ b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/test/resources/features/ldes-client-in.feature @@ -8,6 +8,15 @@ Feature: LdesClientIntegrationTest And I configure this to be of RDF format "application/ld+json" When I start an ldes-ldio-in component Then All 6 members from the stream are passed to the pipeline + And I expect 1 REPLICATING, 0 SYNCHRONISING and 1 COMPLETED updates + + Scenario: Reading an Open LDES Stream + Given I want to follow the following LDES + | /page-without-relations | + And I configure this to be of RDF format "application/ld+json" + When I start an ldes-ldio-in component + Then All 2 members from the stream are passed to the pipeline + And I expect 1 REPLICATING, 1 SYNCHRONISING and 0 COMPLETED updates Scenario: Reading multiple LDES Streams Given I want to follow the following LDES @@ -15,6 +24,7 @@ Feature: LdesClientIntegrationTest | /items/grouped?group=2 | When I start an ldes-ldio-in component Then All 8 members from the stream are passed to the pipeline + And I expect 1 REPLICATING, 0 SYNCHRONISING and 1 COMPLETED updates Scenario Outline: Reading an LDES Stream with latest state filter enabled Given I want to follow the following LDES @@ -46,4 +56,4 @@ Feature: LdesClientIntegrationTest Examples: | isExactlyOnceFilterEnabled | expectedMemberSize | | true | 4 | - | false | 8 | + | false | 8 | \ No newline at end of file diff --git a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/test/resources/mappings/page-without-relations.json b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/test/resources/mappings/page-without-relations.json new file mode 100644 index 000000000..1c34f0584 --- /dev/null +++ b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/test/resources/mappings/page-without-relations.json @@ -0,0 +1,314 @@ +{ + "mappings": [ + { + "scenarioName": "Mutable Fragment", + "newScenarioState": "Mutable Fragment was fetched once", + "request": { + "method": "GET", + "url": "/page-without-relations", + "headers": { + "Accept": { + "contains": "application/ld+json" + } + } + }, + "response": { + "status": 200, + "jsonBody": { + "@context": [ + "https://private-api.gipod.beta-vlaanderen.be/api/v1/context/gipod.jsonld" + ], + "@id": "http://localhost:10101/page-without-relations", + "@type": "Node", + "viewOf": "https://private-api.gipod.beta-vlaanderen.be/api/v1/ldes/mobility-hindrances", + "collectionInfo": { + "@id": "https://private-api.gipod.beta-vlaanderen.be/api/v1/ldes/mobility-hindrances", + "@type": "EventStream", + "shape": "https://private-api.gipod.beta-vlaanderen.be/api/v1/ldes/mobility-hindrances/shape", + "timestampPath": "prov:generatedAtTime", + "versionOfPath": "dct:isVersionOf" + }, + "items": [ + { + "@id": "https://private-api.gipod.beta-vlaanderen.be/api/v1/mobility-hindrances/1", + "@type": "MobilityHindrance", + "gipodId": 10228787, + "identifier": [ + { + "@type": "Identifier", + "Identifier.identifier": { + "value": "10228787", + "type": "gipodId" + }, + "assignedByName": "https://gipod.vlaanderen.be" + } + ], + "isConsequenceOf": [ + { + "@id": "/api/v1/events/3773285", + "@type": "Event", + "gipodId": 3773285 + } + ], + "description": "Eetwagen", + "owner": { + "isVersionOf": "/api/v1/organisations/0201f2a2-39e6-0a88-b5a3-c912f52a9a93", + "@type": "Organisation", + "preferredName": "Geosparc" + }, + "contactOrganisation": [], + "zone": [ + { + "@id": "/api/v1/mobility-hindrances/10228787/zones/6dd8d314-9415-4103-bb06-c7c9fbf3dc19", + "@type": "Zone", + "consequence": [ + { + "@id": "/api/v1/taxonomies/mobility-hindrance/consequencetypes/c53813ab-814f-4ff4-8a87-6934c72e175f", + "prefLabel": "Geen doorgang voor gemotoriseerd verkeer" + } + ], + "geometry": { + "@type": "Geometry", + "wkt": " POLYGON ((109802.90525490482 189774.7184551563, 109801.10560758458 189779.91360264365, 109803.47330090578 189780.72935110983, 109805.27295029224 189775.5342052644, 109807.07260330272 189770.33905491605, 109804.70490584878 189769.52330316138, 109802.90525490482 189774.7184551563))" + }, + "zoneType": { + "@id": "/api/v1/taxonomies/zonetypes/0fb72ef7-6ac9-4a70-b295-a30ea215d250", + "prefLabel": "HinderZone" + } + } + ], + "period": [ + { + "@type": "Period", + "start": "2021-01-31T23:00:00Z", + "end": "2021-02-03T22:30:00Z" + } + ], + "timeSchedule": null, + "permittedBy": [], + "status": { + "@id": "/api/v1/taxonomies/statuses/a411c53e-db33-436a-9bb9-d62d535b661d", + "prefLabel": "Onbekend" + }, + "generatedAtTime": "2020-12-28T09:37:18.577Z", + "eventName": "MobilityHindranceWasImportedFromLegacy", + "isVersionOf": "/api/v1/mobility-hindrances/10228787", + "memberOf": "https://private-api.gipod.beta-vlaanderen.be/api/v1/ldes/mobility-hindrances", + "lastModifiedOn": "2020-12-07T15:10:22.18Z", + "lastModifiedBy": { + "isVersionOf": "/api/v1/organisations/0201f2a2-39e6-0a88-b5a3-c912f52a9a93", + "@type": "Organisation", + "preferredName": "Geosparc" + }, + "createdOn": "2020-12-07T15:10:22.18Z", + "createdBy": { + "isVersionOf": "/api/v1/organisations/0201f2a2-39e6-0a88-b5a3-c912f52a9a93", + "@type": "Organisation", + "preferredName": "Geosparc" + } + } + ] + }, + "headers": { + "Content-Type": "application/ld+json;charset=UTF-8", + "Cache-Control": "public, max-age=1, mutable" + } + } + }, + { + "scenarioName": "Mutable Fragment", + "requiredScenarioState": "Mutable Fragment was fetched once", + "newScenarioState": "Mutable Fragment was fetched twice", + "request": { + "method": "GET", + "url": "/page-without-relations", + "headers": { + "Accept": { + "contains": "application/ld+json" + } + } + }, + "response": { + "status": 200, + "jsonBody": { + "@context": [ + "https://private-api.gipod.beta-vlaanderen.be/api/v1/context/gipod.jsonld" + ], + "@id": "http://localhost:10101/page-without-relations", + "@type": "Node", + "viewOf": "https://private-api.gipod.beta-vlaanderen.be/api/v1/ldes/mobility-hindrances", + "collectionInfo": { + "@id": "https://private-api.gipod.beta-vlaanderen.be/api/v1/ldes/mobility-hindrances", + "@type": "EventStream", + "shape": "https://private-api.gipod.beta-vlaanderen.be/api/v1/ldes/mobility-hindrances/shape", + "timestampPath": "prov:generatedAtTime", + "versionOfPath": "dct:isVersionOf" + }, + "items": [ + { + "@id": "https://private-api.gipod.beta-vlaanderen.be/api/v1/mobility-hindrances/1", + "@type": "MobilityHindrance", + "gipodId": 10228787, + "identifier": [ + { + "@type": "Identifier", + "Identifier.identifier": { + "value": "10228787", + "type": "gipodId" + }, + "assignedByName": "https://gipod.vlaanderen.be" + } + ], + "isConsequenceOf": [ + { + "@id": "/api/v1/events/3773285", + "@type": "Event", + "gipodId": 3773285 + } + ], + "description": "Eetwagen", + "owner": { + "isVersionOf": "/api/v1/organisations/0201f2a2-39e6-0a88-b5a3-c912f52a9a93", + "@type": "Organisation", + "preferredName": "Geosparc" + }, + "contactOrganisation": [], + "zone": [ + { + "@id": "/api/v1/mobility-hindrances/10228787/zones/6dd8d314-9415-4103-bb06-c7c9fbf3dc19", + "@type": "Zone", + "consequence": [ + { + "@id": "/api/v1/taxonomies/mobility-hindrance/consequencetypes/c53813ab-814f-4ff4-8a87-6934c72e175f", + "prefLabel": "Geen doorgang voor gemotoriseerd verkeer" + } + ], + "geometry": { + "@type": "Geometry", + "wkt": " POLYGON ((109802.90525490482 189774.7184551563, 109801.10560758458 189779.91360264365, 109803.47330090578 189780.72935110983, 109805.27295029224 189775.5342052644, 109807.07260330272 189770.33905491605, 109804.70490584878 189769.52330316138, 109802.90525490482 189774.7184551563))" + }, + "zoneType": { + "@id": "/api/v1/taxonomies/zonetypes/0fb72ef7-6ac9-4a70-b295-a30ea215d250", + "prefLabel": "HinderZone" + } + } + ], + "period": [ + { + "@type": "Period", + "start": "2021-01-31T23:00:00Z", + "end": "2021-02-03T22:30:00Z" + } + ], + "timeSchedule": null, + "permittedBy": [], + "status": { + "@id": "/api/v1/taxonomies/statuses/a411c53e-db33-436a-9bb9-d62d535b661d", + "prefLabel": "Onbekend" + }, + "generatedAtTime": "2020-12-28T09:37:18.577Z", + "eventName": "MobilityHindranceWasImportedFromLegacy", + "isVersionOf": "/api/v1/mobility-hindrances/10228787", + "memberOf": "https://private-api.gipod.beta-vlaanderen.be/api/v1/ldes/mobility-hindrances", + "lastModifiedOn": "2020-12-07T15:10:22.18Z", + "lastModifiedBy": { + "isVersionOf": "/api/v1/organisations/0201f2a2-39e6-0a88-b5a3-c912f52a9a93", + "@type": "Organisation", + "preferredName": "Geosparc" + }, + "createdOn": "2020-12-07T15:10:22.18Z", + "createdBy": { + "isVersionOf": "/api/v1/organisations/0201f2a2-39e6-0a88-b5a3-c912f52a9a93", + "@type": "Organisation", + "preferredName": "Geosparc" + } + }, + { + "@id": "https://private-api.gipod.beta-vlaanderen.be/api/v1/mobility-hindrances/2", + "@type": "MobilityHindrance", + "gipodId": 10228787, + "identifier": [ + { + "@type": "Identifier", + "Identifier.identifier": { + "value": "10228787", + "type": "gipodId" + }, + "assignedByName": "https://gipod.vlaanderen.be" + } + ], + "isConsequenceOf": [ + { + "@id": "/api/v1/events/3773285", + "@type": "Event", + "gipodId": 3773285 + } + ], + "description": "Eetwagen", + "owner": { + "isVersionOf": "/api/v1/organisations/0201f2a2-39e6-0a88-b5a3-c912f52a9a93", + "@type": "Organisation", + "preferredName": "Geosparc" + }, + "contactOrganisation": [], + "zone": [ + { + "@id": "/api/v1/mobility-hindrances/10228787/zones/6dd8d314-9415-4103-bb06-c7c9fbf3dc19", + "@type": "Zone", + "consequence": [ + { + "@id": "/api/v1/taxonomies/mobility-hindrance/consequencetypes/c53813ab-814f-4ff4-8a87-6934c72e175f", + "prefLabel": "Geen doorgang voor gemotoriseerd verkeer" + } + ], + "geometry": { + "@type": "Geometry", + "wkt": " POLYGON ((109802.90525490482 189774.7184551563, 109801.10560758458 189779.91360264365, 109803.47330090578 189780.72935110983, 109805.27295029224 189775.5342052644, 109807.07260330272 189770.33905491605, 109804.70490584878 189769.52330316138, 109802.90525490482 189774.7184551563))" + }, + "zoneType": { + "@id": "/api/v1/taxonomies/zonetypes/0fb72ef7-6ac9-4a70-b295-a30ea215d250", + "prefLabel": "HinderZone" + } + } + ], + "period": [ + { + "@type": "Period", + "start": "2021-01-31T23:00:00Z", + "end": "2021-02-03T22:30:00Z" + } + ], + "timeSchedule": null, + "permittedBy": [], + "status": { + "@id": "/api/v1/taxonomies/statuses/a411c53e-db33-436a-9bb9-d62d535b661d", + "prefLabel": "Onbekend" + }, + "generatedAtTime": "2020-12-29T09:37:18.578Z", + "eventName": "MobilityHindranceWasImportedFromLegacy", + "isVersionOf": "/api/v1/mobility-hindrances/10228787", + "memberOf": "https://private-api.gipod.beta-vlaanderen.be/api/v1/ldes/mobility-hindrances", + "lastModifiedOn": "2020-12-07T15:10:22.18Z", + "lastModifiedBy": { + "isVersionOf": "/api/v1/organisations/0201f2a2-39e6-0a88-b5a3-c912f52a9a93", + "@type": "Organisation", + "preferredName": "Geosparc", + "generatedAtTime": "2020-12-27T09:37:18.578Z" + }, + "createdOn": "2020-12-07T15:10:22.18Z", + "createdBy": { + "isVersionOf": "/api/v1/organisations/0201f2a2-39e6-0a88-b5a3-c912f52a9a93", + "@type": "Organisation", + "preferredName": "Geosparc" + } + } + ] + }, + "headers": { + "Content-Type": "application/ld+json;charset=UTF-8", + "Cache-Control": "public, max-age=1, mutable" + } + } + } + ] +} \ No newline at end of file diff --git a/ldi-orchestrator/ldio-connectors/ldio-ngsiv2-to-ld-adapter/pom.xml b/ldi-orchestrator/ldio-connectors/ldio-ngsiv2-to-ld-adapter/pom.xml index 29adabc65..70f352c53 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-ngsiv2-to-ld-adapter/pom.xml +++ b/ldi-orchestrator/ldio-connectors/ldio-ngsiv2-to-ld-adapter/pom.xml @@ -6,7 +6,7 @@ ldio-connectors be.vlaanderen.informatievlaanderen.ldes.ldio - 2.7.0-SNAPSHOT + 2.9.0 ldio-ngsiv2-to-ld-adapter @@ -15,7 +15,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi ngsiv2-to-ld-adapter - 2.7.0-SNAPSHOT + ${project.version} compile diff --git a/ldi-orchestrator/ldio-connectors/ldio-ngsiv2-to-ld-adapter/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioNgsiv2ToLdAdapterAutoConfig.java b/ldi-orchestrator/ldio-connectors/ldio-ngsiv2-to-ld-adapter/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioNgsiv2ToLdAdapterAutoConfig.java index 527a47dc3..79deb75a6 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-ngsiv2-to-ld-adapter/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioNgsiv2ToLdAdapterAutoConfig.java +++ b/ldi-orchestrator/ldio-connectors/ldio-ngsiv2-to-ld-adapter/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioNgsiv2ToLdAdapterAutoConfig.java @@ -2,8 +2,8 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.NgsiV2ToLdAdapter; import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiAdapter; -import be.vlaanderen.informatievlaanderen.ldes.ldio.configurator.LdioAdapterConfigurator; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioAdapterConfigurator; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/ldi-orchestrator/ldio-connectors/ldio-noop-out/pom.xml b/ldi-orchestrator/ldio-connectors/ldio-noop-out/pom.xml index c26b9ea0e..bf693eb79 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-noop-out/pom.xml +++ b/ldi-orchestrator/ldio-connectors/ldio-noop-out/pom.xml @@ -4,7 +4,7 @@ ldio-connectors be.vlaanderen.informatievlaanderen.ldes.ldio - 2.7.0-SNAPSHOT + 2.9.0 4.0.0 diff --git a/ldi-orchestrator/ldio-connectors/ldio-noop-out/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioNoopOutAutoConfig.java b/ldi-orchestrator/ldio-connectors/ldio-noop-out/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioNoopOutAutoConfig.java index f1a642ac0..278255d89 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-noop-out/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioNoopOutAutoConfig.java +++ b/ldi-orchestrator/ldio-connectors/ldio-noop-out/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioNoopOutAutoConfig.java @@ -2,8 +2,8 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiComponent; import be.vlaanderen.informatievlaanderen.ldes.ldio.LdioNoopOut; -import be.vlaanderen.informatievlaanderen.ldes.ldio.configurator.LdioOutputConfigurator; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioOutputConfigurator; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/ldi-orchestrator/ldio-connectors/ldio-rdf-adapter/pom.xml b/ldi-orchestrator/ldio-connectors/ldio-rdf-adapter/pom.xml index d68daa460..9927f6830 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-rdf-adapter/pom.xml +++ b/ldi-orchestrator/ldio-connectors/ldio-rdf-adapter/pom.xml @@ -5,7 +5,7 @@ ldio-connectors be.vlaanderen.informatievlaanderen.ldes.ldio - 2.7.0-SNAPSHOT + 2.9.0 4.0.0 diff --git a/ldi-orchestrator/ldio-connectors/ldio-rdf-adapter/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioRdfAdapterAutoConfig.java b/ldi-orchestrator/ldio-connectors/ldio-rdf-adapter/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioRdfAdapterAutoConfig.java index 45f289dcd..43d8e5023 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-rdf-adapter/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioRdfAdapterAutoConfig.java +++ b/ldi-orchestrator/ldio-connectors/ldio-rdf-adapter/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioRdfAdapterAutoConfig.java @@ -3,8 +3,8 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.RdfAdapter; import be.vlaanderen.informatievlaanderen.ldes.ldi.rdf.parser.JenaContextProvider; import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiAdapter; -import be.vlaanderen.informatievlaanderen.ldes.ldio.configurator.LdioAdapterConfigurator; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioAdapterConfigurator; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/ldi-orchestrator/ldio-connectors/ldio-repository-materialiser/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioRepositoryPipelineEventsListenerConfig.java b/ldi-orchestrator/ldio-connectors/ldio-repository-materialiser/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioRepositoryPipelineEventsListenerConfig.java deleted file mode 100644 index a09fb7870..000000000 --- a/ldi-orchestrator/ldio-connectors/ldio-repository-materialiser/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioRepositoryPipelineEventsListenerConfig.java +++ /dev/null @@ -1,22 +0,0 @@ -package be.vlaanderen.informatievlaanderen.ldes.ldio.config; - -import be.vlaanderen.informatievlaanderen.ldes.ldio.LdioRepositoryMaterialiser; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioPipelineEventsListener; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -@Configuration -public class LdioRepositoryPipelineEventsListenerConfig { - @Bean - public LdioPipelineEventsListener ldioRepositoryMaterialiserLdioPipelineEventsListener() { - return new LdioPipelineEventsListener.Builder() - .withStartBehavior(LdioRepositoryMaterialiser::start) - .withResumeBehavior(LdioRepositoryMaterialiser::start) - .withStopBehavior(LdioRepositoryMaterialiser::shutdown) - .withPauseBehavior(materialiser -> { - materialiser.sendToMaterialiser(); - materialiser.shutdown(); - }) - .build(); - } -} diff --git a/ldi-orchestrator/ldio-connectors/ldio-repository-materialiser/pom.xml b/ldi-orchestrator/ldio-connectors/ldio-repository-sink/pom.xml similarity index 87% rename from ldi-orchestrator/ldio-connectors/ldio-repository-materialiser/pom.xml rename to ldi-orchestrator/ldio-connectors/ldio-repository-sink/pom.xml index e3d94d870..f59e605a0 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-repository-materialiser/pom.xml +++ b/ldi-orchestrator/ldio-connectors/ldio-repository-sink/pom.xml @@ -6,15 +6,15 @@ be.vlaanderen.informatievlaanderen.ldes.ldio ldio-connectors - 2.7.0-SNAPSHOT + 2.9.0 - ldio-repository-materialiser + ldio-repository-sink be.vlaanderen.informatievlaanderen.ldes.ldi - repository-materialiser + repository-sink ${project.version} compile diff --git a/ldi-orchestrator/ldio-connectors/ldio-repository-materialiser/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioRepositoryMaterialiser.java b/ldi-orchestrator/ldio-connectors/ldio-repository-sink/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioRepositorySink.java similarity index 74% rename from ldi-orchestrator/ldio-connectors/ldio-repository-materialiser/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioRepositoryMaterialiser.java rename to ldi-orchestrator/ldio-connectors/ldio-repository-sink/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioRepositorySink.java index 896307ed1..c9c79be71 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-repository-materialiser/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioRepositoryMaterialiser.java +++ b/ldi-orchestrator/ldio-connectors/ldio-repository-sink/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioRepositorySink.java @@ -1,6 +1,6 @@ package be.vlaanderen.informatievlaanderen.ldes.ldio; -import be.vlaanderen.informatievlaanderen.ldes.ldi.Materialiser; +import be.vlaanderen.informatievlaanderen.ldes.ldi.RepositorySink; import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiOutput; import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.ModelFactory; @@ -16,20 +16,20 @@ import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; -import static be.vlaanderen.informatievlaanderen.ldes.ldio.config.ObserveConfiguration.ERROR_TEMPLATE; +import static be.vlaanderen.informatievlaanderen.ldes.ldio.ObserveConfiguration.ERROR_TEMPLATE; import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor; -public class LdioRepositoryMaterialiser implements LdiOutput { - private static final Logger log = LoggerFactory.getLogger(LdioRepositoryMaterialiser.class); - public static final String NAME = "Ldio:RepositoryMaterialiser"; +public class LdioRepositorySink implements LdiOutput { + public static final String NAME = "Ldio:RepositorySink"; + private static final Logger log = LoggerFactory.getLogger(LdioRepositorySink.class); private ScheduledExecutorService scheduledExecutorService; private final int batchSize; private final int batchTimeout; - private final Materialiser materialiser; + private final RepositorySink sink; private final List membersToCommit; - public LdioRepositoryMaterialiser(Materialiser materialiser, int batchSize, int batchTimeout) { - this.materialiser = materialiser; + public LdioRepositorySink(RepositorySink sink, int batchSize, int batchTimeout) { + this.sink = sink; this.batchSize = batchSize; this.batchTimeout = batchTimeout; this.membersToCommit = new ArrayList<>(); @@ -39,30 +39,30 @@ public LdioRepositoryMaterialiser(Materialiser materialiser, int batchSize, int public void accept(Model model) { membersToCommit.add(model); if (membersToCommit.size() >= batchSize) { - sendToMaterialiser(); + sendToSink(); resetExecutor(); } } public void start() { scheduledExecutorService = newSingleThreadScheduledExecutor(); - scheduledExecutorService.scheduleAtFixedRate(this::sendToMaterialiser, batchTimeout, batchTimeout, TimeUnit.MILLISECONDS); + scheduledExecutorService.scheduleAtFixedRate(this::sendToSink, batchTimeout, batchTimeout, TimeUnit.MILLISECONDS); } public void shutdown() { - materialiser.shutdown(); scheduledExecutorService.shutdown(); + sink.shutdown(); } - public synchronized void sendToMaterialiser() { + public synchronized void sendToSink() { if (!membersToCommit.isEmpty()) { final List members = List.copyOf(membersToCommit); - materialiser.processAsync(members) - .exceptionally(throwable -> { - handleException(throwable, members); - return null; - }); membersToCommit.clear(); + try { + sink.process(members); + } catch (Exception e) { + handleException(e, members); + } } } diff --git a/ldi-orchestrator/ldio-connectors/ldio-repository-materialiser/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioRepositoryMaterialiserProperties.java b/ldi-orchestrator/ldio-connectors/ldio-repository-sink/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioRepositoryMaterialiserProperties.java similarity index 100% rename from ldi-orchestrator/ldio-connectors/ldio-repository-materialiser/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioRepositoryMaterialiserProperties.java rename to ldi-orchestrator/ldio-connectors/ldio-repository-sink/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioRepositoryMaterialiserProperties.java diff --git a/ldi-orchestrator/ldio-connectors/ldio-repository-sink/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioRepositoryPipelineEventsListenerConfig.java b/ldi-orchestrator/ldio-connectors/ldio-repository-sink/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioRepositoryPipelineEventsListenerConfig.java new file mode 100644 index 000000000..ed2d42b6c --- /dev/null +++ b/ldi-orchestrator/ldio-connectors/ldio-repository-sink/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioRepositoryPipelineEventsListenerConfig.java @@ -0,0 +1,22 @@ +package be.vlaanderen.informatievlaanderen.ldes.ldio.config; + +import be.vlaanderen.informatievlaanderen.ldes.ldio.LdioRepositorySink; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status.LdioPipelineEventsListener; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class LdioRepositoryPipelineEventsListenerConfig { + @Bean + public LdioPipelineEventsListener ldioRepositoryMaterialiserLdioPipelineEventsListener() { + return new LdioPipelineEventsListener.Builder() + .withStartBehavior(LdioRepositorySink::start) + .withResumeBehavior(LdioRepositorySink::start) + .withStopBehavior(LdioRepositorySink::shutdown) + .withPauseBehavior(materialiser -> { + materialiser.sendToSink(); + materialiser.shutdown(); + }) + .build(); + } +} diff --git a/ldi-orchestrator/ldio-connectors/ldio-repository-materialiser/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioRepositoryMaterialiserAutoConfig.java b/ldi-orchestrator/ldio-connectors/ldio-repository-sink/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioRepositorySinkAutoConfig.java similarity index 60% rename from ldi-orchestrator/ldio-connectors/ldio-repository-materialiser/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioRepositoryMaterialiserAutoConfig.java rename to ldi-orchestrator/ldio-connectors/ldio-repository-sink/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioRepositorySinkAutoConfig.java index 4829b96d9..f0bd446a4 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-repository-materialiser/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioRepositoryMaterialiserAutoConfig.java +++ b/ldi-orchestrator/ldio-connectors/ldio-repository-sink/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioRepositorySinkAutoConfig.java @@ -1,30 +1,30 @@ package be.vlaanderen.informatievlaanderen.ldes.ldio.config; -import be.vlaanderen.informatievlaanderen.ldes.ldi.Materialiser; +import be.vlaanderen.informatievlaanderen.ldes.ldi.RepositorySink; import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiComponent; -import be.vlaanderen.informatievlaanderen.ldes.ldio.LdioRepositoryMaterialiser; -import be.vlaanderen.informatievlaanderen.ldes.ldio.configurator.LdioOutputConfigurator; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioPipelineEventsListener; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.LdioRepositorySink; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioOutputConfigurator; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status.LdioPipelineEventsListener; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import static be.vlaanderen.informatievlaanderen.ldes.ldio.LdioRepositoryMaterialiser.NAME; +import static be.vlaanderen.informatievlaanderen.ldes.ldio.LdioRepositorySink.NAME; import static be.vlaanderen.informatievlaanderen.ldes.ldio.config.LdioRepositoryMaterialiserProperties.*; @Configuration -public class LdioRepositoryMaterialiserAutoConfig { +public class LdioRepositorySinkAutoConfig { @SuppressWarnings("java:S6830") @Bean(NAME) - public LdioOutputConfigurator ldiRepoMaterialiserConfigurator(LdioPipelineEventsListener pipelineEventsListener) { + public LdioOutputConfigurator ldiRepoMaterialiserConfigurator(LdioPipelineEventsListener pipelineEventsListener) { return new LdiRepoMaterialiserProcessorConfigurator(pipelineEventsListener); } public static class LdiRepoMaterialiserProcessorConfigurator implements LdioOutputConfigurator { - private final LdioPipelineEventsListener pipelineEventsListener; + private final LdioPipelineEventsListener pipelineEventsListener; - public LdiRepoMaterialiserProcessorConfigurator(LdioPipelineEventsListener pipelineEventsListener) { + public LdiRepoMaterialiserProcessorConfigurator(LdioPipelineEventsListener pipelineEventsListener) { this.pipelineEventsListener = pipelineEventsListener; } @@ -33,12 +33,12 @@ public LdiComponent configure(ComponentProperties config) { final String hostUrl = config.getProperty(SPARQL_HOST); final String repositoryId = config.getProperty(REPOSITORY_ID); final String namedGraph = config.getOptionalProperty(NAMED_GRAPH).orElse(""); - final Materialiser materialiser = new Materialiser(hostUrl, repositoryId, namedGraph); + final RepositorySink repositorySink = new RepositorySink(hostUrl, repositoryId, namedGraph); final int batchSize = config.getOptionalInteger(BATCH_SIZE).orElse(BATCH_SIZE_DEFAULT); final int batchTimeout = config.getOptionalInteger(BATCH_TIMEOUT).orElse(BATCH_TIMEOUT_DEFAULT); - final LdioRepositoryMaterialiser ldioRepositoryMaterialiser = new LdioRepositoryMaterialiser(materialiser, batchSize, batchTimeout); - pipelineEventsListener.registerComponent(config.getPipelineName(), ldioRepositoryMaterialiser); - return ldioRepositoryMaterialiser; + final LdioRepositorySink ldioRepositorySink = new LdioRepositorySink(repositorySink, batchSize, batchTimeout); + pipelineEventsListener.registerComponent(config.getPipelineName(), ldioRepositorySink); + return ldioRepositorySink; } } } diff --git a/ldi-orchestrator/ldio-connectors/ldio-repository-materialiser/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioRepositoryMaterialiserTest.java b/ldi-orchestrator/ldio-connectors/ldio-repository-sink/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioRepositorySinkTest.java similarity index 56% rename from ldi-orchestrator/ldio-connectors/ldio-repository-materialiser/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioRepositoryMaterialiserTest.java rename to ldi-orchestrator/ldio-connectors/ldio-repository-sink/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioRepositorySinkTest.java index 6650f803a..5875e3cf2 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-repository-materialiser/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioRepositoryMaterialiserTest.java +++ b/ldi-orchestrator/ldio-connectors/ldio-repository-sink/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioRepositorySinkTest.java @@ -1,7 +1,7 @@ package be.vlaanderen.informatievlaanderen.ldes.ldio; -import be.vlaanderen.informatievlaanderen.ldes.ldi.Materialiser; -import be.vlaanderen.informatievlaanderen.ldes.ldi.exceptions.MaterialisationFailedException; +import be.vlaanderen.informatievlaanderen.ldes.ldi.RepositorySink; +import be.vlaanderen.informatievlaanderen.ldes.ldi.exceptions.SinkFailedException; import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.ModelFactory; import org.apache.jena.riot.Lang; @@ -15,7 +15,6 @@ import org.mockito.junit.jupiter.MockitoExtension; import java.util.List; -import java.util.concurrent.CompletableFuture; import java.util.stream.Stream; import static org.assertj.core.api.Assertions.assertThat; @@ -23,16 +22,16 @@ import static org.mockito.Mockito.*; @ExtendWith(MockitoExtension.class) -class LdioRepositoryMaterialiserTest { +class LdioRepositorySinkTest { private static final int BATCH_TIMEOUT = 2000; @Mock - private Materialiser materialiser; + private RepositorySink repositorySink; - private LdioRepositoryMaterialiser ldioRepositoryMaterialiser; + private LdioRepositorySink ldioRepositorySink; @AfterEach void tearDown() { - ldioRepositoryMaterialiser.shutdown(); + ldioRepositorySink.shutdown(); } @@ -42,37 +41,36 @@ class ProcessList { @BeforeEach void setUp() { - ldioRepositoryMaterialiser = new LdioRepositoryMaterialiser(materialiser, BATCH_SIZE, BATCH_TIMEOUT); - ldioRepositoryMaterialiser.start(); + ldioRepositorySink = new LdioRepositorySink(repositorySink, BATCH_SIZE, BATCH_TIMEOUT); + ldioRepositorySink.start(); } @Test void given_ValidListOfMembers_when_ProcessList_then_CommitToRepository() { - when(materialiser.processAsync(anyList())).thenReturn(new CompletableFuture<>()); - readTenModelsFromFile() - .forEach(ldioRepositoryMaterialiser::accept); + .forEach(ldioRepositorySink); - verify(materialiser).processAsync(anyList()); + verify(repositorySink).process(anyList()); } @Test void given_ValidList_when_ProcessList_And_CommitFails_then_RollbackConnection() { - doThrow(MaterialisationFailedException.class).when(materialiser).processAsync(anyList()); + SinkFailedException exception = new SinkFailedException(new RuntimeException()); + doThrow(exception).when(repositorySink).process(anyList()); final List models = readTenModelsFromFile().toList(); for (int i = 0; i < models.size(); i++) { try { - ldioRepositoryMaterialiser.accept(models.get(i)); + ldioRepositorySink.accept(models.get(i)); } catch (Exception e) { - assertThat(e).isInstanceOf(MaterialisationFailedException.class); + assertThat(e).isInstanceOf(SinkFailedException.class); assertThat(i + 1) .as("Exception should only be thrown when batch size has been reached") .isEqualTo(BATCH_SIZE); } } - verify(materialiser).processAsync(anyList()); + verify(repositorySink).process(anyList()); } } @@ -82,17 +80,15 @@ class BatchSizeFive { @BeforeEach void setUp() { - ldioRepositoryMaterialiser = new LdioRepositoryMaterialiser(materialiser, BATCH_SIZE, BATCH_TIMEOUT); - ldioRepositoryMaterialiser.start(); + ldioRepositorySink = new LdioRepositorySink(repositorySink, BATCH_SIZE, BATCH_TIMEOUT); + ldioRepositorySink.start(); } @Test void when_BatchSizeReachedTwice_then_ProcessListTwice() { - when(materialiser.processAsync(anyList())).thenReturn(new CompletableFuture<>()); - - readTenModelsFromFile().forEach(ldioRepositoryMaterialiser::accept); + readTenModelsFromFile().forEach(ldioRepositorySink); - verify(materialiser, times(2)).processAsync(anyList()); + verify(repositorySink, times(2)).process(anyList()); } } @@ -102,15 +98,15 @@ class BatchSizeFifteen { @BeforeEach void setUp() { - ldioRepositoryMaterialiser = new LdioRepositoryMaterialiser(materialiser, BATCH_SIZE, BATCH_TIMEOUT); - ldioRepositoryMaterialiser.start(); + ldioRepositorySink = new LdioRepositorySink(repositorySink, BATCH_SIZE, BATCH_TIMEOUT); + ldioRepositorySink.start(); } @Test void when_BatchSizeIsNotReached_then_CommitAfterBatchTimeout() { - readTenModelsFromFile().forEach(ldioRepositoryMaterialiser::accept); + readTenModelsFromFile().forEach(ldioRepositorySink); - verify(materialiser, timeout(BATCH_TIMEOUT)).processAsync(anyList()); + verify(repositorySink, timeout(BATCH_TIMEOUT)).process(anyList()); } } diff --git a/ldi-orchestrator/ldio-connectors/ldio-repository-materialiser/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/PipelineEventsListenerTest.java b/ldi-orchestrator/ldio-connectors/ldio-repository-sink/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/PipelineEventsListenerTest.java similarity index 74% rename from ldi-orchestrator/ldio-connectors/ldio-repository-materialiser/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/PipelineEventsListenerTest.java rename to ldi-orchestrator/ldio-connectors/ldio-repository-sink/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/PipelineEventsListenerTest.java index 4992abf42..2ab582db8 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-repository-materialiser/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/PipelineEventsListenerTest.java +++ b/ldi-orchestrator/ldio-connectors/ldio-repository-sink/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/PipelineEventsListenerTest.java @@ -1,12 +1,12 @@ package be.vlaanderen.informatievlaanderen.ldes.ldio; -import be.vlaanderen.informatievlaanderen.ldes.ldi.Materialiser; +import be.vlaanderen.informatievlaanderen.ldes.ldi.RepositorySink; import be.vlaanderen.informatievlaanderen.ldes.ldio.config.LdioRepositoryPipelineEventsListenerConfig; -import be.vlaanderen.informatievlaanderen.ldes.ldio.events.PipelineDeletedEvent; -import be.vlaanderen.informatievlaanderen.ldes.ldio.events.PipelineStatusEvent; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioPipelineEventsListener; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.PipelineStatus; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.StatusChangeSource; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.events.PipelineDeletedEvent; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status.LdioPipelineEventsListener; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status.PipelineStatus; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status.StatusChangeSource; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.status.events.PipelineStatusEvent; import org.apache.jena.rdf.model.ModelFactory; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -24,7 +24,6 @@ import org.springframework.context.ApplicationEventPublisher; import java.util.Arrays; -import java.util.concurrent.CompletableFuture; import java.util.stream.Stream; import static org.mockito.ArgumentMatchers.anyList; @@ -34,19 +33,19 @@ @ExtendWith(value = {MockitoExtension.class}) class PipelineEventsListenerTest { @SpyBean - private LdioPipelineEventsListener pipelineEventsListener; + private LdioPipelineEventsListener pipelineEventsListener; @Autowired private ApplicationEventPublisher eventPublisher; private final String pipelineName = "pipeline-name"; @Mock - private Materialiser materialiser; - private LdioRepositoryMaterialiser ldioRepositoryMaterialiser; + private RepositorySink repositorySink; + private LdioRepositorySink ldioRepositorySink; @BeforeEach void setUp() { - ldioRepositoryMaterialiser = new LdioRepositoryMaterialiser(materialiser, 10, 60000); - ldioRepositoryMaterialiser.start(); - pipelineEventsListener.registerComponent(pipelineName, ldioRepositoryMaterialiser); + ldioRepositorySink = new LdioRepositorySink(repositorySink, 10, 60000); + ldioRepositorySink.start(); + pipelineEventsListener.registerComponent(pipelineName, ldioRepositorySink); } @Test @@ -54,7 +53,7 @@ void when_PipelineDeletedEventIsPublished_then_ShutdownMaterialiser() { eventPublisher.publishEvent(new PipelineDeletedEvent(pipelineName)); verify(pipelineEventsListener).handlePipelineDeletedEvent(new PipelineDeletedEvent(pipelineName)); - verify(materialiser).shutdown(); + verify(repositorySink).shutdown(); } @Test @@ -64,22 +63,21 @@ void given_EmptyListOfMembersToCommit_when_PublishPipelineHaltedEvent_then_Shutd eventPublisher.publishEvent(event); verify(pipelineEventsListener).handlePipelineHaltedEvent(event); - verify(materialiser).shutdown(); - verifyNoMoreInteractions(materialiser); + verify(repositorySink).shutdown(); + verifyNoMoreInteractions(repositorySink); } @Test void given_NonEmptyListOfMembersToCommit_when_PublishPipelineHaltedEvent_then_CommitMembers_and_ShutdownMaterialiser() { - when(materialiser.processAsync(anyList())).thenReturn(new CompletableFuture<>()); - ldioRepositoryMaterialiser.accept(ModelFactory.createDefaultModel()); + ldioRepositorySink.accept(ModelFactory.createDefaultModel()); final PipelineStatusEvent event = new PipelineStatusEvent(pipelineName, PipelineStatus.HALTED, StatusChangeSource.MANUAL); eventPublisher.publishEvent(event); verify(pipelineEventsListener).handlePipelineHaltedEvent(event); - verify(materialiser).processAsync(anyList()); - verify(materialiser).shutdown(); - verifyNoMoreInteractions(materialiser); + verify(repositorySink).process(anyList()); + verify(repositorySink).shutdown(); + verifyNoMoreInteractions(repositorySink); } @Test @@ -89,7 +87,7 @@ void given_OtherPipeline_when_PublishPipelineHaltedEvent_then_DoNothingWithMater eventPublisher.publishEvent(event); verify(pipelineEventsListener).handlePipelineHaltedEvent(event); - verifyNoInteractions(materialiser); + verifyNoInteractions(repositorySink); } @Test @@ -108,9 +106,9 @@ void when_PublishNonRunningOrHaltedEvents_then_HandleNothing(PipelineStatus pipe eventPublisher.publishEvent(event); - verify(pipelineEventsListener).registerComponent(pipelineName, ldioRepositoryMaterialiser); + verify(pipelineEventsListener).registerComponent(pipelineName, ldioRepositorySink); verifyNoMoreInteractions(pipelineEventsListener); - verifyNoInteractions(materialiser); + verifyNoInteractions(repositorySink); } static class PipelineStatusArgumentsProvider implements ArgumentsProvider { diff --git a/ldi-orchestrator/ldio-connectors/ldio-repository-materialiser/src/test/resources/10_people_data.nq b/ldi-orchestrator/ldio-connectors/ldio-repository-sink/src/test/resources/10_people_data.nq similarity index 100% rename from ldi-orchestrator/ldio-connectors/ldio-repository-materialiser/src/test/resources/10_people_data.nq rename to ldi-orchestrator/ldio-connectors/ldio-repository-sink/src/test/resources/10_people_data.nq diff --git a/ldi-orchestrator/ldio-connectors/ldio-request-executor/pom.xml b/ldi-orchestrator/ldio-connectors/ldio-request-executor/pom.xml index 47a26960a..1f047147c 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-request-executor/pom.xml +++ b/ldi-orchestrator/ldio-connectors/ldio-request-executor/pom.xml @@ -6,7 +6,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldio ldio-connectors - 2.7.0-SNAPSHOT + 2.9.0 ldio-request-executor diff --git a/ldi-orchestrator/ldio-connectors/ldio-request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/requestexecutor/LdioRequestExecutorSupplier.java b/ldi-orchestrator/ldio-connectors/ldio-request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/requestexecutor/LdioRequestExecutorSupplier.java index 01ed643b1..e21da8520 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/requestexecutor/LdioRequestExecutorSupplier.java +++ b/ldi-orchestrator/ldio-connectors/ldio-request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/requestexecutor/LdioRequestExecutorSupplier.java @@ -6,7 +6,7 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.services.RequestExecutorDecorator; import be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.services.RequestExecutorFactory; import be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.valueobjects.AuthStrategy; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; import io.github.resilience4j.ratelimiter.RateLimiter; import io.github.resilience4j.retry.Retry; import org.apache.http.Header; diff --git a/ldi-orchestrator/ldio-connectors/ldio-request-executor/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/requestexecutor/LdioRequestExecutorSupplierTest.java b/ldi-orchestrator/ldio-connectors/ldio-request-executor/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/requestexecutor/LdioRequestExecutorSupplierTest.java index 0599099c8..d617b8684 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-request-executor/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/requestexecutor/LdioRequestExecutorSupplierTest.java +++ b/ldi-orchestrator/ldio-connectors/ldio-request-executor/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/requestexecutor/LdioRequestExecutorSupplierTest.java @@ -4,7 +4,7 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.services.RequestExecutorDecorator; import be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.services.RequestExecutorFactory; import be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.valueobjects.AuthStrategy; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; import io.github.resilience4j.ratelimiter.RateLimiter; import io.github.resilience4j.retry.Retry; import org.apache.http.Header; diff --git a/ldi-orchestrator/ldio-connectors/ldio-rml-adapter/pom.xml b/ldi-orchestrator/ldio-connectors/ldio-rml-adapter/pom.xml index 6c593306b..b57e37389 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-rml-adapter/pom.xml +++ b/ldi-orchestrator/ldio-connectors/ldio-rml-adapter/pom.xml @@ -5,7 +5,7 @@ ldio-connectors be.vlaanderen.informatievlaanderen.ldes.ldio - 2.7.0-SNAPSHOT + 2.9.0 4.0.0 diff --git a/ldi-orchestrator/ldio-connectors/ldio-rml-adapter/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioRmlAdapterAutoConfig.java b/ldi-orchestrator/ldio-connectors/ldio-rml-adapter/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioRmlAdapterAutoConfig.java index c7e674cde..820288da4 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-rml-adapter/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioRmlAdapterAutoConfig.java +++ b/ldi-orchestrator/ldio-connectors/ldio-rml-adapter/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioRmlAdapterAutoConfig.java @@ -2,8 +2,8 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.RmlAdapter; import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiAdapter; -import be.vlaanderen.informatievlaanderen.ldes.ldio.configurator.LdioAdapterConfigurator; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioAdapterConfigurator; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/ldi-orchestrator/ldio-connectors/ldio-sparql-construct/pom.xml b/ldi-orchestrator/ldio-connectors/ldio-sparql-construct/pom.xml index a64129e36..48569bd9b 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-sparql-construct/pom.xml +++ b/ldi-orchestrator/ldio-connectors/ldio-sparql-construct/pom.xml @@ -3,7 +3,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldio ldio-connectors - 2.7.0-SNAPSHOT + 2.9.0 4.0.0 diff --git a/ldi-orchestrator/ldio-connectors/ldio-sparql-construct/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioSparqlConstruct.java b/ldi-orchestrator/ldio-connectors/ldio-sparql-construct/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioSparqlConstruct.java index cbd2c3367..711fd463d 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-sparql-construct/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioSparqlConstruct.java +++ b/ldi-orchestrator/ldio-connectors/ldio-sparql-construct/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioSparqlConstruct.java @@ -1,7 +1,7 @@ package be.vlaanderen.informatievlaanderen.ldes.ldio; import be.vlaanderen.informatievlaanderen.ldes.ldi.SparqlConstructTransformer; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioTransformer; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioTransformer; import org.apache.jena.query.Query; import org.apache.jena.rdf.model.Model; diff --git a/ldi-orchestrator/ldio-connectors/ldio-sparql-construct/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioSparqlConstructAutoConfig.java b/ldi-orchestrator/ldio-connectors/ldio-sparql-construct/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioSparqlConstructAutoConfig.java index 576e378b7..7d5c5b9ca 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-sparql-construct/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioSparqlConstructAutoConfig.java +++ b/ldi-orchestrator/ldio-connectors/ldio-sparql-construct/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioSparqlConstructAutoConfig.java @@ -1,9 +1,9 @@ package be.vlaanderen.informatievlaanderen.ldes.ldio.config; import be.vlaanderen.informatievlaanderen.ldes.ldio.LdioSparqlConstruct; -import be.vlaanderen.informatievlaanderen.ldes.ldio.configurator.LdioTransformerConfigurator; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioTransformer; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioTransformer; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioTransformerConfigurator; import org.apache.jena.query.Query; import org.apache.jena.query.QueryFactory; import org.springframework.context.annotation.Bean; diff --git a/ldi-orchestrator/ldio-connectors/ldio-version-materialiser/pom.xml b/ldi-orchestrator/ldio-connectors/ldio-version-materialiser/pom.xml index 2c1fa82cc..8d473ec04 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-version-materialiser/pom.xml +++ b/ldi-orchestrator/ldio-connectors/ldio-version-materialiser/pom.xml @@ -3,7 +3,7 @@ ldio-connectors be.vlaanderen.informatievlaanderen.ldes.ldio - 2.7.0-SNAPSHOT + 2.9.0 4.0.0 diff --git a/ldi-orchestrator/ldio-connectors/ldio-version-materialiser/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioVersionMaterialiser.java b/ldi-orchestrator/ldio-connectors/ldio-version-materialiser/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioVersionMaterialiser.java index 83b7ecd33..f18c656d0 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-version-materialiser/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioVersionMaterialiser.java +++ b/ldi-orchestrator/ldio-connectors/ldio-version-materialiser/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioVersionMaterialiser.java @@ -1,7 +1,7 @@ package be.vlaanderen.informatievlaanderen.ldes.ldio; import be.vlaanderen.informatievlaanderen.ldes.ldi.VersionMaterialiser; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioTransformer; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioTransformer; import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.Property; diff --git a/ldi-orchestrator/ldio-connectors/ldio-version-materialiser/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioVersionMaterialiserAutoConfig.java b/ldi-orchestrator/ldio-connectors/ldio-version-materialiser/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioVersionMaterialiserAutoConfig.java index 9d858dfc3..d4d975b39 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-version-materialiser/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioVersionMaterialiserAutoConfig.java +++ b/ldi-orchestrator/ldio-connectors/ldio-version-materialiser/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioVersionMaterialiserAutoConfig.java @@ -1,9 +1,9 @@ package be.vlaanderen.informatievlaanderen.ldes.ldio.config; import be.vlaanderen.informatievlaanderen.ldes.ldio.LdioVersionMaterialiser; -import be.vlaanderen.informatievlaanderen.ldes.ldio.configurator.LdioTransformerConfigurator; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioTransformer; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioTransformer; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioTransformerConfigurator; import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.ModelFactory; import org.apache.jena.rdf.model.Property; diff --git a/ldi-orchestrator/ldio-connectors/ldio-version-object-creator/pom.xml b/ldi-orchestrator/ldio-connectors/ldio-version-object-creator/pom.xml index beb12f2a7..955f2fbd9 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-version-object-creator/pom.xml +++ b/ldi-orchestrator/ldio-connectors/ldio-version-object-creator/pom.xml @@ -3,7 +3,7 @@ ldio-connectors be.vlaanderen.informatievlaanderen.ldes.ldio - 2.7.0-SNAPSHOT + 2.9.0 4.0.0 diff --git a/ldi-orchestrator/ldio-connectors/ldio-version-object-creator/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioVersionObjectCreator.java b/ldi-orchestrator/ldio-connectors/ldio-version-object-creator/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioVersionObjectCreator.java index 72e7de1b0..ec5956cc4 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-version-object-creator/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioVersionObjectCreator.java +++ b/ldi-orchestrator/ldio-connectors/ldio-version-object-creator/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioVersionObjectCreator.java @@ -2,18 +2,20 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.VersionObjectCreator; import be.vlaanderen.informatievlaanderen.ldes.ldi.extractor.PropertyExtractor; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioTransformer; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioTransformer; import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.Property; import org.apache.jena.rdf.model.Resource; +import java.util.List; + public class LdioVersionObjectCreator extends LdioTransformer { public static final String NAME = "Ldio:VersionObjectCreator"; private final VersionObjectCreator versionObjectCreator; - public LdioVersionObjectCreator(PropertyExtractor dateObservedPropertyExtractor, Resource memberType, + public LdioVersionObjectCreator(PropertyExtractor dateObservedPropertyExtractor, List memberTypes, String delimiter, Property generatedAtProperty, Property versionOfProperty) { - this.versionObjectCreator = new VersionObjectCreator(dateObservedPropertyExtractor, memberType, delimiter, + this.versionObjectCreator = new VersionObjectCreator(dateObservedPropertyExtractor, memberTypes, delimiter, generatedAtProperty, versionOfProperty); } diff --git a/ldi-orchestrator/ldio-connectors/ldio-version-object-creator/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioVersionObjectCreatorAutoConfig.java b/ldi-orchestrator/ldio-connectors/ldio-version-object-creator/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioVersionObjectCreatorAutoConfig.java index 1b6785784..a08be8385 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-version-object-creator/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioVersionObjectCreatorAutoConfig.java +++ b/ldi-orchestrator/ldio-connectors/ldio-version-object-creator/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioVersionObjectCreatorAutoConfig.java @@ -4,9 +4,10 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.extractor.PropertyExtractor; import be.vlaanderen.informatievlaanderen.ldes.ldi.extractor.PropertyPathExtractor; import be.vlaanderen.informatievlaanderen.ldes.ldio.LdioVersionObjectCreator; -import be.vlaanderen.informatievlaanderen.ldes.ldio.configurator.LdioTransformerConfigurator; -import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioTransformer; -import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioTransformer; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioTransformerConfigurator; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.exception.ConfigPropertyMissingException; import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.ModelFactory; import org.apache.jena.rdf.model.Property; @@ -14,7 +15,7 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import java.util.Optional; +import java.util.List; import static be.vlaanderen.informatievlaanderen.ldes.ldio.LdioVersionObjectCreator.NAME; @@ -27,6 +28,11 @@ public LdioTransformerConfigurator ldioConfigurator() { public static class LdioVersionObjectCreatorTransformerConfigurator implements LdioTransformerConfigurator { + public static final String DATE_OBSERVED = "date-observed-property"; + public static final String MEMBER_TYPE = "member-type"; + public static final String DELIMITER = "delimiter"; + public static final String GENERATED_AT = "generatedAt-property"; + public static final String VERSION_OF = "versionOf-property"; public static final String DEFAULT_PROV_GENERATED_AT_TIME = "http://www.w3.org/ns/prov#generatedAtTime"; public static final String DEFAULT_VERSION_OF_KEY = "http://purl.org/dc/terms/isVersionOf"; @@ -34,25 +40,31 @@ public static class LdioVersionObjectCreatorTransformerConfigurator implements L public LdioTransformer configure(ComponentProperties properties) { Model initModel = ModelFactory.createDefaultModel(); - PropertyExtractor dateObservedPropertyExtractor = properties.getOptionalProperty("date-observed-property") + PropertyExtractor dateObservedPropertyExtractor = properties.getOptionalProperty(DATE_OBSERVED) .map(PropertyPathExtractor::from) .map(PropertyExtractor.class::cast) .orElseGet(EmptyPropertyExtractor::new); - Resource memberType = Optional.of(properties.getProperty("member-type")) - .map(initModel::createResource).orElse(null); + List memberTypesPropertyList = properties.getPropertyList(MEMBER_TYPE); - String delimiter = properties.getOptionalProperty("delimiter").orElse("/"); + if (memberTypesPropertyList.isEmpty() || memberTypesPropertyList.stream().allMatch(String::isEmpty)) { + throw new ConfigPropertyMissingException(properties.getPipelineName(), properties.getComponentName(), MEMBER_TYPE); + } - Property generatedAtProperty = properties.getOptionalProperty("generatedAt-property") + List memberTypes = memberTypesPropertyList.stream() + .map(initModel::createResource).toList(); + + String delimiter = properties.getOptionalProperty(DELIMITER).orElse("/"); + + Property generatedAtProperty = properties.getOptionalProperty(GENERATED_AT) .map(initModel::createProperty) .orElseGet(() -> initModel.createProperty(DEFAULT_PROV_GENERATED_AT_TIME)); - Property versionOfProperty = properties.getOptionalProperty("versionOf-property") + Property versionOfProperty = properties.getOptionalProperty(VERSION_OF) .map(initModel::createProperty) .orElseGet(() -> initModel.createProperty(DEFAULT_VERSION_OF_KEY)); - return new LdioVersionObjectCreator(dateObservedPropertyExtractor, memberType, delimiter, + return new LdioVersionObjectCreator(dateObservedPropertyExtractor, memberTypes, delimiter, generatedAtProperty, versionOfProperty); } diff --git a/ldi-orchestrator/ldio-connectors/ldio-version-object-creator/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioVersionObjectCreatorAutoConfigTest.java b/ldi-orchestrator/ldio-connectors/ldio-version-object-creator/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioVersionObjectCreatorAutoConfigTest.java new file mode 100644 index 000000000..e2debfce1 --- /dev/null +++ b/ldi-orchestrator/ldio-connectors/ldio-version-object-creator/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioVersionObjectCreatorAutoConfigTest.java @@ -0,0 +1,41 @@ +package be.vlaanderen.informatievlaanderen.ldes.ldio.config; + +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.valueobjects.ComponentProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.creation.LdioConfigurator; +import be.vlaanderen.informatievlaanderen.ldes.ldio.pipeline.exception.ConfigPropertyMissingException; +import org.junit.jupiter.api.extension.ExtensionContext; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.ArgumentsProvider; +import org.junit.jupiter.params.provider.ArgumentsSource; + +import java.util.HashMap; +import java.util.Map; +import java.util.stream.Stream; + +import static be.vlaanderen.informatievlaanderen.ldes.ldio.config.LdioVersionObjectCreatorAutoConfig.LdioVersionObjectCreatorTransformerConfigurator.MEMBER_TYPE; +import static org.junit.jupiter.api.Assertions.assertThrows; + +class LdioVersionObjectCreatorAutoConfigTest { + private final LdioConfigurator configurator = new LdioVersionObjectCreatorAutoConfig().ldioConfigurator(); + + @ParameterizedTest + @ArgumentsSource(configProvider.class) + void when_NoMemberTypes_Then_exceptionIsThrown(Map config) { + ComponentProperties componentProperties = new ComponentProperties("pipelineName", "cName", config); + + assertThrows(ConfigPropertyMissingException.class, () -> configurator.configure(componentProperties)); + } + + static class configProvider implements ArgumentsProvider { + @Override + public Stream provideArguments(ExtensionContext extensionContext) { + Map empty = new HashMap<>(); + empty.put(MEMBER_TYPE, ""); + return Stream.of( + Arguments.of(new HashMap()), + Arguments.of(empty) + ); + } + } +} \ No newline at end of file diff --git a/ldi-orchestrator/ldio-connectors/pom.xml b/ldi-orchestrator/ldio-connectors/pom.xml index 4ba82346c..4879f6629 100644 --- a/ldi-orchestrator/ldio-connectors/pom.xml +++ b/ldi-orchestrator/ldio-connectors/pom.xml @@ -3,7 +3,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi ldi-orchestrator - 2.7.0-SNAPSHOT + 2.9.0 4.0.0 @@ -38,7 +38,7 @@ ldio-rml-adapter ldio-azure-blob-out ldio-file-out - ldio-repository-materialiser + ldio-repository-sink ldio-change-detection-filter diff --git a/ldi-orchestrator/pom.xml b/ldi-orchestrator/pom.xml index f8db05e4e..c96613b91 100644 --- a/ldi-orchestrator/pom.xml +++ b/ldi-orchestrator/pom.xml @@ -3,7 +3,7 @@ be.vlaanderen.informatievlaanderen.ldes linked-data-interactions - 2.7.0-SNAPSHOT + 2.9.0 4.0.0 @@ -19,6 +19,7 @@ 3.1.3 + 1.1.6 6.0.11 7.13.0 1.9.3 diff --git a/ldio.Dockerfile b/ldio.Dockerfile deleted file mode 100644 index b575f5461..000000000 --- a/ldio.Dockerfile +++ /dev/null @@ -1,53 +0,0 @@ -# syntax=docker/dockerfile:1 - -# -# INSTALL MAVEN DEPENDENCIES -# -FROM maven:3.9.6-amazoncorretto-21 AS builder - -# MAVEN: application -FROM builder AS app-stage -COPY . . -RUN mvn clean install -DskipTests - -# -# RUN THE APPLICATION -# -FROM amazoncorretto:21-alpine-jdk - -RUN adduser -D -u 2000 ldio -USER ldio -WORKDIR /ldio - -COPY --from=app-stage ldi-orchestrator/ldio-application/target/ldio-application.jar ./ - -COPY --from=app-stage ldi-orchestrator/ldio-connectors/ldio-http-in/target/ldio-http-in-jar-with-dependencies.jar ./lib/ -COPY --from=app-stage ldi-orchestrator/ldio-connectors/ldio-http-in-poller/target/ldio-http-in-poller-jar-with-dependencies.jar ./lib/ -COPY --from=app-stage ldi-orchestrator/ldio-connectors/ldio-ldes-client/target/ldio-ldes-client-jar-with-dependencies.jar ./lib/ -COPY --from=app-stage ldi-orchestrator/ldio-connectors/ldio-ldes-client-connector/target/ldio-ldes-client-connector-jar-with-dependencies.jar ./lib/ -COPY --from=app-stage ldi-orchestrator/ldio-connectors/ldio-kafka/target/ldio-kafka-jar-with-dependencies.jar ./lib/ -COPY --from=app-stage ldi-orchestrator/ldio-connectors/ldio-amqp/target/ldio-amqp-jar-with-dependencies.jar ./lib/ - -COPY --from=app-stage ldi-orchestrator/ldio-connectors/ldio-rdf-adapter/target/ldio-rdf-adapter-jar-with-dependencies.jar ./lib/ -COPY --from=app-stage ldi-orchestrator/ldio-connectors/ldio-ngsiv2-to-ld-adapter/target/ldio-ngsiv2-to-ld-adapter-jar-with-dependencies.jar ./lib/ -COPY --from=app-stage ldi-orchestrator/ldio-connectors/ldio-rml-adapter/target/ldio-rml-adapter-jar-with-dependencies.jar ./lib/ -COPY --from=app-stage ldi-orchestrator/ldio-connectors/ldio-json-to-ld-adapter/target/ldio-json-to-ld-adapter-jar-with-dependencies.jar ./lib/ - -COPY --from=app-stage ldi-orchestrator/ldio-connectors/ldio-sparql-construct/target/ldio-sparql-construct-jar-with-dependencies.jar ./lib/ -COPY --from=app-stage ldi-orchestrator/ldio-connectors/ldio-version-materialiser/target/ldio-version-materialiser-jar-with-dependencies.jar ./lib/ -COPY --from=app-stage ldi-orchestrator/ldio-connectors/ldio-version-object-creator/target/ldio-version-object-creator-jar-with-dependencies.jar ./lib/ -COPY --from=app-stage ldi-orchestrator/ldio-connectors/ldio-version-object-creator/target/ldio-version-object-creator-jar-with-dependencies.jar ./lib/ -COPY --from=app-stage ldi-orchestrator/ldio-connectors/ldio-geojson-to-wkt/target/ldio-geojson-to-wkt-jar-with-dependencies.jar ./lib/ -COPY --from=app-stage ldi-orchestrator/ldio-connectors/ldio-http-enricher/target/ldio-http-enricher-jar-with-dependencies.jar ./lib/ -COPY --from=app-stage ldi-orchestrator/ldio-connectors/ldio-change-detection-filter/target/ldio-change-detection-filter-jar-with-dependencies.jar ./lib/ - -COPY --from=app-stage ldi-orchestrator/ldio-connectors/ldio-console-out/target/ldio-console-out-jar-with-dependencies.jar ./lib/ -COPY --from=app-stage ldi-orchestrator/ldio-connectors/ldio-http-out/target/ldio-http-out-jar-with-dependencies.jar ./lib/ -COPY --from=app-stage ldi-orchestrator/ldio-connectors/ldio-noop-out/target/ldio-noop-out-jar-with-dependencies.jar ./lib/ -COPY --from=app-stage ldi-orchestrator/ldio-connectors/ldio-repository-materialiser/target/ldio-repository-materialiser-jar-with-dependencies.jar ./lib/ - - -RUN mkdir "state" -RUN chmod -R 777 ./state - -CMD ["java", "-cp", "ldio-application.jar", "-Dloader.path=lib/", "org.springframework.boot.loader.launch.PropertiesLauncher"] diff --git a/pom.xml b/pom.xml index a98faaec1..2649f2381 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ be.vlaanderen.informatievlaanderen.ldes linked-data-interactions pom - 2.7.0-SNAPSHOT + 2.9.0 ldi-api