Deployer { public void softRestart() throws ControllerDefinitionNotFoundException { try { pause(); softShutdown(); startup(); } finally { resume(); } } 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 testSoftRestart() throws Exception { URI deploymentURI = AllTests.getAbsoluteFixturePath().resolve("deployment/sensorsonly"); Deployer d = createDeployer(deploymentURI); d.softRestart(); Sensor sensor1 = d.getSensor(1); Assert.assertNotNull("got null sensor", sensor1); Assert.assertTrue(sensor1.getName().equals("Sensor 1")); Assert.assertTrue(sensor1.getSensorID() == 1); Assert.assertTrue(sensor1 instanceof SwitchSensor); Assert.assertTrue(sensor1.isRunning()); Sensor sensor2 = d.getSensor(2); Assert.assertNotNull(sensor2); Assert.assertTrue(sensor2.getName().equals("Sensor 2")); Assert.assertTrue(sensor2.getSensorID() == 2); Assert.assertTrue(sensor2 instanceof LevelSensor); Assert.assertTrue(sensor2.isRunning()); Sensor sensor3 = d.getSensor(3); Assert.assertNotNull(sensor3); Assert.assertTrue(sensor3.getName().equals("Sensor 3")); Assert.assertTrue(sensor3.getSensorID() == 3); Assert.assertTrue(sensor3 instanceof RangeSensor); Assert.assertTrue(sensor3.isRunning()); Sensor sensor4 = d.getSensor(4); Assert.assertNotNull(sensor4); Assert.assertTrue(sensor4.getName().equals("Sensor 4")); Assert.assertTrue(sensor4.getSensorID() == 4); Assert.assertTrue(sensor4 instanceof StateSensor); Assert.assertTrue(sensor4.isRunning()); }
@Test public void testSoftRestartNoXMLDoc() throws Exception { URI deploymentURI = AllTests.getAbsoluteFixturePath().resolve("deployment/doesntexist"); Deployer d = createDeployer(deploymentURI); try { d.softRestart(); Assert.fail("Expected an exception here.."); } catch (ControllerDefinitionNotFoundException e) { } }