Package org.dozer.classmap

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


    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

public class MappingsBuilderTest extends AbstractDozerTest{

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

    this.documentBuilder = parserFactory.createParser();
    this.parser = new XMLParser();
  }

  public MappingFileData read(InputStream xmlStream) {
    MappingFileData result = null;
    try {
      Document document = documentBuilder.parse(xmlStream);
      result = parser.read(document);
    } catch (Throwable e) {
      log.error("Error while loading dozer mapping InputStream: ["
View Full Code Here

      fail("should have thrown exception");
  }

  private MappingFileData createMappingData(boolean hasConfiguration) {
    MappingFileData mappingFileData = new MappingFileData();
    if (hasConfiguration) {
      mappingFileData.setConfiguration(new Configuration());
    }
    mappingFileData.addClassMap(mock(ClassMap.class));
    return mappingFileData;
  }
View Full Code Here

      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

   * @param xmlStream Dozer mapping XML InputStream
   */
  public void addMapping(InputStream xmlStream) {
    checkIfInitialized();
    MappingStreamReader fileReader = new MappingStreamReader(XMLParserFactory.getInstance());
    MappingFileData mappingFileData = fileReader.read(xmlStream);
    builderMappings.add(mappingFileData);
  }
View Full Code Here

   *
   * @param mappingBuilder mappings to be added
   */
  public void addMapping(BeanMappingBuilder mappingBuilder) {
    checkIfInitialized();
    MappingFileData mappingFileData = mappingBuilder.build();
    builderMappings.add(mappingFileData);
  }
View Full Code Here

    URL url = loader.getResource("dozerBeanMapping.xml");

    Document document = XMLParserFactory.getInstance().createParser().parse(url.openStream());
    parser = new XMLParser();

    MappingFileData mappings = parser.read(document);
    assertNotNull(mappings);
  }
View Full Code Here

    URL url = loader.getResource("fieldCustomConverterParam.xml");

    Document document = XMLParserFactory.getInstance().createParser().parse(url.openStream());
    parser = new XMLParser();
   
    MappingFileData mappings = parser.read(document);

    assertNotNull("The mappings should not be null", mappings);

    List<ClassMap> mapping = mappings.getClassMaps();

    assertNotNull("The list of mappings should not be null", mapping);

    assertEquals("There should be one mapping", 3, mapping.size());
View Full Code Here

TOP

Related Classes of org.dozer.classmap.MappingFileData

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.