Package com.sun.jini.test.spec.javaspace.conformance

Examples of com.sun.jini.test.spec.javaspace.conformance.SimpleEntry


     *
     * <P>Notes:<BR>For more information see the JavaSpaces specification
     * sections 2.3, 2.6.</P>
     */
    public void run() throws Exception {
        SimpleEntry sampleEntry1 = new SimpleEntry("TestEntry #1", 1);
        SimpleEntry sampleEntry2 = new SimpleEntry("TestEntry #2", 2);
        Entry snapshot1;
        Entry snapshot2;
        SimpleEntry origEntry1;
        SimpleEntry origEntry2;
        SimpleEntry result;

        // first check that space is empty
        if (!checkSpace(space)) {
            throw new TestException(
                    "Space is not empty in the beginning.");
View Full Code Here


     *
     * <P>Notes:<BR>For more information see the JavaSpaces specification
     * sections 2.6, 3.1.</P>
     */
    public void run() throws Exception {
        SimpleEntry sampleEntry = new SimpleEntry("TestEntry #1", 1);
        Entry snapshot;
        SimpleEntry result;
        Transaction txn1, txn2;

        // first check that space is empty
        if (!checkSpace(space)) {
            throw new TestException(
View Full Code Here

     *
     * <P>Notes:<BR>For more information see the JavaSpaces specification
     * sections 2.3, 2.6.</P>
     */
    public void run() throws Exception {
        SimpleEntry sampleEntry1 = new SimpleEntry("TestEntry #1", 1);
        SimpleEntry sampleEntry2 = new SimpleEntry("TestEntry #2", 2);
        Entry snapshot1;
        Entry snapshot2;
        SimpleEntry result;
        long curTime1;
        long curTime2;
        long expirTime1;
        long expirTime2;
        long leaseTime1 = timeout1;
View Full Code Here

        SnapshotNotifyCounter[] ncs = new SnapshotNotifyCounter[12];
        EventRegistration er;
        long[] leaseMatrix = new long[] {
            -199, -5000, -13999, Long.MIN_VALUE, -2, Long.MIN_VALUE, -345,
            -8999, -15000, -16000000, Long.MIN_VALUE, -3 };
        SimpleEntry sampleEntry1 = new SimpleEntry("TestEntry #1", 1);
        SimpleEntry sampleEntry2 = new SimpleEntry("TestEntry #2", 2);
        SimpleEntry sampleEntry3 = new SimpleEntry("TestEntry #1", 2);
        SimpleEntry template;
        Transaction txn;

        // first check that space is empty
        if (!checkSpace(space)) {
            throw new TestException(
                    "Space is not empty in the beginning.");
        }

        // create the non null transaction
        txn = getTransaction();

        /*
         * init 3 RemoteEvent counters for snapshot for each
         * of sample entries
         */
        ncs[0] = new SnapshotNotifyCounter(sampleEntry1, leaseMatrix[0],
                space);
        ncs[1] = new SnapshotNotifyCounter(sampleEntry2, leaseMatrix[1],
                space);
        ncs[2] = new SnapshotNotifyCounter(sampleEntry3, leaseMatrix[2],
                space);

        // init 5 counters with snapshots of wrong templates
        template = new SimpleEntry("TestEntry #3", 1);
        ncs[3] = new SnapshotNotifyCounter(template, leaseMatrix[3], space);

        // 2-nd wrong template
        template = new SimpleEntry("TestEntry #1", 3);
        ncs[4] = new SnapshotNotifyCounter(template, leaseMatrix[4], space);

        // 3-rd wrong template
        template = new SimpleEntry("TestEntry #3", 3);
        ncs[5] = new SnapshotNotifyCounter(template, leaseMatrix[5], space);

        // 4-th wrong template
        template = new SimpleEntry(null, 3);
        ncs[6] = new SnapshotNotifyCounter(template, leaseMatrix[6], space);

        // 5-th wrong template
        template = new SimpleEntry("TestEntry #3", null);
        ncs[7] = new SnapshotNotifyCounter(template, leaseMatrix[7], space);

        // init counter with snapshot of null entry as a template
        ncs[8] = new SnapshotNotifyCounter(null, leaseMatrix[8], space);

        /*
         * init 3 counters with snapshots for templates with null values
         * for different fields
         */
        template = new SimpleEntry("TestEntry #1", null);
        ncs[9] = new SnapshotNotifyCounter(template, leaseMatrix[9], space);

        // snapshot of 2-nd template
        template = new SimpleEntry(null, 2);
        ncs[10] = new SnapshotNotifyCounter(template, leaseMatrix[10],
                space);

        // snapshot 3-rd template
        template = new SimpleEntry(null, null);
        ncs[11] = new SnapshotNotifyCounter(template, leaseMatrix[11],
                space);

        // try to register them
        for (int i = 0; i < 12; i++) {
View Full Code Here

     *
     * <P>Notes:<BR>For more information see the JavaSpaces specification
     * sections 2.6, 3.1</P>
     */
    public void run() throws Exception {
        SimpleEntry sampleEntry1 = new SimpleEntry("TestEntry #1", 1);
        SimpleEntry sampleEntry2 = new SimpleEntry("TestEntry #2", 2);
        Entry snapshot1;
        Entry snapshot2;
        SimpleEntry result;
        Transaction txn;
        long leaseTime = timeout2;

        // first check that space is empty
        if (!checkSpace(space)) {
View Full Code Here

     *
     * <P>Notes:<BR>For more information see the JavaSpaces specification
     * sections 2.4, 2.6.</P>
     */
    public void run() throws Exception {
        SimpleEntry sampleEntry1 = new SimpleEntry("TestEntry #1", 1);
        SimpleEntry sampleEntry2 = new SimpleEntry("TestEntry #2", 2);
        SimpleEntry sampleEntry3 = new SimpleEntry("TestEntry #1", 2);
        SimpleEntry template;
        Transaction txn;
        String msg;

        // first check that space is empty
        if (!checkSpace(space)) {
            throw new TestException("Space is not empty in the beginning.");
        }

        // write three sample entries twice to the space
        space.write(sampleEntry1, null, leaseForeverTime);
        space.write(sampleEntry1, null, leaseForeverTime);
        space.write(sampleEntry2, null, leaseForeverTime);
        space.write(sampleEntry2, null, leaseForeverTime);
        space.write(sampleEntry3, null, leaseForeverTime);
        space.write(sampleEntry3, null, leaseForeverTime);

        // create the non null transaction
        txn = getTransaction();

        /*
         * read 1-st entry from the space using snapshot of the same one as
         * a template with JavaSpace.NO_WAIT timeout within the transaction
         */
        msg = testTemplate(sampleEntry1, txn, JavaSpace.NO_WAIT, 0, false);

        if (msg != null) {
            throw new TestException(msg);
        }

        /*
         * read sample entry from the space using snapshots of
         * wrong template entries and JavaSpace.NO_WAIT timeout
         * within the transaction
         */
        template = new SimpleEntry("TestEntry #3", 1);
        msg = testWrongTemplate(template, txn, JavaSpace.NO_WAIT, 0, false);

        if (msg != null) {
            throw new TestException(msg);
        }

        // 2-nd wrong template
        template = new SimpleEntry("TestEntry #1", 3);
        msg = testWrongTemplate(template, txn, JavaSpace.NO_WAIT, 0, false);

        if (msg != null) {
            throw new TestException(msg);
        }

        // 3-rd wrong template
        template = new SimpleEntry("TestEntry #3", 3);
        msg = testWrongTemplate(template, txn, JavaSpace.NO_WAIT, 0, false);

        if (msg != null) {
            throw new TestException(msg);
        }

        // 4-th wrong template
        template = new SimpleEntry(null, 3);
        msg = testWrongTemplate(template, txn, JavaSpace.NO_WAIT, 0, false);

        if (msg != null) {
            throw new TestException(msg);
        }

        // 5-th wrong template
        template = new SimpleEntry("TestEntry #3", null);
        msg = testWrongTemplate(template, txn, JavaSpace.NO_WAIT, 0, false);

        if (msg != null) {
            throw new TestException(msg);
        }

        /*
         * read entry from the space using snapshot of null as a template
         * and JavaSpace.NO_WAIT timeout within the transaction
         */
        msg = testTemplate(null, txn, JavaSpace.NO_WAIT, 0, false);

        if (msg != null) {
            throw new TestException(msg);
        }

        /*
         * read sample entries from the space using snapshots of templates
         * with null as a wildcard for different fields
         * and JavaSpace.NO_WAIT timeout within the transaction
         */
        template = new SimpleEntry("TestEntry #1", null);
        msg = testTemplate(template, txn, JavaSpace.NO_WAIT, 0, false);

        if (msg != null) {
            throw new TestException(msg);
        }

        // try 2-nd template
        template = new SimpleEntry(null, 2);
        msg = testTemplate(template, txn, JavaSpace.NO_WAIT, 0, false);

        if (msg != null) {
            throw new TestException(msg);
        }

        // 3-rd template
        template = new SimpleEntry(null, null);
        msg = testTemplate(template, txn, JavaSpace.NO_WAIT, 0, false);

        if (msg != null) {
            throw new TestException(msg);
        }
View Full Code Here

     *
     * <P>Notes:<BR>For more information see the JavaSpaces specification
     * sections 2.4, 2.6.</P>
     */
    public void run() throws Exception {
        SimpleEntry sampleEntry1 = new SimpleEntry("TestEntry #1", 1);
        SimpleEntry sampleEntry2 = new SimpleEntry("TestEntry #2", 2);
        Entry snapshot1;
        SimpleEntry result;
        long curTime1;
        long curTime2;
        Transaction txn;
        long timeout = leaseForeverTime;
        long leaseTime;
View Full Code Here

     *
     * <P>Notes:<BR>For more information see the JavaSpaces specification
     * sections 2.4, 2.6.</P>
     */
    public void run() throws Exception {
        SimpleEntry sampleEntry1 = new SimpleEntry("TestEntry #1", 1);
        SimpleEntry sampleEntry2 = new SimpleEntry("TestEntry #2", 2);
        SimpleEntry sampleEntry3 = new SimpleEntry("TestEntry #1", 2);
        SimpleEntry template;
        String msg;

        // first check that space is empty
        if (!checkSpace(space)) {
            throw new TestException("Space is not empty in the beginning.");
        }

        // write three sample entries twice to the space
        space.write(sampleEntry1, null, leaseForeverTime);
        space.write(sampleEntry1, null, leaseForeverTime);
        space.write(sampleEntry2, null, leaseForeverTime);
        space.write(sampleEntry2, null, leaseForeverTime);
        space.write(sampleEntry3, null, leaseForeverTime);
        space.write(sampleEntry3, null, leaseForeverTime);

        /*
         * readIfExists 1-st entry from the space using snapshot of
         * the same one as a template
         */
        msg = testTemplate(sampleEntry1, null, Long.MAX_VALUE, 0, true);

        if (msg != null) {
            throw new TestException(msg);
        }

        /*
         * readIfExists sample entry from the space using snapshots of
         * wrong template entries
         */
        template = new SimpleEntry("TestEntry #3", 1);
        msg = testWrongTemplate(template, null, checkTime, 0, true);

        if (msg != null) {
            throw new TestException(msg);
        }

        // 2-nd wrong template
        template = new SimpleEntry("TestEntry #1", 3);
        msg = testWrongTemplate(template, null, timeout1, 0, true);

        if (msg != null) {
            throw new TestException(msg);
        }

        // 3-rd wrong template
        template = new SimpleEntry("TestEntry #3", 3);
        msg = testWrongTemplate(template, null, timeout2, 0, true);

        if (msg != null) {
            throw new TestException(msg);
        }

        // 4-th wrong template
        template = new SimpleEntry(null, 3);
        msg = testWrongTemplate(template, null, checkTime, 0, true);

        if (msg != null) {
            throw new TestException(msg);
        }

        // 5-th wrong template
        template = new SimpleEntry("TestEntry #3", null);
        msg = testWrongTemplate(template, null, timeout2, 0, true);

        if (msg != null) {
            throw new TestException(msg);
        }

        /*
         * readIfExists entry from the space using snapshot of null
         * as a template
         */
        msg = testTemplate(null, null, timeout1, 0, true);

        if (msg != null) {
            throw new TestException(msg);
        }

        /*
         * readIfExists sample entries from the space using snapshots
         * of templates with null as a wildcard for different fields
         */
        template = new SimpleEntry("TestEntry #1", null);
        msg = testTemplate(template, null, timeout1, 0, false);

        if (msg != null) {
            throw new TestException(msg);
        }

        // try 2-nd template
        template = new SimpleEntry(null, 2);
        msg = testTemplate(template, null, timeout2, 0, false);

        if (msg != null) {
            throw new TestException(msg);
        }

        // 3-rd template
        template = new SimpleEntry(null, null);
        msg = testTemplate(template, null, checkTime, 0, false);

        if (msg != null) {
            throw new TestException(msg);
        }
View Full Code Here

     *
     * <P>Notes:<BR>For more information see the JavaSpaces specification
     * sections 2.5, 2.6.</P>
     */
    public void run() throws Exception {
        SimpleEntry sampleEntry1 = new SimpleEntry("TestEntry #1", 1);
        SimpleEntry sampleEntry2 = new SimpleEntry("TestEntry #2", 2);
        SimpleEntry sampleEntry3 = new SimpleEntry("TestEntry #1", 2);
        SimpleEntry template;
        String msg;

        // first check that space is empty
        if (!checkSpace(space)) {
            throw new TestException("Space is not empty in the beginning.");
        }

        // write three sample entries into the space
        space.write(sampleEntry1, null, leaseForeverTime);
        space.write(sampleEntry2, null, leaseForeverTime);
        space.write(sampleEntry3, null, leaseForeverTime);

        /*
         * take 1-st entry from the space using snapshot of the same one
         * as a template
         */
        msg = testTemplate(sampleEntry1, null, Long.MAX_VALUE, 0, 0, false);

        if (msg != null) {
            throw new TestException(msg);
        }

        // write taken entry back to the space
        space.write(sampleEntry1, null, leaseForeverTime);

        /*
         * take sample entry from the space using snapshots of
         * different wrong template entries
         */
        template = new SimpleEntry("TestEntry #3", 1);
        msg = testWrongTemplate(template, null, checkTime, 0, 0, false);

        if (msg != null) {
            throw new TestException(msg);
        }

        // 2-nd wrong template
        template = new SimpleEntry("TestEntry #1", 3);
        msg = testWrongTemplate(template, null, timeout1, 0, 0, false);

        if (msg != null) {
            throw new TestException(msg);
        }

        // 3-rd wrong template
        template = new SimpleEntry("TestEntry #3", 3);
        msg = testWrongTemplate(template, null, timeout2, 0, 0, false);

        if (msg != null) {
            throw new TestException(msg);
        }

        // 4-th wrong template
        template = new SimpleEntry(null, 3);
        msg = testWrongTemplate(template, null, checkTime, 0, 0, false);

        if (msg != null) {
            throw new TestException(msg);
        }

        // 5-th wrong template
        template = new SimpleEntry("TestEntry #3", null);
        msg = testWrongTemplate(template, null, timeout2, 0, 0, false);

        if (msg != null) {
            throw new TestException(msg);
        }

        // take entry from the space using snapshot of null as a template
        msg = testTemplate(null, null, timeout1, 0, 0, false);

        if (msg != null) {
            throw new TestException(msg);
        }

        // clean the space and write 3 entries again
        cleanSpace(space);
        space.write(sampleEntry1, null, leaseForeverTime);
        space.write(sampleEntry2, null, leaseForeverTime);
        space.write(sampleEntry3, null, leaseForeverTime);

        /*
         * take sample entries from the space using snapshot of templates
         * with null as a wildcard for different fields
         */
        template = new SimpleEntry("TestEntry #1", null);
        msg = testTemplate(template, null, checkTime, 0, 0, false);

        if (msg != null) {
            throw new TestException(msg);
        }

        // clean the space and write 3 entries again
        cleanSpace(space);
        space.write(sampleEntry1, null, leaseForeverTime);
        space.write(sampleEntry2, null, leaseForeverTime);
        space.write(sampleEntry3, null, leaseForeverTime);

        // try 2-nd template
        template = new SimpleEntry(null, 2);
        msg = testTemplate(template, null, timeout1, 0, 0, false);

        if (msg != null) {
            throw new TestException(msg);
        }

        // clean the space and write 3 entries again
        cleanSpace(space);
        space.write(sampleEntry1, null, leaseForeverTime);
        space.write(sampleEntry2, null, leaseForeverTime);
        space.write(sampleEntry3, null, leaseForeverTime);

        // 3-rd template
        template = new SimpleEntry(null, null);
        msg = testTemplate(template, null, timeout2, 0, 0, false);

        if (msg != null) {
            throw new TestException(msg);
        }
View Full Code Here

     *
     * <P>Notes:<BR>For more information see the JavaSpaces specification
     * sections 2.6, 3.1.</P>
     */
    public void run() throws Exception {
        SimpleEntry sampleEntry = new SimpleEntry("TestEntry #1", 1);
        Entry snapshot;
        SimpleEntry result;
        Transaction txn1, txn2;

        // first check that space is empty
        if (!checkSpace(space)) {
            throw new TestException(
View Full Code Here

TOP

Related Classes of com.sun.jini.test.spec.javaspace.conformance.SimpleEntry

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.