INT-3262 JDK8 Javadoc Commit
Increase receive timeout for `Jsr223TransformerTests#testInt3162ScriptExecutorThreadSafety`. JIRA: https://jira.springsource.org/browse/INT-3262 JIRA: https://jira.springsource.org/browse/INT-3263
This commit is contained in:
committed by
Artem Bilan
parent
66efb34342
commit
c45b708341
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2014 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.
|
||||
@@ -35,7 +35,6 @@ import org.springframework.messaging.MessageHeaders;
|
||||
* <p>
|
||||
* For example using {@link Assert#assertThat(Object, Matcher)} for a single
|
||||
* entry:
|
||||
* <p>
|
||||
*
|
||||
* <pre class="code">
|
||||
* {@code
|
||||
@@ -49,7 +48,6 @@ import org.springframework.messaging.MessageHeaders;
|
||||
* </pre>
|
||||
* <p>
|
||||
* For multiple entries to match all:
|
||||
* <p>
|
||||
* <pre class="code">
|
||||
* {@code
|
||||
* Map<String, Object> expectedInHeaderMap = new HashMap<String, Object>();
|
||||
@@ -61,7 +59,6 @@ import org.springframework.messaging.MessageHeaders;
|
||||
*
|
||||
* <p>
|
||||
* For a single key:
|
||||
* <p>
|
||||
*
|
||||
* <pre class="code">
|
||||
* ANY_HEADER_KEY = "foo";
|
||||
@@ -96,6 +93,7 @@ public class HeaderMatcher extends TypeSafeMatcher<Message<?>> {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void describeTo(Description description) {
|
||||
description.appendText("a Message with Headers containing ").appendDescriptionOf(matcher);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2014 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.
|
||||
@@ -29,7 +29,7 @@ import org.springframework.messaging.Message;
|
||||
* <p>
|
||||
* A Junit example using {@link Assert#assertThat(Object, Matcher)} could look
|
||||
* like this to test a payload value:
|
||||
* <p>
|
||||
*
|
||||
* <pre class="code">
|
||||
* {@code
|
||||
* ANY_PAYLOAD = new BigDecimal("1.123");
|
||||
@@ -41,7 +41,7 @@ import org.springframework.messaging.Message;
|
||||
* <p>
|
||||
* An example using {@link Assert#assertThat(Object, Matcher)} delegating to
|
||||
* another {@link Matcher}.
|
||||
* <p>
|
||||
*
|
||||
* <pre class="code">
|
||||
* ANY_PAYLOAD = new BigDecimal("1.123");
|
||||
* assertThat(message, PayloadMatcher.hasPayload(is(BigDecimal.class)));
|
||||
@@ -80,6 +80,7 @@ public class PayloadMatcher extends TypeSafeMatcher<Message> {
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
//@Override
|
||||
@Override
|
||||
public void describeTo(Description description) {
|
||||
description.appendText("a Message with payload: ").appendDescriptionOf(matcher);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2014 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.
|
||||
@@ -15,10 +15,10 @@
|
||||
*/
|
||||
package org.springframework.integration.test.matcher;
|
||||
|
||||
import org.hamcrest.BaseMatcher;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.hamcrest.BaseMatcher;
|
||||
|
||||
/**
|
||||
* This class was copied from JUnit to avoid using it from org.junit.internal (causing a backwards compatibility issue).
|
||||
* If you want to extend this class use a recent version of JUnit, and extend
|
||||
@@ -31,11 +31,14 @@ import java.lang.reflect.Method;
|
||||
*/
|
||||
abstract class TypeSafeMatcher<T> extends BaseMatcher<T> {
|
||||
|
||||
private Class<?> expectedType;
|
||||
private final Class<?> expectedType;
|
||||
|
||||
/**
|
||||
* Subclasses should implement this. The item will already have been checked for
|
||||
* the specific type and will never be null.
|
||||
*
|
||||
* @param item The item.
|
||||
* @return true if matches.
|
||||
*/
|
||||
public abstract boolean matchesSafely(T item);
|
||||
|
||||
@@ -70,7 +73,8 @@ abstract class TypeSafeMatcher<T> extends BaseMatcher<T> {
|
||||
* If you need to override this, there's no point on extending TypeSafeMatcher.
|
||||
* Instead, extend the {@link BaseMatcher}.
|
||||
*/
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public final boolean matches(Object item) {
|
||||
return item != null
|
||||
&& expectedType.isInstance(item)
|
||||
|
||||
@@ -1,35 +1,54 @@
|
||||
/*
|
||||
* Copyright 2011-2014 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.test.support;
|
||||
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessagingException;
|
||||
import org.springframework.messaging.MessageHandler;
|
||||
import org.springframework.messaging.MessagingException;
|
||||
/**
|
||||
* The base class for response validators used for {@link RequestResponseScenario}s
|
||||
* @author David Turanski
|
||||
*
|
||||
*/
|
||||
public abstract class AbstractResponseValidator<T> implements MessageHandler {
|
||||
|
||||
|
||||
private Message<?> lastMessage;
|
||||
|
||||
/**
|
||||
* handle the message
|
||||
* handle the message
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
//@Override
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void handleMessage(Message<?> message) throws MessagingException {
|
||||
this.lastMessage = message;
|
||||
validateResponse((T) (extractPayload()? message.getPayload(): message ));
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement this method to validate the response (Message or Payload)
|
||||
* @param response
|
||||
* @param response The response.
|
||||
*/
|
||||
protected abstract void validateResponse(T response);
|
||||
|
||||
/**
|
||||
* If true will extract the payload as the parameter for validateResponse()
|
||||
* @return true to extract the payload; false to process the message.
|
||||
*/
|
||||
protected abstract boolean extractPayload();
|
||||
|
||||
/**
|
||||
* @return the lastMessage
|
||||
*/
|
||||
|
||||
@@ -1,24 +1,44 @@
|
||||
/*
|
||||
* Copyright 2011-2014 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.test.support;
|
||||
|
||||
import org.springframework.messaging.Message;
|
||||
|
||||
/**
|
||||
* Validate a message. Create an anonymous instance or subclass to
|
||||
* Validate a message. Create an anonymous instance or subclass to
|
||||
* implement the validateMessage() method
|
||||
* @author David Turanski
|
||||
*
|
||||
*/
|
||||
public abstract class MessageValidator extends AbstractResponseValidator<Message<?>> {
|
||||
protected final boolean extractPayload(){
|
||||
|
||||
@Override
|
||||
protected final boolean extractPayload(){
|
||||
return false;
|
||||
}
|
||||
|
||||
protected final void validateResponse(Message<?> response){
|
||||
validateMessage((Message<?>) response);
|
||||
|
||||
@Override
|
||||
protected final void validateResponse(Message<?> response){
|
||||
validateMessage(response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement this method to validate the message
|
||||
* @param message
|
||||
* @param message The message.
|
||||
*/
|
||||
protected abstract void validateMessage(Message<?> message);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,27 @@
|
||||
/*
|
||||
* Copyright 2011-2014 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.test.support;
|
||||
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* Defines a Spring Integration request response test scenario. All setter methods may
|
||||
* be chained.
|
||||
* be chained.
|
||||
* @author David Turanski
|
||||
*
|
||||
*/
|
||||
@@ -16,7 +32,7 @@ public class RequestResponseScenario {
|
||||
private Message<?> message;
|
||||
private AbstractResponseValidator<?> responseValidator;
|
||||
private String name;
|
||||
|
||||
|
||||
protected Message<? extends Object> getMessage(){
|
||||
if (message == null){
|
||||
return new GenericMessage<Object>(this.payload);
|
||||
@@ -24,6 +40,7 @@ public class RequestResponseScenario {
|
||||
return message;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance
|
||||
* @param inputChannelName the input channel name
|
||||
@@ -33,51 +50,51 @@ public class RequestResponseScenario {
|
||||
this.inputChannelName = inputChannelName;
|
||||
this.outputChannelName = outputChannelName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @return the input channel name
|
||||
*/
|
||||
public String getInputChannelName() {
|
||||
return inputChannelName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @return the output channel name
|
||||
*/
|
||||
public String getOutputChannelName() {
|
||||
return outputChannelName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @return the request message payload
|
||||
*/
|
||||
public Object getPayload() {
|
||||
return payload;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* set the payload of the request message
|
||||
* @param payload
|
||||
* @param payload The payload.
|
||||
* @return this
|
||||
*/
|
||||
public RequestResponseScenario setPayload(Object payload) {
|
||||
this.payload = payload;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @return the scenario name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* set the scenario name (optional)
|
||||
* Set the scenario name (optional)
|
||||
* @param name the name
|
||||
* @return this
|
||||
*/
|
||||
@@ -85,31 +102,31 @@ public class RequestResponseScenario {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the response validator
|
||||
*
|
||||
* @return the response validator
|
||||
* @see AbstractResponseValidator
|
||||
*/
|
||||
public AbstractResponseValidator<?> getResponseValidator(){
|
||||
return responseValidator;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the response validator
|
||||
* Set the response validator
|
||||
* @see AbstractResponseValidator
|
||||
* @param responseValidator
|
||||
* @param responseValidator The response validator.
|
||||
* @return this
|
||||
*/
|
||||
public RequestResponseScenario setResponseValidator(AbstractResponseValidator<?> responseValidator) {
|
||||
this.responseValidator = responseValidator;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Set the request message (as an alternative to setPayload())
|
||||
* @param message
|
||||
* @param message The message.
|
||||
* @return this
|
||||
*/
|
||||
public RequestResponseScenario setMessage(Message<?> message) {
|
||||
|
||||
Reference in New Issue
Block a user