Skip to content

Commit be45787

Browse files
Merge branch 'master' into pr/720-tim-bootstrap-security
2 parents 63c6da7 + 412a93c commit be45787

502 files changed

Lines changed: 5334 additions & 2472 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎apache-cxf/cxf-introduction/pom.xml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
</parent>
1212
<properties>
1313
<cxf.version>3.1.6</cxf.version>
14+
<surefire.version>2.19.1</surefire.version>
1415
</properties>
1516
<build>
1617
<plugins>
@@ -26,7 +27,7 @@
2627
<version>2.19.1</version>
2728
<configuration>
2829
<excludes>
29-
<exclude>**/StudentTest.java</exclude>
30+
<exclude>**/*LiveTest.java</exclude>
3031
</excludes>
3132
</configuration>
3233
</plugin>
@@ -44,4 +45,5 @@
4445
<version>${cxf.version}</version>
4546
</dependency>
4647
</dependencies>
48+
4749
</project>

apache-cxf/cxf-introduction/src/test/java/com/baeldung/cxf/introduction/StudentTest.java renamed to apache-cxf/cxf-introduction/src/test/java/com/baeldung/cxf/introduction/StudentLiveTest.java

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,16 @@
22

33
import static org.junit.Assert.assertEquals;
44

5-
import org.junit.Before;
6-
import org.junit.Test;
7-
85
import java.util.Map;
96

107
import javax.xml.namespace.QName;
118
import javax.xml.ws.Service;
129
import javax.xml.ws.soap.SOAPBinding;
1310

14-
import com.baeldung.cxf.introduction.Baeldung;
15-
import com.baeldung.cxf.introduction.Student;
16-
import com.baeldung.cxf.introduction.StudentImpl;
11+
import org.junit.Before;
12+
import org.junit.Test;
1713

18-
public class StudentTest {
14+
public class StudentLiveTest {
1915
private static QName SERVICE_NAME = new QName("http://introduction.cxf.baeldung.com/", "Baeldung");
2016
private static QName PORT_NAME = new QName("http://introduction.cxf.baeldung.com/", "BaeldungPort");
2117

@@ -25,7 +21,7 @@ public class StudentTest {
2521

2622
{
2723
service = Service.create(SERVICE_NAME);
28-
String endpointAddress = "http://localhost:8080/baeldung";
24+
final String endpointAddress = "http://localhost:8080/baeldung";
2925
service.addPort(PORT_NAME, SOAPBinding.SOAP11HTTP_BINDING, endpointAddress);
3026
}
3127

@@ -37,28 +33,28 @@ public void reinstantiateBaeldungInstances() {
3733

3834
@Test
3935
public void whenUsingHelloMethod_thenCorrect() {
40-
String endpointResponse = baeldungProxy.hello("Baeldung");
41-
String localResponse = baeldungImpl.hello("Baeldung");
36+
final String endpointResponse = baeldungProxy.hello("Baeldung");
37+
final String localResponse = baeldungImpl.hello("Baeldung");
4238
assertEquals(localResponse, endpointResponse);
4339
}
4440

4541
@Test
4642
public void whenUsingHelloStudentMethod_thenCorrect() {
47-
Student student = new StudentImpl("John Doe");
48-
String endpointResponse = baeldungProxy.helloStudent(student);
49-
String localResponse = baeldungImpl.helloStudent(student);
43+
final Student student = new StudentImpl("John Doe");
44+
final String endpointResponse = baeldungProxy.helloStudent(student);
45+
final String localResponse = baeldungImpl.helloStudent(student);
5046
assertEquals(localResponse, endpointResponse);
5147
}
5248

5349
@Test
5450
public void usingGetStudentsMethod_thenCorrect() {
55-
Student student1 = new StudentImpl("Adam");
51+
final Student student1 = new StudentImpl("Adam");
5652
baeldungProxy.helloStudent(student1);
5753

58-
Student student2 = new StudentImpl("Eve");
54+
final Student student2 = new StudentImpl("Eve");
5955
baeldungProxy.helloStudent(student2);
60-
61-
Map<Integer, Student> students = baeldungProxy.getStudents();
56+
57+
final Map<Integer, Student> students = baeldungProxy.getStudents();
6258
assertEquals("Adam", students.get(1).getName());
6359
assertEquals("Eve", students.get(2).getName());
6460
}

‎apache-cxf/cxf-jaxrs-implementation/pom.xml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1414
<cxf.version>3.1.7</cxf.version>
1515
<httpclient.version>4.5.2</httpclient.version>
16+
<surefire.version>2.19.1</surefire.version>
1617
</properties>
1718
<build>
1819
<plugins>
@@ -28,7 +29,7 @@
2829
<version>2.19.1</version>
2930
<configuration>
3031
<excludes>
31-
<exclude>**/ServiceTest</exclude>
32+
<exclude>**/*LiveTest.java</exclude>
3233
</excludes>
3334
</configuration>
3435
</plugin>

apache-cxf/cxf-jaxrs-implementation/src/main/java/com/baeldung/cxf/jaxrs/implementation/Baeldung.java renamed to apache-cxf/cxf-jaxrs-implementation/src/main/java/com/baeldung/cxf/jaxrs/implementation/CourseRepository.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
@Path("baeldung")
1111
@Produces("text/xml")
12-
public class Baeldung {
12+
public class CourseRepository {
1313
private Map<Integer, Course> courses = new HashMap<>();
1414

1515
{
@@ -69,4 +69,4 @@ private Course findById(int id) {
6969
}
7070
return null;
7171
}
72-
}
72+
}

‎apache-cxf/cxf-jaxrs-implementation/src/main/java/com/baeldung/cxf/jaxrs/implementation/RestfulServer.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
public class RestfulServer {
88
public static void main(String args[]) throws Exception {
99
JAXRSServerFactoryBean factoryBean = new JAXRSServerFactoryBean();
10-
factoryBean.setResourceClasses(Baeldung.class);
11-
factoryBean.setResourceProvider(new SingletonResourceProvider(new Baeldung()));
10+
factoryBean.setResourceClasses(CourseRepository.class);
11+
factoryBean.setResourceProvider(new SingletonResourceProvider(new CourseRepository()));
1212
factoryBean.setAddress("http://localhost:8080/");
1313
Server server = factoryBean.create();
1414

@@ -18,4 +18,4 @@ public static void main(String args[]) throws Exception {
1818
server.destroy();
1919
System.exit(0);
2020
}
21-
}
21+
}

apache-cxf/cxf-jaxrs-implementation/src/test/java/com/baeldung/cxf/jaxrs/implementation/ServiceTest.java renamed to apache-cxf/cxf-jaxrs-implementation/src/test/java/com/baeldung/cxf/jaxrs/implementation/ServiceLiveTest.java

Lines changed: 53 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
package com.baeldung.cxf.jaxrs.implementation;
22

3+
import static org.junit.Assert.assertEquals;
4+
5+
import java.io.IOException;
6+
import java.io.InputStream;
7+
import java.io.InputStreamReader;
8+
import java.net.URL;
9+
10+
import javax.xml.bind.JAXB;
11+
312
import org.apache.http.HttpResponse;
413
import org.apache.http.client.methods.HttpDelete;
514
import org.apache.http.client.methods.HttpPost;
@@ -11,119 +20,111 @@
1120
import org.junit.BeforeClass;
1221
import org.junit.Test;
1322

14-
import javax.xml.bind.JAXB;
15-
import java.io.IOException;
16-
import java.io.InputStream;
17-
import java.io.InputStreamReader;
18-
import java.net.URL;
19-
20-
import static org.junit.Assert.assertEquals;
21-
22-
public class ServiceTest {
23+
public class ServiceLiveTest {
2324
private static final String BASE_URL = "http://localhost:8080/baeldung/courses/";
2425
private static CloseableHttpClient client;
25-
26+
2627
@BeforeClass
2728
public static void createClient() {
2829
client = HttpClients.createDefault();
2930
}
30-
31+
3132
@AfterClass
3233
public static void closeClient() throws IOException {
3334
client.close();
3435
}
35-
36+
3637
@Test
3738
public void whenUpdateNonExistentCourse_thenReceiveNotFoundResponse() throws IOException {
38-
HttpPut httpPut = new HttpPut(BASE_URL + "3");
39-
InputStream resourceStream = this.getClass().getClassLoader().getResourceAsStream("non_existent_course.xml");
39+
final HttpPut httpPut = new HttpPut(BASE_URL + "3");
40+
final InputStream resourceStream = this.getClass().getClassLoader().getResourceAsStream("non_existent_course.xml");
4041
httpPut.setEntity(new InputStreamEntity(resourceStream));
4142
httpPut.setHeader("Content-Type", "text/xml");
42-
43-
HttpResponse response = client.execute(httpPut);
43+
44+
final HttpResponse response = client.execute(httpPut);
4445
assertEquals(404, response.getStatusLine().getStatusCode());
4546
}
46-
47+
4748
@Test
4849
public void whenUpdateUnchangedCourse_thenReceiveNotModifiedResponse() throws IOException {
49-
HttpPut httpPut = new HttpPut(BASE_URL + "1");
50-
InputStream resourceStream = this.getClass().getClassLoader().getResourceAsStream("unchanged_course.xml");
50+
final HttpPut httpPut = new HttpPut(BASE_URL + "1");
51+
final InputStream resourceStream = this.getClass().getClassLoader().getResourceAsStream("unchanged_course.xml");
5152
httpPut.setEntity(new InputStreamEntity(resourceStream));
5253
httpPut.setHeader("Content-Type", "text/xml");
53-
54-
HttpResponse response = client.execute(httpPut);
54+
55+
final HttpResponse response = client.execute(httpPut);
5556
assertEquals(304, response.getStatusLine().getStatusCode());
5657
}
57-
58+
5859
@Test
5960
public void whenUpdateValidCourse_thenReceiveOKResponse() throws IOException {
60-
HttpPut httpPut = new HttpPut(BASE_URL + "2");
61-
InputStream resourceStream = this.getClass().getClassLoader().getResourceAsStream("changed_course.xml");
61+
final HttpPut httpPut = new HttpPut(BASE_URL + "2");
62+
final InputStream resourceStream = this.getClass().getClassLoader().getResourceAsStream("changed_course.xml");
6263
httpPut.setEntity(new InputStreamEntity(resourceStream));
6364
httpPut.setHeader("Content-Type", "text/xml");
64-
65-
HttpResponse response = client.execute(httpPut);
65+
66+
final HttpResponse response = client.execute(httpPut);
6667
assertEquals(200, response.getStatusLine().getStatusCode());
67-
68-
Course course = getCourse(2);
68+
69+
final Course course = getCourse(2);
6970
assertEquals(2, course.getId());
7071
assertEquals("Apache CXF Support for RESTful", course.getName());
7172
}
72-
73+
7374
@Test
7475
public void whenCreateConflictStudent_thenReceiveConflictResponse() throws IOException {
75-
HttpPost httpPost = new HttpPost(BASE_URL + "1/students");
76-
InputStream resourceStream = this.getClass().getClassLoader().getResourceAsStream("conflict_student.xml");
76+
final HttpPost httpPost = new HttpPost(BASE_URL + "1/students");
77+
final InputStream resourceStream = this.getClass().getClassLoader().getResourceAsStream("conflict_student.xml");
7778
httpPost.setEntity(new InputStreamEntity(resourceStream));
7879
httpPost.setHeader("Content-Type", "text/xml");
79-
80-
HttpResponse response = client.execute(httpPost);
80+
81+
final HttpResponse response = client.execute(httpPost);
8182
assertEquals(409, response.getStatusLine().getStatusCode());
8283
}
8384

8485
@Test
8586
public void whenCreateValidStudent_thenReceiveOKResponse() throws IOException {
86-
HttpPost httpPost = new HttpPost(BASE_URL + "2/students");
87-
InputStream resourceStream = this.getClass().getClassLoader().getResourceAsStream("created_student.xml");
87+
final HttpPost httpPost = new HttpPost(BASE_URL + "2/students");
88+
final InputStream resourceStream = this.getClass().getClassLoader().getResourceAsStream("created_student.xml");
8889
httpPost.setEntity(new InputStreamEntity(resourceStream));
8990
httpPost.setHeader("Content-Type", "text/xml");
90-
91-
HttpResponse response = client.execute(httpPost);
91+
92+
final HttpResponse response = client.execute(httpPost);
9293
assertEquals(200, response.getStatusLine().getStatusCode());
93-
94-
Student student = getStudent(2, 3);
94+
95+
final Student student = getStudent(2, 3);
9596
assertEquals(3, student.getId());
9697
assertEquals("Student C", student.getName());
9798
}
98-
99+
99100
@Test
100101
public void whenDeleteInvalidStudent_thenReceiveNotFoundResponse() throws IOException {
101-
HttpDelete httpDelete = new HttpDelete(BASE_URL + "1/students/3");
102-
HttpResponse response = client.execute(httpDelete);
102+
final HttpDelete httpDelete = new HttpDelete(BASE_URL + "1/students/3");
103+
final HttpResponse response = client.execute(httpDelete);
103104
assertEquals(404, response.getStatusLine().getStatusCode());
104-
}
105-
105+
}
106+
106107
@Test
107108
public void whenDeleteValidStudent_thenReceiveOKResponse() throws IOException {
108-
HttpDelete httpDelete = new HttpDelete(BASE_URL + "1/students/1");
109-
HttpResponse response = client.execute(httpDelete);
109+
final HttpDelete httpDelete = new HttpDelete(BASE_URL + "1/students/1");
110+
final HttpResponse response = client.execute(httpDelete);
110111
assertEquals(200, response.getStatusLine().getStatusCode());
111-
112-
Course course = getCourse(1);
112+
113+
final Course course = getCourse(1);
113114
assertEquals(1, course.getStudents().size());
114115
assertEquals(2, course.getStudents().get(0).getId());
115116
assertEquals("Student B", course.getStudents().get(0).getName());
116117
}
117118

118119
private Course getCourse(int courseOrder) throws IOException {
119-
URL url = new URL(BASE_URL + courseOrder);
120-
InputStream input = url.openStream();
120+
final URL url = new URL(BASE_URL + courseOrder);
121+
final InputStream input = url.openStream();
121122
return JAXB.unmarshal(new InputStreamReader(input), Course.class);
122123
}
123124

124125
private Student getStudent(int courseOrder, int studentOrder) throws IOException {
125-
URL url = new URL(BASE_URL + courseOrder + "/students/" + studentOrder);
126-
InputStream input = url.openStream();
126+
final URL url = new URL(BASE_URL + courseOrder + "/students/" + studentOrder);
127+
final InputStream input = url.openStream();
127128
return JAXB.unmarshal(new InputStreamReader(input), Student.class);
128129
}
129130
}

‎apache-cxf/cxf-spring/pom.xml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
<version>${surefire.version}</version>
5252
<configuration>
5353
<excludes>
54-
<exclude>StudentTest.java</exclude>
54+
<exclude>**/*LiveTest.java</exclude>
5555
</excludes>
5656
</configuration>
5757
</plugin>
@@ -60,7 +60,7 @@
6060

6161
<profiles>
6262
<profile>
63-
<id>integration</id>
63+
<id>live</id>
6464
<build>
6565
<plugins>
6666
<plugin>

apache-cxf/cxf-spring/src/test/java/com/baeldung/cxf/spring/StudentTest.java renamed to apache-cxf/cxf-spring/src/test/java/com/baeldung/cxf/spring/StudentLiveTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import org.springframework.context.ApplicationContext;
77
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
88

9-
public class StudentTest {
9+
public class StudentLiveTest {
1010
private ApplicationContext context = new AnnotationConfigApplicationContext(ClientConfiguration.class);
1111
private Baeldung baeldungProxy = (Baeldung) context.getBean("client");
1212

File renamed without changes.

0 commit comments

Comments
 (0)