From 949898bcf1dd429dcfce58306fbd5c27b4af6532 Mon Sep 17 00:00:00 2001 From: Clemens Zagler Date: Thu, 8 Aug 2024 15:00:44 +0200 Subject: [PATCH] delete emobility echarging data collector. Fully migrated to new infrastructure (opendatahub-collectors) --- .../ci-emobility-echarging-alperia.yml | 178 ----------- .../ci-emobility-echarging-driwe.yml | 178 ----------- .../ci-emobility-echarging-nevicam.yml | 182 ----------- .../ci-emobility-echarging-route220.yml | 179 ----------- .../emobility-echarging/.env.example | 40 --- data-collectors/emobility-echarging/README.md | 83 ----- .../emobility-echarging/calls.http | 35 --- .../data-quality-check/.gitignore | 2 - .../data-quality-check/README.md | 14 - .../data-quality-check-no-pandas.py | 291 ------------------ .../data-quality-check/data-quality-check.py | 280 ----------------- .../data-quality-check/requirements.txt | 2 - .../emobility-echarging/docker-compose.yml | 28 -- .../infrastructure/ansible/ansible.cfg | 4 - .../infrastructure/ansible/deploy.yml | 19 -- .../infrastructure/ansible/hosts | 5 - .../infrastructure/ansible/requirements.yml | 2 - .../infrastructure/ansible/roles/.gitignore | 2 - .../infrastructure/docker-compose.build.yml | 8 - .../infrastructure/docker-compose.run.yml | 10 - .../infrastructure/docker/.gitignore | 1 - .../infrastructure/docker/Dockerfile | 3 - data-collectors/emobility-echarging/pom.xml | 153 --------- .../it/bz/idm/bdp/service/ChargePusher.java | 201 ------------ .../idm/bdp/service/DataRetrieverAPIV2.java | 99 ------ .../it/bz/idm/bdp/service/PushScheduler.java | 104 ------- .../bz/idm/bdp/service/dto/ChargerDtoV2.java | 172 ----------- .../bdp/service/dto/ChargingPointsDtoV2.java | 41 --- .../bdp/service/dto/ChargingPositionDto.java | 52 ---- .../bz/idm/bdp/service/dto/ChildPlugDto.java | 35 --- .../bz/idm/bdp/service/dto/OutletDtoV2.java | 63 ---- .../META-INF/spring/application.properties | 7 - .../META-INF/spring/applicationContext.xml | 29 -- .../src/main/resources/logback.xml | 32 -- .../webapp/WEB-INF/spring/webmvc-config.xml | 19 -- .../src/main/webapp/WEB-INF/web.xml | 75 ----- .../test/java/it/bz/idm/bdp/EndpointIT.java | 40 --- .../test/java/it/bz/idm/bdp/PusherTestIT.java | 114 ------- .../META-INF/spring/application.properties | 9 - .../META-INF/spring/applicationContext.xml | 23 -- .../META-INF/spring/types.properties | 1 - .../src/test/resources/log4j.properties | 10 - 42 files changed, 2825 deletions(-) delete mode 100644 .github/workflows/ci-emobility-echarging-alperia.yml delete mode 100644 .github/workflows/ci-emobility-echarging-driwe.yml delete mode 100644 .github/workflows/ci-emobility-echarging-nevicam.yml delete mode 100644 .github/workflows/ci-emobility-echarging-route220.yml delete mode 100644 data-collectors/emobility-echarging/.env.example delete mode 100644 data-collectors/emobility-echarging/README.md delete mode 100644 data-collectors/emobility-echarging/calls.http delete mode 100644 data-collectors/emobility-echarging/data-quality-check/.gitignore delete mode 100644 data-collectors/emobility-echarging/data-quality-check/README.md delete mode 100644 data-collectors/emobility-echarging/data-quality-check/data-quality-check-no-pandas.py delete mode 100644 data-collectors/emobility-echarging/data-quality-check/data-quality-check.py delete mode 100644 data-collectors/emobility-echarging/data-quality-check/requirements.txt delete mode 100644 data-collectors/emobility-echarging/docker-compose.yml delete mode 100644 data-collectors/emobility-echarging/infrastructure/ansible/ansible.cfg delete mode 100644 data-collectors/emobility-echarging/infrastructure/ansible/deploy.yml delete mode 100644 data-collectors/emobility-echarging/infrastructure/ansible/hosts delete mode 100644 data-collectors/emobility-echarging/infrastructure/ansible/requirements.yml delete mode 100644 data-collectors/emobility-echarging/infrastructure/ansible/roles/.gitignore delete mode 100644 data-collectors/emobility-echarging/infrastructure/docker-compose.build.yml delete mode 100644 data-collectors/emobility-echarging/infrastructure/docker-compose.run.yml delete mode 100644 data-collectors/emobility-echarging/infrastructure/docker/.gitignore delete mode 100644 data-collectors/emobility-echarging/infrastructure/docker/Dockerfile delete mode 100644 data-collectors/emobility-echarging/pom.xml delete mode 100644 data-collectors/emobility-echarging/src/main/java/it/bz/idm/bdp/service/ChargePusher.java delete mode 100644 data-collectors/emobility-echarging/src/main/java/it/bz/idm/bdp/service/DataRetrieverAPIV2.java delete mode 100644 data-collectors/emobility-echarging/src/main/java/it/bz/idm/bdp/service/PushScheduler.java delete mode 100644 data-collectors/emobility-echarging/src/main/java/it/bz/idm/bdp/service/dto/ChargerDtoV2.java delete mode 100644 data-collectors/emobility-echarging/src/main/java/it/bz/idm/bdp/service/dto/ChargingPointsDtoV2.java delete mode 100644 data-collectors/emobility-echarging/src/main/java/it/bz/idm/bdp/service/dto/ChargingPositionDto.java delete mode 100644 data-collectors/emobility-echarging/src/main/java/it/bz/idm/bdp/service/dto/ChildPlugDto.java delete mode 100644 data-collectors/emobility-echarging/src/main/java/it/bz/idm/bdp/service/dto/OutletDtoV2.java delete mode 100644 data-collectors/emobility-echarging/src/main/resources/META-INF/spring/application.properties delete mode 100644 data-collectors/emobility-echarging/src/main/resources/META-INF/spring/applicationContext.xml delete mode 100644 data-collectors/emobility-echarging/src/main/resources/logback.xml delete mode 100644 data-collectors/emobility-echarging/src/main/webapp/WEB-INF/spring/webmvc-config.xml delete mode 100644 data-collectors/emobility-echarging/src/main/webapp/WEB-INF/web.xml delete mode 100644 data-collectors/emobility-echarging/src/test/java/it/bz/idm/bdp/EndpointIT.java delete mode 100644 data-collectors/emobility-echarging/src/test/java/it/bz/idm/bdp/PusherTestIT.java delete mode 100644 data-collectors/emobility-echarging/src/test/resources/META-INF/spring/application.properties delete mode 100644 data-collectors/emobility-echarging/src/test/resources/META-INF/spring/applicationContext.xml delete mode 100644 data-collectors/emobility-echarging/src/test/resources/META-INF/spring/types.properties delete mode 100644 data-collectors/emobility-echarging/src/test/resources/log4j.properties diff --git a/.github/workflows/ci-emobility-echarging-alperia.yml b/.github/workflows/ci-emobility-echarging-alperia.yml deleted file mode 100644 index e2bcd39f6..000000000 --- a/.github/workflows/ci-emobility-echarging-alperia.yml +++ /dev/null @@ -1,178 +0,0 @@ -name: CI/CD emobility-echarging-alperia - -on: - push: - paths: - - "data-collectors/emobility-echarging/**" - - ".github/workflows/ci-emobility-echarging-alperia.yml" - -env: - WORKING_DIRECTORY: data-collectors/emobility-echarging - PROJECT_NAME: odh-mobility-dc-emobility-echarging-alperia - DOCKER_IMAGE: ghcr.io/${{ github.repository }}/odh-mobility-dc-emobility-echarging-alperia - DOCKER_TAG: ${{ github.sha }} - JAVA_VERSION: '8' - -jobs: - - # Test - test: - runs-on: ubuntu-20.04 - steps: - - name: Checkout source code - uses: noi-techpark/github-actions/checkout@v2 - - name: REUSE Compliance Check - uses: fsfe/reuse-action@v1 - - name: Test code - uses: noi-techpark/github-actions/maven-test@v2 - with: - java-version: ${{ env.JAVA_VERSION }} - working-directory: ${{ env.WORKING_DIRECTORY }} - test-command: 'mvn -B -U clean test' - - # Migrated to opendatahub-collectors - # # Deploy Test - # deploy-test-emobility-echarging-alperia: - # runs-on: ubuntu-20.04 - # if: github.ref == 'refs/heads/main' - # needs: test - # concurrency: deploy-test-emobility-echarging-alperia - # env: - # KEYCLOAK_URL: https://auth.opendatahub.testingmachine.eu - # steps: - # - name: Checkout source code - # uses: noi-techpark/github-actions/checkout@v2 - # - name: Create .env file - # uses: noi-techpark/github-actions/env-file@v2 - # with: - # working-directory: ${{ env.WORKING_DIRECTORY }} - # env: - # # General deployment options - # X_COMPOSE_PROJECT_NAME: ${{ env.PROJECT_NAME }} - # X_DOCKER_IMAGE: ${{ env.DOCKER_IMAGE }} - # X_DOCKER_TAG: ${{ env.DOCKER_TAG }} - # X_JAVA_OPTIONS: -Xms128m -Xmx512m - - # # Open Data Hub Writer Connectivity - # X_authorizationUri: ${{ env.KEYCLOAK_URL }}/auth - # X_tokenUri: ${{ env.KEYCLOAK_URL }}/auth/realms/noi/protocol/openid-connect/token - # X_clientId: odh-mobility-datacollector - # X_clientName: odh-mobility-datacollector - # X_clientSecret: ${{ secrets.DATACOLLECTORS_CLIENT_SECRET_TEST }} - # X_scope: openid - # X_BASE_URI: https://mobility.share.opendatahub.testingmachine.eu/json - - # # Logging - # X_LOG_LEVEL: info - # X_LOG_STYLE: json - # X_provenance_name: ${{ env.PROJECT_NAME }} - # X_provenance_version: ${{ github.sha }} - - # # Data Origin Configuration - # X_endpoint_host: api.alperia-emobility.eu - # X_endpoint_port: 80 - # X_endpoint_ssl: 'no' - # X_endpoint_path: /e-mobility/api/v3/chargingunits?includePartners=false - # X_app_callerId: NOI-Techpark - # X_app_dataOrigin: ALPERIA - # X_app_period: 600 - - # X_SCHEDULER_CRON: 0 */5 * * * * - # X_SCHEDULER_POOL_SIZE: 2 - - # - name: Build project - # uses: noi-techpark/github-actions/maven-build@v2 - # with: - # working-directory: ${{ env.WORKING_DIRECTORY }} - # java-version: ${{ env.JAVA_VERSION }} - # build-command: 'mvn -B -DskipTests -DfinalName=ROOT clean package' - - # - name: Build and push images - # uses: noi-techpark/github-actions/docker-build-and-push@v2 - # with: - # working-directory: ${{ env.WORKING_DIRECTORY }}/infrastructure - # docker-username: ${{ github.actor }} - # docker-password: ${{ secrets.GITHUB_TOKEN }} - - # - name: Deploy application - # uses: noi-techpark/github-actions/docker-deploy@v2 - # with: - # working-directory: ${{ env.WORKING_DIRECTORY }}/infrastructure/ansible - # hosts: 'test' - # ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} - # docker-username: 'noi-techpark-bot' - # docker-password: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} - # project-name: ${{ env.PROJECT_NAME }} - - # # Deploy Production - # deploy-prod-emobility-echarging-alperia: - # runs-on: ubuntu-20.04 - # if: github.ref == 'refs/heads/prod' - # needs: test - # concurrency: deploy-prod-emobility-echarging-alperia - # env: - # KEYCLOAK_URL: https://auth.opendatahub.com - # steps: - # - name: Checkout source code - # uses: noi-techpark/github-actions/checkout@v2 - # - name: Create .env file - # uses: noi-techpark/github-actions/env-file@v2 - # with: - # working-directory: ${{ env.WORKING_DIRECTORY }} - # env: - # # General deployment options - # X_COMPOSE_PROJECT_NAME: ${{ env.PROJECT_NAME }} - # X_DOCKER_IMAGE: ${{ env.DOCKER_IMAGE }} - # X_DOCKER_TAG: ${{ env.DOCKER_TAG }} - # X_JAVA_OPTIONS: -Xms128m -Xmx512m - - # # Open Data Hub Writer Connectivity - # X_authorizationUri: ${{ env.KEYCLOAK_URL }}/auth - # X_tokenUri: ${{ env.KEYCLOAK_URL }}/auth/realms/noi/protocol/openid-connect/token - # X_clientId: odh-mobility-datacollector - # X_clientName: odh-mobility-datacollector - # X_clientSecret: ${{ secrets.DATACOLLECTORS_CLIENT_SECRET_PROD }} - # X_scope: openid - # X_BASE_URI: https://mobility.share.opendatahub.com/json - - # # Logging - # X_LOG_LEVEL: "info" - # X_LOG_STYLE: json - # X_provenance_name: ${{ env.PROJECT_NAME }} - # X_provenance_version: ${{ github.sha }} - - # # Data Origin Configuration - # X_endpoint_host: api.alperia-emobility.eu - # X_endpoint_port: 80 - # X_endpoint_ssl: 'no' - # X_endpoint_path: /e-mobility/api/v3/chargingunits?includePartners=false - # X_app_callerId: NOI-Techpark - # X_app_dataOrigin: ALPERIA - # X_app_period: 600 - - # X_SCHEDULER_CRON: 0 */5 * * * * - # X_SCHEDULER_POOL_SIZE: 2 - - # - name: Build project - # uses: noi-techpark/github-actions/maven-build@v2 - # with: - # working-directory: ${{ env.WORKING_DIRECTORY }} - # java-version: ${{ env.JAVA_VERSION }} - # build-command: 'mvn -B -DskipTests -DfinalName=ROOT clean package' - - # - name: Build and push images - # uses: noi-techpark/github-actions/docker-build-and-push@v2 - # with: - # working-directory: ${{ env.WORKING_DIRECTORY }}/infrastructure - # docker-username: ${{ github.actor }} - # docker-password: ${{ secrets.GITHUB_TOKEN }} - - # - name: Deploy application - # uses: noi-techpark/github-actions/docker-deploy@v2 - # with: - # working-directory: ${{ env.WORKING_DIRECTORY }}/infrastructure/ansible - # hosts: 'prod' - # ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} - # docker-username: 'noi-techpark-bot' - # docker-password: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} - # project-name: ${{ env.PROJECT_NAME }} diff --git a/.github/workflows/ci-emobility-echarging-driwe.yml b/.github/workflows/ci-emobility-echarging-driwe.yml deleted file mode 100644 index ffbb6af38..000000000 --- a/.github/workflows/ci-emobility-echarging-driwe.yml +++ /dev/null @@ -1,178 +0,0 @@ -name: CI/CD emobility-echarging-driwe - -on: - push: - paths: - - "data-collectors/emobility-echarging/**" - - ".github/workflows/ci-emobility-echarging-driwe.yml" - -env: - WORKING_DIRECTORY: data-collectors/emobility-echarging - PROJECT_NAME: odh-mobility-dc-emobility-echarging-driwe - DOCKER_IMAGE: ghcr.io/${{ github.repository }}/odh-mobility-dc-emobility-echarging-driwe - DOCKER_TAG: ${{ github.sha }} - JAVA_VERSION: '8' - -jobs: - - # Test - test: - runs-on: ubuntu-20.04 - steps: - - name: Checkout source code - uses: noi-techpark/github-actions/checkout@v2 - - name: REUSE Compliance Check - uses: fsfe/reuse-action@v1 - - name: Test code - uses: noi-techpark/github-actions/maven-test@v2 - with: - java-version: ${{ env.JAVA_VERSION }} - working-directory: ${{ env.WORKING_DIRECTORY }} - test-command: 'mvn -B -U clean test' - - # Migrated to opendatahub-collectors - # Deploy Test - # deploy-test-emobility-echarging-driwe: - # runs-on: ubuntu-20.04 - # if: github.ref == 'refs/heads/main' - # needs: test - # concurrency: deploy-test-emobility-echarging-driwe - # env: - # KEYCLOAK_URL: https://auth.opendatahub.testingmachine.eu - # steps: - # - name: Checkout source code - # uses: noi-techpark/github-actions/checkout@v2 - # - name: Create .env file - # uses: noi-techpark/github-actions/env-file@v2 - # with: - # working-directory: ${{ env.WORKING_DIRECTORY }} - # env: - # # General deployment options - # X_COMPOSE_PROJECT_NAME: ${{ env.PROJECT_NAME }} - # X_DOCKER_IMAGE: ${{ env.DOCKER_IMAGE }} - # X_DOCKER_TAG: ${{ env.DOCKER_TAG }} - # X_JAVA_OPTIONS: -Xms128m -Xmx512m - - # # Open Data Hub Writer Connectivity - # X_authorizationUri: ${{ env.KEYCLOAK_URL }}/auth - # X_tokenUri: ${{ env.KEYCLOAK_URL }}/auth/realms/noi/protocol/openid-connect/token - # X_clientId: odh-mobility-datacollector - # X_clientName: odh-mobility-datacollector - # X_clientSecret: ${{ secrets.DATACOLLECTORS_CLIENT_SECRET_TEST }} - # X_scope: openid - # X_BASE_URI: https://mobility.share.opendatahub.testingmachine.eu/json - - # # Logging - # X_LOG_LEVEL: "info" - # X_LOG_STYLE: json - # X_provenance_name: ${{ env.PROJECT_NAME }} - # X_provenance_version: ${{ github.sha }} - - # # Data Origin Configuration - # X_endpoint_host: www.driwe.club - # X_endpoint_port: 443 - # X_endpoint_ssl: 'yes' - # X_endpoint_path: /api/stations/metadata?auth-token=${{ secrets.EMOBILITY_ECHARGING_DRIWE_APIKEY }} - # X_app_callerId: NOI-Techpark - # X_app_dataOrigin: DRIWE - # X_app_period: 600 - - # X_SCHEDULER_CRON: 0 */5 * * * * - # X_SCHEDULER_POOL_SIZE: 2 - - # - name: Build project - # uses: noi-techpark/github-actions/maven-build@v2 - # with: - # working-directory: ${{ env.WORKING_DIRECTORY }} - # java-version: ${{ env.JAVA_VERSION }} - # build-command: 'mvn -B -DskipTests -DfinalName=ROOT clean package' - - # - name: Build and push images - # uses: noi-techpark/github-actions/docker-build-and-push@v2 - # with: - # working-directory: ${{ env.WORKING_DIRECTORY }}/infrastructure - # docker-username: ${{ github.actor }} - # docker-password: ${{ secrets.GITHUB_TOKEN }} - - # - name: Deploy application - # uses: noi-techpark/github-actions/docker-deploy@v2 - # with: - # working-directory: ${{ env.WORKING_DIRECTORY }}/infrastructure/ansible - # hosts: 'test' - # ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} - # docker-username: 'noi-techpark-bot' - # docker-password: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} - # project-name: ${{ env.PROJECT_NAME }} - - # # Deploy Production - # deploy-prod-emobility-echarging-driwe: - # runs-on: ubuntu-20.04 - # if: github.ref == 'refs/heads/prod' - # needs: test - # concurrency: deploy-prod-emobility-echarging-driwe - # env: - # KEYCLOAK_URL: https://auth.opendatahub.com - # steps: - # - name: Checkout source code - # uses: noi-techpark/github-actions/checkout@v2 - # - name: Create .env file - # uses: noi-techpark/github-actions/env-file@v2 - # with: - # working-directory: ${{ env.WORKING_DIRECTORY }} - # env: - # # General deployment options - # X_COMPOSE_PROJECT_NAME: ${{ env.PROJECT_NAME }} - # X_DOCKER_IMAGE: ${{ env.DOCKER_IMAGE }} - # X_DOCKER_TAG: ${{ env.DOCKER_TAG }} - # X_JAVA_OPTIONS: -Xms128m -Xmx512m - - # # Open Data Hub Writer Connectivity - # X_authorizationUri: ${{ env.KEYCLOAK_URL }}/auth - # X_tokenUri: ${{ env.KEYCLOAK_URL }}/auth/realms/noi/protocol/openid-connect/token - # X_clientId: odh-mobility-datacollector - # X_clientName: odh-mobility-datacollector - # X_clientSecret: ${{ secrets.DATACOLLECTORS_CLIENT_SECRET_PROD }} - # X_scope: openid - # X_BASE_URI: https://mobility.share.opendatahub.com/json - - # # Logging - # X_LOG_LEVEL: "info" - # X_LOG_STYLE: json - # X_provenance_name: ${{ env.PROJECT_NAME }} - # X_provenance_version: ${{ github.sha }} - - # # Data Origin Configuration - # X_endpoint_host: www.driwe.club - # X_endpoint_port: 443 - # X_endpoint_ssl: 'yes' - # X_endpoint_path: /api/stations/metadata?auth-token=${{ secrets.EMOBILITY_ECHARGING_DRIWE_APIKEY }} - # X_app_callerId: NOI-Techpark - # X_app_dataOrigin: DRIWE - # X_app_period: 600 - - # X_SCHEDULER_CRON: 0 */5 * * * * - # X_SCHEDULER_POOL_SIZE: 2 - - # - name: Build project - # uses: noi-techpark/github-actions/maven-build@v2 - # with: - # working-directory: ${{ env.WORKING_DIRECTORY }} - # java-version: ${{ env.JAVA_VERSION }} - # build-command: 'mvn -B -DskipTests -DfinalName=ROOT clean package' - - # - name: Build and push images - # uses: noi-techpark/github-actions/docker-build-and-push@v2 - # with: - # working-directory: ${{ env.WORKING_DIRECTORY }}/infrastructure - # docker-username: ${{ github.actor }} - # docker-password: ${{ secrets.GITHUB_TOKEN }} - - # - name: Deploy application - # uses: noi-techpark/github-actions/docker-deploy@v2 - # with: - # working-directory: ${{ env.WORKING_DIRECTORY }}/infrastructure/ansible - # hosts: 'prod' - # ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} - # docker-username: 'noi-techpark-bot' - # docker-password: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} - # project-name: ${{ env.PROJECT_NAME }} diff --git a/.github/workflows/ci-emobility-echarging-nevicam.yml b/.github/workflows/ci-emobility-echarging-nevicam.yml deleted file mode 100644 index c21ec242d..000000000 --- a/.github/workflows/ci-emobility-echarging-nevicam.yml +++ /dev/null @@ -1,182 +0,0 @@ -name: CI/CD emobility-echarging-nevicam - -on: - push: - paths: - - "data-collectors/emobility-echarging/**" - - ".github/workflows/ci-emobility-echarging-nevicam.yml" - -env: - WORKING_DIRECTORY: data-collectors/emobility-echarging - PROJECT_NAME: odh-mobility-dc-emobility-echarging-nevicam - DOCKER_IMAGE: ghcr.io/${{ github.repository }}/odh-mobility-dc-emobility-echarging - DOCKER_TAG: ${{ github.sha }} - JAVA_VERSION: '8' - -jobs: - - # Test - test: - runs-on: ubuntu-20.04 - steps: - - name: Checkout source code - uses: noi-techpark/github-actions/checkout@v2 - - name: REUSE Compliance Check - uses: fsfe/reuse-action@v1 - - name: Test code - uses: noi-techpark/github-actions/maven-test@v2 - with: - java-version: ${{ env.JAVA_VERSION }} - working-directory: ${{ env.WORKING_DIRECTORY }} - test-command: 'mvn -B -U clean test' - - # Deployment disabled while waiting for new nevicam stations - # https://github.com/noi-techpark/bdp-commons/issues/513 - - # Deploy Test - # deploy-test-emobility-echarging-nevicam: - # runs-on: ubuntu-20.04 - # if: github.ref == 'refs/heads/main' - # needs: test - # concurrency: deploy-test-emobility-echarging-nevicam - # env: - # KEYCLOAK_URL: https://auth.opendatahub.testingmachine.eu - # steps: - # - name: Checkout source code - # uses: noi-techpark/github-actions/checkout@v2 - # - name: Create .env file - # uses: noi-techpark/github-actions/env-file@v2 - # with: - # working-directory: ${{ env.WORKING_DIRECTORY }} - # env: - # # General deployment options - # X_COMPOSE_PROJECT_NAME: ${{ env.PROJECT_NAME }} - # X_DOCKER_IMAGE: ${{ env.DOCKER_IMAGE }} - # X_DOCKER_TAG: ${{ env.DOCKER_TAG }} - # X_JAVA_OPTIONS: -Xms128m -Xmx512m - - # # Open Data Hub Writer Connectivity - # X_authorizationUri: ${{ env.KEYCLOAK_URL }}/auth - # X_tokenUri: ${{ env.KEYCLOAK_URL }}/auth/realms/noi/protocol/openid-connect/token - # X_clientId: odh-mobility-datacollector - # X_clientName: odh-mobility-datacollector - # X_clientSecret: ${{ secrets.DATACOLLECTORS_CLIENT_SECRET_TEST }} - # X_scope: openid - # X_BASE_URI: https://mobility.share.opendatahub.testingmachine.eu/json - - # # Logging - # X_LOG_LEVEL: "info" - # X_LOG_STYLE: json - # X_provenance_name: ${{ env.PROJECT_NAME }} - # X_provenance_version: ${{ github.sha }} - - # # Data Origin Configuration - # X_endpoint_host: mobility.nevicam.it - # X_endpoint_port: 443 - # X_endpoint_ssl: 'yes' - # X_endpoint_path: /apiv0/m2 - # X_app_callerId: NOI-Techpark - # X_app_apikey: ${{ secrets.EMOBILITY_ECHARGING_NEVICAM_APIKEY }} - # X_app_dataOrigin: Nevicam - # X_app_period: 600 - - # X_SCHEDULER_CRON: 0 */5 * * * * - # X_SCHEDULER_POOL_SIZE: 2 - - # - name: Build project - # uses: noi-techpark/github-actions/maven-build@v2 - # with: - # working-directory: ${{ env.WORKING_DIRECTORY }} - # java-version: ${{ env.JAVA_VERSION }} - # build-command: 'mvn -B -DskipTests -DfinalName=ROOT clean package' - - # - name: Build and push images - # uses: noi-techpark/github-actions/docker-build-and-push@v2 - # with: - # working-directory: ${{ env.WORKING_DIRECTORY }}/infrastructure - # docker-username: ${{ github.actor }} - # docker-password: ${{ secrets.GITHUB_TOKEN }} - - # - name: Deploy application - # uses: noi-techpark/github-actions/docker-deploy@v2 - # with: - # working-directory: ${{ env.WORKING_DIRECTORY }}/infrastructure/ansible - # hosts: 'test' - # ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} - # docker-username: 'noi-techpark-bot' - # docker-password: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} - # project-name: ${{ env.PROJECT_NAME }} - - # # Deploy Production - # deploy-prod-emobility-echarging-nevicam: - # runs-on: ubuntu-20.04 - # if: github.ref == 'refs/heads/prod' - # needs: test - # concurrency: deploy-prod-emobility-echarging-nevicam - # env: - # KEYCLOAK_URL: https://auth.opendatahub.com - # steps: - # - name: Checkout source code - # uses: noi-techpark/github-actions/checkout@v2 - # - name: Create .env file - # uses: noi-techpark/github-actions/env-file@v2 - # with: - # working-directory: ${{ env.WORKING_DIRECTORY }} - # env: - # # General deployment options - # X_COMPOSE_PROJECT_NAME: ${{ env.PROJECT_NAME }} - # X_DOCKER_IMAGE: ${{ env.DOCKER_IMAGE }} - # X_DOCKER_TAG: ${{ env.DOCKER_TAG }} - # X_JAVA_OPTIONS: -Xms128m -Xmx512m - - # # Open Data Hub Writer Connectivity - # X_authorizationUri: ${{ env.KEYCLOAK_URL }}/auth - # X_tokenUri: ${{ env.KEYCLOAK_URL }}/auth/realms/noi/protocol/openid-connect/token - # X_clientId: odh-mobility-datacollector - # X_clientName: odh-mobility-datacollector - # X_clientSecret: ${{ secrets.DATACOLLECTORS_CLIENT_SECRET_PROD }} - # X_scope: openid - # X_BASE_URI: https://mobility.share.opendatahub.com/json - - # # Logging - # X_LOG_LEVEL: "info" - # X_LOG_STYLE: json - # X_provenance_name: ${{ env.PROJECT_NAME }} - # X_provenance_version: ${{ github.sha }} - - # # Data Origin Configuration - # X_endpoint_host: mobility.nevicam.it - # X_endpoint_port: 443 - # X_endpoint_ssl: 'yes' - # X_endpoint_path: /apiv0/m2 - # X_app_callerId: NOI-Techpark - # X_app_apikey: ${{ secrets.EMOBILITY_ECHARGING_NEVICAM_APIKEY }} - # X_app_dataOrigin: Nevicam - # X_app_period: 600 - - # X_SCHEDULER_CRON: 0 */5 * * * * - # X_SCHEDULER_POOL_SIZE: 2 - - # - name: Build project - # uses: noi-techpark/github-actions/maven-build@v2 - # with: - # working-directory: ${{ env.WORKING_DIRECTORY }} - # java-version: ${{ env.JAVA_VERSION }} - # build-command: 'mvn -B -DskipTests -DfinalName=ROOT clean package' - - # - name: Build and push images - # uses: noi-techpark/github-actions/docker-build-and-push@v2 - # with: - # working-directory: ${{ env.WORKING_DIRECTORY }}/infrastructure - # docker-username: ${{ github.actor }} - # docker-password: ${{ secrets.GITHUB_TOKEN }} - - # - name: Deploy application - # uses: noi-techpark/github-actions/docker-deploy@v2 - # with: - # working-directory: ${{ env.WORKING_DIRECTORY }}/infrastructure/ansible - # hosts: 'prod' - # ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} - # docker-username: 'noi-techpark-bot' - # docker-password: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} - # project-name: ${{ env.PROJECT_NAME }} diff --git a/.github/workflows/ci-emobility-echarging-route220.yml b/.github/workflows/ci-emobility-echarging-route220.yml deleted file mode 100644 index f0fa8bd9a..000000000 --- a/.github/workflows/ci-emobility-echarging-route220.yml +++ /dev/null @@ -1,179 +0,0 @@ -name: CI/CD emobility-echarging-route220 - -on: - push: - paths: - - "data-collectors/emobility-echarging/**" - - ".github/workflows/ci-emobility-echarging-route220.yml" - -env: - WORKING_DIRECTORY: data-collectors/emobility-echarging - PROJECT_NAME: odh-mobility-dc-emobility-echarging-route220 - DOCKER_IMAGE: ghcr.io/${{ github.repository }}/odh-mobility-dc-emobility-echarging-route220 - DOCKER_TAG: ${{ github.sha }} - JAVA_VERSION: '8' - -jobs: - - # Test - test: - runs-on: ubuntu-20.04 - steps: - - name: Checkout source code - uses: noi-techpark/github-actions/checkout@v2 - - name: REUSE Compliance Check - uses: fsfe/reuse-action@v1 - - name: Test code - uses: noi-techpark/github-actions/maven-test@v2 - with: - java-version: ${{ env.JAVA_VERSION }} - working-directory: ${{ env.WORKING_DIRECTORY }} - test-command: 'mvn -B -U clean test' - -# MIGRATED TO NEW INFRASTRUCTURE -# -# # Deploy Test -# deploy-test-emobility-echarging-route220: -# runs-on: ubuntu-20.04 -# if: github.ref == 'refs/heads/main' -# needs: test -# concurrency: deploy-test-emobility-echarging-route220 -# env: -# KEYCLOAK_URL: https://auth.opendatahub.testingmachine.eu -# steps: -# - name: Checkout source code -# uses: noi-techpark/github-actions/checkout@v2 -# - name: Create .env file -# uses: noi-techpark/github-actions/env-file@v2 -# with: -# working-directory: ${{ env.WORKING_DIRECTORY }} -# env: -# # General deployment options -# X_COMPOSE_PROJECT_NAME: ${{ env.PROJECT_NAME }} -# X_DOCKER_IMAGE: ${{ env.DOCKER_IMAGE }} -# X_DOCKER_TAG: ${{ env.DOCKER_TAG }} -# X_JAVA_OPTIONS: -Xms128m -Xmx512m -# -# # Open Data Hub Writer Connectivity -# X_authorizationUri: ${{ env.KEYCLOAK_URL }}/auth -# X_tokenUri: ${{ env.KEYCLOAK_URL }}/auth/realms/noi/protocol/openid-connect/token -# X_clientId: odh-mobility-datacollector -# X_clientName: odh-mobility-datacollector -# X_clientSecret: ${{ secrets.DATACOLLECTORS_CLIENT_SECRET_TEST }} -# X_scope: openid -# X_BASE_URI: https://mobility.share.opendatahub.testingmachine.eu/json -# -# # Logging -# X_LOG_LEVEL: "info" -# X_LOG_STYLE: json -# X_provenance_name: ${{ env.PROJECT_NAME }} -# X_provenance_version: ${{ github.sha }} -# -# # Data Origin Configuration -# X_endpoint_host: platform.evway.net -# X_endpoint_port: 443 -# X_endpoint_ssl: 'yes' -# X_endpoint_path: /api/idm/getAllRoute220Stations -# X_app_callerId: NOI-Techpark -# X_app_dataOrigin: route220 -# X_app_period: 600 -# -# X_SCHEDULER_CRON: 0 */5 * * * * -# X_SCHEDULER_POOL_SIZE: 2 -# -# - name: Build project -# uses: noi-techpark/github-actions/maven-build@v2 -# with: -# working-directory: ${{ env.WORKING_DIRECTORY }} -# java-version: ${{ env.JAVA_VERSION }} -# build-command: 'mvn -B -DskipTests -DfinalName=ROOT clean package' -# -# - name: Build and push images -# uses: noi-techpark/github-actions/docker-build-and-push@v2 -# with: -# working-directory: ${{ env.WORKING_DIRECTORY }}/infrastructure -# docker-username: ${{ github.actor }} -# docker-password: ${{ secrets.GITHUB_TOKEN }} -# -# - name: Deploy application -# uses: noi-techpark/github-actions/docker-deploy@v2 -# with: -# working-directory: ${{ env.WORKING_DIRECTORY }}/infrastructure/ansible -# hosts: 'test' -# ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} -# docker-username: 'noi-techpark-bot' -# docker-password: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} -# project-name: ${{ env.PROJECT_NAME }} -# -# # Deploy Production -# deploy-prod-emobility-echarging-route220: -# runs-on: ubuntu-20.04 -# if: github.ref == 'refs/heads/prod' -# needs: test -# concurrency: deploy-prod-emobility-echarging-route220 -# env: -# KEYCLOAK_URL: https://auth.opendatahub.com -# steps: -# - name: Checkout source code -# uses: noi-techpark/github-actions/checkout@v2 -# - name: Create .env file -# uses: noi-techpark/github-actions/env-file@v2 -# with: -# working-directory: ${{ env.WORKING_DIRECTORY }} -# env: -# # General deployment options -# X_COMPOSE_PROJECT_NAME: ${{ env.PROJECT_NAME }} -# X_DOCKER_IMAGE: ${{ env.DOCKER_IMAGE }} -# X_DOCKER_TAG: ${{ env.DOCKER_TAG }} -# X_JAVA_OPTIONS: -Xms128m -Xmx512m -# -# # Open Data Hub Writer Connectivity -# X_authorizationUri: ${{ env.KEYCLOAK_URL }}/auth -# X_tokenUri: ${{ env.KEYCLOAK_URL }}/auth/realms/noi/protocol/openid-connect/token -# X_clientId: odh-mobility-datacollector -# X_clientName: odh-mobility-datacollector -# X_clientSecret: ${{ secrets.DATACOLLECTORS_CLIENT_SECRET_PROD }} -# X_scope: openid -# X_BASE_URI: https://mobility.share.opendatahub.com/json -# -# # Logging -# X_LOG_LEVEL: "info" -# X_LOG_STYLE: json -# X_provenance_name: ${{ env.PROJECT_NAME }} -# X_provenance_version: ${{ github.sha }} -# -# # Data Origin Configuration -# X_endpoint_host: platform.evway.net -# X_endpoint_port: 443 -# X_endpoint_ssl: 'yes' -# X_endpoint_path: /api/idm/getAllRoute220Stations -# X_app_callerId: NOI-Techpark -# X_app_dataOrigin: route220 -# X_app_period: 600 -# -# X_SCHEDULER_CRON: 0 */5 * * * * -# X_SCHEDULER_POOL_SIZE: 2 -# -# - name: Build project -# uses: noi-techpark/github-actions/maven-build@v2 -# with: -# working-directory: ${{ env.WORKING_DIRECTORY }} -# java-version: ${{ env.JAVA_VERSION }} -# build-command: 'mvn -B -DskipTests -DfinalName=ROOT clean package' -# -# - name: Build and push images -# uses: noi-techpark/github-actions/docker-build-and-push@v2 -# with: -# working-directory: ${{ env.WORKING_DIRECTORY }}/infrastructure -# docker-username: ${{ github.actor }} -# docker-password: ${{ secrets.GITHUB_TOKEN }} -# -# - name: Deploy application -# uses: noi-techpark/github-actions/docker-deploy@v2 -# with: -# working-directory: ${{ env.WORKING_DIRECTORY }}/infrastructure/ansible -# hosts: 'prod' -# ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} -# docker-username: 'noi-techpark-bot' -# docker-password: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} -# project-name: ${{ env.PROJECT_NAME }} diff --git a/data-collectors/emobility-echarging/.env.example b/data-collectors/emobility-echarging/.env.example deleted file mode 100644 index cf6fc761a..000000000 --- a/data-collectors/emobility-echarging/.env.example +++ /dev/null @@ -1,40 +0,0 @@ -# Alperia Config -provenance_name=dc-emobility-echarging-alperia-local -endpoint_host=api.alperia-emobility.eu -endpoint_port=80 -endpoint_ssl=no -endpoint_path=/e-mobility/api/v3/chargingunits?includePartners=false -app_callerId=NOI-Techpark -app_dataOrigin=ALPERIA -app_period=600 - -# Scheduler: 10 seconds with a single job for development -SCHEDULER_CRON=*/10 * * * * * -SCHEDULER_POOL_SIZE=1 - -# ODH Core Writer Connection -BASE_URI=https://mobility.share.opendatahub.testingmachine.eu/json -authorizationUri=https://auth.opendatahub.testingmachine.eu/auth -tokenUri=https://auth.opendatahub.testingmachine.eu/auth/realms/noi/protocol/openid-connect/token -clientId=odh-mobility-datacollector -clientName=odh-mobility-datacollector -scope=openid -clientSecret= - -# Get it from your pom.xml -> project/version and project/artifactId -provenance_name=dc-emobility-echarging-local -provenance_version=0.0.0 - -# Build, only needed to test infrastructure/docker-compose.build.yml -COMPOSE_PROJECT_NAME=emobility-echarging -DOCKER_IMAGE=emobility-echarging-image -DOCKER_TAG=test-1 -ARTIFACT_NAME=dc-emobility-echarging - -# Logging level and style (text or json) -LOG_LEVEL=debug -LOG_STYLE=text - -# Only for calls.http -DRIWE_API_KEY= -NEVICAM_API_KEY= diff --git a/data-collectors/emobility-echarging/README.md b/data-collectors/emobility-echarging/README.md deleted file mode 100644 index c6db795c7..000000000 --- a/data-collectors/emobility-echarging/README.md +++ /dev/null @@ -1,83 +0,0 @@ - - -# E-Charging Data Collector - -This data collector takes data from different companies which comply to the same -standard, created in the workgroup. - -[![CI emobility-echarging](https://github.com/noi-techpark/bdp-commons/actions/workflows/ci-emobility-echarging.yml/badge.svg)](https://github.com/noi-techpark/bdp-commons/actions/workflows/ci-emobility-echarging.yml) - -**Table Of Contents** -- [E-Charging Data Collector](#e-charging-data-collector) - - [Getting Started](#getting-started) - - [Prerequisites](#prerequisites) - - [Source code](#source-code) - - [Build](#build) - - [Information](#information) - - [Support](#support) - - [Contributing](#contributing) - - [Documentation](#documentation) - - [License](#license) - -## Getting Started - -### Prerequisites - -To build the project, the following prerequisites must be met: - -- Java JDK 1.8 or higher (e.g. [OpenJDK](https://openjdk.java.net/)) -- [Maven](https://maven.apache.org/) 3.x -- The [Open Data Hub Mobility Writer](https://github.com/noi-techpark/bdp-core) - (aka Big Data Platform Core) installed -- [Credentials](https://github.com/noi-techpark/odh-docs/wiki/Contributor-Guidelines:-Credentials) - - to get the ODH writer token - - to connect to various E-Charging API endpoint - -### Source code - -Get a copy of the repository: - -```bash -git clone git clone https://github.com/noi-techpark/bdp-commons -``` - -Change directory: - -```bash -cd bdp-commons/data-collectors/emobility-echarging -``` - - -## Build - -- go to src/main/resources/META-INF/spring/application.properties and fill it out -- the chron which schedules the tasks can be changed in src/main/resources/META-INF/spring/applicationContext.xml - -By now you can already deploy the module. -For further documentation check the core repo. - -## Information - -### Support - -For support, please contact [help@opendatahub.com](mailto:help@opendatahub.com). - -### Contributing - -If you'd like to contribute, please follow our [Getting -Started](https://github.com/noi-techpark/odh-docs/wiki/Contributor-Guidelines:-Getting-started) -instructions. - -### Documentation - -More documentation can be found at -[https://docs.opendatahub.com](https://docs.opendatahub.com). - -### License - -The code in this project is licensed under the GNU AFFERO GENERAL PUBLIC LICENSE -Version 3 license. See the [LICENSE](../../LICENSE) file for more information. diff --git a/data-collectors/emobility-echarging/calls.http b/data-collectors/emobility-echarging/calls.http deleted file mode 100644 index c2f63517d..000000000 --- a/data-collectors/emobility-echarging/calls.http +++ /dev/null @@ -1,35 +0,0 @@ -### ALPERIA -# Not https (just port 80) -@hostalperia=http://api.alperia-emobility.eu - -### -GET {{hostalperia}}/e-mobility/api/v3/chargingunits?includePartners=false -X-Caller-ID: NOI-Techpark -Accept: application/json - - -### NEVICAM -# unavailable at the moment, maybe deactivated completely? -@hostnevicam=https://mobility.nevicam.it - -GET {{hostnevicam}}/apiv0/m2 -X-Caller-ID: NOI-Techpark -Accept: application/json -apikey: {{$dotenv NEVICAM_API_KEY}} - -### ROUTE220 -# -@hostroute220=https://platform.evway.net - -GET {{hostroute220}}/api/idm/getAllRoute220Stations -X-Caller-ID: NOI-Techpark -Accept: application/json - -### DRIWE -# -@hostdriwe=https://www.driwe.club - -GET {{hostdriwe}}/api/stations/metadata?auth-token={{$dotenv DRIWE_API_KEY}} -X-Caller-ID: NOI-Techpark -Accept: application/json - diff --git a/data-collectors/emobility-echarging/data-quality-check/.gitignore b/data-collectors/emobility-echarging/data-quality-check/.gitignore deleted file mode 100644 index d2fb2e852..000000000 --- a/data-collectors/emobility-echarging/data-quality-check/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*.csv -logs/ diff --git a/data-collectors/emobility-echarging/data-quality-check/README.md b/data-collectors/emobility-echarging/data-quality-check/README.md deleted file mode 100644 index 123919557..000000000 --- a/data-collectors/emobility-echarging/data-quality-check/README.md +++ /dev/null @@ -1,14 +0,0 @@ - - -# e-mobility e-charging data quality checks - -A simple python script to see if the data provided by the different e-charging stations data providers is saved correct in the Open Data Hub. - -This is the first prototype and will fetch the data from the data provider and the corresponding data from the Open Data Hub amd do the checks. -In future with the new Architecture 2.0 of the Open Data Hub, the raw data of the data provider will be saved in the database and so the real data used to create the entries in the Open Data Hub can be used. So that data will be used and no second fetching from the data provider is needed. - -It's also planned to adapt this quality checks for other data of the Open Data Hub. diff --git a/data-collectors/emobility-echarging/data-quality-check/data-quality-check-no-pandas.py b/data-collectors/emobility-echarging/data-quality-check/data-quality-check-no-pandas.py deleted file mode 100644 index 677367c71..000000000 --- a/data-collectors/emobility-echarging/data-quality-check/data-quality-check-no-pandas.py +++ /dev/null @@ -1,291 +0,0 @@ -# SPDX-FileCopyrightText: NOI Techpark -# -# SPDX-License-Identifier: AGPL-3.0-or-later - -import requests -import time -import configparser - -config = configparser.ConfigParser() -config.read('.env') - -DRIWE_TOKEN = config["keys"]["DRIWE_TOKEN"] -NEVICAM_KEY = config["keys"]["NEVICAM_KEY"] - -ALPERIA = "http://api.alperia-emobility.eu/e-mobility/api/v3/chargingunits?includePartners=false" -ROUTE220 = "https://platform.evway.net/api/idm/getAllRoute220Stations" -NEVICAM = "https://mobility.nevicam.it/apiv0/m2" -DRIWE = "https://www.driwe.club/api/stations/metadata?auth-token=" + DRIWE_TOKEN - - -def get_odh_plugs(origin): - ODH_URL = "https://mobility.api.opendatahub.com/v2/flat%2Cnode/EChargingPlug/%2A/latest?limit=0&offset=0&shownull=false&select=pcode,porigin,smetadata,mvalue&where=pactive.eq.true,porigin.eq." + origin + "&distinct=true&timezone=UTC" - response = requests.get(ODH_URL) - - return response.json()["data"] - - -def get_odh_stations(origin): - ODH_URL = "https://mobility.api.opendatahub.bz.com/v2/flat%2Cnode/EChargingStation/%2A/latest?limit=0&offset=0&shownull=false&where=sactive.eq.true,sorigin.eq." + \ - origin + "&distinct=true&timezone=UTC" - response = requests.get(ODH_URL) - - return response.json()["data"] - - -def get_dataprovider_data(url, api_key=None): - headers = { - "X-Caller-ID": "NOI-Techpark", - "Accept": "application/json" - } - - # nevicam - if api_key: - headers["apikey"] = api_key - - response = requests.get( - url, headers=headers) - - print(response) - - json = response.json() - return json - - -# def to_csv(data): -# panda_file = pd.DataFrame(data) -# # panda_file = pd.read_json(data) -# panda_file.to_csv('csvfile3.csv', encoding='utf-8', index=False) - - -# def append_to_csv(data, csv_file): -# df = pd.DataFrame(data) -# df.to_csv(csv_file, mode='a', -# encoding='utf-8', index=False, header=False) - -def append_to_csv(data, csv_file): - file = open(csv_file, "a") - for row in data: - set = str(row["station_code"]) - if "odh_mvalue" in row: - set += str(row["odh_mvalue"]) + "," - else: - set += "#," - - if "dp_state" in row: - set += str(row["dp_state"]) + "," - else: - set += "#," - - if "problem" in row: - set += str(row["problem"]) + "," - else: - set += "#," - - set += str(row["timestamp"]) - file.write(set + "\n") - file.close() - -# checks if the stations data is represented correctly with the plugs data -# stations have value (current available plugs) and capacity (total plugs) -# every station can have multiple plugs -# every plug has value (0 or 1) for available or not -# so every stations capacity should have the same value as the sum of all its plugs -# and the stations value should be the sum of all its available plugs - - -def analyze_odh_stations_to_plugs(stations, plugs): - error_counter = 0 - - for station in stations: - station_id = station["scode"] - station_capacity = station["smetadata"]["capacity"] - station_value = station["mvalue"] - - plug_counter = 0 - available_plug_counter = 0 - for plug in plugs: - if plug["pcode"] == station_id: - plug_counter += 1 - if plug["mvalue"] == 1: - available_plug_counter += 1 - - if station_capacity != plug_counter: - error_counter += 1 - print(station) - print("Station has " + str(station_capacity) + - " capacity - Total plugs counted: " + str(plug_counter)) - - if station_value != available_plug_counter: - error_counter += 1 - print(station) - print("Station has " + str(station_value) + - " plugs available - Available plugs: " + str(available_plug_counter)) - - if error_counter > 0: - print("Error: " + str(error_counter) + " errors found") - else: - print("No errors found") - - -# analyzes if the data from data-provider is saved correctly in the ODH -def analyze_plugs(odh, data_provider): - # print("ODH: CHARGING - DATA PROVIDER: AVAILABLE\n") - problem_counter = 0 - total_counter = 0 - for odh_plug in odh: - station_code = odh_plug["pcode"] - total_counter += 1 - - for dp_station in data_provider: - if dp_station["code"] == station_code: - outlet_id = odh_plug["smetadata"]["outlets"][0]["id"] - - for charging_point in dp_station["chargingPoints"]: - if charging_point["outlets"][0]["id"] == outlet_id and odh_plug["mvalue"] == 0 and charging_point["state"] == "AVAILABLE": - # print("PROBLEM DETECTED") - # print(odh_plug) - # print(charging_point["state"] + " - " + - # dp_station["code"] + " " + str(charging_point)) - print("id: " + str(station_code) + " mvalue: " + - str(odh_plug["mvalue"]) + " <-> state: " + charging_point["state"]) - problem_counter += 1 - - print("Number of problems: " + str(problem_counter) + - " of total plugs: " + str(total_counter)) - - print("--------------------------------------------------------------------------") - - print("ODH: AVAILABLE - DATA PROVIDER: CHARGING\n") - problem_counter = 0 - total_counter = 0 - for odh_plug in odh: - station_code = odh_plug["pcode"] - total_counter += 1 - - for dp_station in data_provider: - if dp_station["code"] == station_code: - outlet_id = odh_plug["smetadata"]["outlets"][0]["id"] - - for charging_point in dp_station["chargingPoints"]: - if charging_point["outlets"][0]["id"] == outlet_id and odh_plug["mvalue"] == 1 and charging_point["state"] != "AVAILABLE": - # print("PROBLEM DETECTED") - # print(odh_plug) - # print(charging_point["state"] + " - " + - # dp_station["code"] + " " + str(charging_point)) - print("id: " + str(station_code) + " mvalue: " + - str(odh_plug["mvalue"]) + " <-> state: " + charging_point["state"]) - problem_counter += 1 - - print("Number of problems: " + str(problem_counter) + - " of total plugs: " + str(total_counter)) - - print("#########################################################################") - - -def map_plugs(odh, data_provider): - - time_stamp = time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime()) - - plugs = [] - for odh_plug in odh: - plug = {} - plug["station_code"] = odh_plug["pcode"] - for dp_station in data_provider: - if str(dp_station["code"]) == str(plug["station_code"]): - plug["plug_id"] = odh_plug["smetadata"]["outlets"][0]["id"] - - for charging_point in dp_station["chargingPoints"]: - if charging_point["outlets"][0]["id"] == plug["plug_id"]: - plug["odh_mvalue"] = odh_plug["mvalue"] - plug["dp_state"] = charging_point["state"] - plug["problem"] = odh_plug["mvalue"] == 1 and charging_point["state"] == "AVAILABLE" - plug["timestamp"] = time_stamp - plugs.append(plug) - return plugs - - -while True: - print("ALPERIA " + time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime())) - odh_alperia_plugs = get_odh_plugs("ALPERIA") - data_provider = get_dataprovider_data(ALPERIA) - plugs = map_plugs(odh_alperia_plugs, data_provider) - append_to_csv(plugs, "alperia2.csv") - - print("route220 " + time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime())) - odh_route220_plugs = get_odh_plugs("route220") - data_provider_route220 = get_dataprovider_data(ROUTE220) - plugs = map_plugs(odh_route220_plugs, data_provider_route220) - append_to_csv(plugs, "route2202.csv") - - print("DRIWE " + time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime())) - odh_driwe_plugs = get_odh_plugs("DRIWE") - data_provider_driwe = get_dataprovider_data(DRIWE) - plugs = map_plugs(odh_driwe_plugs, data_provider_driwe) - append_to_csv(plugs, "driwe2.csv") - - time.sleep(300) - -while True: - print("ALPERIA " + time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime())) - odh_alperia_plugs = get_odh_plugs("ALPERIA") - data_provider = get_dataprovider_data(ALPERIA) - analyze_plugs(odh_alperia_plugs, data_provider) - - print("route220 " + time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime())) - odh_route220_plugs = get_odh_plugs("route220") - data_provider_route220 = get_dataprovider_data(ROUTE220) - analyze_plugs(odh_route220_plugs, data_provider_route220) - - print("DRIWE " + time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime())) - odh_driwe_plugs = get_odh_plugs("DRIVE") - data_provider_driwe = get_dataprovider_data(DRIWE) - analyze_plugs(odh_driwe_plugs, data_provider_driwe) - - time.sleep(300) - - -print("ROUTE220") -odh_route220_stations = get_odh_stations("route220") -odh_route220_plugs = get_odh_plugs("route220") - -print("ANALYZE ODH STATIONS <-> PLUGS") -analyze_odh_stations_to_plugs(odh_route220_stations, odh_route220_plugs) - -data_provider_route220 = get_dataprovider_data(ROUTE220) -analyze_plugs(odh_route220_plugs, data_provider_route220) - - -print("DRIWE") -odh_driwe_stations = get_odh_stations("DRIVE") -odh_driwe_plugs = get_odh_plugs("DRIVE") - -print("ANALYZE ODH STATIONS <-> PLUGS") -analyze_odh_stations_to_plugs(odh_driwe_stations, odh_driwe_plugs) - -data_provider_driwe = get_dataprovider_data(DRIWE) -analyze_plugs(odh_driwe_plugs, data_provider_driwe) - - -# print("\n\n------------ PLUGS -------------\n\n") - -# print("ALPERIA") -# data_provider = get_dataprovider_data(ALPERIA) -# odh = get_odh_plugs("ALPERIA") -# analyze_plugs(odh, data_provider) - -# print("ROUTE220") -# data_provider_route220 = get_dataprovider_data(ROUTE220) -# odh_route220 = get_odh_plugs("route220") -# analyze_plugs(odh_route220, data_provider_route220) - -# print("DRIWE") -# data_provider_driwe = get_dataprovider_data(DRIWE) -# odh_driwe = get_odh_plugs("DRIVE") -# analyze_plugs(odh_driwe, data_provider_driwe) - -# Gives 502 Bad Gateway Error -# print("NEVICAM") -# data_provider_nevicam = get_dataprovider_data(NEVICAM,NEVICAM_KEY) -# odh_nevicam = get_odh_plugs("Nevicam") -# analyze_plugs(odh_nevicam, data_provider_nevicam) diff --git a/data-collectors/emobility-echarging/data-quality-check/data-quality-check.py b/data-collectors/emobility-echarging/data-quality-check/data-quality-check.py deleted file mode 100644 index ea69ec86b..000000000 --- a/data-collectors/emobility-echarging/data-quality-check/data-quality-check.py +++ /dev/null @@ -1,280 +0,0 @@ -# SPDX-FileCopyrightText: NOI Techpark -# -# SPDX-License-Identifier: AGPL-3.0-or-later - -import requests -import pandas as pd -import time -import configparser - -config = configparser.ConfigParser() -config.read('.env') - -DRIWE_TOKEN = config["keys"]["DRIWE_TOKEN"] -NEVICAM_KEY = config["keys"]["NEVICAM_KEY"] - -ALPERIA = "http://api.alperia-emobility.eu/e-mobility/api/v3/chargingunits?includePartners=false" -ROUTE220 = "https://platform.evway.net/api/idm/getAllRoute220Stations" -NEVICAM = "https://mobility.nevicam.it/apiv0/m2" -DRIWE = "https://www.driwe.club/api/stations/metadata?auth-token=" + DRIWE_TOKEN - - -def get_odh_plugs(origin): - ODH_URL = "https://mobility.api.opendatahub.com/v2/flat%2Cnode/EChargingPlug/%2A/latest?limit=0&offset=0&shownull=false&select=pcode,porigin,smetadata,mvalue&where=pactive.eq.true,porigin.eq." + origin + "&distinct=true&timezone=UTC" - response = requests.get(ODH_URL) - - return response.json()["data"] - - -def get_odh_stations(origin): - ODH_URL = "https://mobility.api.opendatahub.com/v2/flat%2Cnode/EChargingStation/%2A/latest?limit=0&offset=0&shownull=false&where=sactive.eq.true,sorigin.eq." + \ - origin + "&distinct=true&timezone=UTC" - response = requests.get(ODH_URL) - - return response.json()["data"] - - -def get_dataprovider_data(url, api_key=None): - headers = { - "X-Caller-ID": "NOI-Techpark", - "Accept": "application/json" - } - - # nevicam - if api_key: - headers["apikey"] = api_key - - response = requests.get( - url, headers=headers) - - print(response) - - json = response.json() - return json - - -def to_csv(data): - panda_file = pd.DataFrame(data) - # panda_file = pd.read_json(data) - panda_file.to_csv('csvfile3.csv', encoding='utf-8', index=False) - - -def append_to_csv(data, csv_file): - df = pd.DataFrame(data) - df.to_csv(csv_file, mode='a', - encoding='utf-8', index=False, header=False) - -# checks if the stations data is represented correctly with the plugs data -# stations have value (current available plugs) and capacity (total plugs) -# every station can have multiple plugs -# every plug has value (0 or 1) for available or not -# so every stations capacity should have the same value as the sum of all its plugs -# and the stations value should be the sum of all its available plugs - - -def analyze_odh_stations_to_plugs(stations, plugs): - error_counter = 0 - - for station in stations: - station_id = station["scode"] - station_capacity = station["smetadata"]["capacity"] - station_value = station["mvalue"] - - plug_counter = 0 - available_plug_counter = 0 - for plug in plugs: - if plug["pcode"] == station_id: - plug_counter += 1 - if plug["mvalue"] == 1: - available_plug_counter += 1 - - if station_capacity != plug_counter: - error_counter += 1 - print(station) - print("Station has " + str(station_capacity) + - " capacity - Total plugs counted: " + str(plug_counter)) - - if station_value != available_plug_counter: - error_counter += 1 - print(station) - print("Station has " + str(station_value) + - " plugs available - Available plugs: " + str(available_plug_counter)) - - if error_counter > 0: - print("Error: " + str(error_counter) + " errors found") - else: - print("No errors found") - - -# analyzes if the data from data-provider is saved correctly in the ODH -def analyze_plugs(odh, data_provider): - # print("ODH: CHARGING - DATA PROVIDER: AVAILABLE\n") - problem_counter = 0 - total_counter = 0 - for odh_plug in odh: - station_code = odh_plug["pcode"] - total_counter += 1 - - for dp_station in data_provider: - if dp_station["code"] == station_code: - outlet_id = odh_plug["smetadata"]["outlets"][0]["id"] - - for charging_point in dp_station["chargingPoints"]: - if charging_point["outlets"][0]["id"] == outlet_id and odh_plug["mvalue"] == 0 and charging_point["state"] == "AVAILABLE": - # print("PROBLEM DETECTED") - # print(odh_plug) - # print(charging_point["state"] + " - " + - # dp_station["code"] + " " + str(charging_point)) - print("id: " + str(station_code) + " mvalue: " + - str(odh_plug["mvalue"]) + " <-> state: " + charging_point["state"]) - problem_counter += 1 - - print("Number of problems: " + str(problem_counter) + - " of total plugs: " + str(total_counter)) - - print("--------------------------------------------------------------------------") - - print("ODH: AVAILABLE - DATA PROVIDER: CHARGING\n") - problem_counter = 0 - total_counter = 0 - for odh_plug in odh: - station_code = odh_plug["pcode"] - total_counter += 1 - - for dp_station in data_provider: - if dp_station["code"] == station_code: - outlet_id = odh_plug["smetadata"]["outlets"][0]["id"] - - for charging_point in dp_station["chargingPoints"]: - if charging_point["outlets"][0]["id"] == outlet_id and odh_plug["mvalue"] == 1 and charging_point["state"] != "AVAILABLE": - # print("PROBLEM DETECTED") - # print(odh_plug) - # print(charging_point["state"] + " - " + - # dp_station["code"] + " " + str(charging_point)) - print("id: " + str(station_code) + " mvalue: " + - str(odh_plug["mvalue"]) + " <-> state: " + charging_point["state"]) - problem_counter += 1 - - print("Number of problems: " + str(problem_counter) + - " of total plugs: " + str(total_counter)) - - print("#########################################################################") - - -def map_plugs(odh, data_provider): - - time_stamp = time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime()) - - plugs = [] - for odh_plug in odh: - plug = {} - plug["station_code"] = odh_plug["pcode"] - for dp_station in data_provider: - if dp_station["code"] == plug["station_code"]: - plug["plug_id"] = odh_plug["smetadata"]["outlets"][0]["id"] - - for charging_point in dp_station["chargingPoints"]: - if charging_point["outlets"][0]["id"] == plug["plug_id"]: - plug["odh_mvalue"] = odh_plug["mvalue"] - plug["dp_state"] = charging_point["state"] - plug["problem"] = (odh_plug["mvalue"] == 1 and charging_point["state"] == "AVAILABLE") or (odh_plug["mvalue"] == 0 and charging_point["state"] != "AVAILABLE") - plug["timestamp"] = time_stamp - plugs.append(plug) - return plugs - - -print("ALPERIA") -odh_stations = get_odh_stations("ALPERIA") -odh_plugs = get_odh_plugs("ALPERIA") - -print("ANALYZE ODH STATIONS <-> PLUGS") -analyze_odh_stations_to_plugs(odh_stations, odh_plugs) - - -start_time_stamp = time.strftime("%Y-%m-%dT%H:%M:%S", time.gmtime()) - -while True: - print("ALPERIA " + time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime())) - odh_alperia_plugs = get_odh_plugs("ALPERIA") - data_provider = get_dataprovider_data(ALPERIA) - plugs = map_plugs(odh_alperia_plugs, data_provider) - append_to_csv(plugs,"logs/alperia-" + start_time_stamp + ".csv") - - print("route220 " + time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime())) - odh_route220_plugs = get_odh_plugs("route220") - data_provider_route220 = get_dataprovider_data(ROUTE220) - plugs = map_plugs(odh_route220_plugs, data_provider_route220) - append_to_csv(plugs,"logs/route220-" + start_time_stamp + ".csv") - - - print("DRIWE " + time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime())) - odh_driwe_plugs = get_odh_plugs("DRIWE") - data_provider_driwe = get_dataprovider_data(DRIWE) - plugs = map_plugs(odh_driwe_plugs, data_provider_driwe) - append_to_csv(plugs,"logs/driwe-" + start_time_stamp + ".csv") - - time.sleep(300) - -while True: - print("ALPERIA " + time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime())) - odh_alperia_plugs = get_odh_plugs("ALPERIA") - data_provider = get_dataprovider_data(ALPERIA) - analyze_plugs(odh_alperia_plugs, data_provider) - - print("route220 " + time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime())) - odh_route220_plugs = get_odh_plugs("route220") - data_provider_route220 = get_dataprovider_data(ROUTE220) - analyze_plugs(odh_route220_plugs, data_provider_route220) - - print("DRIWE " + time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime())) - odh_driwe_plugs = get_odh_plugs("DRIVE") - data_provider_driwe = get_dataprovider_data(DRIWE) - analyze_plugs(odh_driwe_plugs, data_provider_driwe) - - time.sleep(300) - - -print("ROUTE220") -odh_route220_stations = get_odh_stations("route220") -odh_route220_plugs = get_odh_plugs("route220") - -print("ANALYZE ODH STATIONS <-> PLUGS") -analyze_odh_stations_to_plugs(odh_route220_stations, odh_route220_plugs) - -data_provider_route220 = get_dataprovider_data(ROUTE220) -analyze_plugs(odh_route220_plugs, data_provider_route220) - - -print("DRIWE") -odh_driwe_stations = get_odh_stations("DRIVE") -odh_driwe_plugs = get_odh_plugs("DRIVE") - -print("ANALYZE ODH STATIONS <-> PLUGS") -analyze_odh_stations_to_plugs(odh_driwe_stations, odh_driwe_plugs) - -data_provider_driwe = get_dataprovider_data(DRIWE) -analyze_plugs(odh_driwe_plugs, data_provider_driwe) - - -# print("\n\n------------ PLUGS -------------\n\n") - -# print("ALPERIA") -# data_provider = get_dataprovider_data(ALPERIA) -# odh = get_odh_plugs("ALPERIA") -# analyze_plugs(odh, data_provider) - -# print("ROUTE220") -# data_provider_route220 = get_dataprovider_data(ROUTE220) -# odh_route220 = get_odh_plugs("route220") -# analyze_plugs(odh_route220, data_provider_route220) - -# print("DRIWE") -# data_provider_driwe = get_dataprovider_data(DRIWE) -# odh_driwe = get_odh_plugs("DRIVE") -# analyze_plugs(odh_driwe, data_provider_driwe) - -# Gives 502 Bad Gateway Error -# print("NEVICAM") -# data_provider_nevicam = get_dataprovider_data(NEVICAM,NEVICAM_KEY) -# odh_nevicam = get_odh_plugs("Nevicam") -# analyze_plugs(odh_nevicam, data_provider_nevicam) diff --git a/data-collectors/emobility-echarging/data-quality-check/requirements.txt b/data-collectors/emobility-echarging/data-quality-check/requirements.txt deleted file mode 100644 index d1757d599..000000000 --- a/data-collectors/emobility-echarging/data-quality-check/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -requests==2.25.1 -pandas==1.4.2 diff --git a/data-collectors/emobility-echarging/docker-compose.yml b/data-collectors/emobility-echarging/docker-compose.yml deleted file mode 100644 index 425b829fb..000000000 --- a/data-collectors/emobility-echarging/docker-compose.yml +++ /dev/null @@ -1,28 +0,0 @@ -# SPDX-FileCopyrightText: NOI Techpark -# -# SPDX-License-Identifier: CC0-1.0 - -version: "3.4" - -services: - app: - image: maven:3-jdk-8-alpine - network_mode: host - env_file: - - .env - environment: - MAVEN_CONFIG: /var/maven/.m2 - MAVEN_OPTS: -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9000 - entrypoint: > - mvn - -Duser.home=/var/maven - -Dmaven.tomcat.port=9001 - tomcat:run - ports: - - 9000:9000 - - 9001:9001 - volumes: - - ~/.m2/:/var/maven/.m2 - - ./:/code - working_dir: /code - tty: true diff --git a/data-collectors/emobility-echarging/infrastructure/ansible/ansible.cfg b/data-collectors/emobility-echarging/infrastructure/ansible/ansible.cfg deleted file mode 100644 index bec5ce050..000000000 --- a/data-collectors/emobility-echarging/infrastructure/ansible/ansible.cfg +++ /dev/null @@ -1,4 +0,0 @@ -[defaults] -inventory = ./hosts -roles_path = ./roles -retry_files_enabled = False diff --git a/data-collectors/emobility-echarging/infrastructure/ansible/deploy.yml b/data-collectors/emobility-echarging/infrastructure/ansible/deploy.yml deleted file mode 100644 index c01d4feb1..000000000 --- a/data-collectors/emobility-echarging/infrastructure/ansible/deploy.yml +++ /dev/null @@ -1,19 +0,0 @@ ---- -- hosts: all - vars: - ansible_python_interpreter: /usr/bin/python3 - tasks: - - name: Login to GitHub Container Registry - ansible.builtin.shell: - cmd: echo "{{ docker_password }}" | docker login "{{ docker_host }}" --username "{{ docker_username }}" --password-stdin - - name: Execute Docker deployment - ansible.builtin.include_role: - name: ansible-docker-deployment - vars: - docker_deployment_project_name: '{{ project_name }}' - docker_deployment_release_name: '{{ release_name }}' - docker_deployment_release_files: - - local: ../docker-compose.run.yml - remote: docker-compose.yml - - local: ../../.env - remote: .env diff --git a/data-collectors/emobility-echarging/infrastructure/ansible/hosts b/data-collectors/emobility-echarging/infrastructure/ansible/hosts deleted file mode 100644 index aa052882d..000000000 --- a/data-collectors/emobility-echarging/infrastructure/ansible/hosts +++ /dev/null @@ -1,5 +0,0 @@ -[test] -docker02.testingmachine.eu ansible_user='noi-techpark-bot' ansible_ssh_common_args='-o StrictHostKeyChecking=no' - -[prod] -docker02.opendatahub.com ansible_user='noi-techpark-bot' ansible_ssh_common_args='-o StrictHostKeyChecking=no' diff --git a/data-collectors/emobility-echarging/infrastructure/ansible/requirements.yml b/data-collectors/emobility-echarging/infrastructure/ansible/requirements.yml deleted file mode 100644 index cb9e81bb8..000000000 --- a/data-collectors/emobility-echarging/infrastructure/ansible/requirements.yml +++ /dev/null @@ -1,2 +0,0 @@ -- src: git+https://github.com/noi-techpark/ansible-docker-deployment.git - version: "2.0" diff --git a/data-collectors/emobility-echarging/infrastructure/ansible/roles/.gitignore b/data-collectors/emobility-echarging/infrastructure/ansible/roles/.gitignore deleted file mode 100644 index d6b7ef32c..000000000 --- a/data-collectors/emobility-echarging/infrastructure/ansible/roles/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore diff --git a/data-collectors/emobility-echarging/infrastructure/docker-compose.build.yml b/data-collectors/emobility-echarging/infrastructure/docker-compose.build.yml deleted file mode 100644 index 93d36f027..000000000 --- a/data-collectors/emobility-echarging/infrastructure/docker-compose.build.yml +++ /dev/null @@ -1,8 +0,0 @@ -version: "3.4" - -services: - app: - image: ${DOCKER_IMAGE}:${DOCKER_TAG} - build: - context: ../ - dockerfile: infrastructure/docker/Dockerfile diff --git a/data-collectors/emobility-echarging/infrastructure/docker-compose.run.yml b/data-collectors/emobility-echarging/infrastructure/docker-compose.run.yml deleted file mode 100644 index 8be5e08fa..000000000 --- a/data-collectors/emobility-echarging/infrastructure/docker-compose.run.yml +++ /dev/null @@ -1,10 +0,0 @@ -version: "3.4" - -services: - app: - image: ${DOCKER_IMAGE}:${DOCKER_TAG} - restart: unless-stopped - environment: - _JAVA_OPTIONS: ${JAVA_OPTIONS} - env_file: - - .env diff --git a/data-collectors/emobility-echarging/infrastructure/docker/.gitignore b/data-collectors/emobility-echarging/infrastructure/docker/.gitignore deleted file mode 100644 index 0c84ffb73..000000000 --- a/data-collectors/emobility-echarging/infrastructure/docker/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/.m2 diff --git a/data-collectors/emobility-echarging/infrastructure/docker/Dockerfile b/data-collectors/emobility-echarging/infrastructure/docker/Dockerfile deleted file mode 100644 index 3e9421f2f..000000000 --- a/data-collectors/emobility-echarging/infrastructure/docker/Dockerfile +++ /dev/null @@ -1,3 +0,0 @@ -FROM tomcat:8.5-jdk8-openjdk-slim-buster -COPY target/ROOT.war /usr/local/tomcat/webapps/ROOT.war - diff --git a/data-collectors/emobility-echarging/pom.xml b/data-collectors/emobility-echarging/pom.xml deleted file mode 100644 index 8934a2f6a..000000000 --- a/data-collectors/emobility-echarging/pom.xml +++ /dev/null @@ -1,153 +0,0 @@ - - - - - - 4.0.0 - it.bz.idm.bdp - dc-emobility-echarging - war - 2.0.0 - EMobility datacollector - - 8 - UTF-8 - 5.3.20 - - ROOT - - - - maven-repo.opendatahub.com - https://maven-repo.opendatahub.com/release - - - - - - junit - junit - 4.13.1 - test - - - javax.servlet - javax.servlet-api - 4.0.1 - provided - - - org.apache.commons - commons-lang3 - 3.1 - - - org.springframework - spring-core - ${spring.version} - - - commons-logging - commons-logging - - - - - org.springframework - spring-test - ${spring.version} - test - - - org.springframework - spring-context - ${spring.version} - - - org.springframework - spring-aop - ${spring.version} - - - org.springframework - spring-aspects - ${spring.version} - - - commons-collections - commons-collections - 3.2.2 - - - org.springframework - spring-webmvc - ${spring.version} - - - joda-time - joda-time - 1.6 - - - commons-codec - commons-codec - 1.15 - - - it.bz.idm.bdp - dc-interface - 7.4.0 - - - org.apache.httpcomponents - httpclient - 4.5.13 - - - commons-io - commons-io - 2.11.0 - - - - ${finalName} - - - org.apache.maven.plugins - maven-compiler-plugin - 3.5.1 - - ${java.version} - ${java.version} - ${project.build.sourceEncoding} - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.21.0 - - false - - - - org.apache.maven.plugins - maven-failsafe-plugin - 2.20.1 - - - - integration-test - verify - - - - - - - diff --git a/data-collectors/emobility-echarging/src/main/java/it/bz/idm/bdp/service/ChargePusher.java b/data-collectors/emobility-echarging/src/main/java/it/bz/idm/bdp/service/ChargePusher.java deleted file mode 100644 index 2e36876a1..000000000 --- a/data-collectors/emobility-echarging/src/main/java/it/bz/idm/bdp/service/ChargePusher.java +++ /dev/null @@ -1,201 +0,0 @@ -// SPDX-FileCopyrightText: NOI Techpark -// -// SPDX-License-Identifier: AGPL-3.0-or-later - -package it.bz.idm.bdp.service; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.core.env.Environment; -import org.springframework.stereotype.Service; - -import it.bz.idm.bdp.dto.DataMapDto; -import it.bz.idm.bdp.dto.DataTypeDto; -import it.bz.idm.bdp.dto.ProvenanceDto; -import it.bz.idm.bdp.dto.RecordDtoImpl; -import it.bz.idm.bdp.dto.SimpleRecordDto; -import it.bz.idm.bdp.dto.StationDto; -import it.bz.idm.bdp.dto.StationList; -import it.bz.idm.bdp.json.NonBlockingJSONPusher; -import it.bz.idm.bdp.service.dto.ChargerDtoV2; -import it.bz.idm.bdp.service.dto.ChargingPointsDtoV2; - -@Service -public class ChargePusher extends NonBlockingJSONPusher { - - private static final Logger LOG = LoggerFactory.getLogger(ChargePusher.class); - - private static final String E_CHARGING_PLUG_TYPOLOGY = "EChargingPlug"; - private static final String ORIGIN_KEY = "app_dataOrigin"; - - @Autowired - private Environment env; - - @Override - public String initIntegreenTypology() { - return "EChargingStation"; - } - - private static final List EMOBILTYTYPES = new ArrayList() { - private static final long serialVersionUID = 1L; - - { - add(new DataTypeDto( - "number-available", - "", - "number of available vehicles / charging points", "Instantaneous")); - add(new DataTypeDto( - "echarging-plug-status", - "", - "the state can either be 0, which means that the plug is currently not available, or it can be 1 which means it is", - "")); - } - }; - - public StationList mapStations2bdp(List fetchedStations) { - StationList stations = new StationList(); - String origin = env.getProperty(ORIGIN_KEY); - for (ChargerDtoV2 dto : fetchedStations) { - - if ("REMOVED".equals(dto.getState())) - continue; - - StationDto s = new StationDto(); - s.setId(dto.getId()); - s.setLongitude(dto.getLongitude()); - s.setLatitude(dto.getLatitude()); - s.setName(getName(dto)); - s.getMetaData().put("city", dto.getPosition().getCity()); - s.getMetaData().put("provider", dto.getProvider()); - s.getMetaData().put("capacity", dto.getChargingPoints().size()); - s.getMetaData().put("state", dto.getState()); - s.getMetaData().put("accessInfo", dto.getAccessInfo()); - s.getMetaData().put("flashInfo", dto.getFlashInfo()); - s.getMetaData().put("locationServiceInfo", dto.getLocationServiceInfo()); - s.getMetaData().put("paymentInfo", dto.getPaymentInfo()); - s.getMetaData().put("address", dto.getAddress()); - s.getMetaData().put("reservable", dto.getIsReservable()); - s.getMetaData().put("accessType", dto.getAccessType()); - s.getMetaData().put("categories", dto.getCategories()); - s.setOrigin(origin); - s.setStationType(this.integreenTypology); - if (s.isValid()) { - stations.add(s); - } else { - LOG.warn("Invalid StationDto (chargers) skipped: {}", s); - } - } - return stations; - } - - public StationList mapPlugsStations2Bdp(List fetchedStations) { - if (fetchedStations == null) - return null; - StationList stations = new StationList(); - String origin = env.getProperty(ORIGIN_KEY); - for (ChargerDtoV2 dto : fetchedStations) { - for (ChargingPointsDtoV2 point : dto.getChargingPoints()) { - StationDto s = new StationDto(); - s.setId(dto.getId() + "-" + point.getOutlets().get(0).getId()); - s.setLongitude(dto.getLongitude()); - s.setLatitude(dto.getLatitude()); - s.setName(getName(dto) + "-" + point.getId()); - s.setParentStation(dto.getCode()); - s.getMetaData().put("outlets", point.getOutlets()); - s.setOrigin(origin); - s.setStationType(E_CHARGING_PLUG_TYPOLOGY); - if (s.isValid()) { - stations.add(s); - } else { - LOG.warn("Invalid StationDto (plugs) skipped: {}", s); - } - } - } - return stations; - } - - @Override - public DataMapDto mapData(T rawData) { - if (rawData == null) - return null; - - @SuppressWarnings("unchecked") - List data = (List) rawData; - DataMapDto map = new DataMapDto<>(); - Date now = new Date(); - Integer period = env.getProperty("app_period", Integer.class); - for (ChargerDtoV2 dto : data) { - - if ("REMOVED".equals(dto.getState())) - continue; - - DataMapDto recordsByType = new DataMapDto<>(); - Integer availableStations = 0; - for (ChargingPointsDtoV2 point : dto.getChargingPoints()) { - if (point.getState() != null && point.getState().equals("AVAILABLE")) - availableStations++; - } - List records = new ArrayList<>(); - SimpleRecordDto rec = new SimpleRecordDto(now.getTime(), availableStations.doubleValue(), period); - records.add(rec); - recordsByType.getBranch().put(DataTypeDto.NUMBER_AVAILABE, new DataMapDto<>(records)); - map.getBranch().put(dto.getId(), recordsByType); - } - return map; - } - - public DataMapDto mapPlugData2Bdp(List data) { - if (data == null) - return null; - Integer period = env.getProperty("app_period", Integer.class); - - DataMapDto map = new DataMapDto<>(); - Date now = new Date(); - for (ChargerDtoV2 dto : data) { - - if ("REMOVED".equals(dto.getState())) - continue; - - for (ChargingPointsDtoV2 point : dto.getChargingPoints()) { - if (point.getState() != null) { - DataMapDto recordsByType = new DataMapDto<>(); - List records = new ArrayList<>(); - SimpleRecordDto rec = new SimpleRecordDto(); - rec.setTimestamp(now.getTime()); - rec.setValue(point.getState().equals("AVAILABLE") ? 1. : 0.); - rec.setPeriod(period); - records.add(rec); - recordsByType.getBranch().put("echarging-plug-status", new DataMapDto<>(records)); - map.getBranch().put(dto.getId() + "-" + point.getOutlets().get(0).getId(), recordsByType); - } - } - } - return map; - } - - public List getDataTypes() { - return EMOBILTYTYPES; - } - - @Override - public ProvenanceDto defineProvenance() { - return new ProvenanceDto(null, env.getProperty("provenance_name"), env.getProperty("provenance_version"), - env.getProperty(ORIGIN_KEY)); - } - - /** - * Returns the id as name, if name is null or empty - * - * @param dto - * @return - */ - private String getName(ChargerDtoV2 dto) { - return (dto.getName() == null || dto.getName().isEmpty()) ? dto.getId() - : dto.getName(); - } -} diff --git a/data-collectors/emobility-echarging/src/main/java/it/bz/idm/bdp/service/DataRetrieverAPIV2.java b/data-collectors/emobility-echarging/src/main/java/it/bz/idm/bdp/service/DataRetrieverAPIV2.java deleted file mode 100644 index b691421f5..000000000 --- a/data-collectors/emobility-echarging/src/main/java/it/bz/idm/bdp/service/DataRetrieverAPIV2.java +++ /dev/null @@ -1,99 +0,0 @@ -// SPDX-FileCopyrightText: NOI Techpark -// -// SPDX-License-Identifier: AGPL-3.0-or-later - -package it.bz.idm.bdp.service; - -import java.io.IOException; -import java.io.InputStream; -import java.io.StringWriter; -import java.nio.charset.StandardCharsets; -import java.util.List; - -import javax.annotation.PostConstruct; - -import org.apache.commons.io.IOUtils; -import org.apache.http.HttpHost; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.protocol.HttpClientContext; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClientBuilder; -import org.apache.http.impl.client.HttpClients; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.PropertySource; -import org.springframework.core.env.Environment; -import org.springframework.stereotype.Component; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.ObjectMapper; - -import it.bz.idm.bdp.service.dto.ChargerDtoV2; - -@Component -@PropertySource({ "classpath:/META-INF/spring/application.properties" }) -public class DataRetrieverAPIV2 { - - private static final Logger LOG = LoggerFactory.getLogger(DataRetrieverAPIV2.class); - - private HttpClientBuilder builder = HttpClients.custom(); - private CloseableHttpClient client; - private HttpClientContext localContext; - private HttpHost endPoint; - private ObjectMapper mapper = new ObjectMapper(); - - @Autowired - private Environment env; - - @PostConstruct - private void initClient() { - if (client == null) { - endPoint = new HttpHost(env.getRequiredProperty("endpoint_host"), - env.getProperty("endpoint_port", Integer.class, 443), - ("yes").equals(env.getProperty("endpoint_ssl")) ? "https" : "http"); - localContext = HttpClientContext.create(); - client = builder.build(); - } - } - - private String fetchResponseEntity(String path) { - HttpGet get = new HttpGet(path); - String xcallerHeader = env.getProperty("app_callerId"); - String apikey = env.getProperty("app_apikey"); - if (xcallerHeader != null) - get.setHeader("X-Caller-ID", xcallerHeader); - if (apikey != null) - get.setHeader("apikey", apikey); - get.setHeader("Accept", "application/json"); - try { - CloseableHttpResponse response = client.execute(endPoint, get, localContext); - InputStream entity = response.getEntity().getContent(); - StringWriter writer = new StringWriter(); - IOUtils.copy(entity, writer, StandardCharsets.UTF_8); - String data = writer.toString(); - response.close(); - return data; - } catch (IOException e) { - LOG.error("error occurred during fetching stations with message: {}", e.getMessage()); - e.printStackTrace(); - } - return null; - } - - public List fetchStations() { - List stations; - - String responseEntity = fetchResponseEntity(env.getProperty("endpoint_path")); - try { - stations = mapper.readValue(responseEntity, new TypeReference>() { - }); - return stations; - } catch (IOException e) { - LOG.error("error occurred during mapping stations with message: {}", e.getMessage()); - e.printStackTrace(); - } - return null; - } -} diff --git a/data-collectors/emobility-echarging/src/main/java/it/bz/idm/bdp/service/PushScheduler.java b/data-collectors/emobility-echarging/src/main/java/it/bz/idm/bdp/service/PushScheduler.java deleted file mode 100644 index 0a5980311..000000000 --- a/data-collectors/emobility-echarging/src/main/java/it/bz/idm/bdp/service/PushScheduler.java +++ /dev/null @@ -1,104 +0,0 @@ -// SPDX-FileCopyrightText: NOI Techpark -// -// SPDX-License-Identifier: AGPL-3.0-or-later - -package it.bz.idm.bdp.service; - -import java.util.List; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import it.bz.idm.bdp.dto.DataMapDto; -import it.bz.idm.bdp.dto.DataTypeDto; -import it.bz.idm.bdp.dto.RecordDtoImpl; -import it.bz.idm.bdp.dto.StationList; -import it.bz.idm.bdp.service.dto.ChargerDtoV2; - -@Service -public class PushScheduler { - - private static final Logger LOG = LoggerFactory.getLogger(PushScheduler.class); - - private static final int DATA_CHUNK_SIZE = 50; - private static final int STATION_CHUNK_SIZE = 25; - - @Autowired - private DataRetrieverAPIV2 retrieverV2; - - @Autowired - private ChargePusher pusher; - - /** - * Some of these sync scheduled jobs take longer then their re-scheduling, - * so the former call fails or overwrites data that has been half-synced. - * To avoid this we use a single sync call, and put just a single job per - * scheduler. That is the job will not trigger, if it is still running. - */ - public void syncAll() { - syncDataTypes(); - LOG.info("Sync: Fetching from source"); - List fetchedStations = retrieverV2.fetchStations(); - syncStationsV2(fetchedStations); - pushChargerDataV2(fetchedStations); - } - - public void syncStationsV2(List fetchedStations) { - LOG.info("Sync Stations and Plugs"); - - StationList stations = pusher.mapStations2bdp(fetchedStations); - StationList plugs = pusher.mapPlugsStations2Bdp(fetchedStations); - LOG.info( - "Sync Stations and Plugs: Pushing {} stations and {} plugs to the writer", - stations == null ? 0 : stations.size(), - plugs == null ? 0 : plugs.size() - ); - - if (stations != null && plugs != null) { - pusher.syncStations(stations, STATION_CHUNK_SIZE); - pusher.syncStations("EChargingPlug", plugs, STATION_CHUNK_SIZE); - } - - LOG.info("Sync Stations and Plugs: Done"); - } - - - public void pushChargerDataV2(List fetchedStations) { - LOG.info("Sync Charger Data"); - int chunks = (int) Math.ceil((float) fetchedStations.size() / DATA_CHUNK_SIZE); - LOG.info( - "Sync Charger Data: Found {} stations. Splitting into {} chunks of max. {} each!", - fetchedStations.size(), - chunks, - DATA_CHUNK_SIZE - ); - - for (int i = 0; i < chunks; i++) { - // We have the following interval boundaries for subList: [from, to) - int from = DATA_CHUNK_SIZE * i; - int to = from + DATA_CHUNK_SIZE; - if (to > fetchedStations.size()) - to = fetchedStations.size(); - List stationChunk = fetchedStations.subList(from, to); - DataMapDto map = pusher.mapData(stationChunk); - DataMapDto plugRec = pusher.mapPlugData2Bdp(stationChunk); - LOG.info("Sync Charger Data: Pushing to the writer: Chunk {} of {}", i+1, chunks); - if (map != null && plugRec != null){ - pusher.pushData(map); - pusher.pushData("EChargingPlug", plugRec); - } - } - LOG.info("Sync Charger Data: Fetching from source and parsing: Done"); - } - - - public void syncDataTypes() { - List types = pusher.getDataTypes(); - if (types != null){ - pusher.syncDataTypes("EChargingPlug",types); - } - LOG.info("Sync Data Types: DONE!"); - } -} diff --git a/data-collectors/emobility-echarging/src/main/java/it/bz/idm/bdp/service/dto/ChargerDtoV2.java b/data-collectors/emobility-echarging/src/main/java/it/bz/idm/bdp/service/dto/ChargerDtoV2.java deleted file mode 100644 index 35a00cfe7..000000000 --- a/data-collectors/emobility-echarging/src/main/java/it/bz/idm/bdp/service/dto/ChargerDtoV2.java +++ /dev/null @@ -1,172 +0,0 @@ -// SPDX-FileCopyrightText: NOI Techpark -// -// SPDX-License-Identifier: AGPL-3.0-or-later - -package it.bz.idm.bdp.service.dto; - -import java.io.Serializable; -import java.util.List; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; - -@JsonIgnoreProperties(ignoreUnknown = true) -public class ChargerDtoV2 implements Serializable{ - /** - * - */ - private static final long serialVersionUID = -8562182298961356540L; - protected String id; - protected String name; - protected Double latitude; - protected Double longitude; - protected String crs; - private String origin; - private String address; - private String provider; - private String code; - private String model; - private String state; - private boolean isOnline; - private String paymentInfo; - private String accessInfo; - private String accessType; - private String[] categories; - private String flashInfo; - private String locationServiceInfo; - private Boolean isReservable; - private ChargingPositionDto position; - private List chargingPoints; - public String getProvider() { - return provider; - } - public void setProvider(String provider) { - this.provider = provider; - } - public String getCode() { - return code; - } - public void setCode(String code) { - this.code = code; - this.id = code; - } - public String getModel() { - return model; - } - public void setModel(String model) { - this.model = model; - } - public String getState() { - return state; - } - public void setState(String state) { - this.state = state; - } - public boolean getIsOnline() { - return isOnline; - } - public void setIsOnline(boolean isOnline) { - this.isOnline = isOnline; - } - public String getPaymentInfo() { - return paymentInfo; - } - public void setPaymentInfo(String paymentInfo) { - this.paymentInfo = paymentInfo; - } - public String getAccessInfo() { - return accessInfo; - } - public void setAccessInfo(String accessInfo) { - this.accessInfo = accessInfo; - } - public String getFlashInfo() { - return flashInfo; - } - public void setFlashInfo(String flashInfo) { - this.flashInfo = flashInfo; - } - public String getLocationServiceInfo() { - return locationServiceInfo; - } - public void setLocationServiceInfo(String locationServiceInfo) { - this.locationServiceInfo = locationServiceInfo; - } - public Boolean getIsReservable() { - return isReservable; - } - public void setIsReservable(Boolean isReservable) { - this.isReservable = isReservable; - } - public ChargingPositionDto getPosition() { - return position; - } - public void setPosition(ChargingPositionDto position) { - this.position = position; - this.longitude = this.position.getLongitude(); - this.latitude = this.position.getLatitude(); - this.address = this.position.getAddress(); - } - public List getChargingPoints() { - return chargingPoints; - } - public void setChargingPoints(List chargingPoints) { - this.chargingPoints = chargingPoints; - } - public String getAddress() { - return address; - } - public String getId() { - return id; - } - public void setId(String id) { - this.id = id; - } - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - public Double getLatitude() { - return latitude; - } - public void setLatitude(Double latitude) { - this.latitude = latitude; - } - public Double getLongitude() { - return longitude; - } - public void setLongitude(Double longitude) { - this.longitude = longitude; - } - public String getCrs() { - return crs; - } - public void setCrs(String crs) { - this.crs = crs; - } - public String getOrigin() { - return origin; - } - public void setOrigin(String origin) { - this.origin = origin; - } - public void setAddress(String address) { - this.address = address; - } - public void setOnline(boolean isOnline) { - this.isOnline = isOnline; - } - public String[] getCategories() { - return categories; - } - public void setCategories(String[] categories) { - this.categories = categories; - } - public String getAccessType() { - return accessType; - } - public void setAccessType(String accessType) { - this.accessType = accessType; - } -} diff --git a/data-collectors/emobility-echarging/src/main/java/it/bz/idm/bdp/service/dto/ChargingPointsDtoV2.java b/data-collectors/emobility-echarging/src/main/java/it/bz/idm/bdp/service/dto/ChargingPointsDtoV2.java deleted file mode 100644 index 24404a5e5..000000000 --- a/data-collectors/emobility-echarging/src/main/java/it/bz/idm/bdp/service/dto/ChargingPointsDtoV2.java +++ /dev/null @@ -1,41 +0,0 @@ -// SPDX-FileCopyrightText: NOI Techpark -// -// SPDX-License-Identifier: AGPL-3.0-or-later - -package it.bz.idm.bdp.service.dto; - -import java.util.List; - -public class ChargingPointsDtoV2 { - private String id; - private String state; - private String rechargeState; - private List outlets; - - public String getId() { - return id; - } - public void setId(String id) { - this.id = id; - } - public String getState() { - return state; - } - public void setState(String state) { - this.state = state; - } - public String getRechargeState() { - return rechargeState; - } - public void setRechargeState(String rechargeState) { - this.rechargeState = rechargeState; - } - public List getOutlets() { - return outlets; - } - public void setOutlets(List outlets) { - this.outlets = outlets; - } - - -} diff --git a/data-collectors/emobility-echarging/src/main/java/it/bz/idm/bdp/service/dto/ChargingPositionDto.java b/data-collectors/emobility-echarging/src/main/java/it/bz/idm/bdp/service/dto/ChargingPositionDto.java deleted file mode 100644 index 08bb40dbf..000000000 --- a/data-collectors/emobility-echarging/src/main/java/it/bz/idm/bdp/service/dto/ChargingPositionDto.java +++ /dev/null @@ -1,52 +0,0 @@ -// SPDX-FileCopyrightText: NOI Techpark -// -// SPDX-License-Identifier: AGPL-3.0-or-later - -package it.bz.idm.bdp.service.dto; - -public class ChargingPositionDto { - private Double latitude; - private Double longitude; - private String address; - private String postalCode; - private String city; - private String country; - public Double getLatitude() { - return latitude; - } - public void setLatitude(Double latitude) { - this.latitude = latitude; - } - public Double getLongitude() { - return longitude; - } - public void setLongitude(Double longitude) { - this.longitude = longitude; - } - public String getAddress() { - return address; - } - public void setAddress(String address) { - this.address = address; - } - public String getPostalCode() { - return postalCode; - } - public void setPostalCode(String postalCode) { - this.postalCode = postalCode; - } - public String getCity() { - return city; - } - public void setCity(String city) { - this.city = city; - } - public String getCountry() { - return country; - } - public void setCountry(String country) { - this.country = country; - } - - -} diff --git a/data-collectors/emobility-echarging/src/main/java/it/bz/idm/bdp/service/dto/ChildPlugDto.java b/data-collectors/emobility-echarging/src/main/java/it/bz/idm/bdp/service/dto/ChildPlugDto.java deleted file mode 100644 index 90fa47143..000000000 --- a/data-collectors/emobility-echarging/src/main/java/it/bz/idm/bdp/service/dto/ChildPlugDto.java +++ /dev/null @@ -1,35 +0,0 @@ -// SPDX-FileCopyrightText: NOI Techpark -// -// SPDX-License-Identifier: AGPL-3.0-or-later - -package it.bz.idm.bdp.service.dto; - -import java.util.ArrayList; -import java.util.List; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; - -import it.bz.idm.bdp.dto.ChildDto; - -@JsonInclude(value=Include.NON_EMPTY) -public class ChildPlugDto extends ChildDto{ - /** - * - */ - private static final long serialVersionUID = -7467402590346607912L; - private List outlets = new ArrayList<>(); - private boolean available; - public List getOutlets() { - return outlets; - } - public void setOutlets(List outlets) { - this.outlets = outlets; - } - public boolean isAvailable() { - return available; - } - public void setAvailable(boolean available) { - this.available = available; - } -} diff --git a/data-collectors/emobility-echarging/src/main/java/it/bz/idm/bdp/service/dto/OutletDtoV2.java b/data-collectors/emobility-echarging/src/main/java/it/bz/idm/bdp/service/dto/OutletDtoV2.java deleted file mode 100644 index 29439c7d6..000000000 --- a/data-collectors/emobility-echarging/src/main/java/it/bz/idm/bdp/service/dto/OutletDtoV2.java +++ /dev/null @@ -1,63 +0,0 @@ -// SPDX-FileCopyrightText: Copyright © 2018 IDM Südtirol - Alto Adige (info@idm-suedtirol.com) -// -// SPDX-License-Identifier: GPL-3.0-only - -package it.bz.idm.bdp.service.dto; - -import java.io.Serializable; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; - -@JsonInclude(value=Include.NON_EMPTY) -@JsonIgnoreProperties(ignoreUnknown=true) -public class OutletDtoV2 implements Serializable{ - /** - * - */ - private static final long serialVersionUID = -1925244922468895580L; - private String id; - private String outletTypeCode; - private Double minCurrent; - private Double maxCurrent; - private Double maxPower; - private Boolean hasFixedCable; - - public String getId() { - return id; - } - public void setId(String id) { - this.id = id; - } - public String getOutletTypeCode() { - return outletTypeCode; - } - public void setOutletTypeCode(String outletTypeCode) { - this.outletTypeCode = outletTypeCode; - } - public Double getMinCurrent() { - return minCurrent; - } - public void setMinCurrent(Double minCurrent) { - this.minCurrent = minCurrent; - } - public Double getMaxCurrent() { - return maxCurrent; - } - public void setMaxCurrent(Double maxCurrent) { - this.maxCurrent = maxCurrent; - } - public Double getMaxPower() { - return maxPower; - } - public void setMaxPower(Double maxPower) { - this.maxPower = maxPower; - } - public Boolean getHasFixedCable() { - return hasFixedCable; - } - public void setHasFixedCable(Boolean hasFixedCable) { - this.hasFixedCable = hasFixedCable; - } -} diff --git a/data-collectors/emobility-echarging/src/main/resources/META-INF/spring/application.properties b/data-collectors/emobility-echarging/src/main/resources/META-INF/spring/application.properties deleted file mode 100644 index 07c6551dc..000000000 --- a/data-collectors/emobility-echarging/src/main/resources/META-INF/spring/application.properties +++ /dev/null @@ -1,7 +0,0 @@ -endpoint_host= -endpoint_port= -endpoint_ssl=yes -endpoint_path= -app_callerId= -app_dataOrigin= -app_period= diff --git a/data-collectors/emobility-echarging/src/main/resources/META-INF/spring/applicationContext.xml b/data-collectors/emobility-echarging/src/main/resources/META-INF/spring/applicationContext.xml deleted file mode 100644 index 99b02761c..000000000 --- a/data-collectors/emobility-echarging/src/main/resources/META-INF/spring/applicationContext.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/data-collectors/emobility-echarging/src/main/resources/logback.xml b/data-collectors/emobility-echarging/src/main/resources/logback.xml deleted file mode 100644 index 898db3b34..000000000 --- a/data-collectors/emobility-echarging/src/main/resources/logback.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - [ignore] - [ignore] - [ignore] - - {"application":"${provenance_name:-DCTEST}","application_version":"${provenance_version:-0000}"} - - - - - - %d{HH:mm:ss.SSS} %-5level %logger{36} - %msg%n - - - - - - - - diff --git a/data-collectors/emobility-echarging/src/main/webapp/WEB-INF/spring/webmvc-config.xml b/data-collectors/emobility-echarging/src/main/webapp/WEB-INF/spring/webmvc-config.xml deleted file mode 100644 index cb3d0c7ca..000000000 --- a/data-collectors/emobility-echarging/src/main/webapp/WEB-INF/spring/webmvc-config.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/data-collectors/emobility-echarging/src/main/webapp/WEB-INF/web.xml b/data-collectors/emobility-echarging/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index c88e2fed4..000000000 --- a/data-collectors/emobility-echarging/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - chargeds - Roo generated chargeds application - - defaultHtmlEscape - true - - - contextConfigLocation - classpath*:META-INF/spring/applicationContext*.xml - - - CharacterEncodingFilter - org.springframework.web.filter.CharacterEncodingFilter - - encoding - UTF-8 - - - forceEncoding - true - - - - spring.liveBeansView.mbeanDomain - dev - - - HttpMethodFilter - org.springframework.web.filter.HiddenHttpMethodFilter - - - CharacterEncodingFilter - /* - - - HttpMethodFilter - /* - - - org.springframework.web.context.ContextLoaderListener - - - chargeds - org.springframework.web.servlet.DispatcherServlet - - contextConfigLocation - WEB-INF/spring/webmvc-config.xml - - 1 - - - chargeds - / - - - 10 - - - java.lang.Exception - /uncaughtException - - - 404 - /resourceNotFound - - \ No newline at end of file diff --git a/data-collectors/emobility-echarging/src/test/java/it/bz/idm/bdp/EndpointIT.java b/data-collectors/emobility-echarging/src/test/java/it/bz/idm/bdp/EndpointIT.java deleted file mode 100644 index 1ed5ec236..000000000 --- a/data-collectors/emobility-echarging/src/test/java/it/bz/idm/bdp/EndpointIT.java +++ /dev/null @@ -1,40 +0,0 @@ -// SPDX-FileCopyrightText: NOI Techpark -// -// SPDX-License-Identifier: AGPL-3.0-or-later - -package it.bz.idm.bdp; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.io.IOException; -import java.util.List; - -import org.junit.Test; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests; - -import it.bz.idm.bdp.service.DataRetrieverAPIV2; -import it.bz.idm.bdp.service.dto.ChargerDtoV2; - -@ContextConfiguration(locations = { "classpath:/META-INF/spring/applicationContext.xml" }) -public class EndpointIT extends AbstractJUnit4SpringContextTests{ - - @Autowired - public DataRetrieverAPIV2 retriever; - - - @Test - public void testFetchStations() { - List data = retriever.fetchStations(); - assertNotNull(data); - assertTrue(data.size()>0); - assertNotNull(data.get(0).getId()); - assertFalse(data.get(0).getId().isEmpty()); - assertFalse(data.get(0).getChargingPoints().isEmpty()); - assertFalse(data.get(0).getChargingPoints().get(0).getOutlets().isEmpty()); - } - -} diff --git a/data-collectors/emobility-echarging/src/test/java/it/bz/idm/bdp/PusherTestIT.java b/data-collectors/emobility-echarging/src/test/java/it/bz/idm/bdp/PusherTestIT.java deleted file mode 100644 index eb18aac18..000000000 --- a/data-collectors/emobility-echarging/src/test/java/it/bz/idm/bdp/PusherTestIT.java +++ /dev/null @@ -1,114 +0,0 @@ -// SPDX-FileCopyrightText: NOI Techpark -// -// SPDX-License-Identifier: AGPL-3.0-or-later - -package it.bz.idm.bdp; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.junit.Before; -import org.junit.Test; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests; - -import it.bz.idm.bdp.dto.DataMapDto; -import it.bz.idm.bdp.dto.DataTypeDto; -import it.bz.idm.bdp.dto.RecordDtoImpl; -import it.bz.idm.bdp.dto.SimpleRecordDto; -import it.bz.idm.bdp.dto.StationDto; -import it.bz.idm.bdp.dto.StationList; -import it.bz.idm.bdp.service.ChargePusher; -import it.bz.idm.bdp.service.dto.ChargerDtoV2; -import it.bz.idm.bdp.service.dto.ChargingPointsDtoV2; -import it.bz.idm.bdp.service.dto.ChargingPositionDto; -import it.bz.idm.bdp.service.dto.OutletDtoV2; - -@ContextConfiguration(locations = { "classpath:/META-INF/spring/applicationContext.xml" }) -public class PusherTestIT extends AbstractJUnit4SpringContextTests{ - - @Autowired - private ChargePusher pusher; - - private List charger = null; - - @Before - public void setup() { - charger = new ArrayList(); - ChargerDtoV2 o = new ChargerDtoV2(); - o.setCode("thisisacode"); - o.setCategories(new String[] {"hey","to"}); - o.setAccessType("Got to know"); - o.setAccessInfo("Kind of accessInfo"); - o.setIsOnline(true); - ChargingPositionDto position = new ChargingPositionDto(); - position.setCity("Chicago"); - position.setAddress("Baverlz 23"); - position.setCountry("usa"); - o.setPosition(position); - o.setIsReservable(false); - o.setLatitude(45.2313); - o.setLongitude(42.2313); - o.setModel("TESLA"); - o.setPaymentInfo("INfo for payment"); - o.setProvider("Patrick"); - o.setOrigin("Unknown"); - o.setName("Hello world"); - List chargingPoints = new ArrayList<>(); - ChargingPointsDtoV2 cp = new ChargingPointsDtoV2(); - cp.setId("huibu"); - cp.setRechargeState("ACTIVE"); - cp.setState("ACTIVE"); - List outlets = new ArrayList<>(); - OutletDtoV2 out = new OutletDtoV2(); - out.setHasFixedCable(true); - out.setId("yeah"); - out.setMaxCurrent(20.5); - out.setMinCurrent(1.); - out.setMaxPower(2000.); - out.setOutletTypeCode("Outlettype"); - outlets.add(out); - cp.setOutlets(outlets); - chargingPoints.add(cp); - o.setChargingPoints(chargingPoints); - charger.add(o); - - } - @Test - public void testMappingData(){ - DataMapDto parseData = pusher.mapData(charger); - assertNotNull(parseData); - for(Map.Entry> entry: parseData.getBranch().entrySet()) { - DataMapDto dataMapDto = entry.getValue().getBranch().get(DataTypeDto.NUMBER_AVAILABE); - assertNotNull(dataMapDto); - assertNotNull(dataMapDto.getData()); - assertFalse(dataMapDto.getData().isEmpty()); - RecordDtoImpl recordDtoImpl = dataMapDto.getData().get(0); - assertNotNull(recordDtoImpl); - assertTrue(recordDtoImpl instanceof SimpleRecordDto); - SimpleRecordDto dto = (SimpleRecordDto) recordDtoImpl; - assertNotNull(dto.getTimestamp()); - assertNotNull(dto.getValue()); - } - } - @Test - public void testMappingStations() { - StationList stationList = pusher.mapStations2bdp(charger); - assertFalse(stationList.isEmpty()); - assertNotNull(stationList.get(0)); - assertTrue(stationList.get(0) instanceof StationDto); - StationDto eStation= stationList.get(0); - - assertEquals(new Double(42.2313) , eStation.getLongitude()); - assertEquals(new Double(45.2313) , eStation.getLatitude()); - assertEquals("thisisacode",eStation.getId()); - - } -} diff --git a/data-collectors/emobility-echarging/src/test/resources/META-INF/spring/application.properties b/data-collectors/emobility-echarging/src/test/resources/META-INF/spring/application.properties deleted file mode 100644 index 4b6d00d42..000000000 --- a/data-collectors/emobility-echarging/src/test/resources/META-INF/spring/application.properties +++ /dev/null @@ -1,9 +0,0 @@ -endpoint_host=fakehost.com -endpoint_port=80 -endpoint_ssl=no -endpoint_path=/heeee -app_callerId=noi -app_dataOrigin=test -app_period=300 -provenance.name=dc- -provenance.version=1.0.0-SNAPSHOT diff --git a/data-collectors/emobility-echarging/src/test/resources/META-INF/spring/applicationContext.xml b/data-collectors/emobility-echarging/src/test/resources/META-INF/spring/applicationContext.xml deleted file mode 100644 index 659d51093..000000000 --- a/data-collectors/emobility-echarging/src/test/resources/META-INF/spring/applicationContext.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - diff --git a/data-collectors/emobility-echarging/src/test/resources/META-INF/spring/types.properties b/data-collectors/emobility-echarging/src/test/resources/META-INF/spring/types.properties deleted file mode 100644 index aba7046ef..000000000 --- a/data-collectors/emobility-echarging/src/test/resources/META-INF/spring/types.properties +++ /dev/null @@ -1 +0,0 @@ -plug.status.available=AVAILABLE \ No newline at end of file diff --git a/data-collectors/emobility-echarging/src/test/resources/log4j.properties b/data-collectors/emobility-echarging/src/test/resources/log4j.properties deleted file mode 100644 index abe3ff622..000000000 --- a/data-collectors/emobility-echarging/src/test/resources/log4j.properties +++ /dev/null @@ -1,10 +0,0 @@ -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.rootLogger=DEBUG, stdout -log4j.appender.R.File=emobility-dc.log -log4j.appender.R.MaxFileSize=10000KB -log4j.appender.R.layout=org.apache.log4j.PatternLayout -log4j.appender.R.MaxBackupIndex=1 -log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n -log4j.appender.stdout.layout.ConversionPattern=%d [%t] %-5p %c - %m%n -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.R=org.apache.log4j.RollingFileAppender