Examples of MappingFileData


Examples of org.dozer.classmap.MappingFileData

      log.info("Using the following xml files to load custom mappings for the bean mapper instance: {}", mappingFiles);
      for (String mappingFileName : mappingFiles) {
        log.info("Trying to find xml mapping file: {}", mappingFileName);
        URL url = MappingValidator.validateURL(mappingFileName);
        log.info("Using URL [" + url + "] to load custom xml mappings");
        MappingFileData mappingFileData = mappingFileReader.read(url);
        log.info("Successfully loaded custom xml mappings from URL: [{}]", url);

        mappingFileDataList.add(mappingFileData);
      }
    }
View Full Code Here

Examples of org.dozer.classmap.MappingFileData

    }
  }

  public void addMapping(BeanMappingBuilder mappingBuilder) {
    checkIfInitialized();
    MappingFileData mappingFileData = mappingBuilder.build();
    builderMappings.add(mappingFileData);
  }
View Full Code Here

Examples of org.dozer.classmap.MappingFileData

    URL url = classLoader.loadResource(fileName);
    return read(url);
  }

  public MappingFileData read(URL url) {
    MappingFileData result = null;
    InputStream stream = null;
    try {
      stream = url.openStream();
      Document document = documentBuilder.parse(stream);
     
View Full Code Here

Examples of org.dozer.classmap.MappingFileData

  }

  @Test
  public void testOverridenFields() throws Exception {
    MappingFileReader fileReader = new MappingFileReader(XMLParserFactory.getInstance());
    MappingFileData mappingFileData = fileReader.read("overridemapping.xml");
    MappingsParser mappingsParser = MappingsParser.getInstance();
    mappingsParser.processMappings(mappingFileData.getClassMaps(), mappingFileData.getConfiguration());
    // validate class mappings
    for (ClassMap classMap : mappingFileData.getClassMaps()) {
      if (classMap.getSrcClassToMap().getName().equals("org.dozer.util.mapping.vo.FurtherTestObject")) {
        assertTrue(classMap.isStopOnErrors());
      }
      if (classMap.getSrcClassToMap().getName().equals("org.dozer.util.mapping.vo.SuperSuperSuperClass")) {
        assertTrue(classMap.isWildcard());
View Full Code Here

Examples of org.dozer.classmap.MappingFileData

  }

  @Test(expected=IllegalArgumentException.class)
  public void testDuplicateMapIds() throws Exception {
    MappingFileReader fileReader = new MappingFileReader(XMLParserFactory.getInstance());
    MappingFileData mappingFileData = fileReader.read("duplicateMapIdsMapping.xml");

    parser.processMappings(mappingFileData.getClassMaps(), new Configuration());
    fail("should have thrown exception");
  }
View Full Code Here

Examples of org.dozer.classmap.MappingFileData

  }

  @Test(expected=IllegalArgumentException.class)
  public void testDetectDuplicateMapping() throws Exception {
    MappingFileReader fileReader = new MappingFileReader(XMLParserFactory.getInstance());
    MappingFileData mappingFileData = fileReader.read("duplicateMapping.xml");
    parser.processMappings(mappingFileData.getClassMaps(), new Configuration());
    fail("should have thrown exception");
  }
View Full Code Here

Examples of org.dozer.classmap.MappingFileData

    fail("should have thrown exception");
  }

  @Test
  public void testEmptyMappings() throws Exception {
    MappingFileData mappingFileData = new MappingFileData();
    ClassMappings result = parser.processMappings(mappingFileData.getClassMaps(), new Configuration());
    assertNotNull("result should not be null", result);
    assertEquals("result should be empty", 0, result.size());
  }
View Full Code Here

Examples of org.dozer.classmap.MappingFileData

public class MappingsBuilderTest extends AbstractDozerTest{

  @Test
  public void testBuild() {
    DozerBuilder builder = new DozerBuilder();
    MappingFileData result = builder.build();
    assertNotNull(result);
  }
View Full Code Here

Examples of org.dozer.classmap.MappingFileData

            return Collections.emptyList();
        }

        for (String name : mappingFiles) {
            URL url = camelContext.getClassResolver().loadResourceAsURL(name);
            MappingFileData data = reader.read(url);
            answer.addAll(data.getClassMaps());
        }

        return answer;
    }
View Full Code Here

Examples of org.dozer.classmap.MappingFileData

                    + ". Mapping has not been registered!");
            return;
        }

        mapper.addMapping(beanMappingBuilder);
        MappingFileData mappingFileData = beanMappingBuilder.build();
        TypeConverterRegistry registry = camelContext.getTypeConverterRegistry();
        ArrayList<ClassMap> classMaps = new ArrayList<ClassMap>();
        classMaps.addAll(mappingFileData.getClassMaps());
        registerClassMaps(registry, mapper, classMaps);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.