citrusframework / citrusframework/citrus-simulator
Getting 404 on Request mapping with Request method.GET
- Dominant language
- Java
- Stars
- 47
- Forks
- 45
- Avg merge
- 4d 10h
- Merged PRs (30d)
- 7
Description
After migrating to latest citrus dependency, all my request mapping are giving 404.
pom.xml:-
[](
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
)
Config:-
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);
}
}
Scenario class:-
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"));
}
}
Application.properties:-
spring.application.name=demo
#spring.datasource.url=jdbc:mysql://localhost:3370/catalogdb?useSSL=false
#spring.datasource.username=root
#spring.datasource.password=password
#spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
# Hibernate properties
#spring.jpa.hibernate.ddl-auto=update
#spring.jpa.show-sql=true
#spring.jpa.database-platform=org.hibernate.dialect.MySQL8Dialect
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
# Enable Http REST support
citrus.simulator.rest.enabled=true
citrus.simulator.ws.enabled=true
citrus.simulator.ws.servlet.mapping=/services/ws/*
# Default timeout setting
citrus.simulator.default.timeout=120000
citrus.simulator.defaultTimeout=120000
# Default message template path
citrus.simulator.templatePath=templates
# Default scenario name
citrus.simulator.defaultScenario=Default
# Should Citrus validate incoming messages on syntax and semantics
citrus.simulator.templateValidation=true
management.endpoints.web.exposure.include=*
It gives 404 after upgrading to latest citrus framework and java 17.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with pom.xml and the DemoApplication, TestClass, and application.properties shown in the report. Reproduce the GET request while inspecting the enabled Spring Web and Citrus debug logs; done means the @RequestMapping scenario resolves successfully instead of returning 404 after the dependency upgrade.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring-boot
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100