public void testConfigWithExclude1() throws Exception { setupSerializer(); Properties props = new Properties(); props.put("classes", "com.gemstone.gemfire.pdx.DomainObject#exclude=long.*"); serializer.init(props); assertEquals(3, manager.getFields(DomainObject.class).size()); }
public void testConfigWithExclude2() throws Exception { setupSerializer(); Properties props = new Properties(); props.put("classes", "com.gemstone.gemfire.pdx.DomainObject#exclude=string.* ,"); serializer.init(props); assertEquals(1, manager.getFields(DomainObject.class).size()); }
public void testBasicConfig() throws Exception { setupSerializer(); Properties props = new Properties(); props.put("classes", "com.gemstone.gemfire.pdx.DomainObject"); serializer.init(props); assertEquals(4, manager.getFields(DomainObject.class).size()); }
public void testConfigWithIdentityAndExclude4() throws Exception { setupSerializer(); Properties props = new Properties(); props.put("classes", "com.gemstone.gemfire.pdx.DomainObjectPdxAuto#exclude=string.*, " + "com.gemstone.gemfire.pdx.DomainObjectPdxAuto#exclude=long.*"); serializer.init(props); assertEquals(26, manager.getFields(DomainObjectPdxAuto.class).size()); }
public void testGetConfig() throws Exception { setupSerializer(); Properties props = new Properties(); props.put("classes", "Pdx#exclude=string.*#exclude=badField, Pdx#identity=id.*, PdxAuto#exclude=long.*#identity=id.*"); serializer.init(props); Properties result = serializer.getConfig(); assertEquals("Pdx, PdxAuto, Pdx#identity=id.*, PdxAuto#identity=id.*, Pdx#exclude=string.*, Pdx#exclude=badField, PdxAuto#exclude=long.*", result.getProperty("classes")); manager.resetCaches(); serializer.init(result); result = serializer.getConfig(); assertEquals("Pdx, PdxAuto, Pdx#identity=id.*, PdxAuto#identity=id.*, Pdx#exclude=string.*, Pdx#exclude=badField, PdxAuto#exclude=long.*", result.getProperty("classes")); }
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")); }