mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
+10
-10
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 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.
|
||||
@@ -29,6 +29,7 @@ import com.intellij.openapi.util.text.StringUtil;
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public class JavaTestUtil {
|
||||
private static final String TEST_JDK_NAME = "JDK";
|
||||
|
||||
public static String getJavaTestDataPath() {
|
||||
return PathManagerEx.getTestDataPath();
|
||||
@@ -43,12 +44,14 @@ public class JavaTestUtil {
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Sdk jdk = ProjectJdkTable.getInstance().findJdk("JDK");
|
||||
ProjectJdkTable jdkTable = ProjectJdkTable.getInstance();
|
||||
|
||||
Sdk jdk = jdkTable.findJdk(TEST_JDK_NAME);
|
||||
if (jdk != null) {
|
||||
ProjectJdkTable.getInstance().removeJdk(jdk);
|
||||
jdkTable.removeJdk(jdk);
|
||||
}
|
||||
|
||||
ProjectJdkTable.getInstance().addJdk(getTestJdk());
|
||||
jdkTable.addJdk(getTestJdk());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -56,14 +59,11 @@ public class JavaTestUtil {
|
||||
public static Sdk getTestJdk() {
|
||||
try {
|
||||
ProjectJdkImpl jdk = (ProjectJdkImpl)JavaAwareProjectJdkTableImpl.getInstanceEx().getInternalJdk().clone();
|
||||
jdk.setName("JDK");
|
||||
jdk.setName(TEST_JDK_NAME);
|
||||
return jdk;
|
||||
}
|
||||
catch (CloneNotSupportedException e) {
|
||||
//LOG.error(e);
|
||||
return null;
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 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.
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.intellij.debugger;
|
||||
|
||||
import com.intellij.JavaTestUtil;
|
||||
import com.intellij.debugger.engine.DebugProcessImpl;
|
||||
import com.intellij.debugger.engine.JavaDebugProcess;
|
||||
import com.intellij.debugger.engine.RemoteStateState;
|
||||
@@ -69,17 +70,11 @@ import java.util.StringTokenizer;
|
||||
|
||||
public abstract class DebuggerTestCase extends ExecutionWithDebuggerToolsTestCase {
|
||||
protected DebuggerSession myDebuggerSession;
|
||||
private StringBuffer myConsoleBuffer;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initApplication() throws Exception {
|
||||
super.initApplication();
|
||||
setTestJDK();
|
||||
JavaTestUtil.setupTestJDK();
|
||||
DebuggerSettings.getInstance().DEBUGGER_TRANSPORT = DebuggerSettings.SOCKET_TRANSPORT;
|
||||
DebuggerSettings.getInstance().SKIP_CONSTRUCTORS = false;
|
||||
DebuggerSettings.getInstance().SKIP_GETTERS = false;
|
||||
@@ -97,11 +92,6 @@ public abstract class DebuggerTestCase extends ExecutionWithDebuggerToolsTestCas
|
||||
assertNull(DebuggerManagerEx.getInstanceEx(myProject).getDebugProcess(getDebugProcess().getProcessHandler()));
|
||||
myDebuggerSession = null;
|
||||
}
|
||||
if(myConsoleBuffer != null) {
|
||||
//println("", b);
|
||||
//println("Console output:", b);
|
||||
//println(myConsoleBuffer.toString(), b);
|
||||
}
|
||||
checkTestOutput();
|
||||
}
|
||||
|
||||
@@ -121,7 +111,6 @@ public abstract class DebuggerTestCase extends ExecutionWithDebuggerToolsTestCas
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
FileEditorManagerEx.getInstanceEx(getProject()).closeAllFiles();
|
||||
myConsoleBuffer = null;
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
@@ -180,12 +169,9 @@ public abstract class DebuggerTestCase extends ExecutionWithDebuggerToolsTestCas
|
||||
}, ModalityState.defaultModalityState());
|
||||
myDebugProcess = myDebuggerSession.getProcess();
|
||||
|
||||
//myConsoleBuffer = new StringBuffer();
|
||||
|
||||
myDebugProcess.addProcessListener(new ProcessAdapter() {
|
||||
@Override
|
||||
public void onTextAvailable(ProcessEvent event, Key outputType) {
|
||||
//myConsoleBuffer.append(event.getText());
|
||||
print(event.getText(), outputType);
|
||||
}
|
||||
});
|
||||
@@ -330,6 +316,7 @@ public abstract class DebuggerTestCase extends ExecutionWithDebuggerToolsTestCas
|
||||
@Override
|
||||
public PsiFile compute() {
|
||||
PsiClass psiClass = JavaPsiFacade.getInstance(myProject).findClass(className, GlobalSearchScope.allScope(myProject));
|
||||
assertNotNull(psiClass);
|
||||
return psiClass.getContainingFile();
|
||||
}
|
||||
});
|
||||
@@ -339,10 +326,9 @@ public abstract class DebuggerTestCase extends ExecutionWithDebuggerToolsTestCas
|
||||
|
||||
protected EvaluationContextImpl createEvaluationContext(final SuspendContextImpl suspendContext) {
|
||||
try {
|
||||
return new EvaluationContextImpl(
|
||||
suspendContext,
|
||||
suspendContext.getFrameProxy(),
|
||||
suspendContext.getFrameProxy().thisObject());
|
||||
StackFrameProxyImpl proxy = suspendContext.getFrameProxy();
|
||||
assertNotNull(proxy);
|
||||
return new EvaluationContextImpl(suspendContext, proxy, proxy.thisObject());
|
||||
}
|
||||
catch (EvaluateException e) {
|
||||
error(e);
|
||||
@@ -440,6 +426,7 @@ public abstract class DebuggerTestCase extends ExecutionWithDebuggerToolsTestCas
|
||||
public void run() {
|
||||
BreakpointManager breakpointManager = DebuggerManagerEx.getInstanceEx(myProject).getBreakpointManager();
|
||||
PsiClass psiClass = JavaPsiFacade.getInstance(myProject).findClass("HelloWorld", GlobalSearchScope.allScope(myProject));
|
||||
assertNotNull(psiClass);
|
||||
Document document = PsiDocumentManager.getInstance(myProject).getDocument(psiClass.getContainingFile());
|
||||
breakpointManager.addLineBreakpoint(document, 3);
|
||||
}
|
||||
@@ -481,33 +468,31 @@ public abstract class DebuggerTestCase extends ExecutionWithDebuggerToolsTestCas
|
||||
@Override
|
||||
@NotNull
|
||||
public Module[] getModules() {
|
||||
return Module.EMPTY_ARRAY; //To change body of implemented methods use File | Settings | File Templates.
|
||||
return Module.EMPTY_ARRAY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getIcon() {
|
||||
return null; //To change body of implemented methods use File | Settings | File Templates.
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigurationFactory getFactory() {
|
||||
return null; //To change body of implemented methods use File | Settings | File Templates.
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setName(final String name) {
|
||||
//To change body of implemented methods use File | Settings | File Templates.
|
||||
}
|
||||
public void setName(String name) { }
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public SettingsEditor<? extends RunConfiguration> getConfigurationEditor() {
|
||||
return null; //To change body of implemented methods use File | Settings | File Templates.
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Project getProject() {
|
||||
return null; //To change body of implemented methods use File | Settings | File Templates.
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -517,18 +502,18 @@ public abstract class DebuggerTestCase extends ExecutionWithDebuggerToolsTestCas
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigurationPerRunnerSettings createRunnerSettings(final ConfigurationInfoProvider provider) {
|
||||
return null; //To change body of implemented methods use File | Settings | File Templates.
|
||||
public ConfigurationPerRunnerSettings createRunnerSettings(ConfigurationInfoProvider provider) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SettingsEditor<ConfigurationPerRunnerSettings> getRunnerSettingsEditor(final ProgramRunner runner) {
|
||||
return null; //To change body of implemented methods use File | Settings | File Templates.
|
||||
public SettingsEditor<ConfigurationPerRunnerSettings> getRunnerSettingsEditor(ProgramRunner runner) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RunConfiguration clone() {
|
||||
return null; //To change body of implemented methods use File | Settings | File Templates.
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -537,28 +522,22 @@ public abstract class DebuggerTestCase extends ExecutionWithDebuggerToolsTestCas
|
||||
}
|
||||
|
||||
@Override
|
||||
public RunProfileState getState(@NotNull final Executor executor, @NotNull final ExecutionEnvironment env) throws ExecutionException {
|
||||
return null; //To change body of implemented methods use File | Settings | File Templates.
|
||||
public RunProfileState getState(@NotNull Executor executor, @NotNull ExecutionEnvironment env) throws ExecutionException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return ""; //To change body of implemented methods use File | Settings | File Templates.
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkConfiguration() throws RuntimeConfigurationException {
|
||||
//To change body of implemented methods use File | Settings | File Templates.
|
||||
}
|
||||
public void checkConfiguration() throws RuntimeConfigurationException { }
|
||||
|
||||
@Override
|
||||
public void readExternal(final Element element) throws InvalidDataException {
|
||||
//To change body of implemented methods use File | Settings | File Templates.
|
||||
}
|
||||
public void readExternal(Element element) throws InvalidDataException { }
|
||||
|
||||
@Override
|
||||
public void writeExternal(final Element element) throws WriteExternalException {
|
||||
//To change body of implemented methods use File | Settings | File Templates.
|
||||
}
|
||||
public void writeExternal(Element element) throws WriteExternalException { }
|
||||
}
|
||||
}
|
||||
|
||||
+2
-32
@@ -36,10 +36,6 @@ import com.intellij.execution.process.ProcessOutputTypes;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.projectRoots.ProjectJdkTable;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.projectRoots.impl.JavaAwareProjectJdkTableImpl;
|
||||
import com.intellij.openapi.projectRoots.impl.ProjectJdkImpl;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
import com.intellij.psi.PsiFile;
|
||||
@@ -400,33 +396,7 @@ public abstract class ExecutionWithDebuggerToolsTestCase extends ExecutionTestCa
|
||||
}
|
||||
}
|
||||
|
||||
private Sdk getTestJdk() {
|
||||
try {
|
||||
ProjectJdkImpl jdk = (ProjectJdkImpl)JavaAwareProjectJdkTableImpl.getInstanceEx().getInternalJdk().clone();
|
||||
jdk.setName("JDK");
|
||||
return jdk;
|
||||
}
|
||||
catch (CloneNotSupportedException e) {
|
||||
LOG.error(e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected void setTestJDK() {
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Sdk jdk = ProjectJdkTable.getInstance().findJdk("JDK");
|
||||
if (jdk != null) {
|
||||
ProjectJdkTable.getInstance().removeJdk(jdk);
|
||||
}
|
||||
|
||||
ProjectJdkTable.getInstance().addJdk(getTestJdk());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private class DelayedEventsProcessListener implements DebugProcessListener {
|
||||
private static class DelayedEventsProcessListener implements DebugProcessListener {
|
||||
private final DebugProcessAdapterImpl myTarget;
|
||||
|
||||
public DelayedEventsProcessListener(DebugProcessAdapterImpl target) {
|
||||
@@ -473,7 +443,7 @@ public abstract class ExecutionWithDebuggerToolsTestCase extends ExecutionTestCa
|
||||
myTarget.attachException(state, exception, remoteConnection);
|
||||
}
|
||||
|
||||
private void pauseExecution() {
|
||||
private static void pauseExecution() {
|
||||
TimeoutUtil.sleep(10);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user