Package org.springframework.batch.item.file.transform

Examples of org.springframework.batch.item.file.transform.FieldSet


  }
 
  @Test
  public void testCustomerAdd() throws Exception{
    String customerAddLine = "AFDASFDASFDFSA";
    FieldSet fs = compositeTokenizer.tokenize(customerAddLine);
    assertEquals(customerFieldSet, fs);
    assertEquals(customerAddLine, customerTokenizer.getTokenizedLine());
  }
View Full Code Here


  }
 
  @Test
  public void testCustomerDelete() throws Exception{
    String customerAddLine = "DFDASFDASFDFSA";
    FieldSet fs = compositeTokenizer.tokenize(customerAddLine);
    assertEquals(customerFieldSet, fs);
    assertEquals(customerAddLine, customerTokenizer.getTokenizedLine());
  }
View Full Code Here

  }
 
  @Test
  public void testCustomerUpdate() throws Exception{
    String customerAddLine = "UFDASFDASFDFSA";
    FieldSet fs = compositeTokenizer.tokenize(customerAddLine);
    assertEquals(customerFieldSet, fs);
    assertEquals(customerAddLine, customerTokenizer.getTokenizedLine());
  }
View Full Code Here

    });
    reader.setLineMapper(lineMapper);
    reader.open(new ExecutionContext());

    List<FieldSet> list = new ArrayList<FieldSet>();
    FieldSet item = reader.read();
    while (item!=null) {
      list.add(item);
      item = reader.read();
    }
    assertEquals(7, list.size());
View Full Code Here

  public void testVanillaBeanCreatedFromType() throws Exception {
    BeanWrapperFieldSetMapper<TestObject> mapper = new BeanWrapperFieldSetMapper<TestObject>();
    mapper.setTargetType(TestObject.class);
    mapper.afterPropertiesSet();

    FieldSet fieldSet = new DefaultFieldSet(new String[] { "This is some dummy string", "true", "C" },
        new String[] { "varString", "varBoolean", "varChar" });
    TestObject result = mapper.mapFieldSet(fieldSet);
    assertEquals("This is some dummy string", result.getVarString());
    assertEquals(true, result.isVarBoolean());
    assertEquals('C', result.getVarChar());
View Full Code Here

  public void testNullPropertyAutoCreated() throws Exception {
    BeanWrapperFieldSetMapper<TestNestedA> mapper = new BeanWrapperFieldSetMapper<TestNestedA>();
    mapper.setTargetType(TestNestedA.class);
    mapper.afterPropertiesSet();

    FieldSet fieldSet = new DefaultFieldSet(new String[] { "Foo", "Bar" }, new String[] { "valueA",
        "testObjectB.valueA" });
    TestNestedA result = mapper.mapFieldSet(fieldSet);
    assertEquals("Bar", result.getTestObjectB().getValueA());
  }
View Full Code Here

    StaticApplicationContext context = new StaticApplicationContext();
    mapper.setBeanFactory(context);
    context.getBeanFactory().registerSingleton("bean", new TestObject());
    mapper.setPrototypeBeanName("bean");

    FieldSet fieldSet = new DefaultFieldSet(new String[] { "This is some dummy string", "true", "C" },
        new String[] { "varString", "varBoolean", "varChar" });
    TestObject result = mapper.mapFieldSet(fieldSet);
    assertEquals("This is some dummy string", result.getVarString());
    assertEquals(true, result.isVarBoolean());
    assertEquals('C', result.getVarChar());
View Full Code Here

    mapper.setBeanFactory(context);
    mapper.setDistanceLimit(2);
    context.getBeanFactory().registerSingleton("bean", new TestObject());
    mapper.setPrototypeBeanName("bean");

    FieldSet fieldSet = new DefaultFieldSet(new String[] { "This is some dummy string", "true", "C" },
        new String[] { "VarString", "VAR_BOOLEAN", "VAR_CHAR" });
    TestObject result = mapper.mapFieldSet(fieldSet);
    assertEquals("This is some dummy string", result.getVarString());
    assertEquals(true, result.isVarBoolean());
    assertEquals('C', result.getVarChar());
View Full Code Here

    ApplicationContext context = new ClassPathXmlApplicationContext("bean-wrapper.xml", getClass());

    BeanWrapperFieldSetMapper<TestObject> mapper = (BeanWrapperFieldSetMapper<TestObject>) context
        .getBean("fieldSetMapper");

    FieldSet fieldSet = new DefaultFieldSet(new String[] { "This is some dummy string", "true", "C" },
        new String[] { "varString", "varBoolean", "varChar" });
    TestObject result = mapper.mapFieldSet(fieldSet);
    assertEquals("This is some dummy string", result.getVarString());
    assertEquals(true, result.isVarBoolean());
    assertEquals('C', result.getVarChar());
View Full Code Here

    StaticApplicationContext context = new StaticApplicationContext();
    mapper.setBeanFactory(context);
    context.getBeanFactory().registerSingleton("bean", testNestedA);
    mapper.setPrototypeBeanName("bean");

    FieldSet fieldSet = new DefaultFieldSet(
        new String[] { "This is some dummy string", "1", "Another dummy", "2" }, new String[] { "valueA",
            "valueB", "testObjectB.valueA", "testObjectB.testObjectC.value" });

    TestNestedA result = mapper.mapFieldSet(fieldSet);
View Full Code Here

TOP

Related Classes of org.springframework.batch.item.file.transform.FieldSet

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.