예제 #1
0
 internal virtual void ProcessRelationship(Interaction interaction, BaseRelationshipBridge relationship, Visitor visitor)
 {
     if (relationship.IsAssociation())
     {
         ProcessAllRelationshipValues(interaction, (AssociationBridge)relationship, visitor);
     }
     else
     {
         ConstrainedDatatype constraints = this.factory.GetConstraints(relationship.GetRelationship());
         visitor.VisitAttribute((AttributeBridge)relationship, relationship.GetRelationship(), constraints, this.dateTimeZone, this
                                .dateTimeTimeZone);
     }
 }
예제 #2
0
        public virtual void ShouldHandleCollapsedTypesWithOuterMultipleCardinality()
        {
            MessagePart partB = new MessagePart("ABCE_MT123456CA.BeanB");

            partB.Relationships.Add(new Relationship("text", "ST", Cardinality.Create("1")));
            MessagePart elidedPart = new MessagePart("ABCE_MT123456CA.ElidedPart");

            elidedPart.Relationships.Add(new Relationship("issue", "ABCE_MT123456CA.BeanB", Cardinality.Create("1")));
            mockService.AddPart(elidedPart.Name, elidedPart);
            mockService.AddPart(partB.Name, partB);
            BeanA bean = new BeanA();

            bean.Issues.Add(new BeanB());
            bean.Issues.Add(new BeanB());
            MessagePart  part = new MessagePart();
            Relationship subjectOfRelationship = new Relationship("subjectOf", "ABCE_MT123456CA.ElidedPart", Cardinality.Create("0-50"
                                                                                                                                ));

            Assert.IsTrue(subjectOfRelationship.Association, "association");
            part.Relationships.Add(subjectOfRelationship);
            PartBridge bridge = new BridgeFactoryImpl(this.mockService, VERSION).CreatePartBridgeFromBean("controlAct", bean, new Interaction
                                                                                                              (), new MessagePartHolder(part));

            Assert.AreEqual(1, bridge.GetRelationshipBridges().Count, "size");
            Assert.AreEqual("subjectOf", bridge.GetRelationshipBridges()[0].GetRelationship().Name, "name of relationship");
            BaseRelationshipBridge relationship = bridge.GetRelationshipBridges()[0];

            Assert.IsTrue(relationship.IsAssociation(), "association relationship");
            ICollection <PartBridge> values = ((AssociationBridge)relationship).GetAssociationValues();

            Assert.AreEqual(2, values.Count, "number of values");
            foreach (PartBridge partBridge in values)
            {
                IList <BaseRelationshipBridge> relationshipBridges = partBridge.GetRelationshipBridges();
                Assert.AreEqual(1, relationshipBridges.Count, "inner relationships");
                BaseRelationshipBridge   temp        = relationshipBridges[0];
                AssociationBridge        association = (AssociationBridge)temp;
                ICollection <PartBridge> innerValues = association.GetAssociationValues();
                Assert.IsFalse(innerValues.IsEmpty(), "has value");
            }
        }
예제 #3
0
        public virtual void ShouldHandleCollapsedTypesWithOuterMultipleCardinalityAndSeveralLevelsOfCollapsing()
        {
            MessagePart partB = new MessagePart("ABCE_MT123456CA.BeanB");

            partB.Relationships.Add(new Relationship("text", "ST", Cardinality.Create("1")));
            MessagePart elidedPart1 = new MessagePart("ABCE_MT123456CA.ElidedPart1");

            elidedPart1.Relationships.Add(new Relationship("component", "ABCE_MT123456CA.ElidedPart2", Cardinality.Create("1")));
            MessagePart elidedPart2 = new MessagePart("ABCE_MT123456CA.ElidedPart2");

            elidedPart2.Relationships.Add(new Relationship("issue", "ABCE_MT123456CA.BeanB", Cardinality.Create("1")));
            mockService.AddPart(elidedPart1.Name, elidedPart1);
            mockService.AddPart(elidedPart2.Name, elidedPart2);
            mockService.AddPart(partB.Name, partB);
            BeanAPrime bean = new BeanAPrime();

            bean.Issues.Add(new BeanB());
            bean.Issues.Add(new BeanB());
            MessagePart  part = new MessagePart();
            Relationship subjectOfRelationship = new Relationship("subjectOf", "ABCE_MT123456CA.ElidedPart1", Cardinality.Create("0-50"
                                                                                                                                 ));

            Assert.IsTrue(subjectOfRelationship.Association, "association");
            part.Relationships.Add(subjectOfRelationship);
            PartBridge bridge = new BridgeFactoryImpl(this.mockService, VERSION).CreatePartBridgeFromBean("controlAct", bean, new Interaction
                                                                                                              (), new MessagePartHolder(part));

            Assert.AreEqual(1, bridge.GetRelationshipBridges().Count, "size");
            Assert.AreEqual("subjectOf", bridge.GetRelationshipBridges()[0].GetRelationship().Name, "name of relationship");
            BaseRelationshipBridge relationship = bridge.GetRelationshipBridges()[0];

            Assert.IsTrue(relationship.IsAssociation(), "association relationship");
            ICollection <PartBridge> values = ((AssociationBridge)relationship).GetAssociationValues();

            Assert.AreEqual(2, values.Count, "number of values");
        }