use of org.apache.ignite.spi.systemview.view.BinaryMetadataView in project ignite by apache.
the class SystemViewSelfTest method testBinaryMeta.
/**
*/
@Test
public void testBinaryMeta() throws Exception {
try (IgniteEx g = startGrid(0)) {
IgniteCache<Integer, TestObjectAllTypes> c1 = g.createCache("test-cache");
IgniteCache<Integer, TestObjectEnum> c2 = g.createCache("test-enum-cache");
c1.put(1, new TestObjectAllTypes());
c2.put(1, TestObjectEnum.A);
SystemView<BinaryMetadataView> view = g.context().systemView().view(BINARY_METADATA_VIEW);
assertNotNull(view);
assertEquals(2, view.size());
for (BinaryMetadataView meta : view) {
if (TestObjectEnum.class.getName().contains(meta.typeName())) {
assertTrue(meta.isEnum());
assertEquals(0, meta.fieldsCount());
} else {
assertFalse(meta.isEnum());
Field[] fields = TestObjectAllTypes.class.getDeclaredFields();
assertEquals(fields.length, meta.fieldsCount());
for (Field field : fields) assertTrue(meta.fields().contains(field.getName()));
}
}
}
}
Aggregations