|
25 | 25 | import org.springframework.data.gemfire.ReplicatedRegionFactoryBean;
|
26 | 26 | import org.springframework.data.gemfire.eventing.config.CacheListenerEventType;
|
27 | 27 | import org.springframework.data.gemfire.eventing.config.EnableEventProcessing;
|
28 |
| -import org.springframework.data.gemfire.eventing.config.RegionCacheListenerEventType; |
29 | 28 |
|
30 | 29 | /**
|
31 | 30 | * Tests for {@link org.springframework.data.gemfire.config.annotation.AsCacheListener} configured for a
|
|
42 | 41 | */
|
43 | 42 | public class AsCacheListenerCacheServerConfigurationTests extends AsCacheListenerConfigurationTests {
|
44 | 43 |
|
45 |
| - protected static ReplicatedRegionFactoryBean<String, String> createRegionFactoryBean(GemFireCache cache, String regionName) { |
| 44 | + protected static ReplicatedRegionFactoryBean<String, String> createRegionFactoryBean(GemFireCache cache, |
| 45 | + String regionName) { |
46 | 46 | ReplicatedRegionFactoryBean<String, String> replicateRegion = new ReplicatedRegionFactoryBean<>();
|
47 | 47 | replicateRegion.setName(regionName);
|
48 | 48 | replicateRegion.setCache(cache);
|
49 | 49 | return replicateRegion;
|
50 | 50 | }
|
51 | 51 |
|
52 |
| - @Override protected Class<?> getCacheListenerWithIncorrectRegionEventParameterConfiguration() { |
| 52 | + @Override |
| 53 | + protected Class<?> getCacheListenerWithIncorrectRegionEventParameterConfiguration() { |
53 | 54 | return TestConfigurationWithIncorrectRegionEventParameter.class;
|
54 | 55 | }
|
55 | 56 |
|
56 |
| - @Override protected Class<TestConfigurationWithSimpleCacheListener> getCacheListenerAnnotationSingleDefaultRegionsConfiguration() { |
| 57 | + @Override |
| 58 | + protected Class<?> getCacheListenerAnnotationSingleDefaultRegionsConfiguration() { |
57 | 59 | return TestConfigurationWithSimpleCacheListener.class;
|
58 | 60 | }
|
59 | 61 |
|
60 |
| - @Override protected Class<TestConfigurationWithInvalidRegion> getCacheListenerAnnotationWithInvalidRegion() { |
| 62 | + @Override |
| 63 | + protected Class<TestConfigurationWithInvalidRegion> getCacheListenerAnnotationWithInvalidRegion() { |
61 | 64 | return TestConfigurationWithInvalidRegion.class;
|
62 | 65 | }
|
63 | 66 |
|
64 |
| - @Override protected Class<TestConfigurationWith2RegionsAnd2CacheListenersDefaulted> getCacheListenerAnnotationMultipleRegionsDefault() { |
| 67 | + @Override |
| 68 | + protected Class<TestConfigurationWith2RegionsAnd2CacheListenersDefaulted> getCacheListenerAnnotationMultipleRegionsDefault() { |
65 | 69 | return TestConfigurationWith2RegionsAnd2CacheListenersDefaulted.class;
|
66 | 70 | }
|
67 | 71 |
|
68 |
| - @Override protected Class<TestConfigurationWithSimpleCacheListenerAllEvents> getCacheListenerAnnotationSingleRegionAllEvents() { |
| 72 | + @Override |
| 73 | + protected Class<?> getCacheListenerAnnotationSingleRegionAllEvents() { |
69 | 74 | return TestConfigurationWithSimpleCacheListenerAllEvents.class;
|
70 | 75 | }
|
71 | 76 |
|
72 |
| - @Override protected Class<TestConfigurationWithSimpleCacheListenerWith2Regions> getCacheListenerAnnotationAgainst2NamedRegions() { |
| 77 | + @Override |
| 78 | + protected Class<?> getCacheListenerAnnotationAgainst2NamedRegions() { |
73 | 79 | return TestConfigurationWithSimpleCacheListenerWith2Regions.class;
|
74 | 80 | }
|
75 | 81 |
|
76 |
| - @Configuration @CacheServerApplication @EnableEventProcessing |
| 82 | + @Configuration |
| 83 | + @CacheServerApplication |
| 84 | + @EnableEventProcessing |
77 | 85 | public static class TestConfigurationWithIncorrectRegionEventParameter {
|
78 | 86 |
|
79 |
| - @Bean("TestRegion1") ReplicatedRegionFactoryBean getTestRegion(GemFireCache cache) { |
| 87 | + @Bean("TestRegion1") |
| 88 | + ReplicatedRegionFactoryBean<String,String> getTestRegion(GemFireCache cache) { |
80 | 89 | return createRegionFactoryBean(cache, "TestRegion1");
|
81 | 90 | }
|
82 | 91 |
|
83 | 92 | @AsCacheListener(eventTypes = CacheListenerEventType.AFTER_CREATE)
|
84 |
| - public void afterCreateListener(RegionEvent event) { |
| 93 | + public void afterCreateListener(RegionEvent<String,String> event) { |
85 | 94 | }
|
86 | 95 | }
|
87 | 96 |
|
88 |
| - @Configuration @CacheServerApplication @EnableEventProcessing |
| 97 | + @Configuration |
| 98 | + @CacheServerApplication |
| 99 | + @EnableEventProcessing |
89 | 100 | public static class TestConfigurationWithSimpleCacheListener {
|
90 | 101 |
|
91 |
| - @Bean("TestRegion1") ReplicatedRegionFactoryBean getTestRegion(GemFireCache cache) { |
| 102 | + @Bean("TestRegion1") |
| 103 | + ReplicatedRegionFactoryBean<String,String> getTestRegion(GemFireCache cache) { |
92 | 104 | return createRegionFactoryBean(cache, "TestRegion1");
|
93 | 105 | }
|
94 | 106 |
|
95 | 107 | @AsCacheListener(eventTypes = CacheListenerEventType.AFTER_CREATE)
|
96 |
| - public void afterCreateListener(EntryEvent event) { |
| 108 | + public void afterCreateListener(EntryEvent<String,String> event) { |
97 | 109 | recordEvent(event);
|
98 | 110 | }
|
99 | 111 |
|
100 | 112 | @AsCacheListener(eventTypes = CacheListenerEventType.AFTER_UPDATE)
|
101 |
| - public void afterUpdateListener(EntryEvent event) { |
| 113 | + public void afterUpdateListener(EntryEvent<String,String> event) { |
102 | 114 | recordEvent(event);
|
103 | 115 |
|
104 | 116 | }
|
105 | 117 | }
|
106 | 118 |
|
107 |
| - @Configuration @CacheServerApplication @EnableEventProcessing |
| 119 | + @Configuration |
| 120 | + @CacheServerApplication |
| 121 | + @EnableEventProcessing |
108 | 122 | public static class TestConfigurationWithInvalidRegion {
|
109 | 123 |
|
110 |
| - @Bean("TestRegion1") ReplicatedRegionFactoryBean getTestRegion(GemFireCache cache) { |
| 124 | + @Bean("TestRegion1") |
| 125 | + ReplicatedRegionFactoryBean<String,String> getTestRegion(GemFireCache cache) { |
111 | 126 | return createRegionFactoryBean(cache, "TestRegion1");
|
112 | 127 | }
|
113 | 128 |
|
114 | 129 | @AsCacheListener(eventTypes = CacheListenerEventType.AFTER_CREATE, regions = "TestRegion2")
|
115 |
| - public void afterCreateListener(EntryEvent event) { |
| 130 | + public void afterCreateListener(EntryEvent<String,String> event) { |
116 | 131 | recordEvent(event);
|
117 | 132 | }
|
118 | 133 |
|
119 | 134 | }
|
120 | 135 |
|
121 |
| - @Configuration @CacheServerApplication @EnableEventProcessing |
| 136 | + @Configuration |
| 137 | + @CacheServerApplication |
| 138 | + @EnableEventProcessing |
122 | 139 | public static class TestConfigurationWithSimpleCacheListenerAllEvents {
|
123 | 140 |
|
124 |
| - @Bean("TestRegion1") ReplicatedRegionFactoryBean getTestRegion(GemFireCache cache) { |
| 141 | + @Bean("TestRegion1") |
| 142 | + ReplicatedRegionFactoryBean<String,String> getTestRegion(GemFireCache cache) { |
125 | 143 | return createRegionFactoryBean(cache, "TestRegion1");
|
126 | 144 | }
|
127 | 145 |
|
128 |
| - @AsCacheListener(eventTypes = CacheListenerEventType.ALL) public void afterCreateListener(EntryEvent event) { |
| 146 | + @AsCacheListener(eventTypes = CacheListenerEventType.ALL) |
| 147 | + public void afterCreateListener(EntryEvent<String,String> event) { |
129 | 148 | recordEvent(event);
|
130 | 149 | }
|
131 | 150 | }
|
132 | 151 |
|
133 |
| - @Configuration @CacheServerApplication @EnableEventProcessing |
| 152 | + @Configuration |
| 153 | + @CacheServerApplication |
| 154 | + @EnableEventProcessing |
134 | 155 | public static class TestConfigurationWithSimpleCacheListenerWith2Regions {
|
135 | 156 |
|
136 |
| - @Bean("TestRegion1") ReplicatedRegionFactoryBean getTestRegion1(GemFireCache cache) { |
| 157 | + @Bean("TestRegion1") |
| 158 | + ReplicatedRegionFactoryBean<String,String> getTestRegion1(GemFireCache cache) { |
137 | 159 | return createRegionFactoryBean(cache, "TestRegion1");
|
138 | 160 | }
|
139 | 161 |
|
140 |
| - @Bean("TestRegion2") ReplicatedRegionFactoryBean getTestRegion2(GemFireCache cache) { |
| 162 | + @Bean("TestRegion2") |
| 163 | + ReplicatedRegionFactoryBean<String,String> getTestRegion2(GemFireCache cache) { |
141 | 164 | return createRegionFactoryBean(cache, "TestRegion2");
|
142 | 165 | }
|
143 | 166 |
|
144 | 167 | @AsCacheListener(eventTypes = CacheListenerEventType.AFTER_CREATE, regions = "TestRegion1")
|
145 |
| - public void afterCreateListener(EntryEvent event) { |
| 168 | + public void afterCreateListener(EntryEvent<String,String> event) { |
146 | 169 | recordEvent(event);
|
147 | 170 | }
|
148 | 171 |
|
149 | 172 | @AsCacheListener(eventTypes = CacheListenerEventType.AFTER_CREATE, regions = "TestRegion2")
|
150 |
| - public void afterUpdateListener(EntryEvent event) { |
| 173 | + public void afterUpdateListener(EntryEvent<String,String> event) { |
151 | 174 | recordEvent(event);
|
152 |
| - |
153 | 175 | }
|
154 | 176 | }
|
155 | 177 |
|
156 |
| - @Configuration @CacheServerApplication @EnableEventProcessing |
| 178 | + @Configuration |
| 179 | + @CacheServerApplication |
| 180 | + @EnableEventProcessing |
157 | 181 | public static class TestConfigurationWith2RegionsAnd2CacheListenersDefaulted {
|
158 | 182 |
|
159 |
| - @Bean("TestRegion1") ReplicatedRegionFactoryBean getTestRegion1(GemFireCache cache) { |
| 183 | + @Bean("TestRegion1") |
| 184 | + ReplicatedRegionFactoryBean<String,String> getTestRegion1(GemFireCache cache) { |
160 | 185 | return createRegionFactoryBean(cache, "TestRegion1");
|
161 | 186 | }
|
162 | 187 |
|
163 |
| - @Bean("TestRegion2") ReplicatedRegionFactoryBean getTestRegion2(GemFireCache cache) { |
| 188 | + @Bean("TestRegion2") |
| 189 | + ReplicatedRegionFactoryBean<String,String> getTestRegion2(GemFireCache cache) { |
164 | 190 | return createRegionFactoryBean(cache, "TestRegion2");
|
165 | 191 | }
|
166 | 192 |
|
167 |
| - @AsCacheListener(eventTypes = CacheListenerEventType.ALL) public void afterCreateListener1(EntryEvent event) { |
| 193 | + @AsCacheListener(eventTypes = CacheListenerEventType.ALL) |
| 194 | + public void afterCreateListener1(EntryEvent<String,String> event) { |
168 | 195 | recordEvent(event);
|
169 | 196 | }
|
170 | 197 |
|
171 |
| - @AsCacheListener(eventTypes = CacheListenerEventType.ALL) public void afterCreateListener2(EntryEvent event) { |
| 198 | + @AsCacheListener(eventTypes = CacheListenerEventType.ALL) |
| 199 | + public void afterCreateListener2(EntryEvent<String,String> event) { |
172 | 200 | recordEvent(event);
|
173 |
| - |
174 | 201 | }
|
175 | 202 | }
|
176 | 203 | }
|
0 commit comments