Skip to content

Commit 0776285

Browse files
committed
modify spring-boot-testing
1 parent f0cd666 commit 0776285

20 files changed

Lines changed: 557 additions & 10 deletions

File tree

JavaTMP-SpringBoot-Modules/spring-boot-web/spring-boot-war/src/main/java/com/javatmp/demo/war/HelloController.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
@RestController
77
public class HelloController {
88

9-
@RequestMapping("/")
9+
@RequestMapping({"", "/"})
1010
public String index() {
1111
return "Hello Spring Boot 2.0!";
1212
}
13+
1314
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.javatmp.demo.war;
2+
3+
import lombok.extern.slf4j.Slf4j;
4+
import org.springframework.stereotype.Controller;
5+
import org.springframework.web.bind.annotation.GetMapping;
6+
7+
@Slf4j
8+
@Controller
9+
public class IndexController {
10+
11+
@GetMapping("page.html")
12+
public String index() {
13+
log.info("page requested Controller");
14+
return "/page.html";
15+
}
16+
17+
}

JavaTMP-SpringBoot-Modules/spring-boot-web/spring-boot-war/src/main/java/com/javatmp/demo/war/ServletInitializer.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55

66

77
public class ServletInitializer extends SpringBootServletInitializer {
8+
89
@Override
910
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
1011
return application.sources(DemoApplication.class);
1112
}
13+
1214
}
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
server:
22
port: 8080
33
servlet:
4-
context-path: /demo
4+
context-path: /demo
5+
6+
spring:
7+
mvc:
8+
view:
9+
prefix: ""
10+
suffix: ""
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Context path="/"/>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<!doctype html>
2+
<html dir="ltr" lang="en">
3+
<head>
4+
<title>Welcome To Spring Boot War Template</title>
5+
<!-- Required meta tags -->
6+
<meta charset="utf-8">
7+
<meta content="IE=edge" http-equiv="X-UA-Compatible"/>
8+
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
9+
<meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport">
10+
<link href="" rel="stylesheet" type="text/css"/>
11+
</head>
12+
<body>
13+
<div>
14+
<h1>Welcome To Spring Boot War Template</h1>
15+
</div>
16+
<script src="" type="text/javascript"></script>
17+
<script type="text/javascript">
18+
</script>
19+
</body>
20+
</html>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<!doctype html>
2+
<html dir="ltr" lang="en">
3+
<head>
4+
<title>Welcome To Spring Boot War Template</title>
5+
<!-- Required meta tags -->
6+
<meta charset="utf-8">
7+
<meta content="IE=edge" http-equiv="X-UA-Compatible"/>
8+
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
9+
<meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport">
10+
<link href="" rel="stylesheet" type="text/css"/>
11+
</head>
12+
<body>
13+
<div>
14+
<h1>Welcome To Spring Boot War Template</h1>
15+
</div>
16+
<script src="" type="text/javascript"></script>
17+
<script type="text/javascript">
18+
</script>
19+
</body>
20+
</html>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
2+
package com.blog.demo.service;
3+
4+
import javax.jws.WebMethod;
5+
import javax.jws.WebParam;
6+
import javax.jws.WebResult;
7+
import javax.jws.WebService;
8+
import javax.jws.soap.SOAPBinding;
9+
import javax.xml.bind.annotation.XmlSeeAlso;
10+
import com.blog.demo.webservices.accountservice.AccountDetailsRequest;
11+
import com.blog.demo.webservices.accountservice.AccountDetailsResponse;
12+
import com.blog.demo.webservices.accountservice.ObjectFactory;
13+
14+
15+
/**
16+
* This class was generated by the JAX-WS RI.
17+
* JAX-WS RI 2.1.4-b01-
18+
* Generated source version: 2.1
19+
*
20+
*/
21+
@WebService(name = "AccountService", targetNamespace = "http://www.briansdevblog.com/Accounts/")
22+
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
23+
@XmlSeeAlso({
24+
ObjectFactory.class
25+
})
26+
public interface AccountService {
27+
28+
29+
/**
30+
*
31+
* @param parameters
32+
* @return
33+
* returns com.blog.demo.webservices.accountservice.AccountDetailsResponse
34+
*/
35+
@WebMethod(operationName = "GetAccountDetails", action = "http://www.briansjavablog.com/Accounts/GetAccountDetails")
36+
@WebResult(name = "AccountDetailsResponse", targetNamespace = "http://com/blog/demo/webservices/accountservice", partName = "parameters")
37+
public AccountDetailsResponse getAccountDetails(
38+
@WebParam(name = "AccountDetailsRequest", targetNamespace = "http://com/blog/demo/webservices/accountservice", partName = "parameters")
39+
AccountDetailsRequest parameters);
40+
41+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
2+
package com.blog.demo.service;
3+
4+
import java.net.MalformedURLException;
5+
import java.net.URL;
6+
import java.util.logging.Logger;
7+
import javax.xml.namespace.QName;
8+
import javax.xml.ws.Service;
9+
import javax.xml.ws.WebEndpoint;
10+
import javax.xml.ws.WebServiceClient;
11+
import javax.xml.ws.WebServiceFeature;
12+
13+
14+
/**
15+
* This class was generated by the JAX-WS RI.
16+
* JAX-WS RI 2.1.4-b01-
17+
* Generated source version: 2.1
18+
*
19+
*/
20+
@WebServiceClient(name = "AccountServiceEndpointService", targetNamespace = "http://service.demo.blog.com/", wsdlLocation = "classpath:META-INF\\wsdl\\accounts.wsdl")
21+
public class AccountServiceEndpointService
22+
extends Service
23+
{
24+
25+
private final static URL ACCOUNTSERVICEENDPOINTSERVICE_WSDL_LOCATION;
26+
private final static Logger logger = Logger.getLogger(com.blog.demo.service.AccountServiceEndpointService.class.getName());
27+
28+
static {
29+
URL url = null;
30+
try {
31+
URL baseUrl;
32+
baseUrl = com.blog.demo.service.AccountServiceEndpointService.class.getResource(".");
33+
url = new URL(baseUrl, "classpath:META-INF\\wsdl\\accounts.wsdl");
34+
} catch (MalformedURLException e) {
35+
logger.warning("Failed to create URL for the wsdl Location: 'classpath:META-INF\\wsdl\\accounts.wsdl', retrying as a local file");
36+
logger.warning(e.getMessage());
37+
}
38+
ACCOUNTSERVICEENDPOINTSERVICE_WSDL_LOCATION = url;
39+
}
40+
41+
public AccountServiceEndpointService(URL wsdlLocation, QName serviceName) {
42+
super(wsdlLocation, serviceName);
43+
}
44+
45+
public AccountServiceEndpointService() {
46+
super(ACCOUNTSERVICEENDPOINTSERVICE_WSDL_LOCATION, new QName("http://service.demo.blog.com/", "AccountServiceEndpointService"));
47+
}
48+
49+
/**
50+
*
51+
* @return
52+
* returns AccountService
53+
*/
54+
@WebEndpoint(name = "AccountServiceEndpointPort")
55+
public AccountService getAccountServiceEndpointPort() {
56+
return super.getPort(new QName("http://service.demo.blog.com/", "AccountServiceEndpointPort"), AccountService.class);
57+
}
58+
59+
/**
60+
*
61+
* @param features
62+
* A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the <code>features</code> parameter will have their default values.
63+
* @return
64+
* returns AccountService
65+
*/
66+
@WebEndpoint(name = "AccountServiceEndpointPort")
67+
public AccountService getAccountServiceEndpointPort(WebServiceFeature... features) {
68+
return super.getPort(new QName("http://service.demo.blog.com/", "AccountServiceEndpointPort"), AccountService.class, features);
69+
}
70+
71+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
2+
package com.blog.demo.webservices.accountservice;
3+
4+
import javax.xml.bind.annotation.XmlAccessType;
5+
import javax.xml.bind.annotation.XmlAccessorType;
6+
import javax.xml.bind.annotation.XmlElement;
7+
import javax.xml.bind.annotation.XmlType;
8+
9+
10+
/**
11+
* <p>Java class for Account complex type.
12+
*
13+
* <p>The following schema fragment specifies the expected content contained within this class.
14+
*
15+
* <pre>
16+
* &lt;complexType name="Account">
17+
* &lt;complexContent>
18+
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
19+
* &lt;sequence>
20+
* &lt;element name="AccountNumber" type="{http://www.w3.org/2001/XMLSchema}string"/>
21+
* &lt;element name="AccountName" type="{http://www.w3.org/2001/XMLSchema}string"/>
22+
* &lt;element name="AccountBalance" type="{http://www.w3.org/2001/XMLSchema}double"/>
23+
* &lt;element name="AccountStatus" type="{http://www.w3.org/2001/XMLSchema}string"/>
24+
* &lt;/sequence>
25+
* &lt;/restriction>
26+
* &lt;/complexContent>
27+
* &lt;/complexType>
28+
* </pre>
29+
*
30+
*
31+
*/
32+
@XmlAccessorType(XmlAccessType.FIELD)
33+
@XmlType(name = "Account", propOrder = {
34+
"accountNumber",
35+
"accountName",
36+
"accountBalance",
37+
"accountStatus"
38+
})
39+
public class Account {
40+
41+
@XmlElement(name = "AccountNumber", required = true)
42+
protected String accountNumber;
43+
@XmlElement(name = "AccountName", required = true)
44+
protected String accountName;
45+
@XmlElement(name = "AccountBalance")
46+
protected double accountBalance;
47+
@XmlElement(name = "AccountStatus", required = true)
48+
protected String accountStatus;
49+
50+
/**
51+
* Gets the value of the accountNumber property.
52+
*
53+
* @return
54+
* possible object is
55+
* {@link String }
56+
*
57+
*/
58+
public String getAccountNumber() {
59+
return accountNumber;
60+
}
61+
62+
/**
63+
* Sets the value of the accountNumber property.
64+
*
65+
* @param value
66+
* allowed object is
67+
* {@link String }
68+
*
69+
*/
70+
public void setAccountNumber(String value) {
71+
this.accountNumber = value;
72+
}
73+
74+
/**
75+
* Gets the value of the accountName property.
76+
*
77+
* @return
78+
* possible object is
79+
* {@link String }
80+
*
81+
*/
82+
public String getAccountName() {
83+
return accountName;
84+
}
85+
86+
/**
87+
* Sets the value of the accountName property.
88+
*
89+
* @param value
90+
* allowed object is
91+
* {@link String }
92+
*
93+
*/
94+
public void setAccountName(String value) {
95+
this.accountName = value;
96+
}
97+
98+
/**
99+
* Gets the value of the accountBalance property.
100+
*
101+
*/
102+
public double getAccountBalance() {
103+
return accountBalance;
104+
}
105+
106+
/**
107+
* Sets the value of the accountBalance property.
108+
*
109+
*/
110+
public void setAccountBalance(double value) {
111+
this.accountBalance = value;
112+
}
113+
114+
/**
115+
* Gets the value of the accountStatus property.
116+
*
117+
* @return
118+
* possible object is
119+
* {@link String }
120+
*
121+
*/
122+
public String getAccountStatus() {
123+
return accountStatus;
124+
}
125+
126+
/**
127+
* Sets the value of the accountStatus property.
128+
*
129+
* @param value
130+
* allowed object is
131+
* {@link String }
132+
*
133+
*/
134+
public void setAccountStatus(String value) {
135+
this.accountStatus = value;
136+
}
137+
138+
}

0 commit comments

Comments
 (0)