Esempio n. 1
0
        public void testInheritRules()
        {
            String configFileText1_ = "<agent id=\"mcmTest.MappingsTest\" sifVersion=\"2.0\">\n"
                                      + " <mappings id=\"Default\">\n"
                                      + " <object object=\"StudentPersonal\">\n"
                                      + " <field name=\"StudentPers_guid\">@RefId</field>\n"
                                      + " <field name=\"LastName\">Name[@Type='01']/LastName</field>\n"
                                      + " <field name=\"FirstName\">Name[@Type='01']/FirstName</field>\n"
                                      + " <field name=\"MiddleName\">Name[@Type='01']/MiddleName</field>\n"
                                      +
                                      " <field name=\"Street\">StudentAddress[@PickupOrDropoff='NA',@DayOfWeek='NA']/Address[@Type='01']/Street/Line1</field>\n"
                                      +
                                      " <field name=\"City\">StudentAddress[@PickupOrDropoff='NA',@DayOfWeek='NA']/Address[@Type='01']/City</field>\n"
                                      +
                                      " <field name=\"State\">StudentAddress[@PickupOrDropoff='NA',@DayOfWeek='NA']/Address[@Type='01']/StateProvince</field>\n"
                                      +
                                      " <field name=\"Zip\">StudentAddress[@PickupOrDropoff='NA',@DayOfWeek='NA']/Address[@Type='01']/PostalCode</field>\n"
                                      + " </object>\n"
                                      + "  <mappings id=\"Zone A\" zoneId=\"Zone A\">\n"
                                      + "   <object object=\"StudentPersonal\">\n"
                                      + "     <field name=\"LastName\">Name[@Type='06']/LastName</field>\n"
                                      + "     <field name=\"FirstName\">Name[@Type='06']/FirstName</field>\n"
                                      + "     <field name=\"MiddleName\">Name[@Type='06']/MiddleName</field>\n"
                                      + "   </object>\n"
                                      + "  </mappings>\n"
                                      + " </mappings>\n"
                                      + "</agent>";

            IDictionary psValueMap = new Dictionary <String, String>();

            psValueMap["StudentPers_guid"] = "14050614103526133C3FD2324C5BC8FF";
            psValueMap["LastName"]         = "Finale";
            psValueMap["FirstName"]        = "Prima";
            psValueMap["MiddleName"]       = "Mediccio";
            psValueMap["Street"]           = "667 Gate Way";
            psValueMap["City"]             = "Sacramento";
            psValueMap["State"]            = "CA";
            psValueMap["Zip"] = "91020";

            StringMapAdaptor sma = new StringMapAdaptor(psValueMap);
            StudentPersonal  sp  = doOutboundMappingSelect(sma, configFileText1_,
                                                           "Zone A", null, null);

            Assertion.AssertNotNull("Student should not be null", sp);

            SifElement address = (SifElement)sp
                                 .GetElementOrAttribute(
                "StudentAddress[@PickupOrDropoff='NA',@DayOfWeek='NA']/Address[@Type='01']");

            Assertion.AssertNotNull("Student Address should have mapped", address);

            SifElement name = (SifElement)sp
                              .GetElementOrAttribute("Name[@Type='06']");

            Assertion.AssertNotNull("Name should have mapped to '06'", name);
        }
Esempio n. 2
0
        public void testStudentPersonal2Addresses20r1()
        {
            IDictionary values = new Hashtable();

            values.Add("PERMNUM", "9798");
            values.Add("LASTNAME", "Doe");
            values.Add("FIRSTNAME", "Jane");
            values.Add("MIDDLENAME", null);
            values.Add("MAILADDR", "PO Box 80077");
            values.Add("CITY", "Salt Lake City");
            values.Add("STATE", "Utah");
            values.Add("COUNTRY", "US");
            values.Add("ZIPCODE", "84093");
            values.Add("RESADDR", "528 Big CottonWood Rd");
            values.Add("RESCITY", "Sandy");
            values.Add("RESSTATE", "UT");
            values.Add("RESCOUNTRY", "US");
            values.Add("RESZIPCODE", "84095");

            StringMapAdaptor sma = new StringMapAdaptor(values);
            StudentPersonal  sp  = new StudentPersonal();

            Mappings m = fCfg.Mappings.GetMappings("Default").Select(null,
                                                                     null, null);

            m.MapOutbound(sma, sp, SifVersion.SIF20r1);

            Console.WriteLine(sp.ToXml());

            Element e = sp
                        .GetElementOrAttribute("AddressList/Address[@Type='0123']/Street/Line1");

            Assertion.AssertNotNull("Mailing Address was not mapped ", e);
            Assertion.AssertEquals("Mailing Address", "PO Box 80077", e.TextValue);

            e = sp
                .GetElementOrAttribute("AddressList/Address[@Type='0765']/Street/Line1");
            Assertion.AssertNotNull("Residential Address was not mapped ", e);
            Assertion.AssertEquals("Mailing Address", "528 Big CottonWood Rd", e
                                   .TextValue);

            StudentAddressList[] list     = sp.AddressLists;
            SifElementList       children = sp.GetChildList(CommonDTD.ADDRESSLIST);

            Assertion.AssertEquals("Should have one StudentAddress elements", 1,
                                   children.Count);
            Assertion.AssertEquals("Should have two address elements", 2, children[0].ChildCount);
        }
        public void testParseGraduationDate()
        {
            String sXML = "<StudentPersonal RefId='12345678901234567890'>"
                          + " <GradYear Type='Actual'>2005</GradYear>"
                          + "</StudentPersonal>";

            StudentPersonal sp = (StudentPersonal)parseSIF15r1XML(sXML);

            sp = (StudentPersonal)AdkObjectParseHelper.WriteParseAndReturn(sp, SifVersion.SIF11);
            Assertion.AssertNotNull(sp);
            PartialDateType gd = sp.GraduationDate;

            Assertion.AssertNotNull("Actual Grad Year", gd);
            Assertion.AssertEquals("Actual Grad Year", 2005, (int)gd.Year);

            Adk.SifVersion = SifVersion.SIF15r1;
            sp             = new StudentPersonal();
            sp.SetElementOrAttribute("GradYear[@Type='Actual']", "2054");
            gd = sp.GraduationDate;
            Assertion.AssertNotNull("Actual Grad Year", gd);
            Assertion.AssertNotNull("GraduationDate/getYear()", gd.Year);
            Assertion.AssertEquals("Actual Grad Year", 2054, gd.Year.Value);

            Element gradValue = sp.GetElementOrAttribute("GradYear[@Type='Actual']");

            Assertion.AssertNotNull("Actual Grad Year", gradValue);
            PartialDateType pdt = (PartialDateType)gradValue;

            Assertion.AssertEquals("Actual Grad Year", 2054, pdt.Year.Value);
        }
        public void testParseProjectedGradYear()
        {
            String sXML = "<StudentPersonal RefId='12345678901234567890'>"
                          + " <GradYear Type='Projected'>2012</GradYear>"
                          + "</StudentPersonal>";

            StudentPersonal sp = (StudentPersonal)parseSIF15r1XML(sXML);

            sp = (StudentPersonal)AdkObjectParseHelper.WriteParseAndReturn(sp, SifVersion.SIF11);
            Assertion.AssertNotNull(sp);
            Assertion.AssertNotNull("Projected Grad Year", sp.ProjectedGraduationYear);
            Assertion.AssertEquals("Projected Grad Year", 2012, (int)sp
                                   .ProjectedGraduationYear);

            Adk.SifVersion = SifVersion.SIF15r1;
            sp             = new StudentPersonal();
            sp.SetElementOrAttribute("GradYear[@Type='Projected']", "2089");
            Assertion.AssertNotNull("Projected Grad Year", sp.ProjectedGraduationYear);
            Assertion.AssertEquals("Projected Grad Year", 2089, (int)sp
                                   .ProjectedGraduationYear);

            Element gradValue = sp.GetElementOrAttribute("GradYear[@Type='Projected']");

            Assertion.AssertNotNull("Projected Grad Year", gradValue);
            int gradYear = (int)gradValue.SifValue.RawValue;

            Assertion.AssertNotNull("Projected Grad Year", gradYear);
            Assertion.AssertEquals("Projected Grad Year", 2089, gradYear);
        }
        public void testParseOnTimeGradYear()
        {
            String sXML = "<StudentPersonal RefId='12345678901234567890'>"
                          + " <GradYear Type='Original'>1971</GradYear>"
                          + "</StudentPersonal>";

            StudentPersonal sp = (StudentPersonal)parseSIF15r1XML(sXML);

            sp = (StudentPersonal)AdkObjectParseHelper.WriteParseAndReturn(sp, SifVersion.SIF11);
            Assertion.AssertNotNull(sp);
            Assertion.AssertNotNull("On Time Grad Year", sp.OnTimeGraduationYear);
            Assertion.AssertEquals("On Time Grad Year", 1971, (int)sp
                                   .OnTimeGraduationYear);

            Adk.SifVersion = SifVersion.SIF15r1;
            sp             = new StudentPersonal();
            sp.SetElementOrAttribute("GradYear[@Type='Original']", "8877");
            Assertion.AssertNotNull("On Time Grad Year", sp.OnTimeGraduationYear);
            Assertion.AssertEquals("On Time Grad Year", 8877, (int)sp
                                   .OnTimeGraduationYear);

            Element gradValue = sp.GetElementOrAttribute("GradYear[@Type='Original']");

            Assertion.AssertNotNull("On Time Grad Year", gradValue);
            int gradYear = (int)gradValue.SifValue.RawValue;

            Assertion.AssertNotNull("On Time Grad Year", gradYear);
            Assertion.AssertEquals("On Time Grad Year", 8877, gradYear);
        }
Esempio n. 6
0
        public void TestStringConcat()
        {
            String configFileText = "<agent id=\"Repro\" sifVersion=\"2.0\">"
                                    + "    <mappings id=\"Default\">"
                                    + "        <object object=\"StudentPersonal\">"
                                    +
                                    "            <field name=\"FullName\">Name[@Type='01']/FullName=NAME:$(LastName), $(FirstName) $(MiddleName)</field>"
                                    + "        </object>" + "    </mappings>" + "</agent>";

            IDictionary map = new Dictionary <String, String>();

            map.Add("StudentPers_guid", "1234");
            map.Add("LastName", "Finale");
            map.Add("FirstName", "Prima");
            map.Add("MiddleName", "Mediccio");
            map.Add("FullName", "");

            StringMapAdaptor sma = new StringMapAdaptor(map);
            TestValueBuilder tvb = new TestValueBuilder(sma);
            StudentPersonal  sp  = mapToStudentPersonal(sma, configFileText, tvb);

            Assertion.AssertNotNull("Student should not be null", sp);

            SimpleField fullName = (SimpleField)sp
                                   .GetElementOrAttribute("Name/FullName");

            Assertion.AssertNotNull("FullName", fullName);
            Assertion.AssertEquals("FullName", "NAME:Finale, Prima Mediccio", fullName.Value);
        }
        public void testCountryCodeStudentPersonal()
        {
            Adk.SifVersion = SifVersion.SIF15r1;

            String customMappings = "<agent id='Repro' sifVersion='2.0'>"
                                    + "   <mappings id='Default'>"
                                    + "     <object object='StudentPersonal'>"
                                    +
                                    "       <field name='COUNTRY' sifVersion='+2.0'>AddressList/Address[@Type='0769']/Country=US</field>"
                                    +
                                    "       <field name='COUNTRY' sifVersion='-1.5r1'>StudentAddress[@PickupOrDropoff='NA',@DayOfWeek='NA']/Address[@Type='M']/Country[@Code='UK']</field>"
                                    +
                                    "       <field name='RESCOUNTRY' sifVersion='+2.0'>AddressList/Address[@Type='0765']/Country=US</field>"
                                    +
                                    "       <field name='RESCOUNTRY' sifVersion='-1.5r1'>StudentAddress[@PickupOrDropoff='NA',@DayOfWeek='NA']/Address[@Type='P']/Country[@Code='US']</field>"
                                    + "</object></mappings></agent>";

            Adk.SifVersion = SifVersion.SIF15r1;

            IDictionary map = new Hashtable();

            map.Add("RESCOUNTRY", "");
            map.Add("COUNTRY", "");
            StringMapAdaptor sma = new StringMapAdaptor(map);
            StudentPersonal  sp  = new StudentPersonal();

            doOutboundMapping(sma, sp, customMappings, null);

            StudentAddressList sal = sp.AddressList;

            Assertion.AssertNotNull("StudentAddressList is null", sal);
            Assertion.AssertEquals(
                "StudentAddressList does not contain two address list types",
                2, sal.ChildCount);

            assertCountry((Address)sp
                          .GetElementOrAttribute("StudentAddress/Address[@Type='P']"),
                          "US");
            assertCountry((Address)sp
                          .GetElementOrAttribute("StudentAddress/Address[@Type='M']"),
                          "UK");
        }
Esempio n. 8
0
        public void testStudentPersonalNullHomeroom()
        {
            IDictionary values = new Hashtable();

            values.Add("PERMNUM", "9798");
            values.Add("SOCSECNUM", "845457898");
            values.Add("SCHOOLNUM", "999");
            values.Add("SCHOOLNUM2", "999");
            values.Add("GRADE", "09");
            values.Add("HOMEROOM", null);
            values.Add("LASTNAME", "Doe");
            values.Add("FIRSTNAME", "Jane");
            values.Add("MIDDLENAME", null);
            values.Add("NICKNAME", null);
            values.Add("MAILADDR", "5845 Test Blvd");
            values.Add("CITY", "slc");
            values.Add("STATE", "Utah");
            values.Add("COUNTRY", "");
            values.Add("ZIPCODE", "84093");
            values.Add("RESADDR", null);
            values.Add("RESCITY", null);
            values.Add("RESSTATE", null);
            values.Add("RESCOUNTRY", null);
            values.Add("RESZIPCODE", null);
            values.Add("BIRTHDATE", "20051209");
            values.Add("GENDER", "F");
            values.Add("ETHNICCODE", "W");
            values.Add("ENGPROF", "");
            values.Add("PRIMARYLNG", "");
            values.Add("TELEPHONE", null);

            StringMapAdaptor sma = new StringMapAdaptor(values);
            StudentPersonal  sp  = new StudentPersonal();

            Mappings m = fCfg.Mappings.GetMappings("Default").Select(null,
                                                                     null, null);

            m.MapOutbound(sma, sp, SifVersion.SIF15r1);

            Console.WriteLine(sp.ToXml());

            Element e = sp
                        .GetElementOrAttribute("OtherId[@Type='ZZ' and starts-with(., 'HOMEROOM') ]");

            Assertion.AssertNull("HOMEROOM should not have been mapped", e);
        }