use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SetKeysRequestData in project open-smart-grid-platform by OSGP.
the class KeySetMappingTest method testWithEmptyArrays.
/**
* Tests the mapping of a KeySet object with empty byte arrays.
*/
@Test
public void testWithEmptyArrays() {
// build test data
final SetKeysRequestData keySetOriginal = new SetKeysRequestData();
final byte[] authenticationKey = {};
keySetOriginal.setAuthenticationKey(authenticationKey);
final byte[] encryptionKey = {};
keySetOriginal.setEncryptionKey(encryptionKey);
// actual mapping
final org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SetKeysRequestData keySetMapped = this.configurationMapper.map(keySetOriginal, org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SetKeysRequestData.class);
// check mapping
assertThat(keySetMapped).isNotNull();
assertThat(keySetMapped.getAuthenticationKey()).isNotNull();
assertThat(keySetMapped.getAuthenticationKey().length == 0).isTrue();
assertThat(keySetMapped.getEncryptionKey()).isNotNull();
assertThat(keySetMapped.getEncryptionKey().length == 0).isTrue();
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SetKeysRequestData in project open-smart-grid-platform by OSGP.
the class KeySetMappingTest method testWithNullArrays.
/**
* Tests the mapping of a KeySet object with byte arrays that are null.
*/
// Test mapping with null arrays
@Test
public void testWithNullArrays() {
// build test data
final SetKeysRequestData keySetOriginal = new SetKeysRequestData();
final byte[] authenticationKey = null;
keySetOriginal.setAuthenticationKey(authenticationKey);
final byte[] encryptionKey = null;
keySetOriginal.setEncryptionKey(encryptionKey);
// actual mapping
final org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SetKeysRequestData keySetMapped = this.configurationMapper.map(keySetOriginal, org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SetKeysRequestData.class);
// check mapping
assertThat(keySetMapped).isNotNull();
assertThat(keySetMapped.getAuthenticationKey()).isNull();
assertThat(keySetMapped.getEncryptionKey()).isNull();
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SetKeysRequestData in project open-smart-grid-platform by OSGP.
the class KeySetMappingTest method testWithFilledArrays.
/**
* Tests the mapping of a KeySet object with filled byte arrays.
*/
@Test
public void testWithFilledArrays() {
// build test data
final SetKeysRequestData keySetOriginal = new SetKeysRequestData();
final byte[] authenticationKey = BYTE_ARRAY;
keySetOriginal.setAuthenticationKey(authenticationKey);
final byte[] encryptionKey = BYTE_ARRAY;
keySetOriginal.setEncryptionKey(encryptionKey);
// actual mapping
final org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SetKeysRequestData keySetMapped = this.configurationMapper.map(keySetOriginal, org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SetKeysRequestData.class);
// check mapping
assertThat(keySetMapped).isNotNull();
this.checkMappingFilledArray(keySetMapped.getAuthenticationKey());
this.checkMappingFilledArray(keySetMapped.getEncryptionKey());
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SetKeysRequestData in project open-smart-grid-platform by OSGP.
the class ReplaceKeysRequestFactory method fromParameterMap.
public static ReplaceKeysRequest fromParameterMap(final Map<String, String> requestParameters) {
final ReplaceKeysRequest replaceKeysRequest = new ReplaceKeysRequest();
replaceKeysRequest.setDeviceIdentification(getString(requestParameters, PlatformKeys.KEY_DEVICE_IDENTIFICATION, PlatformDefaults.DEFAULT_DEVICE_IDENTIFICATION));
final SetKeysRequestData setKeysRequestData = SetKeysRequestDataFactory.fromParameterMap(requestParameters);
replaceKeysRequest.setSetKeysRequestData(setKeysRequestData);
return replaceKeysRequest;
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SetKeysRequestData in project open-smart-grid-platform by OSGP.
the class SetKeysRequestDataFactory method fromParameterMap.
public static SetKeysRequestData fromParameterMap(final Map<String, String> requestParameters) {
final SetKeysRequestData setKeysRequestData = new SetKeysRequestData();
setKeysRequestData.setAuthenticationKey(RequestFactoryHelper.hexDecodeDeviceKey(getSoapKey(requestParameters, PlatformKeys.KEY_DEVICE_AUTHENTICATIONKEY), PlatformKeys.KEY_DEVICE_AUTHENTICATIONKEY));
setKeysRequestData.setEncryptionKey(RequestFactoryHelper.hexDecodeDeviceKey(getSoapKey(requestParameters, PlatformKeys.KEY_DEVICE_ENCRYPTIONKEY), PlatformKeys.KEY_DEVICE_ENCRYPTIONKEY));
return setKeysRequestData;
}
Aggregations