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

Feature/jpa secret #300

Merged
merged 4 commits into from
Jan 12, 2023
Merged
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
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package=co.com.bancolombia
systemProp.version=2.4.6
systemProp.version=2.4.5
simulateRest=true
4 changes: 2 additions & 2 deletions src/main/java/co/com/bancolombia/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ public class Constants {
public static final String APP_SERVICE = "app-service";
public static final String PATH_GRAPHQL = "/graphqlpath";
public static final String SECRETS_VERSION = "3.2.0";
public static final String SPRING_BOOT_VERSION = "2.7.6";
public static final String SPRING_BOOT_VERSION = "2.7.7";
public static final String SONAR_VERSION = "3.0";
public static final String LOMBOK_VERSION = "1.18.24";
public static final String JACOCO_VERSION = "0.8.8";
public static final String COBERTURA_VERSION = "3.0.0";
public static final String RCOMMONS_ASYNC_COMMONS_STARTER_VERSION = "1.0.5";
public static final String RCOMMONS_OBJECT_MAPPER_VERSION = "0.1.0";
public static final String PLUGIN_VERSION = "2.4.6";
public static final String PLUGIN_VERSION = "2.4.5";
public static final String GRADLE_WRAPPER_VERSION = "7.4.2";
public static final String KOTLIN_VERSION = "1.6.10";
public static final String AWS_BOM_VERSION = "2.18.39";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public ModuleBuilder(Project project) {
params.put("coberturaVersion", Constants.COBERTURA_VERSION);
params.put("lombokVersion", Constants.LOMBOK_VERSION);
params.put("commonsJmsVersion", Constants.COMMONS_JMS_VERSION);
params.put("secretsVersion", Constants.SECRETS_VERSION);
loadPackage();
loadLanguage();
}
Expand Down
18 changes: 17 additions & 1 deletion src/main/java/co/com/bancolombia/task/GenerateStructureTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public class GenerateStructureTask extends CleanArchitectureDefaultTask {
private String name = "cleanArchitecture";
private BooleanOption lombok = BooleanOption.TRUE;
private BooleanOption metrics = BooleanOption.TRUE;
private BooleanOption force = BooleanOption.FALSE;
private Language language = Language.JAVA;
private JavaVersion javaVersion = JavaVersion.VERSION_11;

Expand Down Expand Up @@ -63,6 +64,11 @@ public void setJavaVersion(JavaVersion javaVersion) {
this.javaVersion = javaVersion;
}

@Option(option = "force", description = "Force regenerates all files")
public void setForce(BooleanOption force) {
this.force = force;
}

@OptionValues("type")
public List<ProjectType> getAvailableProjectTypes() {
return Arrays.asList(ProjectType.values());
Expand All @@ -78,6 +84,16 @@ public List<BooleanOption> getLombokOptions() {
return Arrays.asList(BooleanOption.values());
}

@OptionValues("metrics")
public List<BooleanOption> getMetricsOptions() {
return Arrays.asList(BooleanOption.values());
}

@OptionValues("force")
public List<BooleanOption> getForceOptions() {
return Arrays.asList(BooleanOption.values());
}

@OptionValues("javaVersion")
public List<JavaVersion> getJavaVersions() {
return Arrays.asList(JavaVersion.values());
Expand All @@ -103,7 +119,7 @@ public void generateStructureTask() throws IOException, CleanException {
builder.addParam("java17", javaVersion == JavaVersion.VERSION_17);

boolean exists = FileUtils.exists(builder.getProject().getProjectDir().getPath(), MAIN_GRADLE);
if (exists) {
if (exists && force == BooleanOption.FALSE) {
logger.lifecycle(
"Existing project detected, regenerating main.gradle, build.gradle and gradle.properties");
loadProperty("package");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
dependencies {
implementation project(':model')

implementation 'com.github.bancolombia:aws-secrets-manager-sync:{{secretsVersion}}'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.reactivecommons.utils:object-mapper-api:{{objectMapperVersion}}'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
dependencies {
implementation(project(":model"))
implementation("org.springframework.boot:spring-boot-starter-data-redis-reactive")
implementation("com.github.bancolombia:aws-secrets-manager-sync:3.0.0")
implementation("com.github.bancolombia:aws-secrets-manager-sync:{{secretsVersion}}")
implementation("org.reactivecommons.utils:object-mapper-api:{{objectMapperVersion}}")

testImplementation("org.reactivecommons.utils:object-mapper:{{objectMapperVersion}}")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
dependencies {
implementation project(':model')
implementation 'org.springframework.boot:spring-boot-starter-data-redis-reactive'
implementation 'com.github.bancolombia:aws-secrets-manager-sync:3.0.0'
implementation 'com.github.bancolombia:aws-secrets-manager-sync:{{secretsVersion}}'
implementation 'org.reactivecommons.utils:object-mapper-api:{{objectMapperVersion}}'

testImplementation 'org.reactivecommons.utils:object-mapper:{{objectMapperVersion}}'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ dependencies {
implementation(project(":model"))
implementation("org.springframework.boot:spring-boot-starter-data-redis-reactive")
implementation("com.fasterxml.jackson.core:jackson-databind")
implementation("com.github.bancolombia:aws-secrets-manager-sync:3.0.0")
implementation("com.github.bancolombia:aws-secrets-manager-sync:{{secretsVersion}}")
implementation("org.reactivecommons.utils:object-mapper-api:{{objectMapperVersion}}")

testImplementation("org.reactivecommons.utils:object-mapper:{{objectMapperVersion}}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ dependencies {
implementation project(':model')
implementation 'org.springframework.boot:spring-boot-starter-data-redis-reactive'
implementation 'com.fasterxml.jackson.core:jackson-databind'
implementation 'com.github.bancolombia:aws-secrets-manager-sync:3.0.0'
implementation 'com.github.bancolombia:aws-secrets-manager-sync:{{secretsVersion}}'
implementation 'org.reactivecommons.utils:object-mapper-api:{{objectMapperVersion}}'

testImplementation 'org.reactivecommons.utils:object-mapper:{{objectMapperVersion}}'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
dependencies {
implementation(project(":model"))
implementation("org.springframework.boot:spring-boot-starter-data-redis")
implementation("com.github.bancolombia:aws-secrets-manager-sync:3.0.0")
implementation("com.github.bancolombia:aws-secrets-manager-sync:{{secretsVersion}}")
implementation("org.reactivecommons.utils:object-mapper-api:{{objectMapperVersion}}")

testImplementation("org.reactivecommons.utils:object-mapper:{{objectMapperVersion}}")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
dependencies {
implementation project(':model')
implementation 'org.springframework.boot:spring-boot-starter-data-redis'
implementation 'com.github.bancolombia:aws-secrets-manager-sync:3.0.0'
implementation 'com.github.bancolombia:aws-secrets-manager-sync:{{secretsVersion}}'
implementation 'org.reactivecommons.utils:object-mapper-api:{{objectMapperVersion}}'

testImplementation 'org.reactivecommons.utils:object-mapper:{{objectMapperVersion}}'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ dependencies {
implementation(project(":model"))
implementation("org.springframework.boot:spring-boot-starter-data-redis")
implementation("com.fasterxml.jackson.core:jackson-databind")
implementation("com.github.bancolombia:aws-secrets-manager-sync:3.0.0")
implementation("com.github.bancolombia:aws-secrets-manager-sync:{{secretsVersion}}")
implementation("org.reactivecommons.utils:object-mapper-api:{{objectMapperVersion}}")

testImplementation("org.reactivecommons.utils:object-mapper:{{objectMapperVersion}}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ dependencies {
implementation project(':model')
implementation 'org.springframework.boot:spring-boot-starter-data-redis'
implementation 'com.fasterxml.jackson.core:jackson-databind'
implementation 'com.github.bancolombia:aws-secrets-manager-sync:3.0.0'
implementation 'com.github.bancolombia:aws-secrets-manager-sync:{{secretsVersion}}'
implementation 'org.reactivecommons.utils:object-mapper-api:{{objectMapperVersion}}'

testImplementation 'org.reactivecommons.utils:object-mapper:{{objectMapperVersion}}'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
import static co.com.bancolombia.utils.FileUtilsTest.deleteStructure;
import static org.junit.Assert.*;

import co.com.bancolombia.Constants;
import co.com.bancolombia.Constants.BooleanOption;
import co.com.bancolombia.exceptions.CleanException;
import co.com.bancolombia.task.GenerateStructureTask.JavaVersion;
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
Expand Down Expand Up @@ -51,6 +52,33 @@ public void shouldReturnCoveragePluginTypes() {
assertEquals(Arrays.asList(GenerateStructureTask.CoveragePlugin.values()), types);
}

@Test
public void shouldReturnMetricsOptions() {
// Arrange
// Act
List<BooleanOption> types = task.getMetricsOptions();
// Assert
assertEquals(Arrays.asList(BooleanOption.values()), types);
}

@Test
public void shouldReturnForceOptions() {
// Arrange
// Act
List<BooleanOption> types = task.getForceOptions();
// Assert
assertEquals(Arrays.asList(BooleanOption.values()), types);
}

@Test
public void shouldReturnJavaVersion() {
// Arrange
// Act
List<JavaVersion> types = task.getJavaVersions();
// Assert
assertEquals(Arrays.asList(JavaVersion.values()), types);
}

@Test
public void generateStructure() throws IOException, CleanException {
// Arrange
Expand Down Expand Up @@ -111,7 +139,10 @@ public void generateStructureReactiveWithCoberturaNoLombok() throws IOException,
task.setName("projectTest");
task.setType(GenerateStructureTask.ProjectType.REACTIVE);
task.setCoveragePlugin(GenerateStructureTask.CoveragePlugin.COBERTURA);
task.setStatusLombok(Constants.BooleanOption.FALSE);
task.setStatusLombok(BooleanOption.FALSE);
task.setMetrics(BooleanOption.FALSE);
task.setForce(BooleanOption.FALSE);
task.setJavaVersion(JavaVersion.VERSION_11);
// Act
task.generateStructureTask();
// Assert
Expand Down Expand Up @@ -167,7 +198,7 @@ public void generateStructureOnExistingProject() throws IOException, CleanExcept
@Test
public void generateStructureOnExistingProjectNoLombok() throws IOException, CleanException {
// Arrange
task.setStatusLombok(Constants.BooleanOption.FALSE);
task.setStatusLombok(BooleanOption.FALSE);
task.generateStructureTask();
// Act
task.generateStructureTask();
Expand All @@ -182,7 +213,7 @@ public void generateStructureOnExistingProjectNoLombok() throws IOException, Cle
public void shouldGetLombokOptions() {
// Arrange
// Act
List<Constants.BooleanOption> options = task.getLombokOptions();
List<BooleanOption> options = task.getLombokOptions();
// Assert
assertEquals(2, options.size());
}
Expand Down