public MySupportFilterHandle(FilterServiceLockCoarse filterService, FilterHandle callback, EventType eventType, FilterValueSetParam[][] spec) { this.filterService = filterService; this.callback = callback; this.eventType = eventType; this.spec = spec; }
public void SetUp() { supportEventBeanFactory = SupportEventBeanFactory.GetInstance(container); filterService = new FilterServiceLockCoarse(container.RWLockManager(), -1); eventTypeOne = supportEventTypeFactory.CreateBeanType(typeof(SupportBean)); eventTypeTwo = supportEventTypeFactory.CreateBeanType(typeof(SupportBeanSimple)); filterSpecs = new List <Pair <EventType, FilterValueSetParam[][]> >(); filterSpecs.Add( new Pair <EventType, FilterValueSetParam[][]>( eventTypeOne, SupportFilterSpecBuilder.Build(eventTypeOne, new object[0]).GetValueSet(null, null, null, null))); filterSpecs.Add( new Pair <EventType, FilterValueSetParam[][]>( eventTypeOne, SupportFilterSpecBuilder.Build( eventTypeOne, new object[] { "IntPrimitive", FilterOperator.RANGE_CLOSED, 10, 20, "TheString", FilterOperator.EQUAL, "HELLO", "BoolPrimitive", FilterOperator.EQUAL, false, "DoubleBoxed", FilterOperator.GREATER, 100d }) .GetValueSet(null, null, null, null))); filterSpecs.Add( new Pair <EventType, FilterValueSetParam[][]>( eventTypeTwo, SupportFilterSpecBuilder.Build(eventTypeTwo, new object[0]).GetValueSet(null, null, null, null))); filterSpecs.Add( new Pair <EventType, FilterValueSetParam[][]>( eventTypeTwo, SupportFilterSpecBuilder.Build( eventTypeTwo, new object[] { "MyInt", FilterOperator.RANGE_HALF_CLOSED, 1, 10, "MyString", FilterOperator.EQUAL, "Hello" }) .GetValueSet(null, null, null, null))); // Create callbacks and add filterCallbacks = new List <SupportFilterHandle>(); for (var i = 0; i < filterSpecs.Count; i++) { filterCallbacks.Add(new SupportFilterHandle()); filterService.Add(filterSpecs[i].First, filterSpecs[i].Second, filterCallbacks[i]); } // Create events matchesExpected = new List <int[]>(); events = new List <EventBean>(); events.Add(MakeTypeOneEvent(15, "HELLO", false, 101)); matchesExpected.Add(new[] { 1, 1, 0, 0 }); events.Add(MakeTypeTwoEvent("Hello", 100)); matchesExpected.Add(new[] { 0, 0, 1, 0 }); events.Add(MakeTypeTwoEvent("Hello", 1)); // eventNumber = 2 matchesExpected.Add(new[] { 0, 0, 1, 0 }); events.Add(MakeTypeTwoEvent("Hello", 2)); matchesExpected.Add(new[] { 0, 0, 1, 1 }); events.Add(MakeTypeOneEvent(15, "HELLO", true, 100)); matchesExpected.Add(new[] { 1, 0, 0, 0 }); events.Add(MakeTypeOneEvent(15, "HELLO", false, 99)); matchesExpected.Add(new[] { 1, 0, 0, 0 }); events.Add(MakeTypeOneEvent(9, "HELLO", false, 100)); matchesExpected.Add(new[] { 1, 0, 0, 0 }); events.Add(MakeTypeOneEvent(10, "no", false, 100)); matchesExpected.Add(new[] { 1, 0, 0, 0 }); events.Add(MakeTypeOneEvent(15, "HELLO", false, 999999)); // number 8 matchesExpected.Add(new[] { 1, 1, 0, 0 }); events.Add(MakeTypeTwoEvent("Hello", 10)); matchesExpected.Add(new[] { 0, 0, 1, 1 }); events.Add(MakeTypeTwoEvent("Hello", 11)); matchesExpected.Add(new[] { 0, 0, 1, 0 }); }