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());
}
}
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());
}
Aggregations