diff --git a/.idea/libraries/Maven__mysql_mysql_connector_java_5_1_39.xml b/.idea/libraries/Maven__mysql_mysql_connector_java_5_1_39.xml deleted file mode 100644 index 18e6ec92274c893f2ea42efd5b2be6bb96823301..0000000000000000000000000000000000000000 --- a/.idea/libraries/Maven__mysql_mysql_connector_java_5_1_39.xml +++ /dev/null @@ -1,13 +0,0 @@ -<component name="libraryTable"> - <library name="Maven: mysql:mysql-connector-java:5.1.39"> - <CLASSES> - <root url="jar://$MAVEN_REPOSITORY$/mysql/mysql-connector-java/5.1.39/mysql-connector-java-5.1.39.jar!/" /> - </CLASSES> - <JAVADOC> - <root url="jar://$MAVEN_REPOSITORY$/mysql/mysql-connector-java/5.1.39/mysql-connector-java-5.1.39-javadoc.jar!/" /> - </JAVADOC> - <SOURCES> - <root url="jar://$MAVEN_REPOSITORY$/mysql/mysql-connector-java/5.1.39/mysql-connector-java-5.1.39-sources.jar!/" /> - </SOURCES> - </library> -</component> \ No newline at end of file diff --git a/.idea/libraries/Maven__org_apiguardian_apiguardian_api_1_1_2.xml b/.idea/libraries/Maven__org_apiguardian_apiguardian_api_1_1_2.xml new file mode 100644 index 0000000000000000000000000000000000000000..6ac1c42c6bddbae8d8a2b945ac4b3d58ed4807e2 --- /dev/null +++ b/.idea/libraries/Maven__org_apiguardian_apiguardian_api_1_1_2.xml @@ -0,0 +1,13 @@ +<component name="libraryTable"> + <library name="Maven: org.apiguardian:apiguardian-api:1.1.2"> + <CLASSES> + <root url="jar://$MAVEN_REPOSITORY$/org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2.jar!/" /> + </CLASSES> + <JAVADOC> + <root url="jar://$MAVEN_REPOSITORY$/org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2-javadoc.jar!/" /> + </JAVADOC> + <SOURCES> + <root url="jar://$MAVEN_REPOSITORY$/org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2-sources.jar!/" /> + </SOURCES> + </library> +</component> \ No newline at end of file diff --git a/.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_5_8_1.xml b/.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_5_8_1.xml new file mode 100644 index 0000000000000000000000000000000000000000..987e7d4e2ee35a406ef9142de7027edc2617018a --- /dev/null +++ b/.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_5_8_1.xml @@ -0,0 +1,13 @@ +<component name="libraryTable"> + <library name="Maven: org.junit.jupiter:junit-jupiter:5.8.1"> + <CLASSES> + <root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter/5.8.1/junit-jupiter-5.8.1.jar!/" /> + </CLASSES> + <JAVADOC> + <root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter/5.8.1/junit-jupiter-5.8.1-javadoc.jar!/" /> + </JAVADOC> + <SOURCES> + <root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter/5.8.1/junit-jupiter-5.8.1-sources.jar!/" /> + </SOURCES> + </library> +</component> \ No newline at end of file diff --git a/.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_api_5_8_1.xml b/.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_api_5_8_1.xml new file mode 100644 index 0000000000000000000000000000000000000000..4910ca992b01066ca948ed251061a7555889f545 --- /dev/null +++ b/.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_api_5_8_1.xml @@ -0,0 +1,13 @@ +<component name="libraryTable"> + <library name="Maven: org.junit.jupiter:junit-jupiter-api:5.8.1"> + <CLASSES> + <root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-api/5.8.1/junit-jupiter-api-5.8.1.jar!/" /> + </CLASSES> + <JAVADOC> + <root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-api/5.8.1/junit-jupiter-api-5.8.1-javadoc.jar!/" /> + </JAVADOC> + <SOURCES> + <root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-api/5.8.1/junit-jupiter-api-5.8.1-sources.jar!/" /> + </SOURCES> + </library> +</component> \ No newline at end of file diff --git a/.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_engine_5_8_1.xml b/.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_engine_5_8_1.xml new file mode 100644 index 0000000000000000000000000000000000000000..85ab9ade17773b1a6f962816723f1cc0fb194a29 --- /dev/null +++ b/.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_engine_5_8_1.xml @@ -0,0 +1,13 @@ +<component name="libraryTable"> + <library name="Maven: org.junit.jupiter:junit-jupiter-engine:5.8.1"> + <CLASSES> + <root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-engine/5.8.1/junit-jupiter-engine-5.8.1.jar!/" /> + </CLASSES> + <JAVADOC> + <root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-engine/5.8.1/junit-jupiter-engine-5.8.1-javadoc.jar!/" /> + </JAVADOC> + <SOURCES> + <root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-engine/5.8.1/junit-jupiter-engine-5.8.1-sources.jar!/" /> + </SOURCES> + </library> +</component> \ No newline at end of file diff --git a/.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_params_5_8_1.xml b/.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_params_5_8_1.xml new file mode 100644 index 0000000000000000000000000000000000000000..8675273d91e2b3f4aac3913358060ce49ddcfb91 --- /dev/null +++ b/.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_params_5_8_1.xml @@ -0,0 +1,13 @@ +<component name="libraryTable"> + <library name="Maven: org.junit.jupiter:junit-jupiter-params:5.8.1"> + <CLASSES> + <root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-params/5.8.1/junit-jupiter-params-5.8.1.jar!/" /> + </CLASSES> + <JAVADOC> + <root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-params/5.8.1/junit-jupiter-params-5.8.1-javadoc.jar!/" /> + </JAVADOC> + <SOURCES> + <root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-params/5.8.1/junit-jupiter-params-5.8.1-sources.jar!/" /> + </SOURCES> + </library> +</component> \ No newline at end of file diff --git a/.idea/libraries/Maven__org_junit_platform_junit_platform_commons_1_8_1.xml b/.idea/libraries/Maven__org_junit_platform_junit_platform_commons_1_8_1.xml new file mode 100644 index 0000000000000000000000000000000000000000..341720888f321babd7e543f0c50949dfd9401826 --- /dev/null +++ b/.idea/libraries/Maven__org_junit_platform_junit_platform_commons_1_8_1.xml @@ -0,0 +1,13 @@ +<component name="libraryTable"> + <library name="Maven: org.junit.platform:junit-platform-commons:1.8.1"> + <CLASSES> + <root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-commons/1.8.1/junit-platform-commons-1.8.1.jar!/" /> + </CLASSES> + <JAVADOC> + <root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-commons/1.8.1/junit-platform-commons-1.8.1-javadoc.jar!/" /> + </JAVADOC> + <SOURCES> + <root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-commons/1.8.1/junit-platform-commons-1.8.1-sources.jar!/" /> + </SOURCES> + </library> +</component> \ No newline at end of file diff --git a/.idea/libraries/Maven__org_junit_platform_junit_platform_engine_1_8_1.xml b/.idea/libraries/Maven__org_junit_platform_junit_platform_engine_1_8_1.xml new file mode 100644 index 0000000000000000000000000000000000000000..f19b408dff5fa904755fc05d36ff5c91ffa7c164 --- /dev/null +++ b/.idea/libraries/Maven__org_junit_platform_junit_platform_engine_1_8_1.xml @@ -0,0 +1,13 @@ +<component name="libraryTable"> + <library name="Maven: org.junit.platform:junit-platform-engine:1.8.1"> + <CLASSES> + <root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-engine/1.8.1/junit-platform-engine-1.8.1.jar!/" /> + </CLASSES> + <JAVADOC> + <root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-engine/1.8.1/junit-platform-engine-1.8.1-javadoc.jar!/" /> + </JAVADOC> + <SOURCES> + <root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-engine/1.8.1/junit-platform-engine-1.8.1-sources.jar!/" /> + </SOURCES> + </library> +</component> \ No newline at end of file diff --git a/.idea/libraries/Maven__org_opentest4j_opentest4j_1_2_0.xml b/.idea/libraries/Maven__org_opentest4j_opentest4j_1_2_0.xml new file mode 100644 index 0000000000000000000000000000000000000000..fbc1b1635a2c69174f8bea7d6306f5175015adc0 --- /dev/null +++ b/.idea/libraries/Maven__org_opentest4j_opentest4j_1_2_0.xml @@ -0,0 +1,13 @@ +<component name="libraryTable"> + <library name="Maven: org.opentest4j:opentest4j:1.2.0"> + <CLASSES> + <root url="jar://$MAVEN_REPOSITORY$/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0.jar!/" /> + </CLASSES> + <JAVADOC> + <root url="jar://$MAVEN_REPOSITORY$/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0-javadoc.jar!/" /> + </JAVADOC> + <SOURCES> + <root url="jar://$MAVEN_REPOSITORY$/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0-sources.jar!/" /> + </SOURCES> + </library> +</component> \ No newline at end of file diff --git a/.idea/libraries/Maven__org_postgresql_postgresql_9_4_1211_jre7.xml b/.idea/libraries/Maven__org_postgresql_postgresql_9_4_1211_jre7.xml new file mode 100644 index 0000000000000000000000000000000000000000..be620eac3894a8806d30dac986aa4843c0d94fbd --- /dev/null +++ b/.idea/libraries/Maven__org_postgresql_postgresql_9_4_1211_jre7.xml @@ -0,0 +1,13 @@ +<component name="libraryTable"> + <library name="Maven: org.postgresql:postgresql:9.4.1211.jre7"> + <CLASSES> + <root url="jar://$MAVEN_REPOSITORY$/org/postgresql/postgresql/9.4.1211.jre7/postgresql-9.4.1211.jre7.jar!/" /> + </CLASSES> + <JAVADOC> + <root url="jar://$MAVEN_REPOSITORY$/org/postgresql/postgresql/9.4.1211.jre7/postgresql-9.4.1211.jre7-javadoc.jar!/" /> + </JAVADOC> + <SOURCES> + <root url="jar://$MAVEN_REPOSITORY$/org/postgresql/postgresql/9.4.1211.jre7/postgresql-9.4.1211.jre7-sources.jar!/" /> + </SOURCES> + </library> +</component> \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000000000000000000000000000000000000..94a25f7f4cb416c083d265558da75d457237d671 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="VcsDirectoryMappings"> + <mapping directory="$PROJECT_DIR$" vcs="Git" /> + </component> +</project> \ No newline at end of file diff --git a/source/pom.xml b/source/pom.xml index 2a7a96d8bb5f8a592c2fabd5ada26909f95b5c15..0eaf90198776ee9f6fcce88445068e96c3cf21c1 100644 --- a/source/pom.xml +++ b/source/pom.xml @@ -25,6 +25,7 @@ </properties> <dependencies> + <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> @@ -59,8 +60,21 @@ <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> + <exclusions> + <exclusion> + <groupId>org.junit.vintage</groupId> + <artifactId>junit-vintage-engine</artifactId> + </exclusion> + </exclusions> </dependency> - </dependencies> + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter</artifactId> + <version>5.8.1</version> + <scope>test</scope> + </dependency> + + </dependencies> <build> <finalName>bank-service</finalName> diff --git a/source/src/main/java/com/userfront/config/SecurityConfig.java b/source/src/main/java/com/userfront/config/SecurityConfig.java index 6f3612b0341ac1ffe9b643e7812abc1eaeb1eed5..7e48b6229c9ddf56d06a4de7a7c16028d3012ded 100644 --- a/source/src/main/java/com/userfront/config/SecurityConfig.java +++ b/source/src/main/java/com/userfront/config/SecurityConfig.java @@ -43,15 +43,16 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { "/contact/**", "/error/**/*", "/console/**", - "/signup" + "/signup", + "/swagger-ui-custom.html" }; @Override protected void configure(HttpSecurity http) throws Exception { http .authorizeRequests(). -// antMatchers("/**"). - antMatchers(PUBLIC_MATCHERS). + antMatchers("/**"). +// antMatchers(PUBLIC_MATCHERS). permitAll().anyRequest().authenticated(); http diff --git a/source/src/main/resources/application.properties b/source/src/main/resources/application.properties index 3f89c48f20d697a70c04ef4034628b24be23d0ca..2657793bb9f744ddeb4b05b787a3fd89d007dfb3 100644 --- a/source/src/main/resources/application.properties +++ b/source/src/main/resources/application.properties @@ -1,7 +1,7 @@ -spring.datasource.url= jdbc:postgresql://db-postgres-online-bank/onlinebanking -spring.datasource.username=root -spring.datasource.password=root +spring.datasource.url= jdbc:postgresql://localhost:5432/onlinebanking +spring.datasource.username=postgres +spring.datasource.password=postgres spring.jpa.database-platform=org.hibernate.dialect.PostgreSQL9Dialect -spring.jpa.show-sql = true -spring.jpa.hibernate.ddl-auto = update +spring.jpa.show-sql =true +spring.jpa.hibernate.ddl-auto=update diff --git a/source/src/test/java/com/userfront/service/AccountServiceTest.java b/source/src/test/java/com/userfront/service/AccountServiceTest.java new file mode 100644 index 0000000000000000000000000000000000000000..1f9ff4197f426dc851c7c3337b0bdff4534d924b --- /dev/null +++ b/source/src/test/java/com/userfront/service/AccountServiceTest.java @@ -0,0 +1,43 @@ +package com.userfront.service; + + +import com.userfront.UserFrontApplication; +import com.userfront.UserFrontApplicationTests; +import com.userfront.dao.PrimaryAccountDao; +import com.userfront.dao.SavingsAccountDao; +import com.userfront.domain.PrimaryAccount; +import com.userfront.service.UserServiceImpl.AccountServiceImpl; +import org.junit.Assert; +import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.extension.ExtendWith; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.SpringApplicationConfiguration; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +import java.math.BigDecimal; + + +public class AccountServiceTest { + + @Test + public void createPrimaryAccount() { + AccountServiceImpl accountService = Mockito.mock(AccountServiceImpl.class); + + PrimaryAccount primaryAccount = new PrimaryAccount(); + primaryAccount.setAccountBalance(new BigDecimal(0.0)); + primaryAccount.setAccountNumber(1); + + Mockito.when(accountService.createPrimaryAccount()) + .thenReturn(primaryAccount); + PrimaryAccount primaryAccountResult = accountService.createPrimaryAccount(); + Assert.assertEquals(primaryAccountResult.getAccountBalance(), new BigDecimal(0.0)); + } + +}