Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ndwinton committed Jun 3, 2019
0 parents commit 3910577
Show file tree
Hide file tree
Showing 128 changed files with 5,431 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.gradle
build
.idea
*.iml
*.ipr
*.iws
.DS_Store
.env
ci/variables.yml
149 changes: 149 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
dist: trusty
sudo: required
notifications:
email: false
env:
- RELEASE_TAG="release-$TRAVIS_BUILD_NUMBER"
stages:
- build and publish
- deploy
- migrate
if: tag IS blank

jobs:
include:
- stage: build and publish
language: java
jdk: openjdk11
addons:
mariadb: '10.2'
install: skip
before_script:
- mysql -uroot < databases/create_databases.sql
- ./gradlew testMigrate
script:
- APPLICATION=allocations
- ./gradlew clean :applications:${APPLICATION}-server:build
before_deploy:
- git config --local user.name "Travis CI"
- git config --local user.email "[email protected]"
- git tag -f $RELEASE_TAG
deploy: &github
provider: releases
api_key: $GITHUB_OAUTH_TOKEN
file:
- "applications/${APPLICATION}-server/build/libs/${APPLICATION}-server.jar"
skip_cleanup: true

- stage: build and publish
language: java
jdk: openjdk11
addons:
mariadb: '10.2'
install: skip
before_script:
- mysql -uroot < databases/create_databases.sql
- ./gradlew testMigrate
script:
- APPLICATION=backlog
- ./gradlew clean :applications:${APPLICATION}-server:build
before_deploy:
- git config --local user.name "Travis CI"
- git config --local user.email "[email protected]"
- git tag -f $RELEASE_TAG
deploy:
<<: *github

- stage: build and publish
language: java
jdk: openjdk11
addons:
mariadb: '10.2'
install: skip
before_script:
- mysql -uroot < databases/create_databases.sql
- ./gradlew testMigrate
script:
- APPLICATION=registration
- ./gradlew clean :applications:${APPLICATION}-server:build
before_deploy:
- git config --local user.name "Travis CI"
- git config --local user.email "[email protected]"
- git tag -f $RELEASE_TAG
deploy:
<<: *github

- stage: build and publish
language: java
jdk: openjdk11
addons:
mariadb: '10.2'
install: skip
before_script:
- mysql -uroot < databases/create_databases.sql
- ./gradlew testMigrate
script:
- APPLICATION=timesheets
- ./gradlew clean :applications:${APPLICATION}-server:build
before_deploy:
- git config --local user.name "Travis CI"
- git config --local user.email "[email protected]"
- git tag -f $RELEASE_TAG
deploy:
<<: *github

- stage: deploy
language: bash
script:
- echo "Downloading allocations server $RELEASE_TAG"
- wget -P applications/allocations-server/build/libs https://github.com/$GITHUB_USERNAME/pal-tracker-distributed/releases/download/$RELEASE_TAG/allocations-server.jar
before_deploy:
- cp manifest-allocations.yml manifest.yml
- echo "Deploying allocations server $RELEASE_TAG"
deploy: &cloudfoundry
provider: cloudfoundry
api: $CF_API_URL
username: $CF_USERNAME
password: $CF_PASSWORD
organization: $CF_ORG
space: $CF_SPACE
- stage: deploy
language: bash
script:
- echo "Downloading backlog server $RELEASE_TAG"
- wget -P applications/backlog-server/build/libs https://github.com/$GITHUB_USERNAME/pal-tracker-distributed/releases/download/$RELEASE_TAG/backlog-server.jar
before_deploy:
- cp manifest-backlog.yml manifest.yml
- echo "Deploying backlog server $RELEASE_TAG"
deploy:
<<: *cloudfoundry
- stage: deploy
language: bash
script:
- echo "Downloading registration server $RELEASE_TAG"
- wget -P applications/registration-server/build/libs https://github.com/$GITHUB_USERNAME/pal-tracker-distributed/releases/download/$RELEASE_TAG/registration-server.jar
before_deploy:
- cp manifest-registration.yml manifest.yml
- echo "Deploying registration server $RELEASE_TAG"
deploy:
<<: *cloudfoundry
- stage: deploy
language: bash
script:
- echo "Downloading timesheets server $RELEASE_TAG"
- wget -P applications/timesheets-server/build/libs https://github.com/$GITHUB_USERNAME/pal-tracker-distributed/releases/download/$RELEASE_TAG/timesheets-server.jar
before_deploy:
- cp manifest-timesheets.yml manifest.yml
- echo "Deploying timesheets server $RELEASE_TAG"
deploy:
<<: *cloudfoundry
- stage: migrate
language: java
before_install:
- wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | sudo apt-key add -
- echo "deb https://packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list
- sudo apt-get update
- sudo apt-get install cf-cli
script:
- cf login -a $CF_API_URL -u $CF_USERNAME -p $CF_PASSWORD -o $CF_ORG -s $CF_SPACE
- ./gradlew cfMigrate
5 changes: 5 additions & 0 deletions applications/allocations-server/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apply from: "$projectDir/../server.gradle"

dependencies {
compile project(":components:allocations")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package io.pivotal.pal.tracker.allocations;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.client.RestOperations;

import java.util.TimeZone;


@SpringBootApplication
@ComponentScan({"io.pivotal.pal.tracker.allocations", "io.pivotal.pal.tracker.restsupport"})
public class App {

public static void main(String[] args) {
TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
SpringApplication.run(App.class, args);
}

@Bean
ProjectClient projectClient(
RestOperations restOperations,
@Value("${registration.server.endpoint}") String registrationEndpoint
) {
return new ProjectClient(restOperations, registrationEndpoint);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
spring.application.name=allocations-server

server.port=8081
spring.datasource.username=tracker
spring.datasource.url=jdbc:mysql://localhost:3306/tracker_allocations_dev?useSSL=false&useTimezone=true&serverTimezone=UTC&useLegacyDatetimeCode=false
registration.server.endpoint=http://localhost:8083
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package test.pivotal.pal.tracker.allocations;

import io.pivotal.pal.tracker.allocations.App;
import org.junit.Test;
import org.springframework.web.client.RestTemplate;

import static org.assertj.core.api.Assertions.assertThat;

public class AllocationsAppTest {

@Test
public void embedded() {
App.main(new String[]{});

String response = new RestTemplate().getForObject("http://localhost:8181/allocations?projectId=0", String.class);

assertThat(response).isEqualTo("[]");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
spring.application.name=allocations-server

server.port=8181
spring.datasource.username=tracker
spring.datasource.url=jdbc:mysql://localhost:3306/tracker_allocations_test?useSSL=false&useTimezone=true&serverTimezone=UTC&useLegacyDatetimeCode=false
registration.server.endpoint=http://localhost:8883
5 changes: 5 additions & 0 deletions applications/backlog-server/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apply from: "$projectDir/../server.gradle"

dependencies {
compile project(":components:backlog")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package io.pivotal.pal.tracker.backlog;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.client.RestOperations;

import java.util.TimeZone;


@SpringBootApplication
@ComponentScan({"io.pivotal.pal.tracker.backlog", "io.pivotal.pal.tracker.restsupport"})
public class App {

public static void main(String[] args) {
TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
SpringApplication.run(App.class, args);
}

@Bean
ProjectClient projectClient(
RestOperations restOperations,
@Value("${registration.server.endpoint}") String registrationEndpoint
) {
return new ProjectClient(restOperations, registrationEndpoint);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
spring.application.name=backlog-server

server.port=8082
spring.datasource.username=tracker
spring.datasource.url=jdbc:mysql://localhost:3306/tracker_backlog_dev?useSSL=false&useTimezone=true&serverTimezone=UTC&useLegacyDatetimeCode=false
registration.server.endpoint=http://localhost:8083
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package test.pivotal.pal.tracker.backlog;

import io.pivotal.pal.tracker.backlog.App;
import org.junit.Test;
import org.springframework.web.client.RestTemplate;

import static org.assertj.core.api.Assertions.assertThat;

public class BacklogAppTest {

@Test
public void embedded() {
App.main(new String[]{});

String response = new RestTemplate().getForObject("http://localhost:8181/stories?projectId=0", String.class);

assertThat(response).isEqualTo("[]");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
spring.application.name=backlog-server

server.port=8181
spring.datasource.username=tracker
spring.datasource.url=jdbc:mysql://localhost:3306/tracker_backlog_test?useSSL=false&useTimezone=true&serverTimezone=UTC&useLegacyDatetimeCode=false
registration.server.endpoint=http://localhost:8883
7 changes: 7 additions & 0 deletions applications/registration-server/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apply from: "$projectDir/../server.gradle"

dependencies {
compile project(":components:accounts")
compile project(":components:projects")
compile project(":components:users")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package io.pivotal.pal.tracker.registration;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;

import java.util.TimeZone;


@SpringBootApplication
@ComponentScan({
"io.pivotal.pal.tracker.accounts",
"io.pivotal.pal.tracker.restsupport",
"io.pivotal.pal.tracker.projects",
"io.pivotal.pal.tracker.users",
"io.pivotal.pal.tracker.registration"
})
public class App {
public static void main(String[] args) {
TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
SpringApplication.run(App.class, args);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
spring.application.name=registration-server

server.port=8083
spring.datasource.username=tracker
spring.datasource.url=jdbc:mysql://localhost:3306/tracker_registration_dev?useSSL=false&useTimezone=true&serverTimezone=UTC&useLegacyDatetimeCode=false
registration.server.endpoint=http://localhost:8083
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package test.pivotal.pal.tracker.registration;

import io.pivotal.pal.tracker.registration.App;
import org.junit.Test;
import org.springframework.web.client.RestTemplate;

import static org.assertj.core.api.Assertions.assertThat;

public class RegistrationAppTest {

@Test
public void embedded() {
App.main(new String[]{});

RestTemplate restTemplate = new RestTemplate();

assertThat(restTemplate.getForObject("http://localhost:8181/accounts?ownerId=0", String.class)).isEqualTo("[]");
assertThat(restTemplate.getForObject("http://localhost:8181/projects?accountId=0", String.class)).isEqualTo("[]");
assertThat(restTemplate.getForObject("http://localhost:8181/projects/0", String.class)).isEqualTo(null);
assertThat(restTemplate.getForObject("http://localhost:8181/users/0", String.class)).isEqualTo(null);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
spring.application.name=registration-server

server.port=8181
spring.datasource.username=tracker
spring.datasource.url=jdbc:mysql://localhost:3306/tracker_registration_test?useSSL=false&useTimezone=true&serverTimezone=UTC&useLegacyDatetimeCode=false
registration.server.endpoint=http://localhost:8883
14 changes: 14 additions & 0 deletions applications/server.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apply plugin: "org.springframework.boot"
apply plugin: "io.spring.dependency-management"

dependencies {
compile project(":components:rest-support")

compile "org.springframework.boot:spring-boot-starter-web"

compile "com.zaxxer:HikariCP:$hikariVersion"
compile "mysql:mysql-connector-java:$mysqlVersion"
compile "ch.qos.logback:logback-classic:$logbackVersion"

testCompile project(":components:test-support")
}
5 changes: 5 additions & 0 deletions applications/timesheets-server/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apply from: "$projectDir/../server.gradle"

dependencies {
compile project(":components:timesheets")
}
Loading

0 comments on commit 3910577

Please sign in to comment.