private static void serialization(XmlGenerator gen, SerializationConfig serialization) {
        gen.open("serialization")
                .node("portable-version", serialization.getPortableVersion())
                .node("use-native-byte-order", serialization.isUseNativeByteOrder())
                .node("byte-order", serialization.getByteOrder())
                .node("enable-compression", serialization.isEnableCompression())
                .node("enable-shared-object", serialization.isEnableSharedObject())
                .node("allow-unsafe", serialization.isAllowUnsafe())
                .node("allow-override-default-serializers", serialization.isAllowOverrideDefaultSerializers())
                .node("check-class-def-errors", serialization.isCheckClassDefErrors());


        Map<Integer, String> dsfClasses = serialization.getDataSerializableFactoryClasses();
        Map<Integer, DataSerializableFactory> dsfImpls = serialization.getDataSerializableFactories();
        if (!dsfClasses.isEmpty() || !dsfImpls.isEmpty()) {
            gen.open("data-serializable-factories");
            for (Map.Entry<Integer, String> entry : dsfClasses.entrySet()) {
                gen.node("data-serializable-factory", entry.getValue(), "factory-id", entry.getKey());
            }
            for (Map.Entry<Integer, DataSerializableFactory> entry : dsfImpls.entrySet()) {
                gen.node("data-serializable-factory",
                        entry.getValue().getClass().getName(), "factory-id", entry.getKey());
            }
            gen.close();
        }

        Map<Integer, String> portableClasses = serialization.getPortableFactoryClasses();
        Map<Integer, PortableFactory> portableImpls = serialization.getPortableFactories();
        if (!portableClasses.isEmpty() || !portableImpls.isEmpty()) {
            gen.open("portable-factories");
            for (Map.Entry<Integer, String> entry : portableClasses.entrySet()) {
                gen.node("portable-factory", entry.getValue(), "factory-id", entry.getKey());
            }
            for (Map.Entry<Integer, PortableFactory> entry : portableImpls.entrySet()) {
                gen.node("portable-factory",
                        entry.getValue().getClass().getName(), "factory-id", entry.getKey());
            }
            gen.close();
        }

        serializers(gen, serialization);

        ConfigXmlGeneratorHelper.compactSerialization(gen, serialization.getCompactSerializationConfig());

        //close serialization
        gen.close();
    }
@Test
    public void serialization() {
        SerializationConfig expected = buildSerializationConfig()
            .addSerializerConfig(new SerializerConfig()
                                     .setClassName(TestSerializer.class.getName()).setTypeClassName(TestType.class.getName()));

        clientConfig.setSerializationConfig(expected);
        SerializationConfig actual = newConfigViaGenerator().getSerializationConfig();

        assertEquals(expected.getPortableVersion(), actual.getPortableVersion());
        assertEquals(expected.isUseNativeByteOrder(), actual.isUseNativeByteOrder());
        assertEquals(expected.getByteOrder(), actual.getByteOrder());
        assertEquals(expected.isEnableCompression(), actual.isEnableCompression());
        assertEquals(expected.isEnableSharedObject(), actual.isEnableSharedObject());
        assertEquals(expected.isAllowUnsafe(), actual.isAllowUnsafe());
        assertEquals(expected.isAllowOverrideDefaultSerializers(), actual.isAllowOverrideDefaultSerializers());
        assertEquals(expected.isCheckClassDefErrors(), actual.isCheckClassDefErrors());
        assertEquals(expected.getGlobalSerializerConfig(), actual.getGlobalSerializerConfig());

        assertCollection(expected.getSerializerConfigs(), actual.getSerializerConfigs());
        assertMap(expected.getDataSerializableFactoryClasses(), actual.getDataSerializableFactoryClasses());
        assertMap(expected.getPortableFactoryClasses(), actual.getPortableFactoryClasses());
    }