use of org.apache.geode.pdx.internal.EnumInfo.PdxInstanceEnumInfo in project geode by apache.
the class PdxInstanceJUnitTest method testPdxComplexEnum.
public void testPdxComplexEnum() {
PdxInstanceFactory c = PdxInstanceFactoryImpl.newCreator("testPdxEnum", false);
c.writeObject("enumField", MyComplexEnum.ONE);
PdxInstance pi = c.create();
Object f = pi.getField("enumField");
if (f instanceof PdxInstanceEnumInfo) {
PdxInstanceEnumInfo e = (PdxInstanceEnumInfo) f;
assertEquals("ONE", e.getName());
GemFireCacheImpl theCache = GemFireCacheImpl.getForPdx("PDX registry is unavailable because the Cache has been closed.");
theCache.getPdxRegistry().flushCache();
assertEquals(MyComplexEnum.ONE, e.getObject());
} else {
fail("Expected enumField to be a PdxInstanceEnumInfo but it was a " + f.getClass());
}
}
use of org.apache.geode.pdx.internal.EnumInfo.PdxInstanceEnumInfo in project geode by apache.
the class PdxInstanceJUnitTest method testPdxSimpleEnum.
public void testPdxSimpleEnum() {
PdxInstanceFactory c = PdxInstanceFactoryImpl.newCreator("testPdxEnum", false);
c.writeObject("enumField", MyEnum.ONE);
PdxInstance pi = c.create();
Object f = pi.getField("enumField");
if (f instanceof PdxInstanceEnumInfo) {
PdxInstanceEnumInfo e = (PdxInstanceEnumInfo) f;
assertEquals("ONE", e.getName());
GemFireCacheImpl theCache = GemFireCacheImpl.getForPdx("PDX registry is unavailable because the Cache has been closed.");
theCache.getPdxRegistry().flushCache();
assertEquals(MyEnum.ONE, e.getObject());
} else {
fail("Expected enumField to be a PdxInstanceEnumInfo but it was a " + f.getClass());
}
}
Aggregations