Search in sources :

Example 1 with UpsertCommand

use of org.apache.ignite.internal.table.distributed.command.UpsertCommand in project ignite-3 by apache.

the class PartitionCommandListenerTest method upsert.

/**
 * Upserts rows.
 */
private void upsert() {
    Timestamp ts = Timestamp.nextVersion();
    commandListener.onWrite(iterator((i, clo) -> {
        when(clo.command()).thenReturn(new UpsertCommand(getTestRow(i, i), ts));
        doAnswer(invocation -> {
            assertNull(invocation.getArgument(0));
            return null;
        }).when(clo).result(any());
    }));
}
Also used : DeleteCommand(org.apache.ignite.internal.table.distributed.command.DeleteCommand) BeforeEach(org.junit.jupiter.api.BeforeEach) InsertCommand(org.apache.ignite.internal.table.distributed.command.InsertCommand) DeleteAllCommand(org.apache.ignite.internal.table.distributed.command.DeleteAllCommand) DeleteExactAllCommand(org.apache.ignite.internal.table.distributed.command.DeleteExactAllCommand) GetAndDeleteCommand(org.apache.ignite.internal.table.distributed.command.GetAndDeleteCommand) Row(org.apache.ignite.internal.schema.row.Row) RowAssembler(org.apache.ignite.internal.schema.row.RowAssembler) Mockito.doAnswer(org.mockito.Mockito.doAnswer) CommandClosure(org.apache.ignite.raft.client.service.CommandClosure) RETURNS_DEEP_STUBS(org.mockito.Answers.RETURNS_DEEP_STUBS) GetAllCommand(org.apache.ignite.internal.table.distributed.command.GetAllCommand) Set(java.util.Set) UUID(java.util.UUID) ReplaceCommand(org.apache.ignite.internal.table.distributed.command.ReplaceCommand) Command(org.apache.ignite.raft.client.Command) Test(org.junit.jupiter.api.Test) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) Mockito.any(org.mockito.Mockito.any) NotNull(org.jetbrains.annotations.NotNull) Mockito.mock(org.mockito.Mockito.mock) GetAndReplaceCommand(org.apache.ignite.internal.table.distributed.command.GetAndReplaceCommand) ConcurrentHashMapPartitionStorage(org.apache.ignite.internal.storage.basic.ConcurrentHashMapPartitionStorage) Assertions.assertNotNull(org.junit.jupiter.api.Assertions.assertNotNull) BinaryRow(org.apache.ignite.internal.schema.BinaryRow) UpsertCommand(org.apache.ignite.internal.table.distributed.command.UpsertCommand) Assertions.assertNull(org.junit.jupiter.api.Assertions.assertNull) Function(java.util.function.Function) VersionedRowStore(org.apache.ignite.internal.table.distributed.storage.VersionedRowStore) HashSet(java.util.HashSet) HeapLockManager(org.apache.ignite.internal.tx.impl.HeapLockManager) GetAndUpsertCommand(org.apache.ignite.internal.table.distributed.command.GetAndUpsertCommand) DeleteExactCommand(org.apache.ignite.internal.table.distributed.command.DeleteExactCommand) BiConsumer(java.util.function.BiConsumer) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) ReplaceIfExistCommand(org.apache.ignite.internal.table.distributed.command.ReplaceIfExistCommand) SchemaDescriptor(org.apache.ignite.internal.schema.SchemaDescriptor) Iterator(java.util.Iterator) TxManagerImpl(org.apache.ignite.internal.tx.impl.TxManagerImpl) Mockito.when(org.mockito.Mockito.when) Timestamp(org.apache.ignite.internal.tx.Timestamp) MultiRowsResponse(org.apache.ignite.internal.table.distributed.command.response.MultiRowsResponse) NetworkAddress(org.apache.ignite.network.NetworkAddress) Consumer(java.util.function.Consumer) Mockito(org.mockito.Mockito) NativeTypes(org.apache.ignite.internal.schema.NativeTypes) Column(org.apache.ignite.internal.schema.Column) GetCommand(org.apache.ignite.internal.table.distributed.command.GetCommand) UpsertAllCommand(org.apache.ignite.internal.table.distributed.command.UpsertAllCommand) ClusterService(org.apache.ignite.network.ClusterService) InsertAllCommand(org.apache.ignite.internal.table.distributed.command.InsertAllCommand) SingleRowResponse(org.apache.ignite.internal.table.distributed.command.response.SingleRowResponse) UpsertCommand(org.apache.ignite.internal.table.distributed.command.UpsertCommand) GetAndUpsertCommand(org.apache.ignite.internal.table.distributed.command.GetAndUpsertCommand) Timestamp(org.apache.ignite.internal.tx.Timestamp)

Aggregations

HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1 Set (java.util.Set)1 UUID (java.util.UUID)1 BiConsumer (java.util.function.BiConsumer)1 Consumer (java.util.function.Consumer)1 Function (java.util.function.Function)1 BinaryRow (org.apache.ignite.internal.schema.BinaryRow)1 Column (org.apache.ignite.internal.schema.Column)1 NativeTypes (org.apache.ignite.internal.schema.NativeTypes)1 SchemaDescriptor (org.apache.ignite.internal.schema.SchemaDescriptor)1 Row (org.apache.ignite.internal.schema.row.Row)1 RowAssembler (org.apache.ignite.internal.schema.row.RowAssembler)1 ConcurrentHashMapPartitionStorage (org.apache.ignite.internal.storage.basic.ConcurrentHashMapPartitionStorage)1 DeleteAllCommand (org.apache.ignite.internal.table.distributed.command.DeleteAllCommand)1 DeleteCommand (org.apache.ignite.internal.table.distributed.command.DeleteCommand)1 DeleteExactAllCommand (org.apache.ignite.internal.table.distributed.command.DeleteExactAllCommand)1 DeleteExactCommand (org.apache.ignite.internal.table.distributed.command.DeleteExactCommand)1 GetAllCommand (org.apache.ignite.internal.table.distributed.command.GetAllCommand)1 GetAndDeleteCommand (org.apache.ignite.internal.table.distributed.command.GetAndDeleteCommand)1