Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/0.5.5 #156

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .run/IdentityProvider.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<env name="DB_HOST" value="localhost" />
<env name="DB_NAME" value="sep490_idp" />
<env name="DB_PORT" value="5432" />
<env name="DB_SCHEMA" value="public" />
<env name="FLYWAY_OUTPUT_QUERIES" value="true" />
<env name="HIBERNATE_SQL_LOG_LEVEL" value="DEBUG" />
<env name="HIBERNATE_SQL_PARAM_LOG_LEVEL" value="DEBUG" />
Expand All @@ -28,4 +27,4 @@
<option name="Make" enabled="true" />
</method>
</configuration>
</component>
</component>
4 changes: 2 additions & 2 deletions .run/infrastructure.run.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="infrastructure" type="docker-deploy" factoryName="docker-compose.yml" server-name="Docker">
<configuration default="false" name="infrastructure" type="docker-deploy" factoryName="docker-compose.yml" server-name="Podman">
<deployment type="docker-compose.yml">
<settings>
<option name="envFilePath" value="" />
Expand Down Expand Up @@ -28,4 +28,4 @@
</deployment>
<method v="2" />
</configuration>
</component>
</component>
3 changes: 3 additions & 0 deletions sep490-commons/springfw-impl/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ configurations {
compileOnly {
extendsFrom annotationProcessor
}
all {
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
}
}

repositories {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public CorsConfigurationSource corsConfigurationSource() {
CorsConfiguration config = new CorsConfiguration();
config.addAllowedHeader("*");
config.addAllowedMethod("*");
config.addAllowedOrigin("http://localhost:4200");
config.addAllowedOrigin("https://greenbuildings.cloud");
config.setAllowCredentials(true);
source.registerCorsConfiguration("/**", config);
return source;
Expand Down
15 changes: 15 additions & 0 deletions sep490-enterprise/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,20 @@ java {
}
}

configurations {
compileOnly {
extendsFrom annotationProcessor
}
all {
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
}
}

repositories {
mavenCentral()
maven {
url 'https://splunk.jfrog.io/splunk/ext-releases-local'
}
}

dependencies {
Expand All @@ -33,10 +45,13 @@ dependencies {
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'
testImplementation 'org.testcontainers:postgresql'
testImplementation 'org.testcontainers:kafka'
testImplementation 'io.rest-assured:rest-assured'

// Ops
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'com.splunk.logging:splunk-library-javalogging:1.11.8'
implementation 'org.springframework.boot:spring-boot-starter-log4j2'

// Database
implementation 'org.springframework.boot:spring-boot-starter-validation'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import java.util.UUID;

@RestController
@RequestMapping("/api/buildings")
@RequestMapping("/buildings")
@RequiredArgsConstructor
@RolesAllowed({
UserRole.RoleNameConstant.ENTERPRISE_OWNER,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import java.util.*;

@RestController
@RequestMapping("/api/credit-package")
@RequestMapping("/credit-package")
@RequiredArgsConstructor
public class CreditPackageController {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/enterprise")
@RequestMapping("/enterprise")
@RequiredArgsConstructor
@RolesAllowed({
UserRole.RoleNameConstant.ENTERPRISE_OWNER
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import java.util.UUID;

@RestController
@RequestMapping("/api/payment")
@RequestMapping("/payment")
@RequiredArgsConstructor
public class PaymentController {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


@RestController
@RequestMapping("/api/wallet")
@RequestMapping("/wallet")
@RequiredArgsConstructor
public class WalletController {

Expand Down
15 changes: 11 additions & 4 deletions sep490-enterprise/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spring:
issuer-uri: ${ISSUER_URI}
application:
name: enterprise
homepage: http://localhost:4200
homepage: https://greenbuildings.cloud
datasource:
url: jdbc:postgresql://${DB_HOST}:${DB_PORT}/${DB_NAME}?serverTimezone=UTC
username: ${POSTGRES_USER}
Expand All @@ -31,12 +31,15 @@ spring:
query:
fail_on_pagination_over_collection_fetch: true
kafka:
admin:
fail-fast: true
bootstrap-servers: kafka:9092
producer:
bootstrap-servers: localhost:9092
bootstrap-servers: kafka:9092
key-serializer: org.apache.kafka.common.serialization.StringSerializer
value-serializer: org.springframework.kafka.support.serializer.JsonSerializer
consumer:
bootstrap-servers: localhost:9092
bootstrap-servers: kafka:9092
key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
value-deserializer: org.springframework.kafka.support.serializer.JsonDeserializer
properties:
Expand All @@ -52,6 +55,7 @@ logging:
root: INFO
org:
springframework:
test: ${SPRING_TEST_LOG_LEVEL:INFO}
security: ${SPRING_SECURITY_LOG_LEVEL:INFO}
web: ${SPRING_WEB_LOG_LEVEL:INFO}
hibernate:
Expand All @@ -66,4 +70,7 @@ payment:
api_key: ${PAYOS_API_KEY:not_a_real_key_to_prevent_null}
checksum_key: ${PAYOS_CHECKSUM_KEY:not_a_real_key_to_prevent_null}
returnPath: /enterprise/payment
cancelPath: /enterprise/payment
cancelPath: /enterprise/payment
server:
servlet:
context-path: /enterprise
29 changes: 29 additions & 0 deletions sep490-enterprise/src/main/resources/log4j2-spring.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
<Appenders>
<Console name="console" target="SYSTEM_OUT">
<PatternLayout
pattern="%style{%d{ISO8601}} %highlight{%-5level }[%style{%t}{bright,blue}] %style{%C{10}}{bright,yellow}: %msg%n%throwable"/>
</Console>
<SplunkHttp
name="splunkhttp"
url="${env:SPLUNK_URL}"
token="${env:ENTERPRISE_SPLUNK_TOKEN}"
host="${env:SPLUNK_HOST}"
index="${env:ENTERPRISE_SPLUNK_INDEX}"
source="${env:ENTERPRISE_SPLUNK_SOURCE}"
type="raw"
sourcetype="log4j"
messageFormat="text"
disableCertificateValidation="true">
<PatternLayout pattern="%d{ISO8601} %-5p [%t] %c: %m%n"/>
</SplunkHttp>
</Appenders>

<Loggers>
<Root level="info">
<AppenderRef ref="console"/>
<AppenderRef ref="splunkhttp"/>
</Root>
</Loggers>
</Configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import org.testcontainers.containers.PostgreSQLContainer;
import org.testcontainers.containers.wait.strategy.Wait;
import org.testcontainers.junit.jupiter.Testcontainers;
import org.testcontainers.containers.KafkaContainer;
import org.testcontainers.utility.DockerImageName;

import java.util.Map;
import java.util.function.Supplier;
Expand All @@ -21,10 +23,14 @@
@Testcontainers
public abstract class TestcontainersConfigs {

static PostgreSQLContainer<?> postgres = new PostgreSQLContainer<>("postgres:16.4-alpine");
static GenericContainer<?> idP = new GenericContainer<>("thongdh3401/keycloak:24.0.5");
static final PostgreSQLContainer<?> postgres = new PostgreSQLContainer<>("postgres:16.4-alpine");
static final GenericContainer<?> idP = new GenericContainer<>("thongdh3401/keycloak:24.0.5");
static final KafkaContainer kafka = new KafkaContainer(
DockerImageName.parse("confluentinc/cp-kafka:7.6.1")
);

static {
kafka.start();
postgres.start();
idP.withExposedPorts(8180)
.withCommand("start-dev --http-port 8180")
Expand Down Expand Up @@ -57,6 +63,8 @@ void setUp() {

@DynamicPropertySource
static void configureProperties(DynamicPropertyRegistry registry) {
registry.add("spring.kafka.producer.bootstrap-servers", kafka::getBootstrapServers);
registry.add("spring.kafka.consumer.bootstrap-servers", kafka::getBootstrapServers);
registry.add("spring.datasource.url", postgres::getJdbcUrl);
registry.add("spring.datasource.username", postgres::getUsername);
registry.add("spring.datasource.password", postgres::getPassword);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ void getEnterpriseBuildings_withValidToken_returns200() {
.contentType(ContentType.JSON)
.body(new SearchCriteriaDTO<Void>(null, null, null))
.when()
.post("/api/buildings/search")
.post("/enterprise/buildings/search")
.then()
.statusCode(200);
}
Expand All @@ -28,7 +28,7 @@ void getEnterpriseBuildings_withInvalidToken_returns401() {
.contentType(ContentType.JSON)
.body(new SearchCriteriaDTO<Void>(null, null, null))
.when()
.post("/api/buildings/search")
.post("/enterprise/buildings/search")
.then()
.statusCode(401);
}
Expand All @@ -44,7 +44,7 @@ void createBuilding_withValidToken_returns201() {
.contentType(ContentType.JSON)
.body(building)
.when()
.post("/api/buildings")
.post("/enterprise/buildings")
.then()
.statusCode(201);
}
Expand All @@ -56,7 +56,7 @@ void createBuilding_withMissingFields_returns400() {
.contentType(ContentType.JSON)
.body(BuildingDTO.builder().build())
.when()
.post("/api/buildings")
.post("/enterprise/buildings")
.then()
.statusCode(400);
}
Expand All @@ -68,7 +68,7 @@ void createBuilding_withInvalidToken_returns401() {
.contentType(ContentType.JSON)
.body(BuildingDTO.builder().build())
.when()
.post("/api/buildings")
.post("/enterprise/buildings")
.then()
.statusCode(401);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ void saveBusinessErrorThrowsDemoException() {
.auth().oauth2(getToken("system.admin@greenbuildings.com", "system.admin"))
.body(body)
.when()
.post("/dev/save-business-error")
.post("/enterprise/dev/save-business-error")
.then()
.log().all()
.statusCode(HttpStatus.EXPECTATION_FAILED.value())
Expand All @@ -34,7 +34,7 @@ void saveTechnicalErrorThrowsTechnicalException() {
.auth().oauth2(getToken("system.admin@greenbuildings.com", "system.admin"))
.body(body)
.when()
.post("/dev/save-technical-error")
.post("/enterprise/dev/save-technical-error")
.then()
.log().all()
.statusCode(500)
Expand Down
Loading
Loading