コード例 #1
0
  @Test
  public void testSerializationConfig() {
    SerializationConfig serializationConfig = config.getSerializationConfig();
    assertEquals(ByteOrder.BIG_ENDIAN, serializationConfig.getByteOrder());
    assertEquals(false, serializationConfig.isCheckClassDefErrors());
    assertEquals(13, serializationConfig.getPortableVersion());

    Map<Integer, String> dataSerializableFactoryClasses =
        serializationConfig.getDataSerializableFactoryClasses();
    assertFalse(dataSerializableFactoryClasses.isEmpty());
    assertEquals(
        DummyDataSerializableFactory.class.getName(), dataSerializableFactoryClasses.get(1));

    Map<Integer, DataSerializableFactory> dataSerializableFactories =
        serializationConfig.getDataSerializableFactories();
    assertFalse(dataSerializableFactories.isEmpty());
    assertEquals(DummyDataSerializableFactory.class, dataSerializableFactories.get(2).getClass());

    Map<Integer, String> portableFactoryClasses = serializationConfig.getPortableFactoryClasses();
    assertFalse(portableFactoryClasses.isEmpty());
    assertEquals(DummyPortableFactory.class.getName(), portableFactoryClasses.get(1));

    Map<Integer, PortableFactory> portableFactories = serializationConfig.getPortableFactories();
    assertFalse(portableFactories.isEmpty());
    assertEquals(DummyPortableFactory.class, portableFactories.get(2).getClass());

    Collection<SerializerConfig> serializerConfigs = serializationConfig.getSerializerConfigs();
    assertFalse(serializerConfigs.isEmpty());

    GlobalSerializerConfig globalSerializerConfig = serializationConfig.getGlobalSerializerConfig();
    assertNotNull(globalSerializerConfig);
    assertEquals(dummySerializer, globalSerializerConfig.getImplementation());
  }
コード例 #2
0
  @Test
  public void testSerializationConfig() {
    final SerializationConfig serializationConfig = clientConfig.getSerializationConfig();
    assertEquals(3, serializationConfig.getPortableVersion());

    final Map<Integer, String> dsClasses = serializationConfig.getDataSerializableFactoryClasses();
    assertEquals(1, dsClasses.size());
    assertEquals("com.hazelcast.examples.DataSerializableFactory", dsClasses.get(1));

    final Map<Integer, String> pfClasses = serializationConfig.getPortableFactoryClasses();
    assertEquals(1, pfClasses.size());
    assertEquals("com.hazelcast.examples.PortableFactory", pfClasses.get(2));

    final Collection<SerializerConfig> serializerConfigs =
        serializationConfig.getSerializerConfigs();
    assertEquals(1, serializerConfigs.size());
    final SerializerConfig serializerConfig = serializerConfigs.iterator().next();

    assertEquals("com.hazelcast.examples.DummyType", serializerConfig.getTypeClassName());
    assertEquals("com.hazelcast.examples.SerializerFactory", serializerConfig.getClassName());

    final GlobalSerializerConfig globalSerializerConfig =
        serializationConfig.getGlobalSerializerConfig();
    assertEquals(
        "com.hazelcast.examples.GlobalSerializerFactory", globalSerializerConfig.getClassName());

    assertEquals(ByteOrder.BIG_ENDIAN, serializationConfig.getByteOrder());
    assertEquals(true, serializationConfig.isCheckClassDefErrors());
    assertEquals(false, serializationConfig.isAllowUnsafe());
    assertEquals(false, serializationConfig.isEnableCompression());
    assertEquals(true, serializationConfig.isEnableSharedObject());
    assertEquals(true, serializationConfig.isUseNativeByteOrder());
  }