Keep persisted disabled status when thing is removed (#493)

Also-By: Florian Stolte <fstolte@itemis.de>
Signed-off-by: Kai Kreuzer <kai@openhab.org>
This commit is contained in:
Kai Kreuzer 2019-01-30 11:37:51 +01:00 committed by Christoph Weitkamp
parent 5e2e7b1e16
commit 3b6dfbeddb
2 changed files with 4 additions and 3 deletions

View File

@ -484,7 +484,6 @@ public class ThingManagerImpl
}
}
storage.remove(thing.getUID().getAsString());
this.things.remove(thing);
}

View File

@ -913,7 +913,7 @@ public class ThingManagerOSGiJavaTest extends JavaOSGiTest {
}
@Test
public void testStorageEntryRemovedOnThingRemoval() throws Exception {
public void testStorageEntryRetainedOnThingRemoval() throws Exception {
registerThingTypeProvider();
AtomicReference<ThingHandlerCallback> thingHandlerCallback = new AtomicReference<>();
@ -981,8 +981,10 @@ public class ThingManagerOSGiJavaTest extends JavaOSGiTest {
new Thread((Runnable) () -> managedThingProvider.remove(THING.getUID())).start();
waitForAssert(() -> {
assertThat(storage.containsKey(THING_UID.getAsString()), is(false));
assertThat(thingRegistry.get(THING.getUID()), is(equalTo(null)));
}, SafeCaller.DEFAULT_TIMEOUT - 100, 50);
assertThat(storage.containsKey(THING_UID.getAsString()), is(true));
}
private void assertThingStatus(Map<String, Object> propsThing, Map<String, Object> propsChannel, ThingStatus status,