Search in sources :

Example 1 with StructuredAddressTypeEnum

use of eu.europa.ec.fisheries.ers.fa.utils.StructuredAddressTypeEnum in project UVMS-ActivityModule-APP by UnionVMS.

the class StructuredAddressMapperTest method testStructuredAddressDetailsDTOListMapper.

@Test
public void testStructuredAddressDetailsDTOListMapper() {
    StructuredAddress structuredAddress = MapperUtil.getStructuredAddress();
    StructuredAddressEntity structuredAddressEntity = new StructuredAddressEntity();
    StructuredAddressTypeEnum structuredAddressTypeEnum = StructuredAddressTypeEnum.FLUX_PHYSICAL;
    FluxLocationEntity fluxLocationEntity = null;
    StructuredAddressMapper.INSTANCE.mapToStructuredAddress(structuredAddress, structuredAddressTypeEnum, fluxLocationEntity, structuredAddressEntity);
    List<AddressDetailsDTO> addressDetailsDTO = new ArrayList<>(StructuredAddressMapper.INSTANCE.mapToAddressDetailsDTOList(new HashSet<>(Arrays.asList(structuredAddressEntity))));
    assertEquals(structuredAddressEntity.getAddressId(), addressDetailsDTO.get(0).getAddressId());
    assertEquals(structuredAddressEntity.getBlockName(), addressDetailsDTO.get(0).getBlockName());
    assertEquals(structuredAddressEntity.getBuildingName(), addressDetailsDTO.get(0).getBuildingName());
    assertEquals(structuredAddressEntity.getCityName(), addressDetailsDTO.get(0).getCityName());
    assertEquals(structuredAddressEntity.getCitySubdivisionName(), addressDetailsDTO.get(0).getCitySubdivisionName());
    assertEquals(structuredAddressEntity.getCountry(), addressDetailsDTO.get(0).getCountry());
    assertEquals(structuredAddressEntity.getCountryName(), addressDetailsDTO.get(0).getCountryName());
    assertEquals(structuredAddressEntity.getCountrySubdivisionName(), addressDetailsDTO.get(0).getCountrySubdivisionName());
    assertEquals(structuredAddressEntity.getPlotId(), addressDetailsDTO.get(0).getPlotId());
    assertEquals(structuredAddressEntity.getPostcode(), addressDetailsDTO.get(0).getPostcode());
    assertEquals(structuredAddressEntity.getPostOfficeBox(), addressDetailsDTO.get(0).getPostOfficeBox());
    assertEquals(structuredAddressEntity.getStreetName(), addressDetailsDTO.get(0).getStreetName());
}
Also used : StructuredAddressTypeEnum(eu.europa.ec.fisheries.ers.fa.utils.StructuredAddressTypeEnum) StructuredAddressEntity(eu.europa.ec.fisheries.ers.fa.entities.StructuredAddressEntity) ArrayList(java.util.ArrayList) AddressDetailsDTO(eu.europa.ec.fisheries.ers.service.dto.fareport.details.AddressDetailsDTO) StructuredAddress(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.StructuredAddress) FluxLocationEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxLocationEntity) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 2 with StructuredAddressTypeEnum

use of eu.europa.ec.fisheries.ers.fa.utils.StructuredAddressTypeEnum in project UVMS-ActivityModule-APP by UnionVMS.

the class StructuredAddressMapperTest method testStructuredAddressForFluxLocation.

@Test
public void testStructuredAddressForFluxLocation() {
    StructuredAddress structuredAddress = MapperUtil.getStructuredAddress();
    StructuredAddressEntity structuredAddressEntity = new StructuredAddressEntity();
    StructuredAddressTypeEnum structuredAddressTypeEnum = StructuredAddressTypeEnum.FLUX_PHYSICAL;
    FluxLocationEntity fluxLocationEntity = null;
    StructuredAddressMapper.INSTANCE.mapToStructuredAddress(structuredAddress, structuredAddressTypeEnum, fluxLocationEntity, structuredAddressEntity);
    assertEquals(structuredAddress.getBlockName().getValue(), structuredAddressEntity.getBlockName());
    assertEquals(structuredAddress.getBuildingName().getValue(), structuredAddressEntity.getBuildingName());
    assertEquals(structuredAddress.getID().getValue(), structuredAddressEntity.getAddressId());
    assertEquals(structuredAddress.getCityName().getValue(), structuredAddressEntity.getCityName());
    assertEquals(structuredAddress.getCitySubDivisionName().getValue(), structuredAddressEntity.getCitySubdivisionName());
    assertEquals(structuredAddress.getCountryID().getValue(), structuredAddressEntity.getCountry());
    assertEquals(structuredAddress.getCountryName().getValue(), structuredAddressEntity.getCountryName());
    assertEquals(structuredAddress.getCountrySubDivisionName().getValue(), structuredAddressEntity.getCountrySubdivisionName());
    assertEquals(structuredAddress.getCountryID().getSchemeID(), structuredAddressEntity.getCountryIdSchemeId());
    assertEquals(structuredAddress.getPlotIdentification().getValue(), structuredAddressEntity.getPlotId());
    assertEquals(structuredAddress.getPostcodeCode().getValue(), structuredAddressEntity.getPostcode());
    assertEquals(structuredAddress.getPostOfficeBox().getValue(), structuredAddressEntity.getPostOfficeBox());
    assertEquals(structuredAddress.getStreetName().getValue(), structuredAddressEntity.getStreetName());
    assertEquals(structuredAddressTypeEnum.getType(), structuredAddressEntity.getStructuredAddressType());
    assertNull(structuredAddressEntity.getFluxLocation());
}
Also used : StructuredAddressTypeEnum(eu.europa.ec.fisheries.ers.fa.utils.StructuredAddressTypeEnum) StructuredAddressEntity(eu.europa.ec.fisheries.ers.fa.entities.StructuredAddressEntity) StructuredAddress(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.StructuredAddress) FluxLocationEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxLocationEntity) Test(org.junit.Test)

Example 3 with StructuredAddressTypeEnum

use of eu.europa.ec.fisheries.ers.fa.utils.StructuredAddressTypeEnum in project UVMS-ActivityModule-APP by UnionVMS.

the class StructuredAddressMapperTest method testStructuredAddressDetailsDTOMapper.

@Test
public void testStructuredAddressDetailsDTOMapper() {
    StructuredAddress structuredAddress = MapperUtil.getStructuredAddress();
    StructuredAddressEntity structuredAddressEntity = new StructuredAddressEntity();
    StructuredAddressTypeEnum structuredAddressTypeEnum = StructuredAddressTypeEnum.FLUX_PHYSICAL;
    FluxLocationEntity fluxLocationEntity = null;
    StructuredAddressMapper.INSTANCE.mapToStructuredAddress(structuredAddress, structuredAddressTypeEnum, fluxLocationEntity, structuredAddressEntity);
    AddressDetailsDTO addressDetailsDTO = StructuredAddressMapper.INSTANCE.mapToAddressDetailsDTO(structuredAddressEntity);
    assertEquals(structuredAddressEntity.getAddressId(), addressDetailsDTO.getAddressId());
    assertEquals(structuredAddressEntity.getBlockName(), addressDetailsDTO.getBlockName());
    assertEquals(structuredAddressEntity.getBuildingName(), addressDetailsDTO.getBuildingName());
    assertEquals(structuredAddressEntity.getCityName(), addressDetailsDTO.getCityName());
    assertEquals(structuredAddressEntity.getCitySubdivisionName(), addressDetailsDTO.getCitySubdivisionName());
    assertEquals(structuredAddressEntity.getCountry(), addressDetailsDTO.getCountry());
    assertEquals(structuredAddressEntity.getCountryName(), addressDetailsDTO.getCountryName());
    assertEquals(structuredAddressEntity.getCountrySubdivisionName(), addressDetailsDTO.getCountrySubdivisionName());
    assertEquals(structuredAddressEntity.getPlotId(), addressDetailsDTO.getPlotId());
    assertEquals(structuredAddressEntity.getPostcode(), addressDetailsDTO.getPostcode());
    assertEquals(structuredAddressEntity.getPostOfficeBox(), addressDetailsDTO.getPostOfficeBox());
    assertEquals(structuredAddressEntity.getStreetName(), addressDetailsDTO.getStreetName());
}
Also used : StructuredAddressTypeEnum(eu.europa.ec.fisheries.ers.fa.utils.StructuredAddressTypeEnum) StructuredAddressEntity(eu.europa.ec.fisheries.ers.fa.entities.StructuredAddressEntity) AddressDetailsDTO(eu.europa.ec.fisheries.ers.service.dto.fareport.details.AddressDetailsDTO) StructuredAddress(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.StructuredAddress) FluxLocationEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxLocationEntity) Test(org.junit.Test)

Example 4 with StructuredAddressTypeEnum

use of eu.europa.ec.fisheries.ers.fa.utils.StructuredAddressTypeEnum in project UVMS-ActivityModule-APP by UnionVMS.

the class StructuredAddressMapperTest method testStructuredAddressMapperForContactParty.

@Test
public void testStructuredAddressMapperForContactParty() {
    StructuredAddress structuredAddress = MapperUtil.getStructuredAddress();
    StructuredAddressEntity structuredAddressEntity = new StructuredAddressEntity();
    StructuredAddressTypeEnum structuredAddressTypeEnum = StructuredAddressTypeEnum.CANTACT_PARTY_SPECIFIED;
    ContactPartyEntity contactPartyEntity = null;
    StructuredAddressMapper.INSTANCE.mapToStructuredAddress(structuredAddress, structuredAddressTypeEnum, contactPartyEntity, structuredAddressEntity);
    assertEquals(structuredAddress.getBlockName().getValue(), structuredAddressEntity.getBlockName());
    assertEquals(structuredAddress.getBuildingName().getValue(), structuredAddressEntity.getBuildingName());
    assertEquals(structuredAddress.getID().getValue(), structuredAddressEntity.getAddressId());
    assertEquals(structuredAddress.getCityName().getValue(), structuredAddressEntity.getCityName());
    assertEquals(structuredAddress.getCitySubDivisionName().getValue(), structuredAddressEntity.getCitySubdivisionName());
    assertEquals(structuredAddress.getCountryID().getValue(), structuredAddressEntity.getCountry());
    assertEquals(structuredAddress.getCountryName().getValue(), structuredAddressEntity.getCountryName());
    assertEquals(structuredAddress.getCountrySubDivisionName().getValue(), structuredAddressEntity.getCountrySubdivisionName());
    assertEquals(structuredAddress.getCountryID().getSchemeID(), structuredAddressEntity.getCountryIdSchemeId());
    assertEquals(structuredAddress.getPlotIdentification().getValue(), structuredAddressEntity.getPlotId());
    assertEquals(structuredAddress.getPostcodeCode().getValue(), structuredAddressEntity.getPostcode());
    assertEquals(structuredAddress.getPostOfficeBox().getValue(), structuredAddressEntity.getPostOfficeBox());
    assertEquals(structuredAddress.getStreetName().getValue(), structuredAddressEntity.getStreetName());
    assertEquals(structuredAddressTypeEnum.getType(), structuredAddressEntity.getStructuredAddressType());
    assertNull(structuredAddressEntity.getContactParty());
}
Also used : StructuredAddressTypeEnum(eu.europa.ec.fisheries.ers.fa.utils.StructuredAddressTypeEnum) StructuredAddressEntity(eu.europa.ec.fisheries.ers.fa.entities.StructuredAddressEntity) StructuredAddress(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.StructuredAddress) ContactPartyEntity(eu.europa.ec.fisheries.ers.fa.entities.ContactPartyEntity) Test(org.junit.Test)

Aggregations

StructuredAddressEntity (eu.europa.ec.fisheries.ers.fa.entities.StructuredAddressEntity)4 StructuredAddressTypeEnum (eu.europa.ec.fisheries.ers.fa.utils.StructuredAddressTypeEnum)4 Test (org.junit.Test)4 StructuredAddress (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.StructuredAddress)4 FluxLocationEntity (eu.europa.ec.fisheries.ers.fa.entities.FluxLocationEntity)3 AddressDetailsDTO (eu.europa.ec.fisheries.ers.service.dto.fareport.details.AddressDetailsDTO)2 ContactPartyEntity (eu.europa.ec.fisheries.ers.fa.entities.ContactPartyEntity)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1