21
21
import org .junit .Test ;
22
22
import org .junit .runner .RunWith ;
23
23
24
+ import org .apache .geode .cache .CacheListener ;
25
+ import org .apache .geode .cache .CacheLoader ;
26
+ import org .apache .geode .cache .CacheLoaderException ;
24
27
import org .apache .geode .cache .CustomExpiry ;
25
28
import org .apache .geode .cache .DataPolicy ;
26
29
import org .apache .geode .cache .ExpirationAction ;
27
30
import org .apache .geode .cache .ExpirationAttributes ;
31
+ import org .apache .geode .cache .LoaderHelper ;
28
32
import org .apache .geode .cache .Region ;
33
+ import org .apache .geode .cache .util .CacheListenerAdapter ;
34
+ import org .apache .geode .cache .util .CacheWriterAdapter ;
29
35
30
36
import org .springframework .beans .factory .annotation .Autowired ;
31
37
import org .springframework .beans .factory .annotation .Qualifier ;
@@ -69,23 +75,24 @@ public class RegionExpirationAttributesNamespaceIntegrationTests extends Integra
69
75
@ Qualifier ("LocalExample" )
70
76
private Region <?, ?> localExample ;
71
77
72
- private void assertRegionMetaData (final Region <?, ?> region , final String regionName , final DataPolicy dataPolicy ) {
78
+ private void assertRegionMetaData (Region <?, ?> region , String regionName , DataPolicy dataPolicy ) {
73
79
assertRegionMetaData (region , regionName , Region .SEPARATOR + regionName , dataPolicy );
74
80
}
75
81
76
- private void assertRegionMetaData (Region <?, ?> region , String regionName , String regionFullPath ,
77
- DataPolicy dataPolicy ) {
82
+ private void assertRegionMetaData (Region <?, ?> region ,
83
+ String regionName , String regionFullPath , DataPolicy dataPolicy ) {
78
84
79
85
assertThat (region )
80
- .as ( String . format ( "The '%1$ s' Region was not properly configured and initialized" , regionName ) )
86
+ .describedAs ( "The '%s' Region was not properly configured and initialized" , regionName )
81
87
.isNotNull ();
88
+
82
89
assertThat (region .getName ()).isEqualTo (regionName );
83
90
assertThat (region .getFullPath ()).isEqualTo (regionFullPath );
84
91
assertThat (region .getAttributes ()).isNotNull ();
85
92
assertThat (region .getAttributes ().getDataPolicy ()).isEqualTo (dataPolicy );
86
93
}
87
94
88
- private void assertNoExpiration (final ExpirationAttributes expirationAttributes ) {
95
+ private void assertNoExpiration (ExpirationAttributes expirationAttributes ) {
89
96
90
97
if (expirationAttributes != null ) {
91
98
//assertEquals(ExpirationAction.INVALIDATE, expirationAttributes.getAction());
@@ -111,7 +118,7 @@ private void assertCustomExpiry(CustomExpiry<?, ?> customExpiry, String name, in
111
118
}
112
119
113
120
@ Test
114
- public void testReplicateExampleExpirationAttributes () {
121
+ public void exampleReplicateRegionExpirationAttributesAreCorrect () {
115
122
116
123
assertRegionMetaData (replicateExample , "ReplicateExample" , DataPolicy .REPLICATE );
117
124
assertExpirationAttributes (replicateExample .getAttributes ().getEntryTimeToLive (),
@@ -123,7 +130,7 @@ public void testReplicateExampleExpirationAttributes() {
123
130
}
124
131
125
132
@ Test
126
- public void testPreloadedExampleExpirationAttributes () {
133
+ public void examplePreloadedRegionExpirationAttributesAreCorrect () {
127
134
128
135
assertRegionMetaData (preloadedExample , "PreloadedExample" , DataPolicy .PRELOADED );
129
136
assertExpirationAttributes (preloadedExample .getAttributes ().getEntryTimeToLive (),
@@ -134,7 +141,7 @@ public void testPreloadedExampleExpirationAttributes() {
134
141
}
135
142
136
143
@ Test
137
- public void testPartitionExampleExpirationAttributes () {
144
+ public void examplePartitionRegionExpirationAttributesAreCorrect () {
138
145
139
146
assertRegionMetaData (partitionExample , "PartitionExample" , DataPolicy .PARTITION );
140
147
assertExpirationAttributes (partitionExample .getAttributes ().getEntryTimeToLive (),
@@ -146,7 +153,7 @@ public void testPartitionExampleExpirationAttributes() {
146
153
}
147
154
148
155
@ Test
149
- public void testLocalExampleExpirationAttributes () {
156
+ public void exampleLocalRegionExpirationAttributesAreCorrect () {
150
157
151
158
assertRegionMetaData (localExample , "LocalExample" , DataPolicy .NORMAL );
152
159
assertNoExpiration (localExample .getAttributes ().getEntryTimeToLive ());
@@ -157,6 +164,18 @@ public void testLocalExampleExpirationAttributes() {
157
164
60 , ExpirationAction .LOCAL_INVALIDATE );
158
165
}
159
166
167
+ public static class TestCacheListener <K , V > extends CacheListenerAdapter <K , V > { }
168
+
169
+ public static class TestCacheLoader <K , V > implements CacheLoader <K , V > {
170
+
171
+ @ Override
172
+ public V load (LoaderHelper <K , V > loaderHelper ) throws CacheLoaderException {
173
+ return null ;
174
+ }
175
+ }
176
+
177
+ public static class TestCacheWriter <K , V > extends CacheWriterAdapter <K , V > { }
178
+
160
179
public static class TestCustomExpiry <K , V > implements CustomExpiry <K , V > {
161
180
162
181
private ExpirationAction action ;
@@ -172,21 +191,20 @@ public ExpirationAttributes getExpiry(final Region.Entry<K, V> kvEntry) {
172
191
return new ExpirationAttributes (timeout , action );
173
192
}
174
193
175
- public void setAction (final ExpirationAction action ) {
194
+ public void setAction (ExpirationAction action ) {
176
195
this .action = action ;
177
196
}
178
197
179
- public void setName (final String name ) {
198
+ public void setName (String name ) {
180
199
this .name = name ;
181
200
}
182
201
183
- public void setTimeout (final Integer timeout ) {
202
+ public void setTimeout (Integer timeout ) {
184
203
this .timeout = timeout ;
185
204
}
186
205
187
206
@ Override
188
- public void close () {
189
- }
207
+ public void close () { }
190
208
191
209
@ Override
192
210
public String toString () {
0 commit comments