Examples of Isolate


Examples of com.sun.cldc.isolate.Isolate

    Link to;
    Link from;

    void setUp() throws IOException, IsolateStartupException {
        us = Isolate.currentIsolate();
        them = new Isolate("com.sun.midp.links.Echo", null);
        them.start();
        to = Link.newLink(us, them);
        from = Link.newLink(them, us);
        LinkPortal.setLinks(them, new Link[] { to, from });
    }
View Full Code Here

Examples of com.sun.cldc.isolate.Isolate

    Link to;
    Link from;

    void setUp() throws IOException, IsolateStartupException {
        us = Isolate.currentIsolate();
        them = new Isolate("com.sun.midp.links.Echo", null);
        them.start();
        to = Link.newLink(us, them);
        from = Link.newLink(them, us);
        LinkPortal.setLinks(them, new Link[] { to, from });
    }
View Full Code Here

Examples of com.sun.cldc.isolate.Isolate

    /**
     * Tests a LinkMessage containing a Link.
     */
    void testLink() {
        Isolate isolate = Isolate.currentIsolate();
        Link link = Link.newLink(isolate, isolate);
        LinkMessage lm = LinkMessage.newLinkMessage(link);

        assertFalse("containsData must return false", lm.containsData());
        assertTrue("containsLink must return true", lm.containsLink());
View Full Code Here

Examples of com.sun.cldc.isolate.Isolate

* Tests sending messages around a ring of three isolates.
*/
public class TestRing extends TestCase {

    void testRing() throws IOException, IsolateStartupException {
        Isolate zero = Isolate.currentIsolate();
        Isolate one = new Isolate("com.sun.midp.links.Echo", null);
        Isolate two = new Isolate("com.sun.midp.links.Echo", null);

        one.start();
        two.start();

        Link link01 = Link.newLink(zero, one);
        Link link12 = Link.newLink(one, two);
        Link link20 = Link.newLink(two, zero);

        LinkPortal.setLinks(one, new Link[] { link01, link12 });
        LinkPortal.setLinks(two, new Link[] { link12, link20 });

        String ss = "Mr. Watson, come here. I want you!";
        link01.send(LinkMessage.newStringMessage(ss));
        LinkMessage lm = link20.receive();

        assertTrue("contains string", lm.containsString());
        String rs = lm.extractString();
        assertNotSame("strings not same", ss, rs);
        assertEquals("strings equal", ss, rs);

        LinkPortal.setLinks(one, null);
        LinkPortal.setLinks(two, null);
        one.exit(0);
        two.exit(0);
        one.waitForExit();
        two.waitForExit();
    }
View Full Code Here

Examples of com.sun.cldc.isolate.Isolate

    /**
     * Tests creation, isOpen(), and close().
     */
    void testCreate() {
        Isolate i = Isolate.currentIsolate();
        Link link = Link.newLink(i, i);

        assertTrue("link should be open", link.isOpen());

        link.close();
View Full Code Here

Examples of com.sun.cldc.isolate.Isolate

    /**
     * Tests nulls.
     */
    void testNulls() {
        Isolate i = Isolate.currentIsolate();
        boolean thrown;

        thrown = false;
        try {
            Link link = Link.newLink(null, null);
View Full Code Here

Examples of com.sun.cldc.isolate.Isolate

    /**
     * Tests for equals() and hashCode().
     */
    void testEquals() {
        Isolate i = Isolate.currentIsolate();
        Link link = Link.newLink(i, i);
        Link link2 = Link.newLink(i, i);
        assertFalse("must not equal null", link.equals(null));
        assertTrue("must equal itself", link.equals(link));
        assertFalse("must not equal other obj", link.equals("foobar"));
View Full Code Here

Examples of com.sun.cldc.isolate.Isolate

    /**
     * Tests receive() on a closed link.
     */
    void testReceiveClosed() throws IOException {
        Isolate i = Isolate.currentIsolate();
        Link link = Link.newLink(i, i);
        link.close();

        boolean thrown = false;
        try {
View Full Code Here

Examples of com.sun.cldc.isolate.Isolate

    /**
     * Tests send() on a closed link.
     */
    void testSendClosed() throws IOException {
        Isolate i = Isolate.currentIsolate();
        Link link = Link.newLink(i, i);
        link.close();

        boolean thrown = false;
        try {
View Full Code Here

Examples of com.sun.cldc.isolate.Isolate

    /**
     * Tests receive() followed by a send().
     */
    void testReceiveSend() throws IOException {
        Isolate i = Isolate.currentIsolate();
        Link link = Link.newLink(i, i);
        Receiver receiver = new Receiver(link);

        assertFalse("receiver should be blocked", receiver.done);
        assertNull("receiver should have no exceptions", receiver.exception);
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.