コード例 #1
0
  /** @throws Exception If failed. */
  public void testClientService() throws Exception {
    UUID clientNodeId = grid(0).cluster().localNode().id();

    for (int i = 0; i < NODES_CNT; i++) {
      log.info("Iteration: " + i);

      Ignite ignite = grid(i);

      ignite
          .services(ignite.cluster().forClients())
          .deployNodeSingleton(SINGLETON_NAME, new TestService());

      ClusterGroup grp = ignite.cluster();

      assertEquals(NODES_CNT, grp.nodes().size());

      Collection<ServiceDescriptor> srvDscs = ignite.services(grp).serviceDescriptors();

      assertEquals(1, srvDscs.size());

      Map<UUID, Integer> nodesMap = F.first(srvDscs).topologySnapshot();

      assertEquals(1, nodesMap.size());

      for (Map.Entry<UUID, Integer> nodeInfo : nodesMap.entrySet()) {
        assertEquals(clientNodeId, nodeInfo.getKey());

        assertEquals(1, nodeInfo.getValue().intValue());
      }

      ignite.services().cancelAll();
    }
  }
コード例 #2
0
ファイル: GridSelfTest.java プロジェクト: nightwolfzor/ignite
  /** @throws Exception If failed. */
  public void testForOthers() throws Exception {
    ClusterNode node0 = grid(0).localNode();
    ClusterNode node1 = grid(1).localNode();
    ClusterNode node2 = grid(2).localNode();
    ClusterNode node3 = grid(3).localNode();

    ClusterGroup p1 = grid(0).cluster().forOthers(node0);

    assertEquals(3, p1.nodes().size());

    assertEquals(2, p1.forOthers(node1).nodes().size());

    assertEquals(1, p1.forOthers(node1, node2).nodes().size());

    assertEquals(1, grid(0).cluster().forOthers(node1, node2, node3).nodes().size());
  }
コード例 #3
0
ファイル: GridSelfTest.java プロジェクト: nightwolfzor/ignite
  /** {@inheritDoc} */
  @Override
  public void testRemoteProjection() throws Exception {
    ClusterGroup remotePrj = projection().forRemotes();

    int size = remotePrj.nodes().size();

    String name = "oneMoreGrid";

    try {
      Ignite g = startGrid(name);

      UUID joinedId = g.cluster().localNode().id();

      assert remotePrj.nodes().size() == size + 1;

      assert F.nodeIds(remotePrj.nodes()).contains(joinedId);
    } finally {
      stopGrid(name);
    }
  }
コード例 #4
0
 /**
  * @param prj Projection.
  * @return {@link org.apache.ignite.IgniteMessaging} for given projection.
  */
 protected IgniteEvents events(ClusterGroup prj) {
   return prj.ignite().events(prj);
 }
コード例 #5
0
 /**
  * @param prj Projection.
  * @return {@link org.apache.ignite.IgniteMessaging} for given projection.
  */
 protected IgniteMessaging message(ClusterGroup prj) {
   return prj.ignite().message(prj);
 }
コード例 #6
0
 /**
  * @param prj Projection.
  * @return {@link org.apache.ignite.IgniteCompute} for given projection.
  */
 protected IgniteCompute compute(ClusterGroup prj) {
   return prj.ignite().compute(prj);
 }