Fix Gemfire tests for the latest Spring Data

* Upgrade to SF-5.2.3.BUILD-SNAPSHOT to confirm
that there is no regression in  HTTP module
This commit is contained in:
Artem Bilan
2020-01-07 11:56:36 -05:00
parent 13bd3e5255
commit be9d735c1c
4 changed files with 47 additions and 44 deletions

View File

@@ -95,7 +95,7 @@ ext {
springDataVersion = project.hasProperty('springDataVersion') ? project.springDataVersion : 'Neumann-BUILD-SNAPSHOT'
springSecurityVersion = project.hasProperty('springSecurityVersion') ? project.springSecurityVersion : '5.3.0.BUILD-SNAPSHOT'
springRetryVersion = '1.2.5.RELEASE'
springVersion = project.hasProperty('springVersion') ? project.springVersion : '5.2.2.RELEASE'
springVersion = project.hasProperty('springVersion') ? project.springVersion : '5.2.3.BUILD-SNAPSHOT'
springWsVersion = '3.0.8.RELEASE'
tomcatVersion = "9.0.30"
xstreamVersion = '1.4.11.1'
@@ -473,7 +473,7 @@ project('spring-integration-gemfire') {
api "commons-io:commons-io:$commonsIoVersion"
testImplementation project(':spring-integration-stream')
testRuntimeOnly 'org.apache.logging.log4j:log4j-slf4j-impl'
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 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.
@@ -21,22 +21,21 @@ import static org.assertj.core.api.Assertions.assertThat;
import java.io.IOException;
import java.io.OutputStream;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.query.CqEvent;
import org.apache.geode.internal.cache.LocalRegion;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.integration.gemfire.fork.ForkUtil;
import org.springframework.integration.test.util.TestUtils;
import org.springframework.messaging.Message;
import org.springframework.messaging.PollableChannel;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
/**
* @author David Turanski
@@ -44,13 +43,13 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
* @author Artem Bilan
*
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration
@SpringJUnitConfig
@DirtiesContext
public class CqInboundChannelAdapterTests {
@Autowired
LocalRegion region;
@Qualifier("test")
Region<String, Integer> region;
@Autowired
ConfigurableApplicationContext applicationContext;
@@ -66,13 +65,13 @@ public class CqInboundChannelAdapterTests {
static OutputStream os;
@BeforeClass
public static void startUp() throws Exception {
@BeforeAll
public static void startUp() {
os = ForkUtil.cacheServer();
}
@Test
public void testCqEvent() throws InterruptedException {
public void testCqEvent() {
assertThat(TestUtils.getPropertyValue(withDurable, "durable", Boolean.class)).isTrue();
region.put("one", 1);
Message<?> msg = outputChannel1.receive(10000);
@@ -81,14 +80,14 @@ public class CqInboundChannelAdapterTests {
}
@Test
public void testPayloadExpression() throws InterruptedException {
public void testPayloadExpression() {
region.put("one", 1);
Message<?> msg = outputChannel2.receive(10000);
assertThat(msg).isNotNull();
assertThat(msg.getPayload()).isEqualTo(1);
}
@AfterClass
@AfterAll
public static void cleanUp() {
sendSignal();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 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.
@@ -19,26 +19,26 @@ package org.springframework.integration.gemfire.inbound;
import static org.assertj.core.api.Assertions.assertThat;
import org.apache.geode.cache.EntryEvent;
import org.apache.geode.internal.cache.LocalRegion;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.apache.geode.cache.Region;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageHandler;
import org.springframework.messaging.MessagingException;
import org.springframework.messaging.SubscribableChannel;
import org.springframework.messaging.support.ErrorMessage;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
/**
* @author David Turanski
* @author Artem Bilan
*
* @since 2.1
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration
@SpringJUnitConfig
@DirtiesContext
public class GemfireInboundChannelAdapterTests {
@@ -55,13 +55,16 @@ public class GemfireInboundChannelAdapterTests {
SubscribableChannel errorChannel;
@Autowired
LocalRegion region1;
@Qualifier("region1")
Region<String, String> region1;
@Autowired
LocalRegion region2;
@Qualifier("region2")
Region<String, String> region2;
@Autowired
LocalRegion region3;
@Qualifier("region3")
Region<String, String> region3;
@Test
public void testGemfireInboundChannelAdapterWithExpression() {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 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.
@@ -21,27 +21,26 @@ import static org.assertj.core.api.Assertions.assertThat;
import java.util.HashMap;
import java.util.Map;
import org.apache.geode.internal.cache.DistributedRegion;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.apache.geode.cache.Region;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.integration.support.MessageBuilder;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
/**
* @author David Turanski
* @author Artem Bilan
*
* @since 2.1
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration
@SpringJUnitConfig
@DirtiesContext
public class GemfireOutboundChannelAdapterTests {
@@ -49,19 +48,21 @@ public class GemfireOutboundChannelAdapterTests {
MessageChannel cacheChannel1;
@Autowired
DistributedRegion region1;
@Qualifier("region1")
Region<String, String> region1;
@Autowired
MessageChannel cacheChannel2;
@Autowired
DistributedRegion region2;
@Qualifier("region2")
Region<String, String> region2;
@Autowired
MessageChannel cacheChainChannel;
@Before
@BeforeEach
public void setUp() {
region1.clear();
region2.clear();
@@ -69,7 +70,7 @@ public class GemfireOutboundChannelAdapterTests {
@Test
public void testWriteMapPayload() {
Map<String, String> map = new HashMap<String, String>();
Map<String, String> map = new HashMap<>();
map.put("foo", "bar");
Message<?> message = MessageBuilder.withPayload(map).build();
@@ -87,9 +88,9 @@ public class GemfireOutboundChannelAdapterTests {
assertThat(region2.get("foo")).isEqualTo("bar");
}
@Test //INT-2275
@Test
public void testWriteWithinChain() {
Map<String, String> map = new HashMap<String, String>();
Map<String, String> map = new HashMap<>();
map.put("foo", "bar");
Message<?> message = MessageBuilder.withPayload(map).build();