New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specifying a DomXmlMessageValidator as validator deactivates XPath validations #385

Closed
oweise opened this Issue May 14, 2018 · 0 comments

Comments

Projects
None yet
3 participants
@oweise

oweise commented May 14, 2018

When specifying a DomXmlMessageValidator on a HTTP REST Server reveive then subsequent XPath validations are no longer executed, or at least do not influence the outcoming of the test.

Demo test with Citrus 2.7.5:

@ContextConfiguration(classes= ValidatorBugDemoTest.CitrusConfig.class)
public class ValidatorBugDemoTest extends JUnit4CitrusTest {

    @Configuration
    public static class CitrusConfig {

        @Bean(name="wsClient")
        public HttpClient wsClient() {
            return CitrusEndpoints.http()
                    .client()
                    .requestUrl("http://localhost:8080")
                    .build();
        }

        @Bean(name="wsServer")
        public HttpServer backendEndpoint() {
            return CitrusEndpoints.http()
                    .server()
                    .port(8080)
                    .autoStart(true)
                    .build();
        }
    }

    @Test
    @CitrusTest
    public void test(@CitrusResource TestRunner testRunner) {

        testRunner.http(action -> {
            action.client("wsClient")
                    .send()
                    .post("/")
                    .contentType("application/xml")
                    .payload("<doc text=\"hello\"/>")
                    .fork(true);
        });

        testRunner.http(action -> {
            action.server("wsServer")
                    .receive()
                    .post("/")
                    .contentType("application/xml")
                    .validator(new DomXmlMessageValidator())
                    .validate("/doc/@test", "nothello");
        });
    }
}

This test should fail bc. /doc/@test in sent XML is "hello" , not "nothello".

@svettwer svettwer added this to the SOMEDAY milestone May 14, 2018

@christophd christophd modified the milestones: SOMEDAY, 2.7.6 May 22, 2018

@christophd christophd removed the READY label Jun 13, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment