Search in sources :

Example 1 with AccessRight

use of org.opensmartgridplatform.domain.core.valueobjects.smartmetering.AccessRight 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

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 MethodAccessItem (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.MethodAccessItem)1 AssociationLnListTypeDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.AssociationLnListTypeDto)1