simplification — introduce StateSplitterEx

This commit is contained in:
Vladimir Krivosheev
2014-10-30 10:50:35 +01:00
parent e3a8f92684
commit a1b6f5c8aa
16 changed files with 341 additions and 390 deletions
@@ -1,20 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<config>
<profiles>
<profile version="1.0" is_locked="false">
<option name="myName" value="Project Default" />
<option name="myLocal" value="false" />
</profile>
<profile version="1.0" is_locked="false">
<option name="myName" value="p1" />
<option name="myLocal" value="false" />
<inspection_tool class="ConstantConditions" enabled="true" level="WARNING" enabled_by_default="true">
<option name="SUGGEST_NULLABLE_ANNOTATIONS" value="true" />
<option name="DONT_REPORT_TRUE_ASSERT_STATEMENTS" value="true" />
</inspection_tool>
</profile>
</profiles>
<option name="PROJECT_PROFILE" value="p1" />
<option name="USE_PROJECT_PROFILE" value="true" />
<version value="1.0" />
</config>
<state>
<profile version="1.0" is_locked="false">
<option name="myName" value="Project Default"/>
<option name="myLocal" value="false"/>
</profile>
<profile version="1.0" is_locked="false">
<option name="myName" value="p1"/>
<option name="myLocal" value="false"/>
<inspection_tool class="ConstantConditions" enabled="true" level="WARNING" enabled_by_default="true">
<option name="SUGGEST_NULLABLE_ANNOTATIONS" value="true"/>
<option name="DONT_REPORT_TRUE_ASSERT_STATEMENTS" value="true"/>
</inspection_tool>
</profile>
<option name="PROJECT_PROFILE" value="p1"/>
<option name="USE_PROJECT_PROFILE" value="true"/>
<version value="1.0"/>
</state>
@@ -59,7 +59,6 @@
</component>
<component name="InspectionProjectProfileManager">
<option name="PROJECT_PROFILE" value="p1" />
<profiles>
<profile version="1.0" is_locked="false">
<option name="myName" value="Project Default" />
<option name="myLocal" value="false" />
@@ -72,7 +71,6 @@
<option name="DONT_REPORT_TRUE_ASSERT_STATEMENTS" value="true" />
</inspection_tool>
</profile>
</profiles>
<list size="5">
<item index="0" class="java.lang.String" itemvalue="TYPO" />
<item index="1" class="java.lang.String" itemvalue="SERVER PROBLEM" />
@@ -1,24 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<config>
<profiles>
<profile version="1.0" is_locked="false">
<option name="myName" value="Project Default" />
<option name="myLocal" value="false" />
</profile>
<profile version="1.0" is_locked="false">
<option name="myName" value="p1" />
<option name="myLocal" value="false" />
<inspection_tool class="ConstantConditions" enabled="true" level="WARNING" enabled_by_default="true">
<scope name="Production" level="WARNING" enabled="true">
<option name="SUGGEST_NULLABLE_ANNOTATIONS" value="false" />
<option name="DONT_REPORT_TRUE_ASSERT_STATEMENTS" value="false" />
</scope>
<option name="SUGGEST_NULLABLE_ANNOTATIONS" value="true" />
<option name="DONT_REPORT_TRUE_ASSERT_STATEMENTS" value="true" />
</inspection_tool>
</profile>
</profiles>
<option name="PROJECT_PROFILE" value="p1" />
<option name="USE_PROJECT_PROFILE" value="true" />
<version value="1.0" />
</config>
<state>
<profile version="1.0" is_locked="false">
<option name="myName" value="Project Default"/>
<option name="myLocal" value="false"/>
</profile>
<profile version="1.0" is_locked="false">
<option name="myName" value="p1"/>
<option name="myLocal" value="false"/>
<inspection_tool class="ConstantConditions" enabled="true" level="WARNING" enabled_by_default="true">
<scope name="Production" level="WARNING" enabled="true">
<option name="SUGGEST_NULLABLE_ANNOTATIONS" value="false"/>
<option name="DONT_REPORT_TRUE_ASSERT_STATEMENTS" value="false"/>
</scope>
<option name="SUGGEST_NULLABLE_ANNOTATIONS" value="true"/>
<option name="DONT_REPORT_TRUE_ASSERT_STATEMENTS" value="true"/>
</inspection_tool>
</profile>
<option name="PROJECT_PROFILE" value="p1"/>
<option name="USE_PROJECT_PROFILE" value="true"/>
<version value="1.0"/>
</state>
@@ -62,7 +62,6 @@
<scopes>
<scope profile="Project Default" name="Production" />
</scopes>
<profiles>
<profile version="1.0" is_locked="false">
<option name="myName" value="Project Default" />
<option name="myLocal" value="false" />
@@ -75,7 +74,6 @@
<option name="DONT_REPORT_TRUE_ASSERT_STATEMENTS" value="true" />
</inspection_tool>
</profile>
</profiles>
<list size="5">
<item index="0" class="java.lang.String" itemvalue="TYPO" />
<item index="1" class="java.lang.String" itemvalue="SERVER PROBLEM" />
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
* Copyright 2000-2014 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.
@@ -25,7 +25,6 @@ import com.intellij.testFramework.PlatformTestUtil;
import org.jdom.Element;
import java.io.File;
import java.util.List;
/**
* @author anna
@@ -44,17 +43,13 @@ public class InspectionProfilesConverterTest extends LightIdeaTestCase {
try {
final String relativePath = "/inspection/converter/";
final File projectFile = new File(JavaTestUtil.getJavaTestDataPath() + relativePath + dirName + "/options.ipr");
final List children = JDOMUtil.loadDocument(projectFile).getRootElement().getChildren("component");
for (Object child : children) {
final Element element = (Element)child;
for (Element element : JDOMUtil.loadDocument(projectFile).getRootElement().getChildren("component")) {
if (Comparing.strEqual(element.getAttributeValue("name"), "InspectionProjectProfileManager")) {
final InspectionProjectProfileManager profileManager = InspectionProjectProfileManager.getInstance(getProject());
InspectionProfileImpl.INIT_INSPECTIONS = true;
profileManager.readExternal(element);
profileManager.loadState(element);
final Element configElement = new Element("config");
profileManager.writeExternal(configElement);
Element configElement = profileManager.getState();
final File file = new File(JavaTestUtil.getJavaTestDataPath() + relativePath + dirName + "/options.after.xml");
PlatformTestUtil.assertElementsEqual(configElement, JDOMUtil.loadDocument(file).getRootElement());
break;