Change-Id: I6fc4762d8af5cced96e82529cf23d75bb017dffa
Signed-off-by: Marian Adamjak <marian.adamjak@pantheon.sk>
@Override
public ListenableFuture<Boolean> shutdown() {
LOGGER.debug("Shutdown summoned");
- //TODO: provide exception in case of: not started, not configured (already stopped)
- ListenableFuture<Boolean> result = serverFacade.shutdown();
- return result;
+ if(serverFacade == null){
+ LOGGER.debug("Can not shutdown - not configured or started");
+ throw new IllegalStateException("SwitchConnectionProvider is not started or not configured.");
+ }
+ return serverFacade.shutdown();
}
@Override
Assert.assertNotNull("Wrong -- getServerFacade return null",serverFacade);
}
+ /**
+ * Test shutdown on unconfigured provider
+ */
+ @Test(expected = IllegalStateException.class)
+ public void testShutdownUnconfigured(){
+ startUp(TransportProtocol.TCP);
+ provider.shutdown();
+ }
/**
* Test unregister by wrong key
*/