diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..aeac447 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,21 @@ +# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven +name: Java CI with Maven +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 11 + uses: actions/setup-java@v2 + with: + java-version: '11' + distribution: 'adopt' + cache: maven + - name: Build with Maven + run: mvn -B package --file pom.xml \ No newline at end of file diff --git a/src/main/java/com/pgr301/exam/ReallyShakyBankingCoreSystemService.java b/src/main/java/com/pgr301/exam/ReallyShakyBankingCoreSystemService.java index e90dd01..d93d828 100644 --- a/src/main/java/com/pgr301/exam/ReallyShakyBankingCoreSystemService.java +++ b/src/main/java/com/pgr301/exam/ReallyShakyBankingCoreSystemService.java @@ -27,7 +27,7 @@ class ReallyShakyBankingCoreSystemService implements BankingCoreSystmeService { @Override public void transfer(Transaction tx, String fromAccount, String toAccount) { randomizedWait(2000); - randomizeExceptionOrPanic(0.7f); + randomizeExceptionOrPanic(0.0f); Account from = getOrCreateAccount(fromAccount); Account to = getOrCreateAccount(toAccount); from.setBalance(from.getBalance().subtract(valueOf(tx.getAmount()))); @@ -37,7 +37,7 @@ public void transfer(Transaction tx, String fromAccount, String toAccount) { @Override public Account updateAccount(Account a) { randomizedWait(2000); - randomizeExceptionOrPanic(0.9f); + randomizeExceptionOrPanic(0.0f); Account account = getOrCreateAccount(a.getId()); account.setBalance(a.getBalance()); account.setCurrency(a.getCurrency()); @@ -48,7 +48,7 @@ public Account updateAccount(Account a) { @Override public BigDecimal balance(@PathVariable String accountId) { randomizedWait(10000); - randomizeExceptionOrPanic(0.2f); + randomizeExceptionOrPanic(0.0f); Account account = ofNullable(theBank.get(accountId)).orElseThrow(BankAccountController.AccountNotFoundException::new); return account.getBalance(); } @@ -56,7 +56,7 @@ public BigDecimal balance(@PathVariable String accountId) { @Override public Account getAccount(String accountNumber) { randomizedWait(5000); - randomizeExceptionOrPanic(0.9f, 0.5f); + randomizeExceptionOrPanic(0.0f, 0.0f); return getOrCreateAccount(accountNumber); } diff --git a/target/classes/Logback.xml b/target/classes/Logback.xml new file mode 100644 index 0000000..07a4c3f --- /dev/null +++ b/target/classes/Logback.xml @@ -0,0 +1,10 @@ + + + + %-4relative [%thread] %-5level %logger{35} - %msg %n + + + + + + diff --git a/target/classes/application.properties b/target/classes/application.properties new file mode 100644 index 0000000..badf792 --- /dev/null +++ b/target/classes/application.properties @@ -0,0 +1,2 @@ +management.endpoints.web.exposure.include=* +management.metrics.export.influx.step=1s diff --git a/target/classes/com/pgr301/exam/BackEndException.class b/target/classes/com/pgr301/exam/BackEndException.class new file mode 100644 index 0000000..770c7ff Binary files /dev/null and b/target/classes/com/pgr301/exam/BackEndException.class differ diff --git a/target/classes/com/pgr301/exam/BankAccountApplication.class b/target/classes/com/pgr301/exam/BankAccountApplication.class new file mode 100644 index 0000000..f92d160 Binary files /dev/null and b/target/classes/com/pgr301/exam/BankAccountApplication.class differ diff --git a/target/classes/com/pgr301/exam/BankAccountController$AccountNotFoundException.class b/target/classes/com/pgr301/exam/BankAccountController$AccountNotFoundException.class new file mode 100644 index 0000000..950191e Binary files /dev/null and b/target/classes/com/pgr301/exam/BankAccountController$AccountNotFoundException.class differ diff --git a/target/classes/com/pgr301/exam/BankAccountController.class b/target/classes/com/pgr301/exam/BankAccountController.class new file mode 100644 index 0000000..7cb8953 Binary files /dev/null and b/target/classes/com/pgr301/exam/BankAccountController.class differ diff --git a/target/classes/com/pgr301/exam/BankingCoreSystmeService.class b/target/classes/com/pgr301/exam/BankingCoreSystmeService.class new file mode 100644 index 0000000..bd51e85 Binary files /dev/null and b/target/classes/com/pgr301/exam/BankingCoreSystmeService.class differ diff --git a/target/classes/com/pgr301/exam/ReallyShakyBankingCoreSystemService.class b/target/classes/com/pgr301/exam/ReallyShakyBankingCoreSystemService.class new file mode 100644 index 0000000..4510b03 Binary files /dev/null and b/target/classes/com/pgr301/exam/ReallyShakyBankingCoreSystemService.class differ diff --git a/target/classes/com/pgr301/exam/model/Account.class b/target/classes/com/pgr301/exam/model/Account.class new file mode 100644 index 0000000..60c06f0 Binary files /dev/null and b/target/classes/com/pgr301/exam/model/Account.class differ diff --git a/target/classes/com/pgr301/exam/model/Transaction.class b/target/classes/com/pgr301/exam/model/Transaction.class new file mode 100644 index 0000000..68500cc Binary files /dev/null and b/target/classes/com/pgr301/exam/model/Transaction.class differ diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file mode 100644 index 0000000..a04a1ad --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -0,0 +1,8 @@ +com/pgr301/exam/BankAccountApplication.class +com/pgr301/exam/model/Transaction.class +com/pgr301/exam/model/Account.class +com/pgr301/exam/BankAccountController$AccountNotFoundException.class +com/pgr301/exam/BankAccountController.class +com/pgr301/exam/BankingCoreSystmeService.class +com/pgr301/exam/BackEndException.class +com/pgr301/exam/ReallyShakyBankingCoreSystemService.class diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file mode 100644 index 0000000..b1551e8 --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1,7 @@ +/home/ec2-user/environment/01-CI-Github-actions/src/main/java/com/pgr301/exam/BankAccountController.java +/home/ec2-user/environment/01-CI-Github-actions/src/main/java/com/pgr301/exam/ReallyShakyBankingCoreSystemService.java +/home/ec2-user/environment/01-CI-Github-actions/src/main/java/com/pgr301/exam/model/Transaction.java +/home/ec2-user/environment/01-CI-Github-actions/src/main/java/com/pgr301/exam/BackEndException.java +/home/ec2-user/environment/01-CI-Github-actions/src/main/java/com/pgr301/exam/model/Account.java +/home/ec2-user/environment/01-CI-Github-actions/src/main/java/com/pgr301/exam/BankingCoreSystmeService.java +/home/ec2-user/environment/01-CI-Github-actions/src/main/java/com/pgr301/exam/BankAccountApplication.java