Программисты JAVA общаются здесь
Anonymous
404 с цитрусовыми 3.0
Сообщение
Anonymous » 31 янв 2025, 13:24
После перехода на последнюю зависимость цитрусовых, все мои отображения запросов дают 404.
пом.xml:-
Код: Выделить всё
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
org.springframework.boot
spring-boot-starter-parent
3.3.2
com.example
your-artifact-id
1.0.0-SNAPSHOT
demo
Demo project for Spring Boot
17
3.3.2
3.0.2
org.springframework.boot
spring-boot-starter-web
org.springframework.boot
spring-boot-starter
org.glassfish.jersey.core
jersey-client
org.glassfish.jersey.core
jersey-common
org.glassfish.jersey.inject
jersey-hk2
2.26
org.citrusframework
citrus-simulator
3.0.2
pom
org.citrusframework
citrus-simulator-starter
2.1.1
jakarta.xml.soap
jakarta.xml.soap-api
3.0.2
org.springframework.boot
spring-boot-starter-actuator
org.codehaus.groovy
groovy
2.5.23
org.springframework.boot
spring-boot-maven-plugin
< /code>
config:-< /p>
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.citrusframework.simulator.http.HttpRequestAnnotationScenarioMapper;
import org.citrusframework.simulator.http.HttpRequestPathScenarioMapper;
import org.citrusframework.simulator.http.SimulatorRestAdapter;
import org.citrusframework.simulator.http.SimulatorRestConfigurationProperties;
import org.citrusframework.simulator.scenario.mapper.ContentBasedXPathScenarioMapper;
import org.citrusframework.simulator.scenario.mapper.ScenarioMapper;
import org.citrusframework.simulator.scenario.mapper.ScenarioMappers;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.http.HttpStatus;
import com.consol.citrus.endpoint.EndpointAdapter;
import com.consol.citrus.endpoint.adapter.StaticEndpointAdapter;
import com.consol.citrus.http.message.HttpMessage;
import com.consol.citrus.message.Message;
import jakarta.xml.soap.MessageFactory;
@SpringBootApplication(exclude = SecurityAutoConfiguration.class)
@componentscan(basePackages = {"com.example.demo.*"})
public class DemoApplication extends SimulatorRestAdapter {
@Override
public String urlMapping(SimulatorRestConfigurationProperties simulatorRestConfiguration) {
return "**";
}
@Override
public EndpointAdapter fallbackEndpointAdapter() {
return new StaticEndpointAdapter() {
@Override
protected Message handleMessageInternal(Message message) {
return new HttpMessage().status(HttpStatus.INTERNAL_SERVER_ERROR);
}
};
}
// Note these run on all requests in order, so avoid collisions!
@Override
public ScenarioMapper scenarioMapper() {
return ScenarioMappers.of(new ContentBasedXPathScenarioMapper().addXPathExpression("//:request-id"),
new HttpRequestPathScenarioMapper(), new HttpRequestAnnotationScenarioMapper());
}
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
< /code>
Сценарий класс:-< /p>
package com.example.demo.controller;
import org.citrusframework.simulator.scenario.AbstractSimulatorScenario;
import org.citrusframework.simulator.scenario.Scenario;
import org.citrusframework.simulator.scenario.ScenarioDesigner;
import org.springframework.core.io.ClassPathResource;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@Scenario("GetCircuit")
@RequestMapping(value = "/sim/accessMigration/v1/inventory/circuits/BBEC.000099..ATI", method = RequestMethod.GET)
public class TestClass extends AbstractSimulatorScenario {
@Override
public void run(ScenarioDesigner scenario) {
scenario.http().receive().get();
scenario.http().send().response(HttpStatus.OK).header("ContentType", "application/json")
.payload(new ClassPathResource("datamanager/GetCircuit.json"));
}
}
< /code>
[b] application.properties[/b]:-
spring.application.name=demo
spring.jackson.serialization.FAIL_ON_EMPTY_BEANS=false
logging.level.org.springframework.web=DEBUG
logging.level.org.citrusframework=DEBUG
info.simulator.name=REST Simulator
logging.file=debug.log
logging.level.com.consol.citrus=DEBUG
logging.level.com.att.mso=DEBUG
logging.level.org.reflections.Reflections=ERROR
< /code>
включить Http Rest Support < /p>
citrus.simulator.rest.enabled=true
citrus.simulator.ws.enabled=true
citrus.simulator.ws.servlet.mapping=/services/ws/*
< /code>
Настройка тайм -аута по умолчанию < /p>
citrus.simulator.default.timeout=120000
citrus.simulator.defaultTimeout=120000
< /code>
Путь шаблона сообщений по умолчанию < /p>
citrus.simulator.templatePath=templates
< /code>
Имя сценария по умолчанию < /p>
citrus.simulator.defaultScenario=Default
< /code>
Должен ли цитрусовые подтвердить входящие сообщения на синтаксисе и семантике < /p>
citrus.simulator.templateValidation=true
management.endpoints.web.exposure.include=*
дает 404 после обновления до последних цитрусовых платформ и Java 17.
Подробнее здесь:
https://stackoverflow.com/questions/794 ... citrus-3-0
1738319092
Anonymous
После перехода на последнюю зависимость цитрусовых, все мои отображения запросов дают 404. пом.xml:- [code] xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.springframework.boot spring-boot-starter-parent 3.3.2 com.example your-artifact-id 1.0.0-SNAPSHOT demo Demo project for Spring Boot 17 3.3.2 3.0.2 org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter org.glassfish.jersey.core jersey-client org.glassfish.jersey.core jersey-common org.glassfish.jersey.inject jersey-hk2 2.26 org.citrusframework citrus-simulator 3.0.2 pom org.citrusframework citrus-simulator-starter 2.1.1 jakarta.xml.soap jakarta.xml.soap-api 3.0.2 org.springframework.boot spring-boot-starter-actuator org.codehaus.groovy groovy 2.5.23 org.springframework.boot spring-boot-maven-plugin < /code> config:-< /p> import java.util.Arrays; import java.util.Collections; import java.util.List; import org.citrusframework.simulator.http.HttpRequestAnnotationScenarioMapper; import org.citrusframework.simulator.http.HttpRequestPathScenarioMapper; import org.citrusframework.simulator.http.SimulatorRestAdapter; import org.citrusframework.simulator.http.SimulatorRestConfigurationProperties; import org.citrusframework.simulator.scenario.mapper.ContentBasedXPathScenarioMapper; import org.citrusframework.simulator.scenario.mapper.ScenarioMapper; import org.citrusframework.simulator.scenario.mapper.ScenarioMappers; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.http.HttpStatus; import com.consol.citrus.endpoint.EndpointAdapter; import com.consol.citrus.endpoint.adapter.StaticEndpointAdapter; import com.consol.citrus.http.message.HttpMessage; import com.consol.citrus.message.Message; import jakarta.xml.soap.MessageFactory; @SpringBootApplication(exclude = SecurityAutoConfiguration.class) @componentscan(basePackages = {"com.example.demo.*"}) public class DemoApplication extends SimulatorRestAdapter { @Override public String urlMapping(SimulatorRestConfigurationProperties simulatorRestConfiguration) { return "**"; } @Override public EndpointAdapter fallbackEndpointAdapter() { return new StaticEndpointAdapter() { @Override protected Message handleMessageInternal(Message message) { return new HttpMessage().status(HttpStatus.INTERNAL_SERVER_ERROR); } }; } // Note these run on all requests in order, so avoid collisions! @Override public ScenarioMapper scenarioMapper() { return ScenarioMappers.of(new ContentBasedXPathScenarioMapper().addXPathExpression("//:request-id"), new HttpRequestPathScenarioMapper(), new HttpRequestAnnotationScenarioMapper()); } public static void main(String[] args) { SpringApplication.run(DemoApplication.class, args); } } < /code> Сценарий класс:-< /p> package com.example.demo.controller; import org.citrusframework.simulator.scenario.AbstractSimulatorScenario; import org.citrusframework.simulator.scenario.Scenario; import org.citrusframework.simulator.scenario.ScenarioDesigner; import org.springframework.core.io.ClassPathResource; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @Scenario("GetCircuit") @RequestMapping(value = "/sim/accessMigration/v1/inventory/circuits/BBEC.000099..ATI", method = RequestMethod.GET) public class TestClass extends AbstractSimulatorScenario { @Override public void run(ScenarioDesigner scenario) { scenario.http().receive().get(); scenario.http().send().response(HttpStatus.OK).header("ContentType", "application/json") .payload(new ClassPathResource("datamanager/GetCircuit.json")); } } < /code> [b] application.properties[/b]:- spring.application.name=demo spring.jackson.serialization.FAIL_ON_EMPTY_BEANS=false logging.level.org.springframework.web=DEBUG logging.level.org.citrusframework=DEBUG info.simulator.name=REST Simulator logging.file=debug.log logging.level.com.consol.citrus=DEBUG logging.level.com.att.mso=DEBUG logging.level.org.reflections.Reflections=ERROR < /code> включить Http Rest Support < /p> citrus.simulator.rest.enabled=true citrus.simulator.ws.enabled=true citrus.simulator.ws.servlet.mapping=/services/ws/* < /code> Настройка тайм -аута по умолчанию < /p> citrus.simulator.default.timeout=120000 citrus.simulator.defaultTimeout=120000 < /code> Путь шаблона сообщений по умолчанию < /p> citrus.simulator.templatePath=templates < /code> Имя сценария по умолчанию < /p> citrus.simulator.defaultScenario=Default < /code> Должен ли цитрусовые подтвердить входящие сообщения на синтаксисе и семантике < /p> citrus.simulator.templateValidation=true management.endpoints.web.exposure.include=* [/code] дает 404 после обновления до последних цитрусовых платформ и Java 17. Подробнее здесь: [url]https://stackoverflow.com/questions/79402433/404-with-citrus-3-0[/url]