Example #1
0
        public void SetUp()
        {
            lockFactory = new FilterServiceGranularLockFactoryReentrant(
                container.RWLockManager());

            eventType = SupportEventTypeFactory
                        .GetInstance(container)
                        .CreateBeanType(typeof(SupportBean));
            parameters = new ArrayDeque <FilterValueSetParam>();

            // Create parameter test list
            parameterOne = new FilterValueSetParamImpl(MakeLookupable("IntPrimitive"), FilterOperator.GREATER, 10);
            parameters.Add(parameterOne);
            parameterTwo = new FilterValueSetParamImpl(MakeLookupable("DoubleBoxed"), FilterOperator.GREATER, 20d);
            parameters.Add(parameterTwo);
            parameterThree = new FilterValueSetParamImpl(MakeLookupable("string"), FilterOperator.EQUAL, "sometext");
            parameters.Add(parameterThree);
        }
        public void SetUp()
        {
            var supportEventTypeFactory = SupportEventTypeFactory.GetInstance(container);

            lockFactory = new FilterServiceGranularLockFactoryReentrant(
                container.RWLockManager());

            eventTypeIndex = new EventTypeIndex(lockFactory);
            indexBuilder   = new EventTypeIndexBuilder(eventTypeIndex);

            typeOne = supportEventTypeFactory.CreateBeanType(typeof(SupportBean));
            typeTwo = supportEventTypeFactory.CreateBeanType(typeof(SupportBeanSimple));

            valueSetOne = SupportFilterSpecBuilder.Build(typeOne, new object[0]).GetValueSet(null, null, null, null);
            valueSetTwo = SupportFilterSpecBuilder.Build(typeTwo, new object[0]).GetValueSet(null, null, null, null);

            callbackOne = new SupportFilterHandle();
            callbackTwo = new SupportFilterHandle();
        }
        public void SetUp()
        {
            lockFactory = new FilterServiceGranularLockFactoryReentrant(
                container.RWLockManager());

            eventType = SupportEventTypeFactory
                        .GetInstance(container)
                        .CreateBeanType(typeof(SupportBean));
            topNode         = new FilterHandleSetNode(new SlimReaderWriterLock());
            filterCallbacks = new List <FilterHandle>();

            testFilterSpecs = new List <FilterSpecActivatable>();
            matchedEvents   = new List <EventBean>();
            unmatchedEvents = new List <EventBean>();

            // Any int and double value specified here must match only the current filter spec not any other filter spec
            testFilterSpecs.Add(MakeSpec(new object[] { "IntPrimitive", FilterOperator.GREATER_OR_EQUAL, 100000 }));
            matchedEvents.Add(MakeEvent(9999999, -1));
            unmatchedEvents.Add(MakeEvent(0, -1));

            testFilterSpecs.Add(
                MakeSpec(
                    new object[] {
                "IntPrimitive", FilterOperator.GREATER_OR_EQUAL, 10,
                "DoublePrimitive", FilterOperator.EQUAL, 0.5
            }));
            matchedEvents.Add(MakeEvent(10, 0.5));
            unmatchedEvents.Add(MakeEvent(0, 0.5));

            testFilterSpecs.Add(MakeSpec(new object[] { "DoublePrimitive", FilterOperator.EQUAL, 0.8 }));
            matchedEvents.Add(MakeEvent(-1, 0.8));
            unmatchedEvents.Add(MakeEvent(-1, 0.1));

            testFilterSpecs.Add(
                MakeSpec(
                    new object[] {
                "DoublePrimitive", FilterOperator.EQUAL, 99.99,
                "IntPrimitive", FilterOperator.LESS, 1
            }));
            matchedEvents.Add(MakeEvent(0, 99.99));
            unmatchedEvents.Add(MakeEvent(2, 0.5));

            testFilterSpecs.Add(
                MakeSpec(
                    new object[] {
                "DoublePrimitive", FilterOperator.GREATER, .99,
                "IntPrimitive", FilterOperator.EQUAL, 5001
            }));
            matchedEvents.Add(MakeEvent(5001, 1.1));
            unmatchedEvents.Add(MakeEvent(5002, 0.98));

            testFilterSpecs.Add(MakeSpec(new object[] { "IntPrimitive", FilterOperator.LESS, -99000 }));
            matchedEvents.Add(MakeEvent(-99001, -1));
            unmatchedEvents.Add(MakeEvent(-98999, -1));

            testFilterSpecs.Add(
                MakeSpec(
                    new object[] {
                "IntPrimitive", FilterOperator.GREATER_OR_EQUAL, 11,
                "DoublePrimitive", FilterOperator.GREATER, 888.0
            }));
            matchedEvents.Add(MakeEvent(11, 888.001));
            unmatchedEvents.Add(MakeEvent(10, 888));

            testFilterSpecs.Add(
                MakeSpec(
                    new object[] {
                "IntPrimitive", FilterOperator.EQUAL, 973,
                "DoublePrimitive", FilterOperator.EQUAL, 709.0
            }));
            matchedEvents.Add(MakeEvent(973, 709));
            unmatchedEvents.Add(MakeEvent(0, 0.5));

            testFilterSpecs.Add(
                MakeSpec(
                    new object[] {
                "IntPrimitive", FilterOperator.EQUAL, 973,
                "DoublePrimitive", FilterOperator.EQUAL, 655.0
            }));
            matchedEvents.Add(MakeEvent(973, 655));
            unmatchedEvents.Add(MakeEvent(33838, 655.5));
        }