diff --git a/.github/workflows/build-project.yml b/.github/workflows/build-project.yml index 9ae5a4e6..0102128f 100644 --- a/.github/workflows/build-project.yml +++ b/.github/workflows/build-project.yml @@ -21,19 +21,13 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Cache Docker Register uses: actions/cache@v3 with: path: /tmp/.buildx-cache key: ${{ runner.os }}-buildx-${{ hashFiles('**/Dockerfile') }} - - name: Cache Maven packages - uses: actions/cache@v3 - with: - path: ~/.m2 - key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} - restore-keys: ${{ runner.os }}-m2 - name: Set up Docker Buildx id: buildx @@ -43,6 +37,7 @@ jobs: with: distribution: 'zulu' java-version: '17' + cache: 'maven' - name: Create custom Maven Settings.xml uses: whelk-io/maven-settings-xml-action@v21 diff --git a/.github/workflows/release-project.yml b/.github/workflows/release-project.yml index 7b2d3c3e..a8422e7e 100644 --- a/.github/workflows/release-project.yml +++ b/.github/workflows/release-project.yml @@ -16,19 +16,13 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Cache Docker Register uses: actions/cache@v3 with: path: /tmp/.buildx-cache key: ${{ runner.os }}-buildx-${{ hashFiles('**/Dockerfile') }} - - name: Cache Maven packages - uses: actions/cache@v3 - with: - path: ~/.m2 - key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} - restore-keys: ${{ runner.os }}-m2 - name: Extract tag name id: extract_tagname @@ -41,11 +35,12 @@ jobs: with: distribution: 'zulu' java-version: '17' + cache: 'maven' - name: Set up Docker Buildx id: buildx uses: docker/setup-buildx-action@v3 - name: Login to Docker Hub - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKER_HUB_USERNAME }} password: ${{ secrets.DOCKER_HUB_TOKEN }} diff --git a/.github/workflows/reuse.yml b/.github/workflows/reuse.yml index aff58480..b89fda98 100644 --- a/.github/workflows/reuse.yml +++ b/.github/workflows/reuse.yml @@ -11,6 +11,6 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: REUSE Compliance Check uses: fsfe/reuse-action@v2 diff --git a/.github/workflows/sonarcloud-analysis.yml b/.github/workflows/sonarcloud-analysis.yml index c0364192..a2141b7f 100644 --- a/.github/workflows/sonarcloud-analysis.yml +++ b/.github/workflows/sonarcloud-analysis.yml @@ -40,7 +40,7 @@ jobs: full_name: ${{ github.event.repository.full_name }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: ${{ github.event.workflow_run.head_repository.full_name }} ref: ${{ github.event.workflow_run.head_branch }} @@ -59,6 +59,7 @@ jobs: path: ~/.sonar/cache key: ${{ runner.os }}-sonar restore-keys: ${{ runner.os }}-sonar + - name: Cache Maven packages uses: actions/cache@v3 with: @@ -71,7 +72,6 @@ jobs: with: distribution: 'zulu' java-version: '17' - - name: Set Common Sonar Variables id: sonar_env run: | diff --git a/.github/workflows/sonarcloud-build.yml b/.github/workflows/sonarcloud-build.yml index 58e78fcd..7228a740 100644 --- a/.github/workflows/sonarcloud-build.yml +++ b/.github/workflows/sonarcloud-build.yml @@ -26,7 +26,7 @@ jobs: if: ${{ (github.event_name != 'pull_request_target' && github.actor != 'dependabot[bot]') || (github.actor == 'dependabot[bot]' && github.event_name == 'pull_request_target') }} steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 diff --git a/README.md b/README.md index 7a2caa06..24f65332 100644 --- a/README.md +++ b/README.md @@ -19,10 +19,8 @@ parts of this repository can also be used separately in your own component to ma Service Layer can be used as Java component to manage them. For more information about the architecture go to [documentation](doc/compas-scl-data-service.md). -There are currently two database implementations available. +There is currently one database implementations available. -- For more development information about the BaseX Implementation go to [BaseX](doc/basex.md). (Profile activated by - default.) - For more development information about the PostgreSQL Implementation go to [PostgreSQL](doc/postgresql.md). > **Note:** When switching between implementation it's a good practise to first execute a maven clean to remove diff --git a/app/pom.xml b/app/pom.xml index 1f637c31..dcb9525e 100644 --- a/app/pom.xml +++ b/app/pom.xml @@ -31,10 +31,6 @@ SPDX-License-Identifier: Apache-2.0 org.lfenergy.compas.scl.data repository - - org.lfenergy.compas.scl.data - repository-basex - org.lfenergy.compas.scl.data repository-postgresql @@ -171,28 +167,8 @@ SPDX-License-Identifier: Apache-2.0 generate-code-tests - - build-basex - - build - - - - prod-basex - basex-quarkus-app - src/main/docker/Dockerfile-basex.jvm - - src/main/docker/Dockerfile-basex.native - - ${project.version}-basex - latest-basex - - - - build-postgresql @@ -285,23 +261,6 @@ SPDX-License-Identifier: Apache-2.0 maven-failsafe-plugin ${surefire-plugin.version} - - integration-test-basex - - integration-test - verify - - - - - ${project.build.directory}/basex-quarkus-app/${project.build.finalName}-runner - - org.jboss.logmanager.LogManager - - ${maven.home} - - - diff --git a/app/src/main/resources/application-dev-basex.properties b/app/src/main/resources/application-dev-basex.properties deleted file mode 100644 index 7bb9b600..00000000 --- a/app/src/main/resources/application-dev-basex.properties +++ /dev/null @@ -1,32 +0,0 @@ -# SPDX-FileCopyrightText: 2021 Alliander N.V. -# -# SPDX-License-Identifier: Apache-2.0 - -# Development BaseX configuration. -quarkus.http.port = 9090 -quarkus.http.cors = true - -# Dev Logging -quarkus.log.level = DEBUG -quarkus.log.category."org.lfenergy.compas.scl.data".level = DEBUG - -# Dev extra permissions -quarkus.http.auth.permission.develop-quarkus-services.paths = /compas-scl-data-service/q/swagger-ui/*,/compas-scl-data-service/index.html -quarkus.http.auth.permission.develop-quarkus-services.policy = permit - -# Exclude the other repository implementations from being scanned -quarkus.arc.exclude-dependency.postgresql-repository.group-id = org.lfenergy.compas.scl.data -quarkus.arc.exclude-dependency.postgresql-repository.artifact-id = repository-postgresql - -# Datasource configuration for BaseX (none) -quarkus.datasource.jdbc = false -quarkus.datasource.devservices.enabled = false - -# Flyway configuration for BaseX (none) -quarkus.flyway.migrate-at-start = false - -# BaseX configuration -basex.host = localhost -basex.port = 1984 -basex.username = admin -basex.password = admin diff --git a/app/src/main/resources/application-dev-postgresql.properties b/app/src/main/resources/application-dev-postgresql.properties index 8d2e80a7..b526c75b 100644 --- a/app/src/main/resources/application-dev-postgresql.properties +++ b/app/src/main/resources/application-dev-postgresql.properties @@ -14,10 +14,6 @@ quarkus.log.category."org.lfenergy.compas.scl.data".level = DEBUG quarkus.http.auth.permission.develop-quarkus-services.paths = /compas-scl-data-service/q/swagger-ui/*,/compas-scl-data-service/index.html quarkus.http.auth.permission.develop-quarkus-services.policy = permit -# Exclude the other repository implementations from being scanned -quarkus.arc.exclude-dependency.basex-repository.group-id = org.lfenergy.compas.scl.data -quarkus.arc.exclude-dependency.basex-repository.artifact-id = repository-basex - # Datasource configuration for PostgreSQL quarkus.datasource.devservices.enabled = false quarkus.datasource.db-kind = postgresql diff --git a/app/src/main/resources/application-prod-basex.properties b/app/src/main/resources/application-prod-basex.properties deleted file mode 100644 index 0d81f53f..00000000 --- a/app/src/main/resources/application-prod-basex.properties +++ /dev/null @@ -1,25 +0,0 @@ -# SPDX-FileCopyrightText: 2021 Alliander N.V. -# -# SPDX-License-Identifier: Apache-2.0 - -# Production BaseX configuration. - -# Exclude the other repository implementations from being scanned -quarkus.arc.exclude-dependency.postgresql-repository.group-id = org.lfenergy.compas.scl.data -quarkus.arc.exclude-dependency.postgresql-repository.artifact-id = repository-postgresql - -# Add scanning these dependencies for scanning, also used by native compilation. -quarkus.index-dependency.basex-repository.group-id = org.lfenergy.compas.scl.data -quarkus.index-dependency.basex-repository.artifact-id = repository-basex - -# Datasource configuration for BaseX (none) -quarkus.datasource.jdbc = false - -# Flyway configuration for BaseX (none) -quarkus.flyway.migrate-at-start = false - -# BaseX configuration -basex.host = localhost -basex.port = 1984 -basex.username = admin -basex.password = admin diff --git a/app/src/main/resources/application-prod-postgresql.properties b/app/src/main/resources/application-prod-postgresql.properties index 79642385..ba6516ac 100644 --- a/app/src/main/resources/application-prod-postgresql.properties +++ b/app/src/main/resources/application-prod-postgresql.properties @@ -4,10 +4,6 @@ # Production PostgreSQL configuration. -# Exclude the other repository implementations from being scanned -quarkus.arc.exclude-dependency.basex-repository.group-id = org.lfenergy.compas.scl.data -quarkus.arc.exclude-dependency.basex-repository.artifact-id = repository-basex - # Add scanning these dependencies for scanning, also used by native compilation. quarkus.index-dependency.postgresql-repository.group-id = org.lfenergy.compas.scl.data quarkus.index-dependency.postgresql-repository.artifact-id = repository-postgresql diff --git a/app/src/main/resources/application-test.properties b/app/src/main/resources/application-test.properties index 0ddb127d..1dfce47a 100644 --- a/app/src/main/resources/application-test.properties +++ b/app/src/main/resources/application-test.properties @@ -4,10 +4,6 @@ # Test configuration. -# Exclude the other repository implementations from being scanned -quarkus.arc.exclude-dependency.basex-repository.group-id = org.lfenergy.compas.scl.data -quarkus.arc.exclude-dependency.basex-repository.artifact-id = repository-basex - # Datasource configuration for PostgreSQL quarkus.datasource.devservices.enabled = true quarkus.datasource.db-kind = postgresql diff --git a/doc/basex.md b/doc/basex.md deleted file mode 100644 index d60aa557..00000000 --- a/doc/basex.md +++ /dev/null @@ -1,108 +0,0 @@ - - -# BaseX Implementation - -## BaseX Environment variables - -Below environment variable(s) can be used to configure the connection to BaseX, if BaseX Server is used. - -| Environment variable | Java Property | Description | Example | -| -------------------------------- | ------------------------- | --------------------------------------------- | ---------------- | -| BASEX_HOST | basex.host | Name of the Host where BaseX runs. | localhost | -| BASEX_PORT | basex.port | Port on the Host on which BaseX runs. | 1984 | -| BASEX_USERNAME | basex.username | Username under which the application logs in. | admin | -| BASEX_PASSWORD | basex.password | Password of the username used above. | admin | - -## Development - -### Building the application - -You can use Maven to build the application and see if all tests are working using: - -```shell script -./mvnw clean verify -``` - -This should normally be enough to also run the application, but there were cases that we need to build using: - -```shell script -./mvnw clean install -``` - -This to make the local modules available for the app module to run the application. - -### Running the application in dev mode - -You can run your application in dev mode that enables live coding using: - -```shell script -./mvnw -DskipTests=true -Dquarkus.profile=dev-basex package io.quarkus:quarkus-maven-plugin::dev -``` - -#### Application depends on a running BaseX instance - -Check [basexhttp on DockerHub](https://hub.docker.com/r/basex/basexhttp) for a running BaseX docker container. This is -needed when running the SCL Data Service locally. Not needed to run the tests. - -```shell -mkdir -p /data -sudo chown -R 1984:1984 /data - -docker run --rm --name compas_basex \ - -p 1984:1984 \ - -v /data:/srv/basex/data \ - -d basex/basexhttp:latest -``` - -> **Note:** Replace with a directory on your local machine, for instance "~/basex". -> All data will be stored in this directory under "data". This way data isn't lost after stopping the docker container. - -#### Application depends on a running KeyCloak instance - -Beside a BaseX Database there is also a KeyCloak instance need to be running on port 8089 by default. -See [README.md](../README.md#security) for default values, if custom keycloak is used. - -There is a preconfigured keycloak instance available in -the [CoMPAS Deployment Repository](https://github.com/com-pas/compas-deployment). This repository can be cloned and -when going to this directory the following command can be executed to create a local Docker Image with configuration. - -```shell -cd /compas/keycloak -docker build -t compas_keycloak . -``` - -There is now a Docker Image `compas_keycloak` created that can be started using the following command - -```shell -docker run --rm --name compas_keycloak \ - -p 8089:8080 - -d compas_keycloak:latest -``` - -### Creating a Docker image with native executable - -The releases created in the repository will create a docker image with a native executable. If you're running a Linux -system it's possible to create and run the executable locally. You can create a Docker image with native executable -using: - -```shell script -./mvnw package -Pnative-image -``` - -You can then execute your native executable with: `./app/target/basex-quarkus-app/app-local-SNAPSHOT-runner` - -### Creating a Docker image with JVM executable - -There is also a profile to create a Docker Image which runs the application using a JVM. You can create a Docker Image -with JVM executable using: - -```shell script -./mvnw package -Pjvm-image -``` - -The JVM Image can also (temporary) be created by the release action if there are problems creating or running the -native executable. diff --git a/doc/compas-scl-data-service.md b/doc/compas-scl-data-service.md index 760246ac..ab23204a 100644 --- a/doc/compas-scl-data-service.md +++ b/doc/compas-scl-data-service.md @@ -55,15 +55,6 @@ The Service class contains some logic regarding versions and private elements. - delete: Remove (all versions) of the SCL from the storage. Or if the version is passed that specific version of the SCL. -### BaseX - -There a some BaseX specific choices made in storing the SCL. - -- For every type of SCL a separate database is created. This is quite easy done in BaseX. - ![Databases](images/CoMPAS-SclDataService-Databases.png) -- In these databases the SCL will be stored as "\/\/\/\/scl.xml". - This way it will be easy to store the different version and find the latest version. - ### PostgreSQL There a some PostgreSQL choices made in storing the SCL. diff --git a/pom.xml b/pom.xml index 6afa0afe..ff3008ef 100644 --- a/pom.xml +++ b/pom.xml @@ -20,20 +20,19 @@ SPDX-License-Identifier: Apache-2.0 UTF-8 3.11.0 - 3.1.0 + 3.1.2 3.2.0 0.16.0 - 3.4.1 + 3.4.2 - 3.1 + 3.1.1 2.20.0 0.9.1 repository - repository-basex repository-postgresql service app @@ -75,11 +74,6 @@ SPDX-License-Identifier: Apache-2.0 repository ${project.version} - - org.lfenergy.compas.scl.data - repository-basex - ${project.version} - org.lfenergy.compas.scl.data repository-postgresql diff --git a/repository-basex/pom.xml b/repository-basex/pom.xml deleted file mode 100644 index 929add3e..00000000 --- a/repository-basex/pom.xml +++ /dev/null @@ -1,95 +0,0 @@ - - - - 4.0.0 - - org.lfenergy.compas.scl.data - compas-scl-data-service - local-SNAPSHOT - - - repository-basex - jar - - - 9.2.4 - - - - - org.lfenergy.compas.scl.data - repository - - - - commons-io - commons-io - - - - org.eclipse.microprofile.config - microprofile-config-api - - - org.glassfish.jaxb - jaxb-runtime - provided - 4.0.2 - - - - org.apache.logging.log4j - log4j-api - - - org.apache.logging.log4j - log4j-core - provided - - - - - org.lfenergy.compas.scl.data - repository - test-jar - test - - - org.basex - basex - ${basex.version} - test - - - - org.junit.jupiter - junit-jupiter-api - test - - - org.mockito - mockito-junit-jupiter - test - - - org.junit.jupiter - junit-jupiter-engine - test - - - - - - - org.jboss.jandex - jandex-maven-plugin - - - - diff --git a/repository-basex/src/main/java/org/lfenergy/compas/scl/data/basex/client/BaseXClient.java b/repository-basex/src/main/java/org/lfenergy/compas/scl/data/basex/client/BaseXClient.java deleted file mode 100644 index 2d8d6734..00000000 --- a/repository-basex/src/main/java/org/lfenergy/compas/scl/data/basex/client/BaseXClient.java +++ /dev/null @@ -1,462 +0,0 @@ -// SPDX-FileCopyrightText: 2020 Alliander N.V. -// -// SPDX-License-Identifier: Apache-2.0 - -package org.lfenergy.compas.scl.data.basex.client; - -import org.lfenergy.compas.scl.data.exception.CompasSclDataServiceException; - -import java.io.*; -import java.net.InetSocketAddress; -import java.net.Socket; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.util.ArrayList; - -import static java.nio.charset.StandardCharsets.UTF_8; -import static org.lfenergy.compas.scl.data.exception.CompasSclDataServiceErrorCode.BASEX_CLIENT_CREATION_ERROR_CODE; - -/** - * Java client for BaseX. - * Works with BaseX 7.0 and later - *

- * Documentation: https://docs.basex.org/wiki/Clients - *

- * (C) BaseX Team 2005-20, BSD License - */ -public class BaseXClient implements Closeable { - - /** - * Output stream. - */ - private final OutputStream out; - /** - * Input stream (buffered). - */ - private final BufferedInputStream in; - - /** - * Socket. - */ - private final Socket socket; - /** - * Command info. - */ - private String info; - - /** - * Constructor. - * - * @param host server name - * @param port server port - * @param username username - * @param password password - * @throws IOException Exception - */ - public BaseXClient(final String host, final int port, final String username, - final String password) throws IOException { - - socket = new Socket(); - socket.setTcpNoDelay(true); - socket.connect(new InetSocketAddress(host, port), 5000); - in = new BufferedInputStream(socket.getInputStream()); - out = socket.getOutputStream(); - - // receive server response - final String[] response = receive().split(":"); - final String code; - final String nonce; - if (response.length > 1) { - // support for digest authentication - code = username + ':' + response[0] + ':' + password; - nonce = response[1]; - } else { - // support for cram-md5 (Version < 8.0) - code = password; - nonce = response[0]; - } - - send(username); - send(md5(md5(code) + nonce)); - - // receive success flag - if (!ok()) throw new IOException("Access denied."); - } - - /** - * Executes a command and serializes the result to an output stream. - * - * @param command command - * @param output output stream - * @throws IOException Exception - */ - public void execute(final String command, final OutputStream output) throws IOException { - // send {Command}0 - send(command); - receive(in, output); - info = receive(); - if (!ok()) throw new IOException(info); - } - - /** - * Executes a command and returns the result. - * - * @param command command - * @return result - * @throws IOException Exception - */ - public String execute(final String command) throws IOException { - final var os = new ByteArrayOutputStream(); - execute(command, os); - return os.toString(UTF_8); - } - - /** - * Executes a XQuery Command and returns the result. - * - * @param xqueryCommand command - * @return result - * @throws IOException Exception - */ - public String executeXQuery(final String xqueryCommand) throws IOException { - return execute("xquery " + xqueryCommand); - - } - - /** - * Creates a query object. - * - * @param query query string - * @return query - * @throws IOException Exception - */ - public Query query(final String query) throws IOException { - return new Query(query); - } - - /** - * Creates a database. - * - * @param name name of database - * @param input xml input - * @throws IOException I/O exception - */ - public void create(final String name, final InputStream input) throws IOException { - send(8, name, input); - } - - /** - * Adds a document to a database. - * - * @param path path to resource - * @param input xml input - * @throws IOException I/O exception - */ - public void add(final String path, final InputStream input) throws IOException { - send(9, path, input); - } - - /** - * Replaces a document in a database. - * - * @param path path to resource - * @param input xml input - * @throws IOException I/O exception - */ - public void replace(final String path, final InputStream input) throws IOException { - send(12, path, input); - } - - /** - * Stores a binary resource in a database. - * - * @param path path to resource - * @param input xml input - * @throws IOException I/O exception - */ - public void store(final String path, final InputStream input) throws IOException { - send(13, path, input); - } - - /** - * Closes the session. - * - * @throws IOException Exception - */ - @Override - public void close() throws IOException { - send("exit"); - out.flush(); - socket.close(); - } - - /** - * Checks the next success flag. - * - * @return value of check - * @throws IOException Exception - */ - private boolean ok() throws IOException { - out.flush(); - return in.read() == 0; - } - - /** - * Returns the next received string. - * - * @return String result or info - * @throws IOException I/O exception - */ - private String receive() throws IOException { - final var os = new ByteArrayOutputStream(); - receive(in, os); - return os.toString(UTF_8); - } - - /** - * Sends a string to the server. - * - * @param string string to be sent - * @throws IOException I/O exception - */ - private void send(final String string) throws IOException { - out.write((string + '\0').getBytes(UTF_8)); - } - - /** - * Receives a string and writes it to the specified output stream. - * - * @param input input stream - * @param output output stream - * @throws IOException I/O exception - */ - private static void receive(final InputStream input, final OutputStream output) - throws IOException { - for (int b; (b = input.read()) > 0; ) { - // read next byte if 0xFF is received - output.write(b == 0xFF ? input.read() : b); - } - } - - /** - * Sends a command, argument, and input. - * - * @param code command code - * @param path name, or path to resource - * @param input xml input - * @throws IOException I/O exception - */ - private void send(final int code, final String path, final InputStream input) throws IOException { - out.write(code); - send(path); - send(input); - } - - /** - * Sends an input stream to the server. - * - * @param input xml input - * @throws IOException I/O exception - */ - private void send(final InputStream input) throws IOException { - final var bis = new BufferedInputStream(input); - final var bos = new BufferedOutputStream(out); - for (int b; (b = bis.read()) != -1; ) { - // 0x00 and 0xFF will be prefixed by 0xFF - if (b == 0x00 || b == 0xFF) bos.write(0xFF); - bos.write(b); - } - bos.write(0); - bos.flush(); - info = receive(); - if (!ok()) throw new IOException(info); - } - - /** - * Returns an MD5 hash. - * - * @param pw String - * @return String - */ - private static String md5(final String pw) { - final var sb = new StringBuilder(); - try { - // BaseX uses MD5 hashing, so we can change this for now. - final var md = MessageDigest.getInstance("MD5"); // NOSONAR - md.update(pw.getBytes()); - for (final byte b : md.digest()) { - final var s = Integer.toHexString(b & 0xFF); - if (s.length() == 1) sb.append('0'); - sb.append(s); - } - } catch (final NoSuchAlgorithmException exp) { - throw new CompasSclDataServiceException(BASEX_CLIENT_CREATION_ERROR_CODE, "Unknwn Algorithm", exp); - } - return sb.toString(); - } - - /** - * Inner class for iterative query execution. - */ - public class Query implements Closeable { - /** - * Query id. - */ - private final String id; - /** - * Cached results. - */ - private ArrayList cache; - /** - * Cache pointer. - */ - private int pos; - - /** - * Standard constructor. - * - * @param query query string - * @throws IOException I/O exception - */ - Query(final String query) throws IOException { - id = exec(0, query); - } - - /** - * Binds a value to an external variable. - * - * @param name name of variable - * @param value value - * @throws IOException I/O exception - */ - public void bind(final String name, final String value) throws IOException { - bind(name, value, ""); - } - - /** - * Binds a value with the specified type to an external variable. - * - * @param name name of variable - * @param value value - * @param type type (can be an empty string) - * @throws IOException I/O exception - */ - public void bind(final String name, final String value, final String type) throws IOException { - cache = null; - exec(3, id + '\0' + name + '\0' + value + '\0' + type); - } - - /** - * Binds a value to the context item. - * - * @param value value - * @throws IOException I/O exception - */ - public void context(final String value) throws IOException { - context(value, ""); - } - - /** - * Binds a value with the specified type to the context item. - * - * @param value value - * @param type type (can be an empty string) - * @throws IOException I/O exception - */ - public void context(final String value, final String type) throws IOException { - cache = null; - exec(14, id + '\0' + value + '\0' + type); - } - - /** - * Checks for the next item. - * - * @return result of check - * @throws IOException I/O exception - */ - public boolean more() throws IOException { - if (cache == null) { - out.write(4); - send(id); - cache = new ArrayList<>(); - final var os = new ByteArrayOutputStream(); - while (in.read() > 0) { - receive(in, os); - cache.add(os.toByteArray()); - os.reset(); - } - if (!ok()) throw new IOException(receive()); - pos = 0; - } - if (pos < cache.size()) return true; - cache = null; - return false; - } - - /** - * Returns the next item. - * - * @return item string - * @throws IOException I/O Exception - */ - public String next() throws IOException { - return more() ? new String(cache.set(pos++, null), UTF_8) : null; - } - - /** - * Returns the whole result of the query. - * - * @return query result - * @throws IOException I/O Exception - */ - public String execute() throws IOException { - return exec(5, id); - } - - /** - * Returns query info in a string. - * - * @return query info - * @throws IOException I/O exception - */ - public String info() throws IOException { - return exec(6, id); - } - - /** - * Returns serialization parameters in a string. - * - * @return query info - * @throws IOException I/O exception - */ - public String options() throws IOException { - return exec(7, id); - } - - /** - * Closes the query. - * - * @throws IOException I/O exception - */ - @Override - public void close() throws IOException { - exec(2, id); - } - - /** - * Executes the specified command. - * - * @param code command code - * @param arg argument - * @return resulting string - * @throws IOException I/O exception - */ - private String exec(final int code, final String arg) throws IOException { - out.write(code); - send(arg); - final String s = receive(); - if (!ok()) throw new IOException(receive()); - return s; - } - } -} \ No newline at end of file diff --git a/repository-basex/src/main/java/org/lfenergy/compas/scl/data/basex/client/BaseXClientFactory.java b/repository-basex/src/main/java/org/lfenergy/compas/scl/data/basex/client/BaseXClientFactory.java deleted file mode 100644 index 90b24a94..00000000 --- a/repository-basex/src/main/java/org/lfenergy/compas/scl/data/basex/client/BaseXClientFactory.java +++ /dev/null @@ -1,33 +0,0 @@ -// SPDX-FileCopyrightText: 2021 Alliander N.V. -// -// SPDX-License-Identifier: Apache-2.0 -package org.lfenergy.compas.scl.data.basex.client; - -import org.eclipse.microprofile.config.inject.ConfigProperty; - -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.inject.Inject; -import java.io.IOException; - -@ApplicationScoped -public class BaseXClientFactory { - private final String baseXHost; - private final Integer baseXPort; - private final String baseXUsername; - private final String baseXPassword; - - @Inject - public BaseXClientFactory(@ConfigProperty(name = "basex.host") String baseXHost, - @ConfigProperty(name = "basex.port") Integer baseXPort, - @ConfigProperty(name = "basex.username") String baseXUsername, - @ConfigProperty(name = "basex.password") String baseXPassword) { - this.baseXHost = baseXHost; - this.baseXPort = baseXPort; - this.baseXUsername = baseXUsername; - this.baseXPassword = baseXPassword; - } - - public BaseXClient createClient() throws IOException { - return new BaseXClient(baseXHost, baseXPort, baseXUsername, baseXPassword); - } -} diff --git a/repository-basex/src/main/java/org/lfenergy/compas/scl/data/basex/repository/CompasSclDataBaseXRepository.java b/repository-basex/src/main/java/org/lfenergy/compas/scl/data/basex/repository/CompasSclDataBaseXRepository.java deleted file mode 100644 index 6f55c3db..00000000 --- a/repository-basex/src/main/java/org/lfenergy/compas/scl/data/basex/repository/CompasSclDataBaseXRepository.java +++ /dev/null @@ -1,329 +0,0 @@ -// SPDX-FileCopyrightText: 2021 Alliander N.V. -// -// SPDX-License-Identifier: Apache-2.0 -package org.lfenergy.compas.scl.data.basex.repository; - -import org.apache.commons.io.input.ReaderInputStream; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.lfenergy.compas.scl.data.basex.client.BaseXClient; -import org.lfenergy.compas.scl.data.basex.client.BaseXClientFactory; -import org.lfenergy.compas.scl.data.exception.CompasNoDataFoundException; -import org.lfenergy.compas.scl.data.exception.CompasSclDataServiceException; -import org.lfenergy.compas.scl.data.model.HistoryItem; -import org.lfenergy.compas.scl.data.model.Item; -import org.lfenergy.compas.scl.data.model.SclMetaInfo; -import org.lfenergy.compas.scl.data.model.Version; -import org.lfenergy.compas.scl.data.repository.CompasSclDataRepository; -import org.lfenergy.compas.scl.data.util.SclDataModelMarshaller; -import org.lfenergy.compas.scl.extensions.model.SclFileType; - -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.inject.Inject; -import jakarta.transaction.Transactional; -import java.io.IOException; -import java.io.StringReader; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.UUID; - -import static jakarta.transaction.Transactional.TxType.REQUIRED; -import static jakarta.transaction.Transactional.TxType.SUPPORTS; -import static org.lfenergy.compas.scl.data.SclDataServiceConstants.SCL_DATA_SERVICE_V1_NS_URI; -import static org.lfenergy.compas.scl.data.SclDataServiceConstants.SCL_NS_URI; -import static org.lfenergy.compas.scl.data.exception.CompasSclDataServiceErrorCode.BASEX_COMMAND_ERROR_CODE; -import static org.lfenergy.compas.scl.data.exception.CompasSclDataServiceErrorCode.BASEX_QUERY_ERROR_CODE; -import static org.lfenergy.compas.scl.extensions.commons.CompasExtensionsConstants.COMPAS_EXTENSION_NS_URI; -import static org.lfenergy.compas.scl.extensions.commons.CompasExtensionsConstants.COMPAS_SCL_EXTENSION_TYPE; - -/** - * This implementation of the repository will store the SCL XML Files in BaseX, this is a XML Database. - * For more information see https://basex.org/. - *

- * For every type of SCL a separate database is created in which the SCL XML Files are stored. - * Every entry is stored under <ID>/<Major version>/<Minor version>/<Patch version>/scl.xml. - * This combination is always unique and easy to use. - */ -@ApplicationScoped -public class CompasSclDataBaseXRepository implements CompasSclDataRepository { - private static final Logger LOGGER = LogManager.getLogger(CompasSclDataBaseXRepository.class); - - private static final String DECLARE_NS_AND_VARS = """ - declare namespace scl = "%s"; - declare namespace compas = "%s"; - - declare variable $compasSclExtensionType := '%s'; - declare variable $compasDataServiceNamespace := '%s'; - """.formatted(SCL_NS_URI, COMPAS_EXTENSION_NS_URI, COMPAS_SCL_EXTENSION_TYPE, SCL_DATA_SERVICE_V1_NS_URI); - - // This find method always searches for the latest version. Retrieve all versions using db:list-details function. - // Sort the result descending, this way the last version is the first. - private static final String DECLARE_LATEST_VERSION_FUNC = """ - declare function local:latest-version($db as xs:string, $id as xs:string) as document-node()? { - let $doc := - (for $resource in db:open($db, $id) - let $parts := tokenize($resource/scl:SCL/scl:Header/@version, '\\.') - let $majorVersion := xs:int($parts[1]) - let $minorVersion := xs:int($parts[2]) - let $patchVersion := xs:int($parts[3]) - order by $majorVersion descending, $minorVersion descending, $patchVersion descending - return $resource - )[1] - return $doc - }; - """; - - // Retrieve the Labels as XML Label elements from the XML. The result can be returned by the List functions. - private static final String DECLARE_LABELS_FUNC = """ - declare function local:createLabelsResponse($latestScl as document-node()) as xs:string* { - let $labels := distinct-values($latestScl/scl:SCL/scl:Private[@type=$compasSclExtensionType]/compas:Labels/compas:Label) - for $label in $labels - return ' ' - }; - """; - - private final BaseXClientFactory baseXClientFactory; - private final SclDataModelMarshaller sclDataMarshaller; - - @Inject - public CompasSclDataBaseXRepository(BaseXClientFactory baseXClientFactory, - SclDataModelMarshaller sclDataMarshaller) { - this.baseXClientFactory = baseXClientFactory; - this.sclDataMarshaller = sclDataMarshaller; - - var command = """ - declare variable $db := '%s'; - if (not(db:exists($db))) - then - db:create($db) - """; - // At startup create all needed databases. - Arrays.stream(SclFileType.values()).forEach(type -> - executeCommand(client -> { - client.executeXQuery(command.formatted(type)); - return true; - })); - } - - @Override - @Transactional(SUPPORTS) - public List list(SclFileType type) { - return executeQuery(type, """ - %s - %s - %s - declare variable $db := '%s'; - for $resource in db:open($db) - let $id := $resource/scl:SCL/scl:Header/@id - group by $id - let $latestScl := local:latest-version($db, $id) - let $version := $latestScl/scl:SCL/scl:Header/@version - let $name := ($latestScl/scl:SCL/scl:Private[@type=$compasSclExtensionType]/compas:SclName)[1] - let $labels := fn:string-join(local:createLabelsResponse($latestScl)) - order by fn:lower-case($name) - return '' - || ' ' || $id || '' - || ' ' || $name || '' - || ' ' || $version || '' - || $labels - || '' - """.formatted(DECLARE_NS_AND_VARS, DECLARE_LATEST_VERSION_FUNC, DECLARE_LABELS_FUNC, type) - , - sclDataMarshaller::unmarshalItem); - } - - @Override - @Transactional(SUPPORTS) - public List listVersionsByUUID(SclFileType type, UUID id) { - return executeQuery(type, """ - %s - declare variable $db := '%s'; - declare variable $id := '%s'; - for $resource in db:open($db, $id) - let $version := $resource/scl:SCL/scl:Header/@version - let $name := $resource/scl:SCL/scl:Private[@type=$compasSclExtensionType]/compas:SclName - let $header := ($resource/scl:SCL/scl:Header/scl:History/scl:Hitem[(not(@revision) or @revision="") and @version=$version])[1] - let $parts := tokenize($version, '\\.') - let $majorVersion := xs:int($parts[1]) - let $minorVersion := xs:int($parts[2]) - let $patchVersion := xs:int($parts[3]) - order by $majorVersion, $minorVersion, $patchVersion - return '' - || ' ' || $id || '' - || ' ' || $name || '' - || ' ' || $version || '' - || ' ' || $header/@who || '' - || ' ' || $header/@when || '' - || ' ' || $header/@what || '' - || '' - """.formatted(DECLARE_NS_AND_VARS, type, id), - sclDataMarshaller::unmarshalHistoryItem); - } - - @Override - @Transactional(SUPPORTS) - public String findByUUID(SclFileType type, UUID id) { - // This find method always searches for the latest version and returns this. - var result = executeQuery(type, """ - %s - %s - declare variable $db := '%s'; - declare variable $id := '%s'; - local:latest-version($db, $id) - """.formatted(DECLARE_NS_AND_VARS, DECLARE_LATEST_VERSION_FUNC, type, id) - ); - - if (result.isEmpty()) { - var message = String.format("No record found for type '%s' with ID '%s'", type, id); - throw new CompasNoDataFoundException(message); - } - return result.get(0); - } - - @Override - @Transactional(SUPPORTS) - public String findByUUID(SclFileType type, UUID id, Version version) { - // This find method searches for a specific version. - var result = executeQuery(type, """ - declare variable $db := '%s'; - declare variable $path := '%s'; - db:open($db, $path) - """.formatted(type, createDocumentPath(id, version)) - ); - - if (result.isEmpty()) { - var message = String.format("No record found for type '%s' with ID '%s' and version '%s'", type, id, version); - throw new CompasNoDataFoundException(message); - } - return result.get(0); - } - - @Override - @Transactional(SUPPORTS) - public boolean hasDuplicateSclName(SclFileType type, String name) { - return false; - } - - @Override - @Transactional(SUPPORTS) - public SclMetaInfo findMetaInfoByUUID(SclFileType type, UUID id) { - // This find method always searches for the latest version. - // Extracts the needed information from the document and returns this. - var metaInfo = executeQuery(type, """ - %s - %s - declare variable $db := '%s'; - declare variable $id := '%s'; - let $resource := local:latest-version($db, $id) - return if ($resource) - then ( - let $version := $resource/scl:SCL/scl:Header/@version - let $name := $resource/scl:SCL/scl:Private[@type=$compasSclExtensionType]/compas:SclName - return '' - || ' ' || $id || '' - || ' ' || $name || '' - || ' ' || $version || '' - || '' - ) - """.formatted(DECLARE_NS_AND_VARS, DECLARE_LATEST_VERSION_FUNC, type, id), - sclDataMarshaller::unmarshalSclMetaInfo); - - if (metaInfo.isEmpty()) { - var message = String.format("No meta info found for type '%s' with ID '%s'", type, id); - throw new CompasNoDataFoundException(message); - } - return metaInfo.get(0); - } - - @Override - @Transactional(REQUIRED) - public void create(SclFileType type, UUID id, String name, String scl, Version version, String who, List labels) { - // Who is ignored in the BaseX implementation. - var inputStream = new ReaderInputStream(new StringReader(scl), StandardCharsets.UTF_8); - executeCommand(client -> { - openDatabase(client, type); - client.add(createDocumentPath(id, version) + "/scl.xml", inputStream); - closeDatabase(client); - return true; - }); - } - - @Override - @Transactional(REQUIRED) - public void delete(SclFileType type, UUID id) { - executeCommand(client -> { - client.executeXQuery("db:delete('%s', '%s')".formatted(type, id)); - return true; - }); - } - - @Override - @Transactional(REQUIRED) - public void delete(SclFileType type, UUID id, Version version) { - executeCommand(client -> { - client.executeXQuery("db:delete('%s', '%s')".formatted(type, createDocumentPath(id, version))); - return true; - }); - } - - private String createDocumentPath(UUID uuid, Version version) { - return uuid - + "/" + version.getMajorVersion() - + "/" + version.getMinorVersion() - + "/" + version.getPatchVersion(); - } - - private List executeQuery(SclFileType type, String query) { - // When the Document (as String) is just returned without mapping. - return executeQuery(type, query, xmlString -> xmlString); - } - - private List executeQuery(SclFileType type, String query, ResultRowMapper mapper) { - return executeCommand(client -> { - try { - var response = new ArrayList(); - openDatabase(client, type); - LOGGER.debug("Executing Query:\n{}", query); - try (var queryToRun = client.query(query)) { - while (queryToRun.more()) { - response.add(mapper.map(queryToRun.next())); - } - } - closeDatabase(client); - return response; - } catch (IOException exception) { - final var exceptionMessage = exception.getLocalizedMessage(); - LOGGER.error("executeQuery: {}", exceptionMessage, exception); - throw new CompasSclDataServiceException(BASEX_QUERY_ERROR_CODE, "Error executing query!"); - } - }); - } - - private void openDatabase(BaseXClient client, SclFileType type) throws IOException { - client.execute("OPEN %s".formatted(type)); - } - - private void closeDatabase(BaseXClient client) throws IOException { - client.execute("CLOSE"); - } - - private R executeCommand(ClientExecutor command) { - try (var client = baseXClientFactory.createClient()) { - return command.execute(client); - } catch (IOException exception) { - final var exceptionMessage = exception.getLocalizedMessage(); - LOGGER.error("executeCommand: {}", exceptionMessage, exception); - throw new CompasSclDataServiceException(BASEX_COMMAND_ERROR_CODE, "Error executing command!"); - } - } - - private interface ClientExecutor { - R execute(BaseXClient client) throws IOException; - } - - private interface ResultRowMapper { - R map(String row); - } -} diff --git a/repository-basex/src/test/java/org/lfenergy/compas/scl/data/basex/client/BaseXClientFactoryTest.java b/repository-basex/src/test/java/org/lfenergy/compas/scl/data/basex/client/BaseXClientFactoryTest.java deleted file mode 100644 index 143f1cee..00000000 --- a/repository-basex/src/test/java/org/lfenergy/compas/scl/data/basex/client/BaseXClientFactoryTest.java +++ /dev/null @@ -1,28 +0,0 @@ -// SPDX-FileCopyrightText: 2021 Alliander N.V. -// -// SPDX-License-Identifier: Apache-2.0 -package org.lfenergy.compas.scl.data.basex.client; - -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; - -import java.io.IOException; - -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.lfenergy.compas.scl.data.basex.client.BaseXServerUtil.createClientFactory; - -@ExtendWith({BaseXServerJUnitExtension.class}) -class BaseXClientFactoryTest { - private static BaseXClientFactory factory; - - @BeforeAll - static void beforeAll() { - factory = createClientFactory(BaseXServerJUnitExtension.getPortNumber()); - } - - @Test - void createClient_WhenCalled_ThenReturnClient() throws IOException { - assertNotNull(factory.createClient()); - } -} \ No newline at end of file diff --git a/repository-basex/src/test/java/org/lfenergy/compas/scl/data/basex/client/BaseXServerJUnitExtension.java b/repository-basex/src/test/java/org/lfenergy/compas/scl/data/basex/client/BaseXServerJUnitExtension.java deleted file mode 100644 index e4a1e789..00000000 --- a/repository-basex/src/test/java/org/lfenergy/compas/scl/data/basex/client/BaseXServerJUnitExtension.java +++ /dev/null @@ -1,51 +0,0 @@ -// SPDX-FileCopyrightText: 2021 Alliander N.V. -// -// SPDX-License-Identifier: Apache-2.0 -package org.lfenergy.compas.scl.data.basex.client; - -import org.basex.BaseXServer; -import org.junit.jupiter.api.extension.BeforeAllCallback; -import org.junit.jupiter.api.extension.ExtensionContext; - -import java.util.concurrent.locks.Lock; -import java.util.concurrent.locks.ReentrantLock; - -import static org.junit.jupiter.api.extension.ExtensionContext.Namespace.GLOBAL; -import static org.lfenergy.compas.scl.data.basex.client.BaseXServerUtil.createServer; -import static org.lfenergy.compas.scl.data.basex.client.BaseXServerUtil.getFreePortNumber; - -/** - * JUnit extension to start a BaseX Server. This server should only be started and stopped once for all - * JUnit Tests. - */ -public class BaseXServerJUnitExtension implements BeforeAllCallback, ExtensionContext.Store.CloseableResource { - private static BaseXServer server; - private static int portNumber; - - // Gate keeper to prevent multiple Threads within the same routine - private final static Lock lock = new ReentrantLock(); - - @Override - public void beforeAll(final ExtensionContext context) throws Exception { - // lock the access so only one Thread has access to it - lock.lock(); - if (server == null) { - portNumber = getFreePortNumber(); - server = createServer(portNumber); - - // The following line registers a callback hook when the root test context is shut down - context.getRoot().getStore(GLOBAL).put("BaseXServerJUnitExtension", this); - } - // free the access - lock.unlock(); - } - - @Override - public void close() { - server.stop(); - } - - public static int getPortNumber() { - return portNumber; - } -} \ No newline at end of file diff --git a/repository-basex/src/test/java/org/lfenergy/compas/scl/data/basex/client/BaseXServerUtil.java b/repository-basex/src/test/java/org/lfenergy/compas/scl/data/basex/client/BaseXServerUtil.java deleted file mode 100644 index 8fd7376d..00000000 --- a/repository-basex/src/test/java/org/lfenergy/compas/scl/data/basex/client/BaseXServerUtil.java +++ /dev/null @@ -1,32 +0,0 @@ -// SPDX-FileCopyrightText: 2021 Alliander N.V. -// -// SPDX-License-Identifier: Apache-2.0 -package org.lfenergy.compas.scl.data.basex.client; - -import org.basex.BaseXServer; - -import java.io.IOException; -import java.net.ServerSocket; - -public final class BaseXServerUtil { - private BaseXServerUtil() { - } - - public static int getFreePortNumber() throws IOException { - try (ServerSocket serverSocket = new ServerSocket(0)) { - if (serverSocket.getLocalPort() > 0) { - return serverSocket.getLocalPort(); - } - } - throw new IOException("Port is not available"); - } - - public static BaseXServer createServer(int portNumber) throws IOException { - System.setProperty("org.basex.path", "target/basex"); - return new BaseXServer("-p" + portNumber); - } - - public static BaseXClientFactory createClientFactory(int portNumber) { - return new BaseXClientFactory("localhost", portNumber, "admin", "admin"); - } -} diff --git a/repository-basex/src/test/java/org/lfenergy/compas/scl/data/basex/repository/CompasSclDataBaseXRepositoryTest.java b/repository-basex/src/test/java/org/lfenergy/compas/scl/data/basex/repository/CompasSclDataBaseXRepositoryTest.java deleted file mode 100644 index 693cc194..00000000 --- a/repository-basex/src/test/java/org/lfenergy/compas/scl/data/basex/repository/CompasSclDataBaseXRepositoryTest.java +++ /dev/null @@ -1,67 +0,0 @@ -// SPDX-FileCopyrightText: 2021 Alliander N.V. -// -// SPDX-License-Identifier: Apache-2.0 -package org.lfenergy.compas.scl.data.basex.repository; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.lfenergy.compas.scl.data.basex.client.BaseXClientFactory; -import org.lfenergy.compas.scl.data.basex.client.BaseXServerJUnitExtension; -import org.lfenergy.compas.scl.data.repository.AbstractCompasSclDataRepositoryTest; -import org.lfenergy.compas.scl.data.repository.CompasSclDataRepository; -import org.lfenergy.compas.scl.data.util.SclDataModelMarshaller; -import org.lfenergy.compas.scl.extensions.model.SclFileType; -import org.mockito.junit.jupiter.MockitoExtension; - -import java.io.IOException; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.lfenergy.compas.scl.data.basex.client.BaseXServerUtil.createClientFactory; - -@ExtendWith({MockitoExtension.class, BaseXServerJUnitExtension.class}) -class CompasSclDataBaseXRepositoryTest extends AbstractCompasSclDataRepositoryTest { - private static final Logger LOGGER = LogManager.getLogger(CompasSclDataBaseXRepositoryTest.class); - - private static BaseXClientFactory factory; - private CompasSclDataBaseXRepository repository; - - @Override - protected CompasSclDataRepository getRepository() { - return repository; - } - - @BeforeAll - static void beforeAll() { - factory = createClientFactory(BaseXServerJUnitExtension.getPortNumber()); - - // To make it possible to re-run the test over and over (in your IDE), - // Create all the database, because this will cause to old ones to be removed. - Arrays.stream(SclFileType.values()) - .forEach(type -> { - try { - factory.createClient().executeXQuery("db:create('" + type + "')"); - } catch (IOException exp) { - LOGGER.warn("Error re-creating database {}", type, exp); - } - }); - } - - @BeforeEach - void beforeEach() { - repository = new CompasSclDataBaseXRepository(factory, new SclDataModelMarshaller()); - } - - /* - * TODO: Method beneath needs to be removed and the one from CompasSclDataPostgreSQLRepositoryTest be used - * when hasDuplicateSclName has been implemented by CompasSclDataBaseXRepository. */ - @Test - void hasDuplicateSclName_WhenUsingSclNameThatHasBeenUsedYet_ThenDuplicateIsFound() { - // Will always return false for now, because there is no correct implementation for BaseX - assertFalse(getRepository().hasDuplicateSclName(TYPE, NAME_1)); - } -} diff --git a/repository-basex/src/test/resources/log4j2.xml b/repository-basex/src/test/resources/log4j2.xml deleted file mode 100644 index 3b41fa7f..00000000 --- a/repository-basex/src/test/resources/log4j2.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/repository-postgresql/pom.xml b/repository-postgresql/pom.xml index f531369f..47b0a2cf 100644 --- a/repository-postgresql/pom.xml +++ b/repository-postgresql/pom.xml @@ -60,7 +60,7 @@ SPDX-License-Identifier: Apache-2.0 com.opentable.components otj-pg-embedded - 1.0.1 + 1.0.2 test diff --git a/repository-postgresql/src/test/java/org/lfenergy/compas/scl/data/repository/postgresql/PostgreSQLServerJUnitExtension.java b/repository-postgresql/src/test/java/org/lfenergy/compas/scl/data/repository/postgresql/PostgreSQLServerJUnitExtension.java index be51c4a1..a773e10d 100644 --- a/repository-postgresql/src/test/java/org/lfenergy/compas/scl/data/repository/postgresql/PostgreSQLServerJUnitExtension.java +++ b/repository-postgresql/src/test/java/org/lfenergy/compas/scl/data/repository/postgresql/PostgreSQLServerJUnitExtension.java @@ -18,7 +18,7 @@ import static org.junit.jupiter.api.extension.ExtensionContext.Namespace.GLOBAL; /** - * JUnit extension to start a BaseX Server. This server should only be started and stopped once for all + * JUnit extension to start a Postgresql Server. This server should only be started and stopped once for all * JUnit Tests. */ public class PostgreSQLServerJUnitExtension implements BeforeAllCallback, ExtensionContext.Store.CloseableResource { diff --git a/repository/src/main/java/org/lfenergy/compas/scl/data/exception/CompasSclDataServiceErrorCode.java b/repository/src/main/java/org/lfenergy/compas/scl/data/exception/CompasSclDataServiceErrorCode.java index fc648e3e..19fca817 100644 --- a/repository/src/main/java/org/lfenergy/compas/scl/data/exception/CompasSclDataServiceErrorCode.java +++ b/repository/src/main/java/org/lfenergy/compas/scl/data/exception/CompasSclDataServiceErrorCode.java @@ -17,10 +17,6 @@ public class CompasSclDataServiceErrorCode { public static final String INVALID_LABEL_ERROR_CODE = "SDS-0008"; public static final String TOO_MANY_LABEL_ERROR_CODE = "SDS-0009"; - public static final String BASEX_CLIENT_CREATION_ERROR_CODE = "SDS-1000"; - public static final String BASEX_QUERY_ERROR_CODE = "SDS-1001"; - public static final String BASEX_COMMAND_ERROR_CODE = "SDS-1002"; - public static final String POSTGRES_SELECT_ERROR_CODE = "SDS-2000"; public static final String POSTGRES_INSERT_ERROR_CODE = "SDS-2001"; public static final String POSTGRES_DELETE_ERROR_CODE = "SDS-2002";