Skip to content

Commit

Permalink
rename javatemplate to javapfb
Browse files Browse the repository at this point in the history
remove .idea files
  • Loading branch information
snf2ye committed Jun 22, 2023
1 parent f283a56 commit 6e5abb5
Show file tree
Hide file tree
Showing 23 changed files with 107 additions and 73 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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'
Expand All @@ -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 }}
Expand Down
38 changes: 38 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
6 changes: 3 additions & 3 deletions client/artifactory.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ java {

publishing {
publications {
javatemplateClientLibrary(MavenPublication) {
artifactId = "javatemplate-client"
javaPfbClientLibrary(MavenPublication) {
artifactId = "javapfb-client"
from components.java
versionMapping {
usage("java-runtime") {
Expand All @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion client/swagger.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
2 changes: 0 additions & 2 deletions common/postgres-init.sql

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
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;
import com.google.auth.oauth2.GoogleCredentials;
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
* client.
*
* @param server the server we are testing against
*/
public JavatemplateClient(ServerSpecification server) throws IOException {
public JavaPfbClient(ServerSpecification server) throws IOException {
this(server, null);
}

Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions integration/src/main/java/scripts/testscripts/GetStatus.java
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
6 changes: 3 additions & 3 deletions integration/src/main/java/scripts/testscripts/GetVersion.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
22 changes: 11 additions & 11 deletions service/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
// }
// }
//}
10 changes: 5 additions & 5 deletions service/generators.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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)
}
4 changes: 2 additions & 2 deletions service/publishing.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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" +
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package bio.terra.javatemplate;
package bio.terra.javapfb;

import bio.terra.common.logging.LoggingInitializer;
import com.fasterxml.jackson.annotation.JsonInclude;
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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) {}
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package bio.terra.javatemplate.model;
package bio.terra.javapfb.model;

import java.util.Objects;
import javax.annotation.Nullable;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down

This file was deleted.

19 changes: 10 additions & 9 deletions service/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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:
Expand All @@ -61,7 +62,7 @@ management:
exposure:
include: "*"

javatemplate:
javapfb:
ingress:
# Default value that's overridden by Helm.
domainName: localhost:8080
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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(),
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
rootProject.name = 'terra-java-project-template'
rootProject.name = 'javapfb'
include('service', 'client', 'integration')

gradle.ext.releaseVersion = '0.11.0'

0 comments on commit 6e5abb5

Please sign in to comment.