Package org.jboss.test.xml.book

Examples of org.jboss.test.xml.book.Book


      assertTrue(o instanceof List);
      List list = (List)o;
      assertEquals(1, list.size());
      o = list.get(0);
      assertTrue(o instanceof Book);
      Book book = (Book)o;
      assertEquals("123", book.getIsbn());
      assertEquals("Ti t le", book.getTitle());
      assertEquals("A.U.Thor", book.getAuthor());
   }
View Full Code Here


      assertEquals("A.U.Thor", book.getAuthor());
   }

   public void testMarshallingXerces() throws Exception
   {
      Book book = new Book();
      book.setIsbn("123");
      book.setTitle("Ti t le");
      book.setAuthor("A.U.Thor");

      String marshalled = marshalXerces(book);

      assertXmlEqual(XML, marshalled);
   }
View Full Code Here

      assertXmlEqual(XML, marshalled);
   }

   public void testMarshallingSunday() throws Exception
   {
      Book book = new Book();
      book.setIsbn("123");
      book.setTitle("Ti t le");
      book.setAuthor("A.U.Thor");

      String marshalled = marshalSunday(book);

      assertXmlEqual(XML, marshalled);
   }
View Full Code Here

   public void testMarshallBookDtd() throws Exception
   {
      log.debug("--- " + getName());

      // obtain an instance of Book to marshal
      Book book = createBook();

      // get the output writter to write the XML content
      StringWriter xmlOutput = new StringWriter();

      // get the DTD source
View Full Code Here

   public void testMarshallBookDtdGeneric() throws Exception
   {
      log.debug("--- " + getName());

      // obtain an instance of Book to marshal
      Book book = createBook();

      // get the output writter to write the XML content
      StringWriter xmlOutput = new StringWriter();

      // get the DTD source
View Full Code Here

   private void marshallingTest()
      throws Exception
   {
      // obtain an instance of Book to marshal
      Book book = createBook();

      // get the output writter to write the XML content
      StringWriter xmlOutput = new StringWriter();

      // create an instance of XML Schema marshaller
View Full Code Here

      // create unmarshaller
      Unmarshaller unmarshaller = getBookUnmarshaller();

      // let the object model factory to create an instance of Book and populate it with data from XML
      Book book = (Book)unmarshaller.unmarshal(xmlUrl.openStream(), factory, null);

      checkUnmarshalledBook(book);

      log.debug("</test-unmarshal-" + xmlSource + '>');
   }
View Full Code Here

   }

   private void checkMarshalledBook(String content, Book book)
      throws Exception
   {
      Book unmarshalled = new Book();
      ObjectModelFactory factory = new BookObjectFactory();

      Unmarshaller unmarshaller = getBookUnmarshaller();

      StringReader strReader = new StringReader(content);
View Full Code Here

      return unmarshaller;
   }

   private static Book createBook()
   {
      Book book = new Book();
      book.setIsbn("0836217462");
      book.setTitle("Being a Dog Is a Full-Time Job");
      book.setAuthor("Charles M. Schulz");

      BookCharacter character = new BookCharacter();
      character.setName("Snoopy");
      character.setFriendOf("Peppermint Patty");
      character.setSince("1950-10-04");
      character.setQualification("extroverted beagle");
      book.addCharacter(character);

      character = new BookCharacter();
      character.setName("Peppermint Patty");
      character.setSince("1966-08-22");
      character.setQualification("bold, brash and tomboyish");
      book.addCharacter(character);

      return book;
   }
View Full Code Here

   {
      String url = getPath("xml/book/annotated_books.xsd");
      SchemaBinding schemaBinding = XsdBinder.bind(url);

      Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
      Book book = (Book)unmarshaller.unmarshal(getPath("xml/book/book-xs.xml"), schemaBinding);
      assertEquals(Book.getInstance(), book);
   }
View Full Code Here

TOP

Related Classes of org.jboss.test.xml.book.Book

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.