use of org.opensmartgridplatform.iec60870.Iec60870AsduHandler in project open-smart-grid-platform by OSGP.
the class Iec60870AsduHandlerRegistryTest method registryShouldReturnSingleCommandHandlerForSingleCommandAsduType.
@Test
public void registryShouldReturnSingleCommandHandlerForSingleCommandAsduType() throws Exception {
// arrange
final ASduType asduType = ASduType.C_SC_NA_1;
final Iec60870SingleCommandAsduHandler expected = this.iec60870SingleCommandAsduHandler;
// act
final Iec60870AsduHandler actual = this.iec60870AsduHandlerRegistry.getHandler(asduType);
// assert
assertThat(actual).isEqualTo(expected);
}
use of org.opensmartgridplatform.iec60870.Iec60870AsduHandler in project open-smart-grid-platform by OSGP.
the class Iec60870ConnectionEventListener method newASdu.
@Override
public void newASdu(final ASdu asdu) {
try {
final ASduType asduType = asdu.getTypeIdentification();
final Iec60870AsduHandler asduHandler = this.iec60870AsduHandlerRegistry.getHandler(asduType);
asduHandler.handleAsdu(this.connection, asdu);
} catch (final Iec60870AsduHandlerNotFoundException e) {
LOGGER.error("Unknown request received, no handler available for ASDU: {}", asdu, e);
} catch (final EOFException e) {
LOGGER.error("Connection closed on connection ({}).", this.connection, e);
} catch (final Exception e) {
LOGGER.error("Exception occurred on connection ({}).", this.connection, e);
}
}
use of org.opensmartgridplatform.iec60870.Iec60870AsduHandler in project open-smart-grid-platform by OSGP.
the class Iec60870AsduHandlerRegistryTest method registryShouldReturnInterrogationCommandHandlerForInterrogationCommandAsduType.
@Test
public void registryShouldReturnInterrogationCommandHandlerForInterrogationCommandAsduType() throws Exception {
// arrange
final ASduType asduType = ASduType.C_IC_NA_1;
final Iec60870InterrogationCommandAsduHandler expected = this.iec60870InterrogationCommandAsduHandler;
// act
final Iec60870AsduHandler actual = this.iec60870AsduHandlerRegistry.getHandler(asduType);
// assert
assertThat(actual).isEqualTo(expected);
}
Aggregations