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 CreateEventFrameTest() { PIEventFrame childEventFrame = new PIEventFrame() { Name = Constants.AF_EVENT_FRAME_NAME + "3", StartTime = "*-2d", EndTime = "*-1d" }; instance.CreateEventFrame(webId, childEventFrame); string path = Constants.AF_EVENT_FRAME_PATH; AFEventFrame myEventFrame = AFObject.FindObject(path) as AFEventFrame; myEventFrame.Refresh(); Assert.IsNotNull(myEventFrame.EventFrames[childEventFrame.Name]); }
public void CreateEventFrameTest() { string path = Constants.AF_DATABASE_PATH; PIEventFrame eventFrame = new PIEventFrame() { Name = Constants.AF_EVENT_FRAME_NAME + "3", StartTime = "*-2d", EndTime = "*-1d" }; instance.CreateEventFrame(webId, eventFrame); AFDatabase db = AFObject.FindObject(path) as AFDatabase; var results = AFEventFrame.FindEventFrames(db, null, string.Empty, AFSearchField.Name, true, AFSortField.Name, AFSortOrder.Ascending, 0, 100); Assert.IsTrue(results.Where(ev => ev.Name == eventFrame.Name).Count() == 1); }
public void GetWebIDOnlyTest() { string webIdType = "IDOnly"; PIAnalysis piAnalysis = client.Analysis.GetByPath(Constants.AF_ANALYSIS_PATH, null, webIdType); WebIdInfo piAnalysisWebIdInfo = client.WebIdHelper.GetWebIdInfo(piAnalysis.WebId); Assert.AreNotEqual(Constants.AF_ANALYSIS_PATH.ToUpper().Substring(2), piAnalysisWebIdInfo.Path); Assert.AreEqual(piAnalysis.Id, piAnalysisWebIdInfo.ObjectID.ToString()); PIAnalysisCategory piAnalysisCategory = client.AnalysisCategory.GetByPath(Constants.AF_ANALYSIS_CATEGORY_PATH, null, webIdType); WebIdInfo piAnalysisCategoryWebIdInfo = client.WebIdHelper.GetWebIdInfo(piAnalysisCategory.WebId); Assert.AreNotEqual(Constants.AF_ANALYSIS_CATEGORY_PATH.ToUpper().Substring(2), piAnalysisCategoryWebIdInfo.Path); Assert.AreEqual(piAnalysisCategory.Id, piAnalysisCategoryWebIdInfo.ObjectID.ToString()); PIAnalysisRule piAnalysisRule = client.AnalysisRule.GetByPath(Constants.AF_ANALYSIS_RULE_PATH, null, webIdType); WebIdInfo piAnalysisRuleWebIdInfo = client.WebIdHelper.GetWebIdInfo(piAnalysisRule.WebId); Assert.AreNotEqual(Constants.AF_ANALYSIS_RULE_PATH.ToUpper().Substring(2), piAnalysisRuleWebIdInfo.Path); Assert.AreEqual(piAnalysisRule.Id, piAnalysisRuleWebIdInfo.ObjectID.ToString()); PIAnalysisRulePlugIn piAnalysisRulePlugIn = client.AnalysisRulePlugIn.GetByPath(Constants.AF_ANALYSIS_RULE_PLUGIN_PATH, null, webIdType); WebIdInfo piAnalysisRulePlugInWebIdInfo = client.WebIdHelper.GetWebIdInfo(piAnalysisRulePlugIn.WebId); Assert.AreNotEqual(Constants.AF_ANALYSIS_RULE_PLUGIN_PATH.ToUpper().Substring(2), piAnalysisRulePlugInWebIdInfo.Path); Assert.AreEqual(piAnalysisRulePlugIn.Id, piAnalysisRulePlugInWebIdInfo.ObjectID.ToString()); PIAnalysisTemplate piAnalysisTemplate = client.AnalysisTemplate.GetByPath(Constants.AF_ANALYSIS_TEMPLATE_PATH, null, webIdType); WebIdInfo piAnalysisTemplateWebIdInfo = client.WebIdHelper.GetWebIdInfo(piAnalysisTemplate.WebId); Assert.AreNotEqual(Constants.AF_ANALYSIS_TEMPLATE_PATH.ToUpper().Substring(2), piAnalysisTemplateWebIdInfo.Path); Assert.AreEqual(piAnalysisTemplate.Id, piAnalysisTemplateWebIdInfo.ObjectID.ToString()); PIAssetDatabase piAssetDatabase = client.AssetDatabase.GetByPath(Constants.AF_DATABASE_PATH, null, webIdType); WebIdInfo piAssetDatabaseWebIdInfo = client.WebIdHelper.GetWebIdInfo(piAssetDatabase.WebId); Assert.AreNotEqual(Constants.AF_DATABASE_PATH.ToUpper().Substring(2), piAssetDatabaseWebIdInfo.Path); Assert.AreEqual(piAssetDatabase.Id, piAssetDatabaseWebIdInfo.ObjectID.ToString()); PIAssetServer piAssetServer = client.AssetServer.GetByPath(Constants.AF_SERVER_PATH, null, webIdType); WebIdInfo piAssetServerWebIdInfo = client.WebIdHelper.GetWebIdInfo(piAssetServer.WebId); Assert.AreNotEqual(Constants.AF_SERVER_PATH.ToUpper().Substring(2), piAssetServerWebIdInfo.Path); Assert.AreEqual(piAssetServer.Id, piAssetServerWebIdInfo.ServerID.ToString()); PIAttribute piAttribute = client.Attribute.GetByPath(Constants.AF_ATTRIBUTE_PATH, null, webIdType); WebIdInfo piAttributeWebIdInfo = client.WebIdHelper.GetWebIdInfo(piAttribute.WebId); Assert.AreNotEqual(Constants.AF_ATTRIBUTE_PATH.ToUpper().Substring(2), piAttributeWebIdInfo.Path); Assert.AreEqual(piAttribute.Id, piAttributeWebIdInfo.ObjectID.ToString()); PIAttributeCategory piAttributeCategory = client.AttributeCategory.GetByPath(Constants.AF_ATTRIBUTE_CATEGORY_PATH, null, webIdType); WebIdInfo piAttributeCategoryWebIdInfo = client.WebIdHelper.GetWebIdInfo(piAttributeCategory.WebId); Assert.AreNotEqual(Constants.AF_ATTRIBUTE_CATEGORY_PATH.ToUpper().Substring(2), piAttributeCategoryWebIdInfo.Path); Assert.AreEqual(piAttributeCategory.Id, piAttributeCategoryWebIdInfo.ObjectID.ToString()); PIAttributeTemplate piAttributeTemplate = client.AttributeTemplate.GetByPath(Constants.AF_ATTRIBUTE_TEMPLATE_PATH, null, webIdType); WebIdInfo piAttributeTemplateWebIdInfo = client.WebIdHelper.GetWebIdInfo(piAttributeTemplate.WebId); Assert.AreNotEqual(Constants.AF_ATTRIBUTE_TEMPLATE_PATH.ToUpper().Substring(2), piAttributeTemplateWebIdInfo.Path); Assert.AreEqual(piAttributeTemplate.Id, piAttributeTemplateWebIdInfo.ObjectID.ToString()); PIDataServer piDataServer = client.DataServer.GetByPath(Constants.PI_DATA_SERVER_PATH, null, webIdType); WebIdInfo piDataServerWebIdInfo = client.WebIdHelper.GetWebIdInfo(piDataServer.WebId); Assert.AreNotEqual(Constants.PI_DATA_SERVER_PATH.ToUpper().Substring(2), piDataServerWebIdInfo.Path); Assert.AreEqual(piDataServer.Id, piDataServerWebIdInfo.ServerID.ToString()); PIElement piElement = client.Element.GetByPath(Constants.AF_ELEMENT_PATH, null, webIdType); WebIdInfo piElementWebIdInfo = client.WebIdHelper.GetWebIdInfo(piElement.WebId); Assert.AreNotEqual(Constants.AF_ELEMENT_PATH.ToUpper().Substring(2), piElementWebIdInfo.Path); Assert.AreEqual(piElement.Id, piElementWebIdInfo.ObjectID.ToString()); PIElementCategory piElementCategory = client.ElementCategory.GetByPath(Constants.AF_ELEMENT_CATEGORY_PATH, null, webIdType); WebIdInfo piElementCategoryWebIdInfo = client.WebIdHelper.GetWebIdInfo(piElementCategory.WebId); Assert.AreNotEqual(Constants.AF_ELEMENT_CATEGORY_PATH.ToUpper().Substring(2), piElementCategoryWebIdInfo.Path); Assert.AreEqual(piElementCategory.Id, piElementCategoryWebIdInfo.ObjectID.ToString()); PIElementTemplate piElementTemplate = client.ElementTemplate.GetByPath(Constants.AF_ELEMENT_TEMPLATE_PATH, null, webIdType); WebIdInfo piElementTemplateWebIdInfo = client.WebIdHelper.GetWebIdInfo(piElementTemplate.WebId); Assert.AreNotEqual(Constants.AF_ELEMENT_TEMPLATE_PATH.ToUpper().Substring(2), piElementTemplateWebIdInfo.Path); Assert.AreEqual(piElementTemplate.Id, piElementTemplateWebIdInfo.ObjectID.ToString()); PIEnumerationSet piEnumerationSet = client.EnumerationSet.GetByPath(Constants.AF_ENUMERATION_SET_PATH, null, webIdType); WebIdInfo piEnumerationSetWebIdInfo = client.WebIdHelper.GetWebIdInfo(piEnumerationSet.WebId); Assert.AreNotEqual(Constants.AF_ENUMERATION_SET_PATH.ToUpper().Substring(2), piEnumerationSetWebIdInfo.Path); Assert.AreEqual(piEnumerationSet.Id, piEnumerationSetWebIdInfo.ObjectID.ToString()); PIEnumerationValue piEnumerationValue = client.EnumerationValue.GetByPath(Constants.AF_ENUMERATION_VALUE_PATH, null, webIdType); WebIdInfo piEnumerationValueWebIdInfo = client.WebIdHelper.GetWebIdInfo(piEnumerationValue.WebId); Assert.AreNotEqual(Constants.AF_ENUMERATION_VALUE_PATH.ToUpper().Substring(2), piEnumerationValueWebIdInfo.Path); Assert.AreEqual(piEnumerationValue.Id, piEnumerationValueWebIdInfo.ObjectID.ToString()); PIEventFrame piEventFrame = client.EventFrame.GetByPath(Constants.AF_EVENT_FRAME_PATH, null, webIdType); WebIdInfo piEventFrameWebIdInfo = client.WebIdHelper.GetWebIdInfo(piEventFrame.WebId); Assert.AreNotEqual(Constants.AF_EVENT_FRAME_PATH.ToUpper().Substring(2), piEventFrameWebIdInfo.Path); Assert.AreEqual(piEventFrame.Id, piEventFrameWebIdInfo.ObjectID.ToString()); PIPoint piPoint = client.Point.GetByPath(Constants.PI_POINT_PATH, null, webIdType); WebIdInfo piPointWebIdInfo = client.WebIdHelper.GetWebIdInfo(piPoint.WebId); Assert.AreNotEqual(Constants.PI_POINT_PATH.ToUpper().Substring(2), piPointWebIdInfo.Path); Assert.AreEqual(piPoint.Id.ToString(), piPointWebIdInfo.PointID.ToString()); PISecurityIdentity piSecurityIdentity = client.SecurityIdentity.GetByPath(Constants.AF_SECURITY_IDENTITY_PATH, null, webIdType); WebIdInfo piSecurityIdentityWebIdInfo = client.WebIdHelper.GetWebIdInfo(piSecurityIdentity.WebId); Assert.AreNotEqual(Constants.AF_SECURITY_IDENTITY_PATH.ToUpper().Substring(2), piSecurityIdentityWebIdInfo.Path); Assert.AreEqual(piSecurityIdentity.Id, piSecurityIdentityWebIdInfo.ObjectID.ToString()); PISecurityMapping piSecurityMapping = client.SecurityMapping.GetByPath(Constants.AF_SECURITY_MAPPING_PATH, null, webIdType); WebIdInfo piSecurityMappingWebIdInfo = client.WebIdHelper.GetWebIdInfo(piSecurityMapping.WebId); Assert.AreNotEqual(Constants.AF_SECURITY_MAPPING_PATH.ToUpper().Substring(2), piSecurityMappingWebIdInfo.Path); Assert.AreEqual(piSecurityMapping.Id, piSecurityMappingWebIdInfo.ObjectID.ToString()); PITable piTable = client.Table.GetByPath(Constants.AF_TABLE_PATH, null, webIdType); WebIdInfo piTableWebIdInfo = client.WebIdHelper.GetWebIdInfo(piTable.WebId); Assert.AreNotEqual(Constants.AF_TABLE_PATH.ToUpper().Substring(2), piTableWebIdInfo.Path); Assert.AreEqual(piTable.Id, piTableWebIdInfo.ObjectID.ToString()); PITableCategory piTableCategory = client.TableCategory.GetByPath(Constants.AF_TABLE_CATEGORY_PATH, null, webIdType); WebIdInfo piTableCategoryWebIdInfo = client.WebIdHelper.GetWebIdInfo(piTableCategory.WebId); Assert.AreNotEqual(Constants.AF_TABLE_CATEGORY_PATH.ToUpper().Substring(2), piTableCategoryWebIdInfo.Path); Assert.AreEqual(piTableCategory.Id, piTableCategoryWebIdInfo.ObjectID.ToString()); PIUnit piUnit = client.Unit.GetByPath(Constants.AF_UOM_PATH, null, webIdType); WebIdInfo piUnitWebIdInfo = client.WebIdHelper.GetWebIdInfo(piUnit.WebId); Assert.AreNotEqual(Constants.AF_UOM_PATH.ToUpper().Substring(2), piUnitWebIdInfo.Path); Assert.AreEqual(piUnit.Id, piUnitWebIdInfo.ObjectID.ToString()); PIUnitClass piUnitClass = client.UnitClass.GetByPath(Constants.AF_UOM_CLASS_PATH, null, webIdType); WebIdInfo piUnitClassWebIdInfo = client.WebIdHelper.GetWebIdInfo(piUnitClass.WebId); Assert.AreNotEqual(Constants.AF_UOM_CLASS_PATH.ToUpper().Substring(2), piUnitClassWebIdInfo.Path); Assert.AreEqual(piUnitClass.Id, piUnitClassWebIdInfo.ObjectID.ToString()); }
public ApiResponsePIEventFrame(int statusCode, IDictionary <string, string> headers, PIEventFrame data) : base(statusCode, headers) { this.Data = data; }