Search in sources :

Example 1 with MethodAccessItem

use of org.opensmartgridplatform.domain.core.valueobjects.smartmetering.MethodAccessItem in project open-smart-grid-platform by OSGP.

the class AssociationLnListTypeMappingTest method checkMethodAccessItem.

private void checkMethodAccessItem(final List<MethodAccessItem> methodAccessItemList, final List<MethodAccessItemDto> methodAccessItemDtoList) {
    assertThat(methodAccessItemDtoList.size()).isEqualTo(methodAccessItemList.size());
    final Iterator<MethodAccessItem> methodAccessItemIterator = methodAccessItemList.iterator();
    final Iterator<MethodAccessItemDto> methodAccessItemDtoIterator = methodAccessItemDtoList.iterator();
    while (methodAccessItemIterator.hasNext() && methodAccessItemDtoIterator.hasNext()) {
        final MethodAccessItem methodAccessItem = methodAccessItemIterator.next();
        final MethodAccessItemDto methodAccessItemDto = methodAccessItemDtoIterator.next();
        assertThat(methodAccessItemDto.getAccessMode().name()).isEqualTo(methodAccessItem.getAccessMode().name());
        assertThat(methodAccessItemDto.getMethodId()).isEqualTo(methodAccessItem.getMethodId());
    }
}
Also used : MethodAccessItemDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.MethodAccessItemDto) MethodAccessItem(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.MethodAccessItem)

Example 2 with MethodAccessItem

use of org.opensmartgridplatform.domain.core.valueobjects.smartmetering.MethodAccessItem in project open-smart-grid-platform by OSGP.

the class AssociationLnListTypeMappingTest method testAssociationLnListTypeMappingWithNonEmptyLists.

@Test
public void testAssociationLnListTypeMappingWithNonEmptyLists() {
    // build test data
    final List<AttributeAccessItem> listAttributeAccessItem = new ArrayList<>();
    final AttributeAccessModeType accessMode = AttributeAccessModeType.NO_ACCESS;
    final List<Integer> listInteger = new ArrayList<>();
    final AccessSelectorList accessSelectors = new AccessSelectorList(listInteger);
    listAttributeAccessItem.add(new AttributeAccessItem(1, accessMode, accessSelectors));
    final AttributeAccessDescriptor attributeAccessDescriptor = new AttributeAccessDescriptor(listAttributeAccessItem);
    final List<MethodAccessItem> listMethodAccessItem = new ArrayList<>();
    final MethodAccessDescriptor methodAccessDescriptor = new MethodAccessDescriptor(listMethodAccessItem);
    final AssociationLnListElement associationLnElement = new AssociationLnListElement(72, 2, new CosemObisCode(new int[] { 1, 1, 1, 1, 1, 1 }), new AccessRight(attributeAccessDescriptor, methodAccessDescriptor));
    final AssociationLnListType associationLnListType = new AssociationLnListTypeBuilder().withNonEmptyLists(associationLnElement).build();
    // actual mapping
    final AssociationLnListTypeDto associationLnListTypeDto = this.configurationMapper.map(associationLnListType, AssociationLnListTypeDto.class);
    // check values
    assertThat(associationLnListTypeDto).isNotNull();
    this.checkAssociationLnListElementMapping(associationLnListType.getAssociationLnListElement(), associationLnListTypeDto.getAssociationLnListElement());
}
Also used : MethodAccessDescriptor(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.MethodAccessDescriptor) ArrayList(java.util.ArrayList) AttributeAccessDescriptor(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.AttributeAccessDescriptor) AssociationLnListType(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.AssociationLnListType) CosemObisCode(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.CosemObisCode) AttributeAccessItem(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.AttributeAccessItem) AssociationLnListElement(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.AssociationLnListElement) AssociationLnListTypeDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.AssociationLnListTypeDto) MethodAccessItem(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.MethodAccessItem) AttributeAccessModeType(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.AttributeAccessModeType) AccessRight(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.AccessRight) AccessSelectorList(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.AccessSelectorList) Test(org.junit.jupiter.api.Test)

Aggregations

MethodAccessItem (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.MethodAccessItem)2 ArrayList (java.util.ArrayList)1 Test (org.junit.jupiter.api.Test)1 AccessRight (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.AccessRight)1 AccessSelectorList (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.AccessSelectorList)1 AssociationLnListElement (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.AssociationLnListElement)1 AssociationLnListType (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.AssociationLnListType)1 AttributeAccessDescriptor (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.AttributeAccessDescriptor)1 AttributeAccessItem (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.AttributeAccessItem)1 AttributeAccessModeType (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.AttributeAccessModeType)1 CosemObisCode (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.CosemObisCode)1 MethodAccessDescriptor (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.MethodAccessDescriptor)1 AssociationLnListTypeDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.AssociationLnListTypeDto)1 MethodAccessItemDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.MethodAccessItemDto)1