diff --git a/org.eclipse.m2e.pde.target/META-INF/MANIFEST.MF b/org.eclipse.m2e.pde.target/META-INF/MANIFEST.MF index 877345cab3..96f8d01c91 100644 --- a/org.eclipse.m2e.pde.target/META-INF/MANIFEST.MF +++ b/org.eclipse.m2e.pde.target/META-INF/MANIFEST.MF @@ -11,7 +11,7 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.27.0,4.0.0)", org.eclipse.m2e.maven.runtime;bundle-version="[3.8.0,4.0.0)", org.eclipse.m2e.core;bundle-version="[2.0.0,3.0.0)", org.eclipse.core.resources -Export-Package: org.eclipse.m2e.pde.target;x-friends:="org.eclipse.m2e.pde.ui", +Export-Package: org.eclipse.m2e.pde.target;x-friends:="org.eclipse.m2e.pde.ui,org.eclipse.m2e.swtbot.tests", org.eclipse.m2e.pde.target.shared;x-internal:=true Bundle-ActivationPolicy: lazy Import-Package: aQute.bnd.osgi;version="[5.5.0,8.0.0)", diff --git a/org.eclipse.m2e.pde.target/src/org/eclipse/m2e/pde/target/MavenTargetLocationFactory.java b/org.eclipse.m2e.pde.target/src/org/eclipse/m2e/pde/target/MavenTargetLocationFactory.java index d56e52b331..41a1f55463 100644 --- a/org.eclipse.m2e.pde.target/src/org/eclipse/m2e/pde/target/MavenTargetLocationFactory.java +++ b/org.eclipse.m2e.pde.target/src/org/eclipse/m2e/pde/target/MavenTargetLocationFactory.java @@ -30,7 +30,6 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.Status; -import org.eclipse.pde.core.target.ITargetLocation; import org.eclipse.pde.core.target.ITargetLocationFactory; import org.eclipse.pde.internal.core.ifeature.IFeature; import org.w3c.dom.Document; @@ -44,7 +43,7 @@ public class MavenTargetLocationFactory implements ITargetLocationFactory { private static final String ATTRIBUTE_DEPENDENCY_SCOPE = "includeDependencyScope"; @Override - public ITargetLocation getTargetLocation(String type, String serializedXML) throws CoreException { + public MavenTargetLocation getTargetLocation(String type, String serializedXML) throws CoreException { try { Element location = parseXMLDocument(serializedXML).getDocumentElement(); diff --git a/org.eclipse.m2e.pde.ui/META-INF/MANIFEST.MF b/org.eclipse.m2e.pde.ui/META-INF/MANIFEST.MF index 75caf154f7..bb09df6d00 100644 --- a/org.eclipse.m2e.pde.ui/META-INF/MANIFEST.MF +++ b/org.eclipse.m2e.pde.ui/META-INF/MANIFEST.MF @@ -3,6 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: M2E PDE Integration UI Bundle-SymbolicName: org.eclipse.m2e.pde.ui;singleton:=true Bundle-Version: 2.1.0.qualifier +Export-Package: org.eclipse.m2e.pde.ui.target.editor;x-friends:="org.eclipse.m2e.swtbot.tests" Automatic-Module-Name: org.eclipse.m2e.pde.ui Bundle-RequiredExecutionEnvironment: JavaSE-21 Require-Bundle: org.eclipse.core.runtime;bundle-version="3.19.0", 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..c2678674fe --- /dev/null +++ b/org.eclipse.m2e.swtbot.tests/META-INF/MANIFEST.MF @@ -0,0 +1,14 @@ +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.core.runtime;bundle-version="3.31.100", + org.eclipse.m2e.pde.target, + org.eclipse.m2e.pde.ui, + org.eclipse.swt;bundle-version="3.127.0", + org.eclipse.swtbot.swt.finder;bundle-version="4.2.1", + org.eclipse.ui;bundle-version="3.206.100", + 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..84516854bf --- /dev/null +++ b/org.eclipse.m2e.swtbot.tests/pom.xml @@ -0,0 +1,48 @@ + + 4.0.0 + + + org.eclipse.m2e + m2e-core + 2.1.0-SNAPSHOT + + + org.eclipse.m2e.swtbot.tests + eclipse-test-plugin + M2E - SWTBot Integration tests + + + + + + org.eclipse.tycho + tycho-surefire-plugin + + false + + + + org.eclipse.tycho + target-platform-configuration + + + + + org.eclipse.pde + eclipse-feature + 0.0.0 + + + org.eclipse.m2e.pde.feature + eclipse-feature + 0.0.0 + + + + + + + + + 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..6cbf0252a7 --- /dev/null +++ b/org.eclipse.m2e.swtbot.tests/src/org/eclipse/m2e/pde/ui/MavenTargetDependencyEditorTest.java @@ -0,0 +1,449 @@ +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.jface.wizard.WizardDialog; +import org.eclipse.m2e.pde.target.MavenTargetLocation; +import org.eclipse.m2e.pde.target.MavenTargetLocationFactory; +import org.eclipse.m2e.pde.ui.target.editor.MavenTargetLocationWizard; +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.swt.finder.SWTBot; +import org.eclipse.swtbot.swt.finder.utils.TableCollection; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.PlatformUI; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * Integration tests for {@code MavenTargetDependencyEditor} using SWTBot. + */ +public class MavenTargetDependencyEditorTest { + private static final String MAVEN_LOCATION_XML = """ + + + + 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 + + + + """; + private WizardDialog wizardDialog; + private IWorkbench workbench; + private SWTBot robot; + + @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 + """); + } + + workbench = PlatformUI.getWorkbench(); + wizardDialog = workbench.getDisplay().syncCall(() -> { + Shell shell = new Shell(workbench.getActiveWorkbenchWindow().getShell()); + MavenTargetLocation location = new MavenTargetLocationFactory().getTargetLocation("maven", MAVEN_LOCATION_XML); + MavenTargetLocationWizard wizard = new MavenTargetLocationWizard(location); + WizardDialog wizardDialog = new WizardDialog(shell, wizard); + wizardDialog.setBlockOnOpen(false); + wizardDialog.open(); + return wizardDialog; + }); + robot = new SWTBot().shell("Maven Artifact Target Entry - Maven Central").bot(); + } + + @After + public void tearDown() throws Exception { + if (wizardDialog != null) { + workbench.getDisplay().syncExec(wizardDialog::close); + } + } + + private void readAndDispatch() { + Display display = workbench.getDisplay(); + display.syncExec(display::readAndDispatch); + } + + /** + * Checks whether the initial "enablement" state of all buttons in the Maven + * dependency editor is set correctly. + */ + @Test + public void testInitialButtonState() throws Exception { + assertTrue(robot.button("Add").isEnabled()); + assertTrue(robot.button("Remove").isEnabled()); + assertTrue(robot.button("Update").isEnabled()); + assertFalse(robot.button("Undo").isEnabled()); + assertFalse(robot.button("Redo").isEnabled()); + } + + /** + * Checks whether new Maven coordinates can be added and edited. + */ + @Test + public void testAddMavenLocation() throws Exception { + workbench.getDisplay().syncExec(() -> { + Clipboard clipboard = new Clipboard(workbench.getDisplay()); + clipboard.setContents(new Object[] { + """ + + """ + }, new Transfer[] { TextTransfer.getInstance() }); + clipboard.dispose(); + }); + robot.button("Add").click(); + + SWTBotTable table = robot.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(robot.button("Update").isEnabled()); + assertFalse(robot.button("Finish").isEnabled()); + // There is no elegant way to select the cell editor, + // but we know that opening it focuses the text widget + table.click(19, 0); + robot.text(0).setText("org.apache.commons"); + table.click(19, 1); + robot.text(0).setText("commons-lang3"); + table.click(19, 2); + robot.text(0).setText("3.12.0"); + table.click(19, 3); // Close cell editor + + assertTrue(robot.button("Update").isEnabled()); + assertTrue(robot.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() throws Exception { + 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(); + }); + robot.button("Add").click(); + + SWTBotTable table = robot.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() throws Exception { + SWTBotTable table = robot.table(); + table.click(0, 0); + robot.text("com.fasterxml.jackson.core").setText("a"); + table.click(1, 1); + robot.text("jackson-core").setText("b"); + table.click(2, 2); + robot.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() throws Exception { + SWTBotTable table = robot.table(); + // Update single artifact + assertEquals(table.cell(12, 1), "kotlin-stdlib-common"); + assertEquals(table.cell(12, 2), "1.7.22"); + + table.select(12); + robot.button("Update").click(); + readAndDispatch(); + + 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); + robot.button("Update").click(); + readAndDispatch(); + + 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() throws Exception { + // Removing multiple elements clears the selection + SWTBotTable table = robot.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); + + robot.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); + + robot.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() throws Exception { + SWTBotTable table = robot.table(); + assertEquals(table.cell(6, 1), "jakarta.activation-api"); + + // Tests undo/redo on removal + table.select(6); + robot.button("Remove").click(); + assertEquals(table.cell(6, 1), "jakarta.annotation-api"); + + robot.button("Undo").click(); + assertEquals(table.cell(6, 1), "jakarta.activation-api"); + + robot.button("Redo").click(); + assertEquals(table.cell(6, 1), "jakarta.annotation-api"); + + // Tests undo/redo on editing + table.click(6, 1); + robot.text("jakarta.annotation-api").setText("foo"); + table.click(6, 2); // Close cell editor + assertEquals(table.cell(6, 1), "foo"); + + robot.button("Undo").click(); + assertEquals(table.cell(6, 1), "jakarta.annotation-api"); + + robot.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() throws Exception { + SWTBotTable table = robot.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(); + }); + robot.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() throws Exception { + SWTBotTable table = robot.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/pom.xml b/pom.xml index af61929dca..7fd9a8ab35 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 4f8d9476d8..96f134caac 100644 --- a/target-platform/target-platform.target +++ b/target-platform/target-platform.target @@ -45,6 +45,10 @@ + + + +