protected internal virtual SerializationConfig ParseSerialization(XmlNode node) { var serializationConfig = new SerializationConfig(); foreach (XmlNode child in node.ChildNodes) { string name = CleanNodeName(child); switch (name) { case "portable-version": serializationConfig.SetPortableVersion(GetIntegerValue(name, GetTextContent(child), 0)); break; case "check-class-def-errors": serializationConfig.SetCheckClassDefErrors(CheckTrue(GetTextContent(child))); break; case "use-native-byte-order": serializationConfig.SetUseNativeByteOrder(CheckTrue(GetTextContent(child))); break; case "byte-order": string bigEndian = GetTextContent(child); ByteOrder byteOrder = ByteOrder.GetByteOrder(bigEndian); serializationConfig.SetByteOrder(byteOrder); break; case "enable-compression": serializationConfig.SetEnableCompression(CheckTrue(GetTextContent(child))); break; case "enable-shared-object": serializationConfig.SetEnableSharedObject(CheckTrue(GetTextContent(child))); break; case "data-serializable-factories": FillDataSerializableFactories(child, serializationConfig); break; case "portable-factories": FillPortableFactories(child, serializationConfig); break; case "serializers": FillSerializers(child, serializationConfig); break; } } return(serializationConfig); }
protected internal virtual SerializationConfig ParseSerialization(XmlNode node) { var serializationConfig = new SerializationConfig(); foreach (XmlNode child in node.ChildNodes) { string name = CleanNodeName(child); switch (name) { case "portable-version": serializationConfig.SetPortableVersion(GetIntegerValue(name, GetTextContent(child), 0)); break; case "check-class-def-errors": serializationConfig.SetCheckClassDefErrors(CheckTrue(GetTextContent(child))); break; case "use-native-byte-order": serializationConfig.SetUseNativeByteOrder(CheckTrue(GetTextContent(child))); break; case "byte-order": string bigEndian = GetTextContent(child); ByteOrder byteOrder = ByteOrder.GetByteOrder(bigEndian); serializationConfig.SetByteOrder(byteOrder); break; case "enable-compression": serializationConfig.SetEnableCompression(CheckTrue(GetTextContent(child))); break; case "enable-shared-object": serializationConfig.SetEnableSharedObject(CheckTrue(GetTextContent(child))); break; case "data-serializable-factories": FillDataSerializableFactories(child, serializationConfig); break; case "portable-factories": FillPortableFactories(child, serializationConfig); break; case "serializers": FillSerializers(child, serializationConfig); break; } } return serializationConfig; }
public void TestClassDefinitionConfigWithErrors() { var serializationConfig = new SerializationConfig(); serializationConfig.AddPortableFactory(TestSerializationConstants.PORTABLE_FACTORY_ID, new TestPortableFactory()); serializationConfig.SetPortableVersion(1); serializationConfig.AddClassDefinition( new ClassDefinitionBuilder(TestSerializationConstants.PORTABLE_FACTORY_ID, TestSerializationConstants.RAW_DATA_PORTABLE) .AddLongField("l") .AddCharArrayField("c") .AddPortableField("p", CreateNamedPortableClassDefinition()) .Build()); try { new SerializationServiceBuilder().SetConfig(serializationConfig).Build(); Assert.Fail("Should throw HazelcastSerializationException!"); } catch (HazelcastSerializationException) { } new SerializationServiceBuilder().SetConfig(serializationConfig).SetCheckClassDefErrors(false).Build(); // -- OR -- serializationConfig.SetCheckClassDefErrors(false); new SerializationServiceBuilder().SetConfig(serializationConfig).Build(); }