use of org.apache.ignite.network.MessagingService in project ignite-3 by apache.
the class TxLocalTest method before.
/**
* Initialize the test state.
*/
@Override
@BeforeEach
public void before() {
ClusterService clusterService = Mockito.mock(ClusterService.class, RETURNS_DEEP_STUBS);
Mockito.when(clusterService.topologyService().localMember().address()).thenReturn(DummyInternalTableImpl.ADDR);
lockManager = new HeapLockManager();
txManager = new TxManagerImpl(clusterService, lockManager);
MessagingService messagingService = MessagingServiceTestUtils.mockMessagingService(txManager);
Mockito.when(clusterService.messagingService()).thenReturn(messagingService);
igniteTransactions = new IgniteTransactionsImpl(txManager);
InternalTable table = new DummyInternalTableImpl(new VersionedRowStore(new ConcurrentHashMapPartitionStorage(), txManager), txManager);
accounts = new TableImpl(table, new DummySchemaManagerImpl(ACCOUNTS_SCHEMA));
InternalTable table2 = new DummyInternalTableImpl(new VersionedRowStore(new ConcurrentHashMapPartitionStorage(), txManager), txManager);
customers = new TableImpl(table2, new DummySchemaManagerImpl(CUSTOMERS_SCHEMA));
}
use of org.apache.ignite.network.MessagingService in project ignite-3 by apache.
the class LozaTest method testLozaStop.
/**
* Checks that the all API methods throw the exception ({@link org.apache.ignite.lang.NodeStoppingException})
* when Loza is closed.
*
* @throws Exception If fail.
*/
@Test
public void testLozaStop() throws Exception {
Mockito.doReturn(new ClusterLocalConfiguration("test_node", null)).when(clusterNetSvc).localConfiguration();
Mockito.doReturn(Mockito.mock(MessagingService.class)).when(clusterNetSvc).messagingService();
Mockito.doReturn(Mockito.mock(TopologyService.class)).when(clusterNetSvc).topologyService();
Loza loza = new Loza(clusterNetSvc, workDir);
loza.start();
loza.beforeNodeStop();
loza.stop();
String raftGroupId = "test_raft_group";
List<ClusterNode> nodes = List.of(new ClusterNode(UUID.randomUUID().toString(), UUID.randomUUID().toString(), NetworkAddress.from("127.0.0.1:123")));
List<ClusterNode> newNodes = List.of(new ClusterNode(UUID.randomUUID().toString(), UUID.randomUUID().toString(), NetworkAddress.from("127.0.0.1:124")), new ClusterNode(UUID.randomUUID().toString(), UUID.randomUUID().toString(), NetworkAddress.from("127.0.0.1:125")));
Supplier<RaftGroupListener> lsnrSupplier = () -> null;
assertThrows(NodeStoppingException.class, () -> loza.updateRaftGroup(raftGroupId, nodes, newNodes, lsnrSupplier));
assertThrows(NodeStoppingException.class, () -> loza.stopRaftGroup(raftGroupId));
assertThrows(NodeStoppingException.class, () -> loza.prepareRaftGroup(raftGroupId, nodes, lsnrSupplier));
assertThrows(NodeStoppingException.class, () -> loza.changePeers(raftGroupId, nodes, newNodes));
}
Aggregations