diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 301acc9e..8b3a8648 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -76,7 +76,7 @@ jobs: # # Hey! You'll probably want to adjust below this point: it deploys newly published versions to dev! # - # You'll need to create a new chart entry in Beehive first, at https://broad.io/beehive/charts/new (chart + # You'll need to create a new chart entry in Beehive first, at https://broad.io/beehive/charts/new (chart # names can't be changed, so be sure beforehand). Replace 'javatemplate' below with whatever name you choose. # # You'll also need to add some access to your new repo to allow it to run these steps. We have docs on the @@ -92,7 +92,7 @@ jobs: needs: publish-job with: new-version: ${{ needs.publish-job.outputs.tag }} - chart-name: 'javatemplate' + chart-name: 'javapfb' permissions: contents: 'read' id-token: 'write' @@ -103,7 +103,7 @@ jobs: needs: [publish-job, report-to-sherlock] with: new-version: ${{ needs.publish-job.outputs.tag }} - chart-name: 'javatemplate' + chart-name: 'javapfb' environment-name: 'template-services' secrets: sync-git-token: ${{ secrets.BROADBOT_TOKEN }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..3daa5166 --- /dev/null +++ b/.gitignore @@ -0,0 +1,38 @@ +HELP.md +.gradle +build/ +!gradle/wrapper/gradle-wrapper.jar +!**/src/main/**/build/ +!**/src/test/**/build/ +bootrun.log + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +# Emacs backup files # +*.*~ + +### IntelliJ IDEA ### +.idea/ +*.iml + +### VS Code ### +.vscode/ + +# Mac directory metadata +.DS_Store + +# PyEnv environment files +.env/ + +# Ignore generated credentials from google-github-actions/auth +gha-creds-*.json \ No newline at end of file diff --git a/buildSrc/src/main/groovy/bio.terra.java-spring-conventions.gradle b/buildSrc/src/main/groovy/bio.terra.java-spring-conventions.gradle index 3bc0e9c7..df2a4be5 100644 --- a/buildSrc/src/main/groovy/bio.terra.java-spring-conventions.gradle +++ b/buildSrc/src/main/groovy/bio.terra.java-spring-conventions.gradle @@ -2,5 +2,6 @@ plugins { // Apply the common convention plugin for shared build configuration between library and application projects. id 'bio.terra.java-common-conventions' + id 'io.spring.dependency-management' id 'org.springframework.boot' } diff --git a/client/artifactory.gradle b/client/artifactory.gradle index 6c0338a6..008de4d5 100644 --- a/client/artifactory.gradle +++ b/client/artifactory.gradle @@ -18,8 +18,8 @@ java { publishing { publications { - javatemplateClientLibrary(MavenPublication) { - artifactId = "javatemplate-client" + javaPfbClientLibrary(MavenPublication) { + artifactId = "javapfb-client" from components.java versionMapping { usage("java-runtime") { @@ -41,7 +41,7 @@ artifactory { defaults { // This is how we tell the Artifactory Plugin which artifacts should be published to Artifactory. // Reference to Gradle publications defined in the build script. - publications("javatemplateClientLibrary") + publications("javapfbClientLibrary") publishArtifacts = true publishPom = true } diff --git a/client/swagger.gradle b/client/swagger.gradle index b46dc5bc..fe55676f 100644 --- a/client/swagger.gradle +++ b/client/swagger.gradle @@ -9,7 +9,7 @@ dependencies { swaggerCodegen 'io.swagger.codegen.v3:swagger-codegen-cli' } -def artifactGroup = "${group}.javatemplate" +def artifactGroup = "${group}.javapfb" generateSwaggerCode { inputFile = file('../service/src/main/resources/api/openapi.yml') diff --git a/common/postgres-init.sql b/common/postgres-init.sql deleted file mode 100644 index e49ff37a..00000000 --- a/common/postgres-init.sql +++ /dev/null @@ -1,2 +0,0 @@ -CREATE ROLE dbuser WITH LOGIN ENCRYPTED PASSWORD 'dbpwd'; -CREATE DATABASE javatemplate_db OWNER dbuser; diff --git a/integration/src/main/java/scripts/client/JavatemplateClient.java b/integration/src/main/java/scripts/client/JavaPfbClient.java similarity index 86% rename from integration/src/main/java/scripts/client/JavatemplateClient.java rename to integration/src/main/java/scripts/client/JavaPfbClient.java index 3c640156..ee2625f6 100644 --- a/integration/src/main/java/scripts/client/JavatemplateClient.java +++ b/integration/src/main/java/scripts/client/JavaPfbClient.java @@ -1,6 +1,6 @@ package scripts.client; -import bio.terra.javatemplate.client.ApiClient; +import bio.terra.javapfb.client.ApiClient; import bio.terra.testrunner.common.utils.AuthenticationUtils; import bio.terra.testrunner.runner.config.ServerSpecification; import bio.terra.testrunner.runner.config.TestUserSpecification; @@ -8,7 +8,7 @@ import java.io.IOException; import java.util.Objects; -public class JavatemplateClient extends ApiClient { +public class JavaPfbClient extends ApiClient { /** * Build a no-auth API client object for the service. No access token is needed for this API @@ -16,7 +16,7 @@ public class JavatemplateClient extends ApiClient { * * @param server the server we are testing against */ - public JavatemplateClient(ServerSpecification server) throws IOException { + public JavaPfbClient(ServerSpecification server) throws IOException { this(server, null); } @@ -28,7 +28,7 @@ public JavatemplateClient(ServerSpecification server) throws IOException { * @param server the server we are testing against * @param testUser the test user whose credentials are supplied to the API client object */ - public JavatemplateClient(ServerSpecification server, TestUserSpecification testUser) + public JavaPfbClient(ServerSpecification server, TestUserSpecification testUser) throws IOException { // note that this uses server.catalogUri. Typically a uri for a new service needs to be added to // https://github.com/DataBiosphere/terra-test-runner/blob/main/src/main/java/bio/terra/testrunner/runner/config/ServerSpecification.java diff --git a/integration/src/main/java/scripts/testscripts/GetStatus.java b/integration/src/main/java/scripts/testscripts/GetStatus.java index 1e3154b2..018da00f 100644 --- a/integration/src/main/java/scripts/testscripts/GetStatus.java +++ b/integration/src/main/java/scripts/testscripts/GetStatus.java @@ -3,16 +3,16 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; -import bio.terra.javatemplate.api.PublicApi; +import bio.terra.javapfb.api.PublicApi; import bio.terra.testrunner.runner.TestScript; import bio.terra.testrunner.runner.config.TestUserSpecification; import com.google.api.client.http.HttpStatusCodes; -import scripts.client.JavatemplateClient; +import scripts.client.JavaPfbClient; public class GetStatus extends TestScript { @Override public void userJourney(TestUserSpecification testUser) throws Exception { - var client = new JavatemplateClient(server); + var client = new JavaPfbClient(server); var publicApi = new PublicApi(client); publicApi.getStatus(); assertThat(client.getStatusCode(), is(HttpStatusCodes.STATUS_CODE_OK)); diff --git a/integration/src/main/java/scripts/testscripts/GetVersion.java b/integration/src/main/java/scripts/testscripts/GetVersion.java index 97cad602..e5948351 100644 --- a/integration/src/main/java/scripts/testscripts/GetVersion.java +++ b/integration/src/main/java/scripts/testscripts/GetVersion.java @@ -4,16 +4,16 @@ import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.notNullValue; -import bio.terra.javatemplate.api.PublicApi; +import bio.terra.javapfb.api.PublicApi; import bio.terra.testrunner.runner.TestScript; import bio.terra.testrunner.runner.config.TestUserSpecification; import com.google.api.client.http.HttpStatusCodes; -import scripts.client.JavatemplateClient; +import scripts.client.JavaPfbClient; public class GetVersion extends TestScript { @Override public void userJourney(TestUserSpecification testUser) throws Exception { - JavatemplateClient client = new JavatemplateClient(server); + JavaPfbClient client = new JavaPfbClient(server); var publicApi = new PublicApi(client); var versionProperties = publicApi.getVersion(); diff --git a/service/build.gradle b/service/build.gradle index 12c77cb4..caf1c936 100644 --- a/service/build.gradle +++ b/service/build.gradle @@ -51,14 +51,14 @@ sonarqube { } } -liquibase { - activities { - catalog { - changeLogFile 'src/main/resources/db/changelog.xml' - url 'jdbc:postgresql://localhost:5432/javatemplate_db' - username 'dbuser' - password 'dbpwd' - logLevel 'info' - } - } -} +//liquibase { +// activities { +// catalog { +// changeLogFile 'src/main/resources/db/changelog.xml' +// url 'jdbc:postgresql://localhost:5432/java_pfb_db' +// username 'dbuser' +// password 'dbpwd' +// logLevel 'info' +// } +// } +//} diff --git a/service/generators.gradle b/service/generators.gradle index e9df9fbf..1cc0681c 100644 --- a/service/generators.gradle +++ b/service/generators.gradle @@ -10,7 +10,7 @@ dependencies { annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor' } -def artifactGroup = "${group}.javatemplate" +def artifactGroup = "${group}.javapfb" generateSwaggerCode { inputFile = file('src/main/resources/api/openapi.yml') @@ -37,8 +37,8 @@ compileJava.dependsOn generateSwaggerCode // see https://github.com/n0mer/gradle-git-properties gitProperties { keys = [] - customProperty('javatemplate.version.gitTag', { it.describe(tags: true) }) - customProperty('javatemplate.version.gitHash', { it.head().abbreviatedId }) - customProperty('javatemplate.version.github', { "https://github.com/DataBiosphere/terra-java-project-template/tree/${it.describe(tags: true)}" }) - customProperty('javatemplate.version.build', version) + customProperty('javapfb.version.gitTag', { it.describe(tags: true) }) + customProperty('javapfb.version.gitHash', { it.head().abbreviatedId }) + customProperty('javapfb.version.github', { "https://github.com/DataBiosphere/java-pfb/tree/${it.describe(tags: true)}" }) + customProperty('javapfb.version.build', version) } diff --git a/service/publishing.gradle b/service/publishing.gradle index 2564e39d..d104842a 100644 --- a/service/publishing.gradle +++ b/service/publishing.gradle @@ -28,10 +28,10 @@ jib { } container { filesModificationTime = ZonedDateTime.now().toString() // to prevent ui caching - mainClass = 'bio.terra.javatemplate.App' + mainClass = 'bio.terra.javapfb.App' jvmFlags = [ "-agentpath:" + cloudProfilerLocation + "/profiler_java_agent.so=" + - "-cprof_service=bio.terra.javatemplate" + + "-cprof_service=bio.terra.javapfb" + ",-cprof_service_version=" + version + ",-cprof_enable_heap_sampling=true" + ",-logtostderr" + diff --git a/service/src/main/java/bio/terra/javatemplate/App.java b/service/src/main/java/bio/terra/javapfb/App.java similarity index 95% rename from service/src/main/java/bio/terra/javatemplate/App.java rename to service/src/main/java/bio/terra/javapfb/App.java index 3692ba19..0cbbd53c 100644 --- a/service/src/main/java/bio/terra/javatemplate/App.java +++ b/service/src/main/java/bio/terra/javapfb/App.java @@ -1,4 +1,4 @@ -package bio.terra.javatemplate; +package bio.terra.javapfb; import bio.terra.common.logging.LoggingInitializer; import com.fasterxml.jackson.annotation.JsonInclude; @@ -30,9 +30,9 @@ // Scan for tracing-related components & configs "bio.terra.common.tracing", // Scan all service-specific packages beneath the current package - "bio.terra.javatemplate" + "bio.terra.javapfb" }) -@ConfigurationPropertiesScan("bio.terra.javatemplate") +@ConfigurationPropertiesScan("bio.terra.javapfb") @EnableRetry @EnableTransactionManagement @EnableConfigurationProperties diff --git a/service/src/main/java/bio/terra/javatemplate/config/StatusCheckConfiguration.java b/service/src/main/java/bio/terra/javapfb/config/StatusCheckConfiguration.java similarity index 69% rename from service/src/main/java/bio/terra/javatemplate/config/StatusCheckConfiguration.java rename to service/src/main/java/bio/terra/javapfb/config/StatusCheckConfiguration.java index 4d2736a6..499a1550 100644 --- a/service/src/main/java/bio/terra/javatemplate/config/StatusCheckConfiguration.java +++ b/service/src/main/java/bio/terra/javapfb/config/StatusCheckConfiguration.java @@ -1,8 +1,8 @@ -package bio.terra.javatemplate.config; +package bio.terra.javapfb.config; import org.springframework.boot.context.properties.ConfigurationProperties; -@ConfigurationProperties(prefix = "javatemplate.status-check") +@ConfigurationProperties(prefix = "javapfb.status-check") public record StatusCheckConfiguration( boolean enabled, int pollingIntervalSeconds, diff --git a/service/src/main/java/bio/terra/javatemplate/config/VersionConfiguration.java b/service/src/main/java/bio/terra/javapfb/config/VersionConfiguration.java similarity index 73% rename from service/src/main/java/bio/terra/javatemplate/config/VersionConfiguration.java rename to service/src/main/java/bio/terra/javapfb/config/VersionConfiguration.java index 42d21680..b69a6a83 100644 --- a/service/src/main/java/bio/terra/javatemplate/config/VersionConfiguration.java +++ b/service/src/main/java/bio/terra/javapfb/config/VersionConfiguration.java @@ -1,7 +1,7 @@ -package bio.terra.javatemplate.config; +package bio.terra.javapfb.config; import org.springframework.boot.context.properties.ConfigurationProperties; /** Read from the git.properties file auto-generated at build time */ -@ConfigurationProperties("javatemplate.version") +@ConfigurationProperties("javapfb.version") public record VersionConfiguration(String gitHash, String gitTag, String build, String github) {} diff --git a/service/src/main/java/bio/terra/javatemplate/controller/GlobalExceptionHandler.java b/service/src/main/java/bio/terra/javapfb/controller/GlobalExceptionHandler.java similarity index 85% rename from service/src/main/java/bio/terra/javatemplate/controller/GlobalExceptionHandler.java rename to service/src/main/java/bio/terra/javapfb/controller/GlobalExceptionHandler.java index 15a84292..e9f02081 100644 --- a/service/src/main/java/bio/terra/javatemplate/controller/GlobalExceptionHandler.java +++ b/service/src/main/java/bio/terra/javapfb/controller/GlobalExceptionHandler.java @@ -1,7 +1,7 @@ -package bio.terra.javatemplate.controller; +package bio.terra.javapfb.controller; import bio.terra.common.exception.AbstractGlobalExceptionHandler; -import bio.terra.javatemplate.model.ErrorReport; +import bio.terra.javapfb.model.ErrorReport; import java.util.List; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.RestControllerAdvice; diff --git a/service/src/main/java/bio/terra/javatemplate/model/Example.java b/service/src/main/java/bio/terra/javapfb/model/Example.java similarity index 89% rename from service/src/main/java/bio/terra/javatemplate/model/Example.java rename to service/src/main/java/bio/terra/javapfb/model/Example.java index ef364ea9..0ac4c49f 100644 --- a/service/src/main/java/bio/terra/javatemplate/model/Example.java +++ b/service/src/main/java/bio/terra/javapfb/model/Example.java @@ -1,4 +1,4 @@ -package bio.terra.javatemplate.model; +package bio.terra.javapfb.model; import java.util.Objects; import javax.annotation.Nullable; diff --git a/service/src/main/java/bio/terra/javatemplate/service/BaseStatusService.java b/service/src/main/java/bio/terra/javapfb/service/BaseStatusService.java similarity index 93% rename from service/src/main/java/bio/terra/javatemplate/service/BaseStatusService.java rename to service/src/main/java/bio/terra/javapfb/service/BaseStatusService.java index 37f8370e..b8aa27df 100644 --- a/service/src/main/java/bio/terra/javatemplate/service/BaseStatusService.java +++ b/service/src/main/java/bio/terra/javapfb/service/BaseStatusService.java @@ -1,8 +1,8 @@ -package bio.terra.javatemplate.service; +package bio.terra.javapfb.service; -import bio.terra.javatemplate.config.StatusCheckConfiguration; -import bio.terra.javatemplate.model.SystemStatus; -import bio.terra.javatemplate.model.SystemStatusSystems; +import bio.terra.javapfb.config.StatusCheckConfiguration; +import bio.terra.javapfb.model.SystemStatus; +import bio.terra.javapfb.model.SystemStatusSystems; import com.google.common.annotations.VisibleForTesting; import java.time.Instant; import java.util.Map; diff --git a/service/src/main/java/bio/terra/javatemplate/config/SamConfiguration.java b/service/src/main/java/bio/terra/javatemplate/config/SamConfiguration.java deleted file mode 100644 index d6aa4d69..00000000 --- a/service/src/main/java/bio/terra/javatemplate/config/SamConfiguration.java +++ /dev/null @@ -1,6 +0,0 @@ -package bio.terra.javatemplate.config; - -import org.springframework.boot.context.properties.ConfigurationProperties; - -@ConfigurationProperties(prefix = "javatemplate.sam") -public record SamConfiguration(String basePath) {} diff --git a/service/src/main/resources/application.yml b/service/src/main/resources/application.yml index dac5984e..fecd196c 100644 --- a/service/src/main/resources/application.yml +++ b/service/src/main/resources/application.yml @@ -2,12 +2,13 @@ # This is for deployment-specific values, which may be managed by other teams env: - db: - host: ${DATABASE_HOSTNAME:127.0.0.1}:5432 - init: ${INIT_DB:false} - name: ${DATABASE_NAME:javatemplate_db} - password: ${DATABASE_USER_PASSWORD:dbpwd} - user: ${DATABASE_USER:dbuser} +# We shouldn't need a db for this client +# db: +# host: ${DATABASE_HOSTNAME:127.0.0.1}:5432 +# init: ${INIT_DB:false} +# name: ${DATABASE_NAME:java_pfb_db} +# password: ${DATABASE_USER_PASSWORD:dbpwd} +# user: ${DATABASE_USER:dbuser} tracing: exportEnabled: ${CLOUD_TRACE_ENABLED:false} samplingRate: ${SAMPLING_PROBABILITY:0} @@ -33,8 +34,8 @@ server: spring: # application name and version are used to populate the logging serviceContext # https://github.com/DataBiosphere/terra-common-lib/blob/480ab3daae282ddff0fef8dc329494a4422e32f1/src/main/java/bio/terra/common/logging/GoogleJsonLayout.java#L118 - application.name: javatemplate - application.version: ${javatemplate.version.gitHash:unknown} + application.name: javapfb + application.version: ${javapfb.version.gitHash:unknown} datasource: hikari: @@ -61,7 +62,7 @@ management: exposure: include: "*" -javatemplate: +javapfb: ingress: # Default value that's overridden by Helm. domainName: localhost:8080 diff --git a/service/src/test/java/bio/terra/javatemplate/BaseSpringBootTest.java b/service/src/test/java/bio/terra/javapfb/BaseSpringBootTest.java similarity index 87% rename from service/src/test/java/bio/terra/javatemplate/BaseSpringBootTest.java rename to service/src/test/java/bio/terra/javapfb/BaseSpringBootTest.java index 02fdfc18..1149e6d8 100644 --- a/service/src/test/java/bio/terra/javatemplate/BaseSpringBootTest.java +++ b/service/src/test/java/bio/terra/javapfb/BaseSpringBootTest.java @@ -1,4 +1,4 @@ -package bio.terra.javatemplate; +package bio.terra.javapfb; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.ActiveProfiles; diff --git a/service/src/test/java/bio/terra/javatemplate/service/BaseStatusServiceTest.java b/service/src/test/java/bio/terra/javapfb/service/BaseStatusServiceTest.java similarity index 63% rename from service/src/test/java/bio/terra/javatemplate/service/BaseStatusServiceTest.java rename to service/src/test/java/bio/terra/javapfb/service/BaseStatusServiceTest.java index 26e0c5a4..41dc91b9 100644 --- a/service/src/test/java/bio/terra/javatemplate/service/BaseStatusServiceTest.java +++ b/service/src/test/java/bio/terra/javapfb/service/BaseStatusServiceTest.java @@ -1,12 +1,14 @@ -package bio.terra.javatemplate.service; +package bio.terra.javapfb.service; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; -import bio.terra.javatemplate.config.StatusCheckConfiguration; -import bio.terra.javatemplate.model.SystemStatus; -import bio.terra.javatemplate.model.SystemStatusSystems; +import bio.terra.javapfb.config.StatusCheckConfiguration; +import bio.terra.javapfb.model.SystemStatus; +import bio.terra.javapfb.model.SystemStatusSystems; import java.util.Map; +import org.hamcrest.MatcherAssert; +import org.hamcrest.Matchers; import org.junit.jupiter.api.Test; class BaseStatusServiceTest { @@ -17,7 +19,7 @@ void getCurrentStatus() { BaseStatusService service = new BaseStatusService(config); var status = new SystemStatusSystems().ok(true); service.registerStatusCheck("test", () -> status); - assertThat(service.getCurrentStatus(), is(new SystemStatus().ok(false))); + MatcherAssert.assertThat(service.getCurrentStatus(), Matchers.is(new SystemStatus().ok(false))); service.checkStatus(); assertThat( service.getCurrentStatus(), diff --git a/settings.gradle b/settings.gradle index 0e0df3b0..a0165656 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,4 +1,4 @@ -rootProject.name = 'terra-java-project-template' +rootProject.name = 'javapfb' include('service', 'client', 'integration') gradle.ext.releaseVersion = '0.11.0'