Skip to content

Commit

Permalink
Using Text blocks in ui.tests by moving to Java 17
Browse files Browse the repository at this point in the history
As the whole infrastructure has been moved to Java 17, we can also
update our tests to use Java 17.
  • Loading branch information
vogella authored and iloveeclipse committed Jan 24, 2023
1 parent 61f2888 commit e3cf932
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 19 deletions.
2 changes: 1 addition & 1 deletion tests/org.eclipse.ui.tests/.classpath
Original file line number Diff line number Diff line change
@@ -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/JavaSE-11">
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17">
<attributes>
<attribute name="module" value="true"/>
</attributes>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ 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.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=11
org.eclipse.jdt.core.compiler.compliance=17
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
Expand Down Expand Up @@ -134,7 +134,7 @@ org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=11
org.eclipse.jdt.core.compiler.source=17
org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_additive_operator=16
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -451,14 +451,16 @@ public void testDynamicRegistry() {

});

String ACTIVITY = "<plugin><extension point=\"org.eclipse.ui.activities\">"
+ "<category id=\"dynamic.category\" name=\"Dynamic Activity Category\"/>"
+ "<activity id=\"dynamic.activity\" name=\"Dynamic Activity\"/>"
+ "<activity id=\"dynamic.parent\" name=\"Dynamic Parent Activity\"/>"
+ "<activityRequirementBinding requiredActivityId = \"dynamic.parent\" activityId = \"dynamic.activity\" />"
+ "<categoryActivityBinding categoryId = \"dynamic.category\" activityId = \"dynamic.activity\" />"
+ "<activityPatternBinding activityId=\"dynamic.activity\" pattern=\"dynamic.activity/.*\"/>"
+ "<defaultEnablement id=\"dynamic.activity\"/>" + "</extension></plugin>";
String ACTIVITY = """
<plugin><extension point="org.eclipse.ui.activities">\
<category id="dynamic.category" name="Dynamic Activity Category"/>\
<activity id="dynamic.activity" name="Dynamic Activity"/>\
<activity id="dynamic.parent" name="Dynamic Parent Activity"/>\
<activityRequirementBinding requiredActivityId = "dynamic.parent" activityId = "dynamic.activity" />\
<categoryActivityBinding categoryId = "dynamic.category" activityId = "dynamic.activity" />\
<activityPatternBinding activityId="dynamic.activity" pattern="dynamic.activity/.*"/>\
<defaultEnablement id="dynamic.activity"/>\
</extension></plugin>""";
byte[] bytes = ACTIVITY.getBytes(StandardCharsets.UTF_8);
InputStream is = new ByteArrayInputStream(bytes);
IContributor contrib = ContributorFactoryOSGi.createContributor(TestPlugin.getDefault().getBundle());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,10 @@ protected IStatus run(IProgressMonitor monitor) {
Assert.assertTrue("We tried to sleep the UI thread, but it woke up too early. ",
finalTime - currentTime >= 200);

Assert.assertTrue("Background thread did not start, so there was no possibility "
+ "of testing whether its behavior was correct. This is not a test failure. "
+ "It means we were unable to run the test. ",
Assert.assertTrue("""
Background thread did not start, so there was no possibility\s\
of testing whether its behavior was correct. This is not a test failure.\s\
It means we were unable to run the test.\s""",
backgroundThreadStarted);

Assert.assertFalse("A UI job somehow ran to completion while the UI thread was blocked", uiJobFinished);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ public void widgetSelected(SelectionEvent e) {
};

Label explanation = new Label(parent, SWT.WRAP);
explanation.setText("This view allocates all available SWT resources on demand. "
+ "This is not supposed to be a recoverable error, and is expected to crash the workbench. "
+ "This view allows us observe the workbench when it crashes in this manner.");
explanation.setText("""
This view allocates all available SWT resources on demand.\s\
This is not supposed to be a recoverable error, and is expected to crash the workbench.\s\
This view allows us observe the workbench when it crashes in this manner.""");

useAllComposites = new Button(parent, SWT.PUSH);
useAllComposites.setText("&Allocate all available composites (very slow!)");
Expand Down
2 changes: 1 addition & 1 deletion tests/org.eclipse.ui.tests/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Import-Package: javax.annotation,
Eclipse-AutoStart: true
Export-Package: org.eclipse.ui.tests.api,
org.eclipse.ui.tests.menus
Bundle-RequiredExecutionEnvironment: JavaSE-11
Bundle-RequiredExecutionEnvironment: JavaSE-17
Require-Capability: osgi.extender;
filter:="(&(osgi.extender=osgi.component)(version>=1.2)(!(version>=2.0)))",
osgi.service;
Expand Down

0 comments on commit e3cf932

Please sign in to comment.