#247 -- Add failed test

This commit is contained in:
Anton Romanov 2024-05-02 13:59:12 +04:00
parent c6c0db0232
commit 41b5d42330
11 changed files with 29 additions and 30 deletions

2
Jenkinsfile vendored
View File

@ -8,7 +8,7 @@ pipeline {
}
stage('Test') {
steps {
sh "./gradlew test"
sh "./gradlew clean test --info"
}
}
}

View File

@ -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'
}

View File

@ -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();
}

View File

@ -156,16 +156,16 @@
<a class="paper-name"
th:href="@{'/papers/paper?id=' + *{papers[__${rowStat.index}__].id} + ''}"
th:if="*{papers[__${rowStat.index}__].id !=null}">
<span th:replace="papers/fragments/paperStatusFragment :: paperStatus(paperStatus=*{papers[__${rowStat.index}__].status},
title=*{papers[__${rowStat.index}__].title}, small=false)"/>
<span th:replace="~{papers/fragments/paperStatusFragment :: paperStatus(paperStatus=*{papers[__${rowStat.index}__].status},
title=*{papers[__${rowStat.index}__].title}, small=false)}"/>
<span th:text="*{papers[__${rowStat.index}__].title}">
Имя статьи
</span>
</a>
<a class="paper-name"
th:unless="*{papers[__${rowStat.index}__].id !=null}">
<span th:replace="papers/fragments/paperStatusFragment :: paperStatus(paperStatus=*{papers[__${rowStat.index}__].status},
title=*{papers[__${rowStat.index}__].title}, small=false)"/>
<span th:replace="~{papers/fragments/paperStatusFragment :: paperStatus(paperStatus=*{papers[__${rowStat.index}__].status},
title=*{papers[__${rowStat.index}__].title}, small=false)}"/>
<span th:text="*{papers[__${rowStat.index}__].title}">
Имя статьи
</span>

View File

@ -7,7 +7,7 @@
<div th:fragment="grantDashboard (grant)" class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3 dashboard-card">
<div class="row">
<div class="col-2">
<span th:replace="grants/fragments/grantStatusFragment :: grantStatus(grantStatus=${grant.status})"/>
<span th:replace="~{grants/fragments/grantStatusFragment :: grantStatus(grantStatus=${grant.status})}"/>
</div>
<div class="col col-10 text-right">
<a th:href="'grant?id='+${grant.id}">
@ -15,8 +15,8 @@
</a>
<p class="text-muted" th:text="${grant.status.statusName}"> status</p>
<span th:each="paper, rowStat : *{grant.papers}">
<span th:replace="papers/fragments/paperStatusFragment :: paperStatus(paperStatus=${paper.status},
title=${paper.title}, small=true)"/>
<span th:replace="~{papers/fragments/paperStatusFragment :: paperStatus(paperStatus=${paper.status},
title=${paper.title}, small=true)}"/>
</span>
</div>
</div>

View File

@ -15,8 +15,8 @@
<span class="text-muted" th:text="${grant.authorsString}"/>
</a>
<span th:each="paper, rowStat : *{grant.papers}">
<span th:replace="papers/fragments/paperStatusFragment :: paperStatus(paperStatus=${paper.status},
title=${paper.title}, small=true)"/>
<span th:replace="~{papers/fragments/paperStatusFragment :: paperStatus(paperStatus=${paper.status},
title=${paper.title}, small=true)}"/>
</span>
<input class="id-class" type="hidden" th:value="${grant.id}"/>
<a class="remove-grant pull-right d-none" th:href="@{'/grants/delete/'+${grant.id}}"

View File

@ -11,11 +11,11 @@
<div class="container">
<div class="col-lg-12 text-center">
<h2 class="section-heading text-uppercase">Статьи</h2>
<div th:replace="papers/fragments/paperNavigationFragment"/>
<div th:replace="~{papers/fragments/paperNavigationFragment}"/>
</div>
<div class="row justify-content-center" id="dashboard">
<th:block th:each="paper : ${papers}">
<div th:replace="papers/fragments/paperDashboardFragment :: paperDashboard(paper=${paper})"/>
<div th:replace="~{papers/fragments/paperDashboardFragment :: paperDashboard(paper=${paper})}"/>
</th:block>
</div>
<div th:replace="fragments/noRecordsFragment :: noRecords(entities=${papers}, noRecordsMessage=' одной статьи', url='paper')"/>

View File

@ -7,8 +7,8 @@
<div th:fragment="paperDashboard (paper)" class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3 dashboard-card">
<div class="row">
<div class="col-2">
<span th:replace="papers/fragments/paperStatusFragment :: paperStatus(paperStatus=${paper.status},
title=${paper.title}, small=false)"/>
<span th:replace="~{papers/fragments/paperStatusFragment :: paperStatus(paperStatus=${paper.status},
title=${paper.title}, small=false)}"/>
</div>
<div class="col col-10 text-right">
<p th:if="${paper.url!=null and paper.url!=''}"><a target="_blank" class="externalLink"

View File

@ -7,7 +7,7 @@
<div th:fragment="paperLine (paper)" class="text-left paper-row" style="background-color: white;">
<div class="row">
<div class="col-1 d-flex justify-content-center align-self-center">
<span th:replace="papers/fragments/paperStatusFragment :: paperStatus(paperStatus=${paper.status}, title=${paper.title}, small=false)"/>
<span th:replace="~{papers/fragments/paperStatusFragment :: paperStatus(paperStatus=${paper.status}, title=${paper.title}, small=false)}"/>
</div>
<div class="col-10">
<div class="row">

View File

@ -15,7 +15,7 @@
<div class="row mb-3" id="paper-list">
<div class="col-lg-12 text-center">
<h3 class="section-heading text-uppercase">Статьи</h3>
<div th:replace="papers/fragments/paperNavigationFragment"/>
<div th:replace="~{papers/fragments/paperNavigationFragment}"/>
</div>
</div>

View File

@ -1,4 +1,4 @@
package ru.ulstu;
package ru.ulstu.test;
import org.junit.jupiter.api.Test;