Add missing package-info file for new test.context.web.socket package

Issue: SPR-14420
This commit is contained in:
Juergen Hoeller 2016-07-02 15:46:21 +02:00
parent a6e4b64c23
commit 080dcad218
4 changed files with 21 additions and 22 deletions

View File

@ -20,7 +20,6 @@ import java.io.IOException;
import java.net.URI; import java.net.URI;
import java.util.Collections; import java.util.Collections;
import java.util.Set; import java.util.Set;
import javax.websocket.ClientEndpointConfig; import javax.websocket.ClientEndpointConfig;
import javax.websocket.DeploymentException; import javax.websocket.DeploymentException;
import javax.websocket.Endpoint; import javax.websocket.Endpoint;
@ -30,8 +29,7 @@ import javax.websocket.server.ServerContainer;
import javax.websocket.server.ServerEndpointConfig; import javax.websocket.server.ServerEndpointConfig;
/** /**
* Mock implementation of the {@link javax.websocket.server.ServerContainer} * Mock implementation of the {@link javax.websocket.server.ServerContainer} interface.
* interface.
* *
* @author Sam Brannen * @author Sam Brannen
* @since 4.3.1 * @since 4.3.1
@ -107,6 +105,7 @@ class MockServerContainer implements ServerContainer {
@Override @Override
public Session connectToServer(Endpoint endpointInstance, ClientEndpointConfig cec, URI path) public Session connectToServer(Endpoint endpointInstance, ClientEndpointConfig cec, URI path)
throws DeploymentException, IOException { throws DeploymentException, IOException {
throw new UnsupportedOperationException( throw new UnsupportedOperationException(
"MockServerContainer does not support connectToServer(Endpoint, ClientEndpointConfig, URI)"); "MockServerContainer does not support connectToServer(Endpoint, ClientEndpointConfig, URI)");
} }
@ -114,10 +113,12 @@ class MockServerContainer implements ServerContainer {
@Override @Override
public Session connectToServer(Class<? extends Endpoint> endpointClass, ClientEndpointConfig cec, URI path) public Session connectToServer(Class<? extends Endpoint> endpointClass, ClientEndpointConfig cec, URI path)
throws DeploymentException, IOException { throws DeploymentException, IOException {
throw new UnsupportedOperationException( throw new UnsupportedOperationException(
"MockServerContainer does not support connectToServer(Class, ClientEndpointConfig, URI)"); "MockServerContainer does not support connectToServer(Class, ClientEndpointConfig, URI)");
} }
// --- ServerContainer ----------------------------------------------------- // --- ServerContainer -----------------------------------------------------
@Override @Override

View File

@ -40,14 +40,8 @@ class MockServerContainerContextCustomizer implements ContextCustomizer {
} }
@Override @Override
public boolean equals(Object that) { public boolean equals(Object other) {
if (this == that) { return (this == other || (other != null && getClass() == other.getClass()));
return true;
}
if (that == null || this.getClass() != that.getClass()) {
return false;
}
return true;
} }
@Override @Override

View File

@ -35,15 +35,15 @@ import org.springframework.util.ClassUtils;
*/ */
class MockServerContainerContextCustomizerFactory implements ContextCustomizerFactory { class MockServerContainerContextCustomizerFactory implements ContextCustomizerFactory {
private static final boolean webSocketPresent = ClassUtils.isPresent("javax.websocket.server.ServerContainer",
MockServerContainerContextCustomizerFactory.class.getClassLoader());
private static final String WEB_APP_CONFIGURATION_ANNOTATION_CLASS_NAME = private static final String WEB_APP_CONFIGURATION_ANNOTATION_CLASS_NAME =
"org.springframework.test.context.web.WebAppConfiguration"; "org.springframework.test.context.web.WebAppConfiguration";
private static final String MOCK_SERVER_CONTAINER_CONTEXT_CUSTOMIZER_CLASS_NAME = private static final String MOCK_SERVER_CONTAINER_CONTEXT_CUSTOMIZER_CLASS_NAME =
"org.springframework.test.context.web.socket.MockServerContainerContextCustomizer"; "org.springframework.test.context.web.socket.MockServerContainerContextCustomizer";
private static final boolean webSocketPresent = ClassUtils.isPresent("javax.websocket.server.ServerContainer",
MockServerContainerContextCustomizerFactory.class.getClassLoader());
@Override @Override
public ContextCustomizer createContextCustomizer(Class<?> testClass, public ContextCustomizer createContextCustomizer(Class<?> testClass,
@ -56,8 +56,8 @@ class MockServerContainerContextCustomizerFactory implements ContextCustomizerFa
return (ContextCustomizer) BeanUtils.instantiateClass(clazz); return (ContextCustomizer) BeanUtils.instantiateClass(clazz);
} }
catch (Throwable ex) { catch (Throwable ex) {
throw new IllegalStateException("Failed to enable WebSocket test support; could not load class: " throw new IllegalStateException("Failed to enable WebSocket test support; could not load class: " +
+ MOCK_SERVER_CONTAINER_CONTEXT_CUSTOMIZER_CLASS_NAME, ex); MOCK_SERVER_CONTAINER_CONTEXT_CUSTOMIZER_CLASS_NAME, ex);
} }
} }
@ -66,8 +66,8 @@ class MockServerContainerContextCustomizerFactory implements ContextCustomizerFa
} }
private static boolean isAnnotatedWithWebAppConfiguration(Class<?> testClass) { private static boolean isAnnotatedWithWebAppConfiguration(Class<?> testClass) {
return AnnotatedElementUtils.findMergedAnnotationAttributes(testClass, return (AnnotatedElementUtils.findMergedAnnotationAttributes(testClass,
WEB_APP_CONFIGURATION_ANNOTATION_CLASS_NAME, false, false) != null; WEB_APP_CONFIGURATION_ANNOTATION_CLASS_NAME, false, false) != null);
} }
} }

View File

@ -0,0 +1,4 @@
/**
* WebSocket support classes for the <em>Spring TestContext Framework</em>.
*/
package org.springframework.test.context.web.socket;