Тестовые случаи не удались после обновления зависимости интеграции Spring-Boot-Parameter-Store-IntegrationJAVA

Программисты JAVA общаются здесь
Ответить Пред. темаСлед. тема
Anonymous
 Тестовые случаи не удались после обновления зависимости интеграции Spring-Boot-Parameter-Store-Integration

Сообщение Anonymous »

Случаи тестирования интеграции не удались после обновления зависимости Spring-boot-parameter-store-integration до версии 2.0.0. и Software.amazon.awssdk:bom до 2.26.15.
Версия загрузки Spring, которую я использую, — 3.3.1

Код: Выделить всё

classpath("org.springframework.boot:spring-boot-gradle-plugin:3.3.1")
Я получаю следующие ошибки:

Код: Выделить всё

GcsLogAspectWeavingTest > invokeAnnotatedMethod_WorkflowStepMonitorListener() FAILED
java.lang.IllegalStateException at DefaultCacheAwareContextLoaderDelegate.java:180
Caused by: java.lang.IllegalStateException at SpringApplication.java:825
Caused by: java.lang.NoSuchMethodError at StandardBeanExpressionResolver.java:119
Caused by: java.lang.IllegalStateException at SpringApplication.java:825

Caused by: java.lang.NoSuchMethodError at StandardBeanExpressionResolver.java:119
Ниже приведен код для GcsLogAspectWeavingTest

Код: Выделить всё

package com.tr.gcs.delivertocheetah.logging

import static org.mockito.Mockito.*
import com.amazon.sqs.javamessaging.message.SQSTextMessage
import com.fasterxml.jackson.databind.ObjectMapper
import com.tr.gcs.delivertocheetah.service.LoadToCheetahActivityInputProcessor
import com.tr.gcs.delivertocheetah.queue.WorkflowStepMonitorListener
import com.tr.gcs.delivertocheetah.service.amazonaws.stepfunction.StepFunctionClientWrapper
import com.tr.gcs.delivertocheetah.service.ssm.SystemsManagerConfig
import com.tr.gcs.delivertocheetah.service.ssm.SystemsManagerService
import com.tr.gcs.delivertocheetah.service.util.RetryUtil
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.extension.ExtendWith
import org.mockito.Mock
import org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.boot.test.mock.mockito.MockBean
import org.springframework.boot.test.mock.mockito.SpyBean
import org.springframework.context.annotation.Import
import org.springframework.test.context.junit.jupiter.SpringExtension

@SuppressWarnings("UnusedPrivateField")
@ExtendWith(SpringExtension)
@Import(AnnotationAwareAspectJAutoProxyCreator)
@SpringBootTest(classes = [WorkflowStepMonitorListener, GcsLogAspect])
class GcsLogAspectWeavingTest
{
@Mock
private SQSTextMessage sqsTextMessage

@MockBean
private StepFunctionClientWrapper stepFunctionClientWrapper

@MockBean
private LoadToCheetahActivityInputProcessor loadToCheetahActivityInputProcessor

@MockBean
private SystemsManagerService systemsManagerService

@MockBean
private SystemsManagerConfig systemsManagerConfig

@MockBean
private ObjectMapper objectMapper

@MockBean
private RetryUtil retryUtil

@Autowired
private WorkflowStepMonitorListener workflowStepMonitorListener

@SpyBean
private GcsLogAspect gcsLogAspect

@Test
void invokeAnnotatedMethod_WorkflowStepMonitorListener()
{
workflowStepMonitorListener.onMessage(sqsTextMessage)

verify(gcsLogAspect).populateThreadContext(any())
}
}

Это связано с проблемой несовместимости версий. Есть идеи, как устранить эту ошибку?
Также добавил файл build.gradle:

Код: Выделить всё

buildscript {
repositories {
maven {
url "https://tr1.jfrog.io/tr1/libs-release/"
credentials {
username System.getenv("ARTIFACTORY_USER")
password System.getenv("ARTIFACTORY_TOKEN")
}
}
maven { url "https://plugins.gradle.org/m2/"  }
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:3.1.8")
}
}

apply {
plugin 'groovy'
plugin 'io.spring.dependency-management'
plugin 'codenarc'
plugin 'org.springframework.boot'
}

//Upgrading log4j2 version to 2.19.0
ext['log4j2.version'] = '2.19.0'

def artifactoryUser = System.getenv("ARTIFACTORY_USER")
def artifactoryToken = System.getenv("ARTIFACTORY_TOKEN")
repositories {
maven {
url "https://tr1.jfrog.io/tr1/libs-release/"
credentials {
username artifactoryUser
password artifactoryToken
}
}
}

sourceCompatibility = '17'
targetCompatibility = '17'

configurations {
//https://stackoverflow.com/questions/32366586/using-log4j2-with-slf4j
all*.exclude group: 'org.apache.logging.log4j', module: 'log4j-to-slf4j'
all*.exclude module : 'spring-boot-starter-logging'
all*.exclude group: 'log4j', module: 'log4j'
all*.exclude group: 'org.codehaus.groovy', module:  '*'

qedTestImplementation.extendsFrom testImplementation
qedTestRuntimeOnly.extendsFrom testRuntimeOnly
intTestImplementation.extendsFrom testImplementation
intTestRuntimeOnly.extendsFrom testRuntimeOnly
}

dependencyManagement {
imports {
mavenBom 'software.amazon.awssdk:bom:2.20.15'
}
}

dependencies {
//Groovy
implementation 'org.apache.groovy:groovy-all:4.0.15'

//Spring Boot
implementation(
'org.springframework.boot:spring-boot-starter-validation',
'org.springframework.boot:spring-boot-autoconfigure',
'org.springframework.boot:spring-boot-starter-web',
'org.apache.tomcat.embed:tomcat-embed-core:10.1.19',
'org.springframework:spring-expression:6.0.8',
'org.springframework.boot:spring-boot-starter-actuator',
'org.springframework.boot:spring-boot-actuator-autoconfigure',
'org.springframework.boot:spring-boot-starter-security',
'org.springframework.security:spring-security-web',
'org.springframework.boot:spring-boot-starter-aop',
'org.springframework.boot:spring-boot-starter-cache',
'org.springframework:spring-context-support',
'org.springframework:spring-jms',
'jakarta.servlet:jakarta.servlet-api:6.0.0',
'org.springframework.retry:spring-retry:2.0.0'
)

// TR
implementation(
'com.tr.cars:cars-logging-java:2.1.1',
'com.tr.cars:cars-http-client-java:1.11.0',
'com.tr.cars:cars-aws-clients-java:1.15.0',
'io.netty:netty-codec-http2:4.1.108.Final',
'com.tr.gcs:gcs-http-logging-log4j2:17.0.1',
'com.tr.gcs:control-plane-client-java:0.2.1-RELEASE',
'com.tr.gcs:gcs-authorization:18.1.0-RELEASE',
'com.fasterxml.jackson.datatype:jackson-datatype-jsr310'
)

// External
implementation(
'com.squareup.okhttp3:okhttp:4.10.0',
'com.squareup.okio:okio:3.4.0',
'com.github.ben-manes.caffeine:caffeine:3.1.4',
'org.apache.commons:commons-lang3:3.12.0',
'jakarta.validation:jakarta.validation-api:3.0.2',
// JMS
'com.ibm.mq:com.ibm.mq.jakarta.client:9.3.5.0',
'org.bouncycastle:bcprov-jdk18on:1.78',
//AWS
'software.amazon.awssdk:s3',
'software.amazon.awssdk:sts',
'software.amazon.awssdk:sqs',
'software.amazon.awssdk:ssm',
'com.amazonaws:aws-java-sdk-stepfunctions:1.12.705',
'com.amazonaws:amazon-sqs-java-messaging-lib:2.1.0',
//jsch enabling sftp access
'com.jcraft:jsch:0.1.55',
//Logging with Log4j2
'org.springframework.boot:spring-boot-starter-log4j2',
'org.apache.logging.log4j:log4j-1.2-api',
// https://github.com/coveo/spring-boot-parameter-store-integration
'com.coveo:spring-boot-parameter-store-integration:2.0.0',
'org.springframework:spring-core:6.0.8',
'org.springframework:spring-web:6.0.8',
'org.springframework:spring-context:6.0.8'
)

//Swagger
implementation("org.springdoc:springdoc-openapi:2.1.0")
implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.1.0")
implementation('org.yaml:snakeyaml:2.0')

//Aspose
//    compile(group: 'com.tr.contentworkflowservice.aspose', name: 'aspose-words', version: '20.6', classifier: 'jdk17')
//    implementation(group: 'com.tr.contentworkflowservice.aspose', name: 'aspose-words', version: '20.6', classifier:  'jdk17')
//    implementation('com.aspose:aspose-pdf:19.7')

//Tests
testImplementation(
'org.springframework.boot:spring-boot-starter-test',
'net.minidev:json-smart:2.4.9',
'org.mockito:mockito-core:5.12.0',
'org.mockito:mockito-junit-jupiter:5.12.0',
'net.bytebuddy:byte-buddy:1.14.0',
'net.bytebuddy:byte-buddy-agent:1.14.0',
'org.objenesis:objenesis:3.3',
'org.junit.jupiter:junit-jupiter-api:5.9.2',
'org.junit.jupiter:junit-jupiter-params:5.9.2',
'org.junit.jupiter:junit-jupiter:5.9.2',
'org.assertj:assertj-core:3.24.2',
'xml-apis:xml-apis:2.0.2',
'org.apache.poi:poi-ooxml:5.2.4',
'org.apache.httpcomponents:httpclient:4.5.14',
'org.apache.httpcomponents:httpmime:4.5.14',
'com.amazonaws:aws-java-sdk-ssm:1.12.418',
'org.awaitility:awaitility-groovy:4.2.0',
'io.rest-assured:rest-assured:5.3.0',
'io.rest-assured:rest-assured-all:5.3.0',
'org.testcontainers:localstack:1.17.6',
'org.testcontainers:junit-jupiter:1.17.6',
'com.github.tomakehurst:wiremock-standalone:2.27.2',
'io.github.artsok:rerunner-jupiter:2.1.6'
)
testRuntimeOnly(
'org.junit.jupiter:junit-jupiter-engine:5.9.2',
'org.junit.platform:junit-platform-commons:1.9.2'
)
}

test {
useJUnitPlatform()
}

codenarc {
toolVersion = "3.2.0-groovy-4.0"
}

codenarcMain {
dependsOn(compileJava, compileGroovy)
ignoreFailures false
configFile file('codenarc/codenarc-main.rules')
reports {
text {
enabled = true
}
}

finalizedBy {
writeCodenarcMainFailures
}
}

sourceSets {
qedTest {
groovy {
srcDirs = ['src/qed/groovy']
compileClasspath += sourceSets.main.output + sourceSets.test.output
runtimeClasspath += sourceSets.main.output + sourceSets.test.output
}
resources.srcDir file('src/qed/resources')
}

intTest {
groovy {
srcDirs = ['src/integration-test/groovy']
compileClasspath += sourceSets.main.output
runtimeClasspath += sourceSets.main.output
}
resources {
srcDirs = ['src/main/resources', 'src/integration-test/resources']
}
}
}

task writeCodenarcMainFailures {
doLast {
println "****************************** CODE NARC MAIN ******************************"
File codeNarcFile = file("build/reports/codenarc/main.txt")
if (codeNarcFile.exists())
{
println codeNarcFile.getText()
}
else
{
println "No codenarc violations found in main code"
}
println "****************************** CODE NARC MAIN ******************************"
}
}

codenarcTest {
dependsOn(compileTestJava, compileTestGroovy)
ignoreFailures false
configFile file('codenarc/codenarc-test.rules')
reports {
text {
enabled = true
}
}
finalizedBy {
writeCodenarcTestFailures
}
}

codenarcIntTest {
dependsOn(compileTestJava,  compileTestGroovy)
ignoreFailures false
configFile file('codenarc/codenarc-test.rules')
reports {
text {
enabled = true
}
}
finalizedBy {
writeCodenarcIntTestFailures
}
}

task writeCodenarcIntTestFailures {
doLast {
println "****************************** CODE NARC TEST ******************************"
File codeNarcFile = file("build/reports/codenarc/intTest.txt")
if (codeNarcFile.exists())
{
println codeNarcFile.getText()
}
else
{
println "No codenarc violations found in integration test code"
}
println "****************************** CODE NARC TEST ******************************"
}
}

task writeCodenarcTestFailures {
doLast {
println "****************************** CODE NARC TEST ******************************"
File codeNarcFile = file("build/reports/codenarc/test.txt")
if (codeNarcFile.exists())
{
println codeNarcFile.getText()
}
else
{
println "No codenarc violations found in test code"
}
println "****************************** CODE NARC TEST ******************************"
}
}

codenarcQedTest {
dependsOn(compileQedTestJava, compileQedTestGroovy)
ignoreFailures false
configFile file('codenarc/codenarc-qed.rules')
reports {
text {
enabled = true
}
}
finalizedBy {
writeCodenarcQedTestFailures
}
}

task writeCodenarcQedTestFailures {
doLast {
println "****************************** CODE NARC QED TEST ******************************"
File codeNarcFile = file("build/reports/codenarc/qedTest.txt")
if (codeNarcFile.exists())
{
println codeNarcFile.getText()
}
else
{
println "No codenarc violations found in qed test code"
}
println "****************************** CODE NARC QED TEST ******************************"
}
}

task qedTest(type: Test) {
useJUnitPlatform()
systemProperties System.getProperties()
testClassesDirs = project.sourceSets.qedTest.output.classesDirs
classpath = sourceSets.qedTest.runtimeClasspath
testReportDirName = 'qedTest'
reports.html.enabled = true
outputs.upToDateWhen { false }
testLogging {
showStandardStreams true
events "failed"
exceptionFormat = 'full'
showCauses true
showStackTraces true
}
//turn on after multiple features testing is finished
//maxParallelForks(8)
finalizedBy {
codenarcQedTest
}
}

task qedTestJar(type: Jar) {
manifest {
attributes 'Implementation-Title' : 'Qed Test App',
'Implementation-Version': bootJar.version
}
classifier = 'qedTests'
from sourceSets.qedTest.output.classesDirs
from sourceSets.qedTest.resources
}

task integrationTest(type: Test) {
useJUnitPlatform()
description = 'Runs integration tests.'
group = 'verification'
testLogging {
showExceptions = true
exceptionFormat = 'full'
events = ['failed']
}
testClassesDirs = sourceSets.intTest.output.classesDirs
classpath = sourceSets.intTest.runtimeClasspath
shouldRunAfter test
}

check.dependsOn integrationTest
Это моя весна

Подробнее здесь: https://stackoverflow.com/questions/790 ... tion-depen
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение

Вернуться в «JAVA»