Updated directory structure

This commit is contained in:
Jim Martens 2020-07-07 23:00:19 +02:00
parent ce00bd39ee
commit ef60abc4f9
26 changed files with 44 additions and 61 deletions

View File

@ -1,28 +1,11 @@
# Instructions for using the template
## Introduction
This template is based upon best practices and uses Spring Boot to implement
REST APIs.
## Steps
* clone the project and create a new repository
* replace all occurences of 'template' with your service name, 'Template' accordingly (mind the cases)
* import the project in your IDE
* run initial `gradlew build`
**============ // todo: Ab hier die Doku überprüfen und ggf. ergänzen ==========**
# Template
**// todo: Hier sollte das Projekt etwas beschrieben werden**
# OParl Service
## Git
The repository of ... is located under https://git.2martens.de/2martens/template-service.git
The repository of the OParl service is located under https://git.2martens.de/2martens/oparl-service.git
It is partially encrypted with git-crypt and has to be decrypted first:
```bash
git-crypt unlock %USERPROFILE%/.git-crypt-key
git-crypt unlock %USERPROFILE%/.my-git-crypt-key
```

View File

@ -1,4 +1,4 @@
projectname=template-service
projectname=oparl-service
projectgroup=de.twomartens
projectSourceCompatibility=11
org.gradle.daemon=true

View File

@ -1,8 +1,8 @@
package de.twomartens.templateservice;
package de.twomartens.oparlservice;
import de.twomartens.templateservice.entity.Greeting;
import de.twomartens.templateservice.interceptors.RequestTypeInterceptor;
import de.twomartens.templateservice.interceptors.TraceIdInterceptor;
import de.twomartens.oparlservice.entity.Greeting;
import de.twomartens.oparlservice.interceptors.RequestTypeInterceptor;
import de.twomartens.oparlservice.interceptors.TraceIdInterceptor;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
@ -17,7 +17,7 @@ import static org.springframework.boot.test.context.SpringBootTest.WebEnvironmen
@SpringJUnitConfig
@SpringBootTest(webEnvironment = RANDOM_PORT)
class TemplateServiceRestTests {
class OParlServiceRestTests {
@Autowired
private RestTemplate restTemplate;

View File

@ -1,4 +1,4 @@
package de.twomartens.templateservice;
package de.twomartens.oparlservice;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
@ -10,20 +10,20 @@ import java.util.Optional;
@Slf4j
@SpringBootApplication
@EnableScheduling
public class TemplateServiceApplication {
public class OParlServiceApplication {
public static void main(String[] args) {
log.info(">>> {}:{} <<<", getTitle(), getVersion());
SpringApplication.run(TemplateServiceApplication.class, args);
SpringApplication.run(OParlServiceApplication.class, args);
}
private static String getTitle() {
return Optional.ofNullable(TemplateServiceApplication.class.getPackage().getImplementationTitle())
return Optional.ofNullable(OParlServiceApplication.class.getPackage().getImplementationTitle())
.orElse("start");
}
private static String getVersion() {
return Optional.ofNullable(TemplateServiceApplication.class.getPackage().getImplementationVersion())
return Optional.ofNullable(OParlServiceApplication.class.getPackage().getImplementationVersion())
.orElse("snapshot");
}
}

View File

@ -1,7 +1,7 @@
package de.twomartens.templateservice.actuator;
package de.twomartens.oparlservice.actuator;
import de.twomartens.templateservice.interceptors.RequestTypeInterceptor;
import de.twomartens.templateservice.interceptors.TraceIdInterceptor;
import de.twomartens.oparlservice.interceptors.RequestTypeInterceptor;
import de.twomartens.oparlservice.interceptors.TraceIdInterceptor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.actuate.health.HealthIndicator;

View File

@ -1,8 +1,8 @@
package de.twomartens.templateservice.actuator;
package de.twomartens.oparlservice.actuator;
import de.twomartens.templateservice.entity.Greeting;
import de.twomartens.templateservice.interceptors.RequestTypeInterceptor;
import de.twomartens.templateservice.interceptors.TraceIdInterceptor;
import de.twomartens.oparlservice.entity.Greeting;
import de.twomartens.oparlservice.interceptors.RequestTypeInterceptor;
import de.twomartens.oparlservice.interceptors.TraceIdInterceptor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.actuate.health.HealthIndicator;
import org.springframework.boot.autoconfigure.web.ServerProperties;

View File

@ -1,4 +1,4 @@
package de.twomartens.templateservice.configs;
package de.twomartens.oparlservice.configs;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
@ -6,8 +6,8 @@ import org.springframework.context.annotation.Configuration;
@Data
@Configuration
@ConfigurationProperties(prefix = "de.twomartens.templateservice")
public class TemplateServiceProperties {
@ConfigurationProperties(prefix = "de.twomartens.oparlservice")
public class OParlServiceProperties {
private final Template template = new Template();

View File

@ -1,7 +1,7 @@
package de.twomartens.templateservice.configs;
package de.twomartens.oparlservice.configs;
import de.twomartens.templateservice.interceptors.RequestTypeInterceptor;
import de.twomartens.templateservice.interceptors.TraceIdInterceptor;
import de.twomartens.oparlservice.interceptors.RequestTypeInterceptor;
import de.twomartens.oparlservice.interceptors.TraceIdInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.client.ClientHttpRequestInterceptor;

View File

@ -1,7 +1,7 @@
package de.twomartens.templateservice.control;
package de.twomartens.oparlservice.control;
import de.twomartens.templateservice.entity.Greeting;
import de.twomartens.templateservice.service.GreetingService;
import de.twomartens.oparlservice.entity.Greeting;
import de.twomartens.oparlservice.service.GreetingService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

View File

@ -1,4 +1,4 @@
package de.twomartens.templateservice.entity;
package de.twomartens.oparlservice.entity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;

View File

@ -1,4 +1,4 @@
package de.twomartens.templateservice.interceptors;
package de.twomartens.oparlservice.interceptors;
import lombok.NoArgsConstructor;
import org.slf4j.MDC;

View File

@ -1,4 +1,4 @@
package de.twomartens.templateservice.interceptors;
package de.twomartens.oparlservice.interceptors;
import lombok.NoArgsConstructor;
import org.slf4j.MDC;

View File

@ -1,6 +1,6 @@
package de.twomartens.templateservice.service;
package de.twomartens.oparlservice.service;
import de.twomartens.templateservice.configs.TemplateServiceProperties;
import de.twomartens.oparlservice.configs.OParlServiceProperties;
import io.micrometer.core.instrument.Counter;
import io.micrometer.core.instrument.MeterRegistry;
import lombok.extern.slf4j.Slf4j;
@ -11,10 +11,10 @@ import org.springframework.stereotype.Service;
public class GreetingService {
private final MeterRegistry meterRegistry;
private final TemplateServiceProperties properties;
private final OParlServiceProperties properties;
private final Counter counter;
public GreetingService(MeterRegistry meterRegistry, TemplateServiceProperties properties) {
public GreetingService(MeterRegistry meterRegistry, OParlServiceProperties properties) {
this.meterRegistry = meterRegistry;
this.properties = properties;
counter = meterRegistry.counter("infodb.callCounter");

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,6 +1,6 @@
package de.twomartens.templateservice.control;
package de.twomartens.oparlservice.control;
import de.twomartens.templateservice.service.GreetingService;
import de.twomartens.oparlservice.service.GreetingService;
import org.hamcrest.Matchers;
import org.junit.jupiter.api.Test;
import org.mockito.BDDMockito;

View File

@ -1,6 +1,6 @@
package de.twomartens.templateservice.service;
package de.twomartens.oparlservice.service;
import de.twomartens.templateservice.configs.TemplateServiceProperties;
import de.twomartens.oparlservice.configs.OParlServiceProperties;
import io.micrometer.core.instrument.simple.SimpleMeterRegistry;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
@ -17,10 +17,10 @@ class GreetingServiceTest {
private GreetingService service;
@Mock
private TemplateServiceProperties properties;
private OParlServiceProperties properties;
@Mock
private TemplateServiceProperties.Template template;
private OParlServiceProperties.Template template;
@BeforeEach
void beforeEach() {

View File

@ -1,6 +1,6 @@
rootProject.name = projectname
include 'template-server'
include 'oparl-server'
rootProject.children.each { subproject ->
subproject.buildFileName = "${subproject.name}.gradle"