diff --git a/.mvn/wrapper/MavenWrapperDownloader.java b/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 0000000..b901097 --- /dev/null +++ b/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,117 @@ +/* + * Copyright 2007-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import java.net.*; +import java.io.*; +import java.nio.channels.*; +import java.util.Properties; + +public class MavenWrapperDownloader { + + private static final String WRAPPER_VERSION = "0.5.6"; + /** + * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. + */ + private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" + + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; + + /** + * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to + * use instead of the default one. + */ + private static final String MAVEN_WRAPPER_PROPERTIES_PATH = + ".mvn/wrapper/maven-wrapper.properties"; + + /** + * Path where the maven-wrapper.jar will be saved to. + */ + private static final String MAVEN_WRAPPER_JAR_PATH = + ".mvn/wrapper/maven-wrapper.jar"; + + /** + * Name of the property which should be used to override the default download url for the wrapper. + */ + private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; + + public static void main(String args[]) { + System.out.println("- Downloader started"); + File baseDirectory = new File(args[0]); + System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); + + // If the maven-wrapper.properties exists, read it and check if it contains a custom + // wrapperUrl parameter. + File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); + String url = DEFAULT_DOWNLOAD_URL; + if(mavenWrapperPropertyFile.exists()) { + FileInputStream mavenWrapperPropertyFileInputStream = null; + try { + mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); + Properties mavenWrapperProperties = new Properties(); + mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); + url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); + } catch (IOException e) { + System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); + } finally { + try { + if(mavenWrapperPropertyFileInputStream != null) { + mavenWrapperPropertyFileInputStream.close(); + } + } catch (IOException e) { + // Ignore ... + } + } + } + System.out.println("- Downloading from: " + url); + + File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); + if(!outputFile.getParentFile().exists()) { + if(!outputFile.getParentFile().mkdirs()) { + System.out.println( + "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); + } + } + System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); + try { + downloadFileFromURL(url, outputFile); + System.out.println("Done"); + System.exit(0); + } catch (Throwable e) { + System.out.println("- Error downloading"); + e.printStackTrace(); + System.exit(1); + } + } + + private static void downloadFileFromURL(String urlString, File destination) throws Exception { + if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { + String username = System.getenv("MVNW_USERNAME"); + char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); + Authenticator.setDefault(new Authenticator() { + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(username, password); + } + }); + } + URL website = new URL(urlString); + ReadableByteChannel rbc; + rbc = Channels.newChannel(website.openStream()); + FileOutputStream fos = new FileOutputStream(destination); + fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); + fos.close(); + rbc.close(); + } + +} diff --git a/.mvn/wrapper/maven-wrapper.jar b/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000..2cc7d4a Binary files /dev/null and b/.mvn/wrapper/maven-wrapper.jar differ diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000..642d572 --- /dev/null +++ b/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,2 @@ +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar diff --git a/manifest.yml b/manifest.yml index 0a96266..a67800e 100644 --- a/manifest.yml +++ b/manifest.yml @@ -1,4 +1,4 @@ ---- + #applications: # - name: zipBank # memory: 1G @@ -9,3 +9,4 @@ # services: # - zipBank + diff --git a/mvnw b/mvnw index 21d3ee8..41c0f0c 100755 --- a/mvnw +++ b/mvnw @@ -8,7 +8,7 @@ # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # -# https://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an @@ -19,7 +19,7 @@ # ---------------------------------------------------------------------------- # ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script +# Maven Start Up Batch script # # Required ENV vars: # ------------------ @@ -212,9 +212,9 @@ else echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." fi if [ -n "$MVNW_REPOURL" ]; then - jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar" + jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" else - jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar" + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" fi while IFS="=" read key value; do case "$key" in (wrapperUrl) jarUrl="$value"; break ;; @@ -246,7 +246,7 @@ else else curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f fi - + else if [ "$MVNW_VERBOSE" = true ]; then echo "Falling back to using Java to download" diff --git a/mvnw.cmd b/mvnw.cmd index 84d60ab..8611571 100644 --- a/mvnw.cmd +++ b/mvnw.cmd @@ -7,7 +7,7 @@ @REM "License"); you may not use this file except in compliance @REM with the License. You may obtain a copy of the License at @REM -@REM https://www.apache.org/licenses/LICENSE-2.0 +@REM http://www.apache.org/licenses/LICENSE-2.0 @REM @REM Unless required by applicable law or agreed to in writing, @REM software distributed under the License is distributed on an @@ -18,7 +18,7 @@ @REM ---------------------------------------------------------------------------- @REM ---------------------------------------------------------------------------- -@REM Maven2 Start Up Batch script +@REM Maven Start Up Batch script @REM @REM Required ENV vars: @REM JAVA_HOME - location of a JDK home dir @@ -26,7 +26,7 @@ @REM Optional ENV vars @REM M2_HOME - location of maven2's installed home dir @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands -@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven @REM e.g. to debug Maven itself, use @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 @@ -120,7 +120,7 @@ SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain -set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar" +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B @@ -134,7 +134,7 @@ if exist %WRAPPER_JAR% ( ) ) else ( if not "%MVNW_REPOURL%" == "" ( - SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar" + SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" ) if "%MVNW_VERBOSE%" == "true" ( echo Couldn't find %WRAPPER_JAR%, downloading it ... diff --git a/pom.xml b/pom.xml index 1e7cc7d..f86262c 100644 --- a/pom.xml +++ b/pom.xml @@ -150,6 +150,20 @@ org.springframework.boot spring-boot-maven-plugin + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + lib/ + com.finance.zipBank.ZipBankApplicationTests + + + + diff --git a/src/main/java/com/finance/zipBank/Controllers/AccountsController.java b/src/main/java/com/finance/zipBank/Controllers/AccountsController.java index badbb72..9b6f06b 100644 --- a/src/main/java/com/finance/zipBank/Controllers/AccountsController.java +++ b/src/main/java/com/finance/zipBank/Controllers/AccountsController.java @@ -33,7 +33,7 @@ public ResponseEntity createAccount(@PathVariable Long userId) { } @PutMapping("API/accounts/{accountId}") public ResponseEntity updateAccount(@RequestBody Accounts account, @PathVariable Long accountId) { - return new ResponseEntity<>(accountsService.updateAccount(account, accountId), HttpStatus.OK); + return new ResponseEntity<>(accountsService.updateAccount(account), HttpStatus.OK); } @GetMapping("API/user/{userId}/accounts") public ResponseEntity> getAllAccountsByUserId(@PathVariable Long userId) { diff --git a/src/main/java/com/finance/zipBank/Controllers/BillController.java b/src/main/java/com/finance/zipBank/Controllers/BillController.java index 2c69a9e..2348026 100644 --- a/src/main/java/com/finance/zipBank/Controllers/BillController.java +++ b/src/main/java/com/finance/zipBank/Controllers/BillController.java @@ -37,5 +37,9 @@ public class BillController { billService.removeBill(id); return new ResponseEntity<>(HttpStatus.OK); } + @PutMapping("API/bills/update") + public ResponseEntityupdateBill(@RequestBody Bill bill){ + return new ResponseEntity<>(billService.updateBill(bill),HttpStatus.OK); + } } diff --git a/src/main/java/com/finance/zipBank/Controllers/TransactionsController.java b/src/main/java/com/finance/zipBank/Controllers/TransactionsController.java index 5376cd1..0363bcc 100644 --- a/src/main/java/com/finance/zipBank/Controllers/TransactionsController.java +++ b/src/main/java/com/finance/zipBank/Controllers/TransactionsController.java @@ -35,4 +35,8 @@ public ResponseEntity> listTop5TransactionsByDate(@PathVa public ResponseEntity> listTop5TransactionsForUser(@PathVariable Long userId){ return new ResponseEntity<>(transactionsService.listTop5ForUser(userId), HttpStatus.OK); } + @GetMapping("/API/accounts/transactions/{transactionId}") + public ResponseEntity listTransactionDetails(@PathVariable Long transactionId){ + return new ResponseEntity<>(transactionsService.listTransactionDetails(transactionId), HttpStatus.OK); + } } diff --git a/src/main/java/com/finance/zipBank/Repositories/TransactionsRepo.java b/src/main/java/com/finance/zipBank/Repositories/TransactionsRepo.java index becf471..aacfe08 100644 --- a/src/main/java/com/finance/zipBank/Repositories/TransactionsRepo.java +++ b/src/main/java/com/finance/zipBank/Repositories/TransactionsRepo.java @@ -12,4 +12,5 @@ public interface TransactionsRepo extends CrudRepository { List findAllByAccountNumber (Long accountNumber); List findTop5ByAccountNumberOrderByTransactionDate (Long accountNumber); List findTop5ByUserIdOrderByTransactionDate (Long userId); + List findByTransactionId (Long transactionId); } diff --git a/src/main/java/com/finance/zipBank/Service/AccountsService.java b/src/main/java/com/finance/zipBank/Service/AccountsService.java index a65c611..2489c8c 100644 --- a/src/main/java/com/finance/zipBank/Service/AccountsService.java +++ b/src/main/java/com/finance/zipBank/Service/AccountsService.java @@ -1,6 +1,7 @@ package com.finance.zipBank.Service; import com.finance.zipBank.Models.Accounts; +import com.finance.zipBank.Models.Bill; import com.finance.zipBank.Models.Transactions; import com.finance.zipBank.Models.User; import com.finance.zipBank.Repositories.AccountsRepo; @@ -26,7 +27,7 @@ public class AccountsService { public Accounts createDummyAccount(Accounts account) { Accounts newAccount = new Accounts(); - newAccount.setUserId(1L); + newAccount.setUserId(account.getUserId()); newAccount.setAccountName(account.getAccountName()); newAccount.setBalance(account.getBalance()); newAccount.setType(account.getType()); @@ -58,15 +59,15 @@ public List getFirstFiveAcctsById(Long userId) { return accountsRepo.findTop5ByUserId(userId); } - public Accounts updateAccount(Accounts account, Long accountId) { - Accounts temp = getAccountById(accountId); - temp.setBalance(account.getBalance()); + public Accounts updateAccount(Accounts account) { + + /*temp.setBalance(account.getBalance()); temp.setType(account.getType()); temp.setAccountName(account.getAccountName()); temp.setUserId(account.getUserId()); temp.setAccountNumber(account.getAccountNumber()); - temp.setTransactionsList(account.getTransactionsList()); - return accountsRepo.save(temp); + temp.setTransactionsList(account.getTransactionsList());*/ + return accountsRepo.save(account); } public Accounts accountDeposit(Transactions transactions) { @@ -88,6 +89,7 @@ public Accounts accountDeposit(Transactions transactions) { public Accounts transferRecipient(Transactions transactions) { Long accountId = transactions.getAccountNumber(); Double amount = transactions.getAmount(); + Accounts account = getAccountById(accountId); if (transactions.getAmount() <= 0) { throw new IllegalArgumentException(); @@ -130,7 +132,6 @@ public Accounts accountWithdraw(Transactions transactions) { return accountsRepo.save(account); } - public Boolean deleteAccountById(Long accountId) { accountsRepo.deleteById(accountId); return true; diff --git a/src/main/java/com/finance/zipBank/Service/BillService.java b/src/main/java/com/finance/zipBank/Service/BillService.java index f9dbbc4..526371d 100644 --- a/src/main/java/com/finance/zipBank/Service/BillService.java +++ b/src/main/java/com/finance/zipBank/Service/BillService.java @@ -32,4 +32,7 @@ public Boolean removeBill(Long id){ public IterablegetBillsByUserId(Long id){ return billRepository.findBillsByUserId(id); } + public Bill updateBill(Bill bill){ + return billRepository.save(bill); + } } diff --git a/src/main/java/com/finance/zipBank/Service/TransactionsService.java b/src/main/java/com/finance/zipBank/Service/TransactionsService.java index 3f89f3b..0fa8350 100644 --- a/src/main/java/com/finance/zipBank/Service/TransactionsService.java +++ b/src/main/java/com/finance/zipBank/Service/TransactionsService.java @@ -49,4 +49,8 @@ public List listTop5ForUser(Long userId){ return transactionsRepo.findTop5ByUserIdOrderByTransactionDate(userId); } + public Transactions listTransactionDetails(Long transactionId){ + return transactionsRepo.findById(transactionId).get(); + } + } diff --git a/src/main/resources/script.sql b/src/main/resources/script.sql index 4c789aa..b40810c 100644 --- a/src/main/resources/script.sql +++ b/src/main/resources/script.sql @@ -12,26 +12,26 @@ INSERT INTO ACCOUNTS (ACCOUNT_NUMBER,ACCOUNT_NAME,BALANCE,TYPE,USER_ID) VALUES ( INSERT INTO ACCOUNTS (ACCOUNT_NUMBER,ACCOUNT_NAME,BALANCE,TYPE,USER_ID) VALUES (7,'I need a job', 5000 ,'Checking',4); INSERT INTO ACCOUNTS (ACCOUNT_NUMBER,ACCOUNT_NAME,BALANCE,TYPE,USER_ID) VALUES (8,'Save Me', 8000 ,'Savings',4); -INSERT INTO TRANSACTIONS (TRANSACTION_ID,ACCOUNT_NUMBER,AMOUNT,TRANSACTION_DATE,TYPE) VALUES (1, 1,10.5 ,CURRENT_TIMESTAMP,'W'); -INSERT INTO TRANSACTIONS (TRANSACTION_ID,ACCOUNT_NUMBER,AMOUNT,TRANSACTION_DATE,TYPE) VALUES (2, 1,15.5 ,CURRENT_TIMESTAMP,'D'); -INSERT INTO TRANSACTIONS (TRANSACTION_ID,ACCOUNT_NUMBER,AMOUNT,TRANSACTION_DATE,TYPE) VALUES (3, 2,20 ,CURRENT_TIMESTAMP,'T'); -INSERT INTO TRANSACTIONS (TRANSACTION_ID,ACCOUNT_NUMBER,AMOUNT,TRANSACTION_DATE,TYPE) VALUES (4, 2,3 ,CURRENT_TIMESTAMP,'W'); -INSERT INTO TRANSACTIONS (TRANSACTION_ID,ACCOUNT_NUMBER,AMOUNT,TRANSACTION_DATE,TYPE) VALUES (5, 3,5,CURRENT_TIMESTAMP,'D'); -INSERT INTO TRANSACTIONS (TRANSACTION_ID,ACCOUNT_NUMBER,AMOUNT,TRANSACTION_DATE,TYPE) VALUES (6, 3,16 ,CURRENT_TIMESTAMP,'T'); -INSERT INTO TRANSACTIONS (TRANSACTION_ID,ACCOUNT_NUMBER,AMOUNT,TRANSACTION_DATE,TYPE) VALUES (7, 4,8 ,CURRENT_TIMESTAMP,'W'); -INSERT INTO TRANSACTIONS (TRANSACTION_ID,ACCOUNT_NUMBER,AMOUNT,TRANSACTION_DATE,TYPE) VALUES (8, 4,10.5 ,CURRENT_TIMESTAMP,'D'); -INSERT INTO TRANSACTIONS (TRANSACTION_ID,ACCOUNT_NUMBER,AMOUNT,TRANSACTION_DATE,TYPE) VALUES (9, 1,105 ,CURRENT_TIMESTAMP,'T'); -INSERT INTO TRANSACTIONS (TRANSACTION_ID,ACCOUNT_NUMBER,AMOUNT,TRANSACTION_DATE,TYPE) VALUES (10, 8, 250 ,CURRENT_TIMESTAMP,'D'); -INSERT INTO TRANSACTIONS (TRANSACTION_ID,ACCOUNT_NUMBER,AMOUNT,TRANSACTION_DATE,TYPE) VALUES (11, 8, 100 ,CURRENT_TIMESTAMP,'D'); -INSERT INTO TRANSACTIONS (TRANSACTION_ID,ACCOUNT_NUMBER,AMOUNT,TRANSACTION_DATE,TYPE) VALUES (12, 8, 300 ,CURRENT_TIMESTAMP,'D'); -INSERT INTO TRANSACTIONS (TRANSACTION_ID,ACCOUNT_NUMBER,AMOUNT,TRANSACTION_DATE,TYPE) VALUES (13, 8, 400 ,CURRENT_TIMESTAMP,'W'); -INSERT INTO TRANSACTIONS (TRANSACTION_ID,ACCOUNT_NUMBER,AMOUNT,TRANSACTION_DATE,TYPE) VALUES (14, 7, 250 ,CURRENT_TIMESTAMP,'T'); -INSERT INTO TRANSACTIONS (TRANSACTION_ID,ACCOUNT_NUMBER,AMOUNT,TRANSACTION_DATE,TYPE) VALUES (15, 7, 1250 ,CURRENT_TIMESTAMP,'D'); -INSERT INTO TRANSACTIONS (TRANSACTION_ID,ACCOUNT_NUMBER,AMOUNT,TRANSACTION_DATE,TYPE) VALUES (16, 7, 112 ,CURRENT_TIMESTAMP,'D'); -INSERT INTO TRANSACTIONS (TRANSACTION_ID,ACCOUNT_NUMBER,AMOUNT,TRANSACTION_DATE,TYPE) VALUES (17, 6, 570 ,CURRENT_TIMESTAMP,'D'); -INSERT INTO TRANSACTIONS (TRANSACTION_ID,ACCOUNT_NUMBER,AMOUNT,TRANSACTION_DATE,TYPE) VALUES (18, 6, 125 ,CURRENT_TIMESTAMP,'W'); -INSERT INTO TRANSACTIONS (TRANSACTION_ID,ACCOUNT_NUMBER,AMOUNT,TRANSACTION_DATE,TYPE) VALUES (19, 5, 222 ,CURRENT_TIMESTAMP,'W'); -INSERT INTO TRANSACTIONS (TRANSACTION_ID,ACCOUNT_NUMBER,AMOUNT,TRANSACTION_DATE,TYPE) VALUES (20, 5, 20 ,CURRENT_TIMESTAMP,'D'); +INSERT INTO TRANSACTIONS (TRANSACTION_ID,ACCOUNT_NUMBER,AMOUNT,TRANSACTION_DATE,TYPE) VALUES (1, 1,10.5 ,CURRENT_TIMESTAMP,'Withdraw'); +INSERT INTO TRANSACTIONS (TRANSACTION_ID,ACCOUNT_NUMBER,AMOUNT,TRANSACTION_DATE,TYPE) VALUES (2, 1,15.5 ,CURRENT_TIMESTAMP,'Deosit'); +INSERT INTO TRANSACTIONS (TRANSACTION_ID,ACCOUNT_NUMBER,AMOUNT,TRANSACTION_DATE,TYPE) VALUES (3, 2,20 ,CURRENT_TIMESTAMP,'Transfer recieeived'); +INSERT INTO TRANSACTIONS (TRANSACTION_ID,ACCOUNT_NUMBER,AMOUNT,TRANSACTION_DATE,TYPE) VALUES (4, 2,3 ,CURRENT_TIMESTAMP,'Withdraw'); +INSERT INTO TRANSACTIONS (TRANSACTION_ID,ACCOUNT_NUMBER,AMOUNT,TRANSACTION_DATE,TYPE) VALUES (5, 3,5,CURRENT_TIMESTAMP,'Deposit'); +INSERT INTO TRANSACTIONS (TRANSACTION_ID,ACCOUNT_NUMBER,AMOUNT,TRANSACTION_DATE,TYPE) VALUES (6, 3,16 ,CURRENT_TIMESTAMP,'Transfer received'); +INSERT INTO TRANSACTIONS (TRANSACTION_ID,ACCOUNT_NUMBER,AMOUNT,TRANSACTION_DATE,TYPE) VALUES (7, 4,8 ,CURRENT_TIMESTAMP,'Withdraw'); +INSERT INTO TRANSACTIONS (TRANSACTION_ID,ACCOUNT_NUMBER,AMOUNT,TRANSACTION_DATE,TYPE) VALUES (8, 4,10.5 ,CURRENT_TIMESTAMP,'Deposit'); +INSERT INTO TRANSACTIONS (TRANSACTION_ID,ACCOUNT_NUMBER,AMOUNT,TRANSACTION_DATE,TYPE) VALUES (9, 1,105 ,CURRENT_TIMESTAMP,'Transfer received'); +INSERT INTO TRANSACTIONS (TRANSACTION_ID,ACCOUNT_NUMBER,AMOUNT,TRANSACTION_DATE,TYPE) VALUES (10, 8, 250 ,CURRENT_TIMESTAMP,'Deposit'); +INSERT INTO TRANSACTIONS (TRANSACTION_ID,ACCOUNT_NUMBER,AMOUNT,TRANSACTION_DATE,TYPE) VALUES (11, 8, 100 ,CURRENT_TIMESTAMP,'Deposit'); +INSERT INTO TRANSACTIONS (TRANSACTION_ID,ACCOUNT_NUMBER,AMOUNT,TRANSACTION_DATE,TYPE) VALUES (12, 8, 300 ,CURRENT_TIMESTAMP,'Deposit'); +INSERT INTO TRANSACTIONS (TRANSACTION_ID,ACCOUNT_NUMBER,AMOUNT,TRANSACTION_DATE,TYPE) VALUES (13, 8, 400 ,CURRENT_TIMESTAMP,'Withdraw'); +INSERT INTO TRANSACTIONS (TRANSACTION_ID,ACCOUNT_NUMBER,AMOUNT,TRANSACTION_DATE,TYPE) VALUES (14, 7, 250 ,CURRENT_TIMESTAMP,'Transfer received'); +INSERT INTO TRANSACTIONS (TRANSACTION_ID,ACCOUNT_NUMBER,AMOUNT,TRANSACTION_DATE,TYPE) VALUES (15, 7, 1250 ,CURRENT_TIMESTAMP,'Depost'); +INSERT INTO TRANSACTIONS (TRANSACTION_ID,ACCOUNT_NUMBER,AMOUNT,TRANSACTION_DATE,TYPE) VALUES (16, 7, 112 ,CURRENT_TIMESTAMP,'Deposit'); +INSERT INTO TRANSACTIONS (TRANSACTION_ID,ACCOUNT_NUMBER,AMOUNT,TRANSACTION_DATE,TYPE) VALUES (17, 6, 570 ,CURRENT_TIMESTAMP,'Deposit'); +INSERT INTO TRANSACTIONS (TRANSACTION_ID,ACCOUNT_NUMBER,AMOUNT,TRANSACTION_DATE,TYPE) VALUES (18, 6, 125 ,CURRENT_TIMESTAMP,'Withdraw'); +INSERT INTO TRANSACTIONS (TRANSACTION_ID,ACCOUNT_NUMBER,AMOUNT,TRANSACTION_DATE,TYPE) VALUES (19, 5, 222 ,CURRENT_TIMESTAMP,'Withdraw'); +INSERT INTO TRANSACTIONS (TRANSACTION_ID,ACCOUNT_NUMBER,AMOUNT,TRANSACTION_DATE,TYPE) VALUES (20, 5, 20 ,CURRENT_TIMESTAMP,'Deposit'); INSERT INTO BILL (BILL_ID,RECIPIENT,PURPOSE,AMOUNT,USER_ID,INITIAL_BILL_DATE) VALUES (1,'Comcast','Internet',89.00,1,'2020-01-20'); INSERT INTO BILL (BILL_ID,RECIPIENT,PURPOSE,AMOUNT,USER_ID,INITIAL_BILL_DATE) VALUES (2,'Verizon','Cell Phone',104.99,1,'2019-12-31'); diff --git a/src/test/java/com/finance/zipBank/Contoller/AccountControllerTest.java b/src/test/java/com/finance/zipBank/Contoller/AccountControllerTest.java new file mode 100644 index 0000000..4cb1e4b --- /dev/null +++ b/src/test/java/com/finance/zipBank/Contoller/AccountControllerTest.java @@ -0,0 +1,32 @@ +package com.finance.zipBank.Contoller; + + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.finance.zipBank.Controllers.AccountsController; +import com.finance.zipBank.Models.Accounts; +import com.finance.zipBank.Repositories.AccountsRepo; +import org.junit.Before; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; +import org.springframework.boot.test.json.JacksonTester; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; +import org.junit.Test; + +@RunWith(MockitoJUnitRunner.class) + public class AccountControllerTest { + + private MockMvc mvc; + + @Mock + private AccountsRepo accountsRepo; + + @InjectMocks + private AccountsController accountsController; + + + private JacksonTester jsonAccount; + +} \ No newline at end of file diff --git a/src/test/java/com/finance/zipBank/Models/Account.java b/src/test/java/com/finance/zipBank/Models/AccountTest.java similarity index 59% rename from src/test/java/com/finance/zipBank/Models/Account.java rename to src/test/java/com/finance/zipBank/Models/AccountTest.java index f641e8f..0d454ed 100644 --- a/src/test/java/com/finance/zipBank/Models/Account.java +++ b/src/test/java/com/finance/zipBank/Models/AccountTest.java @@ -1,4 +1,4 @@ package com.finance.zipBank.Models; -public class Account { +public class AccountTest { } diff --git a/src/test/java/com/finance/zipBank/Models/AccountsTest.java b/src/test/java/com/finance/zipBank/Models/AccountsTest.java new file mode 100644 index 0000000..68f2a69 --- /dev/null +++ b/src/test/java/com/finance/zipBank/Models/AccountsTest.java @@ -0,0 +1,72 @@ +package com.finance.zipBank.Models; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + +class AccountsTest { + + @Test + void getAccountNumber() { + } + + @Test + void setAccountNumber() { + } + + @Test + void getUserId() { + } + + @Test + void setUserId() { + } + + @Test + void getTransactionsList() { + } + + @Test + void setTransactionsList() { + } + + @Test + void getBalance() { + } + + @Test + void setBalance() { + } + + @Test + void getType() { + } + + @Test + void setType() { + } + + @Test + void getInterestRate() { + } + + @Test + void setInterestRate() { + } + + @Test + void getUser() { + } + + @Test + void setUser() { + } + + @Test + void getAccountName() { + } + + @Test + void setAccountName() { + } +} \ No newline at end of file