Deployer { public boolean isPaused() { return isPaused; } Deployer(String serviceName, StatusCache deviceStateCache,
                  ControllerConfiguration controllerConfig,
                  Map<String, ModelBuilder> builders); synchronized void startController(); boolean isPaused(); void softRestart(); void deployFromZip(InputStream inputStream); void deployFromOnline(String username, String credentials); Element queryElementById(int id); Map<String, String> getConfigurationProperties(); Sensor getSensorFromComponentInclude(Element componentIncludeElement); void announceDiscoveredDevices(List<DiscoveredDeviceDTO> list); String getLinkedAccountId(); void unlinkController();  }
@Test public void testIsPaused() throws Exception { int MODEL_BUILDER_DELAY = 500; ExecutorService executor = Executors.newFixedThreadPool(1); CyclicBarrier barrier = new CyclicBarrier(2); ControllerConfiguration config = new ControllerConfiguration(); URI deploymentURI = AllTests.getAbsoluteFixturePath().resolve("deployment/sensorsonly"); config.setResourcePath(deploymentURI.getPath()); CommandFactory cf = createCommandFactory(); StatusCache cache = new StatusCache(); final Deployer d = createLongRunningDeployer( deployerName, cache, config, cf, new Version20SensorBuilder(), barrier, MODEL_BUILDER_DELAY ); Assert.assertFalse(d.isPaused()); executor.execute(new Runnable() { @Override public void run() { try { d.softRestart(); } catch (ControllerDefinitionNotFoundException e) { e.printStackTrace(); } } }); barrier.await(); Assert.assertTrue(d.isPaused()); Thread.sleep(MODEL_BUILDER_DELAY * 2); Assert.assertFalse(d.isPaused()); executor.shutdownNow(); executor.awaitTermination(500, TimeUnit.MILLISECONDS); }