Package net.jini.core.entry

Examples of net.jini.core.entry.Entry


        if (null == space.take(entry, txn, 0)) {
            throw new TestException(
                    "Could not perform initial take");
        }
        logger.log(Level.INFO, "took entry under txn");
        Entry rslt;
        final long start = System.currentTimeMillis();

        if (useRead) {
            rslt = space.readIfExists(entry, txn, timeOut);
        } else {
View Full Code Here


     * Not valid until <code>setup()</code> is called.
     * @see MatchTestBase#setup
     */
    protected void writeBunch(Class filter) throws Exception {
  for (Iterator i = writeList.iterator(); i.hasNext();) {
      final Entry ent = (Entry) i.next();
     
      if (filter.isInstance(ent)) {
    addOutriggerLease(space.write(ent, null, Lease.ANY), true);
    logger.log(Level.INFO,
         "Wrote " + ent.getClass().getName() + " Entry");
      }
  }
    }
View Full Code Here

        // Register for events
        int count = 0;

        for (Iterator i = writeList.iterator(); i.hasNext();) {
            final Entry toRegister = (Entry) i.next();
            final TemplateGenerator gen = new SuperclassTmplGen(toRegister);

            if (gen != null) {
                Entry tmpl;

                while ((tmpl = gen.next()) != null) {
                    testUtil.registerForNotify(tmpl);
                    logger.log(Level.INFO, "Notify Registration " + ++count);
                }
View Full Code Here

     * Return one entry
     */
    protected Entry getOne() throws TestException {
        try {
            for (Iterator i = writeList.iterator(); i.hasNext();) {
                final Entry ent = (Entry) i.next();
                final String className = ent.getClass().getName();

                // Is it of the right class
                if (className.equals(classToWrite) || className.equals(
                        "com.sun.jini.test.impl.outrigger.matching."
                        + classToWrite)) {
View Full Code Here

    /**
     * Write one entry to the JavaSpace and return the entry.
     */
    protected Entry writeOne() throws TestException {
        try {
            final Entry ent = getOne();
            addOutriggerLease(space.write(ent, null, Lease.ANY), true);
            logger.log(Level.INFO, "Wrote " + classToWrite + " Entry");
            return ent;
        } catch (Exception e) {
            fail("Failure filling JavaSpace with match set", e);
View Full Code Here

     * matches <code>orginalClass</code>.
     */
    protected Entry matchRead(Entry tmpl, Entry orginal, Class orginalClass)
            throws UnusableEntryException, TransactionException,
            InterruptedException, RemoteException, TestException {
        final Entry rdRslt = spaceRead(tmpl, null, queryTimeOut);
        logger.log(Level.INFO, "Attempting to pull out " + orginal + " with the template "
                + tmpl);

        if (rdRslt == null) {
            fail("Was not able to pull all the entries put in, got a "
                    + "null read");
        }

        if (!orginalClass.equals(rdRslt.getClass())) {
            fail("Did not get the right class out of JavaSpace, put in "
                    + orginalClass + " got out " + rdRslt.getClass());
        }
        return rdRslt;
    }
View Full Code Here

            int count = 0;
            List allEntries = ((JavaSpaceAuditor)
                    space).getLoggedEntries(0);

            for (Iterator i = allEntries.iterator(); i.hasNext();) {
                final Entry toPull = (Entry) i.next();
                final Class orginalClass = toPull.getClass();
                final TemplateGenerator gen = new SuperclassTmplGen(toPull);

                if (gen != null) {
                    Entry tmpl;

                    while ((tmpl = gen.next()) != null) {
                        matchRead(tmpl, toPull, orginalClass);
                    }
                }
View Full Code Here

        JavaSpaceAdmin admin = (JavaSpaceAdmin) ((Administrable)
                services[0]).getAdmin();
  admin = (JavaSpaceAdmin) getConfig().prepare("test.outriggerAdminPreparer",
                 admin);
        final AdminIterator i = admin.contents(null, null, 10);
        Entry weGot = i.next();

        while (weGot != null) {
            boolean accounted = false;
            final Template weGotTemplate = new Template(weGot);
            logger.log(Level.INFO, "Got " + weGot + " from the interator");

            for (Iterator k = allEntries.iterator(); k.hasNext();) {
                final Entry weWrote = (Entry) k.next();
                final Template weWroteTemplate = new Template(weWrote);

                if (weWroteTemplate.matchFieldAreEqual(weGotTemplate)) {
                    k.remove();

                    if (deleteAsWeGo) {
                        i.delete();
                    }
                    accounted = true;
                    break;
                }
            }

            /*
             * At this point we have found it in the list of
             * entries we wrote or its not their
             */
            if (!accounted) {
                throw new TestException(
                        "Extra entries in space!");
            }
            weGot = i.next();
        }
        i.close();

        if (!allEntries.isEmpty()) {
            throw new TestException(
                    "Did not get back all the entries we wrote");
        }

        // Check to see if the entries are still their (or not there...)
        if (deleteAsWeGo) {

            // do a null take and complane if we get something back...
            if (spaceTake(null, null, 20000) != null) {
                throw new TestException(
                        "Deleting all the entries with the interator did"
                        + " not work");
            }
        } else {
            for (Iterator j = copyOfAllEntries.iterator(); j.hasNext();) {
                final Entry toPull = (Entry) j.next();

                if (spaceTake(toPull, null, 20000) == null) {
                    throw new TestException(
                            "Could not find one of the entries we wrote "
                            + "after using iterator");
View Full Code Here

            // Take the first one
            if (!i.hasNext()) {
                fail("Auditor clams space is empty");
            }
            Entry e = (Entry) i.next();
            final Entry taken = spaceTake(e, null, queryTimeOut);
            tmplTemplate = new Template(e);
            fromSpaceTemplate = new Template(taken);

            if (!tmplTemplate.matchFieldAreEqual(fromSpaceTemplate)) {
                fail("Take of entry did not yeild exspected entry");
            }
            logger.log(Level.INFO, "Taken " + ++count);

            // Make sure the rest of the entries are still present
            while (i.hasNext()) {
                e = (Entry) i.next();
                final Entry read = spaceRead(e, null, queryTimeOut);
                tmplTemplate = new Template(e);
                fromSpaceTemplate = new Template(read);

                if (!tmplTemplate.matchFieldAreEqual(fromSpaceTemplate)) {
                    throw new TestException("Read of entry did not yield "
View Full Code Here

     *
     * </DL>
     * </DL>
     */
    static Entry pickTemplate(QAConfig config) throws Exception {
        Entry rslt = null;
        final String tmplStr = config.getStringConfigVal("com.sun.jini.qa."
                + "outrigger.matching.FieldMatchTest.template", "null");

        if (tmplStr.equals("null")) {
            rslt = null;
View Full Code Here

TOP

Related Classes of net.jini.core.entry.Entry

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.