-
-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
152 additions
and
600 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 8 additions & 23 deletions
31
.../generator/server/springboot/logging/logstash/application/LogstashApplicationService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,20 @@ | ||
package tech.jhipster.lite.generator.server.springboot.logging.logstash.application; | ||
|
||
import org.springframework.stereotype.Service; | ||
import tech.jhipster.lite.generator.project.domain.Project; | ||
import tech.jhipster.lite.generator.server.springboot.logging.logstash.domain.LogstashService; | ||
import tech.jhipster.lite.generator.server.springboot.logging.logstash.domain.LogstashModuleFactory; | ||
import tech.jhipster.lite.module.domain.JHipsterModule; | ||
import tech.jhipster.lite.module.domain.properties.JHipsterModuleProperties; | ||
|
||
@Service | ||
public class LogstashApplicationService { | ||
|
||
private final LogstashService logstashService; | ||
private final LogstashModuleFactory factory; | ||
|
||
public LogstashApplicationService(LogstashService logstashService) { | ||
this.logstashService = logstashService; | ||
public LogstashApplicationService() { | ||
factory = new LogstashModuleFactory(); | ||
} | ||
|
||
public void init(Project project) { | ||
logstashService.init(project); | ||
} | ||
|
||
public void addDependencies(Project project) { | ||
logstashService.addDependencies(project); | ||
} | ||
|
||
public void addJavaFiles(Project project) { | ||
logstashService.addJavaFiles(project); | ||
} | ||
|
||
public void addProperties(Project project) { | ||
logstashService.addProperties(project); | ||
} | ||
|
||
public void addLoggerInConfiguration(Project project) { | ||
logstashService.addLoggerInConfiguration(project); | ||
public JHipsterModule buildModule(JHipsterModuleProperties properties) { | ||
return factory.buildModule(properties); | ||
} | ||
} |
17 changes: 0 additions & 17 deletions
17
...java/tech/jhipster/lite/generator/server/springboot/logging/logstash/domain/Logstash.java
This file was deleted.
Oops, something went wrong.
114 changes: 0 additions & 114 deletions
114
...pster/lite/generator/server/springboot/logging/logstash/domain/LogstashDomainService.java
This file was deleted.
Oops, something went wrong.
52 changes: 52 additions & 0 deletions
52
...pster/lite/generator/server/springboot/logging/logstash/domain/LogstashModuleFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package tech.jhipster.lite.generator.server.springboot.logging.logstash.domain; | ||
|
||
import static tech.jhipster.lite.module.domain.JHipsterModule.*; | ||
|
||
import tech.jhipster.lite.error.domain.Assert; | ||
import tech.jhipster.lite.module.domain.JHipsterModule; | ||
import tech.jhipster.lite.module.domain.JHipsterSource; | ||
import tech.jhipster.lite.module.domain.LogLevel; | ||
import tech.jhipster.lite.module.domain.properties.JHipsterModuleProperties; | ||
|
||
public class LogstashModuleFactory { | ||
|
||
private static final JHipsterSource SOURCE = from("server/springboot/logging/logstash"); | ||
|
||
private static final String LOGSTASH_SECONDARY = "technical/infrastructure/secondary/logstash"; | ||
|
||
public JHipsterModule buildModule(JHipsterModuleProperties properties) { | ||
Assert.notNull("properties", properties); | ||
|
||
String packagePath = properties.basePackage().path(); | ||
|
||
//@formatter:off | ||
return moduleBuilder(properties) | ||
.javaDependencies() | ||
.addDependency(groupId("net.logstash.logback"), artifactId("logstash-logback-encoder"), versionSlug("logstash-logback-encoder")) | ||
.and() | ||
.files() | ||
.batch(SOURCE.append("main"), toSrcMainJava().append(packagePath).append(LOGSTASH_SECONDARY)) | ||
.template("LogstashTcpConfiguration.java") | ||
.template("LogstashTcpLifeCycle.java") | ||
.template("LogstashTcpProperties.java") | ||
.and() | ||
.batch(SOURCE.append("test"), toSrcTestJava().append(packagePath).append(LOGSTASH_SECONDARY)) | ||
.template("LogstashTcpConfigurationIT.java") | ||
.template("LogstashTcpConfigurationTest.java") | ||
.template("LogstashTcpLifeCycleTest.java") | ||
.template("LogstashTcpPropertiesTest.java") | ||
.and() | ||
.and() | ||
.springMainProperties() | ||
.set(propertyKey("application.logging.logstash.tcp.enabled"), propertyValue("false")) | ||
.set(propertyKey("application.logging.logstash.tcp.host"), propertyValue("localhost")) | ||
.set(propertyKey("application.logging.logstash.tcp.port"), propertyValue("5000")) | ||
.set(propertyKey("application.logging.logstash.tcp.ring-buffer-size"), propertyValue("8192")) | ||
.set(propertyKey("application.logging.logstash.tcp.shutdown_grace_period"), propertyValue("PT1M")) | ||
.and() | ||
.springTestLogger("net.logstash.logback", LogLevel.ERROR) | ||
.springTestLogger("org.jboss.logging", LogLevel.WARN) | ||
.build(); | ||
//@formatter:on | ||
} | ||
} |
12 changes: 0 additions & 12 deletions
12
...ch/jhipster/lite/generator/server/springboot/logging/logstash/domain/LogstashService.java
This file was deleted.
Oops, something went wrong.
32 changes: 0 additions & 32 deletions
32
...r/server/springboot/logging/logstash/infrastructure/config/LogstashBeanConfiguration.java
This file was deleted.
Oops, something went wrong.
23 changes: 23 additions & 0 deletions
23
...erver/springboot/logging/logstash/infrastructure/primary/LogstashModuleConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package tech.jhipster.lite.generator.server.springboot.logging.logstash.infrastructure.primary; | ||
|
||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import tech.jhipster.lite.generator.server.springboot.logging.logstash.application.LogstashApplicationService; | ||
import tech.jhipster.lite.module.domain.properties.JHipsterModulePropertiesDefinition; | ||
import tech.jhipster.lite.module.infrastructure.primary.JHipsterModuleApiDoc; | ||
import tech.jhipster.lite.module.infrastructure.primary.JHipsterModuleResource; | ||
|
||
@Configuration | ||
class LogstashModuleConfiguration { | ||
|
||
@Bean | ||
JHipsterModuleResource logstashModule(LogstashApplicationService logstash) { | ||
return JHipsterModuleResource | ||
.builder() | ||
.legacyUrl("/api/servers/spring-boot/log-tools/logstash") | ||
.slug("logstash") | ||
.propertiesDefinition(JHipsterModulePropertiesDefinition.builder().addBasePackage().addIndentation().build()) | ||
.apiDoc(new JHipsterModuleApiDoc("Spring Boot - Logging", "Add Logstash TCP appender")) | ||
.factory(logstash::buildModule); | ||
} | ||
} |
35 changes: 0 additions & 35 deletions
35
...ator/server/springboot/logging/logstash/infrastructure/primary/rest/LogstashResource.java
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Feature: logstash module | ||
|
||
Scenario: Should apply logstash module | ||
When I apply "logstash" module to default project with maven file | ||
| packageName | tech.jhipster.chips | | ||
Then I should have files in "src/main/java/tech/jhipster/chips/technical/infrastructure/secondary/logstash" | ||
| LogstashTcpConfiguration.java | |
Oops, something went wrong.