From 2f39334044f70bf919386abc261eb610ff757b32 Mon Sep 17 00:00:00 2001 From: Patrick Ziegler Date: Tue, 27 Aug 2024 21:26:10 +0200 Subject: [PATCH] Migrate RCPTT test for MavenTargetDependencyEditor to SWTBot In the long run, using RCPTT is probably causing more trouble than it's worth. It therefore makes sense to switch to a more lightweight solution like SWTBot for testing. --- org.eclipse.m2e.rcptt.tests/.project | 23 -- org.eclipse.m2e.rcptt.tests/pom.xml | 44 --- org.eclipse.m2e.rcptt.tests/rcptt.properties | 9 - .../DependencyEditorTest.test | 296 --------------- .../_Context/WorkspaceWithTargetPlatform.ctx | 60 --- .../Empty Log Verification.verification | 25 -- org.eclipse.m2e.swtbot.tests/.classpath | 21 ++ org.eclipse.m2e.swtbot.tests/.project | 34 ++ .../org.eclipse.core.resources.prefs | 0 .../.settings/org.eclipse.jdt.core.prefs | 14 + .../META-INF/MANIFEST.MF | 16 + org.eclipse.m2e.swtbot.tests/build.properties | 4 + org.eclipse.m2e.swtbot.tests/pom.xml | 18 + .../projects/target-platform/.project | 11 + .../org.eclipse.core.resources.prefs | 3 + .../target-platform/target-platform.target | 124 +++++++ .../ui/MavenTargetDependencyEditorTest.java | 349 ++++++++++++++++++ .../META-INF/MANIFEST.MF | 4 +- .../common/AbstractMavenProjectTestCase.java | 17 + pom.xml | 2 +- target-platform/target-platform.target | 4 + 21 files changed, 618 insertions(+), 460 deletions(-) delete mode 100644 org.eclipse.m2e.rcptt.tests/.project delete mode 100644 org.eclipse.m2e.rcptt.tests/pom.xml delete mode 100644 org.eclipse.m2e.rcptt.tests/rcptt.properties delete mode 100644 org.eclipse.m2e.rcptt.tests/src/Tests/org.eclipse.m2e.pde.ui/DependencyEditorTest.test delete mode 100644 org.eclipse.m2e.rcptt.tests/src/Tests/org.eclipse.m2e.pde.ui/_Context/WorkspaceWithTargetPlatform.ctx delete mode 100644 org.eclipse.m2e.rcptt.tests/src/Verification/Empty Log Verification.verification create mode 100644 org.eclipse.m2e.swtbot.tests/.classpath create mode 100644 org.eclipse.m2e.swtbot.tests/.project rename {org.eclipse.m2e.rcptt.tests => org.eclipse.m2e.swtbot.tests}/.settings/org.eclipse.core.resources.prefs (100%) create mode 100644 org.eclipse.m2e.swtbot.tests/.settings/org.eclipse.jdt.core.prefs create mode 100644 org.eclipse.m2e.swtbot.tests/META-INF/MANIFEST.MF create mode 100644 org.eclipse.m2e.swtbot.tests/build.properties create mode 100644 org.eclipse.m2e.swtbot.tests/pom.xml create mode 100644 org.eclipse.m2e.swtbot.tests/resources/projects/target-platform/.project create mode 100644 org.eclipse.m2e.swtbot.tests/resources/projects/target-platform/.settings/org.eclipse.core.resources.prefs create mode 100644 org.eclipse.m2e.swtbot.tests/resources/projects/target-platform/target-platform.target create mode 100644 org.eclipse.m2e.swtbot.tests/src/org/eclipse/m2e/pde/ui/MavenTargetDependencyEditorTest.java diff --git a/org.eclipse.m2e.rcptt.tests/.project b/org.eclipse.m2e.rcptt.tests/.project deleted file mode 100644 index be8e53a35c..0000000000 --- a/org.eclipse.m2e.rcptt.tests/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - org.eclipse.m2e.rcptt.tests - - - - - - org.eclipse.rcptt.core.builder.q7Builder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.m2e.core.maven2Nature - org.eclipse.rcptt.core.rcpttnature - - diff --git a/org.eclipse.m2e.rcptt.tests/pom.xml b/org.eclipse.m2e.rcptt.tests/pom.xml deleted file mode 100644 index 8f877c8dc9..0000000000 --- a/org.eclipse.m2e.rcptt.tests/pom.xml +++ /dev/null @@ -1,44 +0,0 @@ - - 4.0.0 - - - org.eclipse.m2e - m2e-core - 2.1.0-SNAPSHOT - - - org.eclipse.m2e.rcptt.tests - rcpttTest - M2E - RCPTT Integration tests - - - - rcptt - Eclipse RCPTT repository - https://repo.eclipse.org/content/repositories/rcptt-releases/ - - - - - - - org.eclipse.rcptt - rcptt-maven-plugin - 2.5.5-M3 - true - - - ../products/m2e-ide/target/products/m2e-ide-[platform].tar.gz - - - - 1800 - - 300 - - - - - - diff --git a/org.eclipse.m2e.rcptt.tests/rcptt.properties b/org.eclipse.m2e.rcptt.tests/rcptt.properties deleted file mode 100644 index 2411fe50ba..0000000000 --- a/org.eclipse.m2e.rcptt.tests/rcptt.properties +++ /dev/null @@ -1,9 +0,0 @@ ---- RCPTT testcase --- -Format-Version: 1.0 -Element-Name: Project Settings -Element-Type: projectMetadata -Element-Version: 2.0 -Id: _A_5OgIe9Ee2DibE_7T1Sqw -Runtime-Version: 2.5.4.202210020716 -Save-Time: 12/29/22, 10:09 PM - diff --git a/org.eclipse.m2e.rcptt.tests/src/Tests/org.eclipse.m2e.pde.ui/DependencyEditorTest.test b/org.eclipse.m2e.rcptt.tests/src/Tests/org.eclipse.m2e.pde.ui/DependencyEditorTest.test deleted file mode 100644 index cc820b2a1e..0000000000 --- a/org.eclipse.m2e.rcptt.tests/src/Tests/org.eclipse.m2e.pde.ui/DependencyEditorTest.test +++ /dev/null @@ -1,296 +0,0 @@ ---- RCPTT testcase --- -Format-Version: 1.0 -Contexts: _mo5J8IfaEe2N1bfX2b9TRQ -Element-Name: DependencyEditorTest -Element-Type: testcase -Element-Version: 3.0 -External-Reference: -Id: _WA75MIfaEe2N1bfX2b9TRQ -Runtime-Version: 2.5.4.202210020716 -Save-Time: 2/3/23, 7:35 PM -Tags: org.eclipse.m2e.pde.ui -Testcase-Type: ecl -Verifications: _7el9kIfGEe2DibE_7T1Sqw - -------=_.content-0a7243a0-75d3-3d5f-9791-539de0e5b7ac -Content-Type: text/ecl -Entry-Name: .content - -with [get-view "Project Explorer" | get-tree] { - select "target-platform" | double-click - select "target-platform/target-platform.target" | double-click -} - -with [get-editor "target-platform.target" | get-section Locations | get-tree] { - get-item -path "Maven Central.*" | click - select "Maven Central.*" | double-click -} - -with [get-window "Maven Artifact Target Entry - Maven Central"] { - // Check the initial button enablement. All buttons except Undo/Redo should be enabled. - get-button Add | get-property enablement | equals true | verify-true - get-button Remove | get-property enablement | equals true | verify-true - get-button Update | get-property enablement | equals true | verify-true - get-button Undo | get-property enablement | equals false | verify-true - get-button Redo | get-property enablement | equals false | verify-true - - // #################################################################### // - // // - // [I] Check behavior of the Add button with and without the clipboard // - // // - // #################################################################### // - - to-clipboard -input "" - - // Click add -> Create blank dependency - get-button Add | click -metaKeys "" - - // Invalid GAV -> Update & Finish button should be disabled - get-button Update | get-property enablement | equals false | verify-true - get-button Finish | get-property enablement | equals false | verify-true - - // Check error messages - get-editbox -after [get-label "Edit Maven Dependency"] | get-property text - | equals "The target location contains one or more incomplete Maven dependencies.\n" - + " Each dependency requires a group id, artifact id, version and type." | verify-true - - get-label "" -after [get-label "Edit Maven Dependency"] - | get-property "image.path" | equals "org.eclipse.jface/icons/full/message_error.png" | verify-true - - with [get-table | get-item -path ""] { - get-property "columns[0]" | equals "" | verify-true - get-property "columns[1]" | equals "" | verify-true - get-property "columns[2]" | equals "" | verify-true - } - - // Fill the row with meaningful data... - with [get-window "Maven Artifact Target Entry - Maven Central" | get-table] { - get-property "getItems().TableItem[19].getData().getClassifier()" | equals "" | verify-true - get-property "getItems().TableItem[19].getData().getType()" | equals jar | verify-true - get-property "getItems().TableItem[19].getData().getVersion()" | equals "" | verify-true - get-property "getItems().TableItem[19].getData().getGroupId()" | equals "" | verify-true - get-property "getItems().TableItem[19].getData().getArtifactId()" | equals "" | verify-true - // Check selection - get-property "getSelectionCount()" | equals 1 | verify-true - get-property "getSelection().TableItem[0].getData().getKey()" | equals "::jar:" | verify-true - // Set GAV to org.apache.commons:commons-lang3:3.12.0 - select "" | activate-cell-edit -type MouseClickSelection - get-editbox | set-text "org.apache.commons" - select "" | apply-cell-edit -deactivate - select "org.apache.commons" | activate-cell-edit -column 1 -type MouseClickSelection - get-editbox | set-text "commons-lang3" - select "org.apache.commons" | apply-cell-edit -deactivate - select "org.apache.commons" | activate-cell-edit -column 2 -type MouseClickSelection - get-editbox | set-text "3.12.0" - apply-cell-edit -deactivate - select "org.apache.commons" | activate-cell-edit -column 3 -type MouseClickSelection - } - - //Valid GAV -> Update & Finish button should now be enabled again - get-button Update | get-property enablement | equals true | verify-true - get-button Finish | get-property enablement | equals true | verify-true - - to-clipboard -input "\ - org.eclipse.platform\ - org.eclipse.core.runtime\ - 3.26.100\ - " - - // Click add -> Copy dependency from clipboard - get-button Add | click -metaKeys "" - - with [get-window "Maven Artifact Target Entry - Maven Central" | get-table] { - get-property "getItems().TableItem[20].getData().getClassifier()" | equals "" | verify-true - get-property "getItems().TableItem[20].getData().getType()" | equals jar | verify-true - get-property "getItems().TableItem[20].getData().getVersion()" | equals "3.26.100" | verify-true - get-property "getItems().TableItem[20].getData().getGroupId()" | equals "org.eclipse.platform" | verify-true - get-property "getItems().TableItem[20].getData().getArtifactId()" | equals "org.eclipse.core.runtime" - | verify-true - // Check selection - get-property "getSelectionCount()" | equals 1 | verify-true - get-property "getSelection().TableItem[0].getData().getKey()" - | equals "org.eclipse.platform:org.eclipse.core.runtime:jar:3.26.100" | verify-true - } - - // Check whether you can edit the remaining columns directly. I.e. whether SWT.FULL_SELECTION is enabled. - with [get-table] { - select "org.eclipse.jdt" | activate-cell-edit -type MouseClickSelection - get-editbox | set-text newGroupId - select "org.apache.commons" | apply-cell-edit -deactivate - select newGroupId | activate-cell-edit -column 1 -type MouseClickSelection - get-editbox | set-text newArtifactId - select "jakarta.xml.bind" | apply-cell-edit -deactivate - select "jakarta.xml.bind" | activate-cell-edit -column 2 -type MouseClickSelection - get-editbox | set-text newVersion - apply-cell-edit -deactivate - } - - // ############################################################################# // - // // - // [II] Check behavior of the Update button with one more more selected elements // - // // - // ############################################################################# // - - // Select org.jetbrains.kotlin:kotlin-stdlib-common -> Click Update - with [get-table] { - select "org.jetbrains.kotlin" | activate-cell-edit -type MouseClickSelection - get-editbox | click-text 1 21 - cancel-cell-edit - deactivate-cell-edit - } - - get-button Update | click -metaKeys "" - - with [get-table] { - get-property "getItems().TableItem[12].getData().getVersion()" | equals "1.7.22" | verify-false - } - - // Select org.jetbrains.kotlin:kotlin-stdlib-jdk7 to org.jetbrains.kotlin:kotlin-stdlib -> Click Update - with [get-table] { - select [get-item -path "org.jetbrains.kotlin" -index 1] | activate-cell-edit -type MouseClickSelection - get-editbox | click-text 1 21 - cancel-cell-edit - deactivate-cell-edit - select [get-item -path "org.jetbrains.kotlin" -index 3] [get-item -path "org.jetbrains.kotlin" - -index 2] [get-item -path "org.jetbrains.kotlin" -index 1] - } - - get-button Update | click -metaKeys "" - - with [get-table] { - get-property "getItems().TableItem[13].getData().getVersion()" | equals "1.7.22" | verify-false - get-property "getItems().TableItem[14].getData().getVersion()" | equals "1.7.22" | verify-false - get-property "getItems().TableItem[15].getData().getVersion()" | equals "1.7.22" | verify-false - } - - // ########################################################################## // - // // - // [III] Check behavior of the Remove button on one or more selected elements // - // // - // ########################################################################## // - - // Selected and remove com.fasterxml.jackson.core:jackson-annotations to com.fasterxml.jackson.core:jackson-databind - with [get-table] { - select "com.fasterxml.jackson.core" | activate-cell-edit -type MouseClickSelection - get-editbox | click-text 1 27 - cancel-cell-edit - deactivate-cell-edit - select [get-item -path "com.fasterxml.jackson.core" -index 2] [get-item -path "com.fasterxml.jackson.core" - -index 1] "com.fasterxml.jackson.core" - } - - get-button Remove | click -metaKeys "" - - // The selected elements should no longer be in the table, with com.github.ben-manes.caffeine:caffeine being the first element - with [get-table] { - get-property "getSelection().length" | equals 0 - get-property "getItemCount()" | equals 18 | verify-true - get-property "getItems().TableItem[0].getText()" | equals "com.github.ben-manes.caffeine" | verify-true - } - - get-button Undo | click -metaKeys "" - - // The artifacts com.fasterxml.jackson.core:jackson-annotations to com.fasterxml.jackson.core:jackson-databind are back and selected - with [get-table] { - get-property "getItemCount()" | equals 21 | verify-true - get-property "getSelection().length" | equals 3 | verify-true - get-property "getSelection().TableItem[0].getData().getKey()" - | equals "com.fasterxml.jackson.core:jackson-annotations:jar:2.14.1" | verify-true - get-property "getSelection().TableItem[1].getData().getKey()" - | equals "com.fasterxml.jackson.core:jackson-core:jar:2.14.1" | verify-true - get-property "getSelection().TableItem[2].getData().getKey()" - | equals "com.fasterxml.jackson.core:jackson-databind:jar:2.14.1" | verify-true - } - - // Select and remove com.squareup.okio:okio-jvm - with [get-table] { - select "com.squareup.okio" | activate-cell-edit -type MouseClickSelection - get-editbox | click-text 1 18 - cancel-cell-edit - deactivate-cell-edit - } - - get-button Remove | click -metaKeys "" - - // The artifact jakarta.activation:jakarta.activation-api should now be selected, because it now at the same position as the removed element - with [get-table] { - get-property "getSelection().length" | equals 1 | verify-true - get-property "getSelection().TableItem[0].getData().getKey()" - | equals "jakarta.activation:jakarta.activation-api:jar:1.2.2" | verify-true - } - - // ############################################ // - // // - // [IV] Check behavior when sorting by columns // - // // - // ############################################ // - - with [get-table] { - // Sort by Version -> jakarta.inject:jakarta.inject-api should be first element - get-column-header Version | click - get-property "getItems().TableItem[0].getData().getKey()" | equals "jakarta.inject:jakarta.inject-api:jar:1.0.5" - | verify-true - // Sort by Artifact Id -> com.github.ben-manes.caffeine:caffeine should be the first element - get-column-header "Artifact Id" | click - get-property "getItems().TableItem[0].getData().getKey()" - | equals "com.github.ben-manes.caffeine:caffeine:jar:3.1.2" | verify-true - // Sort by Group Id -> com.fasterxml.jackson.core:jackson-annotations should be the first element - get-column-header "Group Id" | click - get-property "getItems().TableItem[0].getData().getKey()" - | equals "com.fasterxml.jackson.core:jackson-annotations:jar:2.14.1" | verify-true - } - - // Check whether dependencies are inserted into the correct position when the table is sorted - to-clipboard -input "\ - com.fasterxml.jackson.core\ - jackson-databind\ - 2.14.0\ - " - - get-button Add | click -metaKeys "" - - with [get-table] { - get-property enablement | equals true | verify-true - get-property "getItems().TableItem[2].getData().getKey()" - | equals "com.fasterxml.jackson.core:jackson-databind:jar:2.14.0" | verify-true - } - - // ################################## // - // // - // [V] Check multi-selection behavior // - // // - // ################################## // - - // Make sure items don't get lost when selecting more than one element - with [get-table] { - // Forward selection - select "com.fasterxml.jackson.core" | activate-cell-edit -type MouseClickSelection - get-editbox | click-text 1 27 - cancel-cell-edit - deactivate-cell-edit - select "com.github.ben-manes.caffeine" [get-item -path "com.fasterxml.jackson.core" -index 3] [get-item - -path "com.fasterxml.jackson.core" -index 2] [get-item -path "com.fasterxml.jackson.core" - -index 1] "com.fasterxml.jackson.core" - - get-property "selection[0].path[0]" | equals "com.fasterxml.jackson.core" | verify-true - get-property "selection[1].path[0]" | equals "com.fasterxml.jackson.core%1%" | verify-true - get-property "selection[2].path[0]" | equals "com.fasterxml.jackson.core%2%" | verify-true - get-property "selection[3].path[0]" | equals "com.fasterxml.jackson.core%3%" | verify-true - get-property "selection[4].path[0]" | equals "com.github.ben-manes.caffeine" | verify-true - - // Backward selection - select [get-item -path "org.slf4j" -index 2] | activate-cell-edit -type MouseClickSelection - get-editbox | click-text 1 10 - cancel-cell-edit - deactivate-cell-edit - select [get-item -path "org.slf4j" -index 2] [get-item -path "org.slf4j" -index 1] "org.slf4j" [get-item - -path "org.jetbrains.kotlin" -index 3] [get-item -path "org.jetbrains.kotlin" -index 2] - - get-property "selection[0].path[0]" | equals "org.jetbrains.kotlin%2%" | verify-true - get-property "selection[1].path[0]" | equals "org.jetbrains.kotlin%3%" | verify-true - get-property "selection[2].path[0]" | equals "org.slf4j" | verify-true - get-property "selection[3].path[0]" | equals "org.slf4j%1%" | verify-true - get-property "selection[4].path[0]" | equals "org.slf4j%2%" | verify-true - } -} -------=_.content-0a7243a0-75d3-3d5f-9791-539de0e5b7ac-- diff --git a/org.eclipse.m2e.rcptt.tests/src/Tests/org.eclipse.m2e.pde.ui/_Context/WorkspaceWithTargetPlatform.ctx b/org.eclipse.m2e.rcptt.tests/src/Tests/org.eclipse.m2e.pde.ui/_Context/WorkspaceWithTargetPlatform.ctx deleted file mode 100644 index bf7434a66a..0000000000 --- a/org.eclipse.m2e.rcptt.tests/src/Tests/org.eclipse.m2e.pde.ui/_Context/WorkspaceWithTargetPlatform.ctx +++ /dev/null @@ -1,60 +0,0 @@ ---- RCPTT testcase --- -Format-Version: 1.0 -Context-Type: org.eclipse.rcptt.ctx.workspace -Element-Name: WorkspaceWithTargetPlatform -Element-Type: context -Element-Version: 2.0 -Id: _mo5J8IfaEe2N1bfX2b9TRQ -Runtime-Version: 2.5.4.202210020716 -Save-Time: 12/30/22, 1:40 AM - -------=_contents/target-platform/target-platform.target-39adf134-5244-371e-a7da-2823002f1d57 -Content-Type: q7/binary -Entry-Name: contents/target-platform/target-platform.target - -UEsDBBQACAgIAAAAIQAAAAAAAAAAAAAAAAAIAAkALmNvbnRlbnRVVAUAAQAAAADdl8+OmzAQxs+bp0Dc -cUjYNjlAcmhVqYc9bfsAE3sgJsamtkmbt6+B/NnNSjXSiijdnGD4Bn+/kT1k0vWfSgR71IYrmYUzEocB -SqoYl0UW/vzxLVqGgbEgGQglMQulCterSbquGV7SErLsohZ0gTaQUDllfxPVAmyudBWuJoH7pUJRsC7L -rCYPrwIBl1Q0DL9ijZI5Ewd3ZbftkhLDt0+fqarRZCFVVc3FRfGsGk3b9XXjggI2KLLwCfYogy8orQYR -BhU3xhE+geQ5GpuFBUrUYF2CPdR41DvLD71HdlqVY+v7OnroYn2w0Kqpv7OVs0VyMBa1qzApge6MkoQq -jen0pLlkgbY8B2pd8CiNQEpl+1Kl0xfPL0nH+q/mZPZIZun0dH9RtDDuhTqddldn59Mr6zfA6aX/PwcD -Cxsu2Z2wFNxumw3ZoIwqkGgIhTxHLn04F9k/MRIyI/PxKcyvBjQ2NVG7rbV14jHfqzzWXfljEt/UO1de -41xF5b7yVn0+tvMSds4CEGeB77su493/1wkR1NwD4jbP2Nvn7OvcLoeCnBMGgSTk021AuCyR2oEQvXgQ -QHwrgN+GaDPQf6cdYN+1U/L5Nvbb70Lf4AcRnOSDIBKSjAuhdEGQCl4bJCXz7aIr9asz5CGZk0U8cotq -3ZVoNxq4NGSnrOC+s92LImOZ4Bv3l6OqvCgzsiDzkXvUu0lKtlt8EI7lB+C4EwQj8sfS16aoiJQzEh3F -nmMdj91lh/ruNIN66p1ZNryqhX/SeZ/rq1g/lfbB0zh9HLenL+Zt99JuJl/9BVBLBwjVgN3qVwIAAPYP -AABQSwECFAAUAAgICAAAACEA1YDd6lcCAAD2DwAACAAJAAAAAAAAAAAAAAAAAAAALmNvbnRlbnRVVAUA -AQAAAABQSwUGAAAAAAEAAQA/AAAAlgIAAAAA -------=_contents/target-platform/target-platform.target-39adf134-5244-371e-a7da-2823002f1d57-- -------=_contents/target-platform/.project-faabef30-8b6b-367d-9526-544b3980ac44 -Content-Type: q7/binary -Entry-Name: contents/target-platform/.project - -UEsDBBQACAgIAAAAIQAAAAAAAAAAAAAAAAAIAAkALmNvbnRlbnRVVAUAAQAAAABVjsEOwiAQRM/2Kxru -Fb15oPRi+gPqByBdGwwsZNkaP1+s2tjbm5mdzajuGXz9AMouYiv2252oAW0cHI6tuJz75iA6XalE8Q6W -j5AtucTlWFcbhSaAZkMjcJO84VukoOTsltTGEABZK/mjYn4f5TfLf3GdnB9OCeycrBQangg+lYWX9mrT -C1BLBwhlg0YFhgAAANAAAABQSwECFAAUAAgICAAAACEAZYNGBYYAAADQAAAACAAJAAAAAAAAAAAAAAAA -AAAALmNvbnRlbnRVVAUAAQAAAABQSwUGAAAAAAEAAQA/AAAAxQAAAAAA -------=_contents/target-platform/.project-faabef30-8b6b-367d-9526-544b3980ac44-- -------=_contents/target-platform/.settings/org.eclipse.core.resources.prefs-423fdf98-40c5-315c-9909-2031eed35758 -Content-Type: q7/binary -Entry-Name: contents/target-platform/.settings/org.eclipse.core.resources.prefs - -UEsDBBQACAgIAAAAIQAAAAAAAAAAAAAAAAAIAAkALmNvbnRlbnRVVAUAAQAAAABLTc7JLChO1SsoSk1L -LUrNS04t1itLLSrOzM+zNeQC8vNTMvPS9W0KivKzUpNL7GxDQ9x0LbgAUEsHCA3o3k03AAAANwAAAFBL -AQIUABQACAgIAAAAIQAN6N5NNwAAADcAAAAIAAkAAAAAAAAAAAAAAAAAAAAuY29udGVudFVUBQABAAAA -AFBLBQYAAAAAAQABAD8AAAB2AAAAAAA= -------=_contents/target-platform/.settings/org.eclipse.core.resources.prefs-423fdf98-40c5-315c-9909-2031eed35758-- -------=_.q7.content-3d2e0690-ce48-3609-83e0-c704d49f1eaf -Content-Type: q7/binary -Entry-Name: .q7.content - -UEsDBBQACAgIAAAAIQAAAAAAAAAAAAAAAAAIAAkALmNvbnRlbnRVVAUAAQAAAACVkV1rgzAUhu/7K0Lu -m6zCoBO1F2MXHWxso9DeDRtPbDZNJDmd/vxFa0RKYewuH895Tt6TZNPVFfkB65TRKV2xO0pAC1MoXab0 -jHK5pptskRhbMhCVahwwKxpEJrBjrbHfrskFxPuwejQaoUPS1SqetFGv9Y20i/15Sk+ITcx527bM1CXz -cn542Qbkj15TeWD68oHjnuMTR4nOa09PT9srPO1yWwK+VTlKY2tKVJHSz9rcP6+3Mn+C6HV1lIfo+LD7 -eKfZgpBE9Hk09mu/a6z5AoFuVONgWzZBd6E8J1UFAWJjEeU3r68c7LKfw6Yq/CCDzQGi/xw3Nbvyzacn -jPUjBGfOVoDzDwHpZmY+qsdwPKQbgvMpecL/+/vZ4hdQSwcIDa6p8x0BAABYAgAAUEsBAhQAFAAICAgA -AAAhAA2uqfMdAQAAWAIAAAgACQAAAAAAAAAAAAAAAAAAAC5jb250ZW50VVQFAAEAAAAAUEsFBgAAAAAB -AAEAPwAAAFwBAAAAAA== -------=_.q7.content-3d2e0690-ce48-3609-83e0-c704d49f1eaf-- diff --git a/org.eclipse.m2e.rcptt.tests/src/Verification/Empty Log Verification.verification b/org.eclipse.m2e.rcptt.tests/src/Verification/Empty Log Verification.verification deleted file mode 100644 index 56be463402..0000000000 --- a/org.eclipse.m2e.rcptt.tests/src/Verification/Empty Log Verification.verification +++ /dev/null @@ -1,25 +0,0 @@ ---- RCPTT verification --- -Format-Version: 1.0 -Element-Name: Empty Log Verification -Element-Type: verification -Element-Version: 2.0 -Id: _7el9kIfGEe2DibE_7T1Sqw -Runtime-Version: 2.5.4.202210020716 -Save-Time: 12/29/22, 11:33 PM -Verification-Type: org.eclipse.rcptt.verifications.log - -------=_.description-216f885c-d591-38ce-8ea2-e4f8cb4d6ffa -Content-Type: text/plain -Entry-Name: .description - -Validates that no error has been thrown during the test execution. -------=_.description-216f885c-d591-38ce-8ea2-e4f8cb4d6ffa-- -------=_.errorlog.verification-3ceb5b18-8b7c-3939-9191-416e6e78eb57 -Content-Type: text/errorlog-verification -Entry-Name: .errorlog.verification - -INCLUDE CONTEXTS: true -DENIED: -4 0 .* Message:.* - -------=_.errorlog.verification-3ceb5b18-8b7c-3939-9191-416e6e78eb57-- diff --git a/org.eclipse.m2e.swtbot.tests/.classpath b/org.eclipse.m2e.swtbot.tests/.classpath new file mode 100644 index 0000000000..9479140d1b --- /dev/null +++ b/org.eclipse.m2e.swtbot.tests/.classpath @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/org.eclipse.m2e.swtbot.tests/.project b/org.eclipse.m2e.swtbot.tests/.project new file mode 100644 index 0000000000..678256ff9a --- /dev/null +++ b/org.eclipse.m2e.swtbot.tests/.project @@ -0,0 +1,34 @@ + + + org.eclipse.m2e.swtbot.tests + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.eclipse.pde.PluginNature + + diff --git a/org.eclipse.m2e.rcptt.tests/.settings/org.eclipse.core.resources.prefs b/org.eclipse.m2e.swtbot.tests/.settings/org.eclipse.core.resources.prefs similarity index 100% rename from org.eclipse.m2e.rcptt.tests/.settings/org.eclipse.core.resources.prefs rename to org.eclipse.m2e.swtbot.tests/.settings/org.eclipse.core.resources.prefs diff --git a/org.eclipse.m2e.swtbot.tests/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.m2e.swtbot.tests/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000..66dee60c5a --- /dev/null +++ b/org.eclipse.m2e.swtbot.tests/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,14 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate +org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +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 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=17 diff --git a/org.eclipse.m2e.swtbot.tests/META-INF/MANIFEST.MF b/org.eclipse.m2e.swtbot.tests/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..38832af77b --- /dev/null +++ b/org.eclipse.m2e.swtbot.tests/META-INF/MANIFEST.MF @@ -0,0 +1,16 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: SWTBot Integration Tests +Bundle-SymbolicName: org.eclipse.m2e.swtbot.tests +Bundle-Version: 2.1.0.qualifier +Require-Bundle: org.eclipse.m2e.core, + org.eclipse.m2e.tests.common, + org.eclipse.core.resources;bundle-version="3.20.200", + org.eclipse.core.runtime;bundle-version="3.31.100", + org.eclipse.swt;bundle-version="3.126.0", + org.eclipse.swtbot.eclipse.finder;bundle-version="4.2.1", + org.eclipse.ui.workbench;bundle-version="3.132.0", + org.eclipse.ui.ide;bundle-version="3.22.200", + org.junit;bundle-version="4.13.2" +Bundle-RequiredExecutionEnvironment: JavaSE-17 +Automatic-Module-Name: org.eclipse.m2e.rcptt.tests diff --git a/org.eclipse.m2e.swtbot.tests/build.properties b/org.eclipse.m2e.swtbot.tests/build.properties new file mode 100644 index 0000000000..34d2e4d2da --- /dev/null +++ b/org.eclipse.m2e.swtbot.tests/build.properties @@ -0,0 +1,4 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/org.eclipse.m2e.swtbot.tests/pom.xml b/org.eclipse.m2e.swtbot.tests/pom.xml new file mode 100644 index 0000000000..ac93077d01 --- /dev/null +++ b/org.eclipse.m2e.swtbot.tests/pom.xml @@ -0,0 +1,18 @@ + + 4.0.0 + + + org.eclipse.m2e + m2e-core + 2.1.0-SNAPSHOT + + + org.eclipse.m2e.swtbot.tests + eclipse-test-plugin + M2E - SWTBot Integration tests + + + false + + diff --git a/org.eclipse.m2e.swtbot.tests/resources/projects/target-platform/.project b/org.eclipse.m2e.swtbot.tests/resources/projects/target-platform/.project new file mode 100644 index 0000000000..cedbacfaba --- /dev/null +++ b/org.eclipse.m2e.swtbot.tests/resources/projects/target-platform/.project @@ -0,0 +1,11 @@ + + + target-platform + + + + + + + + diff --git a/org.eclipse.m2e.swtbot.tests/resources/projects/target-platform/.settings/org.eclipse.core.resources.prefs b/org.eclipse.m2e.swtbot.tests/resources/projects/target-platform/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000000..2446d971e3 --- /dev/null +++ b/org.eclipse.m2e.swtbot.tests/resources/projects/target-platform/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 + diff --git a/org.eclipse.m2e.swtbot.tests/resources/projects/target-platform/target-platform.target b/org.eclipse.m2e.swtbot.tests/resources/projects/target-platform/target-platform.target new file mode 100644 index 0000000000..b777b09495 --- /dev/null +++ b/org.eclipse.m2e.swtbot.tests/resources/projects/target-platform/target-platform.target @@ -0,0 +1,124 @@ + + + + + + + + com.fasterxml.jackson.core + jackson-annotations + 2.14.1 + jar + + + com.fasterxml.jackson.core + jackson-core + 2.14.1 + jar + + + com.fasterxml.jackson.core + jackson-databind + 2.14.1 + jar + + + com.github.ben-manes.caffeine + caffeine + 3.1.2 + jar + + + com.squareup.okhttp3 + okhttp + 4.10.0 + jar + + + com.squareup.okio + okio-jvm + 3.2.0 + jar + + + jakarta.activation + jakarta.activation-api + 1.2.2 + jar + + + jakarta.annotation + jakarta.annotation-api + 1.3.5 + jar + + + jakarta.inject + jakarta.inject-api + 1.0.5 + jar + + + jakarta.ws.rs + jakarta.ws.rs-api + 2.1.6 + jar + + + jakarta.xml.bind + jakarta.xml.bind-api + 2.3.3 + jar + + + org.eclipse.jdt + org.eclipse.jdt.annotation + 2.2.700 + jar + + + org.jetbrains.kotlin + kotlin-stdlib-common + 1.7.22 + jar + + + org.jetbrains.kotlin + kotlin-stdlib-jdk7 + 1.7.22 + jar + + + org.jetbrains.kotlin + kotlin-stdlib-jdk8 + 1.7.22 + jar + + + org.jetbrains.kotlin + kotlin-stdlib + 1.7.22 + jar + + + org.slf4j + jcl-over-slf4j + 2.0.6 + jar + + + org.slf4j + slf4j-api + 2.0.6 + jar + + + org.slf4j + slf4j-simple + 2.0.6 + jar + + + + + diff --git a/org.eclipse.m2e.swtbot.tests/src/org/eclipse/m2e/pde/ui/MavenTargetDependencyEditorTest.java b/org.eclipse.m2e.swtbot.tests/src/org/eclipse/m2e/pde/ui/MavenTargetDependencyEditorTest.java new file mode 100644 index 0000000000..20f02b7706 --- /dev/null +++ b/org.eclipse.m2e.swtbot.tests/src/org/eclipse/m2e/pde/ui/MavenTargetDependencyEditorTest.java @@ -0,0 +1,349 @@ +package org.eclipse.m2e.pde.ui; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.m2e.tests.common.AbstractMavenProjectTestCase; +import org.eclipse.swt.dnd.Clipboard; +import org.eclipse.swt.dnd.TextTransfer; +import org.eclipse.swt.dnd.Transfer; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; +import org.eclipse.swtbot.eclipse.finder.waits.Conditions; +import org.eclipse.swtbot.swt.finder.SWTBot; +import org.eclipse.swtbot.swt.finder.matchers.WithText; +import org.eclipse.swtbot.swt.finder.utils.TableCollection; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.ide.IDE; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * Integration tests for {@code MavenTargetDependencyEditor} using SWTBot. + */ +public class MavenTargetDependencyEditorTest extends AbstractMavenProjectTestCase { + private static final String MAVEN_EDITOR_TITLE = "Maven Artifact Target Entry - Maven Central"; + private static final String TARGET_FILE = "target-platform.target"; + private SWTWorkbenchBot workbench; + + @Before + public void setUp() throws Exception { + if (Display.getCurrent() != null) { + fail(""" + SWTBot test needs to run in a non-UI thread. + Make sure that "Run in UI thread" is unchecked in your launch configuration or that useUIThread is set to false in the pom.xml + """); + } + super.setUp(); + // Open target editor + IProject project = importEclipseProject("target-platform", "resources/projects/target-platform"); + IFile targetFile = project.getFile(TARGET_FILE); + workbench = new SWTWorkbenchBot(); + workbench.getDisplay().syncCall(() -> IDE.openEditor(getActivePage(), targetFile)); + } + + @After + public void tearDown() throws Exception { + for (Shell shell : workbench.getFinder().findShells(MAVEN_EDITOR_TITLE)) { + workbench.getDisplay().syncExec(shell::dispose); + } + super.tearDown(); + } + + private IWorkbenchPage getActivePage() { + return workbench.getDisplay().syncCall(() -> PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()); + } + + private SWTBot openTargetEditor() { + SWTBot editor = workbench.editorByTitle(TARGET_FILE).bot(); + SWTBotTree locations = editor.tree(); + // This name is only set once the target platform has been resolved + SWTBotTreeItem mavenLocation = locations.getTreeItem("Maven Central 38 plug-ins available"); + mavenLocation.doubleClick(); + // Opening the editor may take a few seconds... + workbench.waitUntil(Conditions.waitForShell(WithText.withText(MAVEN_EDITOR_TITLE))); + return workbench.shell(MAVEN_EDITOR_TITLE).bot(); + } + + /** + * Checks whether the initial "enablement" state of all buttons in the Maven + * dependency editor is set correctly. + */ + @Test + public void testInitialButtonState() { + SWTBot dialog = openTargetEditor(); + assertTrue(dialog.button("Add").isEnabled()); + assertTrue(dialog.button("Remove").isEnabled()); + assertTrue(dialog.button("Update").isEnabled()); + assertFalse(dialog.button("Undo").isEnabled()); + assertFalse(dialog.button("Redo").isEnabled()); + } + + /** + * Checks whether new Maven coordinates can be added and edited. + */ + @Test + public void testAddMavenLocation() { + SWTBot dialog = openTargetEditor(); + workbench.getDisplay().syncExec(() -> { + Clipboard clipboard = new Clipboard(workbench.getDisplay()); + clipboard.setContents(new Object[] { + """ + + """ + }, new Transfer[] { TextTransfer.getInstance() }); + clipboard.dispose(); + }); + dialog.button("Add").click(); + + SWTBotTable table = dialog.table(); + assertEquals(table.cell(19, 0), ""); + assertEquals(table.cell(19, 1), ""); + assertEquals(table.cell(19, 2), ""); + assertEquals(table.cell(19, 3), ""); + assertEquals(table.cell(19, 4), "jar"); + + assertFalse(dialog.button("Update").isEnabled()); + assertFalse(dialog.button("Finish").isEnabled()); + + table.click(19, 0); + dialog.text("").setText("org.apache.commons"); + table.click(19, 1); + dialog.text("").setText("commons-lang3"); + table.click(19, 2); + dialog.text("").setText("3.12.0"); + table.click(19, 3); // Close cell editor + + assertTrue(dialog.button("Update").isEnabled()); + assertTrue(dialog.button("Finish").isEnabled()); + + assertEquals(table.cell(19, 0), "org.apache.commons"); + assertEquals(table.cell(19, 1), "commons-lang3"); + assertEquals(table.cell(19, 2), "3.12.0"); + assertEquals(table.cell(19, 3), ""); + assertEquals(table.cell(19, 4), "jar"); + } + + /** + * Checks whether adding Maven dependencies from the clipboard is supported. + */ + @Test + public void testAddMavenLocationWithClipboard() { + SWTBot dialog = openTargetEditor(); + workbench.getDisplay().syncExec(() -> { + Clipboard clipboard = new Clipboard(workbench.getDisplay()); + clipboard.setContents(new Object[] { + """ + + org.eclipse.platform + org.eclipse.core.runtime + 3.26.100 + " + """ + }, new Transfer[] { TextTransfer.getInstance() }); + clipboard.dispose(); + }); + dialog.button("Add").click(); + + SWTBotTable table = dialog.table(); + assertEquals(table.cell(19, 0), "org.eclipse.platform"); + assertEquals(table.cell(19, 1), "org.eclipse.core.runtime"); + assertEquals(table.cell(19, 2), "3.26.100"); + assertEquals(table.cell(19, 3), ""); + assertEquals(table.cell(19, 4), "jar"); + } + + /** + * Tests whether the cells can be edited directly without first having to select + * the row (only possible with SWT.FULL_SELECTION). + */ + @Test + public void testEditCellsDirectly() { + SWTBot dialog = openTargetEditor(); + + SWTBotTable table = dialog.table(); + table.click(0, 0); + dialog.text("com.fasterxml.jackson.core").setText("a"); + table.click(1, 1); + dialog.text("jackson-core").setText("b"); + table.click(2, 2); + dialog.text("2.14.1").setText("c"); + table.click(0, 0); // Close cell editor + + assertEquals(table.cell(0, 0), "a"); + assertEquals(table.cell(1, 1), "b"); + assertEquals(table.cell(2, 2), "c"); + } + + /** + * Tests whether the version of one or more dependencies can be updated. + */ + @Test + public void testUpdateMavenArtifactVersion() { + SWTBot dialog = openTargetEditor(); + + SWTBotTable table = dialog.table(); + // Update single artifact + assertEquals(table.cell(12, 1), "kotlin-stdlib-common"); + assertEquals(table.cell(12, 2), "1.7.22"); + + table.select(12); + dialog.button("Update").click(); + + assertEquals(table.cell(12, 1), "kotlin-stdlib-common"); + assertNotEquals(table.cell(12, 2), "1.7.22"); + + // Update multiple artifacts + assertEquals(table.cell(13, 1), "kotlin-stdlib-jdk7"); + assertEquals(table.cell(13, 2), "1.7.22"); + assertEquals(table.cell(15, 1), "kotlin-stdlib"); + assertEquals(table.cell(15, 2), "1.7.22"); + + table.select(13, 15); + dialog.button("Update").click(); + + assertEquals(table.cell(13, 1), "kotlin-stdlib-jdk7"); + assertNotEquals(table.cell(13, 2), "1.7.22"); + assertEquals(table.cell(15, 1), "kotlin-stdlib"); + assertNotEquals(table.cell(15, 2), "1.7.22"); + } + + /** + * Tests whether one or more artifacts can be deleted and whether the selection + * is updated correctly. + */ + @Test + public void testRemoveArtifacts() { + SWTBot dialog = openTargetEditor(); + + // Removing multiple elements clears the selection + SWTBotTable table = dialog.table(); + assertEquals(table.cell(0, 1), "jackson-annotations"); + assertEquals(table.cell(1, 1), "jackson-core"); + assertEquals(table.cell(2, 1), "jackson-databind"); + table.select(0, 1, 2); + + dialog.button("Remove").click(); + assertEquals(table.cell(0, 1), "caffeine"); + assertEquals(table.selectionCount(), 0); + + // Removing a single element selects the next element + assertEquals(table.cell(3, 1), "jakarta.activation-api"); + table.select(3); + + dialog.button("Remove").click(); + assertEquals(table.cell(3, 1), "jakarta.annotation-api"); + assertEquals(table.selectionCount(), 1); + assertEquals(table.selection().get(0, 1), "jakarta.annotation-api"); + } + + /** + * Tests whether changes to the artifacts can be tracked via undo/redo. + */ + @Test + public void testUndoRedo() { + SWTBot dialog = openTargetEditor(); + + SWTBotTable table = dialog.table(); + assertEquals(table.cell(6, 1), "jakarta.activation-api"); + + // Tests undo/redo on removal + table.select(6); + dialog.button("Remove").click(); + assertEquals(table.cell(6, 1), "jakarta.annotation-api"); + + dialog.button("Undo").click(); + assertEquals(table.cell(6, 1), "jakarta.activation-api"); + + dialog.button("Redo").click(); + assertEquals(table.cell(6, 1), "jakarta.annotation-api"); + + // Tests undo/redo on editing + table.click(6, 1); + dialog.text("jakarta.annotation-api").setText("foo"); + table.click(6, 2); // Close cell editor + assertEquals(table.cell(6, 1), "foo"); + + dialog.button("Undo").click(); + assertEquals(table.cell(6, 1), "jakarta.annotation-api"); + + dialog.button("Redo").click(); + assertEquals(table.cell(6, 1), "foo"); + } + + /** + * Tests whether artifacts are correctly sorted by the selected columns and + * whether items are inserted at the correct location. + */ + @Test + public void testColumnSorting() { + SWTBot dialog = openTargetEditor(); + SWTBotTable table = dialog.table(); + + // Sort by Version + table.header("Version").click(); + assertEquals(table.cell(0, 1), "jakarta.inject-api"); + + // Sort by Artifact Id + table.header("Artifact Id").click(); + assertEquals(table.cell(0, 1), "caffeine"); + + // Sort by Artifact Id + table.header("Group Id").click(); + assertEquals(table.cell(0, 1), "jackson-annotations"); + + workbench.getDisplay().syncExec(() -> { + Clipboard clipboard = new Clipboard(workbench.getDisplay()); + clipboard.setContents(new Object[] { + """ + + com.fasterxml.jackson.core + jackson-databind + 2.14.0 + " + """ + }, new Transfer[] { TextTransfer.getInstance() }); + clipboard.dispose(); + }); + dialog.button("Add").click(); + assertEquals(table.cell(2, 1), "jackson-databind"); + } + + /** + * Tests whether items are preserved when selecting more than one element. + */ + @Test + public void testMultiSelection() { + SWTBot dialog = openTargetEditor(); + SWTBotTable table = dialog.table(); + + // Forward selection + table.select(0, 1, 2, 3); + TableCollection selection = table.selection(); + assertEquals(selection.rowCount(), 4); + assertEquals(selection.get(0, 1), "jackson-annotations"); + assertEquals(selection.get(1, 1), "jackson-core"); + assertEquals(selection.get(2, 1), "jackson-databind"); + assertEquals(selection.get(3, 1), "caffeine"); + + // Backward selection + table.select(16, 15, 14, 13); + selection = table.selection(); + assertEquals(selection.rowCount(), 4); + assertEquals(selection.get(0, 1), "kotlin-stdlib-jdk7"); + assertEquals(selection.get(1, 1), "kotlin-stdlib-jdk8"); + assertEquals(selection.get(2, 1), "kotlin-stdlib"); + assertEquals(selection.get(3, 1), "jcl-over-slf4j"); + } +} diff --git a/org.eclipse.m2e.tests.common/META-INF/MANIFEST.MF b/org.eclipse.m2e.tests.common/META-INF/MANIFEST.MF index f02dc6f5a7..4d41a7d13f 100644 --- a/org.eclipse.m2e.tests.common/META-INF/MANIFEST.MF +++ b/org.eclipse.m2e.tests.common/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: M2E Testing Helpers Bundle-SymbolicName: org.eclipse.m2e.tests.common;singleton:=true -Bundle-Version: 2.0.7.qualifier +Bundle-Version: 2.0.8.qualifier Require-Bundle: org.junit;bundle-version="4.0.0", org.eclipse.m2e.core;bundle-version="[2.0.0,3.0.0)", org.eclipse.m2e.maven.runtime;bundle-version="[3.8.6,4.0.0)", @@ -21,6 +21,6 @@ Bundle-RequiredExecutionEnvironment: JavaSE-17 Bundle-Vendor: Eclipse.org - m2e MavenArtifact-GroupId: org.eclipse.m2e MavenArtifact-ArtifactId: org.eclipse.m2e.tests.common -Export-Package: org.eclipse.m2e.tests.common;x-friends:="org.eclipse.m2e.tests,org.eclipse.m2e.core.tests,org.eclipse.m2e.jdt.tests,org.eclipse.m2e.core.ui.tests,org.eclipse.m2e.wtp.tests" +Export-Package: org.eclipse.m2e.tests.common;x-friends:="org.eclipse.m2e.tests,org.eclipse.m2e.core.tests,org.eclipse.m2e.jdt.tests,org.eclipse.m2e.core.ui.tests,org.eclipse.m2e.wtp.tests,org.eclipse.m2e.swtbot.tests" Import-Package: org.eclipse.jetty.io;version="12.0.0" Automatic-Module-Name: org.eclipse.m2e.tests.common diff --git a/org.eclipse.m2e.tests.common/src/org/eclipse/m2e/tests/common/AbstractMavenProjectTestCase.java b/org.eclipse.m2e.tests.common/src/org/eclipse/m2e/tests/common/AbstractMavenProjectTestCase.java index 9b86f4cce7..7a51c1876c 100644 --- a/org.eclipse.m2e.tests.common/src/org/eclipse/m2e/tests/common/AbstractMavenProjectTestCase.java +++ b/org.eclipse.m2e.tests.common/src/org/eclipse/m2e/tests/common/AbstractMavenProjectTestCase.java @@ -54,6 +54,7 @@ import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.resources.IWorkspaceDescription; +import org.eclipse.core.resources.IWorkspaceRoot; import org.eclipse.core.resources.IWorkspaceRunnable; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; @@ -577,6 +578,22 @@ protected IProject importProject(String projectName, String projectLocation, return workspace.getRoot().getProject(projectName); } + protected IProject importEclipseProject(String name, String base) throws Exception { + IWorkspaceRoot root = workspace.getRoot(); + // copy + File src = new File(base); + File dst = new File(root.getLocation().toFile(), name); + copyDir(src, dst); + + IProject project = root.getProject(name); + project.create(monitor); + + if(!project.isOpen()) { + project.open(monitor); + } + return project; + } + protected void waitForJobsToComplete() throws InterruptedException, CoreException { waitForJobsToComplete(monitor); } diff --git a/pom.xml b/pom.xml index 22be31246f..0d63f7ad08 100644 --- a/pom.xml +++ b/pom.xml @@ -95,7 +95,7 @@ products - org.eclipse.m2e.rcptt.tests + org.eclipse.m2e.swtbot.tests diff --git a/target-platform/target-platform.target b/target-platform/target-platform.target index d8c6037c7e..7157ab9dfe 100644 --- a/target-platform/target-platform.target +++ b/target-platform/target-platform.target @@ -45,6 +45,10 @@ + + + +