Package ma.glasnost.orika.test.community.issue25

Examples of ma.glasnost.orika.test.community.issue25.AddressMergingMapper


    @Before
    public void setUp() throws Exception {
      System.setProperty(OrikaSystemProperties.COMPILER_STRATEGY,EclipseJdtCompilerStrategy.class.getName());
       
        mapper = new CustomOrikaMapper();
    }
View Full Code Here


        List<Address> anschriftenGUI = manufacturingFacilityToEdit.getAddresses();
        anschriftenGUI.remove(1);

        manufacturingFacilityToEdit.setDescription("Description after merge.");
       
        Address firstAdr = anschriftenGUI.get(0);
        firstAdr.setStreet("Street new");
       
        // merge
        ManufacturingFacilityDTS prototype = manufacturingFacilityToEdit.returnPrototype();
        mapper.map(manufacturingFacilityToEdit, prototype);
       
View Full Code Here

                            String comment,
                            Character land){
      ManufacturingFacility manufacturingFacility = (ManufacturingFacility)betriebsstaetteMap.get(MANUFACTURINGFACILITY_KEY);
      ManufacturingFacilityDTS manufacturingFacilityDTS = (ManufacturingFacilityDTS)betriebsstaetteMap.get(MANUFACTURINGFACILITYDTS_KEY);
        
        Address vAnschrift = new Address();
        vAnschrift.setIdNumber(idNumber);
        vAnschrift.setStreet(street);
        vAnschrift.setPostalcode(postalcode);

        if(manufacturingFacility.getAddresses()==null)
            manufacturingFacility.setAddresses(new ArrayList<Address>());
        List<Address> anschriften = manufacturingFacility.getAddresses();
        anschriften.add(vAnschrift);
View Full Code Here

    @Test
    public void testMapManufacuringFacilityToDTS() {
        Map<String, Object> betriebsstaetteMap =
            getManufacturingFacility(1L,"First");
       
        ManufacturingFacility manufacturingFacility = (ManufacturingFacility)betriebsstaetteMap.get(BaseManufacturingFacilityTest.MANUFACTURINGFACILITY_KEY);
        ManufacturingFacilityDTS manufacturingFacilityDTS = (ManufacturingFacilityDTS)betriebsstaetteMap.get(BaseManufacturingFacilityTest.MANUFACTURINGFACILITYDTS_KEY);
       
        addAddressToManufacturingFacility(betriebsstaetteMap, 1L, "Beispielstra�e 2", 815L, "This is a comment.", 'D');

        ManufacturingFacilityDTS betriebsstaetteDTSMapped = mapper.map(manufacturingFacility, ManufacturingFacilityDTS.class);
        ManufacturingFacility betriebsstaetteMappedBack = mapper.map(betriebsstaetteDTSMapped, ManufacturingFacility.class);
        assertTrue(manufacturingFacility.equals(betriebsstaetteMappedBack));
    }
View Full Code Here

    @Test
    public void testMapManufacuringFacilityToDTSNullValues() {
        Map<String, Object> betriebsstaetteMap =
                getManufacturingFacility(2L,"Second");
       
        ManufacturingFacility manufacturingFacility = (ManufacturingFacility)betriebsstaetteMap.get(BaseManufacturingFacilityTest.MANUFACTURINGFACILITY_KEY);
        ManufacturingFacilityDTS manufacturingFacilityDTS = (ManufacturingFacilityDTS)betriebsstaetteMap.get(BaseManufacturingFacilityTest.MANUFACTURINGFACILITYDTS_KEY);
       
        addAddressToManufacturingFacility(betriebsstaetteMap, 1L, null, 815L, "This is a comment.", 'D');

        ManufacturingFacilityDTS betriebsstaetteDTSMapped = mapper.map(manufacturingFacility, ManufacturingFacilityDTS.class);
        ManufacturingFacility betriebsstaetteMappedBack = mapper.map(betriebsstaetteDTSMapped, ManufacturingFacility.class);
        assertTrue(manufacturingFacility.equals(betriebsstaetteMappedBack));
    }
View Full Code Here

    @Test
    public void testMapManufacuringFacilityToDTSMultipleAdr() {
        Map<String, Object> betriebsstaetteMap =
                getManufacturingFacility(3L,"First");
       
        ManufacturingFacility manufacturingFacility = (ManufacturingFacility)betriebsstaetteMap.get(BaseManufacturingFacilityTest.MANUFACTURINGFACILITY_KEY);
        ManufacturingFacilityDTS manufacturingFacilityDTS = (ManufacturingFacilityDTS)betriebsstaetteMap.get(BaseManufacturingFacilityTest.MANUFACTURINGFACILITYDTS_KEY);
       
        addAddressToManufacturingFacility(betriebsstaetteMap, 10L, "StreetA", 815L, "This is a comment. 10", 'D');
        addAddressToManufacturingFacility(betriebsstaetteMap, 11L, "StreetB", 816L, "This is a comment. 11", 'E');
        addAddressToManufacturingFacility(betriebsstaetteMap, 12L, "StreetC", 817L, "This is a comment. 12", 'F');

        ManufacturingFacilityDTS betriebsstaetteDTSMapped = mapper.map(manufacturingFacility, ManufacturingFacilityDTS.class);
        ManufacturingFacility betriebsstaetteMappedBack = mapper.map(betriebsstaetteDTSMapped, ManufacturingFacility.class);
        assertTrue(manufacturingFacility.equals(betriebsstaetteMappedBack));
    }
View Full Code Here

    @Test
    public void testMapManufacuringFacilityToDTSMerge() {
        Map<String, Object> betriebsstaetteMap =
            getManufacturingFacility(4L,"Manufacturing Facility Description.");
       
        ManufacturingFacility manufacturingFacility = (ManufacturingFacility)betriebsstaetteMap.get(BaseManufacturingFacilityTest.MANUFACTURINGFACILITY_KEY);
        ManufacturingFacilityDTS manufacturingFacilityDTS = (ManufacturingFacilityDTS)betriebsstaetteMap.get(BaseManufacturingFacilityTest.MANUFACTURINGFACILITYDTS_KEY);
       
        addAddressToManufacturingFacility(betriebsstaetteMap, 10L, "StreetA", 815L, "This is a comment. 10", 'D');
        addAddressToManufacturingFacility(betriebsstaetteMap, 11L, "StreetB", 816L, "This is a comment. 11", 'E');
        addAddressToManufacturingFacility(betriebsstaetteMap, 12L, "StreetC", 817L, "This is a comment. 12", 'F');

        // Edit some values on "orginal" bean.
        // This is because we want to see if values are kept which are not mapped.
       
        // With the AddressMergingMapper this variable does not contain any addresses after merge.
        // The entity mapped from contains 3 addresses.
        // Without the AddressMergingMapper there are contained 3 adresses.
        // But then the check for the land value fails.
        ManufacturingFacilityDTS manufacturingFacilityDTSServer = mapper.map(manufacturingFacility, ManufacturingFacilityDTS.class);
        manufacturingFacilityDTSServer.setIdNumber(4L);
        Character vLand = 'D';
        for(AddressDTO currAnschrift: manufacturingFacilityDTSServer.getAddressL()){
            currAnschrift.setLand(vLand);
        }

        ManufacturingFacility manufacturingFacilityToEdit = mapper.map(manufacturingFacilityDTSServer,ManufacturingFacility.class);
        manufacturingFacilityToEdit.putPrototype(manufacturingFacilityDTSServer);
       
        // Now the bean will be edited to see if the mapped values are correctly merged.
        List<Address> anschriftenGUI = manufacturingFacilityToEdit.getAddresses();
        anschriftenGUI.remove(1);

        manufacturingFacilityToEdit.setDescription("Description after merge.");
       
        Address firstAdr = anschriftenGUI.get(0);
        firstAdr.setStreet("Street new");
       
        // merge
        ManufacturingFacilityDTS prototype = manufacturingFacilityToEdit.returnPrototype();
        mapper.map(manufacturingFacilityToEdit, prototype);
       
        // Do some checks.
        assertTrue("IdNumber was not kept after merge.",
              4L == prototype.getIdNumber());
View Full Code Here

    }
   
    public Map<String, Object> getManufacturingFacility(Long aIdNumber, String aDescription){
        Map<String, Object> vReturnMap = new HashMap<String, Object>();
       
        ManufacturingFacility vManufacturingFacility = new ManufacturingFacility();
        vManufacturingFacility.setDescription(aDescription);
        vReturnMap.put(MANUFACTURINGFACILITY_KEY, vManufacturingFacility);
       
        ManufacturingFacilityDTS vBetriebsstaetteDTS = new ManufacturingFacilityDTS();
        vBetriebsstaetteDTS.setDescription(aDescription);
        vBetriebsstaetteDTS.setIdNumber(aIdNumber);
View Full Code Here

                            Long idNumber,
                            String street,
                            Long postalcode,
                            String comment,
                            Character land){
      ManufacturingFacility manufacturingFacility = (ManufacturingFacility)betriebsstaetteMap.get(MANUFACTURINGFACILITY_KEY);
      ManufacturingFacilityDTS manufacturingFacilityDTS = (ManufacturingFacilityDTS)betriebsstaetteMap.get(MANUFACTURINGFACILITYDTS_KEY);
        
        Address vAnschrift = new Address();
        vAnschrift.setIdNumber(idNumber);
        vAnschrift.setStreet(street);
        vAnschrift.setPostalcode(postalcode);

        if(manufacturingFacility.getAddresses()==null)
            manufacturingFacility.setAddresses(new ArrayList<Address>());
        List<Address> anschriften = manufacturingFacility.getAddresses();
        anschriften.add(vAnschrift);


        AddressDTO vAnschriftDTO = new AddressDTO();
        vAnschriftDTO.setComment(comment);
View Full Code Here

        assertTrue("An address was removed. In the merged DS this address does still exist.",
                   addressesFromPrototype.size() == 2);
       
        // land check
        List<AddressDTO> addressesAfterMerge = prototype.getAddressL();
        AddressDTO addressOne = addressesAfterMerge.get(0);
        AddressDTO addressTwo = addressesAfterMerge.get(1);

        assertTrue("Land after merge is wrong.", Character.valueOf('D').equals(addressOne.getLand()));
        assertTrue("Land after merge is wrong.", Character.valueOf('D').equals(addressTwo.getLand()));
    }
View Full Code Here

TOP

Related Classes of ma.glasnost.orika.test.community.issue25.AddressMergingMapper

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.