Skip to content

Commit

Permalink
Merge pull request #265 from com-pas/postgresql_cache_labels
Browse files Browse the repository at this point in the history
Added new labels table (including migration)
  • Loading branch information
juancho0202 authored Oct 3, 2022
2 parents 078700e + 8ea6056 commit e531a33
Show file tree
Hide file tree
Showing 33 changed files with 619 additions and 760 deletions.
37 changes: 21 additions & 16 deletions app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ SPDX-License-Identifier: Apache-2.0
<artifactId>openpojo</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand All @@ -156,44 +161,44 @@ SPDX-License-Identifier: Apache-2.0
</goals>
</execution>
<execution>
<id>build-postgresql</id>
<id>build-basex</id>
<goals>
<goal>build</goal>
</goals>
<configuration>
<properties>
<quarkus.profile>prod-postgresql</quarkus.profile>
<quarkus.package.output-directory>postgresql-quarkus-app
</quarkus.package.output-directory>
<quarkus.docker.dockerfile-jvm-path>src/main/docker/Dockerfile-postgresql.jvm
<quarkus.profile>prod-basex</quarkus.profile>
<quarkus.package.output-directory>basex-quarkus-app</quarkus.package.output-directory>
<quarkus.docker.dockerfile-jvm-path>src/main/docker/Dockerfile-basex.jvm
</quarkus.docker.dockerfile-jvm-path>
<quarkus.docker.dockerfile-native-path>src/main/docker/Dockerfile-postgresql.native
<quarkus.docker.dockerfile-native-path>src/main/docker/Dockerfile-basex.native
</quarkus.docker.dockerfile-native-path>
<quarkus.container-image.tag>${project.version}-postgresql</quarkus.container-image.tag>
<quarkus.container-image.additional-tags>latest-postgresql
<quarkus.container-image.tag>${project.version}-basex</quarkus.container-image.tag>
<quarkus.container-image.additional-tags>latest-basex
</quarkus.container-image.additional-tags>
</properties>
</configuration>
</execution>
<!-- Put this build execution as last, because we will use this image to do a basic native check (NativeHealthCheckIT).
This information is written in "target\quarkus-artifact.properties" and used by the integration tests (failsafe).
Sadly there is only 1 file create, so this build overwrites the one from postgresql.
Sadly there is only 1 file create, so this build overwrites the one from basex.
-->
<execution>
<id>build-basex</id>
<id>build-postgresql</id>
<goals>
<goal>build</goal>
</goals>
<configuration>
<properties>
<quarkus.profile>prod-basex</quarkus.profile>
<quarkus.package.output-directory>basex-quarkus-app</quarkus.package.output-directory>
<quarkus.docker.dockerfile-jvm-path>src/main/docker/Dockerfile-basex.jvm
<quarkus.profile>prod-postgresql</quarkus.profile>
<quarkus.package.output-directory>postgresql-quarkus-app
</quarkus.package.output-directory>
<quarkus.docker.dockerfile-jvm-path>src/main/docker/Dockerfile-postgresql.jvm
</quarkus.docker.dockerfile-jvm-path>
<quarkus.docker.dockerfile-native-path>src/main/docker/Dockerfile-basex.native
<quarkus.docker.dockerfile-native-path>src/main/docker/Dockerfile-postgresql.native
</quarkus.docker.dockerfile-native-path>
<quarkus.container-image.tag>${project.version}-basex</quarkus.container-image.tag>
<quarkus.container-image.additional-tags>latest-basex
<quarkus.container-image.tag>${project.version}-postgresql</quarkus.container-image.tag>
<quarkus.container-image.additional-tags>latest-postgresql
</quarkus.container-image.additional-tags>
</properties>
</configuration>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@

import io.quarkus.runtime.annotations.RegisterForReflection;
import org.lfenergy.compas.core.commons.ElementConverter;
import org.lfenergy.compas.scl.data.repository.CompasSclDataRepository;
import org.lfenergy.compas.scl.data.service.CompasSclDataService;
import org.lfenergy.compas.scl.data.service.impl.CompasSclDataServiceImpl;
import org.lfenergy.compas.scl.data.util.SclDataModelMarshaller;
import org.lfenergy.compas.scl.data.util.SclElementProcessor;

import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Produces;
Expand All @@ -21,30 +17,16 @@
org.lfenergy.compas.core.jaxrs.model.ErrorResponse.class,
org.lfenergy.compas.core.jaxrs.model.ErrorMessage.class
})
public class CompasSclDataServiceCommonConfiguration {
public class CompasSclDataServiceConfiguration {
@Produces
@ApplicationScoped
public ElementConverter createElementConverter() {
return new ElementConverter();
}

@Produces
@ApplicationScoped
public SclElementProcessor creatSclElementProcessor() {
return new SclElementProcessor();
}

@Produces
@ApplicationScoped
public SclDataModelMarshaller createSclDataModelMarshaller() {
return new SclDataModelMarshaller();
}

@Produces
@ApplicationScoped
public CompasSclDataService createCompasSclDataService(CompasSclDataRepository repository,
ElementConverter converter,
SclElementProcessor sclElementProcessor) {
return new CompasSclDataServiceImpl(repository, converter, sclElementProcessor);
}
}

This file was deleted.

4 changes: 4 additions & 0 deletions app/src/main/resources/application-dev-basex.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ 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.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
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/resources/application-dev-postgresql.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ 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
Expand Down
8 changes: 6 additions & 2 deletions app/src/main/resources/application-prod-basex.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@

# 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.scl-data-repository.group-id = org.lfenergy.compas.scl.data
quarkus.index-dependency.scl-data-repository.artifact-id = repository-basex
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
Expand Down
8 changes: 6 additions & 2 deletions app/src/main/resources/application-prod-postgresql.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@

# 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.scl-data-repository.group-id = org.lfenergy.compas.scl.data
quarkus.index-dependency.scl-data-repository.artifact-id = repository-postgresql
quarkus.index-dependency.postgresql-repository.group-id = org.lfenergy.compas.scl.data
quarkus.index-dependency.postgresql-repository.artifact-id = repository-postgresql

# Datasource configuration for PostgreSQL
quarkus.datasource.db-kind = postgresql
Expand Down
15 changes: 10 additions & 5 deletions app/src/main/resources/application-test.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@

# Test configuration.

# Datasource configuration for BaseX (none)
quarkus.datasource.jdbc = false
quarkus.datasource.devservices.enabled = false
# 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

# Flyway configuration for BaseX (none)
quarkus.flyway.migrate-at-start = false
# Datasource configuration for PostgreSQL
quarkus.datasource.devservices.enabled = true
quarkus.datasource.db-kind = postgresql

# Flyway configuration for PostgreSQL
quarkus.flyway.migrate-at-start = true
quarkus.flyway.locations = classpath:org/lfenergy/compas/scl/data/repository/postgresql/db/migration

3 changes: 0 additions & 3 deletions app/src/main/resources/reflection-config.json.license

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// SPDX-FileCopyrightText: 2021 Alliander N.V.
//
// SPDX-License-Identifier: Apache-2.0
package org.lfenergy.compas.scl.data.rest;

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertNotNull;

class CompasSclDataServiceConfigurationTest {
@Test
void createElementConverter_WhenCalled_ThenObjectReturned() {
assertNotNull(new CompasSclDataServiceConfiguration().createElementConverter());
}

@Test
void createSclDataModelMarshaller_WhenCalled_ThenObjectReturned() {
assertNotNull(new CompasSclDataServiceConfiguration().createSclDataModelMarshaller());
}
}
Loading

0 comments on commit e531a33

Please sign in to comment.