use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.GetSpecificAttributeValueRequest in project open-smart-grid-platform by OSGP.
the class SetPushSetupSms method getSpecificAttributeValues.
private GetSpecificAttributeValueResponse getSpecificAttributeValues(final Map<String, String> settings) throws WebServiceSecurityException, GeneralSecurityException, IOException {
// Make a specificAttributeValueRequest to read out the register for
// pushsetupsms on the device simulator. ClassID = 40, ObisCode =
// 0.2.25.9.0.255 and AttributeID = 3. This is the attribute that stores
// 'sendDestinationAndMethod' which we sent earlier in the form of
// host:port
final GetSpecificAttributeValueRequest request = new GetSpecificAttributeValueRequest();
request.setClassId(BigInteger.valueOf(40L));
request.setObisCode(this.getObisCodeValues());
request.setAttribute(BigInteger.valueOf(3L));
request.setDeviceIdentification(settings.get(PlatformSmartmeteringKeys.KEY_DEVICE_IDENTIFICATION));
final GetSpecificAttributeValueAsyncResponse asyncResponse = this.adHocRequestclient.doRequest(request);
final GetSpecificAttributeValueAsyncRequest asyncRequest = new GetSpecificAttributeValueAsyncRequest();
asyncRequest.setDeviceIdentification(asyncResponse.getDeviceIdentification());
asyncRequest.setCorrelationUid(asyncResponse.getCorrelationUid());
return this.adHocResponseClient.getResponse(asyncRequest);
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.GetSpecificAttributeValueRequest in project open-smart-grid-platform by OSGP.
the class SpecificAttributeValue method whenTheGetSpecificAttributeValueRequestIsReceived.
@When("^the get specific attribute value request is received$")
public void whenTheGetSpecificAttributeValueRequestIsReceived(final Map<String, String> settings) throws Throwable {
final GetSpecificAttributeValueRequest request = SpecificAttributeValueRequestFactory.fromParameterMap(settings);
final GetSpecificAttributeValueAsyncResponse asyncResponse = this.requestClient.doRequest(request);
assertThat(asyncResponse).as("AsyncResponse should not be null").isNotNull();
ScenarioContext.current().put(PlatformKeys.KEY_CORRELATION_UID, asyncResponse.getCorrelationUid());
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.GetSpecificAttributeValueRequest in project open-smart-grid-platform by OSGP.
the class GetSpecificAttributeValueRequestMappingTest method makeRequest.
private GetSpecificAttributeValueRequest makeRequest() {
final GetSpecificAttributeValueRequest result = new GetSpecificAttributeValueRequest();
final ObisCodeValues obiscode = new ObisCodeValues();
obiscode.setA((short) 1);
result.setObisCode(obiscode);
result.setDeviceIdentification("12345");
return result;
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.GetSpecificAttributeValueRequest in project open-smart-grid-platform by OSGP.
the class GetSpecificAttributeValueRequestMappingTest method test.
@Test
public void test() {
final GetSpecificAttributeValueRequest req1 = this.makeRequest();
final Object obj1 = this.mapper.map(req1, org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SpecificAttributeValueRequest.class);
assertThat((obj1 != null) && (obj1 instanceof org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SpecificAttributeValueRequest)).isTrue();
final Object obj2 = this.mapper.map(obj1, GetSpecificAttributeValueRequest.class);
assertThat((obj2 != null) && (obj2 instanceof GetSpecificAttributeValueRequest)).isTrue();
final GetSpecificAttributeValueRequest req2 = (GetSpecificAttributeValueRequest) obj2;
assertThat(req1.getDeviceIdentification().equals(req2.getDeviceIdentification())).isTrue();
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.GetSpecificAttributeValueRequest in project open-smart-grid-platform by OSGP.
the class SpecificAttributeValueRequestFactory method fromParameterMap.
public static GetSpecificAttributeValueRequest fromParameterMap(final Map<String, String> parameters) {
final GetSpecificAttributeValueRequest request = new GetSpecificAttributeValueRequest();
request.setDeviceIdentification(parameters.get(PlatformSmartmeteringKeys.DEVICE_IDENTIFICATION));
request.setClassId(new BigInteger(parameters.get(PlatformSmartmeteringKeys.CLASS_ID)));
request.setObisCode(ObisCodeValuesFactory.fromParameterMap(parameters));
request.setAttribute(new BigInteger(parameters.get(PlatformSmartmeteringKeys.ATTRIBUTE)));
return request;
}
Aggregations