Search in sources :

Example 1 with VersionAwareConstructorFunction

use of com.hazelcast.internal.util.VersionAwareConstructorFunction in project hazelcast by hazelcast.

the class ArrayDataSerializableFactoryTest method testCreateWithoutVersion.

@Test
public void testCreateWithoutVersion() {
    ConstructorFunction<Integer, IdentifiedDataSerializable>[] constructorFunctions = new ConstructorFunction[1];
    VersionAwareConstructorFunction function = mock(VersionAwareConstructorFunction.class);
    constructorFunctions[0] = function;
    ArrayDataSerializableFactory factory = new ArrayDataSerializableFactory(constructorFunctions);
    factory.create(0);
    verify(function, times(1)).createNew(0);
    verify(function, times(0)).createNew(eq(0), any(Version.class), any(Version.class));
}
Also used : VersionAwareConstructorFunction(com.hazelcast.internal.util.VersionAwareConstructorFunction) MemberVersion(com.hazelcast.version.MemberVersion) Version(com.hazelcast.version.Version) ConstructorFunction(com.hazelcast.internal.util.ConstructorFunction) VersionAwareConstructorFunction(com.hazelcast.internal.util.VersionAwareConstructorFunction) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 2 with VersionAwareConstructorFunction

use of com.hazelcast.internal.util.VersionAwareConstructorFunction in project hazelcast by hazelcast.

the class ArrayDataSerializableFactoryTest method testCreateWithVersion.

@Test
public void testCreateWithVersion() throws Exception {
    ConstructorFunction<Integer, IdentifiedDataSerializable>[] constructorFunctions = new ConstructorFunction[1];
    VersionAwareConstructorFunction function = mock(VersionAwareConstructorFunction.class);
    constructorFunctions[0] = function;
    ArrayDataSerializableFactory factory = new ArrayDataSerializableFactory(constructorFunctions);
    Version version = MemberVersion.of(3, 6, 0).asVersion();
    Version wanProtocolVersion = MemberVersion.of(1, 0, 0).asVersion();
    factory.create(0, version, wanProtocolVersion);
    verify(function, times(0)).createNew(0);
    verify(function, times(1)).createNew(0, version, wanProtocolVersion);
}
Also used : VersionAwareConstructorFunction(com.hazelcast.internal.util.VersionAwareConstructorFunction) MemberVersion(com.hazelcast.version.MemberVersion) Version(com.hazelcast.version.Version) ConstructorFunction(com.hazelcast.internal.util.ConstructorFunction) VersionAwareConstructorFunction(com.hazelcast.internal.util.VersionAwareConstructorFunction) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

ConstructorFunction (com.hazelcast.internal.util.ConstructorFunction)2 VersionAwareConstructorFunction (com.hazelcast.internal.util.VersionAwareConstructorFunction)2 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)2 QuickTest (com.hazelcast.test.annotation.QuickTest)2 MemberVersion (com.hazelcast.version.MemberVersion)2 Version (com.hazelcast.version.Version)2 Test (org.junit.Test)2