Explicit type can be replaced by <>
Issue: SPR-13188
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -50,7 +50,7 @@ public abstract class AbstractWebSocketIntegrationTests {
|
||||
|
||||
protected Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
private static Map<Class<?>, Class<?>> upgradeStrategyConfigTypes = new HashMap<Class<?>, Class<?>>();
|
||||
private static Map<Class<?>, Class<?>> upgradeStrategyConfigTypes = new HashMap<>();
|
||||
|
||||
static {
|
||||
upgradeStrategyConfigTypes.put(JettyWebSocketTestServer.class, JettyUpgradeStrategyConfig.class);
|
||||
|
||||
@@ -198,7 +198,7 @@ public class MessageBrokerBeanDefinitionParserTests {
|
||||
SimpleBrokerMessageHandler brokerMessageHandler = this.appContext.getBean(SimpleBrokerMessageHandler.class);
|
||||
assertNotNull(brokerMessageHandler);
|
||||
Collection<String> prefixes = brokerMessageHandler.getDestinationPrefixes();
|
||||
assertEquals(Arrays.asList("/topic", "/queue"), new ArrayList<String>(prefixes));
|
||||
assertEquals(Arrays.asList("/topic", "/queue"), new ArrayList<>(prefixes));
|
||||
assertNotNull(brokerMessageHandler.getTaskScheduler());
|
||||
assertArrayEquals(new long[] {15000, 15000}, brokerMessageHandler.getHeartbeatValue());
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -39,7 +39,7 @@ public class BeanCreatingHandlerProviderTests {
|
||||
public void getHandlerSimpleInstantiation() {
|
||||
|
||||
BeanCreatingHandlerProvider<SimpleEchoHandler> provider =
|
||||
new BeanCreatingHandlerProvider<SimpleEchoHandler>(SimpleEchoHandler.class);
|
||||
new BeanCreatingHandlerProvider<>(SimpleEchoHandler.class);
|
||||
|
||||
assertNotNull(provider.getHandler());
|
||||
}
|
||||
@@ -51,7 +51,7 @@ public class BeanCreatingHandlerProviderTests {
|
||||
ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(Config.class);
|
||||
|
||||
BeanCreatingHandlerProvider<EchoHandler> provider =
|
||||
new BeanCreatingHandlerProvider<EchoHandler>(EchoHandler.class);
|
||||
new BeanCreatingHandlerProvider<>(EchoHandler.class);
|
||||
provider.setBeanFactory(context.getBeanFactory());
|
||||
|
||||
assertNotNull(provider.getHandler());
|
||||
@@ -61,7 +61,7 @@ public class BeanCreatingHandlerProviderTests {
|
||||
public void getHandlerNoBeanFactory() {
|
||||
|
||||
BeanCreatingHandlerProvider<EchoHandler> provider =
|
||||
new BeanCreatingHandlerProvider<EchoHandler>(EchoHandler.class);
|
||||
new BeanCreatingHandlerProvider<>(EchoHandler.class);
|
||||
|
||||
provider.getHandler();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -42,7 +42,7 @@ public class TestWebSocketSession implements WebSocketSession {
|
||||
|
||||
private URI uri;
|
||||
|
||||
private Map<String, Object> attributes = new HashMap<String, Object>();
|
||||
private Map<String, Object> attributes = new HashMap<>();
|
||||
|
||||
private Principal principal;
|
||||
|
||||
@@ -52,7 +52,7 @@ public class TestWebSocketSession implements WebSocketSession {
|
||||
|
||||
private String protocol;
|
||||
|
||||
private List<WebSocketExtension> extensions = new ArrayList<WebSocketExtension>();
|
||||
private List<WebSocketExtension> extensions = new ArrayList<>();
|
||||
|
||||
private boolean open;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -44,7 +44,7 @@ public class WebSocketHttpHeadersTests {
|
||||
|
||||
@Test
|
||||
public void parseWebSocketExtensions() {
|
||||
List<String> extensions = new ArrayList<String>();
|
||||
List<String> extensions = new ArrayList<>();
|
||||
extensions.add("x-foo-extension, x-bar-extension");
|
||||
extensions.add("x-test-extension");
|
||||
this.headers.put(WebSocketHttpHeaders.SEC_WEBSOCKET_EXTENSIONS, extensions);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -468,7 +468,7 @@ public class StompSubProtocolHandlerTests {
|
||||
|
||||
private static class TestPublisher implements ApplicationEventPublisher {
|
||||
|
||||
private final List<ApplicationEvent> events = new ArrayList<ApplicationEvent>();
|
||||
private final List<ApplicationEvent> events = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public void publishEvent(ApplicationEvent event) {
|
||||
@@ -477,7 +477,7 @@ public class StompSubProtocolHandlerTests {
|
||||
|
||||
@Override
|
||||
public void publishEvent(Object event) {
|
||||
publishEvent(new PayloadApplicationEvent<Object>(this, event));
|
||||
publishEvent(new PayloadApplicationEvent<>(this, event));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -32,7 +32,7 @@ public class StompTextMessageBuilder {
|
||||
|
||||
private StompCommand command;
|
||||
|
||||
private final List<String> headerLines = new ArrayList<String>();
|
||||
private final List<String> headerLines = new ArrayList<>();
|
||||
|
||||
private String body;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -57,7 +57,7 @@ public class HandshakeInterceptorChainTests extends AbstractHttpRequestTests {
|
||||
i3 = mock(HandshakeInterceptor.class);
|
||||
interceptors = Arrays.asList(i1, i2, i3);
|
||||
wsHandler = mock(WebSocketHandler.class);
|
||||
attributes = new HashMap<String, Object>();
|
||||
attributes = new HashMap<>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -40,7 +40,7 @@ public class HttpSessionHandshakeInterceptorTests extends AbstractHttpRequestTes
|
||||
|
||||
@Test
|
||||
public void defaultConstructor() throws Exception {
|
||||
Map<String, Object> attributes = new HashMap<String, Object>();
|
||||
Map<String, Object> attributes = new HashMap<>();
|
||||
WebSocketHandler wsHandler = Mockito.mock(WebSocketHandler.class);
|
||||
|
||||
this.servletRequest.setSession(new MockHttpSession(null, "123"));
|
||||
@@ -58,7 +58,7 @@ public class HttpSessionHandshakeInterceptorTests extends AbstractHttpRequestTes
|
||||
|
||||
@Test
|
||||
public void constructorWithAttributeNames() throws Exception {
|
||||
Map<String, Object> attributes = new HashMap<String, Object>();
|
||||
Map<String, Object> attributes = new HashMap<>();
|
||||
WebSocketHandler wsHandler = Mockito.mock(WebSocketHandler.class);
|
||||
|
||||
this.servletRequest.setSession(new MockHttpSession(null, "123"));
|
||||
@@ -76,7 +76,7 @@ public class HttpSessionHandshakeInterceptorTests extends AbstractHttpRequestTes
|
||||
|
||||
@Test
|
||||
public void doNotCopyHttpSessionId() throws Exception {
|
||||
Map<String, Object> attributes = new HashMap<String, Object>();
|
||||
Map<String, Object> attributes = new HashMap<>();
|
||||
WebSocketHandler wsHandler = Mockito.mock(WebSocketHandler.class);
|
||||
|
||||
this.servletRequest.setSession(new MockHttpSession(null, "123"));
|
||||
@@ -93,7 +93,7 @@ public class HttpSessionHandshakeInterceptorTests extends AbstractHttpRequestTes
|
||||
|
||||
@Test
|
||||
public void doNotCopyAttributes() throws Exception {
|
||||
Map<String, Object> attributes = new HashMap<String, Object>();
|
||||
Map<String, Object> attributes = new HashMap<>();
|
||||
WebSocketHandler wsHandler = Mockito.mock(WebSocketHandler.class);
|
||||
|
||||
this.servletRequest.setSession(new MockHttpSession(null, "123"));
|
||||
@@ -109,7 +109,7 @@ public class HttpSessionHandshakeInterceptorTests extends AbstractHttpRequestTes
|
||||
|
||||
@Test
|
||||
public void doNotCauseSessionCreation() throws Exception {
|
||||
Map<String, Object> attributes = new HashMap<String, Object>();
|
||||
Map<String, Object> attributes = new HashMap<>();
|
||||
WebSocketHandler wsHandler = Mockito.mock(WebSocketHandler.class);
|
||||
|
||||
HttpSessionHandshakeInterceptor interceptor = new HttpSessionHandshakeInterceptor();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -47,7 +47,7 @@ public class OriginHandshakeInterceptorTests extends AbstractHttpRequestTests {
|
||||
|
||||
@Test
|
||||
public void originValueMatch() throws Exception {
|
||||
Map<String, Object> attributes = new HashMap<String, Object>();
|
||||
Map<String, Object> attributes = new HashMap<>();
|
||||
WebSocketHandler wsHandler = Mockito.mock(WebSocketHandler.class);
|
||||
this.servletRequest.addHeader(HttpHeaders.ORIGIN, "http://mydomain1.com");
|
||||
List<String> allowed = Collections.singletonList("http://mydomain1.com");
|
||||
@@ -58,7 +58,7 @@ public class OriginHandshakeInterceptorTests extends AbstractHttpRequestTests {
|
||||
|
||||
@Test
|
||||
public void originValueNoMatch() throws Exception {
|
||||
Map<String, Object> attributes = new HashMap<String, Object>();
|
||||
Map<String, Object> attributes = new HashMap<>();
|
||||
WebSocketHandler wsHandler = Mockito.mock(WebSocketHandler.class);
|
||||
this.servletRequest.addHeader(HttpHeaders.ORIGIN, "http://mydomain1.com");
|
||||
List<String> allowed = Collections.singletonList("http://mydomain2.com");
|
||||
@@ -69,7 +69,7 @@ public class OriginHandshakeInterceptorTests extends AbstractHttpRequestTests {
|
||||
|
||||
@Test
|
||||
public void originListMatch() throws Exception {
|
||||
Map<String, Object> attributes = new HashMap<String, Object>();
|
||||
Map<String, Object> attributes = new HashMap<>();
|
||||
WebSocketHandler wsHandler = Mockito.mock(WebSocketHandler.class);
|
||||
this.servletRequest.addHeader(HttpHeaders.ORIGIN, "http://mydomain2.com");
|
||||
List<String> allowed = Arrays.asList("http://mydomain1.com", "http://mydomain2.com", "http://mydomain3.com");
|
||||
@@ -80,7 +80,7 @@ public class OriginHandshakeInterceptorTests extends AbstractHttpRequestTests {
|
||||
|
||||
@Test
|
||||
public void originListNoMatch() throws Exception {
|
||||
Map<String, Object> attributes = new HashMap<String, Object>();
|
||||
Map<String, Object> attributes = new HashMap<>();
|
||||
WebSocketHandler wsHandler = Mockito.mock(WebSocketHandler.class);
|
||||
this.servletRequest.addHeader(HttpHeaders.ORIGIN, "http://mydomain4.com");
|
||||
List<String> allowed = Arrays.asList("http://mydomain1.com", "http://mydomain2.com", "http://mydomain3.com");
|
||||
@@ -91,11 +91,11 @@ public class OriginHandshakeInterceptorTests extends AbstractHttpRequestTests {
|
||||
|
||||
@Test
|
||||
public void originNoMatchWithNullHostileCollection() throws Exception {
|
||||
Map<String, Object> attributes = new HashMap<String, Object>();
|
||||
Map<String, Object> attributes = new HashMap<>();
|
||||
WebSocketHandler wsHandler = Mockito.mock(WebSocketHandler.class);
|
||||
this.servletRequest.addHeader(HttpHeaders.ORIGIN, "http://mydomain4.com");
|
||||
OriginHandshakeInterceptor interceptor = new OriginHandshakeInterceptor();
|
||||
Set<String> allowedOrigins = new ConcurrentSkipListSet<String>();
|
||||
Set<String> allowedOrigins = new ConcurrentSkipListSet<>();
|
||||
allowedOrigins.add("http://mydomain1.com");
|
||||
interceptor.setAllowedOrigins(allowedOrigins);
|
||||
assertFalse(interceptor.beforeHandshake(request, response, wsHandler, attributes));
|
||||
@@ -104,7 +104,7 @@ public class OriginHandshakeInterceptorTests extends AbstractHttpRequestTests {
|
||||
|
||||
@Test
|
||||
public void originMatchAll() throws Exception {
|
||||
Map<String, Object> attributes = new HashMap<String, Object>();
|
||||
Map<String, Object> attributes = new HashMap<>();
|
||||
WebSocketHandler wsHandler = Mockito.mock(WebSocketHandler.class);
|
||||
this.servletRequest.addHeader(HttpHeaders.ORIGIN, "http://mydomain1.com");
|
||||
OriginHandshakeInterceptor interceptor = new OriginHandshakeInterceptor();
|
||||
@@ -115,7 +115,7 @@ public class OriginHandshakeInterceptorTests extends AbstractHttpRequestTests {
|
||||
|
||||
@Test
|
||||
public void sameOriginMatchWithEmptyAllowedOrigins() throws Exception {
|
||||
Map<String, Object> attributes = new HashMap<String, Object>();
|
||||
Map<String, Object> attributes = new HashMap<>();
|
||||
WebSocketHandler wsHandler = Mockito.mock(WebSocketHandler.class);
|
||||
this.servletRequest.addHeader(HttpHeaders.ORIGIN, "http://mydomain2.com");
|
||||
this.servletRequest.setServerName("mydomain2.com");
|
||||
@@ -126,7 +126,7 @@ public class OriginHandshakeInterceptorTests extends AbstractHttpRequestTests {
|
||||
|
||||
@Test
|
||||
public void sameOriginMatchWithAllowedOrigins() throws Exception {
|
||||
Map<String, Object> attributes = new HashMap<String, Object>();
|
||||
Map<String, Object> attributes = new HashMap<>();
|
||||
WebSocketHandler wsHandler = Mockito.mock(WebSocketHandler.class);
|
||||
this.servletRequest.addHeader(HttpHeaders.ORIGIN, "http://mydomain2.com");
|
||||
this.servletRequest.setServerName("mydomain2.com");
|
||||
@@ -137,7 +137,7 @@ public class OriginHandshakeInterceptorTests extends AbstractHttpRequestTests {
|
||||
|
||||
@Test
|
||||
public void sameOriginNoMatch() throws Exception {
|
||||
Map<String, Object> attributes = new HashMap<String, Object>();
|
||||
Map<String, Object> attributes = new HashMap<>();
|
||||
WebSocketHandler wsHandler = Mockito.mock(WebSocketHandler.class);
|
||||
this.servletRequest.addHeader(HttpHeaders.ORIGIN, "http://mydomain3.com");
|
||||
this.servletRequest.setServerName("mydomain2.com");
|
||||
|
||||
Reference in New Issue
Block a user