Skip to content

Commit

Permalink
INT-2963 - Remove JDK7 Compilation Warnings
Browse files Browse the repository at this point in the history
* Upgrade Mockito to 1.9.5
* Fix failing SubscribableJmsChannelTests
  • Loading branch information
ghillert committed Mar 20, 2013
1 parent b4ff3a1 commit 5bebb98
Show file tree
Hide file tree
Showing 26 changed files with 101 additions and 112 deletions.
10 changes: 5 additions & 5 deletions build.gradle
Expand Up @@ -28,8 +28,8 @@ subprojects { subproject ->
apply plugin: 'eclipse'
apply plugin: 'idea'

sourceCompatibility=1.7
targetCompatibility=1.7
sourceCompatibility=1.6
targetCompatibility=1.6

ext {
aspectjVersion = '1.6.8'
Expand All @@ -42,7 +42,7 @@ subprojects { subproject ->
javaxActivationVersion = '1.1.1'
junitVersion = '4.11'
log4jVersion = '1.2.12'
mockitoVersion = '1.9.0'
mockitoVersion = '1.9.5'

springVersionDefault = '3.1.3.RELEASE'
springVersion = project.hasProperty('springVersion') ? getProperty('springVersion') : springVersionDefault
Expand Down Expand Up @@ -296,8 +296,8 @@ project('spring-integration-jdbc') {
testCompile "org.apache.derby:derby:10.5.3.0_1"
testCompile "org.apache.derby:derbyclient:10.5.3.0_1"

testCompile "org.powermock:powermock-module-junit4:1.4.12"
testCompile "org.powermock:powermock-api-mockito:1.4.12"
testCompile "org.powermock:powermock-module-junit4:1.5"
testCompile "org.powermock:powermock-api-mockito:1.5"

testCompile "postgresql:postgresql:9.1-901-1.jdbc4"
testCompile "mysql:mysql-connector-java:5.1.21"
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2011 the original author or authors.
* Copyright 2002-2013 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.
Expand Down Expand Up @@ -315,8 +315,6 @@ protected String getStandardHeaderPrefix() {
* Required since Content-Type can be represented as org.springframework.http.MediaType
* see INT-2713 for more details
*
* @param headers
* @return
*/
private String extractContentTypeAsString(Map<String, Object> headers){
String contentTypeStringValue = null;
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2010 the original author or authors.
* Copyright 2002-2013 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.
Expand Down Expand Up @@ -44,7 +44,7 @@
* An advisor that will apply the {@link MessagePublishingInterceptor} to any
* methods containing the provided annotations. If no annotations are provided,
* the default will be {@link Publisher @Publisher}.
*
*
* @author Mark Fisher
* @since 2.0
*/
Expand All @@ -55,7 +55,7 @@ public class PublisherAnnotationAdvisor extends AbstractPointcutAdvisor implemen

private final MessagePublishingInterceptor interceptor;


@SuppressWarnings("unchecked") //For JDK7
public PublisherAnnotationAdvisor(Class<? extends Annotation> ... publisherAnnotationTypes) {
this.publisherAnnotationTypes = new HashSet<Class<? extends Annotation>>(Arrays.asList(publisherAnnotationTypes));
PublisherMetadataSource metadataSource = new MethodAnnotationPublisherMetadataSource(this.publisherAnnotationTypes);
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors
* Copyright 2002-2013 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.
Expand Down Expand Up @@ -252,12 +252,10 @@ private Message<?> normalizeMessage(Message<?> message){

/**
* Will enrich Message with additional meta headers
* @param message
* @return
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
@SuppressWarnings({ "rawtypes", "unchecked" })
private Message<?> enrichMessage(Message<?> message){
Message<?> enrichedMessage = MessageBuilder.fromMessage(message).setHeader(CREATED_DATE, System.currentTimeMillis()).build();
Message<?> enrichedMessage = MessageBuilder.fromMessage(message).setHeader(CREATED_DATE, System.currentTimeMillis()).build();
Map innerMap = (Map) new DirectFieldAccessor(enrichedMessage.getHeaders()).getPropertyValue("headers");
innerMap.put(MessageHeaders.ID, message.getHeaders().getId());
innerMap.put(MessageHeaders.TIMESTAMP, message.getHeaders().getTimestamp());
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2008 the original author or authors.
* Copyright 2002-2013 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.
Expand Down Expand Up @@ -187,7 +187,7 @@ public boolean notEnoughParameters() {
}
// TODO: this is stupid, but maybe it should be illegal?
new MethodInvokingReleaseStrategy(new TestReleaseStrategy(), TestReleaseStrategy.class.getMethod(
"notEnoughParameters", new Class[] {}));
"notEnoughParameters"));
}

@Test
Expand Down Expand Up @@ -238,7 +238,7 @@ public boolean listSubclassParameter(LinkedList<?> l1) {
}
}
ReleaseStrategy adapter = new MethodInvokingReleaseStrategy(new TestReleaseStrategy(),
TestReleaseStrategy.class.getMethod("listSubclassParameter", new Class[] { LinkedList.class }));
TestReleaseStrategy.class.getMethod("listSubclassParameter", new Class<?>[] { LinkedList.class }));
MessageGroup messages = createListOfMessages(3);
Assert.assertTrue(adapter.canRelease(messages));
}
Expand All @@ -253,7 +253,7 @@ public int wrongReturnType(List<Message<?>> message) {
}
}
new MethodInvokingReleaseStrategy(new TestReleaseStrategy(), TestReleaseStrategy.class.getMethod(
"wrongReturnType", new Class[] { List.class }));
"wrongReturnType", new Class<?>[] { List.class }));
}

private static MessageGroup createListOfMessages(int size) {
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 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.
Expand Down Expand Up @@ -46,6 +46,7 @@
/**
* @author Mark Fisher
* @author Artem Bilan
* @author Gunnar Hillert
* @since 1.0.3
*/
@RunWith(SpringJUnit4ClassRunner.class)
Expand Down Expand Up @@ -104,7 +105,7 @@ public void customMessageStore() {
public void transactionalSubElement() {
Object endpoint = context.getBean("delayerWithTransactional");
DelayHandler delayHandler = TestUtils.getPropertyValue(endpoint, "handler", DelayHandler.class);
List adviceChain = TestUtils.getPropertyValue(delayHandler, "delayedAdviceChain", List.class);
List<?> adviceChain = TestUtils.getPropertyValue(delayHandler, "delayedAdviceChain", List.class);
assertEquals(1, adviceChain.size());
Object advice = adviceChain.get(0);
assertTrue(advice instanceof TransactionInterceptor);
Expand All @@ -121,15 +122,15 @@ public void transactionalSubElement() {
public void adviceChainSubElement() {
Object endpoint = context.getBean("delayerWithAdviceChain");
DelayHandler delayHandler = TestUtils.getPropertyValue(endpoint, "handler", DelayHandler.class);
List adviceChain = TestUtils.getPropertyValue(delayHandler, "delayedAdviceChain", List.class);
List<?> adviceChain = TestUtils.getPropertyValue(delayHandler, "delayedAdviceChain", List.class);
assertEquals(2, adviceChain.size());
assertSame(context.getBean("testAdviceBean"), adviceChain.get(0));

Object txAdvice = adviceChain.get(1);
assertEquals(TransactionInterceptor.class, txAdvice.getClass());
TransactionAttributeSource transactionAttributeSource = ((TransactionInterceptor) txAdvice).getTransactionAttributeSource();
assertEquals(NameMatchTransactionAttributeSource.class, transactionAttributeSource.getClass());
HashMap nameMap = TestUtils.getPropertyValue(transactionAttributeSource, "nameMap", HashMap.class);
HashMap<?, ?> nameMap = TestUtils.getPropertyValue(transactionAttributeSource, "nameMap", HashMap.class);
assertEquals("{*=PROPAGATION_REQUIRES_NEW,ISOLATION_DEFAULT,readOnly}", nameMap.toString());
}

Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2010 the original author or authors.
* Copyright 2002-2013 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.
Expand Down Expand Up @@ -29,6 +29,7 @@
/**
* @author Mark Fisher
* @author Oleg Zhurakousky
* @author Gunnar Hillert
*/
public class MethodInvokingSelectorTests {

Expand All @@ -41,7 +42,7 @@ public void acceptedWithMethodName() {
@Test
public void acceptedWithMethodReference() throws Exception {
TestBean testBean = new TestBean();
Method method = testBean.getClass().getMethod("acceptString", new Class[] { Message.class });
Method method = testBean.getClass().getMethod("acceptString", new Class<?>[] { Message.class });
MethodInvokingSelector selector = new MethodInvokingSelector(testBean, method);
assertTrue(selector.accept(new GenericMessage<String>("should accept")));
}
Expand All @@ -55,7 +56,7 @@ public void rejectedWithMethodName() {
@Test
public void rejectedWithMethodReference() throws Exception {
TestBean testBean = new TestBean();
Method method = testBean.getClass().getMethod("acceptString", new Class[] { Message.class });
Method method = testBean.getClass().getMethod("acceptString", new Class<?>[] { Message.class });
MethodInvokingSelector selector = new MethodInvokingSelector(testBean, method);
assertFalse(selector.accept(new GenericMessage<Integer>(99)));
}
Expand All @@ -69,7 +70,7 @@ public void noArgMethodWithMethodName() {
@Test
public void noArgMethodWithMethodReference() throws Exception {
TestBean testBean = new TestBean();
Method method = testBean.getClass().getMethod("noArgs", new Class[] {});
Method method = testBean.getClass().getMethod("noArgs", new Class<?>[] {});
new MethodInvokingSelector(testBean, method);
}

Expand All @@ -82,7 +83,7 @@ public void voidReturningMethodWithMethodName() {
@Test(expected = IllegalArgumentException.class)
public void voidReturningMethodWithMethodReference() throws Exception {
TestBean testBean = new TestBean();
Method method = testBean.getClass().getMethod("returnVoid", new Class[] { Message.class });
Method method = testBean.getClass().getMethod("returnVoid", new Class<?>[] { Message.class });
MethodInvokingSelector selector = new MethodInvokingSelector(testBean, method);
selector.accept(new GenericMessage<String>("test"));
}
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 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.
Expand All @@ -19,14 +19,12 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;

import java.util.Date;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;

import org.hamcrest.Matchers;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
Expand All @@ -51,6 +49,7 @@
/**
* @author Mark Fisher
* @author Artem Bilan
* @author Gunnar Hillert
* @since 1.0.3
*/
public class DelayHandlerTests {
Expand Down Expand Up @@ -405,7 +404,7 @@ public void testReschedulePersistedMessagesOnStartup() throws Exception {
// Can happen in the parent-child context e.g. Spring-MVC applications
public void testDoubleOnApplicationEvent() throws Exception {
this.delayHandler = Mockito.spy(this.delayHandler);
Mockito.doAnswer(new Answer() {
Mockito.doAnswer(new Answer<Object>() {
public Object answer(InvocationOnMock invocation) throws Throwable {
return null;
}
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2010 the original author or authors.
* Copyright 2002-2013 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.
Expand Down Expand Up @@ -58,6 +58,7 @@ public CompositeFileListFilter<F> addFilter(FileListFilter<F> filter) {
* @return this CompositeFileFilter instance with the added filters
* @see #addFilters(Collection)
*/
@SuppressWarnings("unchecked") //For JDK7
public CompositeFileListFilter<F> addFilters(FileListFilter<F>... filters) {
return addFilters(Arrays.asList(filters));
}
Expand Down
Expand Up @@ -164,10 +164,10 @@ public void testFtpOutboundGatewayInsideChain() throws Exception {
Object payload = result.getPayload();
assertTrue(payload instanceof List<?>);
@SuppressWarnings("unchecked")
List<? extends FileInfo> remoteFiles = (List<? extends FileInfo>) payload;
List<? extends FileInfo<?>> remoteFiles = (List<? extends FileInfo<?>>) payload;
assertEquals(3, remoteFiles.size());
List<String> files = Arrays.asList(new File("remote-test-dir").list());
for (FileInfo remoteFile : remoteFiles) {
for (FileInfo<?> remoteFile : remoteFiles) {
assertTrue(files.contains(remoteFile.getFilename()));
}
}
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2011 the original author or authors.
* Copyright 2002-2013 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.
Expand Down Expand Up @@ -118,10 +118,6 @@ public void onEvent(CqEvent event) {
}
}

/**
* @param event
* @return
*/
private boolean isEventSupported(CqEvent event) {

String eventName = event.getQueryOperation().toString() +
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2011 the original author or authors.
* Copyright 2002-2013 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.
Expand Down Expand Up @@ -75,10 +75,6 @@ public Object doInGemfire(Region region) throws GemFireCheckedException, GemFire
});
}

/**
* @param message
* @return
*/
private Map<Object, Object> parseCacheEntries(Message<?> message) {
if (cacheEntryExpressions.size() == 0) {
return null;
Expand Down
Expand Up @@ -71,10 +71,10 @@ public void referencedScript() throws Exception{
@SuppressWarnings("unchecked")
@Test
public void inlineScript() throws Exception{
Map<String, HeaderEnricher.HeaderValueMessageProcessor> headers =
Map<String, HeaderEnricher.HeaderValueMessageProcessor<?>> headers =
TestUtils.getPropertyValue(headerEnricherWithInlineGroovyScript, "handler.transformer.headersToAdd", Map.class);
assertEquals(1, headers.size());
HeaderEnricher.HeaderValueMessageProcessor headerValueMessageProcessor = headers.get("TEST_HEADER");
HeaderEnricher.HeaderValueMessageProcessor<?> headerValueMessageProcessor = headers.get("TEST_HEADER");
assertThat(headerValueMessageProcessor.getClass().getName(), Matchers.containsString("HeaderEnricher$MessageProcessingHeaderValueMessageProcessor"));
Object targetProcessor = TestUtils.getPropertyValue(headerValueMessageProcessor, "targetProcessor");
assertEquals(GroovyScriptExecutingMessageProcessor.class, targetProcessor.getClass());
Expand Down
Expand Up @@ -142,7 +142,7 @@ public void inlineScript() throws Exception{
//INT-2399
@Test(expected = MessageHandlingException.class)
public void invalidInlineScript() throws Exception {
Message message = new ErrorMessage(new ReplyRequiredException(new GenericMessage<String>("test"), "reply required!"));
Message<?> message = new ErrorMessage(new ReplyRequiredException(new GenericMessage<String>("test"), "reply required!"));
try {
this.invalidInlineScript.send(message);
fail("MessageHandlingException expected!");
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 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.
Expand Down Expand Up @@ -416,9 +416,6 @@ private Message<?> actualDoHandleRequest(HttpServletRequest servletRequest, Http
}
}

/**
* @return
*/
private Message<?> createServiceUnavailableResponse() {
if (logger.isDebugEnabled()) {
logger.debug("Endpoint is shutting down; returning status " + HttpStatus.SERVICE_UNAVAILABLE);
Expand Down
Expand Up @@ -729,7 +729,7 @@ public void compatibleConversionService() throws Exception {
HttpRequestExecutingMessageHandler handler =
new HttpRequestExecutingMessageHandler("http://www.springsource.org/spring-integration");
ConfigurableListableBeanFactory bf = new DefaultListableBeanFactory();
ProxyFactory pf = new ProxyFactory(new Class[] {ConversionService.class, ConverterRegistry.class});
ProxyFactory pf = new ProxyFactory(new Class<?>[] {ConversionService.class, ConverterRegistry.class});
final AtomicInteger converterCount = new AtomicInteger();
pf.addAdvice(new MethodInterceptor() {

Expand Down

0 comments on commit 5bebb98

Please sign in to comment.