Search in sources :

Example 1 with Connection

use of org.openmuc.framework.driver.spi.Connection in project OpenMUC by isc-konstanz.

the class Iec61850DriverTest method testConnectValidSettings1.

@Test
public void testConnectValidSettings1() throws Exception {
    // Test 1
    String testDeviceAdress = host + ":" + port;
    String testSettings = "-a 12 -lt 1 -rt 1";
    Iec61850Driver testIec61850Driver = new Iec61850Driver();
    Connection testIec61850Connection = testIec61850Driver.connect(testDeviceAdress, testSettings);
    Assert.assertThat(testIec61850Connection, instanceOf(Connection.class));
    testIec61850Connection.disconnect();
}
Also used : Connection(org.openmuc.framework.driver.spi.Connection) Test(org.junit.jupiter.api.Test)

Example 2 with Connection

use of org.openmuc.framework.driver.spi.Connection in project OpenMUC by isc-konstanz.

the class Iec61850DriverTest method testConnectValidSettings2.

@Test
public void testConnectValidSettings2() throws Exception {
    // Test 1
    String testDeviceAdress = host + ":" + port;
    String testSettings = "-a 12 -lt -rt ";
    Iec61850Driver testIec61850Driver = new Iec61850Driver();
    Connection testIec61850Connection = testIec61850Driver.connect(testDeviceAdress, testSettings);
    Assert.assertThat(testIec61850Connection, instanceOf(Connection.class));
    testIec61850Connection.disconnect();
}
Also used : Connection(org.openmuc.framework.driver.spi.Connection) Test(org.junit.jupiter.api.Test)

Example 3 with Connection

use of org.openmuc.framework.driver.spi.Connection in project OpenMUC by isc-konstanz.

the class Iec61850DriverTest method expectExeption.

private void expectExeption(String testDeviceAdress, String testSettings, String exeptionMsg, Exception exception) {
    Iec61850Driver testIec61850Driver = new Iec61850Driver();
    Exception e = assertThrows(exception.getClass(), () -> {
        Connection testIec61850Connection = testIec61850Driver.connect(testDeviceAdress, testSettings);
        testIec61850Connection.disconnect();
    });
    assertEquals(exeptionMsg, e.getMessage());
}
Also used : Connection(org.openmuc.framework.driver.spi.Connection) ArgumentSyntaxException(org.openmuc.framework.config.ArgumentSyntaxException) IOException(java.io.IOException) SclParseException(com.beanit.iec61850bean.SclParseException) ConnectionException(org.openmuc.framework.driver.spi.ConnectionException) ExpectedException(org.junit.rules.ExpectedException)

Example 4 with Connection

use of org.openmuc.framework.driver.spi.Connection in project OpenMUC by isc-konstanz.

the class Iec61850DriverTest method testConnectEmptySettings.

@Test
public void testConnectEmptySettings() throws ArgumentSyntaxException, ConnectionException {
    // test with valid syntax on the test server
    String testDeviceAdress = host + ":" + port;
    String testSettings = "";
    Iec61850Driver testIec61850Driver = new Iec61850Driver();
    Connection testIec61850Connection = testIec61850Driver.connect(testDeviceAdress, testSettings);
    Assert.assertThat(testIec61850Connection, instanceOf(Connection.class));
    testIec61850Connection.disconnect();
}
Also used : Connection(org.openmuc.framework.driver.spi.Connection) Test(org.junit.jupiter.api.Test)

Aggregations

Connection (org.openmuc.framework.driver.spi.Connection)4 Test (org.junit.jupiter.api.Test)3 SclParseException (com.beanit.iec61850bean.SclParseException)1 IOException (java.io.IOException)1 ExpectedException (org.junit.rules.ExpectedException)1 ArgumentSyntaxException (org.openmuc.framework.config.ArgumentSyntaxException)1 ConnectionException (org.openmuc.framework.driver.spi.ConnectionException)1