This modifies canUpdateNetwork() to check the network shared
attribute.
Change-Id: Ie875c4cc437c27f6b202e4e26dc1acd1aeff41f8
Signed-off-by: Cédric Ollivier <ollivier.cedric@gmail.com>
@Override
public int canUpdateNetwork(NeutronNetwork delta,
NeutronNetwork original) {
+ if (delta.isShared()) {
+ logger.error(" Network shared attribute not supported ");
+ return HttpURLConnection.HTTP_NOT_ACCEPTABLE;
+ }
+
logger.trace("canUpdateNetwork: network delta {} --- original {}", delta, original);
return HttpURLConnection.HTTP_OK;
}
*/
@Test
public void testCanUpdateNetwork() {
+ when(neutronNetwork.isShared())
+ .thenReturn(true)
+ .thenReturn(false);
+ assertEquals("Error, did not return the correct HTTP flag", HttpURLConnection.HTTP_NOT_ACCEPTABLE, networkHandler.canUpdateNetwork(neutronNetwork, neutronNetwork));
assertEquals("Error, did not return the correct HTTP flag", HttpURLConnection.HTTP_OK, networkHandler.canUpdateNetwork(neutronNetwork, neutronNetwork));
}