-
-
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.
Migrate mssql domain service to new module system
- Loading branch information
1 parent
6fb0ad9
commit ebf205d
Showing
20 changed files
with
215 additions
and
579 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
82 changes: 82 additions & 0 deletions
82
...h/jhipster/lite/generator/server/springboot/database/mssql/domain/MsSQLModuleFactory.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,82 @@ | ||
package tech.jhipster.lite.generator.server.springboot.database.mssql.domain; | ||
|
||
import static tech.jhipster.lite.generator.server.springboot.core.domain.SpringBoot.NEEDLE_LOGBACK_LOGGER; | ||
import static tech.jhipster.lite.generator.server.springboot.database.sqlcommon.domain.SQLCommonModuleBuilder.logger; | ||
import static tech.jhipster.lite.generator.server.springboot.database.sqlcommon.domain.SQLCommonModuleBuilder.sqlCommonModuleBuilder; | ||
import static tech.jhipster.lite.module.domain.JHipsterModule.*; | ||
|
||
import tech.jhipster.lite.docker.domain.DockerImage; | ||
import tech.jhipster.lite.docker.domain.DockerImages; | ||
import tech.jhipster.lite.error.domain.Assert; | ||
import tech.jhipster.lite.generator.project.domain.DatabaseType; | ||
import tech.jhipster.lite.generator.server.springboot.common.domain.Level; | ||
import tech.jhipster.lite.module.domain.JHipsterModule; | ||
import tech.jhipster.lite.module.domain.JHipsterSource; | ||
import tech.jhipster.lite.module.domain.properties.JHipsterModuleProperties; | ||
|
||
public class MsSQLModuleFactory { | ||
|
||
private static final String DEST_SECONDARY = "technical/infrastructure/secondary/mssql"; | ||
|
||
private final DockerImages dockerImages; | ||
|
||
public MsSQLModuleFactory(DockerImages dockerImages) { | ||
Assert.notNull("dockerImages", dockerImages); | ||
|
||
this.dockerImages = dockerImages; | ||
} | ||
|
||
public JHipsterModule buildModule(JHipsterModuleProperties properties) { | ||
Assert.notNull("properties", properties); | ||
|
||
DockerImage dockerImage = dockerImages.get("mcr.microsoft.com/mssql/server"); | ||
JHipsterSource source = from("server/springboot/database/" + DatabaseType.MSSQL.id()); | ||
|
||
return sqlCommonModuleBuilder(properties, DatabaseType.MSSQL, dockerImage, documentationTitle("MsSQL"), artifactId("mssqlserver")) | ||
.files() | ||
.add(source.template("container-license-acceptance.txt"), to("src/test/resources/container-license-acceptance.txt")) | ||
.add( | ||
source.template("MsSQLTestContainerExtension.java"), | ||
toSrcTestJava().append(properties.basePackage().path()).append(DEST_SECONDARY).append("MsSQLTestContainerExtension.java") | ||
) | ||
.and() | ||
.javaDependencies() | ||
.dependency(groupId("com.microsoft.sqlserver"), artifactId("mssql-jdbc")) | ||
.and() | ||
.springMainProperties() | ||
.set( | ||
propertyKey("spring.datasource.url"), | ||
propertyValue("jdbc:sqlserver://localhost:1433;database=" + properties.projectBaseName().name() + ";trustServerCertificate=true") | ||
) | ||
.set(propertyKey("spring.datasource.username"), propertyValue("SA")) | ||
.set(propertyKey("spring.datasource.password"), propertyValue("yourStrong(!)Password")) | ||
.set(propertyKey("spring.datasource.driver-class-name"), propertyValue("com.microsoft.sqlserver.jdbc.SQLServerDriver")) | ||
.set(propertyKey("spring.jpa.hibernate.ddl-auto"), propertyValue("update")) | ||
.set(propertyKey("spring.jpa.properties.hibernate.criteria.literal_handling_mode"), propertyValue("BIND")) | ||
.set(propertyKey("spring.jpa.properties.hibernate.dialect"), propertyValue("org.hibernate.dialect.SQLServer2012Dialect")) | ||
.set(propertyKey("spring.jpa.properties.hibernate.format_sql"), propertyValue("true")) | ||
.set(propertyKey("spring.jpa.properties.hibernate.jdbc.fetch_size"), propertyValue("150")) | ||
.and() | ||
.springTestProperties() | ||
.set( | ||
propertyKey("spring.datasource.url"), | ||
propertyValue( | ||
"jdbc:tc:sqlserver:" + | ||
dockerImage.version() + | ||
":///;database=" + | ||
properties.projectBaseName().name() + | ||
";trustServerCertificate=true?TC_TMPFS=/testtmpfs:rw" | ||
) | ||
) | ||
.set(propertyKey("spring.datasource.username"), propertyValue("SA")) | ||
.set(propertyKey("spring.datasource.password"), propertyValue("yourStrong(!)Password")) | ||
.and() | ||
.optionalReplacements() | ||
.in("src/main/resources/logback-spring.xml") | ||
.add(text(NEEDLE_LOGBACK_LOGGER), logger("com.microsoft.sqlserver", Level.WARN)) | ||
.add(text(NEEDLE_LOGBACK_LOGGER), logger("org.reflections", Level.WARN)) | ||
.and() | ||
.and() | ||
.build(); | ||
} | ||
} |
48 changes: 0 additions & 48 deletions
48
...main/java/tech/jhipster/lite/generator/server/springboot/database/mssql/domain/Mssql.java
This file was deleted.
Oops, something went wrong.
130 changes: 0 additions & 130 deletions
130
...h/jhipster/lite/generator/server/springboot/database/mssql/domain/MssqlDomainService.java
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
...va/tech/jhipster/lite/generator/server/springboot/database/mssql/domain/MssqlService.java
This file was deleted.
Oops, something went wrong.
40 changes: 0 additions & 40 deletions
40
...erator/server/springboot/database/mssql/infrastructure/config/MssqlBeanConfiguration.java
This file was deleted.
Oops, something went wrong.
25 changes: 25 additions & 0 deletions
25
...tor/server/springboot/database/mssql/infrastructure/primary/MsSQLModuleConfiguration.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,25 @@ | ||
package tech.jhipster.lite.generator.server.springboot.database.mssql.infrastructure.primary; | ||
|
||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import tech.jhipster.lite.generator.server.springboot.database.mssql.application.MsSQLApplicationService; | ||
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 MsSQLModuleConfiguration { | ||
|
||
public static final String URL_MSSQL_MODULE = "/api/servers/spring-boot/databases/mssql"; | ||
|
||
@Bean | ||
JHipsterModuleResource msSQLModule(MsSQLApplicationService applicationService) { | ||
return JHipsterModuleResource | ||
.builder() | ||
.legacyUrl(URL_MSSQL_MODULE) | ||
.slug("mssql") | ||
.propertiesDefinition(JHipsterModulePropertiesDefinition.builder().addBasePackage().addIndentation().addProjectBaseName().build()) | ||
.apiDoc(new JHipsterModuleApiDoc("Spring Boot - Database", "Add MsSQL to project")) | ||
.factory(applicationService::build); | ||
} | ||
} |
35 changes: 0 additions & 35 deletions
35
...generator/server/springboot/database/mssql/infrastructure/primary/rest/MssqlResource.java
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...erver/DatabaseConfiguration.java.mustache → ...mssql/DatabaseConfiguration.java.mustache
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
Oops, something went wrong.