Search in sources :

Example 1 with SwitchLocation

use of org.openkilda.messaging.model.SwitchLocation in project open-kilda by telstra.

the class SwitchOperationsServiceTest method shouldPatchSwitch.

@Test
public void shouldPatchSwitch() throws SwitchNotFoundException {
    Switch sw = Switch.builder().switchId(TEST_SWITCH_ID).status(SwitchStatus.ACTIVE).build();
    switchRepository.add(sw);
    SwitchPatch switchPatch = new SwitchPatch("pop", new SwitchLocation(48.860611, 2.337633, "street", "city", "country"));
    switchOperationsService.patchSwitch(TEST_SWITCH_ID, switchPatch);
    Switch updatedSwitch = switchRepository.findById(TEST_SWITCH_ID).get();
    assertEquals(switchPatch.getPop(), updatedSwitch.getPop());
    assertEquals(switchPatch.getLocation().getLatitude(), updatedSwitch.getLatitude());
    assertEquals(switchPatch.getLocation().getLongitude(), updatedSwitch.getLongitude());
    assertEquals(switchPatch.getLocation().getStreet(), updatedSwitch.getStreet());
    assertEquals(switchPatch.getLocation().getCity(), updatedSwitch.getCity());
    assertEquals(switchPatch.getLocation().getCountry(), updatedSwitch.getCountry());
}
Also used : Switch(org.openkilda.model.Switch) SwitchLocation(org.openkilda.messaging.model.SwitchLocation) SwitchPatch(org.openkilda.messaging.model.SwitchPatch) InMemoryGraphBasedTest(org.openkilda.persistence.inmemory.InMemoryGraphBasedTest) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 SwitchLocation (org.openkilda.messaging.model.SwitchLocation)1 SwitchPatch (org.openkilda.messaging.model.SwitchPatch)1 Switch (org.openkilda.model.Switch)1 InMemoryGraphBasedTest (org.openkilda.persistence.inmemory.InMemoryGraphBasedTest)1