Skip to content

Commit

Permalink
Merge pull request #238 from SeC-Hikit/dev/#237
Browse files Browse the repository at this point in the history
RELEASE 1.5
  • Loading branch information
loreV authored Jan 6, 2023
2 parents d0c6207 + 7e68f7c commit da57af7
Show file tree
Hide file tree
Showing 15 changed files with 36 additions and 32 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ FROM openjdk:11

WORKDIR ./home

COPY ./backend/target/backend-2.0-SNAPSHOT.jar .
COPY ./backend/target/backend-1.5.jar .
COPY ./docker/application.properties .

RUN mkdir -p ./deployment ./tmp ./logs

CMD ["java", "-jar", "./backend-2.0-SNAPSHOT.jar", "--spring.config.location=file:///home/application.properties"]
CMD ["java", "-jar", "./backend-1.5.jar", "--spring.config.location=file:///home/application.properties"]

EXPOSE 8990
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Hikit
Hikit is a collaborative service that manages high level geo and meta data related to trails.
It is intended to provide trail support teams (like the [CAI](https://www.cai.it/) ones) with a rich set of features to update and maintain a trail library, while making this data available to users.
# Hikit Service
Hikit service manages high level geo and meta-data related to trails.
It is intended to provide organizations (like the [CAI](https://www.cai.it/) ones) with a rich set of features to update and maintain a trail rich format library, while making this data available to users.

Currently, the library supports accessibility-notifications, user reports, maintenance planning, generic/specific POIs and other features all linked with trails.
Currently, it supports a wide set of features like accessibility-notifications, user trail accidents reports, maintenance planning, generic/specific POIs and other features all linked with trails.

## Build
### Prerequisites
Expand All @@ -13,12 +13,12 @@ Currently, the library supports accessibility-notifications, user reports, maint
After cloning the repo, simply run `mvn install -f root/pom.xml`.

### Deployment Build
To incude all dependencies in a portable uber-jar, run `mvn install -P package`.
To include all dependencies in a portable uber-jar, run `mvn install -P package`.

### Test
There are two main types of tests written to address the S&C QA: unit test and integration test.
The latter requires the [dependencies](#Dependencies) to be up and running as it tests application operations connecting to them.
Once the dependencies are made available, to run the integration tests, simply execute `mvn install -P it`.
### Testing
There are two main types of tests written to address the Hikit QA: unit and integration tests.
The latter requires the [dependencies](#Dependencies) to be up and running as it runs application operations connecting to them.
Once the dependencies are made available, simply execute `mvn install -P it`.

## Run

Expand All @@ -44,7 +44,7 @@ In case you want to test run Hikit in combination with all its dependencies:
The service will be available at `http://localhost:8990/api/v<N>` (where `<N>` stands for the version number)

### Production
Hikit takes advantage of a Keycloak instance, as it does not implement user and roles natively.
As for production, Hikit takes advantage of a Keycloak instance, as it does not implement user and roles natively.
In order to configure a Keycloak instance, see the Keycloak official documentation.

### Properties
Expand Down
8 changes: 4 additions & 4 deletions backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
<parent>
<groupId>org.sec</groupId>
<artifactId>root</artifactId>
<version>2.0-SNAPSHOT</version>
<version>1.5</version>
<relativePath>../root</relativePath>
</parent>

<artifactId>backend</artifactId>
<version>2.0-SNAPSHOT</version>
<version>1.5</version>

<properties>
<java.version>1.8</java.version>
Expand All @@ -27,12 +27,12 @@
<dependency>
<groupId>org.sec</groupId>
<artifactId>rest</artifactId>
<version>2.0-SNAPSHOT</version>
<version>1.5</version>
</dependency>
<dependency>
<groupId>org.sec</groupId>
<artifactId>data</artifactId>
<version>2.0-SNAPSHOT</version>
<version>1.5</version>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package org.sc.adapter

import com.fasterxml.jackson.databind.ObjectMapper
import org.sc.configuration.AppProperties
import org.sc.configuration.AppProperties.LOCAL_IP_ADDRESS
import org.sc.adapter.response.AltitudeApiRequestPoint
import org.sc.adapter.response.AltitudeApiResponse
import org.sc.adapter.response.AltitudeServiceRequest
import org.sc.configuration.AppProperties
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Service
import java.io.BufferedReader
Expand Down Expand Up @@ -34,7 +33,8 @@ class AltitudeServiceAdapter @Autowired constructor(appProperties: AppProperties
val apiGetEndpoint = "http://$pathToServiceApi?locations=$latitude,$longitude"
return try {
val getCall = URL(apiGetEndpoint).readText()
val gsonBuilder: AltitudeApiResponse = objectMapper.readValue(getCall, AltitudeApiResponse::class.java)
val gsonBuilder: AltitudeApiResponse =
objectMapper.readValue(getCall, AltitudeApiResponse::class.java)
listOf(gsonBuilder.results.first().elevation)
} catch (e: Exception) {
logger.severe("Could not connect to altitude service or read its response")
Expand Down
4 changes: 4 additions & 0 deletions backend/src/main/java/org/sc/adapter/WeatherServiceAdapter.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package org.sc.adapter

class WeatherServiceAdapter {
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class AccessibilityReportMailAdapter @Autowired constructor(private val mailAdap
private val logger = Logger.getLogger(AccessibilityReportMailAdapter::class.java.name)

companion object {
const val subject = "[S&C] Attivazione segnalazione"
const val subject = "[Hikit] Attivazione segnalazione"
const val message = "Il %s, hai inviato una segnalazione " +
"tramite S&C al '%s' per il sentiero '%s' (ID da sistema: '%s'). </br> " +
"Descrizione: '%s'.<br/>Per attivare la segnalazione, clicca <a href=\"%s\" target='_blank'>qui</a>, " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
public class AppProperties {

public static final String APP_NAME = "Sentieri&Cartografia";
public static final String DISPLAYED_VERSION = "1.4.0";
public static final String DISPLAYED_VERSION = "1.5.0-SNAPSHOT";
public static final String LOCAL_IP_ADDRESS = "127.0.0.1";

private final String port;
Expand Down
6 changes: 3 additions & 3 deletions backend/src/main/java/org/sc/data/repository/PoiDAO.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ public List<Poi> getById(final String id) {
return toPoisList(collection.find(new Document(Poi.OBJECT_ID, id)));
}

public List<Poi> getByCode(final String code,
final int page,
final int count) {
public List<Poi> getByTrailCode(final String code,
final int page,
final int count) {
return toPoisList(collection.find(new Document(Poi.TRAIL_CODES, code)).skip(page).limit(count));
}

Expand Down
2 changes: 1 addition & 1 deletion backend/src/main/java/org/sc/manager/PoiManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class PoiManager @Autowired constructor(
}

fun getPoiByTrailId(code: String, page: Int, count: Int): List<PoiDto> {
return poiDAO.getByCode(code, page, count).map { poiDtoMapper.poiToPoiDto(it) }
return poiDAO.getByTrailCode(code, page, count).map { poiDtoMapper.poiToPoiDto(it) }
}

fun getPoiByMacro(macro: String, page: Int, count: Int): List<PoiDto> {
Expand Down
2 changes: 1 addition & 1 deletion backend/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ temp.storage.path=/Users/lorenzoverri/Desktop/SeC/webserver/temp
# Open API
springdoc.swagger-ui.path=/api-ui.html
springdoc.api-docs.path=/api-docs
springdoc.info.version=2.0-SNAPSHOT
springdoc.info.version=1.5

# Email
spring.mail.protocol=smtp
Expand Down
2 changes: 1 addition & 1 deletion docker/build.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/usr/bin/env bash
docker build -t 'sec/backend-2.0-SNAPSHOT' .
docker build -t 'sec/backend-1.5' .
2 changes: 1 addition & 1 deletion docker/docker-compose.cluster.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: '3.0'
services:
sec_backend:
image: "sec/backend-2.0-SNAPSHOT"
image: "sec/backend-1.5"
ports:
- "8990:8990"
restart: always
Expand Down
2 changes: 1 addition & 1 deletion root/data/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>root</artifactId>
<groupId>org.sec</groupId>
<version>2.0-SNAPSHOT</version>
<version>1.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion root/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<groupId>org.sec</groupId>
<artifactId>root</artifactId>
<version>2.0-SNAPSHOT</version>
<version>1.5</version>
<name>Sentieri e Cartografia</name>
<description>Sentieri e Cartografia root pom</description>
<packaging>pom</packaging>
Expand Down
4 changes: 2 additions & 2 deletions root/rest/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>root</artifactId>
<groupId>org.sec</groupId>
<version>2.0-SNAPSHOT</version>
<version>1.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand All @@ -15,7 +15,7 @@
<dependency>
<groupId>org.sec</groupId>
<artifactId>data</artifactId>
<version>2.0-SNAPSHOT</version>
<version>1.5</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
Expand Down

0 comments on commit da57af7

Please sign in to comment.