Package org.springframework.batch.item.xml.domain

Examples of org.springframework.batch.item.xml.domain.Trade


  @Test
  public void testRead() throws Exception {
    reader.setResource(new ClassPathResource(ClassUtils.addResourcePathToPackagePath(getClass(), "input.xml")));
    reader.open(new ExecutionContext());
    Trade result;
    List<Trade> results = new ArrayList<Trade>();
    while ((result = reader.read()) != null) {
      results.add(result);
    }
    checkResults(results);
View Full Code Here


  @Test
  public void testReadNested() throws Exception {
    reader.setResource(new ClassPathResource(ClassUtils
        .addResourcePathToPackagePath(getClass(), "input-nested.xml")));
    reader.open(new ExecutionContext());
    Trade result;
    List<Trade> results = new ArrayList<Trade>();
    while ((result = reader.read()) != null) {
      results.add(result);
    }
    checkResults(results);
View Full Code Here

   * @param results list of domain objects returned by input source
   */
  protected void checkResults(List<Trade> results) {
    assertEquals(3, results.size());

    Trade trade1 = results.get(0);
    assertEquals("XYZ0001", trade1.getIsin());
    assertEquals(5, trade1.getQuantity());
    assertEquals(new BigDecimal("11.39"), trade1.getPrice());
    assertEquals("Customer1", trade1.getCustomer());

    Trade trade2 = results.get(1);
    assertEquals("XYZ0002", trade2.getIsin());
    assertEquals(2, trade2.getQuantity());
    assertEquals(new BigDecimal("72.99"), trade2.getPrice());
    assertEquals("Customer2", trade2.getCustomer());

    Trade trade3 = results.get(2);
    assertEquals("XYZ0003", trade3.getIsin());
    assertEquals(9, trade3.getQuantity());
    assertEquals(new BigDecimal("99.99"), trade3.getPrice());
    assertEquals("Customer3", trade3.getCustomer());
  }
View Full Code Here

    Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
    marshaller.setClassesToBeBound(new Class<?>[] { Trade.class });
    marshaller.afterPropertiesSet();
   
    StringWriter string = new StringWriter();
    marshaller.marshal(new Trade("FOO", 100, BigDecimal.valueOf(10.), "bar"), new StreamResult(string));
    String content = string.toString();
    assertTrue("Wrong content: "+content, content.contains("<customer>bar</customer>"));
    return marshaller;
  }
View Full Code Here

TOP

Related Classes of org.springframework.batch.item.xml.domain.Trade

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.