INT-2916 - Upgrade to JUnit 4.11 in support of JDK7

For reference see: https://jira.springsource.org/browse/INT-2916

Changes:

* INT-2919 - Upgrade Spring Data Gemfire to 1.2.2.RELEASE
* Exclude Hamcrest transitive dependency from JUnit (as already explicitly declared)
* Set sourceCompatibility in build.gradle to 1.6
* Set targetCompatibility in build.gradle to 1.6
* Upgrade Hamcrest to 1.3 and fix deprications
  - Corematcher is(*class) change to is(instanceOf(*class))
  - Change org.junit.internal.matchers.TypeSafeMatcher to org.hamcrest.TypeSafeMatcher
  - Change import org.junit.matchers.JUnitMatchers.containsString to org.hamcrest.CoreMatchers.containsString
  - Change import org.junit.matchers.JUnitMatchers.both to org.hamcrest.CoreMatchers.both
  - Change import org.junit.matchers.JUnitMatchers.containsString to org.hamcrest.CoreMatchers.containsString
* Fix JUnit deprecations
  - changed junit.framework.Assert to org.junit.Assert
* Add few missing licenses headers to tests
* Marked several test classes with: @DirtiesContext(classMode=ClassMode.AFTER_EACH_TEST_METHOD)
  - SplitterIntegrationTests
  - GatewayInvokingMessageHandlerTests
  - FileToChannelIntegrationTests
  - FileInboundChannelAdapterWithRecursiveDirectoryTests
  - JdbcMessageStoreChannelTests
  - ChatMessageInboundChannelAdapterParserTests
* 3 Tests ignored (Still needs to be addressed):
  - testOperationOnPrototypeBean
  - testFailOperationWithCustomScope
  - testOperationOfControlBus
* Update SQL script (test-failure):
  - spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/outboundSchema.sql
  - add drop table statements
  - add ignore-failures="DROPS" to "jdbcOutboundChannelAdapterCommonConfig.xml"

INT-2916 - Code Review Changes

INT-2916 - Fix ignored Tests

Fix 3 previously ignored tests in *GroovyControlBusTests*:

* testOperationOnPrototypeBean
* testFailOperationWithCustomScope
* testOperationOfControlBus

INT-2916 - CI Build Testing

INT-2963 - Remove JDK7 Compilation Warnings

* Upgrade Mockito to 1.9.5
* Fix failing SubscribableJmsChannelTests

INT-2916 - Standardize Hamcrest assertions
Ensure Hamcrest assertions are standardized to: is(instanceOf(...))
This commit is contained in:
Gunnar Hillert
2013-02-06 15:51:58 -05:00
committed by Gary Russell
parent 3c98b371fa
commit 0271acaf4c
183 changed files with 1730 additions and 1482 deletions

View File

@@ -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.
@@ -16,8 +16,8 @@
package org.springframework.integration.feed.config;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertTrue;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertSame;
import static org.mockito.Mockito.atLeast;
import static org.mockito.Mockito.spy;
@@ -55,6 +55,7 @@ import com.sun.syndication.fetcher.impl.HttpURLFeedFetcher;
* @author Oleg Zhurakousky
* @author Mark Fisher
* @author Gary Russell
* @author Gunnar Hillert
* @since 2.0
*/
public class FeedInboundChannelAdapterParserTests {
@@ -105,7 +106,7 @@ public class FeedInboundChannelAdapterParserTests {
//Test file samples.rss has 3 news items
latch = spy(new CountDownLatch(3));
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
"FeedInboundChannelAdapterParserTests-file-usage-context.xml", this.getClass());
"FeedInboundChannelAdapterParserTests-file-usage-context.xml", this.getClass());
latch.await(5, TimeUnit.SECONDS);
verify(latch, times(3)).countDown();
context.destroy();
@@ -114,7 +115,7 @@ public class FeedInboundChannelAdapterParserTests {
// in this iteration no new feeds will be received and the latch will timeout
latch = spy(new CountDownLatch(3));
context = new ClassPathXmlApplicationContext(
"FeedInboundChannelAdapterParserTests-file-usage-context.xml", this.getClass());
"FeedInboundChannelAdapterParserTests-file-usage-context.xml", this.getClass());
latch.await(5, TimeUnit.SECONDS);
verify(latch, times(0)).countDown();
context.destroy();
@@ -125,7 +126,7 @@ public class FeedInboundChannelAdapterParserTests {
//Test file samples.rss has 3 news items
latch = spy(new CountDownLatch(3));
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
"FeedInboundChannelAdapterParserTests-file-usage-noid-context.xml", this.getClass());
"FeedInboundChannelAdapterParserTests-file-usage-noid-context.xml", this.getClass());
latch.await(5, TimeUnit.SECONDS);
verify(latch, times(3)).countDown();
context.destroy();
@@ -134,7 +135,7 @@ public class FeedInboundChannelAdapterParserTests {
// in this iteration no new feeds will be received and the latch will timeout
latch = spy(new CountDownLatch(3));
context = new ClassPathXmlApplicationContext(
"FeedInboundChannelAdapterParserTests-file-usage-noid-context.xml", this.getClass());
"FeedInboundChannelAdapterParserTests-file-usage-noid-context.xml", this.getClass());
latch.await(5, TimeUnit.SECONDS);
verify(latch, times(3)).countDown();
context.destroy();
@@ -144,14 +145,14 @@ public class FeedInboundChannelAdapterParserTests {
@Ignore // goes against the real feed
public void validateSuccessfulNewsRetrievalWithHttpUrl() throws Exception{
final CountDownLatch latch = new CountDownLatch(3);
MessageHandler handler = spy(new MessageHandler() {
MessageHandler handler = spy(new MessageHandler() {
public void handleMessage(Message<?> message) throws MessagingException {
latch.countDown();
}
});
ApplicationContext context = new ClassPathXmlApplicationContext(
"FeedInboundChannelAdapterParserTests-http-context.xml", this.getClass());
DirectChannel feedChannel = context.getBean("feedChannel", DirectChannel.class);
DirectChannel feedChannel = context.getBean("feedChannel", DirectChannel.class);
feedChannel.subscribe(handler);
latch.await(5, TimeUnit.SECONDS);
verify(handler, atLeast(3)).handleMessage(Mockito.any(Message.class));
@@ -175,11 +176,11 @@ public class FeedInboundChannelAdapterParserTests {
Properties historyItem = history.get(0);
assertEquals("feedAdapterUsage", historyItem.get("name"));
assertEquals("feed:inbound-channel-adapter", historyItem.get("type"));
historyItem = history.get(1);
assertEquals("feedChannelUsage", historyItem.get("name"));
assertEquals("channel", historyItem.get("type"));
historyItem = history.get(2);
assertEquals("sampleActivator", historyItem.get("name"));
assertEquals("service-activator", historyItem.get("type"));

View File

@@ -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.
@@ -16,8 +16,8 @@
package org.springframework.integration.feed.inbound;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertNull;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import java.io.File;
@@ -99,16 +99,16 @@ public class FeedEntryMessageSourceTests {
SyndEntry entry2 = feedEntrySource.receive().getPayload();
SyndEntry entry3 = feedEntrySource.receive().getPayload();
assertNull(feedEntrySource.receive()); // only 3 entries in the test feed
assertEquals("Spring Integration download", entry1.getTitle().trim());
assertEquals(1266088337000L, entry1.getPublishedDate().getTime());
assertEquals("Check out Spring Integration forums", entry2.getTitle().trim());
assertEquals(1268469501000L, entry2.getPublishedDate().getTime());
assertEquals("Spring Integration adapters", entry3.getTitle().trim());
assertEquals(1272044098000L, entry3.getPublishedDate().getTime());
metadataStore.destroy();
metadataStore.afterPropertiesSet();
@@ -136,16 +136,16 @@ public class FeedEntryMessageSourceTests {
SyndEntry entry2 = feedEntrySource.receive().getPayload();
SyndEntry entry3 = feedEntrySource.receive().getPayload();
assertNull(feedEntrySource.receive()); // only 3 entries in the test feed
assertEquals("Spring Integration download", entry1.getTitle().trim());
assertEquals(1266088337000L, entry1.getPublishedDate().getTime());
assertEquals("Check out Spring Integration forums", entry2.getTitle().trim());
assertEquals(1268469501000L, entry2.getPublishedDate().getTime());
assertEquals("Spring Integration adapters", entry3.getTitle().trim());
assertEquals(1272044098000L, entry3.getPublishedDate().getTime());
// UNLIKE the previous test
// now test that what's been read is read AGAIN
feedEntrySource = new FeedEntryMessageSource(url, this.feedFetcher);
@@ -155,13 +155,13 @@ public class FeedEntryMessageSourceTests {
entry2 = feedEntrySource.receive().getPayload();
entry3 = feedEntrySource.receive().getPayload();
assertNull(feedEntrySource.receive()); // only 3 entries in the test feed
assertEquals("Spring Integration download", entry1.getTitle().trim());
assertEquals(1266088337000L, entry1.getPublishedDate().getTime());
assertEquals("Check out Spring Integration forums", entry2.getTitle().trim());
assertEquals(1268469501000L, entry2.getPublishedDate().getTime());
assertEquals("Spring Integration adapters", entry3.getTitle().trim());
assertEquals(1272044098000L, entry3.getPublishedDate().getTime());
}