mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
JUnit and TEstNG — move VM_PARAMETERS default to code, data — do not write defaults
This commit is contained in:
@@ -22,10 +22,7 @@ import com.intellij.openapi.module.ModuleManager;
|
||||
import com.intellij.openapi.options.SettingsEditor;
|
||||
import com.intellij.openapi.options.SettingsEditorGroup;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.DefaultJDOMExternalizer;
|
||||
import com.intellij.openapi.util.InvalidDataException;
|
||||
import com.intellij.openapi.util.WriteExternalException;
|
||||
import com.intellij.openapi.util.*;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.*;
|
||||
@@ -213,7 +210,7 @@ public class JUnitConfiguration extends JavaTestConfigurationBase {
|
||||
|
||||
@Override
|
||||
public void setVMParameters(@Nullable String value) {
|
||||
myData.setVMParameters(value);
|
||||
myData.setVMParameters(StringUtil.nullize(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -446,7 +443,7 @@ public class JUnitConfiguration extends JavaTestConfigurationBase {
|
||||
JavaRunConfigurationExtensionManager.getInstance().writeExternal(this, element);
|
||||
DefaultJDOMExternalizer.writeExternal(this, element);
|
||||
final Data persistentData = getPersistentData();
|
||||
DefaultJDOMExternalizer.writeExternal(persistentData, element);
|
||||
DefaultJDOMExternalizer.writeExternal(persistentData, element, new DifferenceFilter<>(persistentData, new Data()));
|
||||
|
||||
if (!persistentData.getEnvs().isEmpty()) {
|
||||
EnvironmentVariablesComponent.writeExternal(element, persistentData.getEnvs());
|
||||
@@ -572,7 +569,7 @@ public class JUnitConfiguration extends JavaTestConfigurationBase {
|
||||
private String[] UNIQUE_ID = ArrayUtil.EMPTY_STRING_ARRAY;
|
||||
private String TAGS;
|
||||
public String TEST_OBJECT = TEST_CLASS;
|
||||
public String VM_PARAMETERS;
|
||||
public String VM_PARAMETERS = "-ea";
|
||||
public String PARAMETERS;
|
||||
public String WORKING_DIRECTORY;
|
||||
public boolean PASS_PARENT_ENVS = true;
|
||||
|
||||
+2
-16
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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-2018 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.theoryinpractice.testng.configuration;
|
||||
|
||||
@@ -131,7 +117,7 @@ public class SearchingForTestsTask extends SearchForTestsTask {
|
||||
int logLevel = 1;
|
||||
try {
|
||||
final Properties properties = new Properties();
|
||||
properties.load(new ByteArrayInputStream(myConfig.getPersistantData().VM_PARAMETERS.getBytes()));
|
||||
properties.load(new ByteArrayInputStream(myConfig.getVMParameters().getBytes()));
|
||||
final String verbose = properties.getProperty("-Dtestng.verbose");
|
||||
if (verbose != null) {
|
||||
logLevel = Integer.parseInt(verbose);
|
||||
|
||||
+3
-4
@@ -1,6 +1,4 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
// Copyright 2000-2018 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.theoryinpractice.testng.configuration;
|
||||
|
||||
@@ -20,6 +18,7 @@ import com.intellij.openapi.options.SettingsEditor;
|
||||
import com.intellij.openapi.options.SettingsEditorGroup;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.DefaultJDOMExternalizer;
|
||||
import com.intellij.openapi.util.DifferenceFilter;
|
||||
import com.intellij.openapi.util.WriteExternalException;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.*;
|
||||
@@ -344,7 +343,7 @@ public class TestNGConfiguration extends JavaTestConfigurationBase {
|
||||
super.writeExternal(element);
|
||||
JavaRunConfigurationExtensionManager.getInstance().writeExternal(this, element);
|
||||
DefaultJDOMExternalizer.writeExternal(this, element);
|
||||
DefaultJDOMExternalizer.writeExternal(getPersistantData(), element);
|
||||
DefaultJDOMExternalizer.writeExternal(getPersistantData(), element, new DifferenceFilter<>(getPersistantData(), new TestData()));
|
||||
EnvironmentVariablesComponent.writeExternal(element, getPersistantData().getEnvs());
|
||||
|
||||
Element propertiesElement = element.getChild("properties");
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
// Copyright 2000-2018 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.theoryinpractice.testng.model;
|
||||
|
||||
import com.intellij.execution.ExternalizablePath;
|
||||
@@ -11,9 +9,11 @@ import com.intellij.execution.junit2.info.MethodLocation;
|
||||
import com.intellij.execution.testframework.TestSearchScope;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiMethod;
|
||||
import com.intellij.psi.PsiPackage;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@@ -28,7 +28,8 @@ public class TestData implements Cloneable
|
||||
public String METHOD_NAME;
|
||||
public String GROUP_NAME;
|
||||
public String TEST_OBJECT;
|
||||
public String VM_PARAMETERS;
|
||||
// should be private, but for now we use DefaultJDOMExternalizer, so, public
|
||||
public String VM_PARAMETERS = "-ea";
|
||||
public String PARAMETERS;
|
||||
public String WORKING_DIRECTORY;
|
||||
public String OUTPUT_DIRECTORY;
|
||||
@@ -81,8 +82,8 @@ public class TestData implements Cloneable
|
||||
return OUTPUT_DIRECTORY == null ? "" : OUTPUT_DIRECTORY;
|
||||
}
|
||||
|
||||
public void setVMParameters(String value) {
|
||||
VM_PARAMETERS = value;
|
||||
public void setVMParameters(@Nullable String value) {
|
||||
VM_PARAMETERS = StringUtil.nullize(value);
|
||||
}
|
||||
|
||||
public String getVMParameters() {
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
<component>
|
||||
<configuration name="<template>" type="JUnit" default="true" selected="false">
|
||||
<option name="VM_PARAMETERS" value="-ea"/>
|
||||
<configuration name="<template>" type="D" default="true" selected="false">
|
||||
<option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
|
||||
</configuration>
|
||||
|
||||
<configuration name="<template>" type="TestNG" default="true" selected="false">
|
||||
<option name="VM_PARAMETERS" value="-ea"/>
|
||||
<option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%"/>
|
||||
</configuration>
|
||||
</component>
|
||||
|
||||
Reference in New Issue
Block a user