/** * @return Current baseline. */ private Map<String, BaselineNode> currentBaseLine() { Map<String, BaselineNode> nodes = new HashMap<>(); Collection<BaselineNode> baseline = ignite.cluster().currentBaselineTopology(); if (!F.isEmpty(baseline)) { for (BaselineNode node : baseline) nodes.put(node.consistentId().toString(), node); } return nodes; }
@Override public void run() { try { ignite0.cluster().active(true); } catch (Exception ignore) { // No-op. } } });
/** * Filter server nodes by consistent IDs. * * @param consistentIds Collection of consistent IDs to add. * @throws IllegalStateException In case of some consistent ID not found in nodes collection. */ private Collection<BaselineNode> filterServerNodesByConsId(List<Object> consistentIds) { return filterNodesByConsId(ctx.grid().cluster().forServers().nodes(), consistentIds); } }
/** * @return Cluster nodes. */ private Collection<ClusterNode> nodes() { return grid(0).cluster().nodes(); } }
@Override public boolean apply() { for (int i = 0; i < gridCount(); i++) { if (grid(i).cluster().nodes().size() != gridCount()) return false; } return true; } }, 3000);
/** {@inheritDoc} */ @Override protected void beforeTestsStarted() throws Exception { startGrid(1); startGrid(2); assertEquals(2, grid(1).cluster().nodes().size()); }
/** {@inheritDoc} */ @Override protected void beforeTestsStarted() throws Exception { startGrid(1); startGrid(2); assertEquals(2, grid(1).cluster().nodes().size()); }
/** */ @Test public void testNodeCanJoin() throws Exception { startGrid(GRID_0); startGrid(GRID_3).cluster().active(true); }
@Override public Object call() throws Exception { ignite1.compute(ignite1.cluster().forNode(ignite0.localNode())).call(new IgniteCallable<Object>() { @Override public Object call() throws Exception { jobCtx.setAttribute("test-attr", new BrokenAttribute()); return null; } }); return null; } }, IgniteException.class, null);
/** * @param gridIdx Grid index. * @param key Key. * @return {@code True} if grid is primary for given key. */ private boolean primary(int gridIdx, Object key) { Affinity<Object> aff = grid(0).affinity(CACHE_NAME); return aff.isPrimary(grid(gridIdx).cluster().localNode(), key); }
/** * @throws Exception In case of failure. */ public void testNoIndexes() throws Exception { indexes = Collections.emptyList(); startGrid(); grid().cluster().active(true); populateCache(); checkStat(); checkAll(); checkStat(); }
/** {@inheritDoc} */ @Override protected void beforeTestsStarted() throws Exception { cleanPersistenceDir(); IgniteEx igniteEx = startGrid(0); startGrid(1); igniteEx.cluster().active(true); awaitPartitionMapExchange(); }
/** * @param key Key. */ private void checkAffinityProxyNoCache(Object key) { IgniteEx ignite = grid(0); final Affinity<Object> affinity = ignite.affinity("noCache"); assertFalse("Affinity proxy instance expected", affinity instanceof GridCacheAffinityImpl); final ClusterNode n = ignite.cluster().localNode(); assertAffinityMethodsException(affinity, key, n); }
@Override public Integer call() { assertTrue(ignite.cachex(cctx(queue2).cache().name()).affinity().isPrimaryOrBackup( ignite.cluster().localNode(), "Queue2")); return queue2.take(); } });
/** {@inheritDoc} */ @Override protected void beforeTestsStarted() throws Exception { cleanPersistenceDir(); startGrids(gridCount()); grid(0).cluster().active(true); awaitPartitionMapExchange(); }
/** * @throws Exception If failed. */ @Test public void testOneIgniteNodeIsAlone() throws Exception { startGrid(0); assertEquals(1, grid(0).cluster().metrics().getTotalNodes()); stopAllGrids(); }
/** * @throws Exception If failed. */ @Test public void testDeployService2() throws Exception { helper.clientMode(false); startGrid(0); helper.clientMode(true); startGrid(1); grid(0).services(grid(0).cluster()).deployNodeSingleton("test", new GridCacheAbstractFullApiSelfTest.DummyServiceImpl()); }
/** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { super.beforeTest(); U.resolveWorkDirectory(U.defaultWorkDirectory(), "db", true); startGrids(NODES_COUNT); grid(0).cluster().active(true); actxDflt = grid(0).context().authentication().authenticate(User.DFAULT_USER_NAME, "ignite"); assertNotNull(actxDflt); }
/** * @param client Is joining node client. * @throws Exception If failed. */ private void checkNodeJoinDisabled(boolean client) throws Exception { startGrid(configuration(0, true, false)); startGrid(configuration(1, false, client)); grid(0).cluster().active(true); AuthorizationContext actx = grid(1).context().authentication().authenticate("ignite", "ignite"); assertNotNull(actx); assertEquals("ignite", actx.userName()); }
/** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { super.beforeTest(); U.resolveWorkDirectory(U.defaultWorkDirectory(), "db", true); startGrids(2); grid(0).cluster().active(true); AuthorizationContext.context(grid(0).context().authentication().authenticate("ignite", "ignite")); grid(0).context().authentication().addUser("another_user", "passwd"); AuthorizationContext.clear(); }