From ecfff82dc04992fa887db29b05954be14e7625f4 Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Wed, 2 Sep 2015 13:23:11 +0200 Subject: [PATCH] enable use.loaded.state.as.existing in tests --- .../configuration-store-impl/src/ComponentStoreImpl.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/platform/configuration-store-impl/src/ComponentStoreImpl.kt b/platform/configuration-store-impl/src/ComponentStoreImpl.kt index dcd128e91820..5683648a6a49 100644 --- a/platform/configuration-store-impl/src/ComponentStoreImpl.kt +++ b/platform/configuration-store-impl/src/ComponentStoreImpl.kt @@ -248,7 +248,12 @@ abstract class ComponentStoreImpl : IComponentStore { } val storage = storageManager.getStateStorage(storageSpec) - var stateGetter = if (isUseLoadedStateAsExisting(storageSpec) && Registry.`is`("use.loaded.state.as.existing", false)) (storage as? StorageBaseEx<*>)?.createGetSession(component, name, stateClass) else null + var stateGetter = if (isUseLoadedStateAsExisting(storageSpec) && (ApplicationManager.getApplication().isUnitTestMode() || Registry.`is`("use.loaded.state.as.existing", false))) { + (storage as? StorageBaseEx<*>)?.createGetSession(component, name, stateClass) + } + else { + null + } var state = if (stateGetter == null) storage.getState(component, name, stateClass, defaultState, reloadData) else stateGetter.getState(defaultState) if (state == null) { if (changedStorages != null && changedStorages.contains(storage)) {