Esempio n. 1
0
        public void UpdateTest()
        {
            // TODO uncomment below to test the method and replace null with proper value
            //string webId = null;
            //PIAnalysisTemplate template = null;
            //var response = instance.Update(webId, template);
            //Assert.IsInstanceOf<Object> (response, "response is Object");

            string             path             = Constants.AF_ANALYSIS_TEMPLATE_PATH;
            PIAnalysisTemplate analysisTemplate = instance.Get(webId, null);

            analysisTemplate.WebId = null;
            analysisTemplate.Id    = null;
            analysisTemplate.Links = null;
            analysisTemplate.Path  = null;
            analysisTemplate.HasNotificationTemplate = null;
            analysisTemplate.HasTarget   = null;
            analysisTemplate.Description = "This is the new analysis template swagger description";
            instance.Update(webId, analysisTemplate);

            StandardPISystem.Refresh();
            AFAnalysisTemplate myAnalysisTemplate = AFObject.FindObject(path) as AFAnalysisTemplate;

            myAnalysisTemplate.Refresh();

            if (myAnalysisTemplate != null)
            {
                Assert.IsTrue(myAnalysisTemplate.Description == analysisTemplate.Description);
            }
        }
Esempio n. 2
0
        public void UpdateTest()
        {
            string     path     = Constants.AF_TIMERULE_PATH;
            PITimeRule timeRule = instance.GetByPath(path, null);

            timeRule.Name               = null;
            timeRule.Description        = null;
            timeRule.ConfigStringStored = null;
            timeRule.EditorType         = null;
            timeRule.IsConfigured       = null;
            timeRule.IsInitializing     = null;
            timeRule.PlugInName         = null;
            timeRule.DisplayString      = null;
            timeRule.WebId              = null;
            timeRule.Id           = null;
            timeRule.Path         = null;
            timeRule.Links        = null;
            timeRule.ConfigString = "Frequency=400";
            instance.Update(webId, timeRule);
            StandardPISystem.Refresh();
            var newTimeRule = AFObject.FindObject(path) as AFTimeRule;

            if (newTimeRule != null)
            {
                Assert.IsTrue(timeRule.ConfigString == newTimeRule.ConfigString);
            }
        }
        public void UpdateTest()
        {
            string       path       = Constants.AF_EVENT_FRAME_PATH;
            PIEventFrame eventFrame = instance.GetByPath(path, null);

            eventFrame.Id                = null;
            eventFrame.Description       = "New swagger event frame description";
            eventFrame.Links             = null;
            eventFrame.Path              = null;
            eventFrame.WebId             = null;
            eventFrame.HasChildren       = null;
            eventFrame.AcknowledgedBy    = null;
            eventFrame.Security          = null;
            eventFrame.AcknowledgedDate  = null;
            eventFrame.IsAcknowledged    = null;
            eventFrame.IsAnnotated       = null;
            eventFrame.IsLocked          = null;
            eventFrame.CanBeAcknowledged = null;
            eventFrame.AreValuesCaptured = null;
            instance.Update(webId, eventFrame);

            StandardPISystem.Refresh();
            AFEventFrame myEventFrame = AFObject.FindObject(path) as AFEventFrame;

            myEventFrame.Refresh();
            myEventFrame.Database.Refresh();
            if (myEventFrame != null)
            {
                Assert.IsTrue(myEventFrame.Description == eventFrame.Description);
            }
        }
        public void CreateSecurityMappingTest()
        {
            DeleteMappingAndIdentity();
            PISecurityIdentity securityIdentity = new PISecurityIdentity()
            {
                Name        = Constants.AF_SECURITY_IDENTITY_NAME,
                Description = "Test User Identity"
            };

            instance.CreateSecurityIdentity(webId, securityIdentity);

            string securityIdentityWebId = instance.GetSecurityIdentities(webId).Items.Where(a => a.Name == Constants.AF_SECURITY_IDENTITY_NAME).First().WebId;

            PISecurityMapping securityMapping = new PISecurityMapping()
            {
                Name                  = Constants.AF_SECURITY_MAPPING_NAME,
                Description           = "Current User Mapping",
                SecurityIdentityWebId = securityIdentityWebId,
                Account               = @"marc\marc.adm"
            };

            instance.CreateSecurityMapping(webId, securityMapping);

            StandardPISystem.Refresh();
            Assert.IsNotNull(StandardPISystem.SecurityMappings[securityMapping.Name]);
            CreateMappingAndIdentity();
        }
Esempio n. 5
0
        public void UpdateDataTest()
        {
            string      path = Constants.AF_TABLE_PATH;
            PITableData data = new PITableData();

            data.Columns = new Dictionary <string, string>();
            data.Columns.Add("Model", "String");
            data.Columns.Add("4WD", "Boolean");
            data.Columns.Add("TopSpeed", "Int32");
            data.Rows = new List <Dictionary <string, object> >();
            var item1 = new Dictionary <string, object>();

            item1.Add("Model", "Jeep");
            item1.Add("4WD", true);
            item1.Add("TopSpeed", 100);
            var item2 = new Dictionary <string, object>();

            item2.Add("Model", "Prius");
            item2.Add("4WD", false);
            item2.Add("TopSpeed", 80);
            data.Rows.Add(item1);
            data.Rows.Add(item2);
            instance.UpdateData(webId, data);

            StandardPISystem.Refresh();
            AFTable myTable = AFObject.FindObject(path) as AFTable;

            myTable.Refresh();

            Assert.IsTrue(myTable.Table.Rows.Count == 2);
            Assert.IsTrue(myTable.Table.Columns.Count == 3);
        }
Esempio n. 6
0
        public void UpdateTest()
        {
            string     path     = Constants.AF_ANALYSIS_PATH;
            PIAnalysis analysis = instance.Get(webId, null);

            analysis.WebId                       = null;
            analysis.Id                          = null;
            analysis.Links                       = null;
            analysis.Path                        = null;
            analysis.AutoCreated                 = null;
            analysis.HasTemplate                 = null;
            analysis.HasNotification             = null;
            analysis.HasTarget                   = null;
            analysis.IsConfigured                = null;
            analysis.Description                 = "This is the new analysis swagger description";
            analysis.IsTimeRuleDefinedByTemplate = null;
            instance.Update(webId, analysis);

            StandardPISystem.Refresh();
            AFAnalysis myAnalysis = AFObject.FindObject(path) as AFAnalysis;

            if (analysis != null)
            {
                Assert.IsTrue(myAnalysis.Description == analysis.Description);
            }
        }
        public void DeleteTest()
        {
            instance.Delete(webId);
            StandardPISystem.Refresh();
            string         path           = Constants.AF_ANALYSIS_RULE_PATH;
            AFAnalysisRule myAnalysisRule = AFObject.FindObject(path) as AFAnalysisRule;

            Assert.IsNull(myAnalysisRule);
        }
Esempio n. 8
0
        public void DeleteTest()
        {
            string path = Constants.AF_TIMERULE_PATH;

            instance.Delete(webId);
            StandardPISystem.Refresh();
            var newTimeRule = AFObject.FindObject(path) as AFTimeRule;

            Assert.IsNull(newTimeRule);
        }
Esempio n. 9
0
        public void DeleteTest()
        {
            instance.Delete(webId);
            StandardPISystem.Refresh();
            AFDatabase db = AFObject.FindObject(Constants.AF_DATABASE_NAME) as AFDatabase;

            Assert.IsNull(db);
            DeleteSampleDatabaseForTests();
            CreateSampleDatabaseForTests();
        }
        public void CreateUnitClassTest()
        {
            PIUnitClass unitClass = new PIUnitClass(null, null, "SwaggerUnit", "Old description", "Swaglers", "swg", null, null);

            instance.CreateUnitClass(webId, unitClass);

            StandardPISystem.Refresh();
            Assert.IsNotNull(StandardPISystem.UOMDatabase.UOMClasses[unitClass.Name]);
            StandardPISystem.UOMDatabase.UOMClasses.Remove(unitClass.Name);
        }
        public void DeleteTest()
        {
            string path = Constants.AF_SECURITY_MAPPING_PATH;

            instance.Delete(webId);
            StandardPISystem.Refresh();
            AFSecurityMapping mySecurityMapping = AFObject.FindObject(path) as AFSecurityMapping;

            Assert.IsNull(mySecurityMapping);
            DeleteSampleDatabaseForTests();
            CreateSampleDatabaseForTests();
        }
        public void DeleteTest()
        {
            string path = Constants.AF_SECURITY_IDENTITY_PATH;

            instance.Delete(webId);
            StandardPISystem.Refresh();
            AFSecurityIdentity mySecurityIdentity = AFObject.FindObject(path) as AFSecurityIdentity;

            Assert.IsNull(mySecurityIdentity);
            DeleteSampleDatabaseForTests();
            CreateSampleDatabaseForTests();
        }
        public void CreateAssetDatabaseTest()
        {
            PIAssetDatabase database = new PIAssetDatabase()
            {
                Name        = "TestSwaggerDbbb",
                Description = "PI BI Project Asset Model"
            };

            instance.CreateAssetDatabase(webId, database);
            StandardPISystem.Refresh();
            Assert.IsNotNull(StandardPISystem.Databases[database.Name]);
            StandardPISystem.Databases.Remove(database.Name);
        }
        public void CreateSecurityIdentityTest()
        {
            DeleteMappingAndIdentity();
            PISecurityIdentity securityIdentity = new PISecurityIdentity()
            {
                Name = Constants.AF_SECURITY_IDENTITY_NAME
            };

            instance.CreateSecurityIdentity(webId, securityIdentity);

            StandardPISystem.Refresh();
            Assert.IsNotNull(StandardPISystem.SecurityIdentities[securityIdentity.Name]);
            CreateMappingAndIdentity();
        }
Esempio n. 15
0
        public void UpdateTest()
        {
            string          path     = Constants.AF_DATABASE_PATH;
            PIAssetDatabase database = instance.GetByPath(path, null);

            database.Id          = null;
            database.Description = "New swagger db description";
            database.Links       = null;
            database.Path        = null;
            database.WebId       = null;
            instance.Update(webId, database);

            StandardPISystem.Refresh();
            AFDatabase db = AFObject.FindObject(path) as AFDatabase;

            if (db != null)
            {
                Assert.IsTrue(db.Description == database.Description);
            }
        }
        public void DeleteMappingAndIdentity()
        {
            StandardPISystem.Refresh();

            var myMapping = StandardPISystem.SecurityMappings[Constants.AF_SECURITY_MAPPING_NAME];

            if (myMapping != null)
            {
                _piSystem.SecurityMappings.Remove(Constants.AF_SECURITY_MAPPING_NAME);
            }

            var myIdentity = StandardPISystem.SecurityIdentities[Constants.AF_SECURITY_IDENTITY_NAME];

            if (myIdentity != null)
            {
                StandardPISystem.SecurityIdentities.Remove(Constants.AF_SECURITY_IDENTITY_NAME);
            }


            _piSystem.CheckIn();
        }
        public void UpdateEnumerationValueTest()
        {
            string             path             = Constants.AF_ENUMERATION_VALUE_PATH;
            PIEnumerationValue enumerationValue = instance.GetByPath(path, null);

            enumerationValue.Id          = null;
            enumerationValue.Description = "New enumeration value description";
            enumerationValue.Links       = null;
            enumerationValue.Path        = null;
            enumerationValue.WebId       = null;
            instance.UpdateEnumerationValue(webId, enumerationValue);

            StandardPISystem.Refresh();
            AFEnumerationValue afEnumValue = AFObject.FindObject(path) as AFEnumerationValue;

            afEnumValue.Database.Refresh();
            if (afEnumValue != null)
            {
                Assert.IsTrue(afEnumValue.Description == afEnumValue.Description);
            }
        }
        public void CreateMappingAndIdentity()
        {
            StandardPISystem.Refresh();
            var myIdentity = StandardPISystem.SecurityIdentities[Constants.AF_SECURITY_IDENTITY_NAME];

            if (myIdentity == null)
            {
                myIdentity             = StandardPISystem.SecurityIdentities.Add(Constants.AF_SECURITY_IDENTITY_NAME);
                myIdentity.Description = "Test User Identity";
            }

            var myMapping = StandardPISystem.SecurityMappings[Constants.AF_SECURITY_MAPPING_NAME];

            if (myMapping == null)
            {
                myMapping             = _piSystem.SecurityMappings.Add(Constants.AF_SECURITY_MAPPING_NAME, null, myIdentity);
                myMapping.Description = "Current User Mapping";
            }
            _piSystem.CheckIn();
            StandardPISystem.Refresh();
        }
        public void UpdateTest()
        {
            string            path     = Constants.AF_ELEMENT_CATEGORY_PATH;
            PIElementCategory category = instance.GetByPath(path, null);

            category.Id          = null;
            category.Description = "New element category description";
            category.Links       = null;
            category.Path        = null;
            category.WebId       = null;
            instance.Update(webId, category);

            StandardPISystem.Refresh();
            AFCategory myCategory = AFObject.FindObject(path) as AFCategory;

            myCategory.Refresh();
            myCategory.Database.Refresh();
            if (myCategory != null)
            {
                Assert.IsTrue(myCategory.Description == category.Description);
            }
        }
        public void UpdateTest()
        {
            string             path     = Constants.AF_ANALYSIS_CATEGORY_PATH;
            PIAnalysisCategory category = instance.Get(webId, null);

            category.WebId       = null;
            category.Id          = null;
            category.Links       = null;
            category.Path        = null;
            category.Description = "This is the new analysis category swagger description";
            instance.Update(webId, category);

            StandardPISystem.Refresh();
            AFCategory myCategory = AFObject.FindObject(path) as AFCategory;

            myCategory.Refresh();

            if (myCategory != null)
            {
                Assert.IsTrue(myCategory.Description == category.Description);
            }
        }
Esempio n. 21
0
        public void UpdateTest()
        {
            string          path          = Constants.AF_TABLE_CATEGORY_PATH;
            PITableCategory tableCategory = instance.GetByPath(path, null);

            tableCategory.Id          = null;
            tableCategory.Description = "New table category description";
            tableCategory.Links       = null;
            tableCategory.Path        = null;
            tableCategory.WebId       = null;
            instance.Update(webId, tableCategory);

            StandardPISystem.Refresh();
            AFCategory myCategory = AFObject.FindObject(path) as AFCategory;

            myCategory.Refresh();

            if (myCategory != null)
            {
                Assert.IsTrue(myCategory.Description == tableCategory.Description);
            }
        }
        public void UpdateTest()
        {
            string             path             = Constants.AF_SECURITY_IDENTITY_PATH;
            PISecurityIdentity securityIdentity = instance.Get(webId, null);

            securityIdentity.WebId       = null;
            securityIdentity.Id          = null;
            securityIdentity.Links       = null;
            securityIdentity.Path        = null;
            securityIdentity.Description = "This is the new security identity swagger description";

            instance.Update(webId, securityIdentity);


            StandardPISystem.Refresh();
            AFSecurityIdentity mySecurityIdentity = AFObject.FindObject(path) as AFSecurityIdentity;

            if (mySecurityIdentity != null)
            {
                Assert.IsTrue(mySecurityIdentity.Description == securityIdentity.Description);
            }
        }
Esempio n. 23
0
        public void UpdateTest()
        {
            string  path  = Constants.AF_TABLE_PATH;
            PITable table = instance.GetByPath(path, null);

            table.Id          = null;
            table.Description = "New table description";
            table.Links       = null;
            table.Path        = null;
            table.WebId       = null;
            instance.Update(webId, table);

            StandardPISystem.Refresh();
            AFTable myTable = AFObject.FindObject(path) as AFTable;

            myTable.Refresh();

            if (myTable != null)
            {
                Assert.IsTrue(myTable.Description == table.Description);
            }
        }
        public void UpdateTest()
        {
            string      path      = Constants.AF_ATTRIBUTE_PATH;
            PIAttribute attribute = instance.GetByPath(path);

            attribute.WebId       = null;
            attribute.Id          = null;
            attribute.Path        = null;
            attribute.Step        = null;
            attribute.HasChildren = null;
            attribute.Links       = null;
            attribute.Description = "New description for Swagger attribute";
            instance.Update(webId, attribute);
            StandardPISystem.Refresh();
            AFAttribute myAttribute = AFObject.FindObject(path) as AFAttribute;

            myAttribute.Database.Refresh();
            if (myAttribute != null)
            {
                Assert.IsTrue(myAttribute.Description == myAttribute.Description);
            }
        }
        public void UpdateTest()
        {
            string path = Constants.AF_SECURITY_MAPPING_PATH;

            PISecurityMapping securityMapping = instance.Get(webId, null);

            securityMapping.WebId       = null;
            securityMapping.Id          = null;
            securityMapping.Links       = null;
            securityMapping.Account     = null;
            securityMapping.Path        = null;
            securityMapping.Description = "This is the new security mapping swagger description";
            instance.Update(webId, securityMapping);

            StandardPISystem.Refresh();
            AFSecurityMapping mySecurityMapping = AFObject.FindObject(path) as AFSecurityMapping;

            if (mySecurityMapping != null)
            {
                Assert.IsTrue(mySecurityMapping.Description == securityMapping.Description);
            }
        }
Esempio n. 26
0
        public void UpdateTest()
        {
            string    path    = Constants.AF_ELEMENT_PATH;
            PIElement element = instance.GetByPath(path, null);

            element.Id          = null;
            element.Description = "New element description";
            element.Links       = null;
            element.Path        = null;
            element.WebId       = null;
            element.HasChildren = null;
            instance.Update(webId, element);

            StandardPISystem.Refresh();
            AFElement myElement = AFObject.FindObject(path) as AFElement;

            myElement.Refresh();

            if (myElement != null)
            {
                Assert.IsTrue(myElement.Description == element.Description);
            }
        }
        public void UpdateTest()
        {
            string           path    = Constants.AF_ENUMERATION_SET_PATH;
            PIEnumerationSet enumSet = instance.GetByPath(path, null);

            enumSet.Id          = null;
            enumSet.Description = "New enumeration set description";
            enumSet.Links       = null;
            enumSet.Path        = null;
            enumSet.WebId       = null;
            instance.Update(webId, enumSet);

            StandardPISystem.Refresh();
            AFDatabase db = StandardPISystem.Databases[Constants.AF_DATABASE_NAME];

            db.Refresh();
            AFEnumerationSet afEnumSet = AFObject.FindObject(Constants.AF_ENUMERATION_SET_PATH) as AFEnumerationSet;

            afEnumSet.Database.Refresh();
            afEnumSet.Refresh();

            Assert.IsTrue(afEnumSet.Description == enumSet.Description);
        }
        public void UpdateTest()
        {
            string path = Constants.AF_ATTRIBUTE_TEMPLATE_PATH;
            PIAttributeTemplate template = instance.Get(webId, null);

            template.WebId       = null;
            template.Id          = null;
            template.Links       = null;
            template.Path        = null;
            template.HasChildren = null;
            template.Description = "This is the new attribute template swagger description";
            instance.Update(webId, template);

            StandardPISystem.Refresh();
            AFAttributeTemplate myAttributeTemplate = AFObject.FindObject(path) as AFAttributeTemplate;

            myAttributeTemplate.ElementTemplate.Refresh();
            myAttributeTemplate = AFObject.FindObject(path) as AFAttributeTemplate;

            if (myAttributeTemplate != null)
            {
                Assert.IsTrue(myAttributeTemplate.Description == template.Description);
            }
        }