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

Overwriting TestContext in AbstractServer #221

Closed
ahoeing opened this Issue Mar 10, 2017 · 0 comments

Comments

Projects
None yet
2 participants
@ahoeing

ahoeing commented Mar 10, 2017

During my test execution, I got to following debug and I started to investigate why.

ver.WebServiceServer| Unable to create test context factory from Spring application context - using minimal test context factory

The Debug occus when executing the following line that creates a new SOAP Server:
CitrusEndpoints.soap().server().port(wsPort).timeout(defaultEndpointTimeout).applicationContext(applicationContext).build();

In AbstractServer line 102 ff

 if(this.testContextFactory == null && this.beanFactory != null) {
        this.testContextFactory = (TestContextFactory)this.beanFactory.getBean(TestContextFactory.class);
      } else {
        this.log.warn("Unable to create test context factory from Spring application context - using minimal test context factory");
        this.testContextFactory = new TestContextFactory();
      }

In my case both, testContextFactory and beanFactory exist, so the code executes the else statements and overwriting my testContextFactory.

My assumption is, that code should look like

if (this.testContextFactory == null) {
 if(this.beanFactory != null) {
        this.testContextFactory = (TestContextFactory)this.beanFactory.getBean(TestContextFactory.class);
      } else {
        this.log.warn("Unable to create test context factory from Spring application context - using minimal test context factory");
        this.testContextFactory = new TestContextFactory();
      }
} 

So if testContextFactory exist, no new one is created

@christophd christophd added this to the v2.7.1 milestone Mar 12, 2017

@christophd christophd closed this Mar 12, 2017

@christophd christophd removed the READY label Mar 12, 2017

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