Search in sources :

Example 1 with DefaultControlledStationAsduFactory

use of org.opensmartgridplatform.simulator.protocol.iec60870.domain.defaultcontrolledstation.DefaultControlledStationAsduFactory in project open-smart-grid-platform by OSGP.

the class ScenarioHooks method initMockServerDefaultControlledStation.

@Before("@Iec60870MockServerDefaultControlledStation")
public void initMockServerDefaultControlledStation() {
    ScenarioContext.current().put(PROFILE, Iec60870ProfileType.DEFAULT_CONTROLLED_STATION);
    final Iec60870AsduFactory factory = new DefaultControlledStationAsduFactory();
    factory.setIec60870Server(this.mockServer.getRtuSimulator());
    this.mockServer.addIec60870ASduHandler(ASduType.C_IC_NA_1, new Iec60870InterrogationCommandAsduHandler(factory));
}
Also used : Iec60870AsduFactory(org.opensmartgridplatform.simulator.protocol.iec60870.domain.Iec60870AsduFactory) Iec60870InterrogationCommandAsduHandler(org.opensmartgridplatform.simulator.protocol.iec60870.server.handlers.Iec60870InterrogationCommandAsduHandler) DefaultControlledStationAsduFactory(org.opensmartgridplatform.simulator.protocol.iec60870.domain.defaultcontrolledstation.DefaultControlledStationAsduFactory) Before(io.cucumber.java.Before)

Example 2 with DefaultControlledStationAsduFactory

use of org.opensmartgridplatform.simulator.protocol.iec60870.domain.defaultcontrolledstation.DefaultControlledStationAsduFactory in project open-smart-grid-platform by OSGP.

the class DefaultControlledStationAsduFactoryTest method testCreateSingleCommand.

@Test
void testCreateSingleCommand() {
    // Arrange
    final DefaultControlledStationAsduFactory defaultControlledAsduFactory = new DefaultControlledStationAsduFactory();
    final ASdu expected = new ASdu(ASduType.C_SC_NA_1, false, CauseOfTransmission.SPONTANEOUS, false, false, 0, 1, new InformationObject[] { new InformationObject(0, this.informationElementFactory.createInformationElements(Iec60870InformationObjectType.QUALIFIER_OF_INTERROGATION, 20)) });
    // Act
    final ASdu actual = defaultControlledAsduFactory.createSingleCommandAsdu();
    // Assert
    assertThat(actual).usingRecursiveComparison().isEqualTo(expected);
}
Also used : DefaultControlledStationAsduFactory(org.opensmartgridplatform.simulator.protocol.iec60870.domain.defaultcontrolledstation.DefaultControlledStationAsduFactory) ASdu(org.openmuc.j60870.ASdu) InformationObject(org.openmuc.j60870.ie.InformationObject) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

DefaultControlledStationAsduFactory (org.opensmartgridplatform.simulator.protocol.iec60870.domain.defaultcontrolledstation.DefaultControlledStationAsduFactory)2 Before (io.cucumber.java.Before)1 Test (org.junit.jupiter.api.Test)1 ASdu (org.openmuc.j60870.ASdu)1 InformationObject (org.openmuc.j60870.ie.InformationObject)1 Iec60870AsduFactory (org.opensmartgridplatform.simulator.protocol.iec60870.domain.Iec60870AsduFactory)1 Iec60870InterrogationCommandAsduHandler (org.opensmartgridplatform.simulator.protocol.iec60870.server.handlers.Iec60870InterrogationCommandAsduHandler)1 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)1