Package org.bifrost.xmlio

Examples of org.bifrost.xmlio.XmlReader


   */
  public void testAllTypes()
  {
    String configString = createXml(TEST_ALL_TYPES);
    InputStream reader = new ByteArrayInputStream(configString.getBytes());
    XmlReader xmlReader = null;
    try
    {
      xmlReader = new XmlReader(reader, "org.bifrost.xmlio.test.helpers");
    }
    catch (XmlException e)
    {
      fail("Unexpected error: " + e.toString());
    }
    assertNotNull(xmlReader);
    TestHelperTypes helper = (TestHelperTypes)xmlReader.getRootObject();
    assertNotNull(helper);
    assertEquals(helper.getPint(), 1);
    assertEquals(helper.getInteger(), new Integer(2));
    assertTrue(helper.getString().equals("mdk"));
    assertEquals(helper.getPlong(), 3l);
View Full Code Here


   */
  public void testLowerCaseFirstCharacter()
  {
    String configString = createXml(TEST_LOWER_FIRST_CHAR);
    InputStream reader = new ByteArrayInputStream(configString.getBytes());
    XmlReader xmlReader = null;
    try
    {
      xmlReader = new XmlReader(reader, "org.bifrost.xmlio.test.helpers");
    }
    catch (XmlException e)
    {
      fail("Unexpected error: " + e.toString());
    }
    assertNotNull(xmlReader);
    TestHelperSimple helper = (TestHelperSimple)xmlReader.getRootObject();
    assertNotNull(helper);
    assertTrue(helper.getNumber() == 123);
    assertTrue("abc".equals(helper.getString()));
  } // end testLowerCaseFirstCharacter()
View Full Code Here

   */
  public void testSimpleDashes()
  {
    String configString = createXml(TEST_SIMPLE_DASHES);
    InputStream reader = new ByteArrayInputStream(configString.getBytes());
    XmlReader xmlReader = null;
    try
    {
      xmlReader = new XmlReader(reader, "org.bifrost.xmlio.test.helpers");
    }
    catch (XmlException e)
    {
      fail("Unexpected error: " + e.toString());
    }
    assertNotNull(xmlReader);
    TestHelperSimple helper = (TestHelperSimple)xmlReader.getRootObject();
    assertNotNull(helper);
    assertTrue(helper.getNumber() == 123);
    assertTrue("abc".equals(helper.getString()));
  } // end testSimpleDashes()
View Full Code Here

   */
  public void testDashesAndInheritance()
  {
    String configString = createXml(TEST_VEHICLE_INHERITANCE);
    InputStream reader = new ByteArrayInputStream(configString.getBytes());
    XmlReader xmlReader = null;
    try
    {
      xmlReader = new XmlReader(reader,
          "org.bifrost.xmlio.test.helpers.inheritance");
    }
    catch (XmlException e)
    {
      fail("Unexpected error: " + e.toString());
    }
    assertNotNull(xmlReader);
    TestHelperOwner owner = (TestHelperOwner)xmlReader.getRootObject();
    assertNotNull(owner);
    assertTrue("Jane Smith".equals(owner.getName()));
    Collection vehicles = owner.getTestHelperVehicle();
    assertNotNull(vehicles);
    assertTrue(vehicles.size() == 2);
View Full Code Here

  public void testReadingUnmappedProperties()
  {
    String configString = SIMPLE_TEST;
    InputStream reader = new ByteArrayInputStream(configString.getBytes());
    XmlReader xmlReader = null;
    try
    {
      xmlReader = new XmlReader(reader, "org.bifrost.xmlio.test.helpers");
    }
    catch (XmlException e)
    {
      return;
    }
View Full Code Here

    configSimpleTest();
    PropertyMap map = new PropertyMap();
   
    String configString = SIMPLE_TEST;
    InputStream reader = new ByteArrayInputStream(configString.getBytes());
    XmlReader xmlReader = null;
    try
    {
      xmlReader = new XmlReader(reader, "org.bifrost.xmlio.test.helpers");
    }
    catch (XmlException e)
    {
      fail("Unexpected error: " + e.toString());
    }
    assertNotNull(xmlReader);
    TestHelperSimple helper = (TestHelperSimple)xmlReader.getRootObject();
    assertNotNull(helper);
    assertTrue(helper.getNumber() == 808);
    assertTrue("mdk".equals(helper.getString()));
  }
View Full Code Here

    configSimpleTestFromObject();
    PropertyMap map = new PropertyMap();
   
    String configString = SIMPLE_TEST;
    InputStream reader = new ByteArrayInputStream(configString.getBytes());
    XmlReader xmlReader = null;
    try
    {
      xmlReader = new XmlReader(reader, "org.bifrost.xmlio.test.helpers");
    }
    catch (XmlException e)
    {
      fail("Unexpected error: " + e.toString());
    }
    assertNotNull(xmlReader);
    TestHelperSimple helper = (TestHelperSimple)xmlReader.getRootObject();
    assertNotNull(helper);
    assertTrue(helper.getNumber() == 808);
    assertTrue("mdk".equals(helper.getString()));
  }
View Full Code Here

 
  public void load(InputStream io) throws XmlException
  {
    if (io == null)
      throw new XmlException();
    XmlReader reader = new XmlReader(io, "org.bifrost.xmlio.config");
    XmlIOConfig conf = (XmlIOConfig)reader.getRootObject();
    copyFrom(conf);
  } // end load()
View Full Code Here

TOP

Related Classes of org.bifrost.xmlio.XmlReader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.