Skip to content

Commit be9d735

Browse files
committed
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
1 parent 13bd3e5 commit be9d735

File tree

4 files changed

+47
-44
lines changed

4 files changed

+47
-44
lines changed

build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ ext {
9595
springDataVersion = project.hasProperty('springDataVersion') ? project.springDataVersion : 'Neumann-BUILD-SNAPSHOT'
9696
springSecurityVersion = project.hasProperty('springSecurityVersion') ? project.springSecurityVersion : '5.3.0.BUILD-SNAPSHOT'
9797
springRetryVersion = '1.2.5.RELEASE'
98-
springVersion = project.hasProperty('springVersion') ? project.springVersion : '5.2.2.RELEASE'
98+
springVersion = project.hasProperty('springVersion') ? project.springVersion : '5.2.3.BUILD-SNAPSHOT'
9999
springWsVersion = '3.0.8.RELEASE'
100100
tomcatVersion = "9.0.30"
101101
xstreamVersion = '1.4.11.1'
@@ -473,7 +473,7 @@ project('spring-integration-gemfire') {
473473
api "commons-io:commons-io:$commonsIoVersion"
474474

475475
testImplementation project(':spring-integration-stream')
476-
476+
testRuntimeOnly 'org.apache.logging.log4j:log4j-slf4j-impl'
477477
}
478478
}
479479

spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/inbound/CqInboundChannelAdapterTests.java

+15-16
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -21,36 +21,35 @@
2121
import java.io.IOException;
2222
import java.io.OutputStream;
2323

24+
import org.apache.geode.cache.Region;
2425
import org.apache.geode.cache.query.CqEvent;
25-
import org.apache.geode.internal.cache.LocalRegion;
26-
import org.junit.AfterClass;
27-
import org.junit.BeforeClass;
28-
import org.junit.Test;
29-
import org.junit.runner.RunWith;
26+
import org.junit.jupiter.api.AfterAll;
27+
import org.junit.jupiter.api.BeforeAll;
28+
import org.junit.jupiter.api.Test;
3029

3130
import org.springframework.beans.factory.annotation.Autowired;
31+
import org.springframework.beans.factory.annotation.Qualifier;
3232
import org.springframework.context.ConfigurableApplicationContext;
3333
import org.springframework.integration.gemfire.fork.ForkUtil;
3434
import org.springframework.integration.test.util.TestUtils;
3535
import org.springframework.messaging.Message;
3636
import org.springframework.messaging.PollableChannel;
3737
import org.springframework.test.annotation.DirtiesContext;
38-
import org.springframework.test.context.ContextConfiguration;
39-
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
38+
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
4039

4140
/**
4241
* @author David Turanski
4342
* @author Gary Russell
4443
* @author Artem Bilan
4544
*
4645
*/
47-
@RunWith(SpringJUnit4ClassRunner.class)
48-
@ContextConfiguration
46+
@SpringJUnitConfig
4947
@DirtiesContext
5048
public class CqInboundChannelAdapterTests {
5149

5250
@Autowired
53-
LocalRegion region;
51+
@Qualifier("test")
52+
Region<String, Integer> region;
5453

5554
@Autowired
5655
ConfigurableApplicationContext applicationContext;
@@ -66,13 +65,13 @@ public class CqInboundChannelAdapterTests {
6665

6766
static OutputStream os;
6867

69-
@BeforeClass
70-
public static void startUp() throws Exception {
68+
@BeforeAll
69+
public static void startUp() {
7170
os = ForkUtil.cacheServer();
7271
}
7372

7473
@Test
75-
public void testCqEvent() throws InterruptedException {
74+
public void testCqEvent() {
7675
assertThat(TestUtils.getPropertyValue(withDurable, "durable", Boolean.class)).isTrue();
7776
region.put("one", 1);
7877
Message<?> msg = outputChannel1.receive(10000);
@@ -81,14 +80,14 @@ public void testCqEvent() throws InterruptedException {
8180
}
8281

8382
@Test
84-
public void testPayloadExpression() throws InterruptedException {
83+
public void testPayloadExpression() {
8584
region.put("one", 1);
8685
Message<?> msg = outputChannel2.receive(10000);
8786
assertThat(msg).isNotNull();
8887
assertThat(msg.getPayload()).isEqualTo(1);
8988
}
9089

91-
@AfterClass
90+
@AfterAll
9291
public static void cleanUp() {
9392
sendSignal();
9493
}

spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/inbound/GemfireInboundChannelAdapterTests.java

+14-11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -19,26 +19,26 @@
1919
import static org.assertj.core.api.Assertions.assertThat;
2020

2121
import org.apache.geode.cache.EntryEvent;
22-
import org.apache.geode.internal.cache.LocalRegion;
23-
import org.junit.Test;
24-
import org.junit.runner.RunWith;
22+
import org.apache.geode.cache.Region;
23+
import org.junit.jupiter.api.Test;
2524

2625
import org.springframework.beans.factory.annotation.Autowired;
26+
import org.springframework.beans.factory.annotation.Qualifier;
2727
import org.springframework.messaging.Message;
2828
import org.springframework.messaging.MessageHandler;
2929
import org.springframework.messaging.MessagingException;
3030
import org.springframework.messaging.SubscribableChannel;
3131
import org.springframework.messaging.support.ErrorMessage;
3232
import org.springframework.test.annotation.DirtiesContext;
33-
import org.springframework.test.context.ContextConfiguration;
34-
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
33+
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
3534

3635
/**
3736
* @author David Turanski
37+
* @author Artem Bilan
38+
*
3839
* @since 2.1
3940
*/
40-
@RunWith(SpringJUnit4ClassRunner.class)
41-
@ContextConfiguration
41+
@SpringJUnitConfig
4242
@DirtiesContext
4343
public class GemfireInboundChannelAdapterTests {
4444

@@ -55,13 +55,16 @@ public class GemfireInboundChannelAdapterTests {
5555
SubscribableChannel errorChannel;
5656

5757
@Autowired
58-
LocalRegion region1;
58+
@Qualifier("region1")
59+
Region<String, String> region1;
5960

6061
@Autowired
61-
LocalRegion region2;
62+
@Qualifier("region2")
63+
Region<String, String> region2;
6264

6365
@Autowired
64-
LocalRegion region3;
66+
@Qualifier("region3")
67+
Region<String, String> region3;
6568

6669
@Test
6770
public void testGemfireInboundChannelAdapterWithExpression() {

spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/outbound/GemfireOutboundChannelAdapterTests.java

+16-15
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -21,55 +21,56 @@
2121
import java.util.HashMap;
2222
import java.util.Map;
2323

24-
import org.apache.geode.internal.cache.DistributedRegion;
25-
import org.junit.Before;
26-
import org.junit.Test;
27-
import org.junit.runner.RunWith;
24+
import org.apache.geode.cache.Region;
25+
import org.junit.jupiter.api.BeforeEach;
26+
import org.junit.jupiter.api.Test;
2827

2928
import org.springframework.beans.factory.annotation.Autowired;
29+
import org.springframework.beans.factory.annotation.Qualifier;
3030
import org.springframework.integration.support.MessageBuilder;
3131
import org.springframework.messaging.Message;
3232
import org.springframework.messaging.MessageChannel;
3333
import org.springframework.test.annotation.DirtiesContext;
34-
import org.springframework.test.context.ContextConfiguration;
35-
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
34+
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
3635

3736
/**
3837
* @author David Turanski
3938
* @author Artem Bilan
39+
*
4040
* @since 2.1
4141
*/
4242

43-
@RunWith(SpringJUnit4ClassRunner.class)
44-
@ContextConfiguration
43+
@SpringJUnitConfig
4544
@DirtiesContext
4645
public class GemfireOutboundChannelAdapterTests {
4746

4847
@Autowired
4948
MessageChannel cacheChannel1;
5049

5150
@Autowired
52-
DistributedRegion region1;
51+
@Qualifier("region1")
52+
Region<String, String> region1;
5353

5454
@Autowired
5555
MessageChannel cacheChannel2;
5656

5757
@Autowired
58-
DistributedRegion region2;
58+
@Qualifier("region2")
59+
Region<String, String> region2;
5960

6061
@Autowired
6162
MessageChannel cacheChainChannel;
6263

6364

64-
@Before
65+
@BeforeEach
6566
public void setUp() {
6667
region1.clear();
6768
region2.clear();
6869
}
6970

7071
@Test
7172
public void testWriteMapPayload() {
72-
Map<String, String> map = new HashMap<String, String>();
73+
Map<String, String> map = new HashMap<>();
7374
map.put("foo", "bar");
7475

7576
Message<?> message = MessageBuilder.withPayload(map).build();
@@ -87,9 +88,9 @@ public void testWriteExpressions() {
8788
assertThat(region2.get("foo")).isEqualTo("bar");
8889
}
8990

90-
@Test //INT-2275
91+
@Test
9192
public void testWriteWithinChain() {
92-
Map<String, String> map = new HashMap<String, String>();
93+
Map<String, String> map = new HashMap<>();
9394
map.put("foo", "bar");
9495

9596
Message<?> message = MessageBuilder.withPayload(map).build();

0 commit comments

Comments
 (0)