Skip to content

Commit 0295bb7

Browse files
author
tmiddleton
committed
Enh 35520698 - [35345719->14.1.1.0.14] ENH: Add cache mbean operation method to get distributed cache back map total size (14.1.1.0 -> ce-14.1.1.0@101355)
[git-p4: depot-paths = "//dev/coherence-ce/release/coherence-ce-v14.1.1.0/": change = 101362]
1 parent 7013b8f commit 0295bb7

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

prj/test/functional/jmx/src/test/java/jmx/StorageManagerMBeanTests.java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import javax.management.ObjectName;
3838

3939
import org.junit.AfterClass;
40+
import org.junit.Assert;
4041
import org.junit.BeforeClass;
4142
import org.junit.Test;
4243

@@ -174,6 +175,35 @@ public void entryDeleted(MapEvent<Integer, Integer> evt)
174175
Eventually.assertDeferred(atomicDelete::get, is(100));
175176
}
176177

178+
/**
179+
* Test StorageManager size() operation.
180+
*/
181+
@Test
182+
public void testSizeOperation()
183+
{
184+
NamedCache<Integer, Integer> cache = getNamedCache("dist-size");
185+
MBeanServer server = MBeanHelper.findMBeanServer();
186+
187+
for (int i = 0; i < 100; i++)
188+
{
189+
cache.put(i, i + 1);
190+
}
191+
assertEquals(100, cache.size());
192+
ObjectName name = getQueryName(cache);
193+
Eventually.assertDeferred(() ->
194+
{
195+
try
196+
{
197+
return (Integer) server.invoke(name, "size", null, null);
198+
}
199+
catch (Exception e)
200+
{
201+
Assert.fail(e.getMessage());
202+
}
203+
return 0;
204+
}, is(100));
205+
}
206+
177207
/**
178208
* Test cache truncate operation.
179209
*
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)