From 41b5d42330f50431f4626540c90d223766156fa9 Mon Sep 17 00:00:00 2001 From: Anton Romanov Date: Thu, 2 May 2024 13:59:12 +0400 Subject: [PATCH] #247 -- Add failed test --- Jenkinsfile | 2 +- build.gradle | 20 +++++++++++-------- .../java/ru/ulstu/user/util/UserUtils.java | 5 ----- .../templates/conferences/conference.html | 8 ++++---- .../fragments/grantDashboardFragment.html | 6 +++--- .../grants/fragments/grantLineFragment.html | 4 ++-- .../resources/templates/papers/dashboard.html | 4 ++-- .../fragments/paperDashboardFragment.html | 4 ++-- .../papers/fragments/paperLineFragment.html | 2 +- .../resources/templates/papers/papers.html | 2 +- .../ulstu/{ => test}/StreamApiUtilsTest.java | 2 +- 11 files changed, 29 insertions(+), 30 deletions(-) rename src/test/java/ru/ulstu/{ => test}/StreamApiUtilsTest.java (96%) diff --git a/Jenkinsfile b/Jenkinsfile index bc8c4fa..7b26dbf 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,7 +8,7 @@ pipeline { } stage('Test') { steps { - sh "./gradlew test" + sh "./gradlew clean test --info" } } } diff --git a/build.gradle b/build.gradle index 9657951..9d06099 100644 --- a/build.gradle +++ b/build.gradle @@ -61,6 +61,10 @@ task health(dependsOn: [ 'checkstyleMain' ]) +test { + useJUnitPlatform() +} + jar { enabled = false } @@ -79,7 +83,9 @@ repositories { } dependencies { - implementation group: 'org.springframework.boot', name: 'spring-boot-starter-web' + implementation('org.springframework.boot:spring-boot-starter-web') { + exclude group: 'org.springframework.boot', module: 'spring-boot-starter-tomcat' + } implementation group: 'org.springframework.boot', name: 'spring-boot-starter-security' implementation group: 'org.springframework.boot', name: 'spring-boot-starter-aop' implementation group: 'org.springframework.boot', name: 'spring-boot-starter-mail' @@ -91,8 +97,6 @@ dependencies { implementation group: 'org.thymeleaf.extras', name: 'thymeleaf-extras-springsecurity6' implementation group: 'com.fasterxml.jackson.module', name: 'jackson-module-afterburner' implementation group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-hibernate5' - implementation group: 'org.springframework.security', name: 'spring-security-oauth2-client' - implementation group: 'org.springframework.security', name: 'spring-security-oauth2-jose' implementation group: 'org.postgresql', name: 'postgresql', version: '42.2.5' @@ -101,16 +105,16 @@ dependencies { implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.7' - implementation group: 'org.webjars', name: 'bootstrap', version: '4.1.0' - implementation group: 'org.webjars', name: 'bootstrap-select', version: '1.13.3' - implementation group: 'org.webjars', name: 'jquery', version: '3.3.1-1' - implementation group: 'org.webjars.npm', name: 'jquery.easing', version: '1.4.1' + implementation group: 'org.webjars', name: 'bootstrap', version: '5.3.3' + runtimeOnly group: 'org.webjars', name: 'bootstrap-select', version: '1.4.2' + implementation group: 'org.webjars', name: 'jquery', version: '3.7.1' + implementation group: 'org.webjars', name: 'jquery-easing', version: '1.4.1' implementation group: 'org.webjars', name: 'font-awesome', version: '4.7.0' implementation group: 'org.springdoc', name: 'springdoc-openapi-ui', version: '1.8.0' implementation group: 'net.sourceforge.htmlunit', name: 'htmlunit', version: '2.35.0' implementation group: 'xalan', name: 'xalan', version: '2.7.2' - testImplementation group: 'org.springframework.boot', name: 'spring-boot-starter-test' + implementation group: 'org.springframework.boot', name: 'spring-boot-starter-test' testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.10.2' } diff --git a/src/main/java/ru/ulstu/user/util/UserUtils.java b/src/main/java/ru/ulstu/user/util/UserUtils.java index 6f51633..bee4a1e 100644 --- a/src/main/java/ru/ulstu/user/util/UserUtils.java +++ b/src/main/java/ru/ulstu/user/util/UserUtils.java @@ -4,7 +4,6 @@ import org.apache.commons.lang3.RandomStringUtils; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContext; import org.springframework.security.core.userdetails.UserDetails; -import org.springframework.security.oauth2.core.oidc.user.DefaultOidcUser; import ru.ulstu.configuration.Constants; public class UserUtils { @@ -28,10 +27,6 @@ public class UserUtils { final UserDetails springSecurityUser = (UserDetails) authentication.getPrincipal(); return springSecurityUser.getUsername(); } - if (authentication.getPrincipal() instanceof DefaultOidcUser) { - final DefaultOidcUser oauth2User = (DefaultOidcUser) authentication.getPrincipal(); - return oauth2User.getEmail(); - } if (authentication.getPrincipal() instanceof String) { return (String) authentication.getPrincipal(); } diff --git a/src/main/resources/templates/conferences/conference.html b/src/main/resources/templates/conferences/conference.html index 9a0e6b0..38c0609 100644 --- a/src/main/resources/templates/conferences/conference.html +++ b/src/main/resources/templates/conferences/conference.html @@ -156,16 +156,16 @@ - + Имя статьи - + Имя статьи diff --git a/src/main/resources/templates/grants/fragments/grantDashboardFragment.html b/src/main/resources/templates/grants/fragments/grantDashboardFragment.html index 09e7e89..63f1da7 100644 --- a/src/main/resources/templates/grants/fragments/grantDashboardFragment.html +++ b/src/main/resources/templates/grants/fragments/grantDashboardFragment.html @@ -7,7 +7,7 @@
diff --git a/src/main/resources/templates/grants/fragments/grantLineFragment.html b/src/main/resources/templates/grants/fragments/grantLineFragment.html index 86ae1cf..c215698 100644 --- a/src/main/resources/templates/grants/fragments/grantLineFragment.html +++ b/src/main/resources/templates/grants/fragments/grantLineFragment.html @@ -15,8 +15,8 @@ - +