Beispiel #1
0
        public void TestGetDataItemType()
        {
            EAMetaModel meta = new EAMetaModel();
            {
                EA.Element attr = new EAElement();
                attr.Stereotype = "DataItem,string";

                string s = SchemaManager.getDataItemType(attr);
                Assert.AreEqual("string", s);
            }
            {
                EA.Element attr = new EAElement();
                attr.Stereotype = "string,DataItem";

                string s = SchemaManager.getDataItemType(attr);
                Assert.AreEqual("string", s);
            }
            {
                EA.Element attr = new EAElement();
                attr.Stereotype = null;

                string s = SchemaManager.getDataItemType(attr);
                Assert.IsNull(s);
            }
        }
        public void TestEAMock()
        {
            EAMetaModel meta = new EAMetaModel();

            EARepository rep = EARepository.Repository;

            EAElement metaAPI = new EAElement();

            metaAPI.Name = "API";

            EAElement api = new EAElement();

            api.Name         = "api";
            api.Type         = "Class";
            api.Stereotype   = "stereotype";
            api.ClassifierID = metaAPI.ElementID;

            api.RunState = "runstate";

            EAElement resource = new EAElement();

            resource.Name = "/resource";

            EA.Collection connectors = api.Connectors;
            object        con        = connectors.AddNew("", RoundTripAddIn.RoundTripAddInClass.EA_TYPE_ASSOCIATION);

            EAConnector c = (EAConnector)con;

            c.ClientID   = api.ElementID;
            c.SupplierID = resource.ElementID;

            c.SupplierEnd.Role = "SupplierRole";

            Assert.AreEqual(1, api.Connectors.Count);


            EAElement metaAPI2 = (EAElement)rep.GetElementByID(metaAPI.ElementID);

            Assert.AreEqual(metaAPI.ElementID, metaAPI2.ElementID);

            EAElement api2      = (EAElement)rep.GetElementByID(c.ClientID);
            EAElement resource2 = (EAElement)rep.GetElementByID(c.SupplierID);

            Assert.AreEqual(api.ElementID, api2.ElementID);
            Assert.AreEqual(resource.ElementID, resource2.ElementID);

            Assert.IsNotNull(c.SupplierEnd);
            Assert.IsNotNull(c.SupplierEnd.Role);
        }
Beispiel #3
0
 public void TestGetDataItemExample()
 {
     EAMetaModel meta = new EAMetaModel();
     {
         EA.Element     attr = new EAElement();
         object         o    = attr.TaggedValues.AddNew(RoundTripAddInClass.EA_TAGGEDVALUE_DEFAULT, "");
         EA.TaggedValue tv   = (EA.TaggedValue)o;
         tv.Name  = RoundTripAddInClass.EA_TAGGEDVALUE_DEFAULT;
         tv.Value = "foobar";
         string s = SchemaManager.getDataItemExample(attr);
         Assert.AreEqual("foobar", s);
     }
     {
         EA.Element     attr = new EAElement();
         object         o    = attr.TaggedValues.AddNew(RoundTripAddInClass.EA_TAGGEDVALUE_DEFAULT, "");
         EA.TaggedValue tv   = (EA.TaggedValue)o;
         tv.Name  = RoundTripAddInClass.EA_TAGGEDVALUE_DEFAULT;
         tv.Value = null;
         string s = SchemaManager.getDataItemExample(attr);
         Assert.IsNull(s);
     }
 }
Beispiel #4
0
        public void exportWSDL()
        {
            EAMetaModel meta = new EAMetaModel();

            EA.Element component = new EAElement();
            component.Name    = "CommunicationManagement";
            component.Version = "http://usermodel.namespace";

            {
                object    obj = component.Methods.AddNew("operation1", "");
                EA.Method op1 = (EA.Method)obj;
                op1.Name = "DoSomething1";
                object       objParam = op1.Parameters.AddNew("paramString", "");
                EA.Parameter param    = (EA.Parameter)objParam;
                param.Name = "paramStringName";
                param.Type = "String";
                param.Kind = "Input";
            }
            {
                object    obj = component.Methods.AddNew("operation2", "");
                EA.Method op1 = (EA.Method)obj;
                op1.Name = "DoSomething2";
                object       objParam = op1.Parameters.AddNew("paramString", "");
                EA.Parameter param    = (EA.Parameter)objParam;
                param.Name = "paramStringName";
                param.Type = "String";
                param.Kind = "Input";
            }

            WSDLManager mgr = new WSDLManager();

            ServiceDescription sd = mgr.exportWSDL(EARepository.Repository, component);


            sd.Write(@"service.wsdl");

            Assert.IsNotNull(sd);
            Assert.AreEqual(1, sd.PortTypes.Count);
        }
Beispiel #5
0
 public static IEAElement WrapElement(Element element)
 {
     return(EAElement.Wrap(element));
 }
Beispiel #6
0
 public static IEAElement WrapElement(EventProperties eventProperties)
 {
     return(EAElement.Wrap(eventProperties));
 }