Package net.jini.id

Examples of net.jini.id.Uuid


    public void setup(QAConfig sysConfig) throws Exception {
    }

    public void run() throws Exception {
        Uuid uuid = UuidFactory.create(0,0);
        int counter = 1;

        logger.log(Level.FINE,"=================================");
        logger.log(Level.FINE,"test case " + (counter++) + ": write(null)");
        logger.log(Level.FINE,"");

        try {
            uuid.write(null);
            assertion(false);
        } catch (NullPointerException ignore) {
        }

        for (int i = 0; i < cases.length; i++) {
            logger.log(Level.FINE,"=================================");
            long mostSig = cases[i][0];
            long leastSig = cases[i][1];
            logger.log(Level.FINE,"test case " + (counter++) + ": write("
                + mostSig + "," + leastSig + ")");
            logger.log(Level.FINE,"");

            uuid = UuidFactory.create(mostSig,leastSig);

            // call method and verify the proper result
            ByteArrayOutputStream baos = new ByteArrayOutputStream();

            uuid.write(baos);

            DataInputStream dis = new DataInputStream(
                new ByteArrayInputStream(baos.toByteArray()));
            assertion(mostSig == dis.readLong());
            assertion(leastSig == dis.readLong());
View Full Code Here


        logger.log(Level.FINE,"=================================");
        logger.log(Level.FINE,"test case 2: "
            + "accessor methods return constructor args");
        logger.log(Level.FINE,"");

        Uuid uuid = new FakeUuid(Long.MAX_VALUE,Long.MIN_VALUE);
        assertion(uuid.getMostSignificantBits() == Long.MAX_VALUE);
        assertion(uuid.getLeastSignificantBits() == Long.MIN_VALUE);

        return;
    }
View Full Code Here

        // expectedResult
        Boolean f = Boolean.FALSE;
        Boolean t = Boolean.TRUE;

        // uuids
        Uuid u1 = UuidFactory.create(1,1);
        Uuid u2 = UuidFactory.create(1,2);

        // test cases
        cases = new Object[][] {
            // referentUuid1, referentUuid2, expectedResult
            {null,                      null,                      t},
View Full Code Here

        logger.log(Level.FINE,"=================================");
        logger.log(Level.FINE,"test case " + (counter++) + ": generate()");
        logger.log(Level.FINE,"");

        Uuid uuid1 = UuidFactory.generate();
        mostSig = uuid1.getMostSignificantBits();
        leastSig = uuid1.getLeastSignificantBits();
        assertion((leastSig >>> 62) == 0x2)// variant is 2
        assertion(((mostSig >>> 12 ) & 0x0000000F) == 0x4); // version is 4

        Uuid uuid2 = UuidFactory.generate();
        assertion(uuid1 != uuid2);

        for (int i = 0; i < cases1.length; i++) {
            logger.log(Level.FINE,"=================================");
            mostSig = cases1[i][0];
            leastSig = cases1[i][1];
            logger.log(Level.FINE,"test case " + (counter++) + ": create("
                + mostSig + "," + leastSig + ")");
            logger.log(Level.FINE,"");

            // call method and verify the proper result
            uuid1 = UuidFactory.create(mostSig,leastSig);
            assertion(mostSig == uuid1.getMostSignificantBits());
            assertion(leastSig == uuid1.getLeastSignificantBits());

            uuid2 = UuidFactory.create(uuid1.toString());
            assertion(mostSig == uuid2.getMostSignificantBits());
            assertion(leastSig == uuid2.getLeastSignificantBits());
        }

        for (int j = 0; j < cases2.length; j++) {
            logger.log(Level.FINE,"=================================");
            String uuidString = cases2[j];
View Full Code Here

            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            DataOutputStream dos = new DataOutputStream(baos);
            dos.writeLong(mostSig);
            dos.writeLong(leastSig);

            Uuid uuid = UuidFactory.read(
                new ByteArrayInputStream(baos.toByteArray()));

            assertion(mostSig == uuid.getMostSignificantBits());
            assertion(leastSig == uuid.getLeastSignificantBits());
        }

        return;
    }
View Full Code Here

        logger.log(Level.FINE,"test case 1: "
            + "normal equal hashCode, equals, toString method calls");
        logger.log(Level.FINE,"");

        // construct two instances of Uuid
        Uuid uuid1 = UuidFactory.create(13,11);
        Uuid uuid2 = new FakeUuid(13,11);

        // verify Uuid equals, hashCode, and toString methods
        assertion(uuid1.equals(uuid2));
        assertion(uuid2.equals(uuid1));
        assertion(uuid1.equals(uuid1));
        assertion(uuid2.equals(uuid2));
        assertion(uuid1.hashCode() == uuid2.hashCode());
        assertion(uuid1.toString() != null);
        assertion(uuid1.toString().equals(uuid2.toString()));
        assertion(
            uuid1.toString().equals("00000000-0000-000d-0000-00000000000b"),
            "uuid1.toString(): " + uuid1);

        logger.log(Level.FINE,"=================================");
        logger.log(Level.FINE,"test case 2: "
            + "normal non-equal equals and toString method calls");
        logger.log(Level.FINE,"");

        // construct a third instance of Uuid
        Uuid uuid3 = new FakeUuid(11,13); //reversed bits

        // verify Uuid equals, hashCode, and toString methods
        assertion(! uuid1.equals(uuid3));
        assertion(! uuid3.equals(uuid1));
        assertion(! uuid1.toString().equals(uuid3.toString()));

        return;
    }
View Full Code Here

   *  - ConstrainableLandlordLease (via LandlordProxyVerifier)
         */

  // Server reference from input proxy
        final RemoteMethodControl inputProxyServer;
  final Uuid inputProxyUuid;
        if (obj instanceof ConstrainableSpaceProxy2) {
      final ConstrainableSpaceProxy2 csp = (ConstrainableSpaceProxy2)obj;

      inputProxyUuid = csp.getReferentUuid();
            inputProxyServer = (RemoteMethodControl)csp.space;
View Full Code Here

        readyState.check();
   
  TxnManagerTransaction txntr = null;

  long tid = nextID();
        Uuid uuid = createLeaseUuid(tid);

        if (transactionsLogger.isLoggable(Level.FINEST)) {
            transactionsLogger.log(Level.FINEST,
          "Transaction ID is: {0}", new Long(tid));
  }
View Full Code Here

  }
  TxnManagerTransaction tmt =
          (TxnManagerTransaction) txns.get(key);

  if (tmt == null) {
            Uuid uuid = createLeaseUuid(cookie);
      tmt = new TxnManagerTransaction(
          txnMgrProxy, logmgr, cookie, taskpool,
    taskWakeupMgr, this, uuid);
      noteUnsettledTxn(cookie);
      /* Since only aborted or committed txns are persisted,
View Full Code Here

     * representation does not conform to the specified format 
     * @throws NullPointerException if <code>s</code> is
     * <code>null</code>
     **/   
    public static ServiceID createServiceID(String s) {
  Uuid uuid = UuidFactory.create(s);
  return new ServiceID(uuid.getMostSignificantBits(),
           uuid.getLeastSignificantBits());
    }
View Full Code Here

TOP

Related Classes of net.jini.id.Uuid

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.