Package com.sun.sgs.auth

Examples of com.sun.sgs.auth.Identity


        // Use an exchanger to synchronize between the threads and communicate
        // any problems.
        final Exchanger<AssertionError> errorExchanger =
                new Exchanger<AssertionError>();

        final Identity myOwner = new DummyIdentity("me");
        SimpleTestListener test = new SimpleTestListener(
            new Runnable() {
                public void run() {
                    AssertionError error = null;
                    ProfileReport report = SimpleTestListener.report;
View Full Code Here


        samp.setCapacity(0);
       
        final Exchanger<AssertionError> errorExchanger =
                new Exchanger<AssertionError>();

        final Identity myOwner = new DummyIdentity("me");
        SimpleTestListener test = new SimpleTestListener(
            new Runnable() {
                public void run() {
                    AssertionError error = null;
                    ProfileReport report = SimpleTestListener.report;
View Full Code Here

        systemRegistry, txnProxy);
            TestListener listener = new TestListener();       
            nodemap.addNodeMappingListener(listener);
           
            // We have NOT called ready yet.
            final Identity id = new IdentityImpl("first");
            nodemap.assignNode(NodeMappingService.class, id);
           
            txnScheduler.runTask(
                new TestAbstractKernelRunnable() {
                    public void run() throws Exception {
View Full Code Here

   
    /* -- Test assignNode -- */
    @Test
    public void testAssignNode() throws Exception {  
        // Assign outside a transaction
        final Identity id = new IdentityImpl("first");
        long nodeId =
                nodeMappingService.assignNode(NodeMappingService.class, id);

        if (nodeId < 0) {
            fail("Unexpected assignNode failure");
View Full Code Here

        nodeMappingService.assignNode(NodeMappingService.class, null);
    }
   
    @Test
    public void testAssignNodeTwice() throws Exception {
        Identity id = new IdentityImpl("first");
        nodeMappingService.assignNode(NodeMappingService.class, id);
       
        // Now expect to be able to find the identity
        GetNodeTask task1 = new GetNodeTask(id);
        txnScheduler.runTask(task1, taskOwner);
View Full Code Here

        // This test is partly so I can compare the time it takes to
        // assign one node, or the same node twice
        addNodes(null);
       
        final int MAX = 25;
        Identity ids[] = new Identity[MAX];
        for (int i = 0; i < MAX; i++) {
            ids[i] = new IdentityImpl("identity" + i);        
            nodeMappingService.assignNode(NodeMappingService.class, ids[i]);
               
            verifyMapCorrect(ids[i]);
        }

        for (int j = 0; j < MAX; j++) {
            final Identity id = ids[j];
            txnScheduler.runTask(
                new TestAbstractKernelRunnable() {
                    public void run() throws Exception {
                        nodeMappingService.getNode(id);
                    }
View Full Code Here

        addNodes(null);

        Map<Identity, Long> idMap = new HashMap<Identity, Long>();
        // Assign an identity on each of our nodes
        for (int i = 0; i < NUM_NODES; i++) {
            Identity id = new IdentityImpl("Identity" + i);
            additionalNodes[i].getNodeMappingService().
                                        assignNode(DataService.class, id);
            idMap.put(id, additionalNodes[i].getNodeId());
        }
       
View Full Code Here

            }, taskOwner);
    }
  
    @Test
    public void testGetNode() {
        final Identity id = new IdentityImpl("first");
        nodeMappingService.assignNode(NodeMappingService.class, id);
        try {
            txnScheduler.runTask(
                    new TestAbstractKernelRunnable() {
                        public void run() throws Exception {
View Full Code Here

    // and that any caching of identities in transaction works.
    @Test
    public void testGetNodeMultiple() throws Exception {
        // A better test would have another thread racing to change
        // the identity.
        Identity id = new IdentityImpl("first");
        nodeMappingService.assignNode(NodeMappingService.class, id);
       
        GetNodeTask task = new GetNodeTask(id);
        txnScheduler.runTask(task, taskOwner);
        Node node1 = task.getNode();
View Full Code Here

            }, taskOwner);
    }
  
    @Test
    public void testGetIdentities() throws Exception {
        final Identity id1 = new IdentityImpl("first");
        nodeMappingService.assignNode(NodeMappingService.class, id1);

        txnScheduler.runTask(
            new TestAbstractKernelRunnable() {
                public void run() throws Exception {
View Full Code Here

TOP

Related Classes of com.sun.sgs.auth.Identity

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.