Ejemplo n.º 1
0
        public static String toATML(CASS_MTPSI tpsi)
        {
            StringWriter tw = new StringWriter();
            TestConfiguration testConfig = new TestConfiguration();

            ManufacturerData configManager = testConfig.ConfigurationManager;
            List<CASS_MTPSICASS_MTPSI_page> pages = tpsi.CASS_MTPSI_page;
            foreach( CASS_MTPSICASS_MTPSI_page page in pages )
            {
                CASS_MTPSICASS_MTPSI_pageUUT uut = page.UUT;
                String partNo = uut.UUT_ID.Part_Number;
                //UUTInstance instance = new UUTInstance();
                UUTDescription item = new UUTDescription();
                //item.Item.name = uut.UUT_ID.Part_Number;

                //Lookup UUT Information
                ItemDescriptionReference reference = new ItemDescriptionReference();
                DocumentReference docRef = new DocumentReference();
                //docRef.ID = uut.UUT_ID.Part_Number;
                docRef.uuid = "{SOMEUUIDHERE}";

                reference.Item = docRef;// item.Item;
                //testConfig.TestedUUTs.Add(reference);

                TestConfigurationTestEquipmentItem testEquipment = new TestConfigurationTestEquipmentItem();

                foreach( CASS_MTPSICASS_MTPSI_pageATE_assets asset in page.ATE_assets )
                {
                    ItemDescriptionReference refEquip = new ItemDescriptionReference();
                    ItemDescription instrument = new ItemDescription();
                    instrument.name = asset.Asset_Identifier;
                    refEquip.Item = instrument;
                    //testEquipment.Instrumentation.Add(refEquip);
                }

               // testConfig.TestEquipment.Add(testEquipment);

                try
                {
                    XmlSerializer serializerObj = new XmlSerializer(typeof(TestConfiguration));
                    serializerObj.Serialize(tw, testConfig);
                }
                catch( Exception e )
                {
                    Exception ie = e.InnerException;
                    while( ie != null )
                    {
                        Trace.WriteLine(ie.Message);
                        ie = ie.InnerException;
                    }
                }
                break;
            }
            return tw.ToString();
        }
 public TestResults()
 {
     this._extension = new Extension();
     this._workOrder = new WorkOrder();
     this._uUT = new ItemInstance();
     this._testStation = new HardwareInstance();
     this._testProgram = new TestResultsTestProgram();
     this._testDescription = new ItemDescriptionReference();
     this._site = new Organization();
     this._resultSet = new TestGroup();
     this._references = new List<Document>();
     this._preTestRepairs = new List<Repair>();
     this._personnel = new TestResultsPersonnel();
 }
Ejemplo n.º 3
0
        public static UUTDescription FindUut(ItemDescriptionReference uutReference)
        {
            UUTDescription uut = null;
            string uuid;
            if (uutReference != null && uutReference.Item is DocumentReference)
            {
                uuid = ((DocumentReference) uutReference.Item).uuid;
                Document document = DocumentManager.GetDocument(uuid);
                if (document != null && document.DocumentContent != null)
                {
                    uut = UUTDescription.Deserialize(Encoding.UTF8.GetString(document.DocumentContent));
                }
            }

            return uut;
        }
Ejemplo n.º 4
0
        public static void CreateProject( ProjectInfo projectInfo )
        {
            //--- Prompt for a test set name ---//
            //--- Check if the name exisists ---//
            //--- If name exists then notify the user, ask if they want to open that test set ---//
            //--- Otherwise create the test set and open it ---//
            if (projectInfo != null)
            {
                TestProgramSet currentTestProgramSet = TestProgramSet.CreateTestSet( projectInfo.ProjectName );
                if (currentTestProgramSet != null)
                {
                    SaveProjectInfo( projectInfo, currentTestProgramSet );
                    OpenProject( projectInfo.ProjectName );
                    Document uutDescriptionDocument = DocumentManager.GetDocument( projectInfo.UutId );
                    if (uutDescriptionDocument != null)
                    {
                        SaveATMLDocument( UutManager.BuildAtmlFileName( projectInfo.UutName ),
                                          AtmlFileType.AtmlTypeUut,
                                          uutDescriptionDocument.DocumentContent );
                    }

                    //--- Create a Test Description ---//
                    if (uutDescriptionDocument != null)
                    {
                        var uutDoc = new DocumentReference();
                        uutDoc.ID = "UUT1";
                        uutDoc.uuid = uutDescriptionDocument.uuid;
                        var uutRef = new ItemDescriptionReference();
                        uutRef.Item = uutDoc;
                        var testConfiguration = new TestConfiguration15();
                        testConfiguration.uuid = Guid.NewGuid().ToString();
                        testConfiguration.TestedUUTs.Add( uutRef );
                        SaveATMLDocument( projectInfo.ProjectName + ATMLContext.ATML_CONFIG_FILENAME_SUFFIX,
                                          AtmlFileType.AtmlTypeTestConfiguration,
                                          Encoding.UTF8.GetBytes( testConfiguration.Serialize() ) );
                    }
                }
            }
        }
Ejemplo n.º 5
0
 public static bool LoadFromFile(string fileName, out ItemDescriptionReference obj)
 {
     System.Exception exception;
     return LoadFromFile(fileName, out obj, out exception);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Deserializes xml markup from file into an ItemDescriptionReference object
 /// </summary>
 /// <param name="fileName">string xml file to load and deserialize</param>
 /// <param name="obj">Output ItemDescriptionReference object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
 public static bool LoadFromFile(string fileName, out ItemDescriptionReference obj, out System.Exception exception)
 {
     exception = null;
     obj = default(ItemDescriptionReference);
     try
     {
         obj = LoadFromFile(fileName);
         return true;
     }
     catch (System.Exception ex)
     {
         exception = ex;
         return false;
     }
 }
Ejemplo n.º 7
0
 public static bool Deserialize(string input, out ItemDescriptionReference obj)
 {
     System.Exception exception;
     return Deserialize(input, out obj, out exception);
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Deserializes workflow markup into an ItemDescriptionReference object
 /// </summary>
 /// <param name="input">string workflow markup to deserialize</param>
 /// <param name="obj">Output ItemDescriptionReference object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
 public static bool Deserialize(string input, out ItemDescriptionReference obj, out System.Exception exception)
 {
     exception = null;
     obj = default(ItemDescriptionReference);
     try
     {
         obj = Deserialize(input);
         return true;
     }
     catch (System.Exception ex)
     {
         exception = ex;
         return false;
     }
 }
 private void AddUutDocumentReference(UUTDescription uut)
 {
     var docRef = new DocumentReference();
     var document = DocumentManager.GetDocument(uut.uuid);
     docRef.ID = "UUT" + uutListControl.Items.Count+1;
     docRef.uuid = uut.uuid;
     docRef.DocumentType = document.DocumentType;
     docRef.DocumentContent = document.DocumentContent;
     docRef.ContentType = document.ContentType;
     docRef.DocumentName = document.name;
     var idr = new ItemDescriptionReference {Item = docRef};
     uutListControl.AddListViewObject( idr );
 }
        private void AddUutDocumentReference(ItemDescriptionReference idr)
        {
            string model = "";
            string partNo = "";

            var id = idr.Item as DocumentReference;
            if (id != null)
            {
                Document document = DocumentManager.GetDocument(id.uuid);
                if (document != null)
                {
                    string content =
                        StringUtils.RemoveByteOrderMarkUTF8(Encoding.UTF8.GetString(document.DocumentContent));
                    UUTDescription uut = UUTDescription.Deserialize(content);
                    if (uut != null)
                    {
                        model = GetIdentity(uut.Item, model, ref partNo);
                    }
                    var lvi = new ListViewItem(model);
                    lvi.SubItems.Add(partNo);
                    lvi.SubItems.Add(id.uuid);
                    lvi.Tag = idr;
                    uutListControl.Items.Add(lvi);
                }
            }
        }
 private void AddItemDescription(ItemDescriptionReference idr)
 {
     string partNo = "";
     var id = idr.Item as ItemDescription;
     if (id != null)
     {
         var lvi = new ListViewItem(id.Identification != null ? id.Identification.ModelName : "");
         if (id.Identification != null && id.Identification.IdentificationNumbers != null &&
             id.Identification.IdentificationNumbers.Count > 0)
             partNo = id.Identification.IdentificationNumbers[0].number;
         lvi.SubItems.Add(partNo);
         lvi.SubItems.Add(id.name);
         lvi.Tag = idr;
         uutListControl.Items.Add(lvi);
     }
 }