public void testConfigWithIdentity1() throws Exception { setupSerializer(); Properties props = new Properties(); props.put("classes", "com.gemstone.gemfire.pdx.DomainObjectPdxAuto#identity=long.*"); serializer.init(props); DomainObject objOut = new DomainObjectPdxAuto(4); objOut.set("string_0", "test string value"); objOut.set("long_0", 99L); HeapDataOutputStream out = new HeapDataOutputStream(Version.CURRENT); DataSerializer.writeObject(objOut, out); PdxInstance pdxIn = DataSerializer.readObject(new DataInputStream( new ByteArrayInputStream(out.toByteArray()))); assertEquals(99L, pdxIn.getField("long_0")); assertTrue(pdxIn.isIdentityField("long_0")); }
public void testConfigWithIdentityAndExclude1() throws Exception { setupSerializer(); Properties props = new Properties(); props.put("classes", "com.gemstone.gemfire.pdx.DomainObjectPdxAuto#identity=long.*#exclude=string.*"); serializer.init(props); assertEquals(27, manager.getFields(DomainObjectPdxAuto.class).size()); DomainObject objOut = new DomainObjectPdxAuto(4); objOut.set("string_0", "test string value"); objOut.set("long_0", 99L); HeapDataOutputStream out = new HeapDataOutputStream(Version.CURRENT); DataSerializer.writeObject(objOut, out); PdxInstance pdxIn = DataSerializer.readObject(new DataInputStream( new ByteArrayInputStream(out.toByteArray()))); // This means we're not doing anything with this string assertNull(pdxIn.getField("string_0")); assertTrue(pdxIn.isIdentityField("long_0")); }
public void testConfigWithIdentityAndExclude3() throws Exception { setupSerializer(); Properties props = new Properties(); props.put("classes", "com.gemstone.gemfire.pdx.DomainObjectPdxAuto#identity=long.*#exclude=string.*, com.another.class.Foo"); serializer.init(props); assertEquals(27, manager.getFields(DomainObjectPdxAuto.class).size()); DomainObject objOut = new DomainObjectPdxAuto(4); objOut.set("string_0", "test string value"); objOut.set("long_0", 99L); HeapDataOutputStream out = new HeapDataOutputStream(Version.CURRENT); DataSerializer.writeObject(objOut, out); PdxInstance pdxIn = DataSerializer.readObject(new DataInputStream( new ByteArrayInputStream(out.toByteArray()))); // This means we're not doing anything with this string assertNull(pdxIn.getField("string_0")); assertTrue(pdxIn.isIdentityField("long_0")); }
public void testConfigWithIdentityAndExclude2() throws Exception { setupSerializer(); Properties props = new Properties(); props.put("classes", "com.gemstone.gemfire.pdx.DomainObjectPdxAuto#identity=long.*#exclude=string.*#, com.another.class.Foo"); serializer.init(props); assertEquals(27, manager.getFields(DomainObjectPdxAuto.class).size()); DomainObject objOut = new DomainObjectPdxAuto(4); objOut.set("string_0", "test string value"); objOut.set("long_0", 99L); HeapDataOutputStream out = new HeapDataOutputStream(Version.CURRENT); DataSerializer.writeObject(objOut, out); PdxInstance pdxIn = DataSerializer.readObject(new DataInputStream( new ByteArrayInputStream(out.toByteArray()))); // This means we're not doing anything with this string assertNull(pdxIn.getField("string_0")); assertTrue(pdxIn.isIdentityField("long_0")); }