use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.GetGsmDiagnosticResponse in project open-smart-grid-platform by OSGP.
the class GetGsmDiagnosticResponseFactory method fromParameterMap.
public static GetGsmDiagnosticResponse fromParameterMap(final Map<String, String> requestParameters) {
final String operator = getString(requestParameters, "operator");
final ModemRegistrationStatus modemRegistrationStatus = getEnum(requestParameters, "modemRegistrationStatus", ModemRegistrationStatus.class);
final CircuitSwitchedStatus circuitSwitchedStatus = getEnum(requestParameters, "circuitSwitchedStatus", CircuitSwitchedStatus.class);
final PacketSwitchedStatus packetSwitchedStatus = getEnum(requestParameters, "packetSwitchedStatus", PacketSwitchedStatus.class);
final Long cellId = getLong(requestParameters, "cellId");
final Integer locationId = getInteger(requestParameters, "locationId");
final SignalQuality signalQuality = getEnum(requestParameters, "signalQuality", SignalQuality.class);
final BitErrorRate bitErrorRate = getEnum(requestParameters, "bitErrorRate", BitErrorRate.class);
final Integer mobileCountryCode = getInteger(requestParameters, "mobileCountryCode");
final Integer mobileNetworkCode = getInteger(requestParameters, "mobileNetworkCode");
final Long channelNumber = getLong(requestParameters, "channelNumber");
final CellInfo cellInfo = new CellInfo();
cellInfo.setCellId(cellId);
cellInfo.setLocationId(locationId);
cellInfo.setSignalQuality(signalQuality);
cellInfo.setBitErrorRate(bitErrorRate);
cellInfo.setMobileCountryCode(mobileCountryCode);
cellInfo.setMobileNetworkCode(mobileNetworkCode);
cellInfo.setChannelNumber(channelNumber);
final List<String> adjacentCellIds = Arrays.asList(getString(requestParameters, "adjacentCellIds").split(","));
final List<String> adjacentCellSignalQualities = Arrays.asList(getString(requestParameters, "adjacentCellSignalQualities").split(","));
final List<AdjacentCellInfo> adjacentCellInfos = IntStream.range(0, adjacentCellIds.size()).mapToObj(i -> {
final AdjacentCellInfo adjacentCellInfo = new AdjacentCellInfo();
adjacentCellInfo.setCellId(Long.parseLong(adjacentCellIds.get(i)));
adjacentCellInfo.setSignalQuality(SignalQuality.fromValue(adjacentCellSignalQualities.get(i)));
return adjacentCellInfo;
}).collect(Collectors.toList());
final GetGsmDiagnosticResponse getGsmDiagnosticResponse = new GetGsmDiagnosticResponse();
getGsmDiagnosticResponse.setOperator(operator);
getGsmDiagnosticResponse.setModemRegistrationStatus(modemRegistrationStatus);
getGsmDiagnosticResponse.setCircuitSwitchedStatus(circuitSwitchedStatus);
getGsmDiagnosticResponse.setPacketSwitchedStatus(packetSwitchedStatus);
getGsmDiagnosticResponse.setCellInfo(cellInfo);
getGsmDiagnosticResponse.getAdjacentCells().addAll(adjacentCellInfos);
return getGsmDiagnosticResponse;
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.GetGsmDiagnosticResponse in project open-smart-grid-platform by OSGP.
the class BundledGetGsmDiagnosticSteps method theBundleResponseShouldContainAGetGsmDiagnosticResponse.
@Then("^the bundle response should contain a get gsm diagnostic response with values$")
public void theBundleResponseShouldContainAGetGsmDiagnosticResponse(final Map<String, String> expectedValues) throws Throwable {
final Response response = this.getNextBundleResponse();
assertThat(response).isInstanceOf(GetGsmDiagnosticResponse.class);
final GetGsmDiagnosticResponse getGsmDiagnosticResponse = (GetGsmDiagnosticResponse) response;
final GetGsmDiagnosticResponse expectedResponse = GetGsmDiagnosticResponseFactory.fromParameterMap(expectedValues);
assertThat(getGsmDiagnosticResponse).usingRecursiveComparison().ignoringFields(// Reading of captureTime is disabled for now
"captureTime").isEqualTo(expectedResponse);
}
Aggregations