public void TestExportPopulation()
        {
            EAMetaModel meta = new EAMetaModel().setupPopulationPackage();

            EAFactory rootClass = EAModel.createPopulation(meta);

            meta.setupPopulationPackage();
            EA.Package package = EARepository.currentPackage;


            Assert.AreEqual(1, package.Diagrams.Count);

            object o = package.Diagrams.GetAt(0);

            EA.Diagram diagram = (EA.Diagram)o;

            Assert.AreEqual(2, package.Elements.Count);

            DiagramCache diagramCache = new DiagramCache();

            //Test
            RepositoryHelper.createDiagramCache(EARepository.Repository, diagram, diagramCache);
            JArray jobject = (JArray)PopulationManager.sampleToJObject(EARepository.Repository, diagram, diagramCache)["json"];

            Assert.AreEqual(1, jobject.Count);
        }
예제 #2
0
        public List <T> getOwnedElementWrappers <T>(string stereotype, bool recursive) where T : ElementWrapper
        {
            string packageIDString     = recursive ? this.packageTreeIDString : this.packageID.ToString();
            string getGetOwnedElements = "select * from t_object o" +
                                         " inner join t_xref x on x.Client = o.ea_guid " +
                                         " where o.Object_Type = '" + typeof(T).Name + "' " +
                                         " and o.Package_ID in (" + packageIDString + ") " +
                                         " and x.Name = 'Stereotypes' " +
                                         " and x.Description like '%@STEREO;Name=" + stereotype + ";%'";

            return(EAModel.getElementWrappersByQuery(getGetOwnedElements).Cast <T>().ToList());
        }