Skip to content
Snippets Groups Projects
Verified Commit 3f757faf authored by Martin Weise's avatar Martin Weise
Browse files

WIP

parent 9e7319da
No related branches found
No related tags found
1 merge request!416Attempt new release
Showing
with 53 additions and 58 deletions
...@@ -381,7 +381,7 @@ services: ...@@ -381,7 +381,7 @@ services:
ports: ports:
- "80:8080" - "80:8080"
volumes: volumes:
- ./dbrepo-gateway-service/dbrepo.conf:/opt/bitnami/nginx/conf/server_blocks/dbrepo.conf:ro - ./conf/dbrepo.conf:/opt/bitnami/nginx/conf/server_blocks/dbrepo.conf:ro
depends_on: depends_on:
dbrepo-analyse-service: dbrepo-analyse-service:
condition: service_healthy condition: service_healthy
......
...@@ -180,7 +180,7 @@ build-analyse-service: ...@@ -180,7 +180,7 @@ build-analyse-service:
PIPENV_PIPFILE: "./dbrepo-analyse-service/Pipfile" PIPENV_PIPFILE: "./dbrepo-analyse-service/Pipfile"
script: script:
- "pip install pipenv" - "pip install pipenv"
- "pipenv install gunicorn && pipenv install --dev --system --deploy" - "pipenv install --dev --system --deploy"
build-python-lib: build-python-lib:
image: docker.io/python:${PYTHON_VERSION}-alpine${ALPINE_VERSION} image: docker.io/python:${PYTHON_VERSION}-alpine${ALPINE_VERSION}
...@@ -192,7 +192,7 @@ build-python-lib: ...@@ -192,7 +192,7 @@ build-python-lib:
PIPENV_PIPFILE: "./lib/python/Pipfile" PIPENV_PIPFILE: "./lib/python/Pipfile"
script: script:
- "pip install pipenv" - "pip install pipenv"
- "pipenv install gunicorn && pipenv install --dev --system --deploy" - "pipenv install --dev --system --deploy"
build-java-lib: build-java-lib:
image: maven:3-openjdk-${JAVA_VERSION} image: maven:3-openjdk-${JAVA_VERSION}
...@@ -355,7 +355,7 @@ test-analyse-service: ...@@ -355,7 +355,7 @@ test-analyse-service:
- build-analyse-service - build-analyse-service
before_script: before_script:
- "pip install pipenv" - "pip install pipenv"
- "pipenv install gunicorn && pipenv install --dev --system --deploy" - "pipenv install --dev --system --deploy"
- "mkdir -p /var/log/app/service/analyse" - "mkdir -p /var/log/app/service/analyse"
script: script:
- cd ./dbrepo-analyse-service/ && coverage run --rcfile=.coveragerc -m pytest tests/test_determine_dt.py tests/test_determine_pk.py && coverage html && coverage xml && coverage report > ./coverage.txt - cd ./dbrepo-analyse-service/ && coverage run --rcfile=.coveragerc -m pytest tests/test_determine_dt.py tests/test_determine_pk.py && coverage html && coverage xml && coverage report > ./coverage.txt
...@@ -382,7 +382,7 @@ test-auth-service-init: ...@@ -382,7 +382,7 @@ test-auth-service-init:
before_script: before_script:
- "apk add --no-cache alpine-sdk gcc python3-dev mariadb-connector-c-dev" - "apk add --no-cache alpine-sdk gcc python3-dev mariadb-connector-c-dev"
- "pip install pipenv" - "pip install pipenv"
- "pipenv install gunicorn && pipenv install --dev --system --deploy" - "pipenv install --dev --system --deploy"
script: script:
- cd ./dbrepo-auth-service/init/ && coverage run --rcfile=.coveragerc -m pytest tests/test_unit_app.py && coverage html && coverage xml && coverage report > ./coverage.txt - cd ./dbrepo-auth-service/init/ && coverage run --rcfile=.coveragerc -m pytest tests/test_unit_app.py && coverage html && coverage xml && coverage report > ./coverage.txt
- "cat ./coverage.txt | grep -o 'TOTAL[^%]*%'" - "cat ./coverage.txt | grep -o 'TOTAL[^%]*%'"
...@@ -410,7 +410,7 @@ test-search-service: ...@@ -410,7 +410,7 @@ test-search-service:
- build-search-service - build-search-service
before_script: before_script:
- "pip install pipenv" - "pip install pipenv"
- "pipenv install gunicorn && pipenv install --dev --system --deploy" - "pipenv install --dev --system --deploy"
- "mkdir -p /var/log/app/service/search" - "mkdir -p /var/log/app/service/search"
script: script:
- cd ./dbrepo-search-service/ && coverage run --rcfile=.coveragerc -m pytest tests/test_app.py && coverage html && coverage xml && coverage report > ./coverage.txt - cd ./dbrepo-search-service/ && coverage run --rcfile=.coveragerc -m pytest tests/test_app.py && coverage html && coverage xml && coverage report > ./coverage.txt
...@@ -440,7 +440,7 @@ test-dashboard-service: ...@@ -440,7 +440,7 @@ test-dashboard-service:
- build-dashboard-service - build-dashboard-service
before_script: before_script:
- "pip install pipenv" - "pip install pipenv"
- "pipenv install gunicorn && pipenv install --dev --system --deploy" - "pipenv install --dev --system --deploy"
- "mkdir -p /var/log/app/service/dashboard" - "mkdir -p /var/log/app/service/dashboard"
script: script:
- cd ./dbrepo-dashboard-service/ && coverage run --rcfile=.coveragerc -m pytest tests/test_integration_app.py && coverage html && coverage xml && coverage report > ./coverage.txt - cd ./dbrepo-dashboard-service/ && coverage run --rcfile=.coveragerc -m pytest tests/test_integration_app.py && coverage html && coverage xml && coverage report > ./coverage.txt
...@@ -470,7 +470,7 @@ test-python-lib: ...@@ -470,7 +470,7 @@ test-python-lib:
- build-python-lib - build-python-lib
script: script:
- "pip install pipenv" - "pip install pipenv"
- "pipenv install gunicorn && pipenv install --dev --system --deploy" - "pipenv install --dev --system --deploy"
- cd ./lib/python/ && coverage run --rcfile=.coveragerc -m pytest tests/test_unit_container.py tests/test_unit_messages.py tests/test_unit_image.py tests/test_unit_concept.py tests/test_unit_database.py tests/test_unit_identifier.py tests/test_unit_license.py tests/test_unit_query.py tests/test_unit_rest_client.py tests/test_unit_table.py tests/test_unit_user.py tests/test_unit_view.py tests/test_unit_unit.py && coverage html && coverage xml && coverage report > ./coverage.txt - cd ./lib/python/ && coverage run --rcfile=.coveragerc -m pytest tests/test_unit_container.py tests/test_unit_messages.py tests/test_unit_image.py tests/test_unit_concept.py tests/test_unit_database.py tests/test_unit_identifier.py tests/test_unit_license.py tests/test_unit_query.py tests/test_unit_rest_client.py tests/test_unit_table.py tests/test_unit_user.py tests/test_unit_view.py tests/test_unit_unit.py && coverage html && coverage xml && coverage report > ./coverage.txt
- "cat ./coverage.txt | grep -o 'TOTAL[^%]*%'" - "cat ./coverage.txt | grep -o 'TOTAL[^%]*%'"
artifacts: artifacts:
...@@ -677,11 +677,23 @@ scan-sonarqube: ...@@ -677,11 +677,23 @@ scan-sonarqube:
only: only:
- master - master
needs: needs:
- build-data-service
- build-java-lib - build-java-lib
dependencies: - test-analyse-service
- test-dashboard-service
- build-data-service - build-data-service
- test-data-service
- build-metadata-service
- test-metadata-service
- test-search-service
dependencies:
- build-java-lib - build-java-lib
- test-analyse-service
- test-dashboard-service
- build-data-service
- test-data-service
- build-metadata-service
- test-metadata-service
- test-search-service
script: script:
- 'sonar-scanner -Dsonar.token="${CI_SONAR_TOKEN}"' - 'sonar-scanner -Dsonar.token="${CI_SONAR_TOKEN}"'
allow_failure: true allow_failure: true
......
File deleted
...@@ -13,13 +13,13 @@ ...@@ -13,13 +13,13 @@
<url>https://www.tuwien.ac.at</url> <url>https://www.tuwien.ac.at</url>
</organization> </organization>
<name>data-service</name>
<description>Service that manages the data</description>
<groupId>at.ac.tuwien.ifs.dbrepo</groupId> <groupId>at.ac.tuwien.ifs.dbrepo</groupId>
<artifactId>data-service</artifactId> <artifactId>data-service</artifactId>
<name>data-service</name>
<version>1.8.2</version> <version>1.8.2</version>
<description>Service that manages the data</description>
<packaging>pom</packaging> <packaging>pom</packaging>
<modules> <modules>
<module>querystore</module> <module>querystore</module>
......
...@@ -13,11 +13,6 @@ ...@@ -13,11 +13,6 @@
<artifactId>report</artifactId> <artifactId>report</artifactId>
<version>1.8.2</version> <version>1.8.2</version>
<description>
This module is only intended for the pipeline coverage report. See the detailed report in the
respective modules
</description>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>at.ac.tuwien.ifs.dbrepo</groupId> <groupId>at.ac.tuwien.ifs.dbrepo</groupId>
......
...@@ -21,10 +21,6 @@ ...@@ -21,10 +21,6 @@
</dependency> </dependency>
</dependencies> </dependencies>
<properties>
<jacoco.version>0.8.7</jacoco.version>
</properties>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
...@@ -38,14 +34,6 @@ ...@@ -38,14 +34,6 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>9</source>
<target>9</target>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>
......
package at.ac.tuwien.ifs.dbrepo.config; package at.ac.tuwien.ifs.dbrepo.config;
import at.ac.tuwien.ifs.dbrepo.service.DatabaseService;
import at.ac.tuwien.ifs.dbrepo.core.test.BaseTest; import at.ac.tuwien.ifs.dbrepo.core.test.BaseTest;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.testcontainers.containers.MariaDBContainer; import org.testcontainers.containers.MariaDBContainer;
...@@ -18,6 +16,7 @@ import java.sql.SQLException; ...@@ -18,6 +16,7 @@ import java.sql.SQLException;
import java.sql.SQLTimeoutException; import java.sql.SQLTimeoutException;
import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
@Log4j2 @Log4j2
@SpringBootTest @SpringBootTest
...@@ -25,18 +24,17 @@ import static org.junit.jupiter.api.Assertions.assertThrows; ...@@ -25,18 +24,17 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
@Testcontainers @Testcontainers
public class MariadbConfigTest extends BaseTest { public class MariadbConfigTest extends BaseTest {
@Autowired
private DatabaseService databaseService;
@Container @Container
private static MariaDBContainer<?> mariaDBContainer = MariaDbContainerConfig.getContainer(); private static MariaDBContainer<?> mariaDBContainer = MariaDbContainerConfig.getContainer();
@BeforeAll @BeforeAll
@SuppressWarnings("java:S2925")
public static void beforeAll() throws InterruptedException { public static void beforeAll() throws InterruptedException {
Thread.sleep(1000) /* wait for test container some more */; Thread.sleep(1000) /* wait for test container some more */;
} }
@BeforeEach @BeforeEach
@SuppressWarnings("java:S2925")
public void beforeEach() throws SQLException, InterruptedException { public void beforeEach() throws SQLException, InterruptedException {
/* metadata database */ /* metadata database */
MariaDbConfig.dropDatabase(CONTAINER_1_PRIVILEGED_DTO, DATABASE_1_INTERNAL_NAME); MariaDbConfig.dropDatabase(CONTAINER_1_PRIVILEGED_DTO, DATABASE_1_INTERNAL_NAME);
...@@ -49,6 +47,7 @@ public class MariadbConfigTest extends BaseTest { ...@@ -49,6 +47,7 @@ public class MariadbConfigTest extends BaseTest {
/* test */ /* test */
MariaDbConfig.execute(DATABASE_1_PRIVILEGED_DTO, "SELECT SLEEP(8);"); // -2 MariaDbConfig.execute(DATABASE_1_PRIVILEGED_DTO, "SELECT SLEEP(8);"); // -2
assertTrue(true);
} }
@Test @Test
......
...@@ -26,8 +26,6 @@ public abstract class DataConnector { ...@@ -26,8 +26,6 @@ public abstract class DataConnector {
dataSource.setAcquireIncrement(5); dataSource.setAcquireIncrement(5);
dataSource.setMaxPoolSize(20); dataSource.setMaxPoolSize(20);
dataSource.setMaxStatements(100); dataSource.setMaxStatements(100);
log.trace("mapped datasource, jdbcUrl={}, user={}, password={}", getJdbcUrl(container, databaseName),
container.getUsername(), container.getPassword());
return dataSource; return dataSource;
} }
......
...@@ -24,8 +24,8 @@ ...@@ -24,8 +24,8 @@
<modules> <modules>
<module>oai</module> <module>oai</module>
<module>repositories</module> <module>repositories</module>
<module>services</module>
<module>rest-service</module> <module>rest-service</module>
<module>services</module>
<module>report</module> <module>report</module>
</modules> </modules>
...@@ -58,9 +58,6 @@ ...@@ -58,9 +58,6 @@
<aws-s3.version>2.25.23</aws-s3.version> <aws-s3.version>2.25.23</aws-s3.version>
<jackson.version>2.15.2</jackson.version> <jackson.version>2.15.2</jackson.version>
<minio.version>8.5.7</minio.version> <minio.version>8.5.7</minio.version>
<sonar.coverage.jacoco.xmlReportPaths>
./report/target/site/jacoco-aggregate/jacoco.xml
</sonar.coverage.jacoco.xmlReportPaths>
<CodeCacheSize>128m</CodeCacheSize> <CodeCacheSize>128m</CodeCacheSize>
<extraJavaTestArgs></extraJavaTestArgs> <extraJavaTestArgs></extraJavaTestArgs>
</properties> </properties>
...@@ -280,9 +277,6 @@ ...@@ -280,9 +277,6 @@
<repository> <repository>
<id>dbrepo-maven-repo</id> <id>dbrepo-maven-repo</id>
<url>file:///${project.basedir}/lib</url> <url>file:///${project.basedir}/lib</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots> <snapshots>
<enabled>true</enabled> <enabled>true</enabled>
</snapshots> </snapshots>
......
...@@ -14,6 +14,11 @@ ...@@ -14,6 +14,11 @@
<version>1.8.2</version> <version>1.8.2</version>
<dependencies> <dependencies>
<dependency>
<groupId>at.ac.tuwien.ifs.dbrepo</groupId>
<artifactId>rest-service</artifactId>
<version>1.8.2</version>
</dependency>
<dependency> <dependency>
<groupId>at.ac.tuwien.ifs.dbrepo</groupId> <groupId>at.ac.tuwien.ifs.dbrepo</groupId>
<artifactId>services</artifactId> <artifactId>services</artifactId>
......
...@@ -48,6 +48,8 @@ public class DataCiteIdentifierServiceImpl implements IdentifierService { ...@@ -48,6 +48,8 @@ public class DataCiteIdentifierServiceImpl implements IdentifierService {
private final IdentifierService identifierService; private final IdentifierService identifierService;
private final IdentifierRepository identifierRepository; private final IdentifierRepository identifierRepository;
private static final String LOG_MINT_FAILED = "Failed to mint doi";
private final ParameterizedTypeReference<DataCiteBody<DataCiteDoi>> dataCiteBodyParameterizedTypeReference = new ParameterizedTypeReference<>() { private final ParameterizedTypeReference<DataCiteBody<DataCiteDoi>> dataCiteBodyParameterizedTypeReference = new ParameterizedTypeReference<>() {
}; };
...@@ -152,8 +154,8 @@ public class DataCiteIdentifierServiceImpl implements IdentifierService { ...@@ -152,8 +154,8 @@ public class DataCiteIdentifierServiceImpl implements IdentifierService {
final ResponseEntity<DataCiteBody<DataCiteDoi>> response = restTemplate.exchange(url, HttpMethod.POST, final ResponseEntity<DataCiteBody<DataCiteDoi>> response = restTemplate.exchange(url, HttpMethod.POST,
request, dataCiteBodyParameterizedTypeReference); request, dataCiteBodyParameterizedTypeReference);
if (response.getStatusCode() != HttpStatus.CREATED || response.getBody() == null) { if (response.getStatusCode() != HttpStatus.CREATED || response.getBody() == null) {
log.error("Failed to mint doi: {}", response); log.error(LOG_MINT_FAILED + ": {}", response);
throw new ExternalServiceException("Failed to mint doi: " + response.getBody()); throw new ExternalServiceException(LOG_MINT_FAILED + ": " + response.getBody());
} }
final String doi = response.getBody() final String doi = response.getBody()
.getData() .getData()
...@@ -166,16 +168,16 @@ public class DataCiteIdentifierServiceImpl implements IdentifierService { ...@@ -166,16 +168,16 @@ public class DataCiteIdentifierServiceImpl implements IdentifierService {
return doi; return doi;
} catch (HttpClientErrorException e) { } catch (HttpClientErrorException e) {
log.atError() log.atError()
.setMessage("Failed to mint doi") .setMessage(LOG_MINT_FAILED)
.setCause(e) .setCause(e)
.log(); .log();
throw new MalformedException("Failed to mint doi: " + e.getMessage(), e); throw new MalformedException(LOG_MINT_FAILED + ": " + e.getMessage(), e);
} catch (RestClientException e) { } catch (RestClientException e) {
log.atError() log.atError()
.setMessage("Failed to mint doi") .setMessage(LOG_MINT_FAILED)
.setCause(e) .setCause(e)
.log(); .log();
throw new DataServiceConnectionException("Failed to mint doi: " + e.getMessage(), e); throw new DataServiceConnectionException(LOG_MINT_FAILED + ": " + e.getMessage(), e);
} }
} }
......
...@@ -334,8 +334,7 @@ public class IdentifierServiceImpl implements IdentifierService { ...@@ -334,8 +334,7 @@ public class IdentifierServiceImpl implements IdentifierService {
/* map */ /* map */
final String body = templateEngine.process("record_oai_datacite.xml", context) final String body = templateEngine.process("record_oai_datacite.xml", context)
.replaceAll("\\s+", " "); .replaceAll("\\s+", " ");
final InputStreamResource resource = new InputStreamResource(IOUtils.toInputStream(body, Charset.defaultCharset())); return new InputStreamResource(IOUtils.toInputStream(body, Charset.defaultCharset()));
return resource;
} }
@Override @Override
......
No preview for this file type
...@@ -19,6 +19,7 @@ package-config: ## Package the config files ...@@ -19,6 +19,7 @@ package-config: ## Package the config files
cp ./dbrepo-data-db/1_grant-user.sql ./.docker/config cp ./dbrepo-data-db/1_grant-user.sql ./.docker/config
cp ./dbrepo-metadata-db/1_setup-schema.sql ./.docker/config cp ./dbrepo-metadata-db/1_setup-schema.sql ./.docker/config
cp ./dbrepo-metadata-db/2_setup-data.sql ./.docker/config cp ./dbrepo-metadata-db/2_setup-data.sql ./.docker/config
cp ./dbrepo-metadata-db/metrics.cnf ./.docker/config
cp ./dbrepo-broker-service/rabbitmq.conf ./.docker/config cp ./dbrepo-broker-service/rabbitmq.conf ./.docker/config
cp ./dbrepo-broker-service/enabled_plugins ./.docker/config cp ./dbrepo-broker-service/enabled_plugins ./.docker/config
cp ./dbrepo-broker-service/definitions.json ./.docker/config cp ./dbrepo-broker-service/definitions.json ./.docker/config
......
# sonarqube # sonarqube
sonar.projectKey=fair-data-austria-db-repository_fda-services_a57fa043-ab99-4cdd-a721-162d9a916d77 sonar.projectKey=fair-data-austria-db-repository_fda-services_a57fa043-ab99-4cdd-a721-162d9a916d77
sonar.host.url=https://s39.datalab.tuwien.ac.at sonar.host.url=https://s39.datalab.tuwien.ac.at/sonarqube/
# project # project
sonar.projectVersion=1.8.2 sonar.projectVersion=1.8.2
# general # general
sonar.qualitygate.wait=true sonar.qualitygate.wait=true
sonar.projectCreation.mainBranchName=master sonar.projectCreation.mainBranchName=master
# java services # java services
sonar.sources=./lib/java/dbrepo-core/src/main,./dbrepo-metadata-service/services/src/main,./dbrepo-metadata-service/repositories/src/main,./dbrepo-metadata-service/rest-service/src/main,./dbrepo-metadata-service/api/src/main,./dbrepo-metadata-service/oai/src/main,./dbrepo-data-service/services/src/main,./dbrepo-data-service/rest-service/src/main,./dbrepo-data-service/querystore/src/main sonar.coverage.jacoco.xmlReportPaths=./dbrepo-data-service/report/target/site/jacoco-aggregate/jacoco.xml,./dbrepo-metadata-service/report/target/site/jacoco-aggregate/jacoco.xml
sonar.java.binaries=./lib/java/dbrepo-core/target/classes,./dbrepo-metadata-service/services/target/classes,./dbrepo-metadata-service/repositories/target/classes,./dbrepo-metadata-service/rest-service/target/classes,./dbrepo-metadata-service/api/target/classes,./dbrepo-metadata-service/oai/target/classes,./dbrepo-data-service/services/target/classes,./dbrepo-data-service/rest-service/target/classes,./dbrepo-data-service/querystore/target/classes sonar.tests=./dbrepo-metadata-service/rest-service/src/test,./dbrepo-data-service/rest-service/src/test
sonar.sources=./lib/java/dbrepo-core/src/main,./dbrepo-metadata-service/services/src/main,./dbrepo-metadata-service/repositories/src/main,./dbrepo-metadata-service/rest-service/src/main,./dbrepo-metadata-service/oai/src/main,./dbrepo-data-service/services/src/main,./dbrepo-data-service/rest-service/src/main,./dbrepo-data-service/querystore/src/main
sonar.java.binaries=./lib/java/dbrepo-core/target/classes,./dbrepo-metadata-service/services/target/classes,./dbrepo-metadata-service/repositories/target/classes,./dbrepo-metadata-service/rest-service/target/classes,./dbrepo-metadata-service/oai/target/classes,./dbrepo-data-service/services/target/classes,./dbrepo-data-service/rest-service/target/classes,./dbrepo-data-service/querystore/target/classes
sonar.junit.reportPaths=./dbrepo-metadata-service/rest-service/target/surefire-reports,./dbrepo-data-service/rest-service/target/surefire-reports sonar.junit.reportPaths=./dbrepo-metadata-service/rest-service/target/surefire-reports,./dbrepo-data-service/rest-service/target/surefire-reports
sonar.coverage.jacoco.xmlReportPaths=./dbrepo-metadata-service/report/target/site/jacoco-aggregate/jacoco.xml,./dbrepo-data-service/report/target/site/jacoco-aggregate/jacoco.xml
# python services # python services
sonar.python.coverage.reportPaths=./dbrepo-analyse-service/coverage.xml,./dbrepo-dashboard-service/coverage.xml,./dbrepo-search-service/coverage.xml
sonar.python.version=3.11 sonar.python.version=3.11
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment