Search in sources :

Example 1 with GetSpecificAttributeValueRequest

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);
}
Also used : GetSpecificAttributeValueAsyncRequest(org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.GetSpecificAttributeValueAsyncRequest) GetSpecificAttributeValueAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.GetSpecificAttributeValueAsyncResponse) GetSpecificAttributeValueRequest(org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.GetSpecificAttributeValueRequest)

Example 2 with GetSpecificAttributeValueRequest

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());
}
Also used : GetSpecificAttributeValueAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.GetSpecificAttributeValueAsyncResponse) GetSpecificAttributeValueRequest(org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.GetSpecificAttributeValueRequest) When(io.cucumber.java.en.When)

Example 3 with GetSpecificAttributeValueRequest

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;
}
Also used : ObisCodeValues(org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.ObisCodeValues) GetSpecificAttributeValueRequest(org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.GetSpecificAttributeValueRequest)

Example 4 with GetSpecificAttributeValueRequest

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();
}
Also used : GetSpecificAttributeValueRequest(org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.GetSpecificAttributeValueRequest) GetSpecificAttributeValueRequest(org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.GetSpecificAttributeValueRequest) Test(org.junit.jupiter.api.Test)

Example 5 with GetSpecificAttributeValueRequest

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;
}
Also used : BigInteger(java.math.BigInteger) GetSpecificAttributeValueRequest(org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.GetSpecificAttributeValueRequest)

Aggregations

GetSpecificAttributeValueRequest (org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.GetSpecificAttributeValueRequest)6 GetSpecificAttributeValueAsyncResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.GetSpecificAttributeValueAsyncResponse)3 When (io.cucumber.java.en.When)2 GetSpecificAttributeValueAsyncRequest (org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.GetSpecificAttributeValueAsyncRequest)2 BigInteger (java.math.BigInteger)1 Test (org.junit.jupiter.api.Test)1 ObisCodeValues (org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.ObisCodeValues)1