Browse Source

Polishing

pull/1260/head
Juergen Hoeller 10 years ago
parent
commit
9520a593bd
  1. 24
      spring-aop/src/main/java/org/springframework/aop/framework/CglibAopProxy.java
  2. 4
      spring-test-mvc/src/main/java/org/springframework/test/web/client/MockMvcClientHttpRequestFactory.java
  3. 1
      spring-test-mvc/src/main/java/org/springframework/test/web/client/RequestMatcher.java
  4. 1
      spring-test-mvc/src/main/java/org/springframework/test/web/client/RequestMatcherClientHttpRequest.java
  5. 16
      spring-test-mvc/src/main/java/org/springframework/test/web/client/match/ContentRequestMatchers.java
  6. 3
      spring-test-mvc/src/main/java/org/springframework/test/web/client/match/JsonPathRequestMatchers.java
  7. 6
      spring-test-mvc/src/main/java/org/springframework/test/web/client/match/XpathRequestMatchers.java

24
spring-aop/src/main/java/org/springframework/aop/framework/CglibAopProxy.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2015 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.
@ -93,7 +93,7 @@ final class CglibAopProxy implements AopProxy, Serializable { @@ -93,7 +93,7 @@ final class CglibAopProxy implements AopProxy, Serializable {
/** Logger available to subclasses; static to optimize serialization */
protected final static Log logger = LogFactory.getLog(CglibAopProxy.class);
protected static final Log logger = LogFactory.getLog(CglibAopProxy.class);
/** Keeps track of the Classes that we have validated for final methods */
private static final Map<Class<?>, Boolean> validatedClasses = new WeakHashMap<Class<?>, Boolean>();
@ -294,13 +294,13 @@ final class CglibAopProxy implements AopProxy, Serializable { @@ -294,13 +294,13 @@ final class CglibAopProxy implements AopProxy, Serializable {
Callback targetDispatcher = isStatic ?
new StaticDispatcher(this.advised.getTargetSource().getTarget()) : new SerializableNoOp();
Callback[] mainCallbacks = new Callback[]{
aopInterceptor, // for normal advice
targetInterceptor, // invoke target without considering advice, if optimized
new SerializableNoOp(), // no override for methods mapped to this
targetDispatcher, this.advisedDispatcher,
new EqualsInterceptor(this.advised),
new HashCodeInterceptor(this.advised)
Callback[] mainCallbacks = new Callback[] {
aopInterceptor, // for normal advice
targetInterceptor, // invoke target without considering advice, if optimized
new SerializableNoOp(), // no override for methods mapped to this
targetDispatcher, this.advisedDispatcher,
new EqualsInterceptor(this.advised),
new HashCodeInterceptor(this.advised)
};
Callback[] callbacks;
@ -678,10 +678,11 @@ final class CglibAopProxy implements AopProxy, Serializable { @@ -678,10 +678,11 @@ final class CglibAopProxy implements AopProxy, Serializable {
private final MethodProxy methodProxy;
private boolean protectedMethod;
private final boolean protectedMethod;
public CglibMethodInvocation(Object proxy, Object target, Method method, Object[] arguments,
Class<?> targetClass, List<Object> interceptorsAndDynamicMethodMatchers, MethodProxy methodProxy) {
super(proxy, target, method, arguments, targetClass, interceptorsAndDynamicMethodMatchers);
this.methodProxy = methodProxy;
this.protectedMethod = Modifier.isProtected(method.getModifiers());
@ -800,8 +801,7 @@ final class CglibAopProxy implements AopProxy, Serializable { @@ -800,8 +801,7 @@ final class CglibAopProxy implements AopProxy, Serializable {
if (logger.isDebugEnabled()) {
logger.debug("Method has advice and optimisations are enabled: " + method);
}
// We know that we are optimising so we can use the
// FixedStaticChainInterceptors.
// We know that we are optimising so we can use the FixedStaticChainInterceptors.
int index = this.fixedInterceptorMap.get(key);
return (index + this.fixedInterceptorOffset);
}

4
spring-test-mvc/src/main/java/org/springframework/test/web/client/MockMvcClientHttpRequestFactory.java

@ -16,8 +16,6 @@ @@ -16,8 +16,6 @@
package org.springframework.test.web.client;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.request;
import java.io.IOException;
import java.net.URI;
import java.util.List;
@ -36,6 +34,8 @@ import org.springframework.test.web.servlet.MvcResult; @@ -36,6 +34,8 @@ import org.springframework.test.web.servlet.MvcResult;
import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder;
import org.springframework.util.Assert;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
/**
* A {@link ClientHttpRequestFactory} for requests executed via {@link MockMvc}.
*

1
spring-test-mvc/src/main/java/org/springframework/test/web/client/RequestMatcher.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.test.web.client;
import java.io.IOException;

1
spring-test-mvc/src/main/java/org/springframework/test/web/client/RequestMatcherClientHttpRequest.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.test.web.client;
import java.io.IOException;

16
spring-test-mvc/src/main/java/org/springframework/test/web/client/match/ContentRequestMatchers.java

@ -13,24 +13,24 @@ @@ -13,24 +13,24 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.test.web.client.match;
import static org.springframework.test.util.AssertionErrors.assertEquals;
import static org.springframework.test.util.AssertionErrors.assertTrue;
import static org.springframework.test.util.MatcherAssertionErrors.assertThat;
package org.springframework.test.web.client.match;
import java.io.IOException;
import javax.xml.transform.Source;
import javax.xml.transform.dom.DOMSource;
import org.hamcrest.Matcher;
import org.w3c.dom.Node;
import org.springframework.http.MediaType;
import org.springframework.http.client.ClientHttpRequest;
import org.springframework.mock.http.client.MockClientHttpRequest;
import org.springframework.test.util.XmlExpectationsHelper;
import org.springframework.test.web.client.RequestMatcher;
import org.w3c.dom.Node;
import static org.hamcrest.MatcherAssert.*;
import static org.springframework.test.util.AssertionErrors.*;
/**
* Factory for request content {@code RequestMatcher}'s. An instance of this
@ -185,8 +185,8 @@ public class ContentRequestMatchers { @@ -185,8 +185,8 @@ public class ContentRequestMatchers {
MockClientHttpRequest mockRequest = (MockClientHttpRequest) request;
matchInternal(mockRequest);
}
catch (Exception e) {
throw new AssertionError("Failed to parse expected or actual XML request content: " + e.getMessage());
catch (Exception ex) {
throw new AssertionError("Failed to parse expected or actual XML request content: " + ex.getMessage());
}
}

3
spring-test-mvc/src/main/java/org/springframework/test/web/client/match/JsonPathRequestMatchers.java

@ -13,12 +13,14 @@ @@ -13,12 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.test.web.client.match;
import java.io.IOException;
import java.text.ParseException;
import org.hamcrest.Matcher;
import org.springframework.http.client.ClientHttpRequest;
import org.springframework.mock.http.client.MockClientHttpRequest;
import org.springframework.test.util.JsonPathExpectationsHelper;
@ -51,6 +53,7 @@ public class JsonPathRequestMatchers { @@ -51,6 +53,7 @@ public class JsonPathRequestMatchers {
this.jsonPathHelper = new JsonPathExpectationsHelper(expression, args);
}
/**
* Evaluate the JSONPath and assert the resulting value with the given {@code Matcher}.
*/

6
spring-test-mvc/src/main/java/org/springframework/test/web/client/match/XpathRequestMatchers.java

@ -13,20 +13,19 @@ @@ -13,20 +13,19 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.test.web.client.match;
import java.io.IOException;
import java.util.Map;
import javax.xml.xpath.XPathExpressionException;
import org.hamcrest.Matcher;
import org.w3c.dom.Node;
import org.springframework.http.client.ClientHttpRequest;
import org.springframework.mock.http.client.MockClientHttpRequest;
import org.springframework.test.util.XpathExpectationsHelper;
import org.springframework.test.web.client.RequestMatcher;
import org.w3c.dom.Node;
/**
* Factory methods for request content {@code RequestMatcher}'s using an XPath
@ -196,7 +195,6 @@ public class XpathRequestMatchers { @@ -196,7 +195,6 @@ public class XpathRequestMatchers {
}
protected abstract void matchInternal(MockClientHttpRequest request) throws Exception;
}
}

Loading…
Cancel
Save