JAVA-20617 Migrated spring-soap to JDK 17 (#14413)
This commit is contained in:
parent
420305fe3b
commit
93988220ea
4
pom.xml
4
pom.xml
|
@ -427,7 +427,6 @@
|
||||||
<!-- <module>spring-roo</module> --> <!-- Not supported JAVA-17327 -->
|
<!-- <module>spring-roo</module> --> <!-- Not supported JAVA-17327 -->
|
||||||
|
|
||||||
<module>spring-security-modules/spring-security-ldap</module>
|
<module>spring-security-modules/spring-security-ldap</module>
|
||||||
<module>spring-soap</module>
|
|
||||||
<module>spring-swagger-codegen</module>
|
<module>spring-swagger-codegen</module>
|
||||||
<module>video-tutorials</module>
|
<module>video-tutorials</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
@ -594,7 +593,6 @@
|
||||||
<!-- <module>spring-roo</module> --> <!-- Not supported JAVA-17327 -->
|
<!-- <module>spring-roo</module> --> <!-- Not supported JAVA-17327 -->
|
||||||
|
|
||||||
<module>spring-security-modules/spring-security-ldap</module>
|
<module>spring-security-modules/spring-security-ldap</module>
|
||||||
<module>spring-soap</module>
|
|
||||||
<module>spring-swagger-codegen</module>
|
<module>spring-swagger-codegen</module>
|
||||||
<module>video-tutorials</module>
|
<module>video-tutorials</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
@ -908,6 +906,7 @@
|
||||||
<module>spring-kafka</module>
|
<module>spring-kafka</module>
|
||||||
|
|
||||||
<module>spring-native</module>
|
<module>spring-native</module>
|
||||||
|
<module>spring-soap</module>
|
||||||
<module>spring-security-modules</module>
|
<module>spring-security-modules</module>
|
||||||
<module>spring-protobuf</module>
|
<module>spring-protobuf</module>
|
||||||
<module>spring-quartz</module>
|
<module>spring-quartz</module>
|
||||||
|
@ -1180,6 +1179,7 @@
|
||||||
<module>spring-kafka</module>
|
<module>spring-kafka</module>
|
||||||
|
|
||||||
<module>spring-native</module>
|
<module>spring-native</module>
|
||||||
|
<module>spring-soap</module>
|
||||||
<module>spring-security-modules</module>
|
<module>spring-security-modules</module>
|
||||||
<module>spring-protobuf</module>
|
<module>spring-protobuf</module>
|
||||||
<module>spring-quartz</module>
|
<module>spring-quartz</module>
|
||||||
|
|
|
@ -1,2 +1,4 @@
|
||||||
/target/
|
/target/
|
||||||
sun-jaxb.episode
|
sun-jaxb.episode
|
||||||
|
|
||||||
|
**/gen/**
|
|
@ -30,6 +30,22 @@
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>jakarta.xml.bind</groupId>
|
||||||
|
<artifactId>jakarta.xml.bind-api</artifactId>
|
||||||
|
<version>4.0.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.glassfish.jaxb</groupId>
|
||||||
|
<artifactId>jaxb-runtime</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.xml.bind</groupId>
|
||||||
|
<artifactId>jaxb-api</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
@ -42,7 +58,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
<artifactId>jaxb2-maven-plugin</artifactId>
|
<artifactId>jaxb2-maven-plugin</artifactId>
|
||||||
<version>1.6</version>
|
<version>3.1.0</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<id>xjc</id>
|
<id>xjc</id>
|
||||||
|
@ -52,8 +68,10 @@
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
<configuration>
|
<configuration>
|
||||||
<schemaDirectory>${project.basedir}/src/main/resources/</schemaDirectory>
|
<sources>
|
||||||
<outputDirectory>${project.basedir}/src/main/java</outputDirectory>
|
<source>src/main/resources/countries.xsd</source>
|
||||||
|
</sources>
|
||||||
|
<outputDirectory>src/main/java</outputDirectory>
|
||||||
<clearOutputDir>false</clearOutputDir>
|
<clearOutputDir>false</clearOutputDir>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
@ -61,7 +79,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.jvnet.jaxb2.maven2</groupId>
|
<groupId>org.jvnet.jaxb2.maven2</groupId>
|
||||||
<artifactId>maven-jaxb2-plugin</artifactId>
|
<artifactId>maven-jaxb2-plugin</artifactId>
|
||||||
<version>0.14.0</version>
|
<version>0.15.3</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<goals>
|
<goals>
|
||||||
|
@ -83,4 +101,7 @@
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<java.version>17</java.version>
|
||||||
|
</properties>
|
||||||
</project>
|
</project>
|
|
@ -1,12 +1,14 @@
|
||||||
package com.baeldung.springsoap;
|
package com.baeldung.springsoap;
|
||||||
|
|
||||||
import com.baeldung.springsoap.gen.*;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.ws.server.endpoint.annotation.Endpoint;
|
import org.springframework.ws.server.endpoint.annotation.Endpoint;
|
||||||
import org.springframework.ws.server.endpoint.annotation.PayloadRoot;
|
import org.springframework.ws.server.endpoint.annotation.PayloadRoot;
|
||||||
import org.springframework.ws.server.endpoint.annotation.RequestPayload;
|
import org.springframework.ws.server.endpoint.annotation.RequestPayload;
|
||||||
import org.springframework.ws.server.endpoint.annotation.ResponsePayload;
|
import org.springframework.ws.server.endpoint.annotation.ResponsePayload;
|
||||||
|
|
||||||
|
import com.baeldung.springsoap.client.gen.GetCountryRequest;
|
||||||
|
import com.baeldung.springsoap.client.gen.GetCountryResponse;
|
||||||
|
|
||||||
@Endpoint
|
@Endpoint
|
||||||
public class CountryEndpoint {
|
public class CountryEndpoint {
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,15 @@
|
||||||
package com.baeldung.springsoap;
|
package com.baeldung.springsoap;
|
||||||
|
|
||||||
import com.baeldung.springsoap.gen.*;
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import com.baeldung.springsoap.client.gen.Country;
|
||||||
import java.util.HashMap;
|
import com.baeldung.springsoap.client.gen.Currency;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class CountryRepository {
|
public class CountryRepository {
|
||||||
|
|
|
@ -17,11 +17,11 @@ import org.springframework.xml.xsd.XsdSchema;
|
||||||
public class WebServiceConfig extends WsConfigurerAdapter {
|
public class WebServiceConfig extends WsConfigurerAdapter {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public ServletRegistrationBean messageDispatcherServlet(ApplicationContext applicationContext) {
|
public ServletRegistrationBean<MessageDispatcherServlet> messageDispatcherServlet(ApplicationContext applicationContext) {
|
||||||
MessageDispatcherServlet servlet = new MessageDispatcherServlet();
|
MessageDispatcherServlet servlet = new MessageDispatcherServlet();
|
||||||
servlet.setApplicationContext(applicationContext);
|
servlet.setApplicationContext(applicationContext);
|
||||||
servlet.setTransformWsdlLocations(true);
|
servlet.setTransformWsdlLocations(true);
|
||||||
return new ServletRegistrationBean(servlet, "/ws/*");
|
return new ServletRegistrationBean<>(servlet, "/ws/*");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean(name = "countries")
|
@Bean(name = "countries")
|
||||||
|
|
|
@ -1,139 +0,0 @@
|
||||||
|
|
||||||
package com.baeldung.springsoap.client.gen;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
|
||||||
import javax.xml.bind.annotation.XmlSchemaType;
|
|
||||||
import javax.xml.bind.annotation.XmlType;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>Java class for country complex type.
|
|
||||||
*
|
|
||||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
* <complexType name="country">
|
|
||||||
* <complexContent>
|
|
||||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
|
||||||
* <sequence>
|
|
||||||
* <element name="name" type="{http://www.w3.org/2001/XMLSchema}string"/>
|
|
||||||
* <element name="population" type="{http://www.w3.org/2001/XMLSchema}int"/>
|
|
||||||
* <element name="capital" type="{http://www.w3.org/2001/XMLSchema}string"/>
|
|
||||||
* <element name="currency" type="{http://www.baeldung.com/springsoap/gen}currency"/>
|
|
||||||
* </sequence>
|
|
||||||
* </restriction>
|
|
||||||
* </complexContent>
|
|
||||||
* </complexType>
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
|
||||||
@XmlType(name = "country", propOrder = {
|
|
||||||
"name",
|
|
||||||
"population",
|
|
||||||
"capital",
|
|
||||||
"currency"
|
|
||||||
})
|
|
||||||
public class Country {
|
|
||||||
|
|
||||||
@XmlElement(required = true)
|
|
||||||
protected String name;
|
|
||||||
protected int population;
|
|
||||||
@XmlElement(required = true)
|
|
||||||
protected String capital;
|
|
||||||
@XmlElement(required = true)
|
|
||||||
@XmlSchemaType(name = "string")
|
|
||||||
protected Currency currency;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the value of the name property.
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
* possible object is
|
|
||||||
* {@link String }
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the value of the name property.
|
|
||||||
*
|
|
||||||
* @param value
|
|
||||||
* allowed object is
|
|
||||||
* {@link String }
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public void setName(String value) {
|
|
||||||
this.name = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the value of the population property.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public int getPopulation() {
|
|
||||||
return population;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the value of the population property.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public void setPopulation(int value) {
|
|
||||||
this.population = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the value of the capital property.
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
* possible object is
|
|
||||||
* {@link String }
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public String getCapital() {
|
|
||||||
return capital;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the value of the capital property.
|
|
||||||
*
|
|
||||||
* @param value
|
|
||||||
* allowed object is
|
|
||||||
* {@link String }
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public void setCapital(String value) {
|
|
||||||
this.capital = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the value of the currency property.
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
* possible object is
|
|
||||||
* {@link Currency }
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public Currency getCurrency() {
|
|
||||||
return currency;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the value of the currency property.
|
|
||||||
*
|
|
||||||
* @param value
|
|
||||||
* allowed object is
|
|
||||||
* {@link Currency }
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public void setCurrency(Currency value) {
|
|
||||||
this.currency = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,40 +0,0 @@
|
||||||
|
|
||||||
package com.baeldung.springsoap.client.gen;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlEnum;
|
|
||||||
import javax.xml.bind.annotation.XmlType;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>Java class for currency.
|
|
||||||
*
|
|
||||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
|
||||||
* <p>
|
|
||||||
* <pre>
|
|
||||||
* <simpleType name="currency">
|
|
||||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
|
|
||||||
* <enumeration value="GBP"/>
|
|
||||||
* <enumeration value="EUR"/>
|
|
||||||
* <enumeration value="PLN"/>
|
|
||||||
* </restriction>
|
|
||||||
* </simpleType>
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@XmlType(name = "currency")
|
|
||||||
@XmlEnum
|
|
||||||
public enum Currency {
|
|
||||||
|
|
||||||
GBP,
|
|
||||||
EUR,
|
|
||||||
PLN;
|
|
||||||
|
|
||||||
public String value() {
|
|
||||||
return name();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Currency fromValue(String v) {
|
|
||||||
return valueOf(v);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,64 +0,0 @@
|
||||||
|
|
||||||
package com.baeldung.springsoap.client.gen;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
|
||||||
import javax.xml.bind.annotation.XmlType;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>Java class for anonymous complex type.
|
|
||||||
*
|
|
||||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
* <complexType>
|
|
||||||
* <complexContent>
|
|
||||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
|
||||||
* <sequence>
|
|
||||||
* <element name="name" type="{http://www.w3.org/2001/XMLSchema}string"/>
|
|
||||||
* </sequence>
|
|
||||||
* </restriction>
|
|
||||||
* </complexContent>
|
|
||||||
* </complexType>
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
|
||||||
@XmlType(name = "", propOrder = {
|
|
||||||
"name"
|
|
||||||
})
|
|
||||||
@XmlRootElement(name = "getCountryRequest")
|
|
||||||
public class GetCountryRequest {
|
|
||||||
|
|
||||||
@XmlElement(required = true)
|
|
||||||
protected String name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the value of the name property.
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
* possible object is
|
|
||||||
* {@link String }
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the value of the name property.
|
|
||||||
*
|
|
||||||
* @param value
|
|
||||||
* allowed object is
|
|
||||||
* {@link String }
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public void setName(String value) {
|
|
||||||
this.name = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,64 +0,0 @@
|
||||||
|
|
||||||
package com.baeldung.springsoap.client.gen;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
|
||||||
import javax.xml.bind.annotation.XmlType;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>Java class for anonymous complex type.
|
|
||||||
*
|
|
||||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
* <complexType>
|
|
||||||
* <complexContent>
|
|
||||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
|
||||||
* <sequence>
|
|
||||||
* <element name="country" type="{http://www.baeldung.com/springsoap/gen}country"/>
|
|
||||||
* </sequence>
|
|
||||||
* </restriction>
|
|
||||||
* </complexContent>
|
|
||||||
* </complexType>
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
|
||||||
@XmlType(name = "", propOrder = {
|
|
||||||
"country"
|
|
||||||
})
|
|
||||||
@XmlRootElement(name = "getCountryResponse")
|
|
||||||
public class GetCountryResponse {
|
|
||||||
|
|
||||||
@XmlElement(required = true)
|
|
||||||
protected Country country;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the value of the country property.
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
* possible object is
|
|
||||||
* {@link Country }
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public Country getCountry() {
|
|
||||||
return country;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the value of the country property.
|
|
||||||
*
|
|
||||||
* @param value
|
|
||||||
* allowed object is
|
|
||||||
* {@link Country }
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public void setCountry(Country value) {
|
|
||||||
this.country = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,56 +0,0 @@
|
||||||
|
|
||||||
package com.baeldung.springsoap.client.gen;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlRegistry;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This object contains factory methods for each
|
|
||||||
* Java content interface and Java element interface
|
|
||||||
* generated in the com.baeldung.springsoap.client.gen package.
|
|
||||||
* <p>An ObjectFactory allows you to programatically
|
|
||||||
* construct new instances of the Java representation
|
|
||||||
* for XML content. The Java representation of XML
|
|
||||||
* content can consist of schema derived interfaces
|
|
||||||
* and classes representing the binding of schema
|
|
||||||
* type definitions, element declarations and model
|
|
||||||
* groups. Factory methods for each of these are
|
|
||||||
* provided in this class.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@XmlRegistry
|
|
||||||
public class ObjectFactory {
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.baeldung.springsoap.client.gen
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public ObjectFactory() {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create an instance of {@link GetCountryRequest }
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public GetCountryRequest createGetCountryRequest() {
|
|
||||||
return new GetCountryRequest();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create an instance of {@link GetCountryResponse }
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public GetCountryResponse createGetCountryResponse() {
|
|
||||||
return new GetCountryResponse();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create an instance of {@link Country }
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public Country createCountry() {
|
|
||||||
return new Country();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,2 +0,0 @@
|
||||||
@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.baeldung.com/springsoap/gen", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
|
|
||||||
package com.baeldung.springsoap.client.gen;
|
|
|
@ -1,18 +1,19 @@
|
||||||
package com.baeldung.springsoap;
|
package com.baeldung.springsoap;
|
||||||
|
|
||||||
import com.baeldung.springsoap.gen.GetCountryRequest;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
|
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
|
||||||
import org.springframework.boot.web.server.LocalServerPort;
|
import org.springframework.boot.test.web.server.LocalServerPort;
|
||||||
import org.springframework.oxm.jaxb.Jaxb2Marshaller;
|
import org.springframework.oxm.jaxb.Jaxb2Marshaller;
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
import org.springframework.util.ClassUtils;
|
import org.springframework.util.ClassUtils;
|
||||||
import org.springframework.ws.client.core.WebServiceTemplate;
|
import org.springframework.ws.client.core.WebServiceTemplate;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import com.baeldung.springsoap.client.gen.GetCountryRequest;
|
||||||
|
|
||||||
@RunWith(SpringRunner.class)
|
@RunWith(SpringRunner.class)
|
||||||
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
|
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
|
||||||
|
@ -20,7 +21,8 @@ public class ApplicationIntegrationTest {
|
||||||
|
|
||||||
private Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
|
private Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
|
||||||
|
|
||||||
@LocalServerPort private int port = 0;
|
@LocalServerPort
|
||||||
|
private int port = 0;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void init() throws Exception {
|
public void init() throws Exception {
|
||||||
|
@ -34,6 +36,8 @@ public class ApplicationIntegrationTest {
|
||||||
GetCountryRequest request = new GetCountryRequest();
|
GetCountryRequest request = new GetCountryRequest();
|
||||||
request.setName("Spain");
|
request.setName("Spain");
|
||||||
|
|
||||||
assertThat(ws.marshalSendAndReceive("http://localhost:" + port + "/ws", request)).isNotNull();
|
Object response = ws.marshalSendAndReceive("http://localhost:" + port + "/ws", request);
|
||||||
|
|
||||||
|
assertThat(response).isNotNull();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue