fix ConvertingOldDetectionExcludesTest, remove invalid comment

This commit is contained in:
Vladimir Krivosheev
2017-12-20 11:53:02 +01:00
parent d1fa37b84c
commit 253ca2e646
4 changed files with 10 additions and 18 deletions
@@ -1040,7 +1040,6 @@ open class RunManagerImpl(internal val project: Project) : RunManagerEx(), Persi
}
}
// open for Upsource (UpsourceRunManager overrides to disable loadState (empty impl))
@State(name = "ProjectRunConfigurationManager")
internal class IprRunManagerImpl(private val project: Project) : PersistentStateComponent<Element> {
val lastLoadedState = AtomicReference<Element>()
@@ -5,7 +5,6 @@ package com.intellij.framework.detection.impl.exclude;
import com.intellij.framework.FrameworkType;
import com.intellij.framework.detection.DetectionExcludesConfiguration;
import com.intellij.framework.detection.impl.exclude.old.DisabledAutodetectionInfo;
import com.intellij.framework.detection.impl.exclude.old.OldFacetDetectionExcludesConfiguration;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.components.PersistentStateComponent;
@@ -96,7 +95,7 @@ public class DetectionExcludesConfigurationImpl extends DetectionExcludesConfigu
private void markAsConverted() {
myConverted = true;
OldFacetDetectionExcludesConfiguration.getInstance(myProject).loadState(new DisabledAutodetectionInfo());
OldFacetDetectionExcludesConfiguration.getInstance(myProject).unsetState();
}
private void ensureOldSettingsLoaded() {
@@ -48,6 +48,10 @@ public class OldFacetDetectionExcludesConfiguration implements PersistentStateCo
myDisabledAutodetectionInfo = state;
}
public void unsetState() {
myDisabledAutodetectionInfo = null;
}
@Nullable
public ExcludesConfigurationState convert() {
if (myDisabledAutodetectionInfo == null || myDisabledAutodetectionInfo.getElements().isEmpty()) {
@@ -1,17 +1,5 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
*/
package com.intellij.framework.detection;
@@ -26,6 +14,8 @@ import com.intellij.testFramework.PlatformTestCase;
import com.intellij.testFramework.PsiTestUtil;
import com.intellij.testFramework.TempFiles;
import static com.intellij.testFramework.assertions.Assertions.assertThat;
/**
* @author nik
*/
@@ -81,10 +71,10 @@ public class ConvertingOldDetectionExcludesTest extends PlatformTestCase {
getNewConfiguration().loadState(state);
assertTrue(isFileExcluded(file));
assertNull(getOldConfiguration().getState());
assertThat(getOldConfiguration().getState()).isNull();
final ExcludesConfigurationState newState = getNewConfiguration().getState();
assertNotNull(newState);
assertOneElement(newState.getFiles());
assertThat(newState.getFiles()).hasSize(1);
}
private boolean isFileExcluded(VirtualFile file) {