@Test public void testNeutronNetworkDeleted() throws Exception { String netId = "6cfdb7"; NeutronNetwork mockNet = mock(NeutronNetwork.class); when(mockNet.isShared()).thenReturn(false); when(mockNet.getID()).thenReturn(netId); NetworkHandler spy = spy(testNetworkHandler); TenantNetworkManager tenantNetworkManager = mock(TenantNetworkManager.class); Whitebox.setInternalState(TenantNetworkManager.class, "tenantHelper", tenantNetworkManager); when(spy.canDeleteNetwork(mockNet)) .thenReturn(HttpURLConnection.HTTP_BAD_REQUEST) .thenCallRealMethod(); spy.neutronNetworkDeleted(mockNet); spy.neutronNetworkDeleted(mockNet); verify(tenantNetworkManager).networkDeleted(netId); }
@Override public void neutronNetworkDeleted(NeutronNetwork network) { int result = canDeleteNetwork(network); if (result != HttpURLConnection.HTTP_OK) { logger.error(" deleteNetwork validation failed for result - {} ", result); return; } TenantNetworkManager.getManager().networkDeleted(network.getID()); }
NetworkHandler extends BaseHandler implements INeutronNetworkAware { @Override public void neutronNetworkDeleted(NeutronNetwork network) { int result = canDeleteNetwork(network); if (result != HttpURLConnection.HTTP_OK) { logger.error(" deleteNetwork validation failed for result - {} ", result); return; } TenantNetworkManager.getManager().networkDeleted(network.getID()); } }
NetworkHandler extends BaseHandler implements INeutronNetworkAware { @Override public void neutronNetworkDeleted(NeutronNetwork network) { int result = canDeleteNetwork(network); if (result != HttpURLConnection.HTTP_OK) { logger.error(" deleteNetwork validation failed for result - {} ", result); return; } TenantNetworkManager.getManager().networkDeleted(network.getID()); }  }
NetworkHandler extends BaseHandler implements INeutronNetworkAware { @Override public void neutronNetworkDeleted(NeutronNetwork network) { int result = canDeleteNetwork(network); if (result != HttpURLConnection.HTTP_OK) { logger.error(" deleteNetwork validation failed for result - {} ", result); return; } TenantNetworkManager.getManager().networkDeleted(network.getID()); }  @Override int canCreateNetwork(NeutronNetwork network); @Override void neutronNetworkCreated(NeutronNetwork network); @Override int canUpdateNetwork(NeutronNetwork delta,
                                NeutronNetwork original); @Override void neutronNetworkUpdated(NeutronNetwork network); @Override int canDeleteNetwork(NeutronNetwork network); @Override void neutronNetworkDeleted(NeutronNetwork network); }
NetworkHandler extends BaseHandler implements INeutronNetworkAware { @Override public void neutronNetworkDeleted(NeutronNetwork network) { int result = canDeleteNetwork(network); if (result != HttpURLConnection.HTTP_OK) { logger.error(" deleteNetwork validation failed for result - {} ", result); return; } TenantNetworkManager.getManager().networkDeleted(network.getID()); }  @Override int canCreateNetwork(NeutronNetwork network); @Override void neutronNetworkCreated(NeutronNetwork network); @Override int canUpdateNetwork(NeutronNetwork delta,
                                NeutronNetwork original); @Override void neutronNetworkUpdated(NeutronNetwork network); @Override int canDeleteNetwork(NeutronNetwork network); @Override void neutronNetworkDeleted(NeutronNetwork network);  }