Skip to content

Commit 06999f4

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 429d60e + 58da486 commit 06999f4

26 files changed

Lines changed: 223 additions & 159 deletions

File tree

‎.travis.yml‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
language: java
2+
3+
install: travis_wait 40 mvn -q clean install
4+
5+
jdk:
6+
- oraclejdk8
7+
8+
sudo: false
9+
addons:
10+
apt:
11+
packages:
12+
- oracle-java8-installer
13+
14+
cache:
15+
directories:
16+
- .autoconf
17+
- $HOME/.m2

‎spring-boot/src/main/java/org/baeldung/controller/GenericEntityController.java‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ public GenericEntity findByEnum(@PathVariable("mode") Modes mode) {
5454

5555
@GetMapping("/entity/findbyversion")
5656
public ResponseEntity findByVersion(@Version String version) {
57-
return version != null
58-
? new ResponseEntity(entityList.stream().findFirst().get(), HttpStatus.OK)
59-
: new ResponseEntity(HttpStatus.NOT_FOUND);
57+
return version != null ? new ResponseEntity(entityList.stream().findFirst().get(), HttpStatus.OK) : new ResponseEntity(HttpStatus.NOT_FOUND);
6058
}
6159
}

spring-boot/src/test/java/com/baeldung/annotation/servletcomponentscan/JavaEEAppTest.java renamed to spring-boot/src/test/java/com/baeldung/annotation/servletcomponentscan/JavaEEAppIntegrationTest.java

Lines changed: 29 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
package com.baeldung.annotation.servletcomponentscan;
22

3-
import com.baeldung.annotation.servletcomponentscan.javaee.AttrListener;
4-
import com.baeldung.annotation.servletcomponentscan.javaee.EchoServlet;
5-
import com.baeldung.annotation.servletcomponentscan.javaee.HelloFilter;
6-
import com.baeldung.annotation.servletcomponentscan.javaee.HelloServlet;
7-
import org.jboss.arquillian.container.test.api.Deployment;
8-
import org.jboss.arquillian.container.test.api.RunAsClient;
9-
import org.jboss.arquillian.junit.Arquillian;
10-
import org.jboss.arquillian.test.api.ArquillianResource;
11-
import org.jboss.shrinkwrap.api.ShrinkWrap;
12-
import org.jboss.shrinkwrap.api.spec.WebArchive;
13-
import org.junit.Test;
14-
import org.junit.runner.RunWith;
3+
import static org.junit.Assert.assertEquals;
4+
import static org.junit.Assert.assertNotNull;
5+
import static org.junit.Assert.assertTrue;
6+
7+
import java.net.MalformedURLException;
8+
import java.net.URI;
9+
import java.net.URL;
1510

1611
import javax.inject.Inject;
1712
import javax.servlet.FilterRegistration;
@@ -22,24 +17,31 @@
2217
import javax.ws.rs.client.WebTarget;
2318
import javax.ws.rs.core.MediaType;
2419
import javax.ws.rs.core.Response;
25-
import java.net.MalformedURLException;
26-
import java.net.URI;
27-
import java.net.URL;
2820

29-
import static org.junit.Assert.*;
21+
import org.jboss.arquillian.container.test.api.Deployment;
22+
import org.jboss.arquillian.container.test.api.RunAsClient;
23+
import org.jboss.arquillian.junit.Arquillian;
24+
import org.jboss.arquillian.test.api.ArquillianResource;
25+
import org.jboss.shrinkwrap.api.ShrinkWrap;
26+
import org.jboss.shrinkwrap.api.spec.WebArchive;
27+
import org.junit.Test;
28+
import org.junit.runner.RunWith;
29+
30+
import com.baeldung.annotation.servletcomponentscan.javaee.AttrListener;
31+
import com.baeldung.annotation.servletcomponentscan.javaee.EchoServlet;
32+
import com.baeldung.annotation.servletcomponentscan.javaee.HelloFilter;
33+
import com.baeldung.annotation.servletcomponentscan.javaee.HelloServlet;
3034

3135
@RunWith(Arquillian.class)
32-
public class JavaEEAppTest {
36+
public class JavaEEAppIntegrationTest {
3337

3438
@Deployment
3539
public static WebArchive createDeployment() {
36-
return ShrinkWrap
37-
.create(WebArchive.class)
38-
.addClass(JavaEEApp.class)
39-
.addClasses(AttrListener.class, HelloFilter.class, HelloServlet.class, EchoServlet.class);
40+
return ShrinkWrap.create(WebArchive.class).addClass(JavaEEApp.class).addClasses(AttrListener.class, HelloFilter.class, HelloServlet.class, EchoServlet.class);
4041
}
4142

42-
@Inject private ServletContext servletContext;
43+
@Inject
44+
private ServletContext servletContext;
4345

4446
@Test
4547
public void givenServletContextListener_whenAccessSpecialAttrs_thenFound() throws MalformedURLException {
@@ -54,21 +56,18 @@ public void givenServletContext_whenCheckHelloFilterMappings_thenCorrect() throw
5456
FilterRegistration filterRegistration = servletContext.getFilterRegistration("hello filter");
5557

5658
assertNotNull(filterRegistration);
57-
assertTrue(filterRegistration
58-
.getServletNameMappings()
59-
.contains("echo servlet"));
59+
assertTrue(filterRegistration.getServletNameMappings().contains("echo servlet"));
6060
}
6161

62-
@ArquillianResource private URL base;
62+
@ArquillianResource
63+
private URL base;
6364

6465
@Test
6566
@RunAsClient
6667
public void givenFilterAndServlet_whenGetHello_thenRespondFilteringHello() throws MalformedURLException {
6768
Client client = ClientBuilder.newClient();
6869
WebTarget target = client.target(URI.create(new URL(base, "hello").toExternalForm()));
69-
Response response = target
70-
.request()
71-
.get();
70+
Response response = target.request().get();
7271

7372
assertEquals("filtering hello", response.readEntity(String.class));
7473
}
@@ -78,9 +77,7 @@ public void givenFilterAndServlet_whenGetHello_thenRespondFilteringHello() throw
7877
public void givenFilterAndServlet_whenPostEcho_thenEchoFiltered() throws MalformedURLException {
7978
Client client = ClientBuilder.newClient();
8079
WebTarget target = client.target(URI.create(new URL(base, "echo").toExternalForm()));
81-
Response response = target
82-
.request()
83-
.post(Entity.entity("echo", MediaType.TEXT_PLAIN_TYPE));
80+
Response response = target.request().post(Entity.entity("echo", MediaType.TEXT_PLAIN_TYPE));
8481

8582
assertEquals("filtering echo", response.readEntity(String.class));
8683
}

spring-boot/src/test/java/com/baeldung/annotation/servletcomponentscan/SpringBootWithServletComponentTest.java renamed to spring-boot/src/test/java/com/baeldung/annotation/servletcomponentscan/SpringBootWithServletComponentIntegrationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = SpringBootAnnotatedApp.class)
2121
@AutoConfigureMockMvc
2222
@TestPropertySource(properties = { "security.basic.enabled=false", "server.tomcat.additional-tld-skip-patterns=tomee-*.jar,tomcat-*.jar,openejb-*.jar,cxf-*.jar,activemq-*.jar" })
23-
public class SpringBootWithServletComponentTest {
23+
public class SpringBootWithServletComponentIntegrationTest {
2424

2525
@Autowired private ServletContext servletContext;
2626

spring-boot/src/test/java/com/baeldung/annotation/servletcomponentscan/SpringBootWithoutServletComponentTest.java renamed to spring-boot/src/test/java/com/baeldung/annotation/servletcomponentscan/SpringBootWithoutServletComponentIntegrationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = SpringBootPlainApp.class)
2121
@AutoConfigureMockMvc
2222
@TestPropertySource(properties = { "security.basic.enabled=false", "server.tomcat.additional-tld-skip-patterns=tomee-*.jar,tomcat-*.jar,openejb-*.jar,cxf-*.jar,activemq-*.jar" })
23-
public class SpringBootWithoutServletComponentTest {
23+
public class SpringBootWithoutServletComponentIntegrationTest {
2424

2525
@Autowired private ServletContext servletContext;
2626

‎spring-boot/src/test/java/org/baeldung/SpringBootApplicationIntegrationTest.java‎

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,29 +45,22 @@ public void givenRequestHasBeenMade_whenMeetsAllOfGivenConditions_thenCorrect()
4545
public void givenRequestHasBeenMade_whenMeetsFindByDateOfGivenConditions_thenCorrect() throws Exception {
4646
MediaType contentType = new MediaType(MediaType.APPLICATION_JSON.getType(), MediaType.APPLICATION_JSON.getSubtype(), Charset.forName("utf8"));
4747

48-
mockMvc.perform(MockMvcRequestBuilders.get("/entity/findbydate/{date}", "2011-12-03T10:15:30"))
49-
.andExpect(MockMvcResultMatchers.status().isOk())
50-
.andExpect(MockMvcResultMatchers.content().contentType(contentType))
51-
.andExpect(jsonPath("$.id", equalTo(1)));
48+
mockMvc.perform(MockMvcRequestBuilders.get("/entity/findbydate/{date}", "2011-12-03T10:15:30")).andExpect(MockMvcResultMatchers.status().isOk()).andExpect(MockMvcResultMatchers.content().contentType(contentType))
49+
.andExpect(jsonPath("$.id", equalTo(1)));
5250
}
5351

5452
@Test
5553
public void givenRequestHasBeenMade_whenMeetsFindByModeOfGivenConditions_thenCorrect() throws Exception {
5654
MediaType contentType = new MediaType(MediaType.APPLICATION_JSON.getType(), MediaType.APPLICATION_JSON.getSubtype(), Charset.forName("utf8"));
5755

58-
mockMvc.perform(MockMvcRequestBuilders.get("/entity/findbymode/{mode}", Modes.ALPHA.name()))
59-
.andExpect(MockMvcResultMatchers.status().isOk())
60-
.andExpect(MockMvcResultMatchers.content().contentType(contentType))
61-
.andExpect(jsonPath("$.id", equalTo(1)));
56+
mockMvc.perform(MockMvcRequestBuilders.get("/entity/findbymode/{mode}", Modes.ALPHA.name())).andExpect(MockMvcResultMatchers.status().isOk()).andExpect(MockMvcResultMatchers.content().contentType(contentType)).andExpect(jsonPath("$.id", equalTo(1)));
6257
}
6358

6459
@Test
6560
public void givenRequestHasBeenMade_whenMeetsFindByVersionOfGivenConditions_thenCorrect() throws Exception {
6661
MediaType contentType = new MediaType(MediaType.APPLICATION_JSON.getType(), MediaType.APPLICATION_JSON.getSubtype(), Charset.forName("utf8"));
6762

68-
mockMvc.perform(MockMvcRequestBuilders.get("/entity/findbyversion").header("Version", "1.0.0"))
69-
.andExpect(MockMvcResultMatchers.status().isOk())
70-
.andExpect(MockMvcResultMatchers.content().contentType(contentType))
71-
.andExpect(jsonPath("$.id", equalTo(1)));
63+
mockMvc.perform(MockMvcRequestBuilders.get("/entity/findbyversion").header("Version", "1.0.0")).andExpect(MockMvcResultMatchers.status().isOk()).andExpect(MockMvcResultMatchers.content().contentType(contentType))
64+
.andExpect(jsonPath("$.id", equalTo(1)));
7265
}
7366
}

‎spring-data-dynamodb/src/test/java/com/baeldung/spring/data/dynamodb/repository/ProductInfoRepositoryIntegrationTest.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ public class ProductInfoRepositoryIntegrationTest {
4444
private static final String EXPECTED_PRICE = "50";
4545

4646
@Before
47-
@Ignore //TODO Remove Ignore annotations when running locally with Local DynamoDB instance
48-
public void setup() throws Exception {
47+
@Ignore // TODO Remove Ignore annotations when running locally with Local DynamoDB instance
48+
public void setup() throws Exception {
4949

5050
try {
5151
dynamoDBMapper = new DynamoDBMapper(amazonDynamoDB);
@@ -64,7 +64,7 @@ public void setup() throws Exception {
6464
}
6565

6666
@Test
67-
@Ignore //TODO Remove Ignore annotations when running locally with Local DynamoDB instance
67+
@Ignore // TODO Remove Ignore annotations when running locally with Local DynamoDB instance
6868
public void givenItemWithExpectedCost_whenRunFindAll_thenItemIsFound() {
6969

7070
ProductInfo productInfo = new ProductInfo(EXPECTED_COST, EXPECTED_PRICE);

‎spring-mvc-forms/pom.xml‎

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -47,22 +47,6 @@
4747
<version>${fileupload.version}</version>
4848
</dependency>
4949

50-
<dependency>
51-
<groupId>org.springframework.security</groupId>
52-
<artifactId>spring-security-web</artifactId>
53-
<version>${org.springframework.security.version}</version>
54-
</dependency>
55-
<dependency>
56-
<groupId>org.springframework.security</groupId>
57-
<artifactId>spring-security-config</artifactId>
58-
<version>${org.springframework.security.version}</version>
59-
</dependency>
60-
<dependency>
61-
<groupId>org.springframework.security</groupId>
62-
<artifactId>spring-security-taglibs</artifactId>
63-
<version>${org.springframework.security.version}</version>
64-
</dependency>
65-
6650
</dependencies>
6751
<profiles>
6852
<!-- Local -->
@@ -115,7 +99,6 @@
11599
<hibernate-validator.version>5.3.3.Final</hibernate-validator.version>
116100
<deploy-path>enter-location-of-server</deploy-path>
117101
<fileupload.version>1.3.2</fileupload.version>
118-
<org.springframework.security.version>4.2.1.RELEASE</org.springframework.security.version>
119102
</properties>
120103

121104
</project>

‎spring-mvc-forms/src/main/java/com/baeldung/springmvcforms/configuration/WebInitializer.java‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import org.springframework.web.WebApplicationInitializer;
44
import org.springframework.web.context.ContextLoaderListener;
55
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
6-
import org.springframework.web.filter.DelegatingFilterProxy;
76
import org.springframework.web.servlet.DispatcherServlet;
87

98
import javax.servlet.ServletContext;
@@ -25,9 +24,7 @@ public void onStartup(ServletContext container) throws ServletException {
2524

2625
servlet.setLoadOnStartup(1);
2726
servlet.addMapping("/");
28-
29-
container.addFilter("springSecurityFilterChain", new DelegatingFilterProxy("springSecurityFilterChain"))
30-
.addMappingForUrlPatterns(null, false, "/*");
27+
3128
}
3229
// @Override
3330
// public void onStartup(ServletContext container) {

‎spring-mvc-forms/src/main/webapp/WEB-INF/views/403.jsp‎

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)