Exemplo n.º 1
0
 public RuntimeSettingsService(
     ConfigurationCommon configurationCommon,
     ConfigurationRuntime configurationRuntime)
 {
     ConfigurationCommon = configurationCommon;
     ConfigurationRuntime = configurationRuntime;
 }
Exemplo n.º 2
0
        public void TestEPLFromClauseMethodVariable()
        {
            RegressionSession session = RegressionRunner.Session();

            Configuration configuration = session.Configuration;
            configuration.Common.AddMethodRef(typeof(EPLFromClauseMethodVariable.MyStaticService), new ConfigurationCommonMethodRef());

            configuration.Common.AddImportType(typeof(EPLFromClauseMethodVariable.MyStaticService));
            configuration.Common.AddImportType(typeof(EPLFromClauseMethodVariable.MyNonConstantServiceVariableFactory));
            configuration.Common.AddImportType(typeof(EPLFromClauseMethodVariable.MyNonConstantServiceVariable));

            ConfigurationCommon common = configuration.Common;
            common.AddVariable("MyConstantServiceVariable", typeof(EPLFromClauseMethodVariable.MyConstantServiceVariable), new EPLFromClauseMethodVariable.MyConstantServiceVariable());
            common.AddVariable("MyNonConstantServiceVariable", typeof(EPLFromClauseMethodVariable.MyNonConstantServiceVariable), new EPLFromClauseMethodVariable.MyNonConstantServiceVariable("postfix"));
            common.AddVariable("MyNullMap", typeof(EPLFromClauseMethodVariable.MyMethodHandlerMap), null);
            common.AddVariable("MyMethodHandlerMap", typeof(EPLFromClauseMethodVariable.MyMethodHandlerMap), new EPLFromClauseMethodVariable.MyMethodHandlerMap("a", "b"));
            common.AddVariable("MyMethodHandlerOA", typeof(EPLFromClauseMethodVariable.MyMethodHandlerOA), new EPLFromClauseMethodVariable.MyMethodHandlerOA("a", "b"));

            configuration.Common.Logging.IsEnableQueryPlan = true;
            configuration.Common.AddEventType(typeof(SupportBean));
            configuration.Common.AddEventType(typeof(SupportBean_S0));
            configuration.Common.AddEventType(typeof(SupportBean_S1));
            configuration.Common.AddEventType(typeof(SupportBean_S2));

            RegressionRunner.Run(session, EPLFromClauseMethodVariable.Executions());

            session.Dispose();
        }
Exemplo n.º 3
0
 /// <summary>
 /// Constructor.
 /// </summary>
 public ScriptCompilerImpl(
     IContainer container,
     ConfigurationCommon configuration)
 {
     _container     = container;
     _configuration = configuration.Scripting;
     InitializeScriptingEngines();
 }
Exemplo n.º 4
0
 /// <summary>
 /// 使用自定义配置(默认读取json,不支持其他格式文件)
 /// </summary>
 /// <param name="env">环境信息</param>
 /// <param name="configPath">配置文件</param>
 /// <param name="isOptional">文件必须存在</param>
 /// <param name="reloadOnChange">监听文件更改</param>
 /// <returns></returns>
 public static IConfigurationBuilder AddAppsettings(this IHostingEnvironment env,
                                                    string configPath, bool isOptional = true, bool reloadOnChange = true)
 {
     return(ConfigurationCommon.CreateConfigurationBuilder(configurationBuilder =>
     {
         if (!string.IsNullOrEmpty(configPath))
         {
             ConfigurationCommon.AddJsonAppsettings(env.ContentRootPath, configPath, isOptional, reloadOnChange);
         }
     }));
 }
Exemplo n.º 5
0
        public void TestAddEventTypeName()
        {
            ConfigurationCommon common = config.Common;

            common.AddEventType("AEventType", "BClassName");

            Assert.IsTrue(common.IsEventTypeExists("AEventType"));
            Assert.AreEqual(1, common.EventTypeNames.Count);
            Assert.AreEqual("BClassName", common.EventTypeNames.Get("AEventType"));
            AssertDefaultConfig();
        }
Exemplo n.º 6
0
        private void AssertDefaultConfig()
        {
            ConfigurationCommon common = config.Common;

            Assert.That(
                common.Imports,
                Has.Count.EqualTo(4));
            Assert.That(
                common.Imports,
                Contains.Item(ImportBuiltinAnnotations.Instance));
            Assert.That(
                common.Imports,
                Contains.Item(new ImportNamespace("System")));
            Assert.That(
                common.Imports,
                Contains.Item(new ImportNamespace("System.Text")));
            Assert.That(
                common.Imports,
                Contains.Item(new ImportNamespace(typeof(BeaconSourceForge))));
        }
        private static void Configure(Configuration configuration)
        {
            foreach (Type clazz in new Type[]{
                typeof(SupportBean),
                typeof(SupportBeanTwo),
                typeof(SupportBean_A),
                typeof(SupportBean_S0),
                typeof(SupportBeanInt),
                typeof(SupportTradeEventWithSide),
                typeof(SupportEventWithManyArray)
            })
            {
                configuration.Common.AddEventType(clazz);
            }

            configuration.Common.Logging.IsEnableQueryPlan = true;

            ConfigurationCommon common = configuration.Common;
            common.AddVariable("var1", typeof(int?), 0);
            common.AddVariable("var2", typeof(int?), 0);
            common.AddVariable("var3", typeof(int?), 0);
            common.AddVariable("var4", typeof(int?), 0);
            common.AddVariable("varN1", typeof(int?), 0);
            common.AddVariable("varN2", typeof(int?), 0);
            common.AddVariable("varN3", typeof(int?), 0);
            common.AddVariable("varN4", typeof(int?), 0);

            configuration.Common.AddImportType(typeof(SupportJoinMethods));
            configuration.Common.AddImportType(typeof(SupportMethodInvocationJoinInvalid));

            ConfigurationCompilerPlugInSingleRowFunction entry = new ConfigurationCompilerPlugInSingleRowFunction();
            entry.Name = "myItemProducerUDF";
            entry.FunctionClassName = typeof(EPLFromClauseMethod).FullName;
            entry.FunctionMethodName = "MyItemProducerUDF";
            entry.EventTypeName = "ItemEvent";
            configuration.Compiler.AddPlugInSingleRowFunction(entry);
        }
Exemplo n.º 8
0
        private SupportDatabaseService(IContainer container)
        {
            _container = container;

            var configurationPath     = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, ESPER_REGRESSION_CONFIG_FILE);
            var configurationFile     = new FileInfo(configurationPath);
            var configuration         = new ConfigurationCommon();
            var configurationDocument = new XmlDocument();

            configurationDocument.Load(configurationFile.FullName);
            ConfigurationCommonParser.DoConfigure(configuration, configurationDocument.DocumentElement);

            var dbTable = configuration.DatabaseReferences;

            DriverConnectionFactoryDefault = dbTable["db1"].ConnectionFactoryDesc as DriverConnectionFactoryDesc;

            DbConfigReferenceNative = dbTable["db1"];
            DbConfigReferenceODBC   = dbTable["db2"];

            DriverConnectionFactoryNative = DbConfigReferenceNative
                                            .ConnectionFactoryDesc as DriverConnectionFactoryDesc;
            DriverConnectionFactoryOdbc = DbConfigReferenceODBC
                                          .ConnectionFactoryDesc as DriverConnectionFactoryDesc;
        }
Exemplo n.º 9
0
        private static void Configure(Configuration configuration)
        {
            foreach (Type clazz in new Type[]{
                typeof(SupportBean),
                typeof(SupportBean_S0),
                typeof(SupportBean_S1),
                typeof(SupportMarketDataBean),
                typeof(SupportBeanNumeric),
                typeof(SupportBean_ST0),
                typeof(SupportBean_A),
                typeof(SupportScheduleSimpleEvent),
                typeof(SupportBeanString),
                typeof(SupportEventWithIntArray)
            })
            {
                configuration.Common.AddEventType(clazz);
            }

            ConfigurationCommon common = configuration.Common;
            common.AddVariable("D", typeof(int), 1);
            common.AddVariable("H", typeof(int), 2);
            common.AddVariable("M", typeof(int), 3);
            common.AddVariable("S", typeof(int), 4);
            common.AddVariable("MS", typeof(int), 5);

            common.AddVariable("varoutone", typeof(bool), false);
            common.AddVariable("myint", typeof(int), 0);
            common.AddVariable("mystring", typeof(string), "");
            common.AddVariable("myvar", typeof(int), 0);
            common.AddVariable("count_insert_var", typeof(int), 0);
            common.AddVariable("myvardummy", typeof(int), 0);
            common.AddVariable("myvarlong", typeof(long), 0);

            configuration.Compiler.ByteCode.AllowSubscriber = true;
            configuration.Compiler.AddPlugInAggregationFunctionForge("customagg", typeof(SupportInvocationCountForge));
        }
Exemplo n.º 10
0
        private static void Configure(Configuration configuration)
        {
            foreach (Type clazz in new Type[] {
                typeof(SupportBean_A),
                typeof(SupportBean_B),
                typeof(SupportBean_C),
                typeof(SupportBean_D),
                typeof(SupportBean_E),
                typeof(SupportBean_F),
                typeof(SupportBean_G),
                typeof(SupportBean),
                typeof(SupportCallEvent),
                typeof(SupportRFIDEvent),
                typeof(SupportBean_N),
                typeof(SupportBean_S0),
                typeof(SupportIdEventA),
                typeof(SupportIdEventB),
                typeof(SupportIdEventC),
                typeof(SupportIdEventD),
                typeof(SupportMarketDataBean),
                typeof(SupportTradeEvent),
                typeof(SupportBeanComplexProps),
                typeof(SupportBeanCombinedProps),
                typeof(ISupportC),
                typeof(ISupportBaseAB),
                typeof(ISupportA),
                typeof(ISupportB),
                typeof(ISupportD),
                typeof(ISupportBaseD),
                typeof(ISupportBaseDBase),
                typeof(ISupportAImplSuperG),
                typeof(ISupportAImplSuperGImplPlus),
                typeof(SupportOverrideBase),
                typeof(SupportOverrideOne),
                typeof(SupportOverrideOneA),
                typeof(SupportOverrideOneB),
                typeof(ISupportCImpl),
                typeof(ISupportABCImpl),
                typeof(ISupportAImpl),
                typeof(ISupportBImpl),
                typeof(ISupportDImpl),
                typeof(ISupportBCImpl),
                typeof(ISupportBaseABImpl),
                typeof(ISupportAImplSuperGImpl),
                typeof(SupportEventWithIntArray)
            }) {
                configuration.Common.AddEventType(clazz.Name, clazz);
            }

            foreach (string name in Collections.List(
                "computeISO8601String",
                "getThe1980Calendar",
                "getThe1980Date",
                "getThe1980DateTime",
                "getThe1980DateTimeOffset",
                "getThe1980Long",
                "getTheSeconds")) {
                configuration.Compiler.AddPlugInSingleRowFunction(name, typeof(PatternObserverTimerSchedule), char.ToUpper(name[0]) + name.Substring(1));
            }

            ConfigurationCommon common = configuration.Common;
            common.AddVariable("lower", typeof(int), null);
            common.AddVariable("upper", typeof(int), null);
            common.AddVariable("VMIN", typeof(int), 0);
            common.AddVariable("VHOUR", typeof(int), 8);
            common.AddVariable("DD", typeof(double), 1);
            common.AddVariable("HH", typeof(double), 2);
            common.AddVariable("MM", typeof(double), 3);
            common.AddVariable("SS", typeof(double), 4);
            common.AddVariable("MS", typeof(double), 5);

            configuration.Runtime.ConditionHandling.AddClass(typeof(SupportConditionHandlerFactory));

            configuration.Common.AddImportType(typeof(SupportStaticMethodLib));

            configuration.Compiler.ByteCode.AttachEPL = true;
        }
Exemplo n.º 11
0
        private static void Configure(Configuration configuration)
        {
            foreach (Type clazz in new[] {
                typeof(SupportBean),
                typeof(SupportBean_S0),
                typeof(SupportBean_S1),
                typeof(SupportBean_S2),
                typeof(SupportBean_A),
                typeof(SupportBean_B),
                typeof(SupportMarketDataBean),
                typeof(EPLVariablesUse.MyVariableCustomEvent),
                typeof(SupportEventWithIntArray),
                typeof(SupportBeanNumeric)
            }) {
                configuration.Common.AddEventType(clazz);
            }

            configuration.Common.AddImportType(typeof(EPLVariablesUse.MySimpleVariableServiceFactory));
            configuration.Common.AddImportType(typeof(EPLVariablesUse.MySimpleVariableService));
            configuration.Common.AddImportType(typeof(EPLVariablesUse.MyVariableCustomType));

            configuration.Common.AddImportType(typeof(SupportEnum));

            ConfigurationCommon common = configuration.Common;
            common.AddVariable("var_simple_preconfig_const", "boolean", true, true);
            common.AddVariable("MYCONST_THREE", "boolean", true, true);
            common.AddVariable("papi_1", typeof(string), "begin");
            common.AddVariable("papi_2", typeof(bool), true);
            common.AddVariable("papi_3", typeof(string), "value");
            common.AddVariable("myRuntimeInitService", typeof(EPLVariablesUse.MySimpleVariableService), null);
            common.AddVariable("MYCONST_TWO", "string", null, true);
            common.AddVariable("varcoll", "String[]", new string[] {"E1", "E2"}, true);
            common.AddVariable("mySimpleVariableService", typeof(EPLVariablesUse.MySimpleVariableService), null);
            common.AddVariable("myInitService", typeof(EPLVariablesUse.MySimpleVariableService), EPLVariablesUse.MySimpleVariableServiceFactory.MakeService());
            common.AddVariable("supportEnum", typeof(SupportEnum), SupportEnum.ENUM_VALUE_1);
            common.AddVariable("enumWithOverride", typeof(EPLVariablesUse.MyEnumWithOverride), EPLVariablesUse.MyEnumWithOverride.LONG);
            common.AddVariable("var1", typeof(int), -1);
            common.AddVariable("var2", typeof(string), "abc");
            common.AddVariable("var1SS", typeof(string), "a");
            common.AddVariable("var2SS", typeof(string), "b");
            common.AddVariable("var1IFB", typeof(string), null);
            common.AddVariable("var2IFB", typeof(string), null);
            common.AddVariable("var1IF", typeof(string), null);
            common.AddVariable("var1OND", typeof(int?), "12");
            common.AddVariable("var2OND", typeof(int?), "2");
            common.AddVariable("var3OND", typeof(int?), null);
            common.AddVariable("var1OD", typeof(int?), 0);
            common.AddVariable("var2OD", typeof(int?), 1);
            common.AddVariable("var3OD", typeof(int?), 2);
            common.AddVariable("var1OM", typeof(double), 10d);
            common.AddVariable("var2OM", typeof(long?), 11L);
            common.AddVariable("var1C", typeof(double), 10d);
            common.AddVariable("var2C", typeof(long?), 11L);
            common.AddVariable("var1RTC", typeof(int?), 10);
            common.AddVariable("var1ROM", typeof(int?), null);
            common.AddVariable("var2ROM", typeof(int?), 1);
            common.AddVariable("var1COE", typeof(float?), null);
            common.AddVariable("var2COE", typeof(double?), null);
            common.AddVariable("var3COE", typeof(long?), null);
            common.AddVariable("var1IS", typeof(string), null);
            common.AddVariable("var2IS", typeof(bool), false);
            common.AddVariable("var3IS", typeof(int), 1);
            common.AddVariable("MyPermanentVar", typeof(string), "thevalue");
            common.AddVariable("vars0_A", "SupportBean_S0", new SupportBean_S0(10));
            common.AddVariable("vars1_A", typeof(SupportBean_S1), new SupportBean_S1(20));
            common.AddVariable("varsobj1", typeof(object), 123, true);
            common.AddVariable("vars2", "SupportBean_S2", new SupportBean_S2(30));
            common.AddVariable("vars3", typeof(SupportBean_S3), new SupportBean_S3(40));
            common.AddVariable("varsobj2", typeof(object), "ABC", true);
            common.AddVariable("var_output_limit", typeof(long), "3");
            common.AddVariable("myNonSerializable", typeof(EPLVariablesEventTyped.NonSerializable), EPLVariablesEventTyped.NON_SERIALIZABLE);
            common.AddVariable("my_variable_custom_typed", typeof(EPLVariablesUse.MyVariableCustomType), EPLVariablesUse.MyVariableCustomType.Of("abc"), true);
            common.AddVariable("varargsTestClient", typeof(EPLVariablesUse.SupportVarargsClient), new EPLVariablesUse.SupportVarargsClientImpl());

            common.AddVariable("my_variable_custom_typed", typeof(EPLVariablesUse.MyVariableCustomType), EPLVariablesUse.MyVariableCustomType.Of("abc"), true);

            configuration.Compiler.ViewResources.IterableUnbound = true;
            configuration.Compiler.ByteCode.AllowSubscriber = true;
        }