Package org.apache.imperius.spl.parser.expressions.impl

Examples of org.apache.imperius.spl.parser.expressions.impl.ToSINT16


        //SensorLookup lookup = new SensorLookupImpl(map);

        try {
            Vector v = new Vector();
            v.add(new StringConstant(s1));
            Expression es1 = new ToSINT16(v,true);

            v.clear();
            v.add(new StringConstant(s2));
            Expression es2 = new ToSINT16(v,true);

            v.clear();
            v.add(new ShortConstant(sn1.shortValue()));
            Expression esn1 = new ToSINT16(v,true);

            v.clear();
            v.add(new ShortConstant(sn2.shortValue()));
            Expression esn2 = new ToSINT16(v,true);

            v.clear();
            v.add(propertySensor1);
            Expression eps1 = new ToSINT16(v,true);

            v.clear();
            v.add(propertySensor2);
            Expression eps2 = new ToSINT16(v,true);

            v.clear();
            v.add(propertySensor3);
            Expression eps3 = new ToSINT16(v,true);

            v.clear();
            v.add(propertySensor4);
            Expression eps4 = new ToSINT16(v,true);

            assertTrue(((Short) es1.evaluate()).equals(sn1));
            assertTrue(((Short) es2.evaluate()).equals(sn2));
            assertFalse(((Short) es1.evaluate()).equals(sn2));
            assertTrue(((Short) esn1.evaluate()).equals(sn1));
            assertTrue(((Short) esn2.evaluate()).equals(sn2));
            assertFalse(((Short) esn1.evaluate()).equals(sn2));
            s1 = s1.substring(1, s1.length()-1);
            assertTrue(((Short) eps1.evaluate()).equals(new Short(s1)));
            s2 = s2.substring(1, s2.length()-1);
            assertTrue(((Short) eps2.evaluate()).equals(new Short(s2)));
            assertTrue(((Short) eps3.evaluate()).equals(sn1));
            assertTrue(((Short) eps4.evaluate()).equals(sn2));
           
            assertSame(sn1.getClass(), (es1.evaluate()).getClass());
        } catch (SPLException e) {
            fail("Received evaluation exception " + e.getMessage());
        } catch (Exception e) {
View Full Code Here

TOP

Related Classes of org.apache.imperius.spl.parser.expressions.impl.ToSINT16

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.