Merge remote-tracking branch 'origin/master'

This commit is contained in:
Konstantin Bulenkov
2014-07-23 15:46:07 +02:00
16 changed files with 208 additions and 204 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 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.
@@ -16,24 +16,23 @@
package com.intellij.debugger.settings;
import com.intellij.debugger.DebuggerBundle;
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.OptionsBundle;
import com.intellij.openapi.options.ConfigurableUi;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.ui.StateRestoringCheckBox;
import com.intellij.ui.components.panels.VerticalBox;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.awt.*;
public class DebuggerLaunchingConfigurable implements Configurable {
class DebuggerLaunchingConfigurable implements ConfigurableUi<DebuggerSettings> {
private JRadioButton myRbSocket;
private JRadioButton myRbShmem;
private StateRestoringCheckBox myCbForceClassicVM;
private JCheckBox myCbDisableJIT;
@Override
public void reset() {
final DebuggerSettings settings = DebuggerSettings.getInstance();
public void reset(@NotNull DebuggerSettings settings) {
if (!SystemInfo.isWindows) {
myRbSocket.setSelected(true);
myRbShmem.setEnabled(false);
@@ -52,8 +51,8 @@ public class DebuggerLaunchingConfigurable implements Configurable {
}
@Override
public void apply() {
getSettingsTo(DebuggerSettings.getInstance());
public void apply(@NotNull DebuggerSettings settings) {
getSettingsTo(settings);
}
private void getSettingsTo(DebuggerSettings settings) {
@@ -68,25 +67,15 @@ public class DebuggerLaunchingConfigurable implements Configurable {
}
@Override
public boolean isModified() {
final DebuggerSettings currentSettings = DebuggerSettings.getInstance();
final DebuggerSettings debuggerSettings = currentSettings.clone();
public boolean isModified(@NotNull DebuggerSettings currentSettings) {
DebuggerSettings debuggerSettings = currentSettings.clone();
getSettingsTo(debuggerSettings);
return !debuggerSettings.equals(currentSettings);
}
@NotNull
@Override
public String getDisplayName() {
return OptionsBundle.message("options.java.display.name");
}
@Override
public String getHelpTopic() {
return "reference.idesettings.debugger.launching";
}
@Override
public JComponent createComponent() {
public JComponent getComponent() {
myCbForceClassicVM = new StateRestoringCheckBox(DebuggerBundle.message("label.debugger.launching.configurable.force.classic.vm"));
myCbDisableJIT = new JCheckBox(DebuggerBundle.message("label.debugger.launching.configurable.disable.jit"));
myRbSocket = new JRadioButton(DebuggerBundle.message("label.debugger.launching.configurable.socket"));
@@ -110,12 +99,6 @@ public class DebuggerLaunchingConfigurable implements Configurable {
JPanel result = new JPanel(new BorderLayout());
result.add(panel, BorderLayout.NORTH);
return result;
}
@Override
public void disposeUIResources() {
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 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.
@@ -17,10 +17,7 @@ package com.intellij.debugger.settings;
import com.intellij.debugger.DebuggerBundle;
import com.intellij.debugger.ui.JavaDebuggerSupport;
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.OptionsBundle;
import com.intellij.openapi.options.SearchableConfigurable;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.options.ConfigurableUi;
import com.intellij.ui.classFilter.ClassFilterEditor;
import org.jetbrains.annotations.NotNull;
@@ -29,18 +26,16 @@ import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class DebuggerSteppingConfigurable implements SearchableConfigurable, Configurable.NoScroll {
class DebuggerSteppingConfigurable implements ConfigurableUi<DebuggerSettings> {
private JCheckBox myCbStepInfoFiltersEnabled;
private JCheckBox myCbSkipSyntheticMethods;
private JCheckBox myCbSkipConstructors;
private JCheckBox myCbSkipClassLoaders;
private ClassFilterEditor mySteppingFilterEditor;
private JCheckBox myCbSkipSimpleGetters;
private Project myProject;
@Override
public void reset() {
final DebuggerSettings settings = DebuggerSettings.getInstance();
public void reset(@NotNull DebuggerSettings settings) {
myCbSkipSimpleGetters.setSelected(settings.SKIP_GETTERS);
myCbSkipSyntheticMethods.setSelected(settings.SKIP_SYNTHETIC_METHODS);
myCbSkipConstructors.setSelected(settings.SKIP_CONSTRUCTORS);
@@ -50,13 +45,11 @@ public class DebuggerSteppingConfigurable implements SearchableConfigurable, Con
mySteppingFilterEditor.setFilters(settings.getSteppingFilters());
mySteppingFilterEditor.setEnabled(settings.TRACING_FILTERS_ENABLED);
}
@Override
public void apply() {
getSettingsTo(DebuggerSettings.getInstance());
public void apply(@NotNull DebuggerSettings settings) {
getSettingsTo(settings);
}
private void getSettingsTo(DebuggerSettings settings) {
@@ -71,39 +64,16 @@ public class DebuggerSteppingConfigurable implements SearchableConfigurable, Con
}
@Override
public boolean isModified() {
final DebuggerSettings currentSettings = DebuggerSettings.getInstance();
final DebuggerSettings debuggerSettings = currentSettings.clone();
public boolean isModified(@NotNull DebuggerSettings currentSettings) {
DebuggerSettings debuggerSettings = currentSettings.clone();
getSettingsTo(debuggerSettings);
return !debuggerSettings.equals(currentSettings);
}
@Override
public String getDisplayName() {
return OptionsBundle.message("options.java.display.name");
}
@Override
@NotNull
public String getHelpTopic() {
return "reference.idesettings.debugger.stepping";
}
@Override
@NotNull
public String getId() {
return getHelpTopic();
}
@Override
public Runnable enableSearch(String option) {
return null;
}
@Override
public JComponent createComponent() {
public JComponent getComponent() {
final JPanel panel = new JPanel(new GridBagLayout());
myProject = JavaDebuggerSupport.getContextProjectForEditorFieldsInDebuggerConfigurables();
myCbSkipSyntheticMethods = new JCheckBox(DebuggerBundle.message("label.debugger.general.configurable.skip.synthetic.methods"));
myCbSkipConstructors = new JCheckBox(DebuggerBundle.message("label.debugger.general.configurable.skip.constructors"));
myCbSkipClassLoaders = new JCheckBox(DebuggerBundle.message("label.debugger.general.configurable.skip.classLoaders"));
@@ -115,7 +85,7 @@ public class DebuggerSteppingConfigurable implements SearchableConfigurable, Con
panel.add(myCbSkipSimpleGetters, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0),0, 0));
panel.add(myCbStepInfoFiltersEnabled, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(8, 0, 0, 0),0, 0));
mySteppingFilterEditor = new ClassFilterEditor(myProject, null, "reference.viewBreakpoints.classFilters.newPattern");
mySteppingFilterEditor = new ClassFilterEditor(JavaDebuggerSupport.getContextProjectForEditorFieldsInDebuggerConfigurables(), null, "reference.viewBreakpoints.classFilters.newPattern");
panel.add(mySteppingFilterEditor, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 5, 0, 0),0, 0));
myCbStepInfoFiltersEnabled.addActionListener(new ActionListener() {
@@ -126,11 +96,4 @@ public class DebuggerSteppingConfigurable implements SearchableConfigurable, Con
});
return panel;
}
@Override
public void disposeUIResources() {
mySteppingFilterEditor = null;
myProject = null;
}
}
}
@@ -16,6 +16,9 @@
package com.intellij.debugger.settings;
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.OptionsBundle;
import com.intellij.openapi.options.SimpleConfigurable;
import com.intellij.openapi.util.Getter;
import com.intellij.xdebugger.settings.XDebuggerSettings;
import org.jdom.Element;
import org.jetbrains.annotations.NotNull;
@@ -36,13 +39,21 @@ class JavaDebuggerSettings extends XDebuggerSettings<Element> {
@Nullable
@Override
public Configurable createConfigurable(@NotNull Category category) {
final Getter<DebuggerSettings> debuggerSettingsGetter = new Getter<DebuggerSettings>() {
@Override
public DebuggerSettings get() {
return DebuggerSettings.getInstance();
}
};
switch (category) {
case ROOT:
return new DebuggerLaunchingConfigurable();
return SimpleConfigurable.create("reference.idesettings.debugger.launching", OptionsBundle.message("options.java.display.name"),
DebuggerLaunchingConfigurable.class, debuggerSettingsGetter);
case DATA_VIEWS:
return new DebuggerDataViewsConfigurable(null);
case STEPPING:
return new DebuggerSteppingConfigurable();
return SimpleConfigurable.create("reference.idesettings.debugger.stepping", OptionsBundle.message("options.java.display.name"), DebuggerSteppingConfigurable.class, debuggerSettingsGetter);
}
return null;
}
@@ -831,6 +831,7 @@ public class SingleInspectionProfilePanel extends JPanel {
final ToolbarDecorator wrappedTable = ToolbarDecorator.createDecorator(scopesAndScopesAndSeveritiesTable);
final JPanel panel = wrappedTable.createPanel();
panel.setMinimumSize(new Dimension(getMinimumSize().width, 3 * scopesAndScopesAndSeveritiesTable.getRowHeight()));
severityPanel.add(new JBLabel("Scopes & Severities"),
new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
new Insets(5, 0, 2, 10), 0, 0));
@@ -952,25 +952,18 @@ public class IdeEventQueue extends EventQueue {
}
private static class WindowsAltSupressor implements EventDispatcher {
private boolean myPureAltWasPressed;
private boolean myWaitingForAltRelease;
private boolean myWaiterScheduled;
private Robot myRobot;
@Override
public boolean dispatch(AWTEvent e) {
boolean dispatch = true;
if (!Registry.is("actionSystem.win.suppressAlt.new") && e instanceof KeyEvent) {
if (e instanceof KeyEvent) {
KeyEvent ke = (KeyEvent)e;
final Component component = ke.getComponent();
final Window window = component == null ? null : SwingUtilities.windowForComponent(component);
boolean pureAlt = ke.getKeyCode() == KeyEvent.VK_ALT && (ke.getModifiers() | InputEvent.ALT_MASK) == InputEvent.ALT_MASK;
if (!pureAlt) {
myPureAltWasPressed = false;
myWaitingForAltRelease = false;
myWaiterScheduled = false;
}
else {
if (ApplicationManager.getApplication() == null ||
@@ -978,28 +971,25 @@ public class IdeEventQueue extends EventQueue {
!SystemInfo.isWindows ||
!Registry.is("actionSystem.win.suppressAlt") ||
!(UISettings.getInstance().HIDE_TOOL_STRIPES || UISettings.getInstance().PRESENTATION_MODE)) {
return !dispatch;
return true;
}
if (ke.getID() == KeyEvent.KEY_PRESSED) {
myPureAltWasPressed = true;
dispatch = !myWaitingForAltRelease;
}
else if (ke.getID() == KeyEvent.KEY_RELEASED) {
if (myWaitingForAltRelease) {
myPureAltWasPressed = false;
myWaitingForAltRelease = false;
myWaiterScheduled = false;
dispatch = false;
}
else {
myWaiterScheduled = true;
else if (component != null) {
//noinspection SSBasedInspection
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
try {
if (SystemInfo.isWindows || window == null || !window.isActive()) {
final Window window = component instanceof Window ? (Window)component : SwingUtilities.windowForComponent(component);
if (window == null || !window.isActive()) {
return;
}
myWaitingForAltRelease = true;
@@ -1,18 +1,64 @@
/*
* 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.
*/
package com.intellij.openapi.options;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
public abstract class ConfigurableBase<UI extends ConfigurableUi<S>, S> implements SearchableConfigurable, Configurable.NoScroll {
private final String id;
private final String displayName;
private final String helpTopic;
private UI ui;
protected ConfigurableBase(@NotNull String id, @NotNull String displayName, @Nullable String helpTopic) {
this.id = id;
this.displayName = displayName;
this.helpTopic = helpTopic;
}
@NotNull
@Override
public final String getId() {
return id;
}
@Nls
@Override
public final String getDisplayName() {
return displayName;
}
@Nullable
@Override
public final String getHelpTopic() {
return helpTopic;
}
@Nullable
@Override
public Runnable enableSearch(String option) {
return null;
}
@NotNull
protected abstract S getSettings();
@Override
@@ -1,3 +1,18 @@
/*
* 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.
*/
package com.intellij.openapi.options;
import org.jetbrains.annotations.NotNull;
@@ -0,0 +1,52 @@
/*
* 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.
*/
package com.intellij.openapi.options;
import com.intellij.openapi.util.Getter;
import com.intellij.util.ReflectionUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public final class SimpleConfigurable<UI extends ConfigurableUi<S>, S> extends ConfigurableBase<UI, S> {
private final Class<UI> uiClass;
private final Getter<S> settingsGetter;
private SimpleConfigurable(@NotNull String id, @NotNull String displayName, @Nullable String helpTopic, @NotNull Class<UI> uiClass, @NotNull Getter<S> settingsGetter) {
super(id, displayName, helpTopic);
this.uiClass = uiClass;
this.settingsGetter = settingsGetter;
}
public static <UI extends ConfigurableUi<S>, S> SimpleConfigurable<UI, S> create(@NotNull String id, @NotNull String displayName, @Nullable String helpTopic, @NotNull Class<UI> uiClass, @NotNull Getter<S> settingsGetter) {
return new SimpleConfigurable<UI, S>(id, displayName, helpTopic, uiClass, settingsGetter);
}
public static <UI extends ConfigurableUi<S>, S> SimpleConfigurable<UI, S> create(@NotNull String id, @NotNull String displayName, @NotNull Class<UI> uiClass, @NotNull Getter<S> settingsGetter) {
return create(id, displayName, id, uiClass, settingsGetter);
}
@NotNull
@Override
protected S getSettings() {
return settingsGetter.get();
}
@Override
protected UI createUi() {
return ReflectionUtil.newInstance(uiClass);
}
}
@@ -426,6 +426,25 @@ public class ReflectionUtil {
}
}
/**
* {@link Class#newInstance()} cannot instantiate private classes
*/
public static <T> T newInstance(@NotNull Class<T> aClass) {
try {
Constructor<T> constructor = aClass.getDeclaredConstructor();
try {
constructor.setAccessible(true);
}
catch (SecurityException e) {
return aClass.newInstance();
}
return constructor.newInstance();
}
catch (Exception e) {
throw new RuntimeException(e);
}
}
@NotNull
public static <T> T createInstance(@NotNull Constructor<T> constructor, @NotNull Object... args) {
try {
@@ -16,13 +16,13 @@
package com.intellij.util.xmlb;
import com.intellij.openapi.util.Pair;
import com.intellij.util.ReflectionUtil;
import org.jdom.*;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.lang.annotation.Annotation;
import java.lang.ref.SoftReference;
import java.lang.reflect.Constructor;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.*;
@@ -184,16 +184,9 @@ class XmlSerializerImpl {
/**
* {@link Class#newInstance()} cannot instantiate private classes
*/
static <T> T newInstance(Class<T> aClass) {
static <T> T newInstance(@NotNull Class<T> aClass) {
try {
Constructor<T> constructor = aClass.getDeclaredConstructor();
try {
constructor.setAccessible(true);
}
catch (SecurityException e) {
return aClass.newInstance();
}
return constructor.newInstance();
return ReflectionUtil.newInstance(aClass);
}
catch (Exception e) {
throw new XmlSerializationException(e);
@@ -1,51 +0,0 @@
/*
* 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.
*/
package com.intellij.xdebugger.impl.settings;
import com.intellij.openapi.options.ConfigurableBase;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
class GeneralConfigurable extends ConfigurableBase<GeneralConfigurableUi, XDebuggerGeneralSettings> {
@Override
protected XDebuggerGeneralSettings getSettings() {
return XDebuggerSettingsManager.getInstanceImpl().getGeneralSettings();
}
@Override
protected GeneralConfigurableUi createUi() {
return new GeneralConfigurableUi();
}
@NotNull
@Override
public String getId() {
return "debugger.general";
}
@Nls
@Override
public String getDisplayName() {
return "";
}
@Nullable
@Override
public String getHelpTopic() {
return null;
}
}
@@ -16,6 +16,8 @@
package com.intellij.xdebugger.impl.settings;
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.SimpleConfigurable;
import com.intellij.openapi.util.Getter;
import com.intellij.util.SmartList;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.xdebugger.settings.XDebuggerSettings;
@@ -43,7 +45,12 @@ public class XDebuggerSettingsPanelProviderImpl extends DebuggerSettingsPanelPro
public Collection<? extends Configurable> getConfigurable(@NotNull XDebuggerSettings.Category category) {
List<Configurable> list;
if (category == XDebuggerSettings.Category.ROOT) {
list = new SmartList<Configurable>(new GeneralConfigurable());
list = new SmartList<Configurable>(SimpleConfigurable.create("debugger.general", "", GeneralConfigurableUi.class, new Getter<XDebuggerGeneralSettings>() {
@Override
public XDebuggerGeneralSettings get() {
return XDebuggerSettingsManager.getInstanceImpl().getGeneralSettings();
}
}));
}
else {
list = null;
@@ -19,11 +19,14 @@ import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
import com.intellij.openapi.components.StoragePathMacros;
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.SimpleConfigurable;
import com.intellij.openapi.util.Getter;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.util.xmlb.XmlSerializerUtil;
import com.intellij.xdebugger.settings.XDebuggerSettings;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.groovy.GroovyBundle;
/**
* @author ilyas
@@ -35,7 +38,7 @@ import org.jetbrains.annotations.Nullable;
file = StoragePathMacros.APP_CONFIG + "/groovy_debug.xml"
)}
)
public class GroovyDebuggerSettings extends XDebuggerSettings<GroovyDebuggerSettings> {
public class GroovyDebuggerSettings extends XDebuggerSettings<GroovyDebuggerSettings> implements Getter<GroovyDebuggerSettings> {
public Boolean DEBUG_DISABLE_SPECIFIC_GROOVY_METHODS = true;
public boolean ENABLE_GROOVY_HOTSWAP = Registry.is("enable.groovy.hotswap");
@@ -53,7 +56,7 @@ public class GroovyDebuggerSettings extends XDebuggerSettings<GroovyDebuggerSett
@Override
public Configurable createConfigurable(@NotNull Category category) {
if (category == Category.STEPPING) {
return new GroovySteppingConfigurable();
return SimpleConfigurable.create("reference.idesettings.debugger.groovy", GroovyBundle.message("groovy.debug.caption"), GroovySteppingConfigurableUi.class, this);
}
return null;
}
@@ -71,4 +74,9 @@ public class GroovyDebuggerSettings extends XDebuggerSettings<GroovyDebuggerSett
public static GroovyDebuggerSettings getInstance() {
return getInstance(GroovyDebuggerSettings.class);
}
@Override
public GroovyDebuggerSettings get() {
return this;
}
}
@@ -1,37 +0,0 @@
package org.jetbrains.plugins.groovy.debugger;
import com.intellij.openapi.options.ConfigurableBase;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.groovy.GroovyBundle;
class GroovySteppingConfigurable extends ConfigurableBase<GroovySteppingConfigurableUi, GroovyDebuggerSettings> {
@Override
protected GroovyDebuggerSettings getSettings() {
return GroovyDebuggerSettings.getInstance();
}
@Override
protected GroovySteppingConfigurableUi createUi() {
return new GroovySteppingConfigurableUi();
}
@NotNull
@Override
public String getId() {
return "debugger.stepping.groovy";
}
@Nls
@Override
public String getDisplayName() {
return GroovyBundle.message("groovy.debug.caption");
}
@Nullable
@Override
public String getHelpTopic() {
return "reference.idesettings.debugger.groovy";
}
}
@@ -172,7 +172,7 @@ public class JUnitConfigurationModel {
final JUnitConfiguration.Data data = configuration.getPersistentData();
setTestType(data.TEST_OBJECT);
setJUnitTextValue(ALL_IN_PACKAGE, data.getPackageName());
setJUnitTextValue(CLASS, data.getMainClassName().replaceAll("\\$", "\\."));
setJUnitTextValue(CLASS, data.getMainClassName() != null ? data.getMainClassName().replaceAll("\\$", "\\.") : "");
setJUnitTextValue(METHOD, data.getMethodName());
setJUnitTextValue(PATTERN, data.getPatternPresentation());
setJUnitTextValue(DIR, data.getDirName());
@@ -29,16 +29,20 @@ public class TrelloIntegrationTest extends LiveIntegrationTestCase<TrelloReposit
@Override
protected TrelloRepository createRepository() throws Exception {
TrelloRepository repository = new TrelloRepository(new TrelloRepositoryType());
String token = System.getProperty("tasks.tests.trello.token");
if (StringUtil.isEmpty(token)) {
throw new AssertionError("Authorization token is not set");
try {
TrelloRepository repository = new TrelloRepository(new TrelloRepositoryType());
String token = System.getProperty("tasks.tests.trello.token");
assertTrue("Authorization token is not set", !StringUtil.isEmpty(token));
repository.setPassword(token);
TrelloUser user = repository.fetchUserByToken();
assertNotNull(user);
repository.setCurrentUser(user);
return repository;
}
catch (AssertionError ae){
tearDown();
throw ae;
}
repository.setPassword(token);
TrelloUser user = repository.fetchUserByToken();
assertNotNull(user);
repository.setCurrentUser(user);
return repository;
}
// TODO Check closed tasks exclusion