-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First Version of working Auto Endpoint configuration based on WebServ…
…iceAutoDetection.
- Loading branch information
1 parent
21c147f
commit 3b3135e
Showing
7 changed files
with
181 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
src/test/java/de/codecentric/cxf/endpoint/WeatherServiceEndpointIntegrationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package de.codecentric.cxf.endpoint; | ||
|
||
|
||
import de.codecentric.cxf.TestApplication; | ||
import de.codecentric.cxf.common.BootStarterCxfException; | ||
import de.codecentric.cxf.common.XmlUtils; | ||
import de.codecentric.namespace.weatherservice.WeatherException; | ||
import de.codecentric.namespace.weatherservice.WeatherService; | ||
import de.codecentric.namespace.weatherservice.general.ForecastReturn; | ||
import de.codecentric.namespace.weatherservice.general.GetCityForecastByZIP; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.core.io.Resource; | ||
import org.springframework.test.context.junit4.SpringRunner; | ||
|
||
import java.io.IOException; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertNotNull; | ||
|
||
@RunWith(SpringRunner.class) | ||
@SpringBootTest( | ||
classes = TestApplication.class, | ||
webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT, | ||
properties = { "server.port:8087" } | ||
) | ||
public class WeatherServiceEndpointIntegrationTest { | ||
|
||
@Autowired | ||
private WeatherService weatherServiceClient; | ||
|
||
@Value(value="classpath:requests/GetCityForecastByZIPTest.xml") | ||
private Resource GetCityForecastByZIPTestXml; | ||
|
||
@Test | ||
public void isEndpointCorrectlyAutoDetectedAndConfigured() throws WeatherException, BootStarterCxfException, IOException { | ||
// Given | ||
GetCityForecastByZIP getCityForecastByZIP = XmlUtils.readSoapMessageFromStreamAndUnmarshallBody2Object( | ||
GetCityForecastByZIPTestXml.getInputStream(), GetCityForecastByZIP.class); | ||
|
||
// When | ||
ForecastReturn forecastReturn = weatherServiceClient.getCityForecastByZIP(getCityForecastByZIP.getForecastRequest()); | ||
|
||
// Then | ||
assertNotNull(forecastReturn); | ||
assertEquals("Weimar", forecastReturn.getCity()); | ||
assertEquals("22%", forecastReturn.getForecastResult().getForecast().get(0).getProbabilityOfPrecipiation().getDaytime()); | ||
} | ||
} |