コード例 #1
0
        static TestPerfAgent()
        {
            VFT_SETTING.addField("<" + VF_SETTING_FLOAT + "><F><D=Float Field>");

            VFT_STATISTICS.addField("<" + VF_STATS_COUNT + "><L><D=Update Count>");
            VFT_STATISTICS.addField("<" + VF_STATS_RATE + "><L><D=Updates per Second>");
        }
コード例 #2
0
        public void EventDatatableEncoding()
        {
            TableFormat tf = new TableFormat(1, 1);

            tf.addField(FieldFormat.FLOAT_FIELD, "value");
            tf.addField(FieldFormat.INTEGER_FIELD, "quality");

            DataTable nested = new DataTable(tf, 12345.67f, 123);

            ClassicEncodingSettings ces = new ClassicEncodingSettings(false);

            DataTable table = new DataTable(AbstractContext.EF_UPDATED, "test", nested, null);


            string encodedTable = table.encode(ces);
            //  .encode(this.createClassicEncodingSettings(true));

            //string expected = "<F=<<variable><S><A=>><<value><T><A=<F=>>><<user><S><F=N><A=<NULL>>>"
            //    + "<M=1><X=1>><R=<test>"
            //    + "<<F=<<value><F><A=0>>"
            //    + "<<quality><I><A=0>><M=1><X=1>>"
            //    + "<R=<12345.67><123>>><<NULL>>>";
            string expected = "\\u001c\\u0046\\u001e\\u001c\\u001c\\u0076\\u0061\\u0072\\u0069\\u0061\\u0062\\u006c\\u0065\\u001d\\u001c\\u0053\\u001d\\u001c\\u0041\\u001e\\u001d\\u001d\\u001c\\u001c\\u0076\\u0061\\u006c\\u0075\\u0065\\u001d\\u001c\\u0054\\u001d\\u001c\\u0041\\u001e\\u001c\\u0046\\u001e\\u001d\\u001d\\u001d\\u001c\\u001c\\u0075\\u0073\\u0065\\u0072\\u001d\\u001c\\u0053\\u001d\\u001c\\u0046\\u001e\\u004e\\u001d\\u001c\\u0041\\u001e\\u001a\\u001d\\u001d\\u001c\\u004d\\u001e\\u0031\\u001d\\u001c\\u0058\\u001e\\u0031\\u001d\\u001d\\u001c\\u0052\\u001e\\u001c\\u0074\\u0065\\u0073\\u0074\\u001d\\u001c\\u001c\\u0046\\u001e\\u001c\\u001c\\u0076\\u0061\\u006c\\u0075\\u0065\\u001d\\u001c\\u0046\\u001d\\u001c\\u0041\\u001e\\u0030\\u001d\\u001d\\u001c\\u001c\\u0071\\u0075\\u0061\\u006c\\u0069\\u0074\\u0079\\u001d\\u001c\\u0049\\u001d\\u001c\\u0041\\u001e\\u0030\\u001d\\u001d\\u001c\\u004d\\u001e\\u0031\\u001d\\u001c\\u0058\\u001e\\u0031\\u001d\\u001d\\u001c\\u0052\\u001e\\u001c\\u0031\\u0032\\u0033\\u0034\\u0035\\u002e\\u0036\\u0037\\u001d\\u001c\\u0031\\u0032\\u0033\\u001d\\u001d\\u001d\\u001c\\u001a\\u001d\\u001d";

            StringBuilder sb = new StringBuilder();

            foreach (char c in encodedTable)
            {
                sb.Append("\\u");
                sb.Append(string.Format("{0:x4}", (int)c));
            }

            Assert.AreEqual(expected, sb.ToString());
        }
コード例 #3
0
        static DataFieldFormat()
        {
            var modeF = create(MODE_FIELD, STRING_FIELD);

            modeF.setNullable(true);

            var edF = create(EXTENSIONS_DESCR_FIELD, STRING_FIELD);

            edF.setNullable(true);

            // Default value for 'extensions' field
            var extF = create(EXTENSION_FIELD, STRING_FIELD);

            EXTENSIONS_FORMAT.addField(extF);
            var dt = new DataTable(EXTENSIONS_FORMAT);

            FieldFormat extsF = create(EXTENSIONS_FIELD, DATATABLE_FIELD);

            extsF.setDefault(dt);
            extsF.setNullable(true);

            var folderF = create(FOLDER_FIELD, STRING_FIELD);

            folderF.setNullable(true);

            DATA_EDITOR_OPTIONS_FORMAT.addField(modeF);
            DATA_EDITOR_OPTIONS_FORMAT.addField(edF);
            DATA_EDITOR_OPTIONS_FORMAT.addField(extsF);
            DATA_EDITOR_OPTIONS_FORMAT.addField(folderF);
        }
コード例 #4
0
ファイル: AgentContext.cs プロジェクト: AlexBurmatov/AggAgent
        static AgentContext()
        {
            FOFT_LOGIN.addField("<" + FOF_LOGIN_OWNER + "><S>");
            FOFT_LOGIN.addField("<" + FOF_LOGIN_NAME + "><S>");
            FOFT_LOGIN.addField("<" + FOF_LOGIN_RESPONSE + "><S>");

            FOFT_GET_HISTORY.addField("<" + FOF_GET_HISTORY_VARIABLE + "><S>");
            FOFT_GET_HISTORY.addField("<" + FOF_GET_HISTORY_TIMESTAMP + "><D>");
            FOFT_GET_HISTORY.addField("<" + FOF_GET_HISTORY_VALUE + "><T>");

            FIFT_ACKNOWLEDGE_EVENT.addField("<" + FIF_ACKNOWLEDGE_EVENT_ID + "><L><F=N>");
            FIFT_ACKNOWLEDGE_EVENT.addField("<" + FIF_ACKNOWLEDGE_EVENT_DATE + "><D>");
            FIFT_ACKNOWLEDGE_EVENT.addField("<" + FIF_ACKNOWLEDGE_EVENT_AUTHOR + "><S><F=N>");
            FIFT_ACKNOWLEDGE_EVENT.addField("<" + FIF_ACKNOWLEDGE_EVENT_ACKNOWLEDGEMENT + "><S>");
            FIFT_ACKNOWLEDGE_EVENT.addField("<" + FIF_ACKNOWLEDGE_EVENT_EVENT_DATA + "><T>");

            FOFT_ASSET.addField("<" + FIELD_ID + "><S><F=HRK>");
            FOFT_ASSET.addField("<" + FIELD_DESCRIPTION + "><S><F=R><D=" + Cres.get().getString("description") + ">");
            FOFT_ASSET.addField("<" + FIELD_ENABLED + "><B><A=1><D=" + Cres.get().getString("enabled") + ">");

            FOFT_ASSET.addField(FieldFormat.create("<" + FIELD_CHILDREN + "><T><F=N><D=" + Cres.get().getString("devNestedAssets") + ">"));

            FOFT_ASSET.setNamingExpression(AGGREGATE + "({}, \"{env/previous} + ({" + FIELD_ENABLED + "} ? 1 : 0)\", 0) + '/' + {#" + RECORDS + "}");

            String reff = FIELD_CHILDREN + "#" + PROPERTY_ENABLED;
            String exp  = "{" + FIELD_ENABLED + "}";

            FOFT_ASSET.addBinding(reff, exp);
        }
コード例 #5
0
        public void TestFirstEncoding()
        {
            TableFormat tf = new TableFormat(1, 1);

            tf.addField(FieldFormat.FLOAT_FIELD, "value");
            tf.addField(FieldFormat.INTEGER_FIELD, "quality");

            DataTable nested = new DataTable(tf, 12345.67f, 123);

            ClassicEncodingSettings ces = new ClassicEncodingSettings(true);

            ces.setFormatCache(new FormatCache());

            ces.setKnownFormatCollector(new KnownFormatCollector());

            DataTable table = new DataTable(AbstractContext.EF_UPDATED, "test", nested, null);

            String encodedTable = table.encode(ces);
            String actual       = "<F=<<variable><S><A=>><<value><T><A=<F=>>><<user><S><F=N><A=<NULL>>>"
                                  + "<M=1><X=1>><D=0><R=<test>"
                                  + "<<F=<<value><F><A=0>>"
                                  + "<<quality><I><A=0>><M=1><X=1>><D=1>"
                                  + "<R=<12345.67><123>>><<NULL>>>";

            Assert.AreEqual(encodedTable, actual);
        }
コード例 #6
0
        private static TableFormat ModificationTimeRecordFormat()
        {
            var format = new TableFormat(1, 100);

            format.addField("<" + VF_MODTIME_VARIABLE + "><S><D=Variable Name>");
            format.addField("<" + VF_MODTIME_MODTIME + "><D><D=Modification Time>");
            return(format);
        }
コード例 #7
0
        static Acknowledgement()
        {
            FORMAT.addField("<author><S>");
            FORMAT.addField("<time><D>");
            FORMAT.addField("<text><S>");

            DataTableUtils.registerFormatConverter(new DefaultFormatConverter(typeof(Acknowledgement), FORMAT));
        }
コード例 #8
0
        static UpdateManager()
        {
            VFT_TEST_VARIABLE = new TableFormat(1, 1);

            VFT_TEST_VARIABLE.addField("<" + VF_TEST_VARIABLE_VALUE + ">" + "<E>" + "<D=Value>" + "<A=1>");
            VFT_TEST_VARIABLE.addField("<" + VF_TEST_VARIABLE_TIMESTAMP + ">" + "<D>" + "<D=Timestamp>" +
                                       "<A=2000-02-01 12:00:00.000>");
            VFT_TEST_VARIABLE.addField("<" + VF_TEST_VARIABLE_QUALITY + ">" + "<I>" + "<D=Quality>" + "<A=0>");
        }
コード例 #9
0
        static EventUtils()
        {
            IntFieldFormat ff = (IntFieldFormat)FieldFormat.create("<" + FIELD_SEVERITY_STATS_LEVEL + "><I><D=" +
                                                                   Cres.get().getString(FIELD_SEVERITY_STATS_LEVEL) + ">");

            ff.setSelectionValues(EventLevel.getSelectionValues());
            SEVERITY_STATS_FORMAT.addField(ff);

            SEVERITY_STATS_FORMAT.addField(
                FieldFormat.create("<" + FIELD_SEVERITY_STATS_NUMBER + "><I><D=" + Cres.get().getString("efEventCount") + ">"));
            SEVERITY_STATS_FORMAT.addField(FieldFormat.create("<" + FIELD_SEVERITY_STATS_COLOR + "><C><F=H>"));
        }
コード例 #10
0
        protected TableFormat createTestTableFormat()
        {
            TableFormat format = new TableFormat(1, 1);
            FieldFormat ff     = FieldFormat.create("name", FieldFormat.STRING_FIELD, "name", "default name");

            ff.addValidator(NAME_SYNTAX_VALIDATOR);
            format.addField(ff);
            format.addField(FieldFormat.create("dt", FieldFormat.DATATABLE_FIELD, "dt", new DataTable()));
            format.addField(FieldFormat.create("float", FieldFormat.FLOAT_FIELD, "float", 1.5f));
            format.setReorderable(true);
            return(format);
        }
コード例 #11
0
 static PerformanceTestingAgent()
 {
     VFT_PERFORMANCE_TESTING = new TableFormat(1, 1);
     VFT_PERFORMANCE_TESTING.addField(
         "<" + VF_PERFORMANCE_TESTING_VARIABLE_COUNT + ">" +
         "<I>" +
         "<D=" + "Variable Count>" +
         "<A=" + DEFAULT_VARIABLE_COUNT + ">");
     VFT_PERFORMANCE_TESTING.addField(
         "<" + VF_PERFORMANCE_TESTING_PERIOD + ">" +
         "<L>" +
         "<D=" + "Update Period" + ">" +
         "<E=" + LongFieldFormat.EDITOR_PERIOD + ">" +
         "<O=" + LongFieldFormat.encodePeriodEditorOptions(0 /*TimeHelper.MILLISECOND*/, 2 /*TimeHelper.MINUTE*/) +
         ">" +
         "<A=" + DEFAULT_PERIOD + ">");
 }
コード例 #12
0
 static LoraAgent()
 {
     VTF_USERS.addField(ff_login);
     VTF_USERS.addField(ff_devacc);
     VTF_DEVICES.addField(ff_devEui);
     VTF_DEVICES.addField(ff_devName);
     VTF_DEVICES.addField(ff_devType);
     VTF_DEVICES.addField(ff_devData);
     VTF_DATADEVICES.addField(ff_dataType);
     VTF_DATADEVICES.addField(ff_dataCharge);
     VTF_DATADEVICES.addField(ff_dataDateTime);
     VTF_DATADEVICES.addField(ff_dataTemperature);
     VTF_DATADEVICES.addField(ff_dataInput1);
     VTF_DATADEVICES.addField(ff_dataInput2);
     VTF_DATADEVICES.addField(ff_dataInput3);
     VTF_DATADEVICES.addField(ff_dataInput4);
     //EFT_EVENT.addField(ff_typeEvent);
     //EFT_EVENT.addField(ff_dataEvent);
 }
コード例 #13
0
        public void TestCachedEncoding()
        {
            TableFormat tf = new TableFormat(1, 1);

            tf.addField(FieldFormat.FLOAT_FIELD, "value");
            tf.addField(FieldFormat.INTEGER_FIELD, "quality");

            DataTable nested = new DataTable(tf, 12345.67f, 123);

            ClassicEncodingSettings ces = new ClassicEncodingSettings(true);

            ces.setFormatCache(new FormatCache());

            ces.setKnownFormatCollector(new KnownFormatCollector());

            DataTable table = new DataTable(AbstractContext.EF_UPDATED, "test", nested, null);

            table.encode(ces);
            String encodedTable = table.encode(ces);
            String actual       = "<D=0><R=<test><<D=0><R=<12345.67><123>>><<NULL>>>";

            Assert.AreEqual(encodedTable, actual);
        }
コード例 #14
0
        public void TestNestedTableEncoding()
        {
            string strdata = "test % %% %%% test";

            TableFormat tf = new TableFormat();

            FieldFormat ff = FieldFormat.create("strfield", FieldFormat.STRING_FIELD);

            ff.setDefault(strdata);

            tf.addField(ff);

            DataTable table = new DataTable(tf, strdata + "value");

            DataTable wrapped = table;

            for (int i = 0; i < 2; i++)
            {
                TableFormat wtf = new TableFormat();

                FieldFormat wff = FieldFormat.create("dtfield" + i, FieldFormat.DATATABLE_FIELD);

                wff.setDefault(wrapped);

                wtf.addField(wff);

                wrapped = new DataTable(wtf, wrapped);
            }

            string encoded = wrapped.encode(false);

            DataTable restored = new DataTable(encoded, new ClassicEncodingSettings(false), true);


            Assert.AreEqual(wrapped, restored);
        }
コード例 #15
0
 static StringFieldFormat()
 {
     ADDITIONAL_REFERENCES_FORMAT.addField("<reference><S>");
     ADDITIONAL_REFERENCES_FORMAT.addField("<description><S>");
 }
コード例 #16
0
        static void Main()
        {
            try
            {
                Log.start();

                TableFormat tf = new TableFormat(1, 1);
                tf.addField(FieldFormat.DATE_FIELD, "date");
                tf.addField(FieldFormat.FLOAT_FIELD, "value");
                tf.addField(FieldFormat.INTEGER_FIELD, "quality");

                DataTable nested = new DataTable(tf, DateTime.Now, 12345.67890f, 123);

                ClassicEncodingSettings ces = new ClassicEncodingSettings(false);
                ces.setFormatCache(new FormatCache());

                //ces.setKnownFormatCollector(new KnownFormatCollector());
                ces.setKnownFormatCollector(new KnownFormatCollector());

                DataTable table = new DataTable(AbstractContext.EF_UPDATED, "test", nested, null);

                int tablesPerTask = 10000;

                // Encoding

                //System.Threading.WaitCallback etask = new System.Threading.WaitCallback()
                Action etask = () =>
                {
                    for (int i = 0; i < tablesPerTask; i++)
                    {
                        table.encode(ces);
                    }
                };

                execute(tablesPerTask, etask);

                // Decoding

                // table.encode(ces); // First time format will be encoded into table, and we'd like to test decoding tables without format
                //
                // final String encoded = table.encode(ces);
                //
                // Callable dtask = new Callable()
                // {
                // @Override
                // public Object call() throws Exception
                // {
                // try
                // {
                // for (int i = 0; i < tablesPerTask; i++)
                // {
                // new DataTable(encoded, ces, true);
                // }
                // }
                // catch (Exception ex)
                // {
                // ex.printStackTrace();
                // }
                // return null;
                // }
                // };
                //
                // execute(tablesPerTask, dtask);

                Console.ReadLine();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }
        }
コード例 #17
0
 static RootContextConstants()
 {
     FIFT_LOGIN.addField("<" + FIF_LOGIN_USERNAME + "><S>");
     FIFT_LOGIN.addField("<" + FIF_LOGIN_PASSWORD + "><S>");
 }