public void SetUp()
        {
            var configuration = new Configuration();

            configuration.EngineDefaults.EventMetaConfig.ClassPropertyResolutionStyle =
                PropertyResolutionStyle.CASE_INSENSITIVE;

            _listener = new MatchAlertListener();
            EPServiceProviderManager.PurgeDefaultProvider();
            _epService = EPServiceProviderManager.GetDefaultProvider(configuration);
            _epService.Initialize();

            new MatchMakingMonitor(_epService, _listener);
        }
Beispiel #2
0
        public void SetUp()
        {
            var container = ContainerExtensions.CreateDefaultContainer()
                            .InitializeDefaultServices()
                            .InitializeDatabaseDrivers();

            var configuration = new Configuration(container);

            configuration.EngineDefaults.EventMeta.ClassPropertyResolutionStyle =
                PropertyResolutionStyle.CASE_INSENSITIVE;

            _listener = new MatchAlertListener();
            EPServiceProviderManager.PurgeDefaultProvider();
            _epService = EPServiceProviderManager.GetDefaultProvider(configuration);
            _epService.Initialize();

            new MatchMakingMonitor(_epService, _listener);
        }
        public void SetUp()
        {
            var container = ContainerExtensions.CreateDefaultContainer()
                            .InitializeDefaultServices()
                            .InitializeDatabaseDrivers();

            var configuration = new Configuration(container);

            configuration.Common.EventMeta.ClassPropertyResolutionStyle =
                PropertyResolutionStyle.CASE_INSENSITIVE;

            _listener = new MatchAlertListener();
            EPRuntimeProvider
            .GetDefaultRuntime()
            .DeploymentService
            .UndeployAll();

            _runtime = EPRuntimeProvider.GetDefaultRuntime(configuration);
            _runtime.Initialize();

            new MatchMakingMonitor(_runtime, _listener);
        }
Beispiel #4
0
        public void Run()
        {
            Log.Info("Setting up EPL");
            // This code runs as part of the automated regression test suite; Therefore disable internal timer theading to safe resources
            var config = new Configuration();

            config.EngineDefaults.Threading.IsInternalTimerEnabled = false;

            var listener  = new MatchAlertListener();
            var epService = EPServiceProviderManager.GetProvider(_engineURI, config);

            epService.Initialize();

            new MatchMakingMonitor(epService, listener);

            Log.Info("Sending user information");
            var user1 = new MobileUserBean(1, 10, 10,
                                           Gender.MALE, HairColor.BLONDE, AgeRange.AGE_4,
                                           Gender.FEMALE, HairColor.BLACK, AgeRange.AGE_1);

            epService.EPRuntime.SendEvent(user1);

            var user2 = new MobileUserBean(2, 10, 10,
                                           Gender.FEMALE, HairColor.BLACK, AgeRange.AGE_1,
                                           Gender.MALE, HairColor.BLONDE, AgeRange.AGE_4);

            epService.EPRuntime.SendEvent(user2);

            Log.Info("Sending some near locations");
            user1.SetLocation(8.99999, 10);
            epService.EPRuntime.SendEvent(user1);

            user1.SetLocation(9, 10);
            epService.EPRuntime.SendEvent(user1);

            user1.SetLocation(11, 10);
            epService.EPRuntime.SendEvent(user1);

            user1.SetLocation(11.0000001, 10);
            epService.EPRuntime.SendEvent(user1);

            user2.SetLocation(10.0000001, 9);
            epService.EPRuntime.SendEvent(user2);

            user1 = new MobileUserBean(1, 10, 10,
                                       Gender.MALE, HairColor.RED, AgeRange.AGE_6,
                                       Gender.FEMALE, HairColor.BLACK, AgeRange.AGE_5);
            epService.EPRuntime.SendEvent(user1);

            // Test all combinations
            foreach (var gender in EnumHelper.GetValues <Gender>())
            {
                foreach (var color in EnumHelper.GetValues <HairColor>())
                {
                    foreach (var age in EnumHelper.GetValues <AgeRange>())
                    {
                        // Try user preferences
                        var userA = new MobileUserBean(2, 10, 10,
                                                       Gender.FEMALE, HairColor.BLACK, AgeRange.AGE_5,
                                                       gender, color, age);
                        epService.EPRuntime.SendEvent(userA);
                    }
                }
            }

            var random = new Random();
            int maxEvents;

            if (_continuousSimulation)
            {
                maxEvents = int.MaxValue;
            }
            else
            {
                maxEvents = 100000;
                Log.Info("Sending 100k of random locations");
            }

            for (var i = 1; i < maxEvents; i++)
            {
                var x = 10 + random.Next(i) / 100000;
                var y = 10 + random.Next(i) / 100000;

                user2.SetLocation(x, y);
                epService.EPRuntime.SendEvent(user2);

                if (_continuousSimulation)
                {
                    try {
                        Thread.Sleep(200);
                    } catch (ThreadInterruptedException e) {
                        Log.Debug("Interrupted", e);
                    }
                }
            }

            Log.Info("Done.");
        }