Search in sources :

Example 1 with ReplicatedMapEntryView

use of com.hazelcast.replicatedmap.impl.record.ReplicatedMapEntryView in project hazelcast by hazelcast.

the class AbstractReplicatedMapMergePolicyTest method merge_draw_mergingWins.

@Test
public void merge_draw_mergingWins() {
    ReplicatedMapEntryView existing = entryWithGivenPropertyAndValue(1, EXISTING);
    ReplicatedMapEntryView merging = entryWithGivenPropertyAndValue(1, MERGING);
    assertEquals(MERGING, policy.merge("map", merging, existing));
}
Also used : ReplicatedMapEntryView(com.hazelcast.replicatedmap.impl.record.ReplicatedMapEntryView) Test(org.junit.Test)

Example 2 with ReplicatedMapEntryView

use of com.hazelcast.replicatedmap.impl.record.ReplicatedMapEntryView in project hazelcast by hazelcast.

the class AbstractReplicatedMapMergePolicyTest method merge_mergingWins.

@Test
public void merge_mergingWins() {
    ReplicatedMapEntryView existing = entryWithGivenPropertyAndValue(1, EXISTING);
    ReplicatedMapEntryView merging = entryWithGivenPropertyAndValue(333, MERGING);
    assertEquals(MERGING, policy.merge("map", merging, existing));
}
Also used : ReplicatedMapEntryView(com.hazelcast.replicatedmap.impl.record.ReplicatedMapEntryView) Test(org.junit.Test)

Example 3 with ReplicatedMapEntryView

use of com.hazelcast.replicatedmap.impl.record.ReplicatedMapEntryView in project hazelcast by hazelcast.

the class AbstractReplicatedMapMergePolicyTest method merge_existingWins.

@Test
public void merge_existingWins() {
    ReplicatedMapEntryView existing = entryWithGivenPropertyAndValue(333, EXISTING);
    ReplicatedMapEntryView merging = entryWithGivenPropertyAndValue(1, MERGING);
    assertEquals(EXISTING, policy.merge("map", merging, existing));
}
Also used : ReplicatedMapEntryView(com.hazelcast.replicatedmap.impl.record.ReplicatedMapEntryView) Test(org.junit.Test)

Example 4 with ReplicatedMapEntryView

use of com.hazelcast.replicatedmap.impl.record.ReplicatedMapEntryView in project hazelcast by hazelcast.

the class ReplicatedMapDataSerializerHook method createFactoryInternal.

private static DataSerializableFactory createFactoryInternal() {
    ConstructorFunction<Integer, IdentifiedDataSerializable>[] constructors = new ConstructorFunction[LEN];
    constructors[CLEAR] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        @Override
        public IdentifiedDataSerializable createNew(Integer arg) {
            return new ClearOperation();
        }
    };
    constructors[ENTRY_VIEW] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        @Override
        public IdentifiedDataSerializable createNew(Integer arg) {
            return new ReplicatedMapEntryView();
        }
    };
    constructors[REPLICATE_UPDATE] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        @Override
        public IdentifiedDataSerializable createNew(Integer arg) {
            return new ReplicateUpdateOperation();
        }
    };
    constructors[REPLICATE_UPDATE_TO_CALLER] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        @Override
        public IdentifiedDataSerializable createNew(Integer arg) {
            return new ReplicateUpdateToCallerOperation();
        }
    };
    constructors[PUT_ALL] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        @Override
        public IdentifiedDataSerializable createNew(Integer arg) {
            return new PutAllOperation();
        }
    };
    constructors[PUT] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        @Override
        public IdentifiedDataSerializable createNew(Integer arg) {
            return new PutOperation();
        }
    };
    constructors[REMOVE] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        @Override
        public IdentifiedDataSerializable createNew(Integer arg) {
            return new RemoveOperation();
        }
    };
    constructors[SIZE] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        @Override
        public IdentifiedDataSerializable createNew(Integer arg) {
            return new SizeOperation();
        }
    };
    constructors[MERGE] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        @Override
        public IdentifiedDataSerializable createNew(Integer arg) {
            return new MergeOperation();
        }
    };
    constructors[VERSION_RESPONSE_PAIR] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        @Override
        public IdentifiedDataSerializable createNew(Integer arg) {
            return new VersionResponsePair();
        }
    };
    constructors[GET] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        @Override
        public IdentifiedDataSerializable createNew(Integer arg) {
            return new GetOperation();
        }
    };
    constructors[CHECK_REPLICA_VERSION] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        @Override
        public IdentifiedDataSerializable createNew(Integer arg) {
            return new CheckReplicaVersionOperation();
        }
    };
    constructors[CONTAINS_KEY] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        @Override
        public IdentifiedDataSerializable createNew(Integer arg) {
            return new ContainsKeyOperation();
        }
    };
    constructors[CONTAINS_VALUE] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        @Override
        public IdentifiedDataSerializable createNew(Integer arg) {
            return new ContainsValueOperation();
        }
    };
    constructors[ENTRY_SET] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        @Override
        public IdentifiedDataSerializable createNew(Integer arg) {
            return new EntrySetOperation();
        }
    };
    constructors[EVICTION] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        @Override
        public IdentifiedDataSerializable createNew(Integer arg) {
            return new EvictionOperation();
        }
    };
    constructors[IS_EMPTY] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        @Override
        public IdentifiedDataSerializable createNew(Integer arg) {
            return new IsEmptyOperation();
        }
    };
    constructors[KEY_SET] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        @Override
        public IdentifiedDataSerializable createNew(Integer arg) {
            return new KeySetOperation();
        }
    };
    constructors[REPLICATION] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        @Override
        public IdentifiedDataSerializable createNew(Integer arg) {
            return new ReplicationOperation();
        }
    };
    constructors[REQUEST_MAP_DATA] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        @Override
        public IdentifiedDataSerializable createNew(Integer arg) {
            return new RequestMapDataOperation();
        }
    };
    constructors[SYNC_REPLICATED_DATA] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        @Override
        public IdentifiedDataSerializable createNew(Integer arg) {
            return new SyncReplicatedMapDataOperation();
        }
    };
    constructors[VALUES] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        @Override
        public IdentifiedDataSerializable createNew(Integer arg) {
            return new ValuesOperation();
        }
    };
    constructors[CLEAR_OP_FACTORY] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        @Override
        public IdentifiedDataSerializable createNew(Integer arg) {
            return new ClearOperationFactory();
        }
    };
    constructors[PUT_ALL_OP_FACTORY] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        @Override
        public IdentifiedDataSerializable createNew(Integer arg) {
            return new PutAllOperationFactory();
        }
    };
    constructors[RECORD_MIGRATION_INFO] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        @Override
        public IdentifiedDataSerializable createNew(Integer arg) {
            return new RecordMigrationInfo();
        }
    };
    constructors[HIGHER_HITS_MERGE_POLICY] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        @Override
        public IdentifiedDataSerializable createNew(Integer arg) {
            return HigherHitsMapMergePolicy.INSTANCE;
        }
    };
    constructors[LATEST_UPDATE_MERGE_POLICY] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        @Override
        public IdentifiedDataSerializable createNew(Integer arg) {
            return LatestUpdateMapMergePolicy.INSTANCE;
        }
    };
    constructors[PASS_THROUGH_MERGE_POLICY] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        @Override
        public IdentifiedDataSerializable createNew(Integer arg) {
            return PassThroughMergePolicy.INSTANCE;
        }
    };
    constructors[PUT_IF_ABSENT_MERGE_POLICY] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        @Override
        public IdentifiedDataSerializable createNew(Integer arg) {
            return PutIfAbsentMapMergePolicy.INSTANCE;
        }
    };
    return new ArrayDataSerializableFactory(constructors);
}
Also used : ReplicatedMapEntryView(com.hazelcast.replicatedmap.impl.record.ReplicatedMapEntryView) RecordMigrationInfo(com.hazelcast.replicatedmap.impl.record.RecordMigrationInfo) IdentifiedDataSerializable(com.hazelcast.nio.serialization.IdentifiedDataSerializable) ConstructorFunction(com.hazelcast.util.ConstructorFunction) ArrayDataSerializableFactory(com.hazelcast.internal.serialization.impl.ArrayDataSerializableFactory)

Example 5 with ReplicatedMapEntryView

use of com.hazelcast.replicatedmap.impl.record.ReplicatedMapEntryView in project hazelcast by hazelcast.

the class PassThroughMapMergePolicyTest method merge_mergingNotNull.

@Test
public void merge_mergingNotNull() {
    ReplicatedMapEntryView existing = entryWithGivenValue(EXISTING);
    ReplicatedMapEntryView merging = entryWithGivenValue(MERGING);
    assertEquals(MERGING, policy.merge("map", merging, existing));
}
Also used : ReplicatedMapEntryView(com.hazelcast.replicatedmap.impl.record.ReplicatedMapEntryView) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Aggregations

ReplicatedMapEntryView (com.hazelcast.replicatedmap.impl.record.ReplicatedMapEntryView)9 Test (org.junit.Test)8 ParallelTest (com.hazelcast.test.annotation.ParallelTest)5 QuickTest (com.hazelcast.test.annotation.QuickTest)5 ArrayDataSerializableFactory (com.hazelcast.internal.serialization.impl.ArrayDataSerializableFactory)1 IdentifiedDataSerializable (com.hazelcast.nio.serialization.IdentifiedDataSerializable)1 RecordMigrationInfo (com.hazelcast.replicatedmap.impl.record.RecordMigrationInfo)1 ConstructorFunction (com.hazelcast.util.ConstructorFunction)1