Example #1
0
 private void node_NodeStatusChange(ErlLocalNode sender, ErlAtom node, bool up, object info)
 {
     if (!node.Equals(this.m_RemoteName))
     {
         return;                             //filter-out nodes that are not mine
     }
     if (!up)
     {
         asyncReconnect();
     }
 }
Example #2
0
        public void ErlAtomTest()
        {
            var am_test = new ErlAtom("test");

            Assert.IsTrue(am_test.Equals(new ErlAtom("test")));
            Assert.AreEqual(am_test, new ErlAtom("test"));
            Assert.AreEqual("test", am_test.Value);
            Assert.AreEqual("test", am_test.ToString());
            Assert.IsTrue(am_test.IsScalar);
            Assert.AreEqual(ErlTypeOrder.ErlAtom, am_test.TypeOrder);

            Assert.IsTrue(am_test.Matches(new ErlAtom("test")));
            Assert.AreEqual(new ErlVarBind(), am_test.Match(new ErlAtom("test")));

            var am_Test = new ErlAtom("Test");

            Assert.AreEqual("'Test'", am_Test.ToString());
            Assert.AreEqual(4, am_Test.Length);
            Assert.AreNotEqual(am_test, am_Test);

            IErlObject temp = null;

            Assert.IsFalse(am_test.Subst(ref temp, new ErlVarBind()));

            Assert.IsTrue(am_Test.Visit(true, (acc, o) => acc));

            Assert.DoesNotThrow(() => { var x = am_test.ValueAsObject; });
            Assert.Throws <ErlIncompatibleTypesException>(() => { var x = am_test.ValueAsInt; });
            Assert.Throws <ErlIncompatibleTypesException>(() => { var x = am_test.ValueAsLong; });
            Assert.Throws <ErlIncompatibleTypesException>(() => { var x = am_test.ValueAsDecimal; });
            Assert.Throws <ErlIncompatibleTypesException>(() => { var x = am_test.ValueAsDateTime; });
            Assert.Throws <ErlIncompatibleTypesException>(() => { var x = am_test.ValueAsTimeSpan; });
            Assert.Throws <ErlIncompatibleTypesException>(() => { var x = am_test.ValueAsDouble; });
            Assert.DoesNotThrow(() => { var x = am_test.ValueAsString; });
            Assert.DoesNotThrow(() => { var x = am_test.ValueAsBool; });
            Assert.AreEqual('a', new ErlAtom("a").ValueAsChar);
            Assert.Throws <ErlIncompatibleTypesException>(() => { var x = am_test.ValueAsByteArray; });

            string s = am_test; // Implicit conversion

            Assert.AreEqual("test", s);

            ErlAtom a = "abc"; // Implicit conversion

            Assert.AreEqual("abc", a.Value);
        }
Example #3
0
        public void ErlAtomTest()
        {
            var am_test = new ErlAtom("test");
              Assert.IsTrue(am_test.Equals(new ErlAtom("test")));
              Assert.AreEqual(am_test, new ErlAtom("test"));
              Assert.AreEqual("test", am_test.Value);
              Assert.AreEqual("test", am_test.ToString());
              Assert.IsTrue(am_test.IsScalar);
              Assert.AreEqual(ErlTypeOrder.ErlAtom, am_test.TypeOrder);

              Assert.IsTrue(am_test.Matches(new ErlAtom("test")));
              Assert.AreEqual(new ErlVarBind(), am_test.Match(new ErlAtom("test")));

              var am_Test = new ErlAtom("Test");
              Assert.AreEqual("'Test'", am_Test.ToString());
              Assert.AreEqual(4, am_Test.Length);
              Assert.AreNotEqual(am_test, am_Test);

              IErlObject temp = null;
              Assert.IsFalse(am_test.Subst(ref temp, new ErlVarBind()));

              Assert.IsTrue(am_Test.Visit(true, (acc, o) => acc));

              Assert.DoesNotThrow(() => { var x = am_test.ValueAsObject; });
              Assert.Throws<ErlIncompatibleTypesException>(() => { var x = am_test.ValueAsInt; });
              Assert.Throws<ErlIncompatibleTypesException>(() => { var x = am_test.ValueAsLong; });
              Assert.Throws<ErlIncompatibleTypesException>(() => { var x = am_test.ValueAsDecimal; });
              Assert.Throws<ErlIncompatibleTypesException>(() => { var x = am_test.ValueAsDateTime; });
              Assert.Throws<ErlIncompatibleTypesException>(() => { var x = am_test.ValueAsTimeSpan; });
              Assert.Throws<ErlIncompatibleTypesException>(() => { var x = am_test.ValueAsDouble; });
              Assert.DoesNotThrow(() => { var x = am_test.ValueAsString; });
              Assert.DoesNotThrow(() => { var x = am_test.ValueAsBool; });
              Assert.AreEqual('a', new ErlAtom("a").ValueAsChar);
              Assert.Throws<ErlIncompatibleTypesException>(() => { var x = am_test.ValueAsByteArray; });

              string s = am_test;  // Implicit conversion
              Assert.AreEqual("test", s);

              ErlAtom a = "abc";   // Implicit conversion
              Assert.AreEqual("abc", a.Value);
        }
Example #4
0
 public void RPCcast(ErlAtom node, ErlAtom mod, ErlAtom fun, ErlList args, IErlObject ioServer)
 {
   if (node.Equals(m_Node.NodeName))
     throw new ErlException(StringConsts.ERL_CONN_CANT_RPC_TO_LOCAL_NODE_ERROR);
   else
   {
     var msg = Internal.ErlRpcServer.EncodeRPCcast(m_Self, mod, fun, args, ioServer);
     var conn = m_Node.Connection(node);
     if (conn == null)
       throw new ErlConnectionException(
           node, StringConsts.ERL_CONN_CANT_CONNECT_TO_NODE_ERROR.Args(node));
     conn.Send(m_Self, ConstAtoms.Rex, msg);
   }
 }