Polishing

This commit is contained in:
Juergen Hoeller 2016-08-10 16:21:35 +02:00
parent 67ba187b6f
commit 35e247aa26
6 changed files with 24 additions and 16 deletions

View File

@ -174,7 +174,7 @@ public class MultiServerUserRegistry implements SimpUserRegistry, SmartApplicati
@Override @Override
public String toString() { public String toString() {
return "local=[" + this.localRegistry + "], remote=" + this.remoteRegistries + "]"; return "local=[" + this.localRegistry + "], remote=" + this.remoteRegistries;
} }
@ -260,7 +260,6 @@ public class MultiServerUserRegistry implements SimpUserRegistry, SmartApplicati
/** /**
* SimpUser that can be (de)serialized and broadcast to other servers. * SimpUser that can be (de)serialized and broadcast to other servers.
*/ */
@SuppressWarnings("unused")
private static class TransferSimpUser implements SimpUser { private static class TransferSimpUser implements SimpUser {
private String name; private String name;
@ -274,6 +273,7 @@ public class MultiServerUserRegistry implements SimpUserRegistry, SmartApplicati
/** /**
* Default constructor for JSON deserialization. * Default constructor for JSON deserialization.
*/ */
@SuppressWarnings("unused")
public TransferSimpUser() { public TransferSimpUser() {
this.sessions = new HashSet<TransferSimpSession>(1); this.sessions = new HashSet<TransferSimpSession>(1);
} }
@ -368,7 +368,6 @@ public class MultiServerUserRegistry implements SimpUserRegistry, SmartApplicati
/** /**
* SimpSession that can be (de)serialized and broadcast to other servers. * SimpSession that can be (de)serialized and broadcast to other servers.
*/ */
@SuppressWarnings("unused")
private static class TransferSimpSession implements SimpSession { private static class TransferSimpSession implements SimpSession {
private String id; private String id;
@ -380,6 +379,7 @@ public class MultiServerUserRegistry implements SimpUserRegistry, SmartApplicati
/** /**
* Default constructor for JSON deserialization. * Default constructor for JSON deserialization.
*/ */
@SuppressWarnings("unused")
public TransferSimpSession() { public TransferSimpSession() {
this.subscriptions = new HashSet<TransferSimpSubscription>(4); this.subscriptions = new HashSet<TransferSimpSubscription>(4);
} }

View File

@ -146,15 +146,12 @@ public class SqlScriptsTestExecutionListener extends AbstractTestExecutionListen
/** /**
* Execute the SQL scripts configured via the supplied {@link Sql @Sql} * Execute the SQL scripts configured via the supplied {@link Sql @Sql}
* annotation for the given {@link ExecutionPhase} and {@link TestContext}. * annotation for the given {@link ExecutionPhase} and {@link TestContext}.
*
* <p>Special care must be taken in order to properly support the configured * <p>Special care must be taken in order to properly support the configured
* {@link SqlConfig#transactionMode}. * {@link SqlConfig#transactionMode}.
*
* @param sql the {@code @Sql} annotation to parse * @param sql the {@code @Sql} annotation to parse
* @param executionPhase the current execution phase * @param executionPhase the current execution phase
* @param testContext the current {@code TestContext} * @param testContext the current {@code TestContext}
* @param classLevel {@code true} if {@link Sql @Sql} was declared at the * @param classLevel {@code true} if {@link Sql @Sql} was declared at the class level
* class level
*/ */
private void executeSqlScripts(Sql sql, ExecutionPhase executionPhase, TestContext testContext, boolean classLevel) private void executeSqlScripts(Sql sql, ExecutionPhase executionPhase, TestContext testContext, boolean classLevel)
throws Exception { throws Exception {

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -86,7 +86,7 @@ abstract class ActiveProfilesUtils {
ActiveProfiles annotation = descriptor.synthesizeAnnotation(); ActiveProfiles annotation = descriptor.synthesizeAnnotation();
if (logger.isTraceEnabled()) { if (logger.isTraceEnabled()) {
logger.trace(String.format("Retrieved @ActiveProfiles [%s] for declaring class [%s].", logger.trace(String.format("Retrieved @ActiveProfiles [%s] for declaring class [%s]",
annotation, declaringClass.getName())); annotation, declaringClass.getName()));
} }
@ -101,7 +101,7 @@ abstract class ActiveProfilesUtils {
} }
catch (Exception ex) { catch (Exception ex) {
String msg = String.format("Could not instantiate ActiveProfilesResolver of type [%s] " + String msg = String.format("Could not instantiate ActiveProfilesResolver of type [%s] " +
"for test class [%s].", resolverClass.getName(), rootDeclaringClass.getName()); "for test class [%s]", resolverClass.getName(), rootDeclaringClass.getName());
logger.error(msg); logger.error(msg);
throw new IllegalStateException(msg, ex); throw new IllegalStateException(msg, ex);
} }
@ -109,7 +109,7 @@ abstract class ActiveProfilesUtils {
String[] profiles = resolver.resolve(rootDeclaringClass); String[] profiles = resolver.resolve(rootDeclaringClass);
if (profiles == null) { if (profiles == null) {
String msg = String.format( String msg = String.format(
"ActiveProfilesResolver [%s] returned a null array of bean definition profiles.", "ActiveProfilesResolver [%s] returned a null array of bean definition profiles",
resolverClass.getName()); resolverClass.getName());
logger.error(msg); logger.error(msg);
throw new IllegalStateException(msg); throw new IllegalStateException(msg);

View File

@ -243,7 +243,7 @@ public class MockHttpServletRequestBuilder
* @param mediaTypes one or more media types * @param mediaTypes one or more media types
*/ */
public MockHttpServletRequestBuilder accept(MediaType... mediaTypes) { public MockHttpServletRequestBuilder accept(MediaType... mediaTypes) {
Assert.notEmpty(mediaTypes, "No 'Accept' media types"); Assert.notEmpty(mediaTypes, "'mediaTypes' must not be empty");
this.headers.set("Accept", MediaType.toString(Arrays.asList(mediaTypes))); this.headers.set("Accept", MediaType.toString(Arrays.asList(mediaTypes)));
return this; return this;
} }
@ -253,7 +253,7 @@ public class MockHttpServletRequestBuilder
* @param mediaTypes one or more media types * @param mediaTypes one or more media types
*/ */
public MockHttpServletRequestBuilder accept(String... mediaTypes) { public MockHttpServletRequestBuilder accept(String... mediaTypes) {
Assert.notEmpty(mediaTypes, "No 'Accept' media types"); Assert.notEmpty(mediaTypes, "'mediaTypes' must not be empty");
List<MediaType> result = new ArrayList<MediaType>(mediaTypes.length); List<MediaType> result = new ArrayList<MediaType>(mediaTypes.length);
for (String mediaType : mediaTypes) { for (String mediaType : mediaTypes) {
result.add(MediaType.parseMediaType(mediaType)); result.add(MediaType.parseMediaType(mediaType));
@ -285,7 +285,6 @@ public class MockHttpServletRequestBuilder
* @param cookies the cookies to add * @param cookies the cookies to add
*/ */
public MockHttpServletRequestBuilder cookie(Cookie... cookies) { public MockHttpServletRequestBuilder cookie(Cookie... cookies) {
Assert.notNull(cookies, "'cookies' must not be null");
Assert.notEmpty(cookies, "'cookies' must not be empty"); Assert.notEmpty(cookies, "'cookies' must not be empty");
this.cookies.addAll(Arrays.asList(cookies)); this.cookies.addAll(Arrays.asList(cookies));
return this; return this;

View File

@ -288,7 +288,7 @@ public class ServletWebRequest extends ServletRequestAttributes implements Nativ
} }
return HttpStatus.valueOf(response.getStatus()).is2xxSuccessful(); return HttpStatus.valueOf(response.getStatus()).is2xxSuccessful();
} }
catch (IllegalArgumentException e) { catch (IllegalArgumentException ex) {
return true; return true;
} }
} }

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -62,10 +62,22 @@ public class ResourceHandlerRegistry {
private int order = Integer.MAX_VALUE -1; private int order = Integer.MAX_VALUE -1;
/**
* Create a new resource handler registry for the given application context.
* @param applicationContext the Spring application context
* @param servletContext the corresponding Servlet context
*/
public ResourceHandlerRegistry(ApplicationContext applicationContext, ServletContext servletContext) { public ResourceHandlerRegistry(ApplicationContext applicationContext, ServletContext servletContext) {
this(applicationContext, servletContext, null); this(applicationContext, servletContext, null);
} }
/**
* Create a new resource handler registry for the given application context.
* @param applicationContext the Spring application context
* @param servletContext the corresponding Servlet context
* @param contentNegotiationManager the content negotiation manager to use
* @since 4.3
*/
public ResourceHandlerRegistry(ApplicationContext applicationContext, ServletContext servletContext, public ResourceHandlerRegistry(ApplicationContext applicationContext, ServletContext servletContext,
ContentNegotiationManager contentNegotiationManager) { ContentNegotiationManager contentNegotiationManager) {