Package net.jini.space

Examples of net.jini.space.JavaSpace05.contents()


                               List expectedResult,
                               String testName) throws Exception
    {

        JavaSpace05 space05 = (JavaSpace05) space;
        MatchSet matchSet = space05.contents(templates, txn, leaseDuration,
                                             maxEntries);
        ArrayList result = new ArrayList();
        SimpleEntry entry = (SimpleEntry) matchSet.next();
        while (entry != null) {
            result.add(entry);
View Full Code Here


         * MatchSet.next() method
         */
        JavaSpace05 space05 = (JavaSpace05) space;
        templates.add(sampleEntry1);
        txn = getTransaction();
        MatchSet matchSet = space05.contents(templates, txn, Lease.ANY,
                                             MAX_ENTRIES);
        if (matchSet.next() == null) {
            throw new TestException(
                    "Match set is exhausted. But it shouldn't be.");
        }
View Full Code Here

         * After maxEntries entries are yielded by next invocations the match
         * set becomes empty. For this test case let maxEntries = 2
         */
        templates.add(null);    // for 3 existing entries
        txn = getTransaction();
        matchSet = space05.contents(templates, txn, Lease.ANY, 2);
        matchSet.next();
        matchSet.next();
        if (matchSet.next() != null) {
            throw new TestException("Match set is not empty after maxEntries "
                                    + "are yielded by next invocations");
View Full Code Here

         * The initial duration of the lease must be less than or equal to
         * leaseDuration. Let leaseDuration = instantTime.
         */
        templates.add(null);    // for 3 existing entries
        txn = getTransaction();
        matchSet = space05.contents(templates, txn, leaseForeverTime,
                                    MAX_ENTRIES);
        Lease lease = matchSet.getLease();
        if (lease != null) {
            long initialDuration = lease.getExpiration()
                    - System.currentTimeMillis();
View Full Code Here

        reset();

        //corresponds to item #6 in this method's comments
        txn = getTransaction();
        templates.add((SimpleEntry) sampleEntry1.clone());
        matchSet = space05.contents(templates, txn, leaseForeverTime,
                                    MAX_ENTRIES);
        matchSet.next();
        SimpleEntry entry = (SimpleEntry) space.take(
                (SimpleEntry) sampleEntry1.clone(), null, instantTime);
        if (entry != null) {
View Full Code Here

        //corresponds to item #7 in this method's comments
        txn = getTransaction();
        templates.add((SimpleEntry) sampleEntry1.clone());
        templates.add("not an Entry");
        try {
            space05.contents(templates, txn, Lease.ANY, MAX_ENTRIES);
            throw new TestException("IllegalArgumentException is not thrown "
                                    + "when a non-null element of tepmlates "
                                    + "is not an instance on Entry");
        } catch (IllegalArgumentException e) {}
View Full Code Here

                                    + "is not an instance on Entry");
        } catch (IllegalArgumentException e) {}

        templates.clear();
        try {
            space05.contents(templates, txn, Lease.ANY, MAX_ENTRIES);
            throw new TestException("IllegalArgumentException is not thrown "
                                    + "when templates is empty");
        } catch (IllegalArgumentException e) {}

        templates.add((SimpleEntry) sampleEntry1.clone());
View Full Code Here

                                    + "when templates is empty");
        } catch (IllegalArgumentException e) {}

        templates.add((SimpleEntry) sampleEntry1.clone());
        try {
            space05.contents(templates, txn, 0, MAX_ENTRIES);
            throw new TestException("IllegalArgumentException is not thrown "
                                    + "when leaseDuration is nither positive "
                                    + "nor Lease.ANY (0)");
        } catch (IllegalArgumentException e) {}
View Full Code Here

                                    + "when leaseDuration is nither positive "
                                    + "nor Lease.ANY (0)");
        } catch (IllegalArgumentException e) {}

        try {
            space05.contents(templates, txn, Lease.ANY - 1, MAX_ENTRIES);
            throw new TestException("IllegalArgumentException is not thrown "
                                    + "when leaseDuration is nither positive "
                                    + "nor Lease.ANY (Lease.ANY-1)");
        } catch (IllegalArgumentException e) {}
View Full Code Here

                                    + "when leaseDuration is nither positive "
                                    + "nor Lease.ANY (Lease.ANY-1)");
        } catch (IllegalArgumentException e) {}

        try {
            space05.contents(templates, txn, Lease.ANY, 0);
            throw new TestException("IllegalArgumentException is not thrown "
                                    + "when maxEntries is non-positive (0)");
        } catch (IllegalArgumentException e) {}

        try {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.