Search in sources :

Example 1 with SwitchDtoV2

use of org.openkilda.northbound.dto.v2.switches.SwitchDtoV2 in project open-kilda by telstra.

the class SwitchMapperTest method testSwitchToSwitchDtoV2.

@Test
public void testSwitchToSwitchDtoV2() {
    Switch sw = getSwitch();
    SwitchDtoV2 switchDto = switchMapper.map(sw);
    assertEquals(sw.getSwitchId(), switchDto.getSwitchId());
    assertEquals("127.0.0.1", switchDto.getAddress());
    assertEquals(sw.getSocketAddress().getPort(), switchDto.getPort());
    assertEquals(sw.getHostname(), switchDto.getHostname());
    assertEquals(sw.getDescription(), switchDto.getDescription());
    assertEquals(switchMapper.convertStatus(sw.getStatus()), switchDto.getState());
    assertEquals(sw.isUnderMaintenance(), switchDto.isUnderMaintenance());
    assertEquals(sw.getOfVersion(), switchDto.getOfVersion());
    assertEquals(sw.getOfDescriptionManufacturer(), switchDto.getManufacturer());
    assertEquals(sw.getOfDescriptionHardware(), switchDto.getHardware());
    assertEquals(sw.getOfDescriptionSoftware(), switchDto.getSoftware());
    assertEquals(sw.getOfDescriptionSerialNumber(), switchDto.getSerialNumber());
    assertEquals(sw.getPop(), switchDto.getPop());
    assertEquals((Double) sw.getLatitude(), switchDto.getLocation().getLatitude());
    assertEquals((Double) sw.getLongitude(), switchDto.getLocation().getLongitude());
    assertEquals(sw.getStreet(), switchDto.getLocation().getStreet());
    assertEquals(sw.getCity(), switchDto.getLocation().getCity());
    assertEquals(sw.getCountry(), switchDto.getLocation().getCountry());
}
Also used : Switch(org.openkilda.model.Switch) SwitchDtoV2(org.openkilda.northbound.dto.v2.switches.SwitchDtoV2) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 Switch (org.openkilda.model.Switch)1 SwitchDtoV2 (org.openkilda.northbound.dto.v2.switches.SwitchDtoV2)1