use of org.openkilda.messaging.model.SwitchPatch in project open-kilda by telstra.
the class SwitchOperationsServiceTest method shouldSetNullPopWhenPopIsEmptyString.
@Test
public void shouldSetNullPopWhenPopIsEmptyString() throws SwitchNotFoundException {
Switch sw = Switch.builder().switchId(TEST_SWITCH_ID).status(SwitchStatus.ACTIVE).build();
switchRepository.add(sw);
SwitchPatch switchPatch = new SwitchPatch("", null);
switchOperationsService.patchSwitch(TEST_SWITCH_ID, switchPatch);
Switch updatedSwitch = switchRepository.findById(TEST_SWITCH_ID).get();
assertNull(updatedSwitch.getPop());
}
use of org.openkilda.messaging.model.SwitchPatch 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());
}
use of org.openkilda.messaging.model.SwitchPatch in project open-kilda by telstra.
the class SwitchMapperTest method testSwitchPatchDtoToSwitchPatch.
@Test
public void testSwitchPatchDtoToSwitchPatch() {
SwitchPatchDto switchPatchDto = new SwitchPatchDto("pop", new SwitchLocationDtoV2(48.860611, 2.337633, "street", "city", "country"));
SwitchPatch switchPatch = switchMapper.map(switchPatchDto);
assertEquals(switchPatchDto.getPop(), switchPatch.getPop());
assertEquals(switchPatchDto.getLocation().getLatitude(), switchPatch.getLocation().getLatitude());
assertEquals(switchPatchDto.getLocation().getLongitude(), switchPatch.getLocation().getLongitude());
assertEquals(switchPatchDto.getLocation().getStreet(), switchPatch.getLocation().getStreet());
assertEquals(switchPatchDto.getLocation().getCity(), switchPatch.getLocation().getCity());
assertEquals(switchPatchDto.getLocation().getCountry(), switchPatch.getLocation().getCountry());
}
Aggregations