public void TestExpressionNodeArray()
        {
            ConfigurationEventTypeXMLDOM eventTypeMeta = new ConfigurationEventTypeXMLDOM();

            eventTypeMeta.RootElementName = "simpleEvent";
            String schemaUri = ResourceManager.ResolveResourceURL(CLASSLOADER_SCHEMA_URI).ToString();

            eventTypeMeta.SchemaResource = schemaUri;
            epService.EPAdministrator.Configuration.AddEventType("TestXMLSchemaType", eventTypeMeta);

            // try array property insert
            EPStatement stmtInsert = epService.EPAdministrator.CreateEPL("select nested3.nested4 as narr from TestXMLSchemaType.std:lastevent()");

            EPAssertionUtil.AssertEqualsAnyOrder(new [] {
                new EventPropertyDescriptor("narr", typeof(XmlNode[]), typeof(XmlNode), false, false, true, false, true),
            }, stmtInsert.EventType.PropertyDescriptors);
            EventTypeAssertionUtil.AssertConsistency(stmtInsert.EventType);

            SupportXML.SendDefaultEvent(epService.EPRuntime, "test");

            EventBean result = stmtInsert.First();

            EventTypeAssertionUtil.AssertConsistency(result);
            EventBean[] fragments = (EventBean[])result.GetFragment("narr");
            Assert.AreEqual(3, fragments.Length);
            Assert.AreEqual("SAMPLE_V8", fragments[0].Get("prop5[1]"));
            Assert.AreEqual("SAMPLE_V11", fragments[2].Get("prop5[1]"));

            EventBean fragmentItem = (EventBean)result.GetFragment("narr[2]");

            Assert.AreEqual("TestXMLSchemaType.nested3.nested4", fragmentItem.EventType.Name);
            Assert.AreEqual("SAMPLE_V10", fragmentItem.Get("prop5[0]"));

            // try array index property insert
            EPStatement stmtInsertItem = epService.EPAdministrator.CreateEPL("select nested3.nested4[1] as narr from TestXMLSchemaType.std:lastevent()");

            EPAssertionUtil.AssertEqualsAnyOrder(new [] {
                new EventPropertyDescriptor("narr", typeof(XmlNode), null, false, false, false, false, true),
            }, stmtInsertItem.EventType.PropertyDescriptors);
            EventTypeAssertionUtil.AssertConsistency(stmtInsertItem.EventType);

            SupportXML.SendDefaultEvent(epService.EPRuntime, "test");

            EventBean resultItem = stmtInsertItem.First();

            Assert.AreEqual("b", resultItem.Get("narr.id"));
            EventTypeAssertionUtil.AssertConsistency(resultItem);
            EventBean fragmentsInsertItem = (EventBean)resultItem.GetFragment("narr");

            EventTypeAssertionUtil.AssertConsistency(fragmentsInsertItem);
            Assert.AreEqual("b", fragmentsInsertItem.Get("id"));
            Assert.AreEqual("SAMPLE_V9", fragmentsInsertItem.Get("prop5[0]"));
        }
        private void RunAssertionFragment(EPServiceProvider epService)
        {
            string      stmtTxtOne = "select * from pattern [[2] a=A -> b=B]";
            EPStatement stmt       = epService.EPAdministrator.CreateEPL(stmtTxtOne);
            var         listener   = new SupportUpdateListener();

            stmt.Events += listener.Update;

            EPAssertionUtil.AssertEqualsAnyOrder(new EventPropertyDescriptor[] {
                new EventPropertyDescriptor("a", typeof(SupportBean_A[]), typeof(SupportBean_A), false, false, true, false, true),
                new EventPropertyDescriptor("b", typeof(SupportBean_B), null, false, false, false, false, true)
            }, stmt.EventType.PropertyDescriptors);

            epService.EPRuntime.SendEvent(new SupportBean_A("A1"));
            epService.EPRuntime.SendEvent(new SupportBean_A("A2"));
            epService.EPRuntime.SendEvent(new SupportBean_B("B1"));

            EventBean theEvent = listener.AssertOneGetNewAndReset();

            Assert.IsTrue(theEvent.Underlying is IDictionary <string, object>);

            // test fragment B type and event
            FragmentEventType typeFragB = theEvent.EventType.GetFragmentType("b");

            Assert.IsFalse(typeFragB.IsIndexed);
            Assert.AreEqual("B", typeFragB.FragmentType.Name);
            Assert.AreEqual(typeof(string), typeFragB.FragmentType.GetPropertyType("id"));

            EventBean eventFragB = (EventBean)theEvent.GetFragment("b");

            Assert.AreEqual("B", eventFragB.EventType.Name);

            // test fragment A type and event
            FragmentEventType typeFragA = theEvent.EventType.GetFragmentType("a");

            Assert.IsTrue(typeFragA.IsIndexed);
            Assert.AreEqual("A", typeFragA.FragmentType.Name);
            Assert.AreEqual(typeof(string), typeFragA.FragmentType.GetPropertyType("id"));

            Assert.IsTrue(theEvent.GetFragment("a") is EventBean[]);
            EventBean eventFragA1 = (EventBean)theEvent.GetFragment("a[0]");

            Assert.AreEqual("A", eventFragA1.EventType.Name);
            Assert.AreEqual("A1", eventFragA1.Get("id"));
            EventBean eventFragA2 = (EventBean)theEvent.GetFragment("a[1]");

            Assert.AreEqual("A", eventFragA2.EventType.Name);
            Assert.AreEqual("A2", eventFragA2.Get("id"));

            stmt.Dispose();
        }
Beispiel #3
0
        private void RunAssertionSubquerySelectStar(object[] rowValues)
        {
            string eplFiltered = "select (select * from MyTable where key = 'G1') as mt from SupportBean_S2";

            RunAssertionSubquerySelectStar(rowValues, eplFiltered);

            string eplUnfiltered = "select (select * from MyTable) as mt from SupportBean_S2";

            RunAssertionSubquerySelectStar(rowValues, eplUnfiltered);

            // With @eventbean
            string      eplEventBean = "select (select * from MyTable) @eventbean as mt from SupportBean_S2";
            EPStatement stmt         = _epService.EPAdministrator.CreateEPL(eplEventBean);

            stmt.AddListener(_listener);
            Assert.AreEqual(typeof(object[][]), stmt.EventType.GetPropertyType("mt"));
            Assert.AreSame(GetTablePublicType("MyTable"), stmt.EventType.GetFragmentType("mt").FragmentType);

            _epService.EPRuntime.SendEvent(new SupportBean_S2(0));
            EventBean @event = _listener.AssertOneGetNewAndReset();

            object[][] value = (object[][])@event.Get("mt");
            AssertEventUnd(value[0], rowValues);
            Assert.AreSame(GetTablePublicType("MyTable"), ((EventBean[])@event.GetFragment("mt"))[0].EventType);

            stmt.Dispose();
        }
Beispiel #4
0
 public Object GetFragment(String propertyExpression)
 {
     if (_optionalSynthetic != null)
     {
         return(_optionalSynthetic.GetFragment(propertyExpression));
     }
     throw new PropertyAccessException("Property access not allowed for natural events without the synthetic event present");
 }
 private static void AssertFragmentArray(EventBean @event, bool isNative, string propertyExpression)
 {
     var fragmentBean = (EventBean[]) @event.GetFragment(propertyExpression);
     FragmentEventType fragmentType = @event.EventType.GetFragmentType(propertyExpression);
     ScopeTestHelper.AssertTrue("failed for " + propertyExpression, fragmentType.IsIndexed);
     ScopeTestHelper.AssertEquals("failed for " + propertyExpression, isNative, fragmentType.IsNative);
     ScopeTestHelper.AssertSame(
         "failed for " + propertyExpression, fragmentBean[0].EventType, fragmentType.FragmentType);
     AssertConsistency(fragmentBean[0]);
 }
Beispiel #6
0
        public override EventBean ProcessSpecific(IDictionary <String, Object> props,
                                                  EventBean[] eventsPerStream,
                                                  bool isNewData,
                                                  ExprEvaluatorContext exprEvaluatorContext)
        {
            // In case of a wildcard and single stream that is itself a
            // wrapper bean, we also need to add the map properties
            if (_singleStreamWrapper)
            {
                var wrapper = (DecoratingEventBean)eventsPerStream[0];
                if (wrapper != null)
                {
                    IDictionary <String, Object> map = wrapper.DecoratingProperties;
                    props.PutAll(map);
                }
            }

            EventBean theEvent = null;

            if (_underlyingIsFragmentEvent)
            {
                EventBean eventBean = eventsPerStream[_underlyingStreamNumber];
                theEvent = (EventBean)eventBean.GetFragment(_unnamedStreams[0].StreamSelected.StreamName);
            }
            else if (_underlyingPropertyEventGetter != null)
            {
                object value = _underlyingPropertyEventGetter.Get(eventsPerStream[_underlyingStreamNumber]);
                if (value != null)
                {
                    theEvent = SelectExprContext.EventAdapterService.AdapterForObject(value);
                }
            }
            else if (_underlyingExprEvaluator != null)
            {
                object value = _underlyingExprEvaluator.Evaluate(new EvaluateParams(eventsPerStream, true, exprEvaluatorContext));
                if (value != null)
                {
                    theEvent = SelectExprContext.EventAdapterService.AdapterForObject(value);
                }
            }
            else
            {
                theEvent = eventsPerStream[_underlyingStreamNumber];
                if (_tableMetadata != null && theEvent != null)
                {
                    theEvent = _tableMetadata.EventToPublic.Convert(theEvent, new EvaluateParams(eventsPerStream, isNewData, exprEvaluatorContext));
                }
            }

            // Using a wrapper bean since we cannot use the same event type else same-type filters match.
            // Wrapping it even when not adding properties is very inexpensive.
            return(base.SelectExprContext.EventAdapterService.AdapterForTypedWrapper(theEvent, props, base.ResultEventType));
        }
Beispiel #7
0
        private void AssertNestedElement(EventBean eventBean, String propertyName, String value)
        {
            FragmentEventType fragmentTypeOne = eventBean.EventType.GetFragmentType(propertyName);

            Assert.AreEqual(true, fragmentTypeOne.IsNative);
            Assert.AreEqual(false, fragmentTypeOne.IsIndexed);
            Assert.AreEqual(typeof(SupportBeanIterableProps.SupportBeanSpecialGetterNested), fragmentTypeOne.FragmentType.UnderlyingType);

            EventBean theEvent = (EventBean)eventBean.GetFragment(propertyName);

            Assert.AreEqual(value, theEvent.Get("NestedValue"));
        }
Beispiel #8
0
 private static void TryInvalidGetFragment(EventBean eventBean, String propName)
 {
     try
     {
         eventBean.GetFragment(propName);
         Assert.Fail();
     }
     catch (PropertyAccessException ex)
     {
         // expected
     }
 }
Beispiel #9
0
        private void AssertReceived(SupportUpdateListener listener, object[][] values)
        {
            EventBean @event = listener.AssertOneGetNewAndReset();

            EventBean[] events = (EventBean[])@event.GetFragment("detail");
            if (values == null)
            {
                Assert.IsNull(events);
                return;
            }
            EPAssertionUtil.AssertPropsPerRowAnyOrder(events, "c0,c1".Split(','), values);
        }
Beispiel #10
0
 public static void TryInvalidGetFragment(
     EventBean @event,
     string propertyName)
 {
     try {
         @event.GetFragment(propertyName);
         Assert.Fail();
     }
     catch (PropertyAccessException ex) {
         // expected
         AssertMessage(ex, "Property named '" + propertyName + "' is not a valid property name for this type");
     }
 }
Beispiel #11
0
        private void AssertNestedCollection(EventBean eventBean, String propertyName, String prefix)
        {
            FragmentEventType fragmentTypeTwo = eventBean.EventType.GetFragmentType(propertyName);

            Assert.AreEqual(true, fragmentTypeTwo.IsNative);
            Assert.AreEqual(true, fragmentTypeTwo.IsIndexed);
            Assert.AreEqual(typeof(SupportBeanIterableProps.SupportBeanSpecialGetterNested), fragmentTypeTwo.FragmentType.UnderlyingType);

            EventBean[] events = (EventBean[])eventBean.GetFragment(propertyName);
            Assert.AreEqual(2, events.Length);
            Assert.AreEqual(prefix + "N1", events[0].Get("NestedValue"));
            Assert.AreEqual(prefix + "N2", events[1].Get("NestedValue"));
        }
        public void TestExpressionPrimitiveArray()
        {
            ConfigurationEventTypeXMLDOM eventTypeMeta = new ConfigurationEventTypeXMLDOM();

            eventTypeMeta.RootElementName = "simpleEvent";
            eventTypeMeta.SchemaResource  = schemaURI;
            epService.EPAdministrator.Configuration.AddEventType("ABCType", eventTypeMeta);

            eventTypeMeta = new ConfigurationEventTypeXMLDOM();
            eventTypeMeta.RootElementName            = "//nested2";
            eventTypeMeta.SchemaResource             = schemaURI;
            eventTypeMeta.IsEventSenderValidatesRoot = false;
            epService.EPAdministrator.Configuration.AddEventType("TestNested2", eventTypeMeta);

            // try array property in select
            EPStatement stmtInsert = epService.EPAdministrator.CreateEPL("select * from TestNested2.std:lastevent()");

            stmtInsert.Events += listener.Update;
            EPAssertionUtil.AssertEqualsAnyOrder(new [] {
                new EventPropertyDescriptor("prop3", typeof(int?[]), typeof(int?), false, false, true, false, false),
            }, stmtInsert.EventType.PropertyDescriptors);
            EventTypeAssertionUtil.AssertConsistency(stmtInsert.EventType);

            SupportXML.SendDefaultEvent(epService.EPRuntime, "test");
            Assert.IsFalse(listener.IsInvoked);

            EventSender sender = epService.EPRuntime.GetEventSender("TestNested2");

            sender.SendEvent(SupportXML.GetDocument("<nested2><prop3>2</prop3><prop3></prop3><prop3>4</prop3></nested2>"));
            EventBean theEvent = stmtInsert.First();

            EPAssertionUtil.AssertEqualsExactOrder((int?[])theEvent.Get("prop3"), new int?[] { 2, null, 4 });
            EventTypeAssertionUtil.AssertConsistency(theEvent);

            // try array property nested
            EPStatement stmtSelect = epService.EPAdministrator.CreateEPL("select nested3.* from ABCType.std:lastevent()");

            SupportXML.SendDefaultEvent(epService.EPRuntime, "test");
            EventBean stmtSelectResult = stmtSelect.First();

            EventTypeAssertionUtil.AssertConsistency(stmtSelectResult);
            Assert.AreEqual(typeof(String[]), stmtSelectResult.EventType.GetPropertyType("nested4[2].prop5"));
            Assert.AreEqual("SAMPLE_V8", stmtSelectResult.Get("nested4[0].prop5[1]"));
            EPAssertionUtil.AssertEqualsExactOrder((String[])stmtSelectResult.Get("nested4[2].prop5"), new Object[] { "SAMPLE_V10", "SAMPLE_V11" });

            EventBean fragmentNested4 = (EventBean)stmtSelectResult.GetFragment("nested4[2]");

            EPAssertionUtil.AssertEqualsExactOrder((String[])fragmentNested4.Get("prop5"), new Object[] { "SAMPLE_V10", "SAMPLE_V11" });
            Assert.AreEqual("SAMPLE_V11", fragmentNested4.Get("prop5[1]"));
            EventTypeAssertionUtil.AssertConsistency(fragmentNested4);
        }
Beispiel #13
0
        private void AssertNestedElement(
            EventBean eventBean,
            string propertyName,
            string value)
        {
            var fragmentTypeOne = eventBean.EventType.GetFragmentType(propertyName);
            Assert.AreEqual(true, fragmentTypeOne.IsNative);
            Assert.AreEqual(false, fragmentTypeOne.IsIndexed);
            Assert.AreEqual(typeof(SupportBeanIterableProps.SupportBeanSpecialGetterNested), fragmentTypeOne.FragmentType.UnderlyingType);

            var theEvent = (EventBean) eventBean.GetFragment(propertyName);
            Assert.That(theEvent, Is.Not.Null);
            Assert.That(theEvent.Get("NestedValue"), Is.EqualTo(value));
        }
        private void RunAssertPopulateFromNamedWindow(EPServiceProvider epService, EventRepresentationChoice type)
        {
            epService.EPAdministrator.CreateEPL("create " + type.GetOutputTypeCreateSchemaName() + " schema Node(nid string)");
            epService.EPAdministrator.CreateEPL("create window NodeWindow#unique(nid) as Node");
            epService.EPAdministrator.CreateEPL("insert into NodeWindow select * from Node");
            epService.EPAdministrator.CreateEPL("create " + type.GetOutputTypeCreateSchemaName() + " schema NodePlus(npid string, node Node)");

            EPStatement stmt     = epService.EPAdministrator.CreateEPL("insert into NodePlus select 'E1' as npid, n1 as node from NodeWindow n1");
            var         listener = new SupportUpdateListener();

            stmt.Events += listener.Update;

            if (type.IsObjectArrayEvent())
            {
                epService.EPRuntime.SendEvent(new object[] { "n1" }, "Node");
            }
            else if (type.IsMapEvent())
            {
                epService.EPRuntime.SendEvent(Collections.SingletonDataMap("nid", "n1"), "Node");
            }
            else if (type.IsAvroEvent())
            {
                var genericRecord = new GenericRecord(SchemaBuilder.Record("name", RequiredString("nid")));
                genericRecord.Put("nid", "n1");
                epService.EPRuntime.SendEventAvro(genericRecord, "Node");
            }
            else
            {
                Assert.Fail();
            }
            EventBean @event = listener.AssertOneGetNewAndReset();

            Assert.AreEqual("E1", @event.Get("npid"));
            Assert.AreEqual("n1", @event.Get("node.nid"));
            EventBean fragment = (EventBean)@event.GetFragment("node");

            Assert.AreEqual("Node", fragment.EventType.Name);

            epService.EPAdministrator.DestroyAllStatements();
            epService.EPAdministrator.Configuration.RemoveEventType("Node", true);
            epService.EPAdministrator.Configuration.RemoveEventType("NodePlus", true);
            epService.EPAdministrator.Configuration.RemoveEventType("NodeWindow", true);
        }
Beispiel #15
0
        public void TestGetComplexProperty()
        {
            SupportBeanCombinedProps eventCombined = SupportBeanCombinedProps.MakeDefaultBean();
            EventBean eventBean = SupportEventBeanFactory.CreateObject(eventCombined);

            Assert.AreEqual("0ma0", eventBean.Get("Indexed[0].Mapped('0ma').Value"));
            Assert.AreEqual(typeof(string), eventBean.EventType.GetPropertyType("Indexed[0].Mapped('0ma').Value"));
            Assert.IsNotNull(eventBean.EventType.GetGetter("Indexed[0].Mapped('0ma').Value"));
            Assert.AreEqual("0ma1", eventBean.Get("Indexed[0].Mapped('0mb').Value"));
            Assert.AreEqual("1ma0", eventBean.Get("Indexed[1].Mapped('1ma').Value"));
            Assert.AreEqual("1ma1", eventBean.Get("Indexed[1].Mapped('1mb').Value"));

            Assert.AreEqual("0ma0", eventBean.Get("Array[0].Mapped('0ma').Value"));
            Assert.AreEqual("1ma1", eventBean.Get("Array[1].Mapped('1mb').Value"));
            Assert.AreEqual("0ma0", eventBean.Get("Array[0].Mapprop('0ma').Value"));
            Assert.AreEqual("1ma1", eventBean.Get("Array[1].Mapprop('1mb').Value"));

            TryInvalidGet(eventBean, "Dummy");
            TryInvalidGet(eventBean, "Dummy[1]");
            TryInvalidGet(eventBean, "Dummy('dd')");
            TryInvalidGet(eventBean, "Dummy.Dummy1");

            // indexed getter
            TryInvalidGetFragment(eventBean, "Indexed");
            Assert.AreEqual(typeof(SupportBeanCombinedProps.NestedLevOne), ((EventBean)eventBean.GetFragment("Indexed[0]")).EventType.UnderlyingType);
            Assert.AreEqual("abc", ((EventBean)eventBean.GetFragment("Array[0]")).Get("NestLevOneVal"));
            Assert.AreEqual("abc", ((EventBean)eventBean.GetFragment("Array[2]?")).Get("NestLevOneVal"));
            Assert.IsNull(eventBean.GetFragment("Array[3]?"));
            Assert.IsNull(eventBean.GetFragment("Array[4]?"));
            Assert.IsNull(eventBean.GetFragment("Array[5]?"));

            String eventText = EventTypeAssertionUtil.Print(eventBean);
            //Console.Out.WriteLine(eventText);

            SupportBeanComplexProps eventComplex = SupportBeanComplexProps.MakeDefaultBean();

            eventBean = SupportEventBeanFactory.CreateObject(eventComplex);
            Assert.AreEqual("NestedValue", ((EventBean)eventBean.GetFragment("Nested")).Get("NestedValue"));
        }
        private void RunAssertionXPathConfigured(string schemaURI, EPServiceProvider epService)
        {
            var rootMeta = new ConfigurationEventTypeXMLDOM();

            rootMeta.RootElementName = "simpleEvent";
            rootMeta.SchemaResource  = schemaURI;
            rootMeta.AddNamespacePrefix("ss", "samples:schemas:simpleSchema");
            rootMeta.AddXPathPropertyFragment("nested1simple", "/ss:simpleEvent/ss:nested1", XPathResultType.Any, "MyNestedEvent");
            rootMeta.AddXPathPropertyFragment("nested4array", "//ss:nested4", XPathResultType.NodeSet, "MyNestedArrayEvent");
            rootMeta.IsAutoFragment = false;
            epService.EPAdministrator.Configuration.AddEventType("MyXMLEvent", rootMeta);

            var metaNested = new ConfigurationEventTypeXMLDOM();

            metaNested.RootElementName = "//nested1";
            metaNested.SchemaResource  = schemaURI;
            metaNested.IsAutoFragment  = false;
            epService.EPAdministrator.Configuration.AddEventType("MyNestedEvent", metaNested);

            var metaNestedArray = new ConfigurationEventTypeXMLDOM();

            metaNestedArray.RootElementName = "//nested4";
            metaNestedArray.SchemaResource  = schemaURI;
            epService.EPAdministrator.Configuration.AddEventType("MyNestedArrayEvent", metaNestedArray);

            EPStatement stmtInsert   = epService.EPAdministrator.CreateEPL("insert into Nested3Stream select nested1simple, nested4array from MyXMLEvent#lastevent");
            EPStatement stmtWildcard = epService.EPAdministrator.CreateEPL("select * from MyXMLEvent#lastevent");

            SupportEventTypeAssertionUtil.AssertConsistency(stmtInsert.EventType);
            SupportEventTypeAssertionUtil.AssertConsistency(stmtWildcard.EventType);
            EPAssertionUtil.AssertEqualsAnyOrder(new EventPropertyDescriptor[] {
                new EventPropertyDescriptor("nested1simple", typeof(XmlNode), null, false, false, false, false, true),
                new EventPropertyDescriptor("nested4array", typeof(XmlNode[]), typeof(XmlNode), false, false, true, false, true),
            }, stmtInsert.EventType.PropertyDescriptors);

            FragmentEventType fragmentTypeNested1 = stmtInsert.EventType.GetFragmentType("nested1simple");

            Assert.IsFalse(fragmentTypeNested1.IsIndexed);
            EPAssertionUtil.AssertEqualsAnyOrder(new EventPropertyDescriptor[] {
                new EventPropertyDescriptor("prop1", typeof(string), typeof(char), false, false, true, false, false),
                new EventPropertyDescriptor("prop2", typeof(bool?), null, false, false, false, false, false),
                new EventPropertyDescriptor("attr1", typeof(string), typeof(char), false, false, true, false, false),
                new EventPropertyDescriptor("nested2", typeof(XmlNode), null, false, false, false, false, false),
            }, fragmentTypeNested1.FragmentType.PropertyDescriptors);
            SupportEventTypeAssertionUtil.AssertConsistency(fragmentTypeNested1.FragmentType);

            FragmentEventType fragmentTypeNested4 = stmtInsert.EventType.GetFragmentType("nested4array");

            Assert.IsTrue(fragmentTypeNested4.IsIndexed);
            EPAssertionUtil.AssertEqualsAnyOrder(new EventPropertyDescriptor[] {
                new EventPropertyDescriptor("prop5", typeof(string[]), typeof(string), false, false, true, false, false),
                new EventPropertyDescriptor("prop6", typeof(string[]), typeof(string), false, false, true, false, false),
                new EventPropertyDescriptor("prop7", typeof(string[]), typeof(string), false, false, true, false, false),
                new EventPropertyDescriptor("prop8", typeof(string[]), typeof(string), false, false, true, false, false),
                new EventPropertyDescriptor("id", typeof(string), typeof(char), false, false, true, false, false),
            }, fragmentTypeNested4.FragmentType.PropertyDescriptors);
            SupportEventTypeAssertionUtil.AssertConsistency(fragmentTypeNested4.FragmentType);

            FragmentEventType fragmentTypeNested4Item = stmtInsert.EventType.GetFragmentType("nested4array[0]");

            Assert.IsFalse(fragmentTypeNested4Item.IsIndexed);
            EPAssertionUtil.AssertEqualsAnyOrder(new EventPropertyDescriptor[] {
                new EventPropertyDescriptor("prop5", typeof(string[]), typeof(string), false, false, true, false, false),
                new EventPropertyDescriptor("prop6", typeof(string[]), typeof(string), false, false, true, false, false),
                new EventPropertyDescriptor("prop7", typeof(string[]), typeof(string), false, false, true, false, false),
                new EventPropertyDescriptor("prop8", typeof(string[]), typeof(string), false, false, true, false, false),
                new EventPropertyDescriptor("id", typeof(string), typeof(char), false, false, true, false, false),
            }, fragmentTypeNested4Item.FragmentType.PropertyDescriptors);
            SupportEventTypeAssertionUtil.AssertConsistency(fragmentTypeNested4Item.FragmentType);

            SupportXML.SendDefaultEvent(epService.EPRuntime, "ABC");

            EventBean received = stmtInsert.First();

            EPAssertionUtil.AssertProps(received, "nested1simple.prop1,nested1simple.prop2,nested1simple.attr1,nested1simple.nested2.prop3[1]".Split(','), new object[] { "SAMPLE_V1", true, "SAMPLE_ATTR1", 4 });
            EPAssertionUtil.AssertProps(received, "nested4array[0].id,nested4array[0].prop5[1],nested4array[1].id".Split(','), new object[] { "a", "SAMPLE_V8", "b" });

            // assert event and fragments alone
            EventBean wildcardStmtEvent = stmtWildcard.First();

            SupportEventTypeAssertionUtil.AssertConsistency(wildcardStmtEvent);

            FragmentEventType eventType = wildcardStmtEvent.EventType.GetFragmentType("nested1simple");

            Assert.IsFalse(eventType.IsIndexed);
            Assert.IsFalse(eventType.IsNative);
            Assert.AreEqual("MyNestedEvent", eventType.FragmentType.Name);
            Assert.IsTrue(wildcardStmtEvent.Get("nested1simple") is XmlNode);
            Assert.AreEqual("SAMPLE_V1", ((EventBean)wildcardStmtEvent.GetFragment("nested1simple")).Get("prop1"));

            eventType = wildcardStmtEvent.EventType.GetFragmentType("nested4array");
            Assert.IsTrue(eventType.IsIndexed);
            Assert.IsFalse(eventType.IsNative);
            Assert.AreEqual("MyNestedArrayEvent", eventType.FragmentType.Name);
            EventBean[] eventsArray = (EventBean[])wildcardStmtEvent.GetFragment("nested4array");
            Assert.AreEqual(3, eventsArray.Length);
            Assert.AreEqual("SAMPLE_V8", eventsArray[0].Get("prop5[1]"));
            Assert.AreEqual("SAMPLE_V9", eventsArray[1].Get("prop5[0]"));
            Assert.AreEqual(typeof(XmlNodeList), wildcardStmtEvent.EventType.GetPropertyType("nested4array"));
            Assert.IsTrue(wildcardStmtEvent.Get("nested4array") is XmlNodeList);

            EventBean nested4arrayItem = (EventBean)wildcardStmtEvent.GetFragment("nested4array[1]");

            Assert.AreEqual("b", nested4arrayItem.Get("id"));

            epService.EPAdministrator.DestroyAllStatements();
        }
Beispiel #17
0
        public void TestXPathConfigured()
        {
            ConfigurationEventTypeXMLDOM rootMeta = new ConfigurationEventTypeXMLDOM();

            rootMeta.RootElementName = "simpleEvent";
            rootMeta.AddNamespacePrefix("ss", "samples:schemas:simpleSchema");
            rootMeta.AddXPathPropertyFragment("nested1simple", "/ss:simpleEvent/ss:nested1", XPathResultType.Any, "MyNestedEvent");
            rootMeta.AddXPathPropertyFragment("nested4array", "//ss:nested4", XPathResultType.NodeSet, "MyNestedArrayEvent");
            _epService.EPAdministrator.Configuration.AddEventType("MyXMLEvent", rootMeta);

            ConfigurationEventTypeXMLDOM metaNested = new ConfigurationEventTypeXMLDOM();

            metaNested.RootElementName = "nested1";
            _epService.EPAdministrator.Configuration.AddEventType("MyNestedEvent", metaNested);

            ConfigurationEventTypeXMLDOM metaNestedArray = new ConfigurationEventTypeXMLDOM();

            metaNestedArray.RootElementName = "nested4";
            _epService.EPAdministrator.Configuration.AddEventType("MyNestedArrayEvent", metaNestedArray);

            EPStatement stmtInsert   = _epService.EPAdministrator.CreateEPL("insert into Nested3Stream select nested1simple, nested4array from MyXMLEvent");
            EPStatement stmtWildcard = _epService.EPAdministrator.CreateEPL("select * from MyXMLEvent");

            SupportEventTypeAssertionUtil.AssertConsistency(stmtInsert.EventType);
            SupportEventTypeAssertionUtil.AssertConsistency(stmtWildcard.EventType);
            EPAssertionUtil.AssertEqualsAnyOrder(
                new EventPropertyDescriptor[] {
                new EventPropertyDescriptor("nested1simple", typeof(XmlNode), null, false, false, false, false, true),
                new EventPropertyDescriptor("nested4array", typeof(XmlNode[]), typeof(XmlNode), false, false, true, false, true),
            }, stmtInsert.EventType.PropertyDescriptors);

            FragmentEventType fragmentTypeNested1 = stmtInsert.EventType.GetFragmentType("nested1simple");

            Assert.IsFalse(fragmentTypeNested1.IsIndexed);
            Assert.AreEqual(0, fragmentTypeNested1.FragmentType.PropertyDescriptors.Count);
            SupportEventTypeAssertionUtil.AssertConsistency(fragmentTypeNested1.FragmentType);

            FragmentEventType fragmentTypeNested4 = stmtInsert.EventType.GetFragmentType("nested4array");

            Assert.IsTrue(fragmentTypeNested4.IsIndexed);
            Assert.AreEqual(0, fragmentTypeNested4.FragmentType.PropertyDescriptors.Count);
            SupportEventTypeAssertionUtil.AssertConsistency(fragmentTypeNested4.FragmentType);

            SupportXML.SendDefaultEvent(_epService.EPRuntime, "ABC");

            EventBean received = stmtInsert.First();

            EPAssertionUtil.AssertProps(received, "nested1simple.prop1,nested1simple.prop2,nested1simple.attr1,nested1simple.nested2.prop3[1]".SplitCsv(), new object[] { "SAMPLE_V1", "true", "SAMPLE_ATTR1", "4" });
            EPAssertionUtil.AssertProps(received, "nested4array[0].id,nested4array[0].prop5[1],nested4array[1].id".SplitCsv(), new object[] { "a", "SAMPLE_V8", "b" });

            // assert event and fragments alone
            EventBean wildcardStmtEvent = stmtWildcard.First();

            SupportEventTypeAssertionUtil.AssertConsistency(wildcardStmtEvent);

            FragmentEventType eventType = wildcardStmtEvent.EventType.GetFragmentType("nested1simple");

            Assert.IsFalse(eventType.IsIndexed);
            Assert.IsFalse(eventType.IsNative);
            Assert.AreEqual("MyNestedEvent", eventType.FragmentType.Name);
            Assert.IsTrue(wildcardStmtEvent.Get("nested1simple") is XmlNode);
            Assert.AreEqual("SAMPLE_V1", ((EventBean)wildcardStmtEvent.GetFragment("nested1simple")).Get("prop1"));

            eventType = wildcardStmtEvent.EventType.GetFragmentType("nested4array");
            Assert.IsTrue(eventType.IsIndexed);
            Assert.IsFalse(eventType.IsNative);
            Assert.AreEqual("MyNestedArrayEvent", eventType.FragmentType.Name);
            EventBean[] eventsArray = (EventBean[])wildcardStmtEvent.GetFragment("nested4array");
            Assert.AreEqual(3, eventsArray.Length);
            Assert.AreEqual("SAMPLE_V8", eventsArray[0].Get("prop5[1]"));
            Assert.AreEqual("SAMPLE_V9", eventsArray[1].Get("prop5[0]"));
            Assert.AreEqual(typeof(XmlNodeList), wildcardStmtEvent.EventType.GetPropertyType("nested4array"));
            Assert.IsTrue(wildcardStmtEvent.Get("nested4array") is XmlNodeList);
        }
Beispiel #18
0
        private static void AssertConsistencyRecursive(
            EventBean eventBean,
            ISet<EventType> alreadySeenTypes)
        {
            AssertConsistencyRecursive(eventBean.EventType, alreadySeenTypes);

            var properties = eventBean.EventType.PropertyDescriptors;
            for (var i = 0; i < properties.Count; i++) {
                var failedMessage = "failed assertion for property '" + properties[i].PropertyName + "' ";
                var propertyName = properties[i].PropertyName;

                // assert getter
                if (!properties[i].IsRequiresIndex && !properties[i].IsRequiresMapKey) {
                    var getter = eventBean.EventType.GetGetter(propertyName);
                    var resultGetter = getter.Get(eventBean);
                    var resultGet = eventBean.Get(propertyName);

                    if (resultGetter == null && resultGet == null) {
                        // fine
                    }
                    else if (resultGet is XmlNodeList) {
                        ScopeTestHelper.AssertEquals(
                            failedMessage,
                            ((XmlNodeList) resultGet).Count,
                            ((XmlNodeList) resultGetter).Count);
                    }
                    else if (resultGet.GetType().IsArray) {
                        ScopeTestHelper.AssertEquals(
                            failedMessage,
                            ((Array) resultGet).Length,
                            ((Array) resultGetter).Length);
                    }
                    else {
                        ScopeTestHelper.AssertEquals(failedMessage, resultGet, resultGetter);
                    }

                    if (resultGet != null) {
                        if (resultGet is EventBean[] || resultGet is EventBean) {
                            ScopeTestHelper.AssertTrue(properties[i].IsFragment);
                        }
                        else {
                            var resultType = resultGet.GetType();
                            var propertyType = properties[i].PropertyType.GetBoxedType();
                            if ((resultType != propertyType) &&
                                !TypeHelper.IsSubclassOrImplementsInterface(resultType, propertyType)) {
                                ScopeTestHelper.Fail(failedMessage);
                            }
                        }
                    }
                }

                // fragment
                if (!properties[i].IsFragment) {
                    ScopeTestHelper.AssertNull(failedMessage, eventBean.GetFragment(propertyName));
                    continue;
                }

                var fragmentType = eventBean.EventType.GetFragmentType(propertyName);
                ScopeTestHelper.AssertNotNull(failedMessage, fragmentType);

                // fragment can be null
                var fragment = eventBean.GetFragment(propertyName);
                if (fragment == null) {
                    return;
                }

                if (!fragmentType.IsIndexed) {
                    ScopeTestHelper.AssertTrue(failedMessage, fragment is EventBean);
                    var fragmentEvent = (EventBean) fragment;
                    AssertConsistencyRecursive(fragmentEvent, alreadySeenTypes);
                }
                else {
                    ScopeTestHelper.AssertTrue(failedMessage, fragment is EventBean[]);
                    var events = (EventBean[]) fragment;
                    ScopeTestHelper.AssertTrue(failedMessage, events.Length > 0);
                    foreach (var theEvent in events) {
                        AssertConsistencyRecursive(theEvent, alreadySeenTypes);
                    }
                }
            }
        }
Beispiel #19
0
        private static void AssertConsistencyRecusive(EventBean eventBean, ICollection <EventType> alreadySeenTypes)
        {
            AssertConsistencyRecursive(eventBean.EventType, alreadySeenTypes);

            var properties = eventBean.EventType.PropertyDescriptors;

            for (var i = 0; i < properties.Count; i++)
            {
                var failedMessage = "failed assertion for property '" + properties[i].PropertyName + "' ";
                var propertyName  = properties[i].PropertyName;

                // assert getter
                if ((!properties[i].RequiresIndex) && (!properties[i].RequiresMapKey))
                {
                    var getter       = eventBean.EventType.GetGetter(propertyName);
                    var resultGetter = getter.Get(eventBean);
                    var resultGet    = eventBean.Get(propertyName);

                    if ((resultGetter == null) && (resultGet == null))
                    {
                        // fine
                    }
                    else if (resultGet is XmlNodeList)
                    {
                        Assert.AreEqual(((XmlNodeList)resultGet).Count, ((XmlNodeList)resultGetter).Count, failedMessage);
                    }
                    else if (resultGet.GetType().IsArray)
                    {
                        var asArray       = (Array)resultGet;
                        var asArrayGetter = (Array)resultGetter;

                        Assert.AreEqual(asArray.Length, asArrayGetter.Length, failedMessage);
                    }
                    else
                    {
                        Assert.AreEqual(resultGet, resultGetter, failedMessage);
                    }

                    if (resultGet != null)
                    {
                        if (resultGet is EventBean[] || resultGet is EventBean)
                        {
                            Assert.IsTrue(properties[i].IsFragment);
                        }
                        else
                        {
                            Assert.IsTrue(TypeHelper.IsSubclassOrImplementsInterface(resultGet.GetType(), properties[i].PropertyType), failedMessage);
                        }
                    }
                }

                // fragment
                if (!properties[i].IsFragment)
                {
                    Assert.IsNull(eventBean.GetFragment(propertyName), failedMessage);
                    continue;
                }

                var fragment = eventBean.GetFragment(propertyName);
                Assert.NotNull(fragment, failedMessage);

                var fragmentType = eventBean.EventType.GetFragmentType(propertyName);
                Assert.NotNull(fragmentType, failedMessage);

                if (!fragmentType.IsIndexed)
                {
                    Assert.IsTrue(fragment is EventBean, failedMessage);
                    var fragmentEvent = (EventBean)fragment;
                    AssertConsistencyRecusive(fragmentEvent, alreadySeenTypes);
                }
                else
                {
                    Assert.IsTrue(fragment is EventBean[], failedMessage);
                    var events = (EventBean[])fragment;
                    Assert.IsTrue(events.Length > 0, failedMessage);
                    foreach (var theEvent in events)
                    {
                        AssertConsistencyRecusive(theEvent, alreadySeenTypes);
                    }
                }
            }
        }
Beispiel #20
0
        private static void Print(EventBean theEvent, TextWriter writer, int indent, Stack <String> propertyStack)
        {
            WriteIndent(writer, indent);
            writer.Write("Properties : \n");
            PrintProperties(theEvent, writer, indent + 2, propertyStack);

            // count fragments
            var countFragments = 0;

            foreach (var desc in theEvent.EventType.PropertyDescriptors)
            {
                if (desc.IsFragment)
                {
                    countFragments++;
                }
            }
            if (countFragments == 0)
            {
                return;
            }

            WriteIndent(writer, indent);
            writer.Write("Fragments : (" + countFragments + ") \n");
            foreach (var desc in theEvent.EventType.PropertyDescriptors)
            {
                if (!desc.IsFragment)
                {
                    continue;
                }

                WriteIndent(writer, indent + 2);
                writer.Write(desc.PropertyName);
                writer.Write(" : ");

                if (desc.RequiresIndex)
                {
                    writer.Write("\n");
                    var count = 0;
                    while (true)
                    {
                        try
                        {
                            WriteIndent(writer, indent + 4);
                            writer.Write("bean #");
                            writer.Write(Convert.ToString(count));
                            var result = (EventBean)theEvent.GetFragment(desc.PropertyName + "[" + count + "]");
                            if (result == null)
                            {
                                writer.Write("(null EventBean)\n");
                            }
                            else
                            {
                                writer.Write("\n");
                                propertyStack.Push(desc.PropertyName);
                                Print(result, writer, indent + 6, propertyStack);
                                propertyStack.Pop();
                            }
                            count++;
                        }
                        catch (PropertyAccessException)
                        {
                            writer.Write("-- no access --\n");
                            break;
                        }
                    }
                }
                else
                {
                    var fragment = theEvent.GetFragment(desc.PropertyName);
                    if (fragment == null)
                    {
                        writer.Write("(null)\n");
                        continue;
                    }

                    if (fragment is EventBean)
                    {
                        var fragmentBean = (EventBean)fragment;
                        writer.Write("EventBean type ");
                        writer.Write(fragmentBean.EventType.Name);
                        writer.Write("...\n");

                        // prevent GetThis() loops
                        if (fragmentBean.EventType == theEvent.EventType)
                        {
                            WriteIndent(writer, indent + 2);
                            writer.Write("Skipping");
                        }
                        else
                        {
                            propertyStack.Push(desc.PropertyName);
                            Print(fragmentBean, writer, indent + 4, propertyStack);
                            propertyStack.Pop();
                        }
                    }
                    else
                    {
                        var fragmentBeans = (EventBean[])fragment;
                        writer.Write("EventBean[] type ");
                        if (fragmentBeans.Length == 0)
                        {
                            writer.Write("(empty array)\n");
                        }
                        else
                        {
                            writer.Write(fragmentBeans[0].EventType.Name);
                            writer.Write("...\n");
                            for (var i = 0; i < fragmentBeans.Length; i++)
                            {
                                WriteIndent(writer, indent + 4);
                                writer.Write("bean #" + i + "...\n");

                                propertyStack.Push(desc.PropertyName);
                                Print(fragmentBeans[i], writer, indent + 6, propertyStack);
                                propertyStack.Pop();
                            }
                        }
                    }
                }
            }
        }
Beispiel #21
0
 private static void TryInvalidGetFragment(
     EventBean eventBean,
     string propName)
 {
     Assert.That(() => eventBean.GetFragment(propName), Throws.InstanceOf<PropertyAccessException>());
 }
        private static void AssertConsistencyRecusive(EventBean eventBean, ISet<EventType> alreadySeenTypes)
        {
            AssertConsistencyRecursive(eventBean.EventType, alreadySeenTypes);

            IList<EventPropertyDescriptor> properties = eventBean.EventType.PropertyDescriptors;
            for (int i = 0; i < properties.Count; i++)
            {
                string failedMessage = "failed assertion for property '" + properties[i].PropertyName + "' ";
                string propertyName = properties[i].PropertyName;

                // assert getter
                if ((!properties[i].RequiresIndex) && (!properties[i].RequiresMapKey))
                {
                    EventPropertyGetter getter = eventBean.EventType.GetGetter(propertyName);
                    object resultGetter = getter.Get(eventBean);
                    object resultGet = eventBean.Get(propertyName);

                    if ((resultGetter == null) && (resultGet == null))
                    {
                        // fine
                    }
                    else if (resultGet is XmlNodeList)
                    {
                        ScopeTestHelper.AssertEquals(
                            failedMessage, 
                            ((XmlNodeList) resultGet).Count, 
                            ((XmlNodeList) resultGetter).Count);
                    }
                    else if (resultGet is Array)
                    {
                        ScopeTestHelper.AssertEquals(
                            failedMessage,
                            ((Array) resultGet).Length,
                            ((Array) resultGetter).Length);
                    }
                    else
                    {
                        ScopeTestHelper.AssertEquals(failedMessage, resultGet, resultGetter);
                    }

                    if (resultGet != null)
                    {
                        if (resultGet is EventBean[] || resultGet is EventBean)
                        {
                            ScopeTestHelper.AssertTrue(properties[i].IsFragment);
                        }
                        else
                        {
                            ScopeTestHelper.AssertTrue(
                                failedMessage,
                                TypeHelper.IsSubclassOrImplementsInterface(
                                    resultGet.GetType(),
                                    properties[i].PropertyType.GetBoxedType()));
                        }
                    }
                }

                // fragment
                if (!properties[i].IsFragment)
                {
                    ScopeTestHelper.AssertNull(failedMessage, eventBean.GetFragment(propertyName));
                    continue;
                }

                object fragment = eventBean.GetFragment(propertyName);
                ScopeTestHelper.AssertNotNull(failedMessage, fragment);

                FragmentEventType fragmentType = eventBean.EventType.GetFragmentType(propertyName);
                ScopeTestHelper.AssertNotNull(failedMessage, fragmentType);

                if (!fragmentType.IsIndexed)
                {
                    ScopeTestHelper.AssertTrue(failedMessage, fragment is EventBean);
                    var fragmentEvent = (EventBean) fragment;
                    AssertConsistencyRecusive(fragmentEvent, alreadySeenTypes);
                }
                else
                {
                    ScopeTestHelper.AssertTrue(failedMessage, fragment is EventBean[]);
                    var events = (EventBean[]) fragment;
                    ScopeTestHelper.AssertTrue(failedMessage, events.Length > 0);
                    foreach (EventBean theEvent in events)
                    {
                        AssertConsistencyRecusive(theEvent, alreadySeenTypes);
                    }
                }
            }
        }
        public void TestExpressionSimpleDOMGetter()
        {
            ConfigurationEventTypeXMLDOM eventTypeMeta = new ConfigurationEventTypeXMLDOM();

            eventTypeMeta.RootElementName = "simpleEvent";
            String schemaUri = ResourceManager.ResolveResourceURL(CLASSLOADER_SCHEMA_URI).ToString();

            eventTypeMeta.SchemaResource = schemaUri;
            // eventTypeMeta.XPathPropertyExpr = false; <== the default
            epService.EPAdministrator.Configuration.AddEventType("TestXMLSchemaType", eventTypeMeta);

            EPStatement stmtInsert = epService.EPAdministrator.CreateEPL("insert into MyNestedStream select nested1 from TestXMLSchemaType.std:lastevent()");

            EPAssertionUtil.AssertEqualsAnyOrder(new [] {
                new EventPropertyDescriptor("nested1", typeof(XmlNode), null, false, false, false, false, true),
            }, stmtInsert.EventType.PropertyDescriptors);
            EventTypeAssertionUtil.AssertConsistency(stmtInsert.EventType);

            EPStatement stmtSelect = epService.EPAdministrator.CreateEPL("select nested1.attr1 as attr1, nested1.prop1 as prop1, nested1.prop2 as prop2, nested1.nested2.prop3 as prop3, nested1.nested2.prop3[0] as prop3_0, nested1.nested2 as nested2 from MyNestedStream.std:lastevent()");

            EPAssertionUtil.AssertEqualsAnyOrder(new [] {
                new EventPropertyDescriptor("prop1", typeof(string), typeof(char), false, false, true, false, false),
                new EventPropertyDescriptor("prop2", typeof(bool?), null, false, false, false, false, false),
                new EventPropertyDescriptor("attr1", typeof(string), typeof(char), false, false, true, false, false),
                new EventPropertyDescriptor("prop3", typeof(int?[]), typeof(int?), false, false, true, false, false),
                new EventPropertyDescriptor("prop3_0", typeof(int?), null, false, false, false, false, false),
                new EventPropertyDescriptor("nested2", typeof(XmlNode), null, false, false, false, false, true),
            }, stmtSelect.EventType.PropertyDescriptors);
            EventTypeAssertionUtil.AssertConsistency(stmtSelect.EventType);

            EPStatement stmtSelectWildcard = epService.EPAdministrator.CreateEPL("select * from MyNestedStream");

            EPAssertionUtil.AssertEqualsAnyOrder(new [] {
                new EventPropertyDescriptor("nested1", typeof(XmlNode), null, false, false, false, false, true),
            }, stmtSelectWildcard.EventType.PropertyDescriptors);
            EventTypeAssertionUtil.AssertConsistency(stmtSelectWildcard.EventType);

            EPStatement stmtInsertWildcard = epService.EPAdministrator.CreateEPL("insert into MyNestedStreamTwo select nested1.* from TestXMLSchemaType.std:lastevent()");

            EPAssertionUtil.AssertEqualsAnyOrder(new [] {
                new EventPropertyDescriptor("prop1", typeof(string), typeof(char), false, false, true, false, false),
                new EventPropertyDescriptor("prop2", typeof(bool?), null, false, false, false, false, false),
                new EventPropertyDescriptor("attr1", typeof(string), typeof(char), false, false, true, false, false),
                new EventPropertyDescriptor("nested2", typeof(XmlNode), null, false, false, false, false, true),
            }, stmtInsertWildcard.EventType.PropertyDescriptors);
            EventTypeAssertionUtil.AssertConsistency(stmtInsertWildcard.EventType);

            SupportXML.SendDefaultEvent(epService.EPRuntime, "test");
            EventBean stmtInsertWildcardBean = stmtInsertWildcard.First();

            EPAssertionUtil.AssertProps(stmtInsertWildcardBean, "prop1,prop2,attr1".Split(','),
                                        new Object[] { "SAMPLE_V1", true, "SAMPLE_ATTR1" });

            EventTypeAssertionUtil.AssertConsistency(stmtSelect.First());
            EventBean stmtInsertBean = stmtInsert.First();

            EventTypeAssertionUtil.AssertConsistency(stmtInsertWildcard.First());
            EventTypeAssertionUtil.AssertConsistency(stmtInsert.First());

            EventBean fragmentNested1 = (EventBean)stmtInsertBean.GetFragment("nested1");

            Assert.AreEqual(5, fragmentNested1.Get("nested2.prop3[2]"));
            Assert.AreEqual("TestXMLSchemaType.nested1", fragmentNested1.EventType.Name);

            EventBean fragmentNested2 = (EventBean)stmtInsertWildcardBean.GetFragment("nested2");

            Assert.AreEqual(4, fragmentNested2.Get("prop3[1]"));
            Assert.AreEqual("TestXMLSchemaType.nested1.nested2", fragmentNested2.EventType.Name);
        }