Move o.e.dltk.debug tests to Java 8.
With enabled more warnings and save actions.
Empty tests removed.
Change-Id: I17b578378c76be8ac853a86e5e42ba50dc6dcf14
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
diff --git a/core/tests/org.eclipse.dltk.debug.tests/.classpath b/core/tests/org.eclipse.dltk.debug.tests/.classpath
index 64c5e31..eca7bdb 100644
--- a/core/tests/org.eclipse.dltk.debug.tests/.classpath
+++ b/core/tests/org.eclipse.dltk.debug.tests/.classpath
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
diff --git a/core/tests/org.eclipse.dltk.debug.tests/.settings/org.eclipse.jdt.core.prefs b/core/tests/org.eclipse.dltk.debug.tests/.settings/org.eclipse.jdt.core.prefs
index 534eb0e..970a5a7 100644
--- a/core/tests/org.eclipse.dltk.debug.tests/.settings/org.eclipse.jdt.core.prefs
+++ b/core/tests/org.eclipse.dltk.debug.tests/.settings/org.eclipse.jdt.core.prefs
@@ -1,8 +1,106 @@
eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
+org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
+org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnull.secondary=
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
+org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
+org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
+org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=disabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=disabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameter=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/core/tests/org.eclipse.dltk.debug.tests/.settings/org.eclipse.jdt.ui.prefs b/core/tests/org.eclipse.dltk.debug.tests/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 0000000..fbac55c
--- /dev/null
+++ b/core/tests/org.eclipse.dltk.debug.tests/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,59 @@
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_functional_interfaces=true
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=true
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.insert_inferred_type_arguments=false
+sp_cleanup.make_local_variable_final=true
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_redundant_type_arguments=true
+sp_cleanup.remove_trailing_whitespaces=true
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=true
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_anonymous_class_creation=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_lambda=true
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/core/tests/org.eclipse.dltk.debug.tests/META-INF/MANIFEST.MF b/core/tests/org.eclipse.dltk.debug.tests/META-INF/MANIFEST.MF
index af46d10..7b8a1e4 100644
--- a/core/tests/org.eclipse.dltk.debug.tests/META-INF/MANIFEST.MF
+++ b/core/tests/org.eclipse.dltk.debug.tests/META-INF/MANIFEST.MF
@@ -15,4 +15,4 @@
org.eclipse.dltk.core.tests
Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.dltk.debug.tests
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
diff --git a/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/AbstractCommunicator.java b/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/AbstractCommunicator.java
index b0bf4a1..c0b8ea2 100644
--- a/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/AbstractCommunicator.java
+++ b/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/AbstractCommunicator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 xored software, Inc.
+ * Copyright (c) 2008, 2017 xored software, Inc. and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -13,20 +13,22 @@
import org.eclipse.dltk.dbgp.DbgpRequest;
import org.eclipse.dltk.dbgp.IDbgpCommunicator;
-import org.eclipse.dltk.dbgp.exceptions.DbgpException;
import org.eclipse.dltk.debug.core.IDebugOptions;
import org.eclipse.dltk.debug.core.model.DefaultDebugOptions;
public abstract class AbstractCommunicator implements IDbgpCommunicator {
- public void send(DbgpRequest request) throws DbgpException {
+ @Override
+ public void send(DbgpRequest request) {
// empty
}
+ @Override
public IDebugOptions getDebugOptions() {
return DefaultDebugOptions.getDefaultInstance();
}
+ @Override
public void configure(IDebugOptions debugOptions) {
// empty
}
diff --git a/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/DbgpBase64Tests.java b/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/DbgpBase64Tests.java
index c4405de..26e834f 100644
--- a/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/DbgpBase64Tests.java
+++ b/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/DbgpBase64Tests.java
@@ -11,12 +11,13 @@
*******************************************************************************/
package org.eclipse.dltk.debug.dbgp.tests;
+import static org.junit.Assert.assertEquals;
+
import org.eclipse.dltk.dbgp.internal.utils.Base64Helper;
+import org.junit.Test;
-import junit.framework.TestCase;
-
-public class DbgpBase64Tests extends TestCase {
-
+public class DbgpBase64Tests {
+ @Test
public void testNullAndEmpty() {
assertEquals("", Base64Helper.encodeString(null));
assertEquals("", Base64Helper.encodeString(""));
@@ -24,23 +25,23 @@
assertEquals("", Base64Helper.decodeString(""));
assertEquals("", Base64Helper.decodeString("\r\n"));
}
-
+ @Test
public void testEndode() {
assertEquals("MTIz", Base64Helper.encodeString("123"));
assertEquals("MTIzNDU2Nzg5", Base64Helper.encodeString("123456789"));
}
-
+ @Test
public void testDecode() {
assertEquals("123", Base64Helper.decodeString("MTIz"));
assertEquals("123456789", Base64Helper.decodeString("MTIzNDU2Nzg5"));
}
-
+ @Test
public void testDecodeChunked() {
assertEquals("123", Base64Helper.decodeString("MTIz"));
assertEquals("123456789", Base64Helper.decodeString("MTIz" + "\n"
+ "NDU2" + "\n" + "Nzg5"));
}
-
+ @Test
public void testLongString() {
char[] c = new char[256];
for (int i = 0; i < c.length; ++i) {
diff --git a/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/DbgpBreakpointCommandsTests.java b/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/DbgpBreakpointCommandsTests.java
deleted file mode 100644
index 2bad379..0000000
--- a/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/DbgpBreakpointCommandsTests.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
-
- *******************************************************************************/
-package org.eclipse.dltk.debug.dbgp.tests;
-
-import junit.framework.TestCase;
-
-
-public class DbgpBreakpointCommandsTests extends TestCase {
-
-
-
- public void testSetLineBreakpoint() throws Exception {
-
- }
-
- public void testSetCallBreakpoint() throws Exception {
- }
-
- public void testSetReturnBreakpoint() throws Exception {
-
- }
-
- public void testSetExceptionBreakpoint() throws Exception {
-
- }
-
- public void testConditionalBreakpoint() throws Exception {
-
- }
-
- public void testWatchBreakpoint() throws Exception {
-
- }
-
- public void testGetBreakpoint() throws Exception {
-
- }
-
- public void testRemoveBreakpoint() throws Exception {
-
- }
-
- public void testUpdateBreakpoint() throws Exception {
-
- }
-
- public void testGetBreakpoints() throws Exception {
-
- }
-}
diff --git a/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/DbgpContextCommandsTests.java b/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/DbgpContextCommandsTests.java
deleted file mode 100644
index 7c56433..0000000
--- a/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/DbgpContextCommandsTests.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
-
- *******************************************************************************/
-package org.eclipse.dltk.debug.dbgp.tests;
-
-import junit.framework.TestCase;
-
-
-public class DbgpContextCommandsTests extends TestCase {
- public void testGetContextNames() throws Exception {
-
- }
-
- public void testGetContextProperties() throws Exception {
-
- }
-}
diff --git a/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/DbgpContinuationCommandsTests.java b/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/DbgpContinuationCommandsTests.java
deleted file mode 100644
index 7ee4fc7..0000000
--- a/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/DbgpContinuationCommandsTests.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
-
- *******************************************************************************/
-package org.eclipse.dltk.debug.dbgp.tests;
-
-import junit.framework.TestCase;
-
-import org.eclipse.dltk.dbgp.exceptions.DbgpException;
-
-public class DbgpContinuationCommandsTests extends TestCase {
- public void testRun() throws Exception {
-
- }
-
- public void testStepInto() throws Exception {
-
- }
-
- public void testStepOver() throws Exception {
-
- }
-
- public void testStepOut() throws Exception {
-
- }
-
- public void testStop() throws Exception {
-
- }
-
- public void testDetach() throws DbgpException {
-
- }
-}
diff --git a/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/DbgpFeatureCommandsTests.java b/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/DbgpFeatureCommandsTests.java
deleted file mode 100644
index b340a95..0000000
--- a/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/DbgpFeatureCommandsTests.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
-
- *******************************************************************************/
-package org.eclipse.dltk.debug.dbgp.tests;
-
-import junit.framework.TestCase;
-
-public class DbgpFeatureCommandsTests extends TestCase {
- public void testGetFeature() throws Exception {
-
- }
-
- public void testSetFeature(String featureName, String featureValue)
- throws Exception {
- }
-}
diff --git a/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/DbgpPropertyCommandsTests.java b/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/DbgpPropertyCommandsTests.java
index 6e879fe..b76508f 100644
--- a/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/DbgpPropertyCommandsTests.java
+++ b/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/DbgpPropertyCommandsTests.java
@@ -1,22 +1,22 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.debug.dbgp.tests;
+import static org.junit.Assert.assertTrue;
+
import java.io.IOException;
import org.eclipse.dltk.dbgp.DbgpRequest;
import org.eclipse.dltk.dbgp.commands.IDbgpPropertyCommands;
-import org.eclipse.dltk.dbgp.exceptions.DbgpException;
-import org.eclipse.dltk.dbgp.exceptions.DbgpProtocolException;
import org.eclipse.dltk.dbgp.internal.commands.DbgpPropertyCommands;
import org.eclipse.osgi.util.NLS;
+import org.junit.Test;
import org.w3c.dom.Element;
public class DbgpPropertyCommandsTests extends DbgpProtocolTests {
@@ -25,37 +25,25 @@
private IDbgpPropertyCommands commands;
- protected Element makePropertyGetResponse(String name, String fullName,
- String type) throws IOException, DbgpProtocolException {
+ protected Element makePropertyGetResponse(String name, String fullName, String type) throws IOException {
String xml = getResourceAsString(GET_PROPERTY_RESPONSE);
- xml = NLS.bind(xml, new Object[] { name, fullName, type,
- "_size", "_children" });
+ xml = NLS.bind(xml, new Object[] { name, fullName, type, "_size", "_children" });
return parseResponse(xml);
}
- protected Element makePropertySetResponse(int transaction_id,
- boolean success) throws IOException, DbgpProtocolException {
+ protected Element makePropertySetResponse(int transaction_id, boolean success) throws IOException {
String xml = getResourceAsString(SET_PROPERTY_RESPONSE);
- xml = NLS.bind(xml, new Object[] { success ? "1" : "0",
- Integer.toString(transaction_id) });
+ xml = NLS.bind(xml, new Object[] { success ? "1" : "0", Integer.toString(transaction_id) });
return parseResponse(xml);
}
- protected String makePropertyValueResponse(String name) {
- return "";
- }
-
- public DbgpPropertyCommandsTests() {
-
- }
-
+ @Test
public void testGetPropertyByName() throws Exception {
- final Element response = makePropertyGetResponse("xxx", "test::xxx",
- "string");
+ final Element response = makePropertyGetResponse("xxx", "test::xxx", "string");
commands = new DbgpPropertyCommands(new AbstractCommunicator() {
- public Element communicate(DbgpRequest request)
- throws DbgpException {
+ @Override
+ public Element communicate(DbgpRequest request) {
assertTrue(request.optionCount() == 2);
assertTrue(request.hasOption("-i"));
@@ -69,24 +57,14 @@
// System.out.println(property);
}
- public void testGetPropertyByNameAndStackDepth() throws Exception {
-
- // IDbgpProperty property = commands.getPropery("my_var", 0);
- // System.out.println(property);
- }
-
- public void testGetPropertyByNameAndStackDepthAndContextId()
- throws Exception {
-
- }
-
+ @Test
public void testSetProperty() throws Exception {
final Element response = makePropertySetResponse(123, true);
commands = new DbgpPropertyCommands(new AbstractCommunicator() {
- public Element communicate(DbgpRequest request)
- throws DbgpException {
+ @Override
+ public Element communicate(DbgpRequest request) {
assertTrue(request.hasOption("-n"));
diff --git a/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/DbgpPropertyTests.java b/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/DbgpPropertyTests.java
deleted file mode 100644
index 43268e2..0000000
--- a/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/DbgpPropertyTests.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
-
- *******************************************************************************/
-package org.eclipse.dltk.debug.dbgp.tests;
-
-import junit.framework.TestCase;
-
-public class DbgpPropertyTests extends TestCase {
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
- public void testConstruction() {
- //IDbgpProperty property = new DbgpProperty("name", "fullname", );
- }
-
- public void testEquals() throws Exception {
-
- }
-}
diff --git a/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/DbgpProtocolTests.java b/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/DbgpProtocolTests.java
index f6f45e4..fbaa50d 100644
--- a/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/DbgpProtocolTests.java
+++ b/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/DbgpProtocolTests.java
@@ -1,41 +1,29 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.debug.dbgp.tests;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
-import java.io.UnsupportedEncodingException;
-
-import junit.framework.TestCase;
+import java.nio.charset.StandardCharsets;
import org.eclipse.dltk.dbgp.exceptions.DbgpProtocolException;
import org.eclipse.dltk.dbgp.internal.utils.DbgpXmlParser;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
-public class DbgpProtocolTests extends TestCase {
+public class DbgpProtocolTests {
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
protected String getResourceAsString(String name) throws IOException {
BufferedReader reader = null;
try {
- reader = new BufferedReader(new InputStreamReader(getClass()
- .getResourceAsStream(name)));
+ reader = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream(name)));
StringBuffer sb = new StringBuffer();
@@ -52,17 +40,15 @@
}
}
}
-
+
protected Element parseResponse(String xml) {
try {
- Document doc = DbgpXmlParser.parseXml(xml.getBytes("ISO-8859-1"));
+ Document doc = DbgpXmlParser.parseXml(xml.getBytes(StandardCharsets.ISO_8859_1));
return (Element) doc.getFirstChild();
} catch (DbgpProtocolException e) {
e.printStackTrace();
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
}
-
+
return null;
}
}
diff --git a/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/DbgpRequestTests.java b/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/DbgpRequestTests.java
index f5be03f..c635e58 100644
--- a/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/DbgpRequestTests.java
+++ b/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/DbgpRequestTests.java
@@ -1,28 +1,31 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.debug.dbgp.tests;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import org.eclipse.dltk.dbgp.DbgpRequest;
+import org.junit.Before;
+import org.junit.Test;
-public class DbgpRequestTests extends TestCase {
+public class DbgpRequestTests {
private DbgpRequest request;
- protected void setUp() throws Exception {
- super.setUp();
+ @Before
+ public void setUp() {
request = new DbgpRequest("test_command");
}
+ @Test
public void testOptions() {
request.addOption("-t", 324);
@@ -32,11 +35,13 @@
assertEquals("test_command", request.getCommand());
}
+ @Test
public void testData() {
request.setData("my_data");
assertEquals("my_data", request.getData());
}
+ @Test
public void testStringRepresentation() {
request.addOption("-i", 324);
request.setData("my_data");
@@ -44,6 +49,7 @@
assertEquals("test_command -i 324 -- bXlfZGF0YQ==", request.toString());
}
+ @Test
public void testEquals() {
DbgpRequest r1 = new DbgpRequest("step_command_xxx");
r1.addOption("-a", 32);
diff --git a/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/DbgpStackCommandsTests.java b/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/DbgpStackCommandsTests.java
index 18695d8..0f5a652 100644
--- a/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/DbgpStackCommandsTests.java
+++ b/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/DbgpStackCommandsTests.java
@@ -1,41 +1,39 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.debug.dbgp.tests;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
import java.io.IOException;
import org.eclipse.dltk.dbgp.DbgpRequest;
import org.eclipse.dltk.dbgp.IDbgpStackLevel;
import org.eclipse.dltk.dbgp.commands.IDbgpStackCommands;
-import org.eclipse.dltk.dbgp.exceptions.DbgpException;
import org.eclipse.dltk.dbgp.internal.commands.DbgpStackCommands;
import org.eclipse.osgi.util.NLS;
+import org.junit.Test;
import org.w3c.dom.Element;
public class DbgpStackCommandsTests extends DbgpProtocolTests {
- protected Element getStackDepthResponse(int transaction_id, int depth)
- throws IOException {
+ protected Element getStackDepthResponse(int transaction_id, int depth) throws IOException {
String xml = getResourceAsString("get_stack_depth.xml");
- xml = NLS.bind(xml, new Object[] {
- Integer.toString(transaction_id), Integer.toString(depth) });
+ xml = NLS.bind(xml, new Object[] { Integer.toString(transaction_id), Integer.toString(depth) });
return parseResponse(xml);
}
- protected Element getStackGetResponse(int transaction_id)
- throws IOException {
+ protected Element getStackGetResponse(int transaction_id) throws IOException {
String xml = getResourceAsString("stack_get.xml");
- xml = NLS.bind(xml, new Object[] { Integer
- .toString(transaction_id) });
+ xml = NLS.bind(xml, new Object[] { Integer.toString(transaction_id) });
return parseResponse(xml);
}
@@ -44,38 +42,38 @@
return null;
}
+ @Test
public void testStackDepth() throws Exception {
final Element response = getStackDepthResponse(0, 3);
- IDbgpStackCommands commands = new DbgpStackCommands(
- new AbstractCommunicator() {
- public Element communicate(DbgpRequest request)
- throws DbgpException {
+ IDbgpStackCommands commands = new DbgpStackCommands(new AbstractCommunicator() {
+ @Override
+ public Element communicate(DbgpRequest request) {
- assertEquals(1, request.optionCount());
- assertTrue(request.hasOption("-i"));
+ assertEquals(1, request.optionCount());
+ assertTrue(request.hasOption("-i"));
- return response;
- }
- });
+ return response;
+ }
+ });
int depth = commands.getStackDepth();
assertEquals(3, depth);
}
+ @Test
public void testGetStackLevel() throws Exception {
final Element response = getStackGetResponse(0);
- IDbgpStackCommands commands = new DbgpStackCommands(
- new AbstractCommunicator() {
- public Element communicate(DbgpRequest request)
- throws DbgpException {
+ IDbgpStackCommands commands = new DbgpStackCommands(new AbstractCommunicator() {
+ @Override
+ public Element communicate(DbgpRequest request) {
- assertTrue(request.hasOption("-i"));
+ assertTrue(request.hasOption("-i"));
- return response;
- }
- });
+ return response;
+ }
+ });
IDbgpStackLevel level = commands.getStackLevel(0);
assertEquals(0, level.getLevel());
diff --git a/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/DbgpStackLevelTests.java b/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/DbgpStackLevelTests.java
index 6c33e95..3ea8bf6 100644
--- a/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/DbgpStackLevelTests.java
+++ b/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/DbgpStackLevelTests.java
@@ -1,36 +1,32 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.debug.dbgp.tests;
-import java.net.URI;
+import static org.junit.Assert.assertEquals;
-import junit.framework.TestCase;
+import java.net.URI;
import org.eclipse.dltk.dbgp.IDbgpStackLevel;
import org.eclipse.dltk.dbgp.internal.DbgpStackLevel;
+import org.junit.Before;
+import org.junit.Test;
-public class DbgpStackLevelTests extends TestCase {
+public class DbgpStackLevelTests {
private static final String uri = "";
private IDbgpStackLevel level;
- protected void setUp() throws Exception {
- super.setUp();
-
+ @Before
+ public void setUp() throws Exception {
level = new DbgpStackLevel(new URI(uri), "", 2, 56, 56, "", 0, 80);
}
-
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
+ @Test
public void testEquals() throws Exception {
IDbgpStackLevel l = new DbgpStackLevel(new URI(uri), "", 2, 56, 56, "", 0, 80);
diff --git a/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/DbgpStatusCommandsTests.java b/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/DbgpStatusCommandsTests.java
deleted file mode 100644
index c7790da..0000000
--- a/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/DbgpStatusCommandsTests.java
+++ /dev/null
@@ -1,16 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
-
- *******************************************************************************/
-package org.eclipse.dltk.debug.dbgp.tests;
-
-public class DbgpStatusCommandsTests extends DbgpProtocolTests {
- public void testGetStatus() throws Exception {
-
- }
-}
diff --git a/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/DbgpStatusTests.java b/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/DbgpStatusTests.java
index 8a3d8cb..0329c23 100644
--- a/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/DbgpStatusTests.java
+++ b/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/DbgpStatusTests.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.debug.dbgp.tests;
@@ -13,23 +12,17 @@
import org.eclipse.dltk.dbgp.IDbgpStatus;
import org.eclipse.dltk.dbgp.internal.DbgpStatus;
+import org.junit.Test;
public class DbgpStatusTests extends TestCase {
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
+ @Test
public void testConstruction() {
IDbgpStatus s = DbgpStatus.parse("running", "ok");
assertTrue(s.isRunning());
assertTrue(s.reasonOk());
}
-
+ @Test
public void testEquals() {
IDbgpStatus a = DbgpStatus.parse("running", "ok");
IDbgpStatus b = DbgpStatus.parse("running", "ok");
diff --git a/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/DbgpStreamCommandsTests.java b/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/DbgpStreamCommandsTests.java
deleted file mode 100644
index 7a342d1..0000000
--- a/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/DbgpStreamCommandsTests.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
-
- *******************************************************************************/
-package org.eclipse.dltk.debug.dbgp.tests;
-
-import junit.framework.TestCase;
-
-
-public class DbgpStreamCommandsTests extends TestCase {
- public void testConfigureStdout() throws Exception {
-
- }
-
- public void testConfigureStderr() throws Exception {
-
- }
-}
diff --git a/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/service/AbstractDbgpServiceTests.java b/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/service/AbstractDbgpServiceTests.java
index d9afe71..994d898 100644
--- a/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/service/AbstractDbgpServiceTests.java
+++ b/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/service/AbstractDbgpServiceTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 xored software, Inc.
+ * Copyright (c) 2008, 2017 xored software, Inc. and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -11,6 +11,8 @@
*******************************************************************************/
package org.eclipse.dltk.debug.dbgp.tests.service;
+import static org.junit.Assert.assertTrue;
+
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.Socket;
@@ -18,14 +20,14 @@
import java.util.Iterator;
import java.util.List;
-import junit.framework.TestCase;
-
import org.eclipse.dltk.dbgp.DbgpServer;
import org.eclipse.dltk.dbgp.IDbgpSession;
import org.eclipse.dltk.debug.core.DLTKDebugPreferenceConstants;
import org.eclipse.dltk.internal.debug.core.model.DbgpService;
+import org.junit.After;
+import org.junit.Before;
-public class AbstractDbgpServiceTests extends TestCase {
+public class AbstractDbgpServiceTests {
protected static final int ANY_PORT = DLTKDebugPreferenceConstants.DBGP_AVAILABLE_PORT;
@@ -41,7 +43,7 @@
* Creates socket and connects it to the specified port. If connection could
* not be performed the error is thrown. Successfully connected socket is
* added to the {@link #sockets} and closed in {@link #tearDown()}
- *
+ *
* @param port
* @return con
* @throws IOException
@@ -60,14 +62,13 @@
/**
* {@link #connect(int)}s socket and performs operation on it.
- *
+ *
* @param port
* @param operation
* @return
* @throws IOException
*/
- protected Socket performOperation(final int port, ISocketOperation operation)
- throws IOException {
+ protected Socket performOperation(final int port, ISocketOperation operation) throws IOException {
final Socket socket = connect(port);
operation.execute(socket);
return socket;
@@ -76,7 +77,7 @@
/**
* Find some available port in the specified range. The returned values is
* checked, so users should not perform addtitional checks.
- *
+ *
* @param minPort
* @param maxPort
* @return
@@ -92,30 +93,29 @@
* to close sockets as the corresponding {@link IDbgpSession} could be
* terminated before we processed the connection.
*/
- private final List sockets = new ArrayList();
+ private final List<Socket> sockets = new ArrayList<>();
- protected void setUp() throws Exception {
- super.setUp();
+ @Before
+ public void setUp() throws Exception {
sockets.clear();
}
/**
* Closes all sockets opened by {@link #connect(int)}
- *
- * @see junit.framework.TestCase#tearDown()
+ *
*/
- protected void tearDown() throws Exception {
- for (Iterator i = sockets.iterator(); i.hasNext();) {
- closeQuietly((Socket) i.next());
+ @After
+ public void tearDown() {
+ for (Iterator<Socket> i = sockets.iterator(); i.hasNext();) {
+ closeQuietly(i.next());
}
sockets.clear();
- super.tearDown();
}
/**
* Closes the specified socket and catch possible errors. So it could be
* safely used in finally statements and keep original exception if any.
- *
+ *
* @param socket
*/
protected void closeQuietly(final Socket socket) {
diff --git a/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/service/DbgpServiceDispatcherTests.java b/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/service/DbgpServiceDispatcherTests.java
index 0e976cc..bb0f1b3 100644
--- a/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/service/DbgpServiceDispatcherTests.java
+++ b/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/service/DbgpServiceDispatcherTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 xored software, Inc.
+ * Copyright (c) 2008, 2017 xored software, Inc. and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -11,11 +11,15 @@
*******************************************************************************/
package org.eclipse.dltk.debug.dbgp.tests.service;
+import static org.junit.Assert.*;
+
import java.io.IOException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.dltk.dbgp.IDbgpSession;
import org.eclipse.dltk.internal.debug.core.model.DbgpService;
+import org.junit.Before;
+import org.junit.Test;
public class DbgpServiceDispatcherTests extends AbstractDbgpServiceTests {
@@ -31,35 +35,38 @@
volatile int count2;
volatile int count3;
- protected void setUp() throws Exception {
+ @Override
+ @Before
+ public void setUp() throws Exception {
super.setUp();
count1 = 0;
count2 = 0;
count3 = 0;
}
+ @Test
public void testInitPacketParser() throws IOException {
final DbgpService service = createService(ANY_PORT);
try {
service.registerAcceptor(IDE1, new AbstractDbgpAcceptor() {
- public void acceptDbgpThread(IDbgpSession session,
- IProgressMonitor monitor) {
+ @Override
+ public void acceptDbgpThread(IDbgpSession session, IProgressMonitor monitor) {
synchronized (DbgpServiceDispatcherTests.this) {
++count1;
}
}
});
service.registerAcceptor(IDE2, new AbstractDbgpAcceptor() {
- public void acceptDbgpThread(IDbgpSession session,
- IProgressMonitor monitor) {
+ @Override
+ public void acceptDbgpThread(IDbgpSession session, IProgressMonitor monitor) {
synchronized (DbgpServiceDispatcherTests.this) {
++count2;
}
}
});
service.registerAcceptor(IDE3, new AbstractDbgpAcceptor() {
- public void acceptDbgpThread(IDbgpSession session,
- IProgressMonitor monitor) {
+ @Override
+ public void acceptDbgpThread(IDbgpSession session, IProgressMonitor monitor) {
synchronized (DbgpServiceDispatcherTests.this) {
++count3;
}
@@ -68,26 +75,23 @@
for (int i = 0; i < COUNT1; ++i) {
final byte[] packet = TestInitPacket.build(IDE1);
assertNotNull(packet);
- performOperation(service.getPort(), new SendPacketOperation(
- packet));
+ performOperation(service.getPort(), new SendPacketOperation(packet));
}
for (int i = 0; i < COUNT2; ++i) {
final byte[] packet = TestInitPacket.build(IDE2);
assertNotNull(packet);
- performOperation(service.getPort(), new SendPacketOperation(
- packet));
+ performOperation(service.getPort(), new SendPacketOperation(packet));
}
for (int i = 0; i < COUNT3; ++i) {
final byte[] packet = TestInitPacket.build(IDE3);
assertNotNull(packet);
- performOperation(service.getPort(), new SendPacketOperation(
- packet));
+ performOperation(service.getPort(), new SendPacketOperation(packet));
}
for (int i = 0; i < 40; ++i) {
try {
Thread.sleep(100);
} catch (InterruptedException e) {
- //
+ //
}
synchronized (DbgpServiceDispatcherTests.this) {
if (count1 + count2 + count3 == COUNT1 + COUNT2 + COUNT3) {
diff --git a/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/service/DbgpServiceTests.java b/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/service/DbgpServiceTests.java
index fa00712..60130ee 100644
--- a/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/service/DbgpServiceTests.java
+++ b/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/service/DbgpServiceTests.java
@@ -11,13 +11,16 @@
*******************************************************************************/
package org.eclipse.dltk.debug.dbgp.tests.service;
+import static org.junit.Assert.*;
+
import java.io.IOException;
import org.eclipse.dltk.dbgp.DbgpServer;
import org.eclipse.dltk.internal.debug.core.model.DbgpService;
+import org.junit.Test;
public class DbgpServiceTests extends AbstractDbgpServiceTests {
-
+ @Test
public void testConnect() throws IOException {
DbgpService service = createService(ANY_PORT);
try {
@@ -27,12 +30,15 @@
}
}
+ @Test
public void testConnectDelayed() throws IOException {
DbgpService service = new DbgpService(ANY_PORT) {
+ @Override
protected DbgpServer createServer(int port) {
return new DbgpServer(port, CLIENT_SOCKET_TIMEOUT) {
+ @Override
protected void workingCycle() throws Exception, IOException {
Thread.sleep(1000);
super.workingCycle();
@@ -49,6 +55,7 @@
}
}
+ @Test
public void testShutdown() throws IOException {
final int port = findAvailablePort(MIN_PORT, MAX_PORT);
for (int i = 0; i < 4; ++i) {
diff --git a/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/service/SendPacketOperation.java b/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/service/SendPacketOperation.java
index 268aed9..2701e0a 100644
--- a/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/service/SendPacketOperation.java
+++ b/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/service/SendPacketOperation.java
@@ -16,6 +16,7 @@
this.packet = packet;
}
+ @Override
public void execute(Socket socket) throws IOException {
ClientPackets.send(socket, packet);
}
diff --git a/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/service/TestInitPacket.java b/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/service/TestInitPacket.java
index 8236489..d8126d9 100644
--- a/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/service/TestInitPacket.java
+++ b/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/dbgp/tests/service/TestInitPacket.java
@@ -11,30 +11,27 @@
*******************************************************************************/
package org.eclipse.dltk.debug.dbgp.tests.service;
-import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
+import java.util.Map.Entry;
class TestInitPacket {
public static byte[] build(String ideKey) {
- final Map attributes = createTestInitAttributes();
+ final Map<String, String> attributes = createTestInitAttributes();
attributes.put("idekey", ideKey);
StringBuffer sb = new StringBuffer();
sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
sb.append("<init");
appendAttributes(sb, attributes);
sb.append("/>");
- try {
- return sb.toString().getBytes("UTF-8");
- } catch (UnsupportedEncodingException e) {
- return null;
- }
+ return sb.toString().getBytes(StandardCharsets.UTF_8);
}
- private static Map createTestInitAttributes() {
- final Map attributes = new HashMap();
+ private static Map<String, String> createTestInitAttributes() {
+ final Map<String, String> attributes = new HashMap<>();
attributes.put("appid", "APPID");
attributes.put("session", "DBGP_COOKIE");
attributes.put("thread", "THREAD_ID");
@@ -45,15 +42,14 @@
return attributes;
}
- private static void appendAttributes(StringBuffer sb, Map attributes) {
- for (Iterator i = attributes.entrySet().iterator(); i.hasNext();) {
- final Map.Entry entry = (Map.Entry) i.next();
+ private static void appendAttributes(StringBuffer sb, Map<String, String> attributes) {
+ for (Iterator<Map.Entry<String, String>> i = attributes.entrySet().iterator(); i.hasNext();) {
+ final Entry<String, String> entry = i.next();
appendAttribute(sb, entry.getKey(), entry.getValue());
}
}
- private static void appendAttribute(StringBuffer sb, Object name,
- Object value) {
+ private static void appendAttribute(StringBuffer sb, Object name, Object value) {
sb.append(' ');
sb.append(name);
sb.append("=\"");
diff --git a/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/tests/AbstractDebugTests.java b/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/tests/AbstractDebugTests.java
index 1a4cf30..c6d3265 100644
--- a/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/tests/AbstractDebugTests.java
+++ b/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/tests/AbstractDebugTests.java
@@ -11,6 +11,7 @@
protected IScriptProject scriptProject;
// Configuration
+ @Override
public void setUpSuite() throws Exception {
super.setUpSuite();
@@ -22,6 +23,7 @@
// project.setDescription(description, null);
}
+ @Override
public void tearDownSuite() throws Exception {
deleteProject(getProjectName());
diff --git a/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/tests/Activator.java b/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/tests/Activator.java
index eadc5ed..b4748fb 100644
--- a/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/tests/Activator.java
+++ b/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/tests/Activator.java
@@ -1,16 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.debug.tests;
import org.eclipse.core.runtime.Plugin;
-import org.osgi.framework.BundleContext;
/**
* The activator class controls the plug-in life cycle
@@ -25,15 +23,6 @@
plugin = this;
}
- public void start(BundleContext context) throws Exception {
- super.start(context);
- }
-
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
public static Activator getDefault() {
return plugin;
}
diff --git a/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/tests/AllTests.java b/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/tests/AllTests.java
index a0cfe43..4e44ee7 100644
--- a/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/tests/AllTests.java
+++ b/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/tests/AllTests.java
@@ -5,67 +5,25 @@
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.debug.tests;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
import org.eclipse.dltk.debug.dbgp.tests.DbgpBase64Tests;
-import org.eclipse.dltk.debug.dbgp.tests.DbgpBreakpointCommandsTests;
-import org.eclipse.dltk.debug.dbgp.tests.DbgpContextCommandsTests;
-import org.eclipse.dltk.debug.dbgp.tests.DbgpContinuationCommandsTests;
-import org.eclipse.dltk.debug.dbgp.tests.DbgpFeatureCommandsTests;
import org.eclipse.dltk.debug.dbgp.tests.DbgpPropertyCommandsTests;
import org.eclipse.dltk.debug.dbgp.tests.DbgpRequestTests;
import org.eclipse.dltk.debug.dbgp.tests.DbgpStackCommandsTests;
import org.eclipse.dltk.debug.dbgp.tests.DbgpStackLevelTests;
-import org.eclipse.dltk.debug.dbgp.tests.DbgpStatusCommandsTests;
import org.eclipse.dltk.debug.dbgp.tests.DbgpStatusTests;
-import org.eclipse.dltk.debug.dbgp.tests.DbgpStreamCommandsTests;
-import org.eclipse.dltk.debug.dbgp.tests.service.DbgpServiceDispatcherTests;
import org.eclipse.dltk.debug.dbgp.tests.service.DbgpServiceTests;
import org.eclipse.dltk.debug.tests.breakpoints.BreakpointTests;
import org.eclipse.dltk.internal.debug.tests.VariableNameComparatorTest;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+@RunWith(Suite.class)
+@Suite.SuiteClasses({ DbgpRequestTests.class, DbgpStackLevelTests.class, DbgpPropertyCommandsTests.class,
+ DbgpStackCommandsTests.class, DbgpBase64Tests.class, DbgpStatusTests.class,
+ DbgpServiceTests.class, BreakpointTests.class, VariableNameComparatorTest.class })
public class AllTests {
- public static Test suite() {
- final TestSuite suite = new TestSuite("org.eclipse.dltk.debug");
-
- // // $JUnit-BEGIN$
-
- // Dbgp
- final TestSuite dbgpSuite = new TestSuite("DBGP tests");
- dbgpSuite.addTestSuite(DbgpRequestTests.class);
- dbgpSuite.addTestSuite(DbgpStackLevelTests.class);
- dbgpSuite.addTestSuite(DbgpPropertyCommandsTests.class);
- dbgpSuite.addTestSuite(DbgpFeatureCommandsTests.class);
- dbgpSuite.addTestSuite(DbgpBreakpointCommandsTests.class);
- dbgpSuite.addTestSuite(DbgpContextCommandsTests.class);
- dbgpSuite.addTestSuite(DbgpContinuationCommandsTests.class);
- dbgpSuite.addTestSuite(DbgpStackCommandsTests.class);
- dbgpSuite.addTestSuite(DbgpStreamCommandsTests.class);
- dbgpSuite.addTestSuite(DbgpStatusCommandsTests.class);
- dbgpSuite.addTestSuite(DbgpBase64Tests.class);
- dbgpSuite.addTestSuite(DbgpStatusTests.class);
- suite.addTest(dbgpSuite);
-
- final TestSuite serviceSuite = new TestSuite("DBGP Service tests");
- serviceSuite.addTestSuite(DbgpServiceTests.class);
-// serviceSuite.addTestSuite(DbgpServiceDispatcherTests.class);
- suite.addTest(serviceSuite);
-
- // Breakpoints
- suite.addTest(BreakpointTests.suite());
-
- // Internal debug tests
- final TestSuite internalSuite = new TestSuite("Internal debug tests");
- internalSuite.addTestSuite(VariableNameComparatorTest.class);
- suite.addTest(internalSuite);
-
- // // $JUnit-END$
- return suite;
- }
}
diff --git a/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/tests/MyDebugTests.java b/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/tests/MyDebugTests.java
index ba90e85..8d176e2 100644
--- a/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/tests/MyDebugTests.java
+++ b/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/tests/MyDebugTests.java
@@ -1,6 +1,7 @@
package org.eclipse.dltk.debug.tests;
import java.io.File;
+import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.URL;
@@ -13,26 +14,23 @@
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.dltk.core.DLTKCore;
import org.eclipse.dltk.core.IScriptProject;
import org.eclipse.dltk.core.tests.model.SuiteOfTestCases;
public class MyDebugTests extends SuiteOfTestCases {
private static class FileHelper {
- public static byte[] readFile(java.io.File file)
- throws java.io.IOException {
+ public static byte[] readFile(java.io.File file) throws java.io.IOException {
int fileLength = (int) file.length();
byte[] fileBytes = new byte[fileLength];
- java.io.FileInputStream stream = new java.io.FileInputStream(file);
- int bytesRead = 0;
- int lastReadSize = 0;
- while ((lastReadSize != -1) && (bytesRead != fileLength)) {
- lastReadSize = stream.read(fileBytes, bytesRead, fileLength
- - bytesRead);
- bytesRead += lastReadSize;
+ try (FileInputStream stream = new java.io.FileInputStream(file)) {
+ int bytesRead = 0;
+ int lastReadSize = 0;
+ while ((lastReadSize != -1) && (bytesRead != fileLength)) {
+ lastReadSize = stream.read(fileBytes, bytesRead, fileLength - bytesRead);
+ bytesRead += lastReadSize;
+ }
}
- stream.close();
return fileBytes;
}
@@ -40,8 +38,7 @@
* Copy the given source directory (and all its contents) to the given
* target directory.
*/
- public static void copyDirectory(File source, File target)
- throws IOException {
+ public static void copyDirectory(File source, File target) throws IOException {
if (!target.exists()) {
target.mkdirs();
}
@@ -66,15 +63,14 @@
* Copy file from src (path to the original file) to dest (path to the
* destination file).
*/
- public static void copyFile(File source, File target)
- throws IOException {
+ public static void copyFile(File source, File target) throws IOException {
// read source bytes
byte[] srcBytes = readFile(source);
// write bytes to dest
- FileOutputStream out = new FileOutputStream(target);
- out.write(srcBytes);
- out.close();
+ try (FileOutputStream out = new FileOutputStream(target)) {
+ out.write(srcBytes);
+ }
}
}
@@ -83,16 +79,6 @@
// TODO Auto-generated constructor stub
}
- public void setUpSuite() throws Exception {
- // TODO Auto-generated method stub
- super.setUpSuite();
- }
-
- public void tearDownSuite() throws Exception {
- // TODO Auto-generated method stub
- super.tearDownSuite();
- }
-
// Helper methods
protected IWorkspace getWorkspace() {
return ResourcesPlugin.getWorkspace();
@@ -107,14 +93,11 @@
}
// Create project
- protected IProject createProject(final String projectName)
- throws CoreException {
+ protected IProject createProject(final String projectName) throws CoreException {
final IProject project = getProject(projectName);
- IWorkspaceRunnable create = new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- project.create(null);
- project.open(null);
- }
+ IWorkspaceRunnable create = monitor -> {
+ project.create(null);
+ project.open(null);
};
getWorkspace().run(create, null);
return project;
@@ -134,32 +117,28 @@
return new File(getPluginDirectoryPath(), "workspace");
}
- protected IProject createProjectWithContent(final String projectName)
- throws CoreException, IOException {
+ protected IProject createProjectWithContent(final String projectName) throws CoreException, IOException {
final File source = getSourceWorkspacePath();
final File target = getWorkspaceRoot().getLocation().toFile();
- FileHelper.copyDirectory(new File(source, projectName), new File(
- target, projectName));
+ FileHelper.copyDirectory(new File(source, projectName), new File(target, projectName));
return createProject(projectName);
}
- protected IScriptProject createScriptProject(final String projectName,
- final String[] natureIds) throws CoreException {
+ protected IScriptProject createScriptProject(final String projectName, final String[] natureIds)
+ throws CoreException {
final IScriptProject[] result = new IScriptProject[1];
- IWorkspaceRunnable create = new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- final IProject project = createProject(projectName);
+ IWorkspaceRunnable create = monitor -> {
+ final IProject project = createProject(projectName);
- // Natures
- IProjectDescription description = project.getDescription();
- description.setNatureIds(natureIds);
- project.setDescription(description, null);
+ // Natures
+ IProjectDescription description = project.getDescription();
+ description.setNatureIds(natureIds);
+ project.setDescription(description, null);
- // Script project
- result[0] = DLTKCore.create(project);
- }
+ // Script project
+ result[0] = DLTKCore.create(project);
};
getWorkspace().run(create, null);
diff --git a/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/tests/breakpoints/BreakpointTests.java b/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/tests/breakpoints/BreakpointTests.java
index 82a506d..6b7af67 100644
--- a/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/tests/breakpoints/BreakpointTests.java
+++ b/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/tests/breakpoints/BreakpointTests.java
@@ -28,6 +28,7 @@
private IScriptLineBreakpoint breakpoint;
+ @Override
public void setUpSuite() throws Exception {
super.setUpSuite();
@@ -38,11 +39,13 @@
resource.getLocation(), 1, -1, -1, true);
}
+ @Override
public void tearDownSuite() throws Exception {
super.tearDownSuite();
}
// Helper methods
+ @Override
protected String getProjectName() {
return "debug";
}
@@ -50,6 +53,7 @@
private static IDbgpSession createDbgpSessionMock() {
final InvocationHandler handler = new InvocationHandler() {
+ @Override
public Object invoke(Object proxy, Method method, Object[] args)
throws Throwable {
throw new UnsupportedOperationException("Mock called "
diff --git a/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/tests/core/BuildpathContainerTests.java b/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/tests/core/BuildpathContainerTests.java
deleted file mode 100644
index c81273f..0000000
--- a/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/debug/tests/core/BuildpathContainerTests.java
+++ /dev/null
@@ -1,135 +0,0 @@
-// /*******************************************************************************
-// * Copyright (c) 2000, 2007 IBM Corporation and others.
-// * All rights reserved. This program and the accompanying materials
-// * are made available under the terms of the Eclipse Public License v1.0
-// * which accompanies this distribution, and is available at
-// * http://www.eclipse.org/legal/epl-v10.html
-// *
-//
-// *******************************************************************************/
-// package org.eclipse.dltk.debug.tests.core;
-//
-// import org.eclipse.core.runtime.CoreException;
-// import org.eclipse.core.runtime.IPath;
-// import org.eclipse.core.runtime.Path;
-// import org.eclipse.dltk.core.IBuildpathContainer;
-// import org.eclipse.dltk.core.IBuildpathEntry;
-// import org.eclipse.dltk.core.IBuiltinModuleProvider;
-// import org.eclipse.dltk.debug.tests.AbstractDebugTest;
-// import org.eclipse.dltk.internal.launching.InterpreterContainer;
-// import org.eclipse.dltk.internal.launching.InterpreterContainerInitializer;
-// import org.eclipse.dltk.launching.IInterpreterInstall;
-// import org.eclipse.dltk.launching.InterpreterStandin;
-// import org.eclipse.dltk.launching.LibraryLocation;
-// import org.eclipse.dltk.launching.ScriptRuntime;
-//
-// /**
-// * Tests interpreter buildpath container
-// */
-// public class BuildpathContainerTests extends AbstractDebugTest {
-//
-// class FakeContainer implements IBuildpathContainer {
-//
-// IBuildpathEntry[] entries = new IBuildpathEntry[0];
-//
-// public IBuildpathEntry[] getBuildpathEntries() {
-// return entries;
-// }
-//
-// public String getDescription() {
-// return "Fake";
-// }
-//
-// public int getKind() {
-// return IBuildpathContainer.K_DEFAULT_SYSTEM;
-// }
-//
-// public IPath getPath() {
-// return new Path(ScriptRuntime.INTERPRETER_CONTAINER);
-// }
-//
-// public void setEntries(IBuildpathEntry[] cpe) {
-// entries = cpe;
-// }
-//
-// public IBuiltinModuleProvider getBuiltinProvider() {
-// // TODO Auto-generated method stub
-// return null;
-// }
-// }
-//
-// public BuildpathContainerTests(String name) {
-// super(name);
-// }
-//
-// /**
-// * Tests that the container will accept an update
-// */
-// public void testCanUpdate() throws CoreException {
-// // Create a new Interpreter install that mirros the current install
-// IInterpreterInstall def = ScriptRuntime
-// .getDefaultInterpreterInstall("testnature");
-//
-// final String id = def.getId() + System.currentTimeMillis();
-// InterpreterStandin standin = new InterpreterStandin(def
-// .getInterpreterInstallType(), id);
-// String name = "Alternate Interpreter";
-// IPath containerPath = new Path(ScriptRuntime.INTERPRETER_CONTAINER);
-// containerPath = containerPath.append(new Path(def
-// .getInterpreterInstallType().getId()));
-// containerPath = containerPath.append(new Path(name));
-//
-// standin.setName(name);
-// standin.setInstallLocation(def.getInstallLocation());
-// standin.setLibraryLocations(ScriptRuntime.getLibraryLocations(def));
-// standin.convertToRealInterpreter();
-//
-// // ensure the new Interpreter exists
-// IInterpreterInstall newInterpreter = def.getInterpreterInstallType()
-// .findInterpreterInstall(id);
-// assertNotNull("Failed to create new Interpreter", newInterpreter);
-//
-// InterpreterContainer container = new InterpreterContainer(
-// newInterpreter, containerPath);
-// InterpreterContainerInitializer initializer = new
-// InterpreterContainerInitializer();
-// // store the current library settings
-// LibraryLocation[] originalLibs = ScriptRuntime
-// .getLibraryLocations(newInterpreter);
-// assertTrue("Libraries should not be empty", originalLibs.length > 0);
-// IBuildpathEntry[] originalEntries = container.getBuildpathEntries();
-// assertEquals("Libraries should be same size as buildpath entries",
-// originalLibs.length, originalEntries.length);
-//
-// // ensure we can update
-// assertTrue("Initializer will not accept update", initializer
-// .canUpdateBuildpathContainer(containerPath, getScriptProject()));
-//
-// // update to an empty set of libs
-// FakeContainer fakeContainer = new FakeContainer();
-// initializer.requestBuildpathContainerUpdate(containerPath,
-// getScriptProject(), fakeContainer);
-//
-// // ensure the library locations are now empty on the new Interpreter
-// LibraryLocation[] newLibs = ScriptRuntime
-// .getLibraryLocations(newInterpreter);
-// assertEquals("Libraries should be empty", 0, newLibs.length);
-//
-// // re-set to original libs
-// fakeContainer.setEntries(originalEntries);
-// initializer.requestBuildpathContainerUpdate(containerPath,
-// getScriptProject(), fakeContainer);
-//
-// // ensure libs are restored
-// newLibs = ScriptRuntime.getLibraryLocations(newInterpreter);
-// assertEquals("Libraries should be restored", originalLibs.length,
-// newLibs.length);
-//
-// for (int i = 0; i < newLibs.length; i++) {
-// LibraryLocation location = newLibs[i];
-// LibraryLocation origi = originalLibs[i];
-// assertEquals("Library should be the eqaual", origi.getLibraryPath()
-// .toFile(), location.getLibraryPath().toFile());
-// }
-// }
-// }
diff --git a/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/internal/debug/tests/VariableNameComparatorTest.java b/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/internal/debug/tests/VariableNameComparatorTest.java
index ef51b7b..8e92ff3 100644
--- a/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/internal/debug/tests/VariableNameComparatorTest.java
+++ b/core/tests/org.eclipse.dltk.debug.tests/src/org/eclipse/dltk/internal/debug/tests/VariableNameComparatorTest.java
@@ -17,16 +17,16 @@
protected ArrayList<IVariable> list;
protected VariableNameComparator comparator;
+ @Override
protected void setUp() {
comparator = new VariableNameComparator();
if (list == null)
- list = new ArrayList<IVariable>();
+ list = new ArrayList<>();
else
list.clear();
}
- protected void assertSortedListNamesEqual(String... expectedListNames)
- throws DebugException {
+ protected void assertSortedListNamesEqual(String... expectedListNames) throws DebugException {
// when comparator doesn't adhere to the "Comparator" contract this
// could give an exception
IVariable[] tmp = new IVariable[list.size()];
@@ -41,8 +41,7 @@
}
if (!ok)
- failNotEquals("Sorted list has unexpected value;",
- Arrays.asList(expectedListNames), Arrays.asList(tmp));
+ failNotEquals("Sorted list has unexpected value;", Arrays.asList(expectedListNames), Arrays.asList(tmp));
}
public void testStringVariables1() throws DebugException {
@@ -84,8 +83,7 @@
// when the comparator doesn't respect it's contract this could get
// ordered strangely for ArrayList
- assertSortedListNamesEqual("4", "5", "6", "114", "116", "2a", "2a",
- "2a", "a", "b", "c");
+ assertSortedListNamesEqual("4", "5", "6", "114", "116", "2a", "2a", "2a", "a", "b", "c");
}
public void testMixedVariables2() throws DebugException {
@@ -173,76 +171,87 @@
// org.eclipse.dltk.internal.debug.tests.VariableNameComparatorTest.testMixedVariables2(VariableNameComparatorTest.java:158)
// (...)
- assertSortedListNamesEqual("1", "2", "3", "4", "4", "4", "4", "5", "5",
- "5", "5", "6", "6", "6", "6", "6", "7", "8", "9", "10", "11",
- "12", "13", "14", "15", "16", "17", "18", "114", "114", "114",
- "114", "116", "116", "116", "2a", "2a", "2a", "2a", "2a", "2a",
- "2a", "2a", "2a", "2a", "a", "a", "a", "a", "b", "b", "b", "c",
- "c", "c");
+ assertSortedListNamesEqual("1", "2", "3", "4", "4", "4", "4", "5", "5", "5", "5", "6", "6", "6", "6", "6", "7",
+ "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "114", "114", "114", "114", "116",
+ "116", "116", "2a", "2a", "2a", "2a", "2a", "2a", "2a", "2a", "2a", "2a", "a", "a", "a", "a", "b", "b",
+ "b", "c", "c", "c");
}
protected IVariable getNewVariable(final String name) {
return new IVariable() {
- public boolean verifyValue(IValue value) throws DebugException {
+ @Override
+ public boolean verifyValue(IValue value) {
// dummy
return false;
}
- public boolean verifyValue(String expression) throws DebugException {
+ @Override
+ public boolean verifyValue(String expression) {
// dummy
return false;
}
+ @Override
public boolean supportsValueModification() {
// dummy
return false;
}
- public void setValue(IValue value) throws DebugException {
+ @Override
+ public void setValue(IValue value) {
// dummy
}
- public void setValue(String expression) throws DebugException {
+ @Override
+ public void setValue(String expression) {
// dummy
}
- public Object getAdapter(Class adapter) {
+ @Override
+ public <T> T getAdapter(Class<T> adapter) {
// dummy
return null;
}
+ @Override
public String getModelIdentifier() {
// dummy
return null;
}
+ @Override
public ILaunch getLaunch() {
// dummy
return null;
}
+ @Override
public IDebugTarget getDebugTarget() {
// dummy
return null;
}
- public boolean hasValueChanged() throws DebugException {
+ @Override
+ public boolean hasValueChanged() {
// dummy
return false;
}
- public IValue getValue() throws DebugException {
+ @Override
+ public IValue getValue() {
// dummy
return null;
}
- public String getReferenceTypeName() throws DebugException {
+ @Override
+ public String getReferenceTypeName() {
// dummy
return null;
}
- public String getName() throws DebugException {
+ @Override
+ public String getName() {
return name;
}
diff --git a/core/tests/org.eclipse.dltk.debug.ui.tests/src/org/eclipse/dltk/debug/ui/tests/DLTKDebugUITestsPlugin.java b/core/tests/org.eclipse.dltk.debug.ui.tests/src/org/eclipse/dltk/debug/ui/tests/DLTKDebugUITestsPlugin.java
index 14a11d2..ec6f5c6 100644
--- a/core/tests/org.eclipse.dltk.debug.ui.tests/src/org/eclipse/dltk/debug/ui/tests/DLTKDebugUITestsPlugin.java
+++ b/core/tests/org.eclipse.dltk.debug.ui.tests/src/org/eclipse/dltk/debug/ui/tests/DLTKDebugUITestsPlugin.java
@@ -20,19 +20,13 @@
public DLTKDebugUITestsPlugin() {
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
+ @Override
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
+ @Override
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
diff --git a/core/tests/org.eclipse.dltk.debug.ui.tests/src/org/eclipse/dltk/debug/ui/tests/core/DLTKDebugUILanguageManagerTests.java b/core/tests/org.eclipse.dltk.debug.ui.tests/src/org/eclipse/dltk/debug/ui/tests/core/DLTKDebugUILanguageManagerTests.java
index bd9fe36..548ded6 100644
--- a/core/tests/org.eclipse.dltk.debug.ui.tests/src/org/eclipse/dltk/debug/ui/tests/core/DLTKDebugUILanguageManagerTests.java
+++ b/core/tests/org.eclipse.dltk.debug.ui.tests/src/org/eclipse/dltk/debug/ui/tests/core/DLTKDebugUILanguageManagerTests.java
@@ -1,11 +1,10 @@
package org.eclipse.dltk.debug.ui.tests.core;
-import junit.framework.Assert;
-
import org.eclipse.dltk.core.tests.model.AbstractModelTests;
import org.eclipse.dltk.core.tests.model.TestConstants;
import org.eclipse.dltk.debug.ui.DLTKDebugUILanguageManager;
import org.eclipse.dltk.debug.ui.IDLTKDebugUILanguageToolkit;
+import org.junit.Assert;
public class DLTKDebugUILanguageManagerTests extends AbstractModelTests {
diff --git a/core/tests/org.eclipse.dltk.debug.ui.tests/src/org/eclipse/dltk/debug/ui/tests/core/DLTKDebugUITestLanguageToolkit.java b/core/tests/org.eclipse.dltk.debug.ui.tests/src/org/eclipse/dltk/debug/ui/tests/core/DLTKDebugUITestLanguageToolkit.java
index 731e4fb..e364fba 100644
--- a/core/tests/org.eclipse.dltk.debug.ui.tests/src/org/eclipse/dltk/debug/ui/tests/core/DLTKDebugUITestLanguageToolkit.java
+++ b/core/tests/org.eclipse.dltk.debug.ui.tests/src/org/eclipse/dltk/debug/ui/tests/core/DLTKDebugUITestLanguageToolkit.java
@@ -7,19 +7,12 @@
public class DLTKDebugUITestLanguageToolkit extends
AbstractDebugUILanguageToolkit {
- /*
- * @see
- * org.eclipse.dltk.debug.ui.IDLTKDebugUILanguageToolkit#getDebugModelId()
- */
+ @Override
public String getDebugModelId() {
return null;
}
- /*
- * @see
- * org.eclipse.dltk.debug.ui.IDLTKDebugUILanguageToolkit#getPreferenceStore
- * ()
- */
+ @Override
public IPreferenceStore getPreferenceStore() {
return DLTKDebugUITestsPlugin.getDefault().getPreferenceStore();
}