Package org.agilewiki.jactor

Examples of org.agilewiki.jactor.Actor


            JAFuture future = new JAFuture();
            JidFactories factory = new JidFactories();
            factory.initialize(mailboxFactory.createMailbox());

            RootJidFactory rootJidFactory = new RootJidFactory();
            Actor rootJid1 = rootJidFactory.newActor(factory.getMailbox(), factory);
            int sl = GetSerializedLength.req.send(future, rootJid1);
            assertEquals(0, sl);
            Clear.req.send(future, rootJid1);
            sl = GetSerializedLength.req.send(future, rootJid1);
            assertEquals(0, sl);
            Actor rootJid1a = GetActor.req.send(future, rootJid1);
            assertNull(rootJid1a);
            Actor rpa = (new ResolvePathname("")).send(future, rootJid1);
            assertNotNull(rpa);
            assertEquals(rpa, rootJid1);
            rpa = (new ResolvePathname("0")).send(future, rootJid1);
            assertNull(rpa);
            Actor rootJid11 = (new CopyJID()).send(future, rootJid1);
            assertNotNull(rootJid11);
            sl = GetSerializedLength.req.send(future, rootJid11);
            assertEquals(0, sl);
            rpa = (new ResolvePathname("")).send(future, rootJid11);
            assertNotNull(rpa);
            assertEquals(rpa, rootJid11);
            rpa = (new ResolvePathname("0")).send(future, rootJid11);
            assertNull(rpa);

            StringJidFactory stringJidAFactory = StringJidFactory.fac;
            Actor string1 = stringJidAFactory.newActor(factory.getMailbox(), factory);
            (new SetString("abc")).send(future, string1);
            byte[] sb = GetSerializedBytes.req.send(future, string1);
            (new SetActorBytes(stringJidAFactory, sb)).send(future, rootJid1);
            Actor sj = GetActor.req.send(future, rootJid1);
            assertEquals("abc", GetString.req.send(future, sj));

            Actor rootJid2 = RootJidFactory.fac.newActor(factory.getMailbox(), factory);
            sl = GetSerializedLength.req.send(future, rootJid2);
            assertEquals(0, sl);
            SetActor sjvj = new SetActor(JidFactories.JID_TYPE);
            sjvj.send(future, rootJid2);
            MakeActor mjvj = new MakeActor(JidFactories.JID_TYPE);
            boolean made = mjvj.send(future, rootJid2);
            assertEquals(false, made);
            Actor jidJid2a = GetActor.req.send(future, rootJid2);
            assertNotNull(jidJid2a);
            sl = GetSerializedLength.req.send(future, jidJid2a);
            assertEquals(0, sl);
            sl = GetSerializedLength.req.send(future, rootJid2);
            assertEquals(10, sl);
            rpa = (new ResolvePathname("")).send(future, rootJid2);
            assertNotNull(rpa);
            assertEquals(rpa, rootJid2);
            rpa = (new ResolvePathname("0")).send(future, rootJid2);
            assertNotNull(rpa);
            assertEquals(rpa, jidJid2a);
            Actor rootJid22 = (new CopyJID()).send(future, rootJid2);
            Clear.req.send(future, rootJid2);
            sl = GetSerializedLength.req.send(future, rootJid2);
            assertEquals(0, sl);
            jidJid2a = GetActor.req.send(future, rootJid2);
            assertNull(jidJid2a);
View Full Code Here


            assertFalse(GetBoolean.req.send(future, boolean1));
            assertTrue(GetBoolean.req.send(future, boolean2));
            assertTrue(GetBoolean.req.send(future, boolean3));

            Actor jidJid1 = ActorJidFactory.fac.newActor(factory.getMailbox(), factory);
            SetActor sjvb = new SetActor(JidFactories.BOOLEAN_JID_TYPE);
            sjvb.send(future, jidJid1);
            BooleanJid rpa = (BooleanJid) (new ResolvePathname("0")).send(future, jidJid1);
            assertFalse(GetBoolean.req.send(future, rpa));
            (new SetBoolean(true)).send(future, rpa);
View Full Code Here

            assertNull(GetString.req.send(future, string1));
            assertEquals("abc", GetString.req.send(future, string2));
            assertEquals("abc", GetString.req.send(future, string3));

            Actor jidJid1 = ActorJidFactory.fac.newActor(factory.getMailbox(), factory);
            SetActor sjvbs = new SetActor(JidFactories.STRING_JID_TYPE);
            sjvbs.send(future, jidJid1);
            StringJid rpa = (StringJid) (new ResolvePathname("0")).send(future, jidJid1);
            assertNull(GetString.req.send(future, rpa));
            assertTrue((new MakeString("")).send(future, rpa));
View Full Code Here

        MailboxFactory mailboxFactory = JAMailboxFactory.newMailboxFactory(1);
        try {
            JidFactories factory = new JidFactories();
            factory.initialize(mailboxFactory.createMailbox());
            JAFuture future = new JAFuture();
            Actor m = (new StringMapJidFactory(JidFactories.STRING_STRING_MAP_JID_TYPE, StringJidFactory.fac)).
                    newActor(factory.getMailbox(), factory);
            assertNull(new KGet<String, StringJid>("a").send(future, m));
            assertTrue(new KMake<String, StringJid>("b").send(future, m));
            assertNull(new KGet<String, StringJid>("a").send(future, m));
            Actor value = new KGet<String, StringJid>("b").send(future, m);
            assertNotNull(value);
            assertTrue(value instanceof StringJid);
            value = new GetHigher<String, StringJid>("a").send(future, m);
            assertTrue(value instanceof MapEntry);
            assertNull(new GetHigher<String, StringJid>("b").send(future, m));
View Full Code Here

            v = GetInteger.req.send(future, int2);
            assertEquals(1, v);
            v = GetInteger.req.send(future, int3);
            assertEquals(1, v);

            Actor jidJid1 = ActorJidFactory.fac.newActor(factory.getMailbox(), factory);
            SetActor sjvi = new SetActor(JidFactories.INTEGER_JID_TYPE);
            sjvi.send(future, jidJid1);
            IntegerJid rpa = (IntegerJid) (new ResolvePathname("0")).send(future, jidJid1);
            v = GetInteger.req.send(future, rpa);
            assertEquals(0, v);
View Full Code Here

        try {
            JAFuture future = new JAFuture();
            JidFactories factory = new JidFactories();
            factory.initialize(mailboxFactory.createMailbox());

            Actor bytes1 = BytesJidFactory.fac.newActor(factory.getMailbox(), factory);
            Actor bytes2 = (new CopyJID()).send(future, bytes1);
            (new SetBytes(new byte[3])).send(future, bytes2);
            Actor bytes3 = (new CopyJID()).send(future, bytes2);

            int sl = GetSerializedLength.req.send(future, bytes1);
            assertEquals(4, sl);
            sl = GetSerializedLength.req.send(future, bytes2);
            assertEquals(7, sl);
            sl = GetSerializedLength.req.send(future, bytes3);
            assertEquals(7, sl);

            assertNull(GetBytes.req.send(future, bytes1));
            assertEquals(3, GetBytes.req.send(future, bytes2).length);
            assertEquals(3, GetBytes.req.send(future, bytes3).length);

            Actor jidJid1 = ActorJidFactory.fac.newActor(factory.getMailbox(), factory);
            SetActor sjvbs = new SetActor(JidFactories.BYTES_JID_TYPE);
            sjvbs.send(future, jidJid1);
            Actor rpa = (new ResolvePathname("0")).send(future, jidJid1);
            assertNull(GetBytes.req.send(future, rpa));
            assertTrue((new MakeBytes(new byte[0])).send(future, rpa));
            assertFalse((new MakeBytes(new byte[99])).send(future, rpa));
            rpa = (new ResolvePathname("0")).send(future, jidJid1);
            assertEquals(0, GetBytes.req.send(future, rpa).length);
View Full Code Here

            v = GetLong.req.send(future, long2);
            assertEquals(1L, v);
            v = GetLong.req.send(future, float3);
            assertEquals(1L, v);

            Actor jidJid1 = ActorJidFactory.fac.newActor(factory.getMailbox(), factory);
            SetActor sjvl = new SetActor(JidFactories.LONG_JID_TYPE);
            sjvl.send(future, jidJid1);
            LongJid rpa = (LongJid) (new ResolvePathname("0")).send(future, jidJid1);
            v = GetLong.req.send(future, rpa);
            assertEquals(0L, v);
View Full Code Here

            v = GetDouble.req.send(future, double2);
            assertEquals(1.D, v);
            v = GetDouble.req.send(future, double3);
            assertEquals(1.D, v);

            Actor jidJid1 = ActorJidFactory.fac.newActor(factory.getMailbox(), factory);
            SetActor sjvl = new SetActor(JidFactories.DOUBLE_JID_TYPE);
            sjvl.send(future, jidJid1);
            DoubleJid rpa = (DoubleJid) (new ResolvePathname("0")).send(future, jidJid1);
            v = GetDouble.req.send(future, rpa);
            assertEquals(0.D, v);
View Full Code Here

            factory.initialize(mailboxFactory.createMailbox());

            FloatJid float1 = (FloatJid) FloatJidFactory.fac.newActor(factory.getMailbox(), factory);
            FloatJid float2 = (FloatJid) (new CopyJID()).send(future, float1);
            (new SetFloat(1.0f)).send(future, float2);
            Actor float3 = (new CopyJID()).send(future, float2);

            int sl = GetSerializedLength.req.send(future, float1);
            assertEquals(4, sl);
            sl = GetSerializedLength.req.send(future, float2);
            assertEquals(4, sl);
            sl = GetSerializedLength.req.send(future, float3);
            assertEquals(4, sl);

            float v = GetFloat.req.send(future, float1);
            assertEquals(0.f, v);
            v = GetFloat.req.send(future, float2);
            assertEquals(1.f, v);
            v = GetFloat.req.send(future, float3);
            assertEquals(1.f, v);

            Actor jidJid1 = ActorJidFactory.fac.newActor(factory.getMailbox(), factory);
            SetActor sjvf = new SetActor(JidFactories.FLOAT_JID_TYPE);
            sjvf.send(future, jidJid1);
            FloatJid rpa = (FloatJid) (new ResolvePathname("0")).send(future, jidJid1);
            v = GetFloat.req.send(future, rpa);
            assertEquals(0.f, v);
View Full Code Here

            parent = new JAFactory();
            ((JAFactory) parent).initialize(mailbox);
        }
        super.initialize(mailbox, parent, actorFactory);

        Actor f = parent;
        while (!(f instanceof JAFactory)) f = f.getParent();
        JAFactory factory = (JAFactory) f;

        factory.registerActorFactory(EvaluatorActerJidFactory.fac);
        factory.registerActorFactory(new EvaluatorListJidFactory(EVALUATER_LIST_JID_TYPE));
        factory.registerActorFactory(GetIntegerTransactionFactory.fac);
View Full Code Here

TOP

Related Classes of org.agilewiki.jactor.Actor

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.