Package org.dozer.vo.deep

Examples of org.dozer.vo.deep.SrcDeepObj


    return obj;
  }

  public SrcDeepObj getSrcDeepObj() {
    SrcDeepObj result = newInstance(SrcDeepObj.class);
    SrcNestedDeepObj srcNested = newInstance(SrcNestedDeepObj.class);
    SrcNestedDeepObj2 srcNested2 = newInstance(SrcNestedDeepObj2.class);
    FurtherTestObjectPrime furtherObjectPrime = newInstance(FurtherTestObjectPrime.class);

    srcNested2.setSrc5("nestedsrc2field5");
    furtherObjectPrime.setOne("fjd");

    srcNested.setSrc1("nestedsrc1");
    srcNested.setSrc2(Integer.valueOf("5"));
    srcNested.setSrc3(90);
    srcNested.setSrc4(new String[] { "item1", "item2", "item3" });
    srcNested.setSrcNestedObj2(srcNested2);
    srcNested.setSrc6(furtherObjectPrime);

    // List to List. String to Integer
    List<String> hintList = newInstance(ArrayList.class);
    hintList.add("1");
    hintList.add("2");
    srcNested.setHintList(hintList);

    // List to List. TheFirstSubClass to TheFirstSubClassPrime
    TheFirstSubClass hintList2Obj = newInstance(TheFirstSubClass.class);
    hintList2Obj.setS("test");

    TheFirstSubClass hintList2Obj2 = newInstance(TheFirstSubClass.class);
    hintList2Obj.setS("test2");

    List<TheFirstSubClass> hintList2 = newInstance(ArrayList.class);
    hintList2.add(hintList2Obj);
    hintList2.add(hintList2Obj2);
    srcNested.setHintList2(hintList2);

    result.setSrcNestedObj(srcNested);
    result.setSameNameField("sameNameField");

    return result;
  }
View Full Code Here


  }

  @Test(timeout = 13000)
  public void testMapping5() throws Exception {
    // SrcDeepObj --> DestDeepObj (Field Deep)
    SrcDeepObj src = testDataFactory.getSrcDeepObj();
    runGeneric("testMapping5", src, DestDeepObj.class);
  }
View Full Code Here

public class DeepMappingTest extends AbstractFunctionalTest {

  @Test
  public void testDeepMapping() throws Exception {
    mapper = getMapper(new String[] { "dozerBeanMapping.xml" });
    SrcDeepObj src = testDataFactory.getSrcDeepObj();
    DestDeepObj dest = mapper.map(src, DestDeepObj.class);
    SrcDeepObj src2 = mapper.map(dest, SrcDeepObj.class);
    DestDeepObj dest2 = mapper.map(src2, DestDeepObj.class);

    assertEquals(src, src2);
    assertEquals(dest, dest2);
  }
View Full Code Here

    TestObject testObject1 = newInstance(TestObject.class);
    TestObject testObject2 = newInstance(TestObject.class);
    testObject2.setEqualNamedList(Arrays.asList(new AnotherTestObject[] { anotherTestObject }));

    SrcDeepObj src = newInstance(SrcDeepObj.class);
    src.setSomeList(Arrays.asList(new TestObject[] { testObject1, testObject2 }));
    src.setSrcNestedObj(srcNestedObj);

    DestDeepObj dest = mapper.map(src, DestDeepObj.class);
    assertEquals(Integer.valueOf("985756"), dest.getDest2());
    assertEquals("another test object field 3 value", dest.getDest5());
    assertEquals(Integer.valueOf("6453"), ((TestObjectPrime) dest.getHintList().get(0)).getTwoPrime());
View Full Code Here

  public void testDeepMappingWithIndexOnDestField() {
    DestDeepObj src = newInstance(DestDeepObj.class);
    src.setDest2(new Integer(857557));
    src.setDest5("789777");

    SrcDeepObj dest = mapper.map(src, SrcDeepObj.class);
    assertEquals("857557", dest.getSrcNestedObj().getSrcNestedObj2().getSimpleObjects()[0].getField1());
    TestObject destTestObj = (TestObject) dest.getSomeList().get(1);
    assertEquals("789777", ((AnotherTestObject) destTestObj.getEqualNamedList().get(0)).getField3());
  }
View Full Code Here

    TestObject testObject1 = newInstance(TestObject.class);
    TestObject testObject2 = newInstance(TestObject.class);
    testObject2.setEqualNamedList(Arrays.asList(new AnotherTestObject[] { anotherTestObject }));

    SrcDeepObj src = newInstance(SrcDeepObj.class);
    src.setSomeList(Arrays.asList(new TestObject[] { testObject1, testObject2 }));
    src.setSrcNestedObj(srcNestedObj);

    DestDeepObj dest = mapper.map(src, DestDeepObj.class);
    assertEquals(Integer.valueOf("985756"), dest.getDest2());
    assertEquals("another test object field 3 value", dest.getDest5());
    assertEquals(Integer.valueOf("6453"), ((TestObjectPrime) dest.getHintList().get(0)).getTwoPrime());
View Full Code Here

  public void testDeepMappingWithIndexOnDestField() {
    DestDeepObj src = newInstance(DestDeepObj.class);
    src.setDest2(new Integer(857557));
    src.setDest5("789777");

    SrcDeepObj dest = mapper.map(src, SrcDeepObj.class);
    assertEquals("857557", dest.getSrcNestedObj().getSrcNestedObj2().getSimpleObjects()[0].getField1());
    TestObject destTestObj = (TestObject) dest.getSomeList().get(1);
    assertEquals("789777", ((AnotherTestObject) destTestObj.getEqualNamedList().get(0)).getField3());
  }
View Full Code Here

public class DeepMappingTest extends AbstractFunctionalTest {

  @Test
  public void testDeepMapping() throws Exception {
    mapper = getMapper(new String[] { "dozerBeanMapping.xml" });
    SrcDeepObj src = testDataFactory.getSrcDeepObj();
    DestDeepObj dest = mapper.map(src, DestDeepObj.class);
    SrcDeepObj src2 = mapper.map(dest, SrcDeepObj.class);
    DestDeepObj dest2 = mapper.map(src2, DestDeepObj.class);

    assertEquals(src, src2);
    assertEquals(dest, dest2);
  }
View Full Code Here

  }

  @Test(timeout = 13000)
  public void testMapping5() throws Exception {
    // SrcDeepObj --> DestDeepObj (Field Deep)
    SrcDeepObj src = testDataFactory.getSrcDeepObj();
    runGeneric("testMapping5", src, DestDeepObj.class);
  }
View Full Code Here

    return obj;
  }

  public SrcDeepObj getSrcDeepObj() {
    SrcDeepObj result = newInstance(SrcDeepObj.class);
    SrcNestedDeepObj srcNested = newInstance(SrcNestedDeepObj.class);
    SrcNestedDeepObj2 srcNested2 = newInstance(SrcNestedDeepObj2.class);
    FurtherTestObjectPrime furtherObjectPrime = newInstance(FurtherTestObjectPrime.class);

    srcNested2.setSrc5("nestedsrc2field5");
    furtherObjectPrime.setOne("fjd");

    srcNested.setSrc1("nestedsrc1");
    srcNested.setSrc2(Integer.valueOf("5"));
    srcNested.setSrc3(90);
    srcNested.setSrc4(new String[] { "item1", "item2", "item3" });
    srcNested.setSrcNestedObj2(srcNested2);
    srcNested.setSrc6(furtherObjectPrime);

    // List to List. String to Integer
    List<String> hintList = newInstance(ArrayList.class);
    hintList.add("1");
    hintList.add("2");
    srcNested.setHintList(hintList);

    // List to List. TheFirstSubClass to TheFirstSubClassPrime
    TheFirstSubClass hintList2Obj = newInstance(TheFirstSubClass.class);
    hintList2Obj.setS("test");

    TheFirstSubClass hintList2Obj2 = newInstance(TheFirstSubClass.class);
    hintList2Obj.setS("test2");

    List<TheFirstSubClass> hintList2 = newInstance(ArrayList.class);
    hintList2.add(hintList2Obj);
    hintList2.add(hintList2Obj2);
    srcNested.setHintList2(hintList2);

    result.setSrcNestedObj(srcNested);
    result.setSameNameField("sameNameField");

    return result;
  }
View Full Code Here

TOP

Related Classes of org.dozer.vo.deep.SrcDeepObj

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.