use of org.opensmartgridplatform.domain.core.valueobjects.smartmetering.AttributeAccessItem in project open-smart-grid-platform by OSGP.
the class AssociationLnListTypeMappingTest method checkAttributeAccessItem.
private void checkAttributeAccessItem(final List<AttributeAccessItem> attributeAccessItemList, final List<AttributeAccessItemDto> attributeAccessItemDtoList) {
assertThat(attributeAccessItemDtoList.size()).isEqualTo(attributeAccessItemList.size());
final Iterator<AttributeAccessItem> attributeAccessItemIterator = attributeAccessItemList.iterator();
final Iterator<AttributeAccessItemDto> attributeAccessItemDtoIterator = attributeAccessItemDtoList.iterator();
while (attributeAccessItemIterator.hasNext() && attributeAccessItemDtoIterator.hasNext()) {
final AttributeAccessItem attributeAccessItem = attributeAccessItemIterator.next();
final AttributeAccessItemDto attributeAccessItemDto = attributeAccessItemDtoIterator.next();
assertThat(attributeAccessItemDto.getAccessMode().name()).isEqualTo(attributeAccessItem.getAccessMode().name());
assertThat(attributeAccessItemDto.getAccessSelectors().getAccessSelector()).isEqualTo(attributeAccessItem.getAccessSelectors().getAccessSelector());
assertThat(attributeAccessItemDto.getAttributeId()).isEqualTo(attributeAccessItem.getAttributeId());
}
}
use of org.opensmartgridplatform.domain.core.valueobjects.smartmetering.AttributeAccessItem 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());
}
Aggregations