Package com.sun.sgs.service

Examples of com.sun.sgs.service.Node


      
        // Now expect to be able to find the identity
        txnScheduler.runTask(
            new TestAbstractKernelRunnable() {
                public void run() throws Exception {
                    Node node = nodeMappingService.getNode(id);
                    // Make sure we got a notification, no old node
                    TestListener listener = nodeListenerMap.get(node.getId());
                    checkIdAdded(listener, id, null);
                }
        }, taskOwner);
    }
View Full Code Here


        nodeMappingService.assignNode(NodeMappingService.class, id);
       
        // Now expect to be able to find the identity
        GetNodeTask task1 = new GetNodeTask(id);
        txnScheduler.runTask(task1, taskOwner);
        Node node1 = task1.getNode();
       
        // There shouldn't be a problem if we assign it twice;  as an
        // optimization we shouldn't call out to the server
        nodeMappingService.assignNode(NodeMappingService.class, id);
        verifyMapCorrect(id);
       
        // Now expect to be able to find the identity
        GetNodeTask task2 = new GetNodeTask(id);
        txnScheduler.runTask(task2, taskOwner);
        Node node2 = task2.getNode();
        assertEquals(node1, node2);
    }
View Full Code Here

        Identity id = new IdentityImpl("first");
        nodeMappingService.assignNode(NodeMappingService.class, id);
       
        GetNodeTask task = new GetNodeTask(id);
        txnScheduler.runTask(task, taskOwner);
        Node node1 = task.getNode();
        txnScheduler.runTask(task, taskOwner);
        Node node2 = task.getNode();
        txnScheduler.runTask(task, taskOwner);
        Node node3 = task.getNode();
        assertEquals(node1, node2);
        assertEquals(node1, node3);
        assertEquals(node2, node3);
    }
View Full Code Here

        nodeMappingService.assignNode(NodeMappingService.class, id1);

        txnScheduler.runTask(
            new TestAbstractKernelRunnable() {
                public void run() throws Exception {
                    Node node = nodeMappingService.getNode(id1);
        Set<Identity> foundSet = new HashSet<Identity>();
                    Iterator<Identity> ids =
                        nodeMappingService.getIdentities(node.getId());
                    while (ids.hasNext()) {
                        foundSet.add(ids.next());
        }
        assertTrue(foundSet.contains(id1));
                }
View Full Code Here

            ids[i] = new IdentityImpl("dummy" + i);
            nodeMappingService.assignNode(NodeMappingService.class, ids[i]);
        }
           
        Set<Node> nodeset = new HashSet<Node>();
        Node nodes[] = new Node[MAX];
         
        for (int j = 0; j < MAX; j++) {
            GetNodeTask task = new GetNodeTask(ids[j]);
            txnScheduler.runTask(task, taskOwner);
            Node n = task.getNode();
            nodes[j] = n;
            nodeset.add(n);
        }
       
        // Set up our own internal node map based on the info above
View Full Code Here

    public void testSetStatusRemove() throws Exception {
        Identity id = new IdentityImpl("first");
        nodeMappingService.assignNode(NodeMappingService.class, id);
        GetNodeTask task = new GetNodeTask(id);
        txnScheduler.runTask(task, taskOwner);
        Node node = task.getNode();
       
        // clear out the listener
        TestListener listener = nodeListenerMap.get(node.getId());
  listener.waitForNotification();
        listener.clear();
        nodeMappingService.setStatus(NodeMappingService.class, id, false);
        listener.waitForNotification(removeTime * 4);
       
View Full Code Here

    public void testSetStatusMultRemove() throws Exception {
        Identity id = new IdentityImpl("first");
        nodeMappingService.assignNode(NodeMappingService.class, id);
        GetNodeTask task = new GetNodeTask(id);
        txnScheduler.runTask(task, taskOwner);
        Node node = task.getNode();
       
        // clear out the listener
        TestListener listener = nodeListenerMap.get(node.getId());
  listener.waitForNotification();
        listener.clear();
        // SetStatus is idempotent:  it doesn't matter how often a particular
        // service says an id is active.
        nodeMappingService.setStatus(NodeMappingService.class, id, true);
View Full Code Here

    public void testSetStatusQuickMultRemove() throws Exception
        Identity id = new IdentityImpl("something");
        nodeMappingService.assignNode(NodeMappingService.class, id);
        GetNodeTask task = new GetNodeTask(id);
        txnScheduler.runTask(task, taskOwner);
        Node node = task.getNode();
       
        // clear out the listener
        TestListener listener = nodeListenerMap.get(node.getId());
  listener.waitForNotification();
        listener.clear();

        // We arrange for the test to fail if there is a WARNING log message
        // in the time period we're interested in.  The threads use an
View Full Code Here

        Identity id = new IdentityImpl("first");
        nodeMappingService.assignNode(NodeMappingService.class, id);

        GetNodeTask task = new GetNodeTask(id);
        txnScheduler.runTask(task, taskOwner);
        Node firstNode = task.getNode();
        long firstNodeId = task.getNodeId();
        TestListener firstNodeListener = nodeListenerMap.get(firstNodeId);
  firstNodeListener.waitForNotification();

        NodeMappingServerImpl server =
            (NodeMappingServerImpl)serverImplField.get(nodeMappingService);
       
        // clear out the listeners
        for (TestListener lis : nodeListenerMap.values()) {
            lis.clear();
        }
        // ... and invoke the method
        moveMethod.invoke(server, id, null, firstNode, firstNodeId);

  firstNodeListener.waitForNotification();
 
  txnScheduler.runTask(task, taskOwner);
  Node secondNode = task.getNode();
        TestListener secondNodeListener =
      nodeListenerMap.get(secondNode.getId());

  secondNodeListener.waitForNotification();

        checkIdMoved(firstNodeListener, firstNode,
                     secondNodeListener, secondNode, id);
View Full Code Here

        Identity id = new IdentityImpl("first");
        nodeMappingService.assignNode(NodeMappingService.class, id);

        GetNodeTask task = new GetNodeTask(id);
        txnScheduler.runTask(task, taskOwner);
        Node firstNode = task.getNode();
        long firstNodeId = task.getNodeId();
        TestListener firstNodeListener = nodeListenerMap.get(firstNodeId);
        TestRelocationListener idListener = moveMap.get(firstNodeId);

  firstNodeListener.waitForNotification();

        NodeMappingServerImpl server =
            (NodeMappingServerImpl)serverImplField.get(nodeMappingService);

        // clear out the listeners
        for (TestListener lis : nodeListenerMap.values()) {
            lis.clear();
        }
        for (TestRelocationListener lis : moveMap.values()) {
            lis.clear();
        }
        // ... and invoke the method
        moveMethod.invoke(server, id, null, firstNode, firstNodeId);

        // Give the id relocation listener a chance to finish, and the
        // actual node assignment to complete.
        idListener.waitForNotification();

        txnScheduler.runTask(task, taskOwner);
        Node secondNode = task.getNode();
        long secondNodeId = task.getNodeId();
        TestListener secondNodeListener =
                nodeListenerMap.get(secondNodeId);

  secondNodeListener.waitForNotification();
View Full Code Here

TOP

Related Classes of com.sun.sgs.service.Node

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.