├── .gitattributes ├── .github ├── ISSUE_TEMPLATE.md ├── PULL_REQUEST_TEMPLATE.md ├── dependabot.yml └── workflows │ ├── ci.yml │ └── main.yml ├── .gitignore ├── Contributing.md ├── LICENSE ├── README.md ├── camel-lsp-target-platform ├── .project ├── .settings │ ├── org.eclipse.core.resources.prefs │ └── org.eclipse.m2e.core.prefs ├── camel-lsp-target-platform.target └── pom.xml ├── com.github.camel-tooling.lsp.eclipse.client.tests.integration ├── .classpath ├── .gitignore ├── .project ├── .settings │ ├── org.eclipse.core.resources.prefs │ ├── org.eclipse.jdt.core.prefs │ └── org.eclipse.m2e.core.prefs ├── META-INF │ └── MANIFEST.MF ├── build.properties ├── infinitest.filters ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── github │ └── cameltooling │ └── eclipse │ └── client │ └── tests │ └── integration │ ├── AbtractPreferencesIT.java │ ├── CamelCatalogVersionIT.java │ ├── CamelLSPLoadedByExtensionPointIT.java │ ├── CamelLSPStreamConnectionProviderIT.java │ ├── CamelRuntimeProviderIT.java │ └── TestSetupHelper.java ├── com.github.camel-tooling.lsp.eclipse.client.tests.ui ├── .project ├── README.md ├── plugins │ ├── .project │ ├── com.github.cameltooling.lsp.reddeer │ │ ├── .classpath │ │ ├── .project │ │ ├── .settings │ │ │ ├── org.eclipse.core.resources.prefs │ │ │ ├── org.eclipse.jdt.core.prefs │ │ │ └── org.eclipse.m2e.core.prefs │ │ ├── META-INF │ │ │ └── MANIFEST.MF │ │ ├── OSGI-INF │ │ │ └── l10n │ │ │ │ └── bundle.properties │ │ ├── build.properties │ │ ├── pom.xml │ │ └── src │ │ │ └── com │ │ │ └── github │ │ │ └── cameltooling │ │ │ └── lsp │ │ │ └── reddeer │ │ │ ├── Activator.java │ │ │ ├── LogGrapper.java │ │ │ ├── ResourceHelper.java │ │ │ ├── XPathEvaluator.java │ │ │ ├── editor │ │ │ ├── EditorComponentControl.java │ │ │ ├── FilteredSelectionDialog.java │ │ │ └── SourceEditor.java │ │ │ ├── launchconfigurations │ │ │ └── MavenBuildLaunchConfiguration.java │ │ │ ├── preference │ │ │ ├── CamelCatalogVersion.java │ │ │ ├── CamelExtraComponents.java │ │ │ ├── CamelRuntimeProvider.java │ │ │ ├── ConsolePreferencePage.java │ │ │ ├── ConsolePreferenceUtil.java │ │ │ ├── DefaultEditorPreferencePage.java │ │ │ ├── FileTypeDialog.java │ │ │ └── KafkaConnectionURL.java │ │ │ ├── utils │ │ │ ├── AboutEclipsePage.java │ │ │ ├── CreateNewEmptyFile.java │ │ │ ├── JavaProjectFactory.java │ │ │ └── LogChecker.java │ │ │ ├── view │ │ │ └── ProblemsViewExt.java │ │ │ └── wizard │ │ │ ├── NewJavaClassFirstPage.java │ │ │ ├── NewJavaClassWizard.java │ │ │ ├── NewXMLFileFirstPage.java │ │ │ └── NewXMLFileWizard.java │ └── pom.xml ├── pom.xml └── tests │ ├── .project │ ├── com.github.cameltooling.lsp.ui.tests │ ├── .classpath │ ├── .project │ ├── .settings │ │ ├── org.eclipse.core.resources.prefs │ │ ├── org.eclipse.jdt.core.prefs │ │ └── org.eclipse.m2e.core.prefs │ ├── META-INF │ │ └── MANIFEST.MF │ ├── OSGI-INF │ │ └── l10n │ │ │ └── bundle.properties │ ├── build.properties │ ├── infinitest.filters │ ├── launcher │ │ └── RedDeer Test.launch │ ├── pom.xml │ ├── resources │ │ ├── additional-component-feature-component.json │ │ ├── additional-component-feature-context.xml │ │ ├── camel-context-cbr.xml │ │ ├── catalog-version-feature-context.xml │ │ ├── java-editor-completion-test-route.java │ │ ├── kafka-dynamic-completion-context.xml │ │ └── settings │ │ │ ├── plugin_customization.ini │ │ │ ├── plugin_customization_with_proxy_settings.ini │ │ │ └── proxy_settings.xml │ └── src │ │ ├── com │ │ └── github │ │ │ └── cameltooling │ │ │ └── lsp │ │ │ └── ui │ │ │ └── tests │ │ │ ├── Activator.java │ │ │ ├── AdditionalComponentFeatureTest.java │ │ │ ├── CamelCatalogVersionFeatureTest.java │ │ │ ├── CamelLSPCompletionTest.java │ │ │ ├── CamelRuntimeProviderFeatureTest.java │ │ │ ├── DefaultLSPCompletionTest.java │ │ │ ├── DefaultTest.java │ │ │ ├── GenericEditorLSPCompletionTest.java │ │ │ ├── JavaEditorCompletionTest.java │ │ │ ├── KafkaDynamicCompletionTest.java │ │ │ ├── PluginInstalledTest.java │ │ │ ├── suite │ │ │ └── SmokeTests.java │ │ │ └── utils │ │ │ ├── EditorManipulator.java │ │ │ └── TimeoutPeriodManipulator.java │ │ └── log4j.xml │ └── pom.xml ├── com.github.camel-tooling.lsp.eclipse.client ├── .classpath ├── .project ├── .settings │ ├── org.eclipse.core.resources.prefs │ ├── org.eclipse.jdt.core.prefs │ └── org.eclipse.m2e.core.prefs ├── META-INF │ └── MANIFEST.MF ├── OSGI-INF │ └── l10n │ │ └── bundle.properties ├── build.properties ├── plugin.xml ├── pom.xml └── src │ └── com │ └── github │ └── cameltooling │ └── eclipse │ ├── client │ ├── ActivatorCamelLspClient.java │ └── CamelLSPStreamConnectionProvider.java │ ├── internal │ └── l10n │ │ ├── Messages.java │ │ └── messages.properties │ ├── preferences │ ├── CamelLanguageServerPreferenceManager.java │ ├── CamelLanguageServerPreferencePage.java │ ├── MultilineStringFieldEditor.java │ └── runtimeprovider │ │ └── CamelRuntimeProvider.java │ └── xml │ └── completion │ └── CamelURICompletionProposalComputer.java ├── com.github.camel-tooling.lsp.eclipse.updatesite ├── .project ├── category.xml └── pom.xml ├── com.github.cameltooling.lsp.eclipse.client.feature ├── .project ├── build.properties ├── feature.xml └── pom.xml ├── pom.xml └── website └── index.html /.gitattributes: -------------------------------------------------------------------------------- 1 | # Set the default behavior, in case people don't have core.autocrlf set. 2 | * text eol=lf 3 | 4 | # Declare files that will always have CRLF line endings on checkout. 5 | *.bat text eol=crlf 6 | 7 | # Denote all files that are truly binary and should not be modified. 8 | *.png binary 9 | *.jpg binary 10 | *.gif binary 11 | *.jar binary 12 | 13 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | # Issue information 2 | 3 | > Define issue title **short** and **most specific** to the problem. 4 | 5 | > Tag each new issue with relevant **LABELS** (*Bug*, *Improvement*, etc.). 6 | 7 | ## BUG report 8 | 9 | ### Environment 10 | 11 | - Apache Camel LSP Client Extensions Plugin version: e.g. "**1.0.0.201902050715**" ? 12 | - OS: 13 | - [ ] Linux (*RHEL*, *Fedora*, *Ubuntu*, ...) 14 | - [ ] Windows 15 | - [ ] macOS 16 | 17 | ### Description of wrong behavior 18 | 19 | - ... 20 | 21 | ### Exact steps to reproduce issue 22 | 23 | 1. ... 24 | 2. ... 25 | 3. ... 26 | 27 | ## TASK definition 28 | 29 | ### Description 30 | 31 | - ... 32 | 33 | ### Expected behaviour 34 | 35 | - ... 36 | 37 | ### Screenshot (*optional*) 38 | 39 | - ... 40 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | # Pull Request informations 2 | 3 | ## Rebase & Merge default requirements 4 | 5 | 1. Green build for main branch 6 | 2. Wait 24 hours after PR creation 7 | 3. Green job for PR 8 | 4. Approved PR 9 | 10 | ## PR labels default process 11 | 12 | - READY_FOR_REVIEW → REVIEW_DONE → READY_FOR_MERGE 13 | 14 | ## Tests 15 | 16 | - [ ] Are there **Unit tests**? 17 | - [ ] Are there **Integration tests**? 18 | - [ ] Do we need a new **UI test**? 19 | 20 | ## PR workflow progress 21 | 22 | 1. [ ] Tagged with relevant **PR labels** 23 | 2. [ ] Green **job for PR** 24 | 3. [ ] PR was created more than **24 hours ago** or **All committers approved** it 25 | 4. [ ] Green **main** branch build -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: maven 4 | directory: "/" 5 | schedule: 6 | interval: daily 7 | open-pull-requests-limit: 10 8 | reviewers: 9 | - camel-tooling/vs-code-dependabot-reviewers 10 | - package-ecosystem: github-actions 11 | directory: "/" 12 | schedule: 13 | interval: weekly 14 | open-pull-requests-limit: 10 15 | reviewers: 16 | - camel-tooling/vs-code-dependabot-reviewers 17 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | # This workflow will build a Java project with Maven 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven 3 | 4 | name: Matrix 5 | 6 | on: 7 | push: 8 | branches: [ main ] 9 | pull_request: 10 | branches: [ main ] 11 | workflow_dispatch: 12 | 13 | jobs: 14 | build: 15 | 16 | runs-on: ${{ matrix.os }} 17 | strategy: 18 | fail-fast: false 19 | matrix: 20 | os: [ ubuntu-latest, windows-latest ] 21 | java: [ 17, 21 ] 22 | exclude: 23 | - os: ubuntu-latest 24 | java: 17 25 | - os: windows-latest 26 | java: 21 27 | 28 | steps: 29 | - uses: actions/checkout@v4 30 | - name: Set up JDK 31 | uses: actions/setup-java@v4 32 | with: 33 | java-version: ${{ matrix.java }} 34 | distribution: 'temurin' 35 | cache: 'maven' 36 | - name: Build with Maven 37 | run: xvfb-run -a mvn -B verify 38 | if: ${{ runner.os == 'Linux' }} 39 | - name: Build with Maven 40 | run: mvn -B verify 41 | if: ${{ runner.os != 'Linux' }} 42 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | # This workflow will build a Java project with Maven 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven 3 | 4 | name: Build 5 | 6 | on: 7 | push: 8 | branches: [ main ] 9 | pull_request: 10 | branches: [ main ] 11 | workflow_dispatch: 12 | 13 | jobs: 14 | build: 15 | 16 | runs-on: ubuntu-latest 17 | 18 | steps: 19 | - uses: actions/checkout@v4 20 | - name: Set up JDK 17 21 | uses: actions/setup-java@v4 22 | with: 23 | java-version: 17 24 | distribution: 'temurin' 25 | cache: maven 26 | - name: Cache SonarCloud packages 27 | uses: actions/cache@v4.2.3 28 | with: 29 | path: ~/.sonar/cache 30 | key: ${{ runner.os }}-sonar 31 | restore-keys: ${{ runner.os }}-sonar 32 | - name: Build with Maven 33 | run: xvfb-run -a mvn -B verify 34 | - name: Deploy 35 | uses: JamesIves/github-pages-deploy-action@v4.7.3 36 | with: 37 | branch: gh-pages 38 | folder: com.github.camel-tooling.lsp.eclipse.updatesite/target/repository 39 | if: ${{ github.ref_name == 'main' }} 40 | - name: Sonar analysis 41 | env: 42 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 43 | SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} 44 | run: mvn -B org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=camel-lsp-client-eclipse 45 | if: ${{ github.ref_name == 'main' }} 46 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | target 2 | *.iml 3 | *.ipr 4 | *.iws 5 | .DS_Store 6 | bin 7 | .metadata 8 | .idea 9 | libs/ 10 | log-camel-lsp.out 11 | -------------------------------------------------------------------------------- /Contributing.md: -------------------------------------------------------------------------------- 1 | First Time Setup 2 | -------------- 3 | 0. Fork and clone the repository 4 | 1. Install Eclipse [Oxygen Java EE](http://www.eclipse.org/downloads/packages/eclipse-ide-java-ee-developers/oxygenr) 5 | that will have most needed already installed. Alternately, 6 | you can get the [Eclipse IDE for Java developers](http://www.eclipse.org/downloads/packages/eclipse-ide-java-developers/oxygenr) 7 | and just install Eclipse PDE from marketplace. 8 | 9 | 2. Once installed use `File > Open Projects from File System...` and 10 | point it `camel-lsp-client-eclipse` and Eclipse should automatically 11 | detect the projects and import it properly. 12 | 13 | 3. If you discover an error on `pom.xml` after import about Tycho, you can use Quick Fix 14 | (Ctrl+1) to install the Tycho Maven integration. 15 | 16 | 17 | Building from command line 18 | ---------------------------- 19 | 20 | 1. Install [Apache Maven](https://maven.apache.org/) 21 | 22 | 2. This command will build the server: 23 | ```bash 24 | $ mvn clean verify 25 | ```` 26 | 27 | How to debug Camel Language Server from Eclipse client 28 | ====================================================== 29 | 30 | 1. Modify launch configuration to include -DdebugLSPServer=true VM argument 31 | 2. Create a Remote Java Application Debug Launch configuration in Eclipse listening to port 3000 -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![GitHub tag](https://img.shields.io/github/tag/camel-tooling/camel-lsp-client-eclipse.svg?style=plastic)]() 2 | [![Build and Test](https://github.com/camel-tooling/camel-lsp-client-eclipse/actions/workflows/main.yml/badge.svg)](https://github.com/camel-tooling/camel-lsp-client-eclipse/actions/workflows/main.yml) 3 | [![License](https://img.shields.io/badge/license-Apache%202-blue.svg)]() 4 | [![Gitter](https://img.shields.io/gitter/room/camel-tooling/Lobby.js.svg)](https://gitter.im/camel-tooling/Lobby) 5 | 6 | # Apache Camel for Eclipse 7 | 8 | This is a preview release of the Eclipse plugin that adds [Apache Camel](http://camel.apache.org/) language support for XML DSL and Java DSL code. 9 | 10 | # Features 11 | 12 | After you add this extension to your Eclipse IDE installation, when you use the generic Eclipse text editor, you can access the following Apache Camel language service features for Apache Camel URIs (both XML DSL and Java DSL): 13 | 14 | * Auto-completion for Camel components, attributes, and the list of attribute values 15 | 16 | * Quick reference documentation when you hover the cursor over a Camel component 17 | 18 | * Provide a specific Camel catalog version through preferences 19 | 20 | * Provide a specific runtime provider of Camel catalog through preferences 21 | 22 | * Specify Kafka connection URl through preferences for dynamic completion on Camel kafka component 23 | 24 | * Specify a list of additional Camel components 25 | 26 | When you use the XML or Java editor, only the auto-completion feature is provided. 27 | 28 | For detailed information about Apache Camel supported features, see the [Language Server GitHub page](https://github.com/camel-tooling/camel-language-server#features). 29 | 30 | # Before you begin 31 | 32 | * Install the [Eclipse IDE](https://www.eclipse.org/ide/). 33 | 34 | Optionally, you can install this plugin on top of an Eclipse IDE installation with Red Hat CodeReady Studio and [Fuse Tooling](https://tools.jboss.org/features/fusetools.html). This **Apache Camel for Eclipse** plugin provides even more help for Fuse development. 35 | 36 | * Install the [Eclipse Marketplace client](https://www.eclipse.org/mpc/). In Eclipse, select **Help > Install New Software** and then type **MPC**. Follow the prompts in the installation wizard. 37 | 38 | # How to Install 39 | 40 | To install this **Apache Camel for Eclipse** plugin: 41 | 42 | * Open your Eclipse IDE installation. 43 | * Drag this button [![Drag to your running Eclipse* workspace. *Requires Eclipse Marketplace Client](https://marketplace.eclipse.org/sites/all/themes/solstice/public/images/marketplace/btn-install.png)](http://marketplace.eclipse.org/marketplace-client-intro?mpc_install=4038733 "Drag to your running Eclipse* workspace. *Requires Eclipse Marketplace Client") to your running Eclipse workspace. 44 | 45 | * Wait until Eclipse completes the installation of the plugin. 46 | 47 | * In the popup window that appears when the plugin installation completes, click **Confirm**. 48 | * Accept the license, if asked. 49 | * Click **Finish**. 50 | * Click **Install Anyway**. 51 | * Click **Restart Now**. 52 | 53 | 54 | -------------------------------------------------------------------------------- /camel-lsp-target-platform/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | camel-lsp-target-platform 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.m2e.core.maven2Builder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.m2e.core.maven2Nature 16 | 17 | 18 | -------------------------------------------------------------------------------- /camel-lsp-target-platform/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /camel-lsp-target-platform/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /camel-lsp-target-platform/camel-lsp-target-platform.target: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /camel-lsp-target-platform/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | 8 | com.github.camel-tooling.lsp 9 | eclipse 10 | 1.0.0-SNAPSHOT 11 | 12 | 13 | eclipse-target-definition 14 | camel-lsp-target-platform 15 | ${base.name} :: Target Platform 16 | 17 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.integration/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.integration/.gitignore: -------------------------------------------------------------------------------- 1 | *.out -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.integration/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | Camel LSP Eclipse Integration Tests 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.pde.ManifestBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.pde.SchemaBuilder 20 | 21 | 22 | 23 | 24 | org.sonarlint.eclipse.core.sonarlintBuilder 25 | 26 | 27 | 28 | 29 | org.eclipse.m2e.core.maven2Builder 30 | 31 | 32 | 33 | 34 | 35 | org.eclipse.m2e.core.maven2Nature 36 | org.eclipse.pde.PluginNature 37 | org.eclipse.jdt.core.javanature 38 | 39 | 40 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.integration/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.integration/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 3 | org.eclipse.jdt.core.compiler.compliance=17 4 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 5 | org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning 8 | org.eclipse.jdt.core.compiler.release=enabled 9 | org.eclipse.jdt.core.compiler.source=17 10 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.integration/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.integration/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Bundle-ManifestVersion: 2 3 | Bundle-Name: %Bundle-Name 4 | Bundle-SymbolicName: com.github.camel-tooling.eclipse.client.tests.integration;singleton:=true 5 | Bundle-Version: 1.0.0.qualifier 6 | Bundle-Vendor: %Bundle-Vendor 7 | Bundle-RequiredExecutionEnvironment: JavaSE-17 8 | Bundle-ActivationPolicy: lazy 9 | Require-Bundle: org.junit;bundle-version="4.12.0", 10 | org.assertj;bundle-version="1.7.1", 11 | org.eclipse.lsp4e;bundle-version="0.3.0", 12 | com.github.camel-tooling.eclipse.client;bundle-version="1.0.0", 13 | org.eclipse.jface.text;bundle-version="3.12.0", 14 | org.eclipse.ui.ide;bundle-version="3.13.1", 15 | org.eclipse.core.resources;bundle-version="3.12.0", 16 | org.eclipse.core.runtime;bundle-version="3.13.0", 17 | org.eclipse.ui.genericeditor;bundle-version="1.0.1", 18 | org.eclipse.ui.workbench.texteditor;bundle-version="3.10.100", 19 | org.eclipse.jface.text.tests;bundle-version="3.11.500", 20 | org.eclipse.ui;bundle-version="3.112.0" 21 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.integration/build.properties: -------------------------------------------------------------------------------- 1 | source.. = src/main/java/ 2 | output.. = bin/ 3 | bin.includes = .,\ 4 | META-INF/ 5 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.integration/infinitest.filters: -------------------------------------------------------------------------------- 1 | .*IT -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.integration/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | 8 | com.github.camel-tooling.lsp 9 | eclipse 10 | 1.0.0-SNAPSHOT 11 | 12 | com.github.camel-tooling.eclipse.client.tests.integration 13 | ${base.name} :: Integration Tests 14 | eclipse-test-plugin 15 | 16 | 17 | 0.26.0 18 | ../target/jacoco.exec 19 | ../target/jacoco-it.exec 20 | 21 | 22 | 23 | 24 | 25 | 26 | org.eclipse.tycho 27 | tycho-surefire-plugin 28 | ${tycho.version} 29 | 30 | 31 | 32 | true 33 | true 34 | 35 | **/*IT.class 36 | 37 | ${tycho.testArgLine} -XX:+HeapDumpOnOutOfMemoryError ${os-jvm-flags} 38 | ${project.basedir}/target/work sp@cé 39 | 40 | 41 | 42 | 43 | 44 | 45 | macosx-jvm-flags 46 | 47 | mac 48 | 49 | 50 | -XstartOnFirstThread 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.integration/src/main/java/com/github/cameltooling/eclipse/client/tests/integration/AbtractPreferencesIT.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.github.cameltooling.eclipse.client.tests.integration; 18 | 19 | import static org.assertj.core.api.Assertions.assertThat; 20 | 21 | import java.util.stream.Collectors; 22 | import java.util.stream.Stream; 23 | 24 | import org.eclipse.core.runtime.CoreException; 25 | import org.eclipse.jface.text.ITextViewer; 26 | import org.eclipse.jface.text.contentassist.ICompletionProposal; 27 | import org.eclipse.jface.text.tests.util.DisplayHelper; 28 | import org.eclipse.lsp4e.operations.completion.LSContentAssistProcessor; 29 | import org.eclipse.swt.widgets.Display; 30 | import org.eclipse.ui.PlatformUI; 31 | import org.junit.After; 32 | import org.junit.Before; 33 | import org.junit.Test; 34 | import org.osgi.service.prefs.BackingStoreException; 35 | 36 | import com.github.cameltooling.eclipse.preferences.CamelLanguageServerPreferenceManager; 37 | 38 | public abstract class AbtractPreferencesIT { 39 | 40 | private ICompletionProposal[] proposals; 41 | protected TestSetupHelper testSetupHelper; 42 | 43 | @Before 44 | public void setup() { 45 | proposals = null; 46 | PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeAllEditors(false); 47 | } 48 | 49 | @After 50 | public void tearDown() throws BackingStoreException, CoreException { 51 | new CamelLanguageServerPreferenceManager().setCamelCatalogVersion(""); 52 | testSetupHelper.clean(); 53 | } 54 | 55 | @Test 56 | public void testUseCamelCatalogVersionPreference() throws Exception { 57 | String camelXmlFileContent = "\n"; 58 | testSetupHelper = new TestSetupHelper(); 59 | ITextViewer textViewer = testSetupHelper.createFileInProjectAndOpenInEditor(CamelCatalogVersionIT.class.getSimpleName(), camelXmlFileContent); 60 | checkJGroupRaftCompletion(textViewer, 1); 61 | 62 | PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeAllEditors(false); 63 | updatePreference(); 64 | textViewer = testSetupHelper.openGenericEditor(); 65 | 66 | checkJGroupRaftCompletion(textViewer, 0); 67 | 68 | PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeAllEditors(false); 69 | setBackPreference(); 70 | textViewer = testSetupHelper.openGenericEditor(); 71 | 72 | checkJGroupRaftCompletion(textViewer, 1); 73 | } 74 | 75 | protected abstract void setBackPreference() throws BackingStoreException; 76 | protected abstract void updatePreference() throws BackingStoreException; 77 | 78 | protected void checkJGroupRaftCompletion(ITextViewer textViewer, long numberOfJgroupsRaftCompletion) { 79 | new DisplayHelper() { 80 | 81 | LSContentAssistProcessor lsContentAssistProcessor = new LSContentAssistProcessor(); 82 | 83 | @Override 84 | protected boolean condition() { 85 | proposals = lsContentAssistProcessor.computeCompletionProposals(textViewer, 21); 86 | if(Stream.of(proposals).map(ICompletionProposal::getDisplayString) 87 | .anyMatch(displayString -> displayString.contains("Computing proposals"))) { 88 | return false; 89 | } 90 | return count() == numberOfJgroupsRaftCompletion; 91 | } 92 | 93 | long count() { 94 | return Stream.of(proposals).map(ICompletionProposal::getDisplayString) 95 | .filter(displayString -> displayString.contains("jgroups-raft:clusterName")).count(); 96 | } 97 | }.waitForCondition(Display.getDefault(), 30000); 98 | 99 | long count = Stream.of(proposals).map(ICompletionProposal::getDisplayString) 100 | .filter(displayString -> displayString.contains("jgroups-raft:clusterName")).count(); 101 | String jgroupsProposals = Stream.of(proposals).map(ICompletionProposal::getDisplayString).collect(Collectors.joining(";")); 102 | assertThat(count).describedAs("Wrong number "+ count +" of expected proposals "+ numberOfJgroupsRaftCompletion+" for jgroup: " + jgroupsProposals).isEqualTo(numberOfJgroupsRaftCompletion); 103 | } 104 | 105 | } 106 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.integration/src/main/java/com/github/cameltooling/eclipse/client/tests/integration/CamelCatalogVersionIT.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.github.cameltooling.eclipse.client.tests.integration; 18 | 19 | import org.osgi.service.prefs.BackingStoreException; 20 | 21 | import com.github.cameltooling.eclipse.preferences.CamelLanguageServerPreferenceManager; 22 | 23 | public class CamelCatalogVersionIT extends AbtractPreferencesIT { 24 | 25 | private static final String A_CAMEL_CATALOG_VERSION_WITHOUT_JGROUPSRAFT_COMPONENT = "2.22.0"; 26 | 27 | protected void setBackPreference() throws BackingStoreException { 28 | new CamelLanguageServerPreferenceManager().setCamelCatalogVersion(""); 29 | } 30 | 31 | protected void updatePreference() throws BackingStoreException { 32 | new CamelLanguageServerPreferenceManager().setCamelCatalogVersion(A_CAMEL_CATALOG_VERSION_WITHOUT_JGROUPSRAFT_COMPONENT); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.integration/src/main/java/com/github/cameltooling/eclipse/client/tests/integration/CamelLSPLoadedByExtensionPointIT.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.github.cameltooling.eclipse.client.tests.integration; 18 | 19 | import static org.assertj.core.api.Assertions.assertThat; 20 | 21 | import java.util.stream.Stream; 22 | 23 | import org.eclipse.core.runtime.CoreException; 24 | import org.eclipse.jface.text.ITextViewer; 25 | import org.eclipse.jface.text.contentassist.ICompletionProposal; 26 | import org.eclipse.jface.text.tests.util.DisplayHelper; 27 | import org.eclipse.lsp4e.operations.completion.LSContentAssistProcessor; 28 | import org.eclipse.swt.widgets.Display; 29 | import org.junit.After; 30 | import org.junit.Before; 31 | import org.junit.Test; 32 | 33 | public class CamelLSPLoadedByExtensionPointIT { 34 | 35 | private static final int ARBITRARY_NUMBER_OF_MINIMAL_CAMEL_COMPONENTS = 200; 36 | private ICompletionProposal[] proposals; 37 | private TestSetupHelper testSetupHelper; 38 | 39 | @Before 40 | public void setup() { 41 | proposals = null; 42 | } 43 | 44 | @After 45 | public void tearDown() throws CoreException { 46 | testSetupHelper.clean(); 47 | } 48 | 49 | @Test 50 | public void testGenericEditorProvideCompletion() throws Exception { 51 | String camelXmlFileContent = "\n"; 52 | testSetupHelper = new TestSetupHelper(); 53 | ITextViewer textViewer = testSetupHelper.createFileInProjectAndOpenInEditor(CamelLSPLoadedByExtensionPointIT.class.getSimpleName(), camelXmlFileContent); 54 | 55 | new DisplayHelper() { 56 | 57 | LSContentAssistProcessor lsContentAssistProcessor = new LSContentAssistProcessor(); 58 | 59 | @Override 60 | protected boolean condition() { 61 | proposals = lsContentAssistProcessor.computeCompletionProposals(textViewer, 11); 62 | return proposals.length > ARBITRARY_NUMBER_OF_MINIMAL_CAMEL_COMPONENTS; 63 | } 64 | }.waitForCondition(Display.getDefault(), 3000); 65 | 66 | checkContainsATimerProposal(proposals); 67 | } 68 | 69 | private void checkContainsATimerProposal(ICompletionProposal[] proposals) { 70 | assertThat(Stream.of(proposals) 71 | .map(ICompletionProposal::getDisplayString) 72 | .filter(displayString -> displayString.contains("timer")) 73 | .findFirst()).isNotEmpty(); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.integration/src/main/java/com/github/cameltooling/eclipse/client/tests/integration/CamelLSPStreamConnectionProviderIT.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.github.cameltooling.eclipse.client.tests.integration; 18 | 19 | 20 | import static org.assertj.core.api.Assertions.assertThat; 21 | 22 | import java.io.IOException; 23 | import java.io.InputStream; 24 | 25 | import com.github.cameltooling.eclipse.client.CamelLSPStreamConnectionProvider; 26 | import org.junit.Test; 27 | 28 | public class CamelLSPStreamConnectionProviderIT { 29 | 30 | @Test 31 | public void testStart() throws IOException { 32 | CamelLSPStreamConnectionProvider provider = new CamelLSPStreamConnectionProvider(); 33 | provider.start(); 34 | InputStream inputStream = provider.getInputStream(); 35 | assertThat(inputStream).isNotNull(); 36 | InputStream errorStream = provider.getErrorStream(); 37 | assertThat(errorStream).isNotNull(); 38 | byte[] buffer = new byte[1024]; 39 | assertThat(errorStream.read(buffer)).isEqualTo(-1); 40 | provider.stop(); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.integration/src/main/java/com/github/cameltooling/eclipse/client/tests/integration/CamelRuntimeProviderIT.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.github.cameltooling.eclipse.client.tests.integration; 18 | 19 | import org.osgi.service.prefs.BackingStoreException; 20 | 21 | import com.github.cameltooling.eclipse.preferences.CamelLanguageServerPreferenceManager; 22 | import com.github.cameltooling.eclipse.preferences.runtimeprovider.CamelRuntimeProvider; 23 | 24 | public class CamelRuntimeProviderIT extends AbtractPreferencesIT { 25 | 26 | protected void setBackPreference() throws BackingStoreException { 27 | new CamelLanguageServerPreferenceManager().setRuntimeProvider(CamelRuntimeProvider.DEFAULT.name()); 28 | } 29 | 30 | protected void updatePreference() throws BackingStoreException { 31 | new CamelLanguageServerPreferenceManager().setRuntimeProvider(CamelRuntimeProvider.KARAF.name()); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.integration/src/main/java/com/github/cameltooling/eclipse/client/tests/integration/TestSetupHelper.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.github.cameltooling.eclipse.client.tests.integration; 18 | 19 | import static org.assertj.core.api.Assertions.assertThat; 20 | import static org.junit.Assert.fail; 21 | 22 | import java.io.ByteArrayInputStream; 23 | import java.lang.reflect.InvocationTargetException; 24 | import java.lang.reflect.Method; 25 | 26 | import org.eclipse.core.resources.IFile; 27 | import org.eclipse.core.resources.IProject; 28 | import org.eclipse.core.resources.IResource; 29 | import org.eclipse.core.resources.IWorkspaceRoot; 30 | import org.eclipse.core.resources.ResourcesPlugin; 31 | import org.eclipse.core.runtime.CoreException; 32 | import org.eclipse.core.runtime.NullProgressMonitor; 33 | import org.eclipse.jface.text.ITextViewer; 34 | import org.eclipse.ui.IEditorPart; 35 | import org.eclipse.ui.PartInitException; 36 | import org.eclipse.ui.PlatformUI; 37 | import org.eclipse.ui.ide.IDE; 38 | import org.eclipse.ui.internal.genericeditor.ExtensionBasedTextEditor; 39 | import org.eclipse.ui.texteditor.AbstractTextEditor; 40 | import org.eclipse.ui.texteditor.ITextEditor; 41 | 42 | public class TestSetupHelper { 43 | 44 | private IFile camelFile; 45 | private IProject project; 46 | private IEditorPart openEditor; 47 | 48 | public ITextViewer createFileInProjectAndOpenInEditor(String projectName, String camelXmlFileContent) 49 | throws CoreException, InvocationTargetException { 50 | IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); 51 | project = root.getProject(projectName); 52 | project.create(null); 53 | project.open(null); 54 | camelFile = project.getFile("camelFile.xml"); 55 | camelFile.create(new ByteArrayInputStream(camelXmlFileContent.getBytes()), IResource.FORCE, null); 56 | return openGenericEditor(camelFile); 57 | } 58 | 59 | public ITextViewer openGenericEditor() throws PartInitException, InvocationTargetException { 60 | return openGenericEditor(camelFile); 61 | } 62 | 63 | private ITextViewer openGenericEditor(IFile camelFile) throws PartInitException, InvocationTargetException { 64 | openEditor = IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), camelFile, "org.eclipse.ui.genericeditor.GenericEditor"); 65 | assertThat(openEditor).isInstanceOf(ExtensionBasedTextEditor.class); 66 | return getTextViewer(openEditor); 67 | } 68 | 69 | /** 70 | * Retrieve the TextViewer by reflection on a protected method as it is not publicly available. 71 | * it is used also by LSP4E Tests org.eclipse.lsp4e.test.TestUtils.getTextViewer(IEditorPart) 72 | * Unfortunately, the code cannot be reused as it is in a fragment. 73 | */ 74 | public ITextViewer getTextViewer(IEditorPart part) throws InvocationTargetException { 75 | try { 76 | if (part instanceof ITextEditor) { 77 | ITextEditor textEditor = (ITextEditor) part; 78 | 79 | Method getSourceViewerMethod = AbstractTextEditor.class.getDeclaredMethod("getSourceViewer"); //$NON-NLS-1$ 80 | getSourceViewerMethod.setAccessible(true); 81 | return (ITextViewer) getSourceViewerMethod.invoke(textEditor); 82 | } else { 83 | fail("Unable to open editor"); 84 | return null; 85 | } 86 | } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException 87 | | InvocationTargetException e) { 88 | throw new InvocationTargetException(e); 89 | } 90 | } 91 | 92 | public void clean() throws CoreException { 93 | if(openEditor != null) { 94 | PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeEditor(openEditor, false); 95 | } 96 | project.delete(true, new NullProgressMonitor()); 97 | } 98 | 99 | } 100 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | com.github.camel-tooling.lsp.eclipse.client.tests.ui 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.m2e.core.maven2Builder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.m2e.core.maven2Nature 16 | 17 | 18 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/README.md: -------------------------------------------------------------------------------- 1 | # Apache Camel LSP Eclipse client UI Tests 2 | 3 | ## Structure 4 | 5 | - com.github.camel-tooling.lsp.eclipse.client.tests.ui/plugins/com.github.cameltooling.lsp.reddeer 6 | RedDeer Test framework 7 | - com.github.camel-tooling.lsp.eclipse.client.tests.ui/tests/com.github.cameltooling.lsp.ui.tests 8 | UI tests based on the above RedDeer framework for Camel Tooling 9 | 10 | ## Executing tests from command line 11 | 12 | The UI smoke tests are enabled by default. You can also execute other test suite by specifying 13 | 14 | -DtestUIClass=CamelLSPCompletionTest 15 | 16 | To disable UI tests you need to set 17 | 18 | -DskipUITests=true 19 | 20 | It is also recommended to ignore local artifacts 21 | 22 | -Dtycho.localArtifacts=ignore 23 | 24 | You may also get errors from baseline comparison, so disable it 25 | 26 | -Dtycho.baseline=disable 27 | -DskipBaselineComparison=true 28 | 29 | You also need to specify target platform 30 | 31 | camel-lsp-target-platform 32 | 33 | Executing only UI tests should look like as follows 34 | 35 | mvn clean verify -pl \ 36 | camel-lsp-target-platform, \ 37 | com.github.camel-tooling.lsp.eclipse.client.tests.ui/plugins/com.github.cameltooling.lsp.reddeer, \ 38 | com.github.camel-tooling.lsp.eclipse.client.tests.ui/tests/com.github.cameltooling.lsp.ui.tests \ 39 | -am \ 40 | -DskipUITests=false \ 41 | -Dtycho.localArtifacts=ignore \ 42 | -Dtycho.baseline=disable \ 43 | -DskipBaselineComparison=true \ 44 | -DfailIfNoTests=false \ 45 | -Dtest=CamelLSPCompletionTest 46 | 47 | ## Debugging tests when running from command line 48 | 49 | Just add the following system property 50 | 51 | -DdebugPort=8001 52 | 53 | and in IDE create a configuration for Remote Java Application in Run > Debug Configurations... 54 | 55 | ### Executing tests from IDE 56 | 57 | 1. Install Camel Tooling LSP Eclipse client, e.g from https://camel-tooling.github.io/camel-lsp-client-eclipse-update-site/updatesite/nightly/ 58 | 2. Install RedDeer 3.x, e.g. from http://download.eclipse.org/reddeer/releases/3.1.0/ 59 | 3. Import the tests as Existing Projects into Workspace 60 | 4. Now, we can launch 'RedDeer Test' which is available in Run configuration 61 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/plugins/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | plugins 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.m2e.core.maven2Builder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.m2e.core.maven2Nature 16 | 17 | 18 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/plugins/com.github.cameltooling.lsp.reddeer/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/plugins/com.github.cameltooling.lsp.reddeer/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | com.github.cameltooling.lsp.reddeer 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.pde.ManifestBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.pde.SchemaBuilder 20 | 21 | 22 | 23 | 24 | org.eclipse.m2e.core.maven2Builder 25 | 26 | 27 | 28 | 29 | 30 | org.eclipse.m2e.core.maven2Nature 31 | org.eclipse.pde.PluginNature 32 | org.eclipse.jdt.core.javanature 33 | 34 | 35 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/plugins/com.github.cameltooling.lsp.reddeer/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/plugins/com.github.cameltooling.lsp.reddeer/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 4 | org.eclipse.jdt.core.compiler.compliance=17 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled 7 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 8 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 9 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning 10 | org.eclipse.jdt.core.compiler.release=enabled 11 | org.eclipse.jdt.core.compiler.source=17 12 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/plugins/com.github.cameltooling.lsp.reddeer/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/plugins/com.github.cameltooling.lsp.reddeer/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Bundle-ManifestVersion: 2 3 | Bundle-Name: %Bundle-Name 4 | Bundle-SymbolicName: com.github.cameltooling.lsp.reddeer;singleton:=true 5 | Bundle-Version: 1.0.0.qualifier 6 | Bundle-Activator: com.github.cameltooling.lsp.reddeer.Activator 7 | Bundle-RequiredExecutionEnvironment: JavaSE-17 8 | Require-Bundle: org.eclipse.ui, 9 | org.eclipse.ui.ide, 10 | org.eclipse.gef, 11 | org.eclipse.osgi, 12 | org.eclipse.core.resources, 13 | org.eclipse.core.runtime, 14 | org.eclipse.graphiti.ui, 15 | com.jcraft.jsch;bundle-version="0.1.50", 16 | org.eclipse.reddeer.go;bundle-version="3.1.0", 17 | org.eclipse.reddeer.gef;bundle-version="3.1.0", 18 | org.eclipse.reddeer.graphiti;bundle-version="3.1.0", 19 | org.eclipse.reddeer.eclipse;bundle-version="3.1.0" 20 | Export-Package: com.github.cameltooling.lsp.reddeer, 21 | com.github.cameltooling.lsp.reddeer.editor, 22 | com.github.cameltooling.lsp.reddeer.launchconfigurations, 23 | com.github.cameltooling.lsp.reddeer.preference, 24 | com.github.cameltooling.lsp.reddeer.utils, 25 | com.github.cameltooling.lsp.reddeer.view, 26 | com.github.cameltooling.lsp.reddeer.wizard 27 | Bundle-Vendor: %Bundle-Vendor 28 | Import-Package: com.fasterxml.jackson.annotation 29 | Eclipse-BundleShape: dir 30 | Automatic-Module-Name: com.github.cameltooling.lsp.reddeer 31 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/plugins/com.github.cameltooling.lsp.reddeer/OSGI-INF/l10n/bundle.properties: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | ############################################################################### 17 | Bundle-Vendor = Red Hat 18 | Bundle-Name = Camel Tooling RedDeer Framework -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/plugins/com.github.cameltooling.lsp.reddeer/build.properties: -------------------------------------------------------------------------------- 1 | source.. = src/ 2 | output.. = target/classes 3 | bin.includes = META-INF/,\ 4 | OSGI-INF/,\ 5 | .,\ 6 | OSGI-INF/l10n/bundle.properties 7 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/plugins/com.github.cameltooling.lsp.reddeer/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.github.camel-tooling.lsp 7 | plugins 8 | 1.0.0-SNAPSHOT 9 | 10 | com.github.cameltooling.lsp.reddeer 11 | ${base.name} :: UI Tests :: Plugins :: RedDeer Framework 12 | eclipse-plugin 13 | 14 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/plugins/com.github.cameltooling.lsp.reddeer/src/com/github/cameltooling/lsp/reddeer/Activator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.github.cameltooling.lsp.reddeer; 18 | 19 | import org.eclipse.core.runtime.Plugin; 20 | import org.osgi.framework.BundleContext; 21 | 22 | public class Activator extends Plugin { 23 | 24 | public static final String PLUGINID = "com.github.cameltooling.lsp.reddeer"; 25 | private static Activator plugin; 26 | 27 | @Override 28 | public void start(BundleContext bundleContext) throws Exception { 29 | setInstance(this); 30 | } 31 | 32 | @Override 33 | public void stop(BundleContext bundleContext) throws Exception { 34 | setInstance(null); 35 | } 36 | 37 | private static synchronized void setInstance(Activator plugin) { 38 | Activator.plugin = plugin; 39 | } 40 | 41 | public static synchronized Activator getInstance() { 42 | return plugin; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/plugins/com.github.cameltooling.lsp.reddeer/src/com/github/cameltooling/lsp/reddeer/LogGrapper.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.github.cameltooling.lsp.reddeer; 18 | 19 | import java.util.ArrayList; 20 | import java.util.List; 21 | 22 | import org.eclipse.reddeer.eclipse.ui.views.log.LogMessage; 23 | import org.eclipse.reddeer.eclipse.ui.views.log.LogView; 24 | 25 | /** 26 | * Utilizes access to Error Log View 27 | * 28 | * @author tsedmik 29 | */ 30 | public class LogGrapper { 31 | 32 | private LogGrapper() { 33 | //private constructor, only static access 34 | } 35 | 36 | /** 37 | * Retrieves all error logs about given plugin 38 | * 39 | * @param plugin name of plugin or substring of it 40 | * @return List of errors in the plugin. In case of no error occurred, an empty 41 | * List is returned 42 | */ 43 | public static List getPluginErrors(String plugin) { 44 | 45 | List errors = new ArrayList<>(); 46 | LogView log = new LogView(); 47 | log.open(); 48 | List allErrors = log.getErrorMessages(); 49 | for (LogMessage message : allErrors) { 50 | if (message.getPlugin().toLowerCase().contains(plugin)) { 51 | errors.add(message); 52 | } 53 | } 54 | return errors; 55 | } 56 | } -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/plugins/com.github.cameltooling.lsp.reddeer/src/com/github/cameltooling/lsp/reddeer/ResourceHelper.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.github.cameltooling.lsp.reddeer; 18 | 19 | import java.io.File; 20 | import java.io.IOException; 21 | 22 | import org.eclipse.core.runtime.FileLocator; 23 | import org.eclipse.core.runtime.IStatus; 24 | import org.eclipse.core.runtime.Platform; 25 | import org.eclipse.core.runtime.Status; 26 | 27 | /** 28 | * Class provides resource related static method 29 | */ 30 | public class ResourceHelper { 31 | 32 | private ResourceHelper() { 33 | //private constructor, only static access 34 | } 35 | 36 | /** 37 | * Provide bundle resource absolute path 38 | * 39 | * @param pluginId 40 | * - plugin id 41 | * @param path 42 | * - resource relative path 43 | * @return resource absolute path 44 | */ 45 | public static String getResourceAbsolutePath(String pluginId, String... path) { 46 | 47 | // Construct path 48 | StringBuilder builder = new StringBuilder(); 49 | for (String fragment : path) { 50 | builder.append("/" + fragment); 51 | } 52 | 53 | String filePath = ""; 54 | try { 55 | filePath = FileLocator.toFileURL(Platform.getBundle(pluginId).getEntry("/")).getFile() + "resources" 56 | + builder.toString(); 57 | File file = new File(filePath); 58 | if (!file.isFile()) { 59 | filePath = FileLocator.toFileURL(Platform.getBundle(pluginId).getEntry("/")).getFile() 60 | + builder.toString(); 61 | } 62 | } catch (IOException ex) { 63 | Activator.getInstance().getLog().log(new Status(IStatus.ERROR, Activator.PLUGINID, "Error locating file in "+ pluginId, ex)); 64 | } 65 | 66 | return filePath; 67 | } 68 | } -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/plugins/com.github.cameltooling.lsp.reddeer/src/com/github/cameltooling/lsp/reddeer/XPathEvaluator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.github.cameltooling.lsp.reddeer; 18 | 19 | import java.io.IOException; 20 | import java.io.Reader; 21 | import java.io.StringWriter; 22 | 23 | import javax.xml.XMLConstants; 24 | import javax.xml.parsers.DocumentBuilderFactory; 25 | import javax.xml.parsers.ParserConfigurationException; 26 | import javax.xml.transform.OutputKeys; 27 | import javax.xml.transform.Result; 28 | import javax.xml.transform.Transformer; 29 | import javax.xml.transform.TransformerException; 30 | import javax.xml.transform.TransformerFactory; 31 | import javax.xml.transform.dom.DOMSource; 32 | import javax.xml.transform.stream.StreamResult; 33 | import javax.xml.xpath.XPath; 34 | import javax.xml.xpath.XPathConstants; 35 | import javax.xml.xpath.XPathExpressionException; 36 | import javax.xml.xpath.XPathFactory; 37 | 38 | import org.eclipse.core.runtime.IStatus; 39 | import org.eclipse.core.runtime.Status; 40 | import org.w3c.dom.Document; 41 | import org.w3c.dom.Node; 42 | import org.xml.sax.InputSource; 43 | import org.xml.sax.SAXException; 44 | 45 | public class XPathEvaluator { 46 | 47 | public static final boolean DEFAULT_NAMESPACE_AWARE = false; 48 | 49 | public static final DocumentBuilderFactory DOC_FACTORY = DocumentBuilderFactory.newInstance(); 50 | private final XPath xpath = XPathFactory.newInstance().newXPath(); 51 | 52 | private Document doc; 53 | 54 | public XPathEvaluator(Reader reader) throws SAXException, IOException, ParserConfigurationException { 55 | this(reader, DEFAULT_NAMESPACE_AWARE); 56 | } 57 | 58 | public XPathEvaluator(Reader reader, boolean namespaceAware) throws SAXException, IOException, ParserConfigurationException { 59 | DOC_FACTORY.setNamespaceAware(namespaceAware); 60 | doc = DOC_FACTORY.newDocumentBuilder().parse(new InputSource(reader)); 61 | } 62 | 63 | public boolean evaluateBoolean(String expr) { 64 | try { 65 | return (Boolean) xpath.evaluate(expr, doc, XPathConstants.BOOLEAN); 66 | } catch (XPathExpressionException e) { 67 | logXpathEvaluationError(e, expr); 68 | return false; 69 | } 70 | } 71 | 72 | private void logXpathEvaluationError(Exception e, String expr) { 73 | Activator.getInstance().getLog().log(new Status(IStatus.ERROR, Activator.PLUGINID, "Error evaluating xPath '" + expr + "'", e)); 74 | } 75 | 76 | public String evaluateString(String expr) { 77 | try { 78 | return (String) xpath.evaluate(expr, doc, XPathConstants.STRING); 79 | } catch (XPathExpressionException e) { 80 | logXpathEvaluationError(e, expr); 81 | return null; 82 | } 83 | } 84 | 85 | public Node evaluateNode(String expr) { 86 | try { 87 | return (Node) xpath.evaluate(expr, doc, XPathConstants.NODE); 88 | } catch (XPathExpressionException e) { 89 | logXpathEvaluationError(e, expr); 90 | return null; 91 | } 92 | } 93 | 94 | public void printDocument(Result target) throws TransformerException { 95 | TransformerFactory tf = TransformerFactory.newInstance(); 96 | tf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); 97 | Transformer transformer = tf.newTransformer(); 98 | transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no"); 99 | transformer.setOutputProperty(OutputKeys.METHOD, "xml"); 100 | transformer.setOutputProperty(OutputKeys.INDENT, "yes"); 101 | transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); 102 | transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4"); 103 | 104 | transformer.transform(new DOMSource(doc), target); 105 | } 106 | 107 | @Override 108 | public String toString() { 109 | StringWriter writer = new StringWriter(); 110 | try { 111 | printDocument(new StreamResult(writer)); 112 | } catch (TransformerException e) { 113 | Activator.getInstance().getLog().log(new Status(IStatus.ERROR, Activator.PLUGINID, "Error printing Document", e)); 114 | } 115 | return writer.toString(); 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/plugins/com.github.cameltooling.lsp.reddeer/src/com/github/cameltooling/lsp/reddeer/editor/EditorComponentControl.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.github.cameltooling.lsp.reddeer.editor; 19 | 20 | /** 21 | * Handles most common actions required while working with Components and LSP. 22 | * 23 | * @author fpospisi 24 | */ 25 | public class EditorComponentControl { 26 | 27 | /** 28 | * Inserts component to camel-context to place="$HERE". 29 | * 30 | * @param component Component to be added represented by string. 31 | * @param place Place inside camel-context. 32 | */ 33 | public static void insertComponent(String component, String place) { 34 | SourceEditor sourceEditor = new SourceEditor(); 35 | int cursorPosition = sourceEditor.getText().indexOf(place) + place.length() + 2; 36 | sourceEditor.setCursorPosition(cursorPosition); // to write between "" 37 | sourceEditor.insertText(component); 38 | sourceEditor.setCursorPosition(cursorPosition + component.length()); 39 | 40 | } 41 | 42 | /** 43 | * Removes component from opened camel-context. 44 | * 45 | * @param component Component to be removed form camel-context. 46 | */ 47 | public static void removeComponent(String component) { 48 | SourceEditor sourceEditor = new SourceEditor(); 49 | String withoutComponent = sourceEditor.getText().replace(component, ""); 50 | sourceEditor.selectText(0, withoutComponent.length() + component.length()); 51 | sourceEditor.insertText(withoutComponent); 52 | } 53 | } -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/plugins/com.github.cameltooling.lsp.reddeer/src/com/github/cameltooling/lsp/reddeer/editor/FilteredSelectionDialog.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.github.cameltooling.lsp.reddeer.editor; 18 | 19 | import java.util.List; 20 | 21 | import org.eclipse.reddeer.common.exception.RedDeerException; 22 | import org.eclipse.reddeer.common.util.Display; 23 | import org.eclipse.reddeer.common.wait.TimePeriod; 24 | import org.eclipse.reddeer.common.wait.WaitUntil; 25 | import org.eclipse.reddeer.common.wait.WaitWhile; 26 | import org.eclipse.reddeer.swt.api.TableItem; 27 | import org.eclipse.reddeer.swt.condition.ShellIsAvailable; 28 | import org.eclipse.reddeer.swt.condition.TableHasRows; 29 | import org.eclipse.reddeer.swt.impl.button.CancelButton; 30 | import org.eclipse.reddeer.swt.impl.button.OkButton; 31 | import org.eclipse.reddeer.swt.impl.shell.DefaultShell; 32 | import org.eclipse.reddeer.swt.impl.table.DefaultTable; 33 | import org.eclipse.reddeer.swt.impl.text.DefaultText; 34 | 35 | public class FilteredSelectionDialog extends DefaultShell { 36 | 37 | public static final String TITLE = ""; 38 | 39 | public FilteredSelectionDialog() { 40 | super(TITLE); 41 | } 42 | 43 | public FilteredSelectionDialog setText(String text) { 44 | new DefaultText(this).setText(text); 45 | return this; 46 | } 47 | 48 | public List getItems() { 49 | return new DefaultTable(this).getItems(); 50 | } 51 | 52 | public FilteredSelectionDialog waitForItems() { 53 | new WaitUntil(new TableHasRows(new DefaultTable(this)), TimePeriod.LONG, false); 54 | return this; 55 | } 56 | 57 | public FilteredSelectionDialog selectItem(String text) { 58 | DefaultTable table = new DefaultTable(this); 59 | Display.syncExec(() -> { 60 | org.eclipse.swt.widgets.TableItem[] item = table.getSWTWidget().getSelection(); 61 | if (item.length > 0 && !item[0].getText().startsWith(text)) { 62 | table.getItem(text).select(); 63 | } 64 | }); 65 | return this; 66 | } 67 | 68 | public void ok() { 69 | List selectedItems = new DefaultTable(this).getSelectedItems(); 70 | if (selectedItems.isEmpty()) { 71 | throw new RedDeerException("No item is selected"); 72 | } 73 | new OkButton(this).click(); 74 | new WaitWhile(new ShellIsAvailable(TITLE)); 75 | } 76 | 77 | public void cancel() { 78 | new CancelButton(this).click(); 79 | new WaitWhile(new ShellIsAvailable(TITLE)); 80 | } 81 | 82 | } 83 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/plugins/com.github.cameltooling.lsp.reddeer/src/com/github/cameltooling/lsp/reddeer/editor/SourceEditor.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.github.cameltooling.lsp.reddeer.editor; 18 | 19 | import java.util.List; 20 | 21 | import org.eclipse.core.runtime.NullProgressMonitor; 22 | import org.eclipse.reddeer.common.util.Display; 23 | import org.eclipse.reddeer.common.util.ResultRunnable; 24 | import org.eclipse.reddeer.eclipse.core.resources.ProjectItem; 25 | import org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer; 26 | import org.eclipse.reddeer.jface.text.contentassist.ContentAssistant; 27 | import org.eclipse.reddeer.swt.impl.styledtext.DefaultStyledText; 28 | import org.eclipse.reddeer.workbench.handler.EditorHandler; 29 | import org.eclipse.reddeer.workbench.impl.editor.DefaultEditor; 30 | 31 | /** 32 | * Represents 'Source' tab of Editor 33 | * 34 | * @author tsedmik 35 | */ 36 | public class SourceEditor extends DefaultEditor { 37 | 38 | private DefaultStyledText editor = new DefaultStyledText(); 39 | 40 | /** 41 | * Sets position of the cursor to the specified position 42 | * 43 | * @param position 44 | * position in the editor 45 | */ 46 | public void setCursorPosition(int position) { 47 | editor.selectPosition(position); 48 | } 49 | 50 | /** 51 | * Inserts given text on the cursor position 52 | * 53 | * @param text 54 | * text to be inserted 55 | */ 56 | public void insertText(String text) { 57 | editor.insertText(text); 58 | } 59 | 60 | /** 61 | * Returns text in the editor 62 | * 63 | * @return text in the editor 64 | */ 65 | public String getText() { 66 | return editor.getText(); 67 | } 68 | 69 | public int getPosition(String text) { 70 | return editor.getPositionOfText(text); 71 | } 72 | 73 | public void selectText(int from, int to) { 74 | editor.setSelection(from, to); 75 | } 76 | 77 | /** 78 | * Opens ContentAssistant and return available code completion proposals 79 | * 80 | * @return List 81 | */ 82 | public List getCompletionProposals() { 83 | ContentAssistant assistant = openContentAssistant(); 84 | List proposals = assistant.getProposals(); 85 | assistant.close(); 86 | return proposals; 87 | } 88 | 89 | @Override 90 | public void activate() { 91 | EditorHandler.getInstance().activate(editorPart); 92 | } 93 | 94 | public void save() { 95 | log.debug("Saving editor"); 96 | Display.syncExec(new Runnable() { 97 | 98 | @Override 99 | public void run() { 100 | editorPart.doSave(new NullProgressMonitor()); 101 | } 102 | }); 103 | } 104 | 105 | public boolean isDirty() { 106 | return Display.syncExec(new ResultRunnable() { 107 | 108 | @Override 109 | public Boolean run() { 110 | return editorPart.isDirty(); 111 | } 112 | }); 113 | } 114 | 115 | /** 116 | * Opens required file in editor. 117 | * 118 | * @param project Name of project containing file. 119 | * @param path Path to file. 120 | */ 121 | public static void openFile(String project, String... path) { 122 | ProjectItem item = new ProjectExplorer().getProject(project).getProjectItem(path); 123 | item.open(); 124 | } 125 | 126 | /** 127 | * Closes current instance of editor and opens again required file. 128 | * 129 | * @param project Name of project containing file. 130 | * @param file Name of file to be open after reopen. 131 | */ 132 | public static void reopenEditor(String project, String... file) { 133 | new SourceEditor().close(); 134 | openFile(project, file); 135 | } 136 | } 137 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/plugins/com.github.cameltooling.lsp.reddeer/src/com/github/cameltooling/lsp/reddeer/launchconfigurations/MavenBuildLaunchConfiguration.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.github.cameltooling.lsp.reddeer.launchconfigurations; 18 | 19 | import org.eclipse.reddeer.eclipse.debug.ui.launchConfigurations.LaunchConfiguration; 20 | 21 | /** 22 | * Represents 'Maven Build' of launch configuration in Launch configuration dialog. 23 | * 24 | * @author tsedmik 25 | */ 26 | public class MavenBuildLaunchConfiguration extends LaunchConfiguration { 27 | 28 | public MavenBuildLaunchConfiguration() { 29 | super("Maven Build"); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/plugins/com.github.cameltooling.lsp.reddeer/src/com/github/cameltooling/lsp/reddeer/preference/CamelCatalogVersion.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.github.cameltooling.lsp.reddeer.preference; 18 | 19 | import org.eclipse.reddeer.core.reference.ReferencedComposite; 20 | import org.eclipse.reddeer.jface.preference.PreferencePage; 21 | import org.eclipse.reddeer.swt.impl.text.LabeledText; 22 | 23 | /** 24 | * Represents Preferences... -> Apache Camel page. 25 | * 26 | * @author fpospisi 27 | */ 28 | public class CamelCatalogVersion extends PreferencePage { 29 | 30 | public CamelCatalogVersion(ReferencedComposite ref) { 31 | super(ref, "Apache Camel"); 32 | } 33 | 34 | /** 35 | * Sets Catalog version. 36 | * 37 | * @param required Catalog version. 38 | */ 39 | public void setVersion(String version) { 40 | new LabeledText("Catalog version").setText(version); 41 | } 42 | 43 | /** 44 | * Gets set Catalog version. 45 | * 46 | * @return currently used Catalog version. 47 | */ 48 | public String getVersion() { 49 | return new LabeledText("Catalog version").getText(); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/plugins/com.github.cameltooling.lsp.reddeer/src/com/github/cameltooling/lsp/reddeer/preference/CamelExtraComponents.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.github.cameltooling.lsp.reddeer.preference; 18 | 19 | import org.eclipse.reddeer.core.reference.ReferencedComposite; 20 | import org.eclipse.reddeer.jface.preference.PreferencePage; 21 | import org.eclipse.reddeer.swt.impl.text.LabeledText; 22 | 23 | /** 24 | * 25 | * @author fpospisi 26 | */ 27 | public class CamelExtraComponents extends PreferencePage { 28 | 29 | public CamelExtraComponents(ReferencedComposite ref) { 30 | super(ref, "Apache Camel"); 31 | } 32 | 33 | public void setComponents(String version) { 34 | new LabeledText("Extra components").setText(version); 35 | } 36 | 37 | public String getComponents() { 38 | return new LabeledText("Extra components").getText(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/plugins/com.github.cameltooling.lsp.reddeer/src/com/github/cameltooling/lsp/reddeer/preference/CamelRuntimeProvider.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.github.cameltooling.lsp.reddeer.preference; 18 | 19 | import java.util.List; 20 | 21 | import org.eclipse.reddeer.core.reference.ReferencedComposite; 22 | import org.eclipse.reddeer.jface.preference.PreferencePage; 23 | import org.eclipse.reddeer.swt.impl.combo.LabeledCombo; 24 | 25 | /** 26 | * Represents Preferences... -> Apache Camel page. 27 | * 28 | * @author fpospisi 29 | */ 30 | public class CamelRuntimeProvider extends PreferencePage { 31 | 32 | public CamelRuntimeProvider(ReferencedComposite ref) { 33 | super(ref, "Apache Camel"); 34 | } 35 | 36 | /** 37 | * Gets list of available runtime providers. 38 | * 39 | * @return available runtime providers. 40 | */ 41 | public List getProviders() { 42 | return new LabeledCombo("Runtime provider").getItems(); 43 | } 44 | 45 | /** 46 | * Gets current runtime provider. 47 | * 48 | * @return current runtime provider. 49 | */ 50 | public String getCurrentProvider() { 51 | return new LabeledCombo("Runtime provider").getText(); 52 | } 53 | 54 | /** 55 | * Sets runtime provider. 56 | * 57 | * @param required runtime provider. 58 | */ 59 | public void setProvider(String provider) { 60 | new LabeledCombo("Runtime provider").setSelection(provider); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/plugins/com.github.cameltooling.lsp.reddeer/src/com/github/cameltooling/lsp/reddeer/preference/ConsolePreferencePage.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.github.cameltooling.lsp.reddeer.preference; 18 | 19 | import org.eclipse.reddeer.core.reference.ReferencedComposite; 20 | import org.eclipse.reddeer.jface.preference.PreferencePage; 21 | import org.eclipse.reddeer.swt.impl.button.CheckBox; 22 | 23 | /** 24 | * Represents Console preference page 25 | * 26 | * @author tsedmik 27 | */ 28 | public class ConsolePreferencePage extends PreferencePage { 29 | 30 | public ConsolePreferencePage(ReferencedComposite ref) { 31 | super(ref, "Run/Debug", "Console"); 32 | } 33 | 34 | public void toggleShowConsoleStandardWrite(boolean checked) { 35 | new CheckBox(2).toggle(checked); 36 | } 37 | 38 | public void toggleShowConsoleErrorWrite(boolean checked) { 39 | new CheckBox(3).toggle(checked); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/plugins/com.github.cameltooling.lsp.reddeer/src/com/github/cameltooling/lsp/reddeer/preference/ConsolePreferenceUtil.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.github.cameltooling.lsp.reddeer.preference; 18 | 19 | import org.eclipse.reddeer.common.logging.Logger; 20 | import org.eclipse.reddeer.direct.preferences.Preferences; 21 | 22 | public class ConsolePreferenceUtil { 23 | 24 | public static final Logger log = Logger.getLogger(ConsolePreferenceUtil.class); 25 | 26 | public static final String CONSOLE_PLUGIN = "org.eclipse.debug.ui"; 27 | public static final String CONSOLE_OPEN_ON_ERR_KEY = "DEBUG.consoleOpenOnErr"; 28 | public static final String CONSOLE_OPEN_ON_OUT_KEY = "DEBUG.consoleOpenOnOut"; 29 | 30 | private ConsolePreferenceUtil() { 31 | //private constructor, only static access 32 | } 33 | 34 | /** 35 | * Decides whether the console opens on error 36 | * 37 | * @return true if the console opens on error, false otherwise 38 | */ 39 | public static boolean isConsoleOpenOnError() { 40 | return "true".equalsIgnoreCase(Preferences.get(CONSOLE_PLUGIN, CONSOLE_OPEN_ON_ERR_KEY)); 41 | } 42 | 43 | /** 44 | * Decides whether the console opens on standard output 45 | * 46 | * @return true if the console opens on standard output, false otherwise 47 | */ 48 | public static boolean isConsoleOpenOnOutput() { 49 | return "true".equalsIgnoreCase(Preferences.get(CONSOLE_PLUGIN, CONSOLE_OPEN_ON_OUT_KEY)); 50 | } 51 | 52 | /** 53 | * Sets the console open on standard output 54 | */ 55 | public static void setConsoleOpenOnError(boolean openOnError) { 56 | log.info("Sets the console open on error to '" + openOnError + "'"); 57 | Preferences.set(CONSOLE_PLUGIN, CONSOLE_OPEN_ON_ERR_KEY, String.valueOf(openOnError)); 58 | } 59 | 60 | /** 61 | * Sets the console open on standard output 62 | */ 63 | public static void setConsoleOpenOnOutput(boolean openOnOutput) { 64 | log.info("Sets the console open on error to '" + openOnOutput + "'"); 65 | Preferences.set(CONSOLE_PLUGIN, CONSOLE_OPEN_ON_OUT_KEY, String.valueOf(openOnOutput)); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/plugins/com.github.cameltooling.lsp.reddeer/src/com/github/cameltooling/lsp/reddeer/preference/FileTypeDialog.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.github.cameltooling.lsp.reddeer.preference; 18 | 19 | import org.eclipse.reddeer.swt.impl.text.LabeledText; 20 | import org.eclipse.reddeer.swt.impl.shell.DefaultShell; 21 | 22 | public class FileTypeDialog { 23 | 24 | public static final String FILE_TYPE = "File type:"; 25 | public static final String ADD_FILE_TYPE = "Add File Type"; 26 | 27 | // Generated class methods (5) 28 | public LabeledText getFileTypeTXT() { 29 | return new LabeledText(FILE_TYPE); 30 | } 31 | 32 | public String getTextFileType() { 33 | return new LabeledText(FILE_TYPE).getText(); 34 | } 35 | 36 | public DefaultShell getShellAddFileType() { 37 | return new DefaultShell(ADD_FILE_TYPE); 38 | } 39 | 40 | public String getTextAddFileType() { 41 | return new DefaultShell(ADD_FILE_TYPE).getText(); 42 | } 43 | 44 | public void setTextFileType(String str) { 45 | new LabeledText(FILE_TYPE).setText(str); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/plugins/com.github.cameltooling.lsp.reddeer/src/com/github/cameltooling/lsp/reddeer/preference/KafkaConnectionURL.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.github.cameltooling.lsp.reddeer.preference; 18 | 19 | import org.eclipse.reddeer.core.reference.ReferencedComposite; 20 | import org.eclipse.reddeer.jface.preference.PreferencePage; 21 | import org.eclipse.reddeer.swt.impl.text.LabeledText; 22 | 23 | /** 24 | * Represents Preferences... -> Apache Camel page. 25 | * 26 | * @author fpospisi 27 | */ 28 | public class KafkaConnectionURL extends PreferencePage { 29 | 30 | public KafkaConnectionURL(ReferencedComposite ref) { 31 | super(ref, "Apache Camel"); 32 | } 33 | 34 | /** 35 | * Sets Kafka connection URL. 36 | * 37 | * @param sets required Kafka connection URL. 38 | */ 39 | public void setURL(String URL) { 40 | new LabeledText("Kafka connection URL").setText(URL); 41 | } 42 | 43 | /** 44 | * Gets Sets Kafka connection URL. 45 | * 46 | * @return currently used Kafka connection URL. 47 | */ 48 | public String getURL() { 49 | return new LabeledText("Kafka connection URL").getText(); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/plugins/com.github.cameltooling.lsp.reddeer/src/com/github/cameltooling/lsp/reddeer/utils/CreateNewEmptyFile.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.github.cameltooling.lsp.reddeer.utils; 18 | 19 | import com.github.cameltooling.lsp.reddeer.wizard.NewJavaClassFirstPage; 20 | import com.github.cameltooling.lsp.reddeer.wizard.NewJavaClassWizard; 21 | import com.github.cameltooling.lsp.reddeer.wizard.NewXMLFileFirstPage; 22 | import com.github.cameltooling.lsp.reddeer.wizard.NewXMLFileWizard; 23 | 24 | /** 25 | * Creates new empty file. 26 | * 27 | * @author fpospisi 28 | */ 29 | public class CreateNewEmptyFile { 30 | 31 | /** 32 | * Creates new empty XML file. 33 | * 34 | * @param filename Name of file. 35 | */ 36 | public static void XMLFile(String filename) { 37 | NewXMLFileWizard newWizXML = new NewXMLFileWizard(); 38 | newWizXML.open(); 39 | NewXMLFileFirstPage newWizXMLPage = new NewXMLFileFirstPage(newWizXML); 40 | newWizXMLPage.setFileName(filename); 41 | newWizXML.finish(); 42 | } 43 | 44 | /** 45 | * Creates new empty Java class. 46 | * 47 | * @param filename Name of class. 48 | */ 49 | public static void JavaClass(String filename) { 50 | NewJavaClassWizard newWizJavaClass = new NewJavaClassWizard(); 51 | newWizJavaClass.open(); 52 | NewJavaClassFirstPage newWizJavaClassPage = new NewJavaClassFirstPage(newWizJavaClass); 53 | newWizJavaClassPage.setClassName(filename); 54 | newWizJavaClass.finish(); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/plugins/com.github.cameltooling.lsp.reddeer/src/com/github/cameltooling/lsp/reddeer/utils/JavaProjectFactory.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.github.cameltooling.lsp.reddeer.utils; 18 | 19 | import org.eclipse.reddeer.common.wait.AbstractWait; 20 | import org.eclipse.reddeer.common.wait.TimePeriod; 21 | import org.eclipse.reddeer.common.wait.WaitWhile; 22 | import org.eclipse.reddeer.eclipse.jdt.ui.wizards.JavaProjectWizard; 23 | import org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer; 24 | import org.eclipse.reddeer.eclipse.utils.DeleteUtils; 25 | import org.eclipse.reddeer.eclipse.wst.jsdt.ui.wizards.JavaProjectWizardFirstPage; 26 | import org.eclipse.reddeer.swt.api.Shell; 27 | import org.eclipse.reddeer.swt.impl.button.CheckBox; 28 | import org.eclipse.reddeer.swt.impl.button.PushButton; 29 | import org.eclipse.reddeer.swt.impl.menu.ContextMenuItem; 30 | import org.eclipse.reddeer.swt.impl.shell.DefaultShell; 31 | import org.eclipse.reddeer.workbench.core.condition.JobIsRunning; 32 | import org.eclipse.reddeer.workbench.impl.shell.WorkbenchShell; 33 | 34 | /** 35 | * Creates new Java project. 36 | * 37 | * @author fpospisi 38 | */ 39 | public class JavaProjectFactory { 40 | 41 | /** 42 | * Creates new Java project. 43 | * 44 | * @param name Name of project. 45 | */ 46 | public static void create(String name) { 47 | JavaProjectWizard javaWiz = new JavaProjectWizard(); 48 | javaWiz.open(); 49 | JavaProjectWizardFirstPage javaWizPage = new JavaProjectWizardFirstPage(javaWiz); 50 | javaWizPage.setName(name); 51 | javaWiz.finish(TimePeriod.DEFAULT); 52 | } 53 | 54 | /** 55 | * Removes all projects. 56 | */ 57 | public static void deleteAllProjects() { 58 | ProjectExplorer explorer = new ProjectExplorer(); 59 | explorer.activate(); 60 | if (explorer.getProjects().size() > 0) { 61 | explorer.selectAllProjects(); 62 | new ContextMenuItem("Refresh").select(); 63 | new WaitWhile(new JobIsRunning(), TimePeriod.LONG); 64 | AbstractWait.sleep(TimePeriod.SHORT); 65 | new WorkbenchShell(); 66 | explorer.activate(); 67 | explorer.selectAllProjects(); 68 | new ContextMenuItem("Delete").select(); 69 | Shell s = new DefaultShell("Delete Resources"); 70 | new CheckBox().toggle(true); 71 | new PushButton("OK").click(); 72 | DeleteUtils.handleDeletion(s, TimePeriod.LONG); 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/plugins/com.github.cameltooling.lsp.reddeer/src/com/github/cameltooling/lsp/reddeer/utils/LogChecker.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.github.cameltooling.lsp.reddeer.utils; 18 | 19 | import static org.junit.Assert.assertTrue; 20 | 21 | import com.github.cameltooling.lsp.reddeer.LogGrapper; 22 | 23 | /** 24 | * Checks 'lsp' errors in Error Log View 25 | * 26 | * @author djelinek 27 | */ 28 | public class LogChecker { 29 | 30 | private LogChecker() { 31 | //private constructor, only static access 32 | } 33 | 34 | public static boolean noLSPError() { 35 | return LogGrapper.getPluginErrors("lsp").isEmpty(); 36 | } 37 | 38 | public static void assertNoLSPError() { 39 | assertTrue("Console contains 'Apache Camel LSP' errors", noLSPError()); 40 | } 41 | 42 | public static boolean noCamelClientLSPError() { 43 | return LogGrapper.getPluginErrors("camel-tooling").isEmpty(); 44 | } 45 | 46 | public static void assertNoCamelClientError() { 47 | assertTrue("Console contains 'Apache Camel Client LSP' errors", noCamelClientLSPError()); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/plugins/com.github.cameltooling.lsp.reddeer/src/com/github/cameltooling/lsp/reddeer/view/ProblemsViewExt.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.github.cameltooling.lsp.reddeer.view; 18 | 19 | import java.util.List; 20 | 21 | import org.eclipse.reddeer.eclipse.ui.views.markers.ProblemsView; 22 | import org.eclipse.reddeer.swt.api.TreeItem; 23 | import org.eclipse.reddeer.swt.impl.tree.DefaultTree; 24 | 25 | public class ProblemsViewExt extends ProblemsView { 26 | 27 | public static final String ERRORS = "Errors"; 28 | 29 | public void doubleClickProblem (String name, ProblemType type) { 30 | activate(); 31 | List items = new DefaultTree().getItems(); 32 | for (TreeItem item : items) { 33 | if (type.equals(ProblemType.ERROR) && item.getText().startsWith(ERRORS)) { 34 | List tmpList = item.getItems(); 35 | for (TreeItem tmp : tmpList) { 36 | if (tmp.getText().contains(name)) { 37 | tmp.doubleClick(); 38 | break; 39 | } 40 | } 41 | break; 42 | } 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/plugins/com.github.cameltooling.lsp.reddeer/src/com/github/cameltooling/lsp/reddeer/wizard/NewJavaClassFirstPage.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.github.cameltooling.lsp.reddeer.wizard; 18 | 19 | import org.eclipse.reddeer.core.reference.ReferencedComposite; 20 | import org.eclipse.reddeer.jface.wizard.WizardPage; 21 | import org.eclipse.reddeer.swt.impl.text.LabeledText; 22 | 23 | /** 24 | * Wizard dialog first page for creating new Java Class. 25 | * 26 | * @author fpospisi 27 | */ 28 | public class NewJavaClassFirstPage extends WizardPage { 29 | 30 | public static final String NAME = "Name:"; 31 | 32 | public NewJavaClassFirstPage(ReferencedComposite referencedComposite) { 33 | super(referencedComposite); 34 | } 35 | 36 | public LabeledText getClassNameTXT() { 37 | return new LabeledText(this, NAME); 38 | } 39 | 40 | public String getClassName() { 41 | return new LabeledText(this, NAME).getText(); 42 | } 43 | 44 | public void setClassName(String str) { 45 | new LabeledText(this, NAME).setText(str); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/plugins/com.github.cameltooling.lsp.reddeer/src/com/github/cameltooling/lsp/reddeer/wizard/NewJavaClassWizard.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.github.cameltooling.lsp.reddeer.wizard; 18 | 19 | import org.eclipse.reddeer.eclipse.selectionwizard.NewMenuWizard; 20 | 21 | /** 22 | * Wizard dialog for creating new Java Class. 23 | * 24 | * @author fpospisi 25 | */ 26 | public class NewJavaClassWizard extends NewMenuWizard { 27 | 28 | /** 29 | * Constructs the wizard with Java > Java Project. 30 | */ 31 | public NewJavaClassWizard() { 32 | super("New Java Class", "Java", "Class"); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/plugins/com.github.cameltooling.lsp.reddeer/src/com/github/cameltooling/lsp/reddeer/wizard/NewXMLFileFirstPage.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.github.cameltooling.lsp.reddeer.wizard; 18 | 19 | import org.eclipse.reddeer.core.reference.ReferencedComposite; 20 | import org.eclipse.reddeer.jface.wizard.WizardPage; 21 | import org.eclipse.reddeer.swt.impl.text.LabeledText; 22 | 23 | /** 24 | * Wizard dialog first page for creating new XML File. 25 | * 26 | * @author djelinek 27 | */ 28 | public class NewXMLFileFirstPage extends WizardPage { 29 | 30 | public static final String FILE_NAME = "File name:"; 31 | 32 | public NewXMLFileFirstPage(ReferencedComposite referencedComposite) { 33 | super(referencedComposite); 34 | } 35 | 36 | public LabeledText getFileNameTXT() { 37 | return new LabeledText(this, FILE_NAME); 38 | } 39 | 40 | public String getFileName() { 41 | return new LabeledText(this, FILE_NAME).getText(); 42 | } 43 | 44 | public void setFileName(String str) { 45 | new LabeledText(this, FILE_NAME).setText(str); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/plugins/com.github.cameltooling.lsp.reddeer/src/com/github/cameltooling/lsp/reddeer/wizard/NewXMLFileWizard.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.github.cameltooling.lsp.reddeer.wizard; 18 | 19 | import org.eclipse.reddeer.eclipse.selectionwizard.NewMenuWizard; 20 | 21 | /** 22 | * Wizard dialog for creating new XML File. 23 | * 24 | * @author djelinek 25 | */ 26 | public class NewXMLFileWizard extends NewMenuWizard { 27 | 28 | /** 29 | * Constructs the wizard with Java > Java Project. 30 | */ 31 | public NewXMLFileWizard() { 32 | super("New XML File", "XML", "XML File"); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/plugins/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.github.camel-tooling.lsp 8 | com.github.camel-tooling.lsp.eclipse.client.tests.ui 9 | 1.0.0-SNAPSHOT 10 | 11 | com.github.camel-tooling.lsp 12 | plugins 13 | ${base.name} :: UI Tests :: Plugins 14 | 1.0.0-SNAPSHOT 15 | pom 16 | 17 | com.github.cameltooling.lsp.reddeer 18 | 19 | 20 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.github.camel-tooling.lsp 8 | eclipse 9 | 1.0.0-SNAPSHOT 10 | 11 | com.github.camel-tooling.lsp.eclipse.client.tests.ui 12 | ${base.name} :: UI Tests 13 | 1.0.0-SNAPSHOT 14 | pom 15 | 16 | plugins 17 | tests 18 | 19 | 20 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/tests/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | tests 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.m2e.core.maven2Builder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.m2e.core.maven2Nature 16 | 17 | 18 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/tests/com.github.cameltooling.lsp.ui.tests/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/tests/com.github.cameltooling.lsp.ui.tests/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | com.github.cameltooling.lsp.ui.tests 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.wst.common.project.facet.core.builder 10 | 11 | 12 | 13 | 14 | org.eclipse.jdt.core.javabuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.pde.ManifestBuilder 20 | 21 | 22 | 23 | 24 | org.eclipse.pde.SchemaBuilder 25 | 26 | 27 | 28 | 29 | org.eclipse.m2e.core.maven2Builder 30 | 31 | 32 | 33 | 34 | 35 | org.eclipse.m2e.core.maven2Nature 36 | org.eclipse.pde.PluginNature 37 | org.eclipse.jdt.core.javanature 38 | org.eclipse.wst.common.project.facet.core.nature 39 | 40 | 41 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/tests/com.github.cameltooling.lsp.ui.tests/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/tests/com.github.cameltooling.lsp.ui.tests/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 4 | org.eclipse.jdt.core.compiler.compliance=17 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled 7 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 8 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 9 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning 10 | org.eclipse.jdt.core.compiler.release=enabled 11 | org.eclipse.jdt.core.compiler.source=17 12 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/tests/com.github.cameltooling.lsp.ui.tests/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/tests/com.github.cameltooling.lsp.ui.tests/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Bundle-ManifestVersion: 2 3 | Bundle-Name: %Bundle-Name 4 | Bundle-SymbolicName: com.github.cameltooling.lsp.ui.tests 5 | Bundle-Version: 1.0.0.qualifier 6 | Bundle-Activator: com.github.cameltooling.lsp.ui.tests.Activator 7 | Require-Bundle: org.eclipse.ui, 8 | org.eclipse.ui.ide;bundle-version="3.13.1", 9 | org.eclipse.ui.workbench.texteditor;bundle-version="3.10.100", 10 | org.eclipse.core.resources;bundle-version="3.12.0", 11 | org.eclipse.core.runtime;bundle-version="3.13.0", 12 | org.eclipse.jface.text;bundle-version="3.12.0", 13 | org.junit;bundle-version="4.12.0", 14 | org.eclipse.reddeer.go;bundle-version="3.1.0", 15 | org.eclipse.reddeer.gef;bundle-version="3.1.0", 16 | org.eclipse.reddeer.graphiti;bundle-version="3.1.0", 17 | com.github.cameltooling.lsp.reddeer;bundle-version="1.0.0", 18 | org.eclipse.draw2d;bundle-version="3.3.1.1", 19 | org.assertj;bundle-version="1.7.1", 20 | org.eclipse.lsp4e;bundle-version="0.6.0", 21 | org.eclipse.lsp4j;bundle-version="0.4.0", 22 | org.eclipse.wst.xml.ui;bundle-version="1.2.0", 23 | org.eclipse.wst.xml.core;bundle-version="1.2.0", 24 | org.eclipse.ui.genericeditor;bundle-version="1.2.0", 25 | com.github.camel-tooling.eclipse.client;bundle-version="1.0.0", 26 | org.eclipse.reddeer.junit 27 | Bundle-ActivationPolicy: lazy 28 | Bundle-RequiredExecutionEnvironment: JavaSE-17 29 | Bundle-Vendor: %Bundle-Vendor 30 | Eclipse-RegisterBuddy: org.apache.log4j 31 | Eclipse-BundleShape: dir 32 | Automatic-Module-Name: com.github.cameltooling.lsp.ui.tests 33 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/tests/com.github.cameltooling.lsp.ui.tests/OSGI-INF/l10n/bundle.properties: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | ############################################################################### 17 | Bundle-Vendor = Red Hat 18 | Bundle-Name = Apache Camel LSP Eclipse client UI Tests 19 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/tests/com.github.cameltooling.lsp.ui.tests/build.properties: -------------------------------------------------------------------------------- 1 | source.. = src/ 2 | output.. = target/classes 3 | bin.includes = .,\ 4 | META-INF/,\ 5 | resources/,\ 6 | OSGI-INF/l10n/bundle.properties,\ 7 | OSGI-INF/ 8 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/tests/com.github.cameltooling.lsp.ui.tests/infinitest.filters: -------------------------------------------------------------------------------- 1 | .*Test 2 | .*Tests -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/tests/com.github.cameltooling.lsp.ui.tests/launcher/RedDeer Test.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/tests/com.github.cameltooling.lsp.ui.tests/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.github.camel-tooling.lsp 8 | tests 9 | 1.0.0-SNAPSHOT 10 | 11 | com.github.cameltooling.lsp.ui.tests 12 | ${base.name} :: UI Tests :: Tests :: LSP Eclipse Client Tests 13 | eclipse-test-plugin 14 | 15 | 16 | 21600 17 | -XX:MaxPermSize=384m 18 | false 19 | false 20 | -Dreddeer.skipUnfixedIssues=${reddeer.skipUnfixedIssues} -Dorg.eclipse.swt.internal.gtk.disablePrinting 21 | -Drd.config=${rd.config} 22 | false 23 | ${integrationTestsSystemProperties} ${reddeerConfig} ${ideConfig} 24 | resources/settings/plugin_customization.ini 25 | ${project.build.directory}/requirements/repository/ 26 | false 27 | true 28 | false 29 | SmokeTests 30 | ../../../target/jacoco.exec 31 | ../../../target/jacoco-it.exec 32 | -XX:+HeapDumpOnOutOfMemoryError 33 | 34 | 35 | 36 | 37 | 38 | maven-resources-plugin 39 | 3.3.1 40 | 41 | 42 | copy-files 43 | pre-integration-test 44 | 45 | copy-resources 46 | 47 | 48 | UTF-8 49 | ${project.build.directory}/requirements 50 | 51 | 52 | resources/config 53 | true 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | org.eclipse.tycho 64 | tycho-surefire-plugin 65 | ${tycho.version} 66 | 67 | org.eclipse.platform.ide 68 | org.eclipse.ui.ide.workbench 69 | true 70 | false 71 | pluginCustomization ${customization.file} -clean -testpluginname com.github.cameltooling.lsp.ui.tests 72 | ${tycho.testArgLine} ${ui.tests.vmargs} 73 | com.github.cameltooling.lsp.ui.tests 74 | **/${testUIClass} 75 | ${skipUITests} 76 | 77 | ${enable.debug.log} 78 | ${project.build.directory}/requirements/emptysettings.xml 79 | ${maven.repo} 80 | ${staging.repos} 81 | ${rd.skipUnfixedIssues} 82 | 83 | 84 | 85 | p2-installable-unit 86 | org.eclipse.platform 87 | 0.0.0 88 | 89 | 90 | p2-installable-unit 91 | org.eclipse.e4.rcp.feature.group 92 | 0.0.0 93 | 94 | 95 | p2-installable-unit 96 | org.eclipse.jdt.feature.group 97 | 0.0.0 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | macos 107 | 108 | 109 | mac 110 | 111 | 112 | 113 | -XX:+HeapDumpOnOutOfMemoryError -XstartOnFirstThread 114 | 115 | 116 | 117 | 118 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/tests/com.github.cameltooling.lsp.ui.tests/resources/additional-component-feature-component.json: -------------------------------------------------------------------------------- 1 | [{ 2 | "component":{ 3 | "kind":"component", 4 | "scheme":"abcd", 5 | "syntax":"abcd:xyz" 6 | } 7 | }] -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/tests/com.github.cameltooling.lsp.ui.tests/resources/additional-component-feature-context.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/tests/com.github.cameltooling.lsp.ui.tests/resources/camel-context-cbr.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | /order/customer/country = 'UK' 11 | 12 | 13 | 14 | 15 | /order/customer/country = 'US' 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/tests/com.github.cameltooling.lsp.ui.tests/resources/catalog-version-feature-context.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/tests/com.github.cameltooling.lsp.ui.tests/resources/java-editor-completion-test-route.java: -------------------------------------------------------------------------------- 1 | import src.main.java.com.mycompany.camel.RouteBuilder; 2 | 3 | public class MyRouteBuilder extends RouteBuilder { 4 | public void configure() { 5 | from("file:work/cbr/input") 6 | .choice() 7 | .when(xpath("/person/city = 'London'")) 8 | .to("file:target/messages/uk") 9 | .otherwise() 10 | .to("file:target/messages/others"); 11 | } 12 | } -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/tests/com.github.cameltooling.lsp.ui.tests/resources/kafka-dynamic-completion-context.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/tests/com.github.cameltooling.lsp.ui.tests/resources/settings/plugin_customization.ini: -------------------------------------------------------------------------------- 1 | #camel tooling tests 2 | org.eclipse.m2e.core/eclipse.m2.updateIndexes=false 3 | org.eclipse.jdt.ui/closeBraces=false 4 | org.eclipse.jdt.ui/closeBrackets=false 5 | org.eclipse.jdt.ui/closeStrings=false 6 | 7 | #not activated plugins on startup 8 | org.eclipse.ui.workbench/PLUGINS_NOT_ACTIVATED_ON_STARTUP=org.eclipse.equinox.p2.ui.sdk.scheduler;org.eclipse.m2e.discovery;org.eclipse.epp.logging.aeri.ide;org.eclipse.epp.logging.aeri.core; 9 | #do not perform oomph startup tasks 10 | org.eclipse.oomph.setup.ui/skip.startup.tasks=true 11 | #disable oomph recorder (will work after https://bugs.eclipse.org/bugs/show_bug.cgi?id=467854 is fixed 12 | org.eclipse.oomph.setup.ui/enable.preference.recorder=false 13 | #do not report errors 14 | org.eclipse.epp.logging.aeri.ui.prefs/action=IGNORE 15 | #disable notifications 16 | org.eclipse.mylyn.commons.notifications.ui/notifications.enabled=false 17 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/tests/com.github.cameltooling.lsp.ui.tests/resources/settings/plugin_customization_with_proxy_settings.ini: -------------------------------------------------------------------------------- 1 | #not activated plugins on startup 2 | org.eclipse.ui.workbench/PLUGINS_NOT_ACTIVATED_ON_STARTUP=org.eclipse.equinox.p2.ui.sdk.scheduler;org.eclipse.m2e.discovery;org.eclipse.epp.logging.aeri.ide;org.eclipse.epp.logging.aeri.core; 3 | #do not perform oomph startup tasks 4 | org.eclipse.oomph.setup.ui/skip.startup.tasks=true 5 | #disable oomph recorder (will work after https://bugs.eclipse.org/bugs/show_bug.cgi?id=467854 is fixed 6 | org.eclipse.oomph.setup.ui/enable.preference.recorder=false 7 | #do not report errors 8 | org.eclipse.epp.logging.aeri.ui.prefs/action=IGNORE 9 | #disable notifications 10 | org.eclipse.mylyn.commons.notifications.ui/notifications.enabled=false 11 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/tests/com.github.cameltooling.lsp.ui.tests/resources/settings/proxy_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | maven-proxy 6 | 7 | 8 | maven-proxy-repo 9 | ${test.mavenProxy} 10 | 11 | 12 | 13 | 14 | maven-proxy-repo 15 | ${test.mavenProxy} 16 | 17 | 18 | 19 | 20 | 21 | maven-proxy 22 | 23 | 24 | 25 | maven-proxy-mirror 26 | ${test.mavenProxy} 27 | * 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/tests/com.github.cameltooling.lsp.ui.tests/src/com/github/cameltooling/lsp/ui/tests/Activator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.github.cameltooling.lsp.ui.tests; 18 | 19 | import org.eclipse.ui.plugin.AbstractUIPlugin; 20 | import org.osgi.framework.BundleContext; 21 | 22 | /** 23 | * The activator class controls the plug-in life cycle 24 | */ 25 | public class Activator extends AbstractUIPlugin { 26 | 27 | // The plug-in ID 28 | public static final String PLUGIN_ID = "com.github.cameltooling.lsp.ui.tests"; 29 | 30 | // The shared instance 31 | private static Activator plugin; 32 | 33 | @Override 34 | public void start(BundleContext context) throws Exception { 35 | super.start(context); 36 | setInstance(this); 37 | } 38 | 39 | @Override 40 | public void stop(BundleContext context) throws Exception { 41 | setInstance(null); 42 | super.stop(context); 43 | } 44 | 45 | /** 46 | * Returns the shared instance 47 | * 48 | * @return the shared instance 49 | */ 50 | public static Activator getDefault() { 51 | return plugin; 52 | } 53 | 54 | private static synchronized void setInstance(Activator plugin) { 55 | Activator.plugin = plugin; 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/tests/com.github.cameltooling.lsp.ui.tests/src/com/github/cameltooling/lsp/ui/tests/AdditionalComponentFeatureTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.github.cameltooling.lsp.ui.tests; 19 | 20 | import com.github.cameltooling.lsp.reddeer.editor.EditorComponentControl; 21 | import com.github.cameltooling.lsp.reddeer.editor.SourceEditor; 22 | import com.github.cameltooling.lsp.reddeer.preference.CamelExtraComponents; 23 | import com.github.cameltooling.lsp.reddeer.utils.CreateNewEmptyFile; 24 | import com.github.cameltooling.lsp.reddeer.utils.JavaProjectFactory; 25 | import com.github.cameltooling.lsp.ui.tests.utils.EditorManipulator; 26 | import com.github.cameltooling.lsp.ui.tests.utils.TimeoutPeriodManipulator; 27 | 28 | import org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer; 29 | import org.eclipse.reddeer.eclipse.ui.views.log.LogView; 30 | import org.eclipse.reddeer.jface.text.contentassist.ContentAssistant; 31 | import org.eclipse.reddeer.junit.runner.RedDeerSuite; 32 | import org.eclipse.reddeer.requirements.cleanerrorlog.CleanErrorLogRequirement; 33 | import org.eclipse.reddeer.requirements.cleanworkspace.CleanWorkspaceRequirement; 34 | import org.eclipse.reddeer.swt.api.Shell; 35 | import org.eclipse.reddeer.swt.impl.button.PushButton; 36 | import org.eclipse.reddeer.swt.impl.ctab.DefaultCTabItem; 37 | import org.eclipse.reddeer.swt.impl.shell.DefaultShell; 38 | import org.eclipse.reddeer.workbench.handler.WorkbenchShellHandler; 39 | import org.eclipse.reddeer.workbench.impl.editor.DefaultEditor; 40 | import org.eclipse.reddeer.workbench.ui.dialogs.WorkbenchPreferenceDialog; 41 | import org.junit.After; 42 | import org.junit.Before; 43 | import org.junit.BeforeClass; 44 | import org.junit.Rule; 45 | import org.junit.Test; 46 | import org.junit.rules.ErrorCollector; 47 | import org.junit.runner.RunWith; 48 | 49 | import static org.hamcrest.CoreMatchers.equalTo; 50 | 51 | /* 52 | * 53 | * @author fpospisi 54 | */ 55 | @RunWith(RedDeerSuite.class) 56 | public class AdditionalComponentFeatureTest extends DefaultTest { 57 | 58 | public static final String PROJECT_NAME = "AdditionalComponentTest"; 59 | public static final String CAMEL_CONTEXT = "camel-context.xml"; 60 | public static final String SOURCE_TAB = "Source"; 61 | public static final String COMPONENT_PLACE = "uri"; 62 | 63 | private static final String COMPONENT_NAME = "abcd"; 64 | private static final String COMPONENT_PROPOSAL = "abcd:xyz"; 65 | public static final String RESOURCES_CONTEXT_PATH = "resources/additional-component-feature-context.xml"; 66 | public static final String EXTRA_COMPONENT_JSON_PATH = "resources/additional-component-feature-component.json"; 67 | 68 | private SourceEditor sourceEditor; 69 | 70 | /** 71 | * Creates empty project, then creates XML file with camel-context. 72 | */ 73 | @BeforeClass 74 | public static void setupTestEnvironment() { 75 | JavaProjectFactory.create(PROJECT_NAME); 76 | new ProjectExplorer().selectProjects(PROJECT_NAME); 77 | CreateNewEmptyFile.XMLFile(CAMEL_CONTEXT); 78 | DefaultEditor editor = new DefaultEditor(CAMEL_CONTEXT); 79 | editor.activate(); 80 | new DefaultCTabItem(SOURCE_TAB).activate(); 81 | EditorManipulator.copyFileContentToXMLEditor(RESOURCES_CONTEXT_PATH); 82 | } 83 | 84 | /** 85 | * Prepares test environment. 86 | */ 87 | @Before 88 | public void defaultBeforeTestSetup() { 89 | new CleanErrorLogRequirement().fulfill(); 90 | } 91 | 92 | @Before 93 | public void setupTimeout() { 94 | TimeoutPeriodManipulator.setFactor(3); 95 | } 96 | 97 | /** 98 | * Cleans up test environment. 99 | */ 100 | @After 101 | public void defaultAfterTestClean() { 102 | WorkbenchShellHandler.getInstance().closeAllNonWorbenchShells(); 103 | } 104 | 105 | @After 106 | public void tearDown() { 107 | TimeoutPeriodManipulator.clearFactor(); 108 | setAdditionalComponent(""); // set version back to empty 109 | } 110 | 111 | @After 112 | public void deleteProject() { 113 | JavaProjectFactory.deleteAllProjects(); 114 | LogView log = new LogView(); 115 | log.open(); 116 | log.deleteLog(); 117 | WorkbenchShellHandler.getInstance().closeAllNonWorbenchShells(); 118 | 119 | new CleanWorkspaceRequirement().fulfill(); 120 | } 121 | 122 | @Rule 123 | public ErrorCollector collector = new ErrorCollector(); 124 | 125 | /** 126 | * Inserts custom component into template. Then checks if proposal is available. 127 | * Custom component is added into environment preferences and editor is 128 | * reopened. Checks again if proposal is available. 129 | */ 130 | @Test 131 | public void testAdditionalComponentFeature() { 132 | EditorComponentControl.insertComponent(COMPONENT_NAME, COMPONENT_PLACE); 133 | collector.checkThat(testProposal(COMPONENT_NAME, COMPONENT_PROPOSAL), equalTo(false)); 134 | setAdditionalComponent(EditorManipulator.getFileContent(EXTRA_COMPONENT_JSON_PATH)); 135 | SourceEditor.reopenEditor(PROJECT_NAME, CAMEL_CONTEXT); 136 | EditorComponentControl.insertComponent(COMPONENT_NAME, COMPONENT_PLACE); 137 | collector.checkThat(testProposal(COMPONENT_NAME, COMPONENT_PROPOSAL), equalTo(true)); 138 | } 139 | 140 | /* 141 | * Inserts additional component in Apache Camel preference page. 142 | * 143 | * @param component Representation of additional component in JSON valid format. 144 | */ 145 | public void setAdditionalComponent(String component) { 146 | WorkbenchPreferenceDialog prefs = new WorkbenchPreferenceDialog(); 147 | CamelExtraComponents extraComponents = new CamelExtraComponents(prefs); 148 | prefs.open(); 149 | prefs.select(extraComponents); 150 | extraComponents.setComponents(component); 151 | new PushButton("Apply").click(); 152 | Shell shell = new DefaultShell("Preferences"); 153 | new PushButton(shell, "Apply and Close").click(); 154 | } 155 | 156 | /* 157 | * Tests if expected proposal is available for component. 158 | * 159 | * @param component Tested component. 160 | * 161 | * @param expectedProposal Expected proposal for component. 162 | * 163 | * @return true Proposal is available. 164 | * 165 | * @return false Proposal is not available. 166 | */ 167 | public boolean testProposal(String component, String expectedProposal) { 168 | sourceEditor = new SourceEditor(); 169 | int cursorPosition = sourceEditor.getText().indexOf(component); 170 | sourceEditor.setCursorPosition(cursorPosition + component.length()); 171 | ContentAssistant assistant = sourceEditor.openContentAssistant(); 172 | return assistant.getProposals().contains(expectedProposal); 173 | } 174 | } -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/tests/com.github.cameltooling.lsp.ui.tests/src/com/github/cameltooling/lsp/ui/tests/CamelCatalogVersionFeatureTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.github.cameltooling.lsp.ui.tests; 18 | 19 | import com.github.cameltooling.lsp.reddeer.utils.CreateNewEmptyFile; 20 | import com.github.cameltooling.lsp.reddeer.utils.JavaProjectFactory; 21 | import com.github.cameltooling.lsp.ui.tests.utils.EditorManipulator; 22 | import com.github.cameltooling.lsp.ui.tests.utils.TimeoutPeriodManipulator; 23 | 24 | import org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer; 25 | import org.eclipse.reddeer.eclipse.ui.views.log.LogView; 26 | import org.eclipse.reddeer.jface.text.contentassist.ContentAssistant; 27 | import org.eclipse.reddeer.junit.runner.RedDeerSuite; 28 | import org.eclipse.reddeer.requirements.cleanerrorlog.CleanErrorLogRequirement; 29 | import org.eclipse.reddeer.requirements.cleanworkspace.CleanWorkspaceRequirement; 30 | import org.eclipse.reddeer.swt.api.Shell; 31 | import org.eclipse.reddeer.swt.impl.button.PushButton; 32 | import org.eclipse.reddeer.swt.impl.ctab.DefaultCTabItem; 33 | import org.eclipse.reddeer.swt.impl.shell.DefaultShell; 34 | import org.eclipse.reddeer.workbench.handler.WorkbenchShellHandler; 35 | import org.eclipse.reddeer.workbench.impl.editor.DefaultEditor; 36 | import org.eclipse.reddeer.workbench.ui.dialogs.WorkbenchPreferenceDialog; 37 | import org.junit.After; 38 | import org.junit.Before; 39 | import org.junit.BeforeClass; 40 | import org.junit.Rule; 41 | import org.junit.Test; 42 | import org.junit.rules.ErrorCollector; 43 | import org.junit.runner.RunWith; 44 | 45 | import static org.hamcrest.CoreMatchers.equalTo; 46 | 47 | import com.github.cameltooling.lsp.reddeer.editor.EditorComponentControl; 48 | import com.github.cameltooling.lsp.reddeer.editor.SourceEditor; 49 | import com.github.cameltooling.lsp.reddeer.preference.CamelCatalogVersion; 50 | 51 | /* 52 | * 53 | * @author fpospisi 54 | */ 55 | @RunWith(RedDeerSuite.class) 56 | public class CamelCatalogVersionFeatureTest extends DefaultTest { 57 | 58 | public static final String PROJECT_NAME = "CatalogFeatureTest"; 59 | public static final String CAMEL_CONTEXT = "camel-context.xml"; 60 | public static final String RESOURCES_CONTEXT_PATH = "resources/catalog-version-feature-context.xml"; 61 | public static final String COMPONENT = "file-watch"; 62 | public static final String COMPONENT_PROPOSAL = "file-watch:path"; 63 | public static final String DEFAULT_VERSION = ""; 64 | public static final String OLDER_VERSION = "2.15.1"; 65 | 66 | public static final String SOURCE_TAB = "Source"; 67 | public static final String COMPONENT_PLACE = "uri"; 68 | 69 | /** 70 | * Creates empty project, then creates XML file with camel-context. 71 | */ 72 | @BeforeClass 73 | public static void setupTestEnvironment() { 74 | JavaProjectFactory.create(PROJECT_NAME); 75 | new ProjectExplorer().selectProjects(PROJECT_NAME); 76 | CreateNewEmptyFile.XMLFile(CAMEL_CONTEXT); 77 | DefaultEditor editor = new DefaultEditor(CAMEL_CONTEXT); 78 | editor.activate(); 79 | new DefaultCTabItem(SOURCE_TAB).activate(); 80 | EditorManipulator.copyFileContentToXMLEditor(RESOURCES_CONTEXT_PATH); 81 | } 82 | 83 | /** 84 | * Prepares test environment. 85 | */ 86 | @Before 87 | public void defaultBeforeTestSetup() { 88 | new CleanErrorLogRequirement().fulfill(); 89 | } 90 | 91 | @Before 92 | public void setupTimeout() { 93 | TimeoutPeriodManipulator.setFactor(3); 94 | } 95 | 96 | /** 97 | * Cleans up test environment. 98 | */ 99 | @After 100 | public void defaultAfterTestClean() { 101 | WorkbenchShellHandler.getInstance().closeAllNonWorbenchShells(); 102 | } 103 | 104 | @After 105 | public void tearDown() { 106 | TimeoutPeriodManipulator.clearFactor(); 107 | setCamelCatalogVersion(DEFAULT_VERSION); // set version back to default 108 | } 109 | 110 | @After 111 | public void deleteProject() { 112 | JavaProjectFactory.deleteAllProjects(); 113 | LogView log = new LogView(); 114 | log.open(); 115 | log.deleteLog(); 116 | WorkbenchShellHandler.getInstance().closeAllNonWorbenchShells(); 117 | 118 | new CleanWorkspaceRequirement().fulfill(); 119 | } 120 | 121 | @Rule 122 | public ErrorCollector collector = new ErrorCollector(); 123 | 124 | /** 125 | * Checks if proposal is available for component in latest catalog. Then changes 126 | * version of used Catalog to older one which is not containing that component. 127 | * Checks if proposal is not available in older version. 128 | */ 129 | @Test 130 | public void testCamelCatalogVersionFeature() { 131 | EditorComponentControl.insertComponent(COMPONENT, COMPONENT_PLACE); 132 | 133 | // set cursor position for getting proposal 134 | SourceEditor sourceEditor = new SourceEditor(); 135 | int cursorPosition = sourceEditor.getText().indexOf(COMPONENT) + COMPONENT.length(); 136 | sourceEditor.setCursorPosition(cursorPosition); 137 | 138 | // check proposal 139 | ContentAssistant assistant = sourceEditor.openContentAssistant(); 140 | assistant.getProposals(); 141 | collector.checkThat(assistant.getProposals().contains(COMPONENT_PROPOSAL), equalTo(true)); 142 | 143 | setCamelCatalogVersion(OLDER_VERSION); 144 | 145 | SourceEditor.reopenEditor(PROJECT_NAME, CAMEL_CONTEXT); 146 | 147 | EditorComponentControl.insertComponent(COMPONENT, COMPONENT_PLACE); 148 | sourceEditor = new SourceEditor(); 149 | cursorPosition = sourceEditor.getText().indexOf(COMPONENT) + COMPONENT.length(); 150 | sourceEditor.setCursorPosition(cursorPosition); 151 | assistant = sourceEditor.openContentAssistant(); 152 | 153 | collector.checkThat(assistant.getProposals().contains(COMPONENT_PROPOSAL), equalTo(false)); 154 | } 155 | 156 | /** 157 | * Changes used Camel Catalog Version. It's necessary to reopen editor to take 158 | * effect. 159 | * 160 | * @param version of Camel Catalog represented by string. 161 | */ 162 | public void setCamelCatalogVersion(String version) { 163 | WorkbenchPreferenceDialog prefs = new WorkbenchPreferenceDialog(); 164 | CamelCatalogVersion catalogVersion = new CamelCatalogVersion(prefs); 165 | prefs.open(); 166 | prefs.select(catalogVersion); 167 | catalogVersion.setVersion(version); 168 | new PushButton("Apply").click(); 169 | Shell shell = new DefaultShell("Preferences"); 170 | new PushButton(shell, "Apply and Close").click(); 171 | } 172 | } -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/tests/com.github.cameltooling.lsp.ui.tests/src/com/github/cameltooling/lsp/ui/tests/CamelLSPCompletionTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.github.cameltooling.lsp.ui.tests; 18 | 19 | import org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer; 20 | import org.eclipse.reddeer.junit.runner.RedDeerSuite; 21 | import org.eclipse.reddeer.swt.impl.ctab.DefaultCTabItem; 22 | import org.eclipse.reddeer.workbench.impl.editor.DefaultEditor; 23 | import org.eclipse.reddeer.workbench.ui.dialogs.WorkbenchPreferenceDialog; 24 | 25 | import com.github.cameltooling.lsp.ui.tests.utils.EditorManipulator; 26 | import com.github.cameltooling.lsp.reddeer.preference.DefaultEditorPreferencePage; 27 | import com.github.cameltooling.lsp.reddeer.utils.JavaProjectFactory; 28 | import com.github.cameltooling.lsp.reddeer.utils.CreateNewEmptyFile; 29 | 30 | import org.junit.BeforeClass; 31 | import org.junit.runner.RunWith; 32 | 33 | /** 34 | * Tests Apache Camel Tooling LSP client in XML Editor (Source tab)
35 | * 36 | * @author djelinek 37 | */ 38 | @RunWith(RedDeerSuite.class) 39 | public class CamelLSPCompletionTest extends DefaultLSPCompletionTest { 40 | 41 | @BeforeClass 42 | public static void prepareEnvironment() { 43 | WorkbenchPreferenceDialog prefs = new WorkbenchPreferenceDialog(); 44 | DefaultEditorPreferencePage defaultEditor = new DefaultEditorPreferencePage(prefs); 45 | prefs.open(); 46 | prefs.select(defaultEditor); 47 | defaultEditor.set(".xml", "XML Editor"); 48 | prefs.ok(); 49 | 50 | JavaProjectFactory.create(PROJECT_NAME); 51 | new ProjectExplorer().selectProjects(PROJECT_NAME); 52 | CreateNewEmptyFile.XMLFile(CAMEL_CONTEXT); 53 | new DefaultEditor(CAMEL_CONTEXT).activate(); 54 | new DefaultCTabItem(EDITOR_SOURCE_TAB).activate(); 55 | EditorManipulator.copyFileContentToXMLEditor(RESOURCES_CONTEXT_PATH); 56 | } 57 | 58 | // ... execute UI tests from DefaultLSPCompletionTest class 59 | 60 | } 61 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/tests/com.github.cameltooling.lsp.ui.tests/src/com/github/cameltooling/lsp/ui/tests/DefaultTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.github.cameltooling.lsp.ui.tests; 18 | 19 | import org.eclipse.reddeer.common.logging.Logger; 20 | import org.eclipse.reddeer.eclipse.ui.views.log.LogView; 21 | import org.eclipse.reddeer.requirements.cleanerrorlog.CleanErrorLogRequirement; 22 | import org.eclipse.reddeer.requirements.cleanerrorlog.CleanErrorLogRequirement.CleanErrorLog; 23 | import org.eclipse.reddeer.requirements.cleanworkspace.CleanWorkspaceRequirement; 24 | import org.eclipse.reddeer.requirements.cleanworkspace.CleanWorkspaceRequirement.CleanWorkspace; 25 | import org.eclipse.reddeer.workbench.handler.WorkbenchShellHandler; 26 | import org.eclipse.reddeer.workbench.impl.shell.WorkbenchShell; 27 | import com.github.cameltooling.lsp.reddeer.preference.ConsolePreferenceUtil; 28 | import org.junit.After; 29 | import org.junit.AfterClass; 30 | import org.junit.Before; 31 | import org.junit.BeforeClass; 32 | 33 | /** 34 | * Prepares environment for UI testing 35 | * 36 | * @author djelinek 37 | */ 38 | @CleanWorkspace 39 | @CleanErrorLog 40 | public abstract class DefaultTest { 41 | 42 | private static Logger log = Logger.getLogger(DefaultTest.class); 43 | 44 | /** 45 | * Prepares test environment 46 | */ 47 | @BeforeClass 48 | public static void defaultBeforeClassSetup() { 49 | log.info("Maximizing workbench shell."); 50 | new WorkbenchShell().maximize(); 51 | 52 | log.info("Disable showing Console view after standard output changes"); 53 | ConsolePreferenceUtil.setConsoleOpenOnError(false); 54 | ConsolePreferenceUtil.setConsoleOpenOnOutput(false); 55 | 56 | log.info("Disable showing Error Log view after changes"); 57 | LogView logView = new LogView(); 58 | logView.open(); 59 | logView.setActivateOnNewEvents(false); 60 | } 61 | 62 | /** 63 | * Prepares test environment 64 | */ 65 | @Before 66 | public void defaultBeforeTestSetup() { 67 | log.info("Deleting Error Log."); 68 | new CleanErrorLogRequirement().fulfill(); 69 | } 70 | 71 | /** 72 | * Cleans up test environment 73 | */ 74 | @After 75 | public void defaultAfterTestClean() { 76 | log.info("Closing all non-workbench shells."); 77 | WorkbenchShellHandler.getInstance().closeAllNonWorbenchShells(); 78 | } 79 | 80 | /** 81 | * Cleans up test environment 82 | */ 83 | @AfterClass 84 | public static void defaultAfterClassClean() { 85 | log.info("Closing all non-workbench shells."); 86 | WorkbenchShellHandler.getInstance().closeAllNonWorbenchShells(); 87 | log.info("Deleting all projects"); 88 | new CleanWorkspaceRequirement().fulfill(); 89 | log.info("Clean Error Log"); 90 | new CleanErrorLogRequirement().fulfill(); 91 | } 92 | 93 | } -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/tests/com.github.cameltooling.lsp.ui.tests/src/com/github/cameltooling/lsp/ui/tests/GenericEditorLSPCompletionTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.github.cameltooling.lsp.ui.tests; 18 | 19 | import org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer; 20 | import org.eclipse.reddeer.junit.runner.RedDeerSuite; 21 | import org.eclipse.reddeer.workbench.impl.editor.DefaultEditor; 22 | import org.eclipse.reddeer.workbench.ui.dialogs.WorkbenchPreferenceDialog; 23 | 24 | import com.github.cameltooling.lsp.ui.tests.utils.EditorManipulator; 25 | import com.github.cameltooling.lsp.reddeer.preference.DefaultEditorPreferencePage; 26 | import com.github.cameltooling.lsp.reddeer.utils.JavaProjectFactory; 27 | import com.github.cameltooling.lsp.reddeer.utils.CreateNewEmptyFile; 28 | 29 | import org.junit.BeforeClass; 30 | import org.junit.runner.RunWith; 31 | 32 | /** 33 | * Tests Apache Camel Tooling LSP client in Generic Text Editor
34 | * 35 | * @author djelinek 36 | */ 37 | @RunWith(RedDeerSuite.class) 38 | public class GenericEditorLSPCompletionTest extends DefaultLSPCompletionTest { 39 | 40 | @BeforeClass 41 | public static void prepareEnvironment() { 42 | WorkbenchPreferenceDialog prefs = new WorkbenchPreferenceDialog(); 43 | DefaultEditorPreferencePage defaultEditor = new DefaultEditorPreferencePage(prefs); 44 | prefs.open(); 45 | prefs.select(defaultEditor); 46 | defaultEditor.set(".xml", "Generic Text Editor"); 47 | prefs.ok(); 48 | 49 | JavaProjectFactory.create(PROJECT_NAME); 50 | new ProjectExplorer().selectProjects(PROJECT_NAME); 51 | CreateNewEmptyFile.XMLFile(CAMEL_CONTEXT); 52 | new DefaultEditor(CAMEL_CONTEXT).activate(); 53 | EditorManipulator.copyFileContentToXMLEditor(RESOURCES_CONTEXT_PATH); 54 | } 55 | 56 | // ... execute UI tests from DefaultLSPCompletionTest class 57 | 58 | } 59 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/tests/com.github.cameltooling.lsp.ui.tests/src/com/github/cameltooling/lsp/ui/tests/PluginInstalledTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.github.cameltooling.lsp.ui.tests; 18 | 19 | import static org.junit.Assert.*; 20 | 21 | import com.github.cameltooling.lsp.reddeer.utils.AboutEclipsePage; 22 | import static org.hamcrest.MatcherAssert.assertThat; 23 | import static org.hamcrest.CoreMatchers.containsString; 24 | 25 | import org.eclipse.reddeer.junit.runner.RedDeerSuite; 26 | 27 | import org.eclipse.reddeer.swt.api.TableItem; 28 | import org.junit.Test; 29 | import org.junit.runner.RunWith; 30 | 31 | /** 32 | * 33 | * @author fpospisi 34 | */ 35 | @RunWith(RedDeerSuite.class) 36 | public class PluginInstalledTest extends DefaultTest { 37 | 38 | public static final String provider = "JBoss by Red Hat"; 39 | public static final String name = "Apache Camel LSP Client Extensions Plugin"; 40 | public static final String version = "1.0.0"; 41 | public static final String id = "com.github.camel-tooling.eclipse.client"; 42 | 43 | /** 44 | * Checks if LSP plugin has correct author, name, version and id. 45 | */ 46 | @Test 47 | public void testPluginInstalled() { 48 | 49 | // Open plug-ins page and get plugin. 50 | AboutEclipsePage.openPlugins(); 51 | TableItem plugin = AboutEclipsePage.getPluginByID(id); 52 | 53 | // Checks id, if null = no plug-in with this id found. 54 | assertTrue(plugin != null); 55 | // Check provider. 56 | assertEquals(AboutEclipsePage.getPluginProvider(plugin), provider); 57 | // Check name. 58 | assertEquals(AboutEclipsePage.getPluginName(plugin), name); 59 | // Check version. 60 | assertThat(AboutEclipsePage.getPluginVersion(plugin), containsString(version)); 61 | 62 | // Close plug-ins page. 63 | AboutEclipsePage.closePlugins(); 64 | } 65 | } -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/tests/com.github.cameltooling.lsp.ui.tests/src/com/github/cameltooling/lsp/ui/tests/suite/SmokeTests.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.github.cameltooling.lsp.ui.tests.suite; 18 | 19 | import org.eclipse.reddeer.junit.runner.RedDeerSuite; 20 | import org.junit.runner.RunWith; 21 | import org.junit.runners.Suite.SuiteClasses; 22 | 23 | import com.github.cameltooling.lsp.ui.tests.AdditionalComponentFeatureTest; 24 | import com.github.cameltooling.lsp.ui.tests.CamelCatalogVersionFeatureTest; 25 | import com.github.cameltooling.lsp.ui.tests.CamelLSPCompletionTest; 26 | import com.github.cameltooling.lsp.ui.tests.CamelRuntimeProviderFeatureTest; 27 | import com.github.cameltooling.lsp.ui.tests.GenericEditorLSPCompletionTest; 28 | import com.github.cameltooling.lsp.ui.tests.JavaEditorCompletionTest; 29 | import com.github.cameltooling.lsp.ui.tests.PluginInstalledTest; 30 | 31 | import junit.framework.TestSuite; 32 | 33 | /** 34 | * Runs smoke tests on Camel LSP Client 35 | * 36 | * @author djelinek 37 | */ 38 | @SuiteClasses({ 39 | AdditionalComponentFeatureTest.class, 40 | CamelCatalogVersionFeatureTest.class, 41 | CamelLSPCompletionTest.class, 42 | CamelRuntimeProviderFeatureTest.class, 43 | GenericEditorLSPCompletionTest.class, 44 | JavaEditorCompletionTest.class, 45 | PluginInstalledTest.class 46 | }) 47 | 48 | @RunWith(RedDeerSuite.class) 49 | public class SmokeTests extends TestSuite { 50 | 51 | } 52 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/tests/com.github.cameltooling.lsp.ui.tests/src/com/github/cameltooling/lsp/ui/tests/utils/EditorManipulator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.github.cameltooling.lsp.ui.tests.utils; 18 | 19 | import java.io.File; 20 | import java.io.FileNotFoundException; 21 | import java.io.IOException; 22 | import java.io.StringReader; 23 | import java.util.Scanner; 24 | 25 | import javax.xml.parsers.ParserConfigurationException; 26 | 27 | import org.eclipse.reddeer.common.logging.Logger; 28 | import org.eclipse.reddeer.common.matcher.RegexMatcher; 29 | import org.eclipse.reddeer.common.wait.TimePeriod; 30 | import org.eclipse.reddeer.common.wait.WaitUntil; 31 | import org.eclipse.reddeer.core.matcher.WithTooltipTextMatcher; 32 | import org.eclipse.reddeer.swt.condition.ShellIsAvailable; 33 | import org.eclipse.reddeer.swt.impl.button.PushButton; 34 | import org.eclipse.reddeer.swt.impl.shell.DefaultShell; 35 | import org.eclipse.reddeer.swt.impl.styledtext.DefaultStyledText; 36 | import org.eclipse.reddeer.swt.impl.toolbar.DefaultToolItem; 37 | import org.eclipse.reddeer.workbench.impl.editor.TextEditor; 38 | import org.eclipse.reddeer.workbench.impl.shell.WorkbenchShell; 39 | import org.xml.sax.SAXException; 40 | 41 | import com.github.cameltooling.lsp.reddeer.ResourceHelper; 42 | import com.github.cameltooling.lsp.reddeer.XPathEvaluator; 43 | import com.github.cameltooling.lsp.ui.tests.Activator; 44 | 45 | /** 46 | * Support static methods manipulates with Text Editor 47 | * 48 | * @author tsedmik 49 | */ 50 | public class EditorManipulator { 51 | 52 | private static Logger log = Logger.getLogger(EditorManipulator.class); 53 | 54 | private EditorManipulator() { 55 | //private constructor, only static access 56 | } 57 | 58 | /** 59 | * Replaces content of a file opened in active text editor with content of the 60 | * file source 61 | * 62 | * @param source Path to the source file 63 | */ 64 | public static void copyFileContent(String source) { 65 | TextEditor editor = new TextEditor(); 66 | editor.setText(getFileContent(source)); 67 | editor.save(); 68 | } 69 | 70 | /** 71 | * Replaces content of a file opened in active XML editor with content of the 72 | * file source 73 | * 74 | * @param source Path to the source file 75 | */ 76 | public static void copyFileContentToXMLEditor(String source) { 77 | new DefaultStyledText().setText(EditorManipulator.getFileContent(source)); 78 | new DefaultToolItem(new WorkbenchShell(), 0, new WithTooltipTextMatcher(new RegexMatcher("Save.*"))).click(); 79 | try { 80 | log.debug("Check whether 'Could not parse your changes to the XML' dialog is appeared"); 81 | new WaitUntil(new ShellIsAvailable("Could not parse your changes to the XML"), TimePeriod.SHORT); 82 | new DefaultShell("Could not parse your changes to the XML"); 83 | new PushButton("OK").click(); 84 | } catch (Exception e) { 85 | log.debug("Dialog 'Could not parse your changes to the XML' didn't appeared"); 86 | } 87 | } 88 | 89 | /** 90 | * Gets content of a given file 91 | * 92 | * @param source the source file 93 | * @return content of the file, in case of some error - empty string 94 | */ 95 | public static String getFileContent(String source) { 96 | File testFile = new File(ResourceHelper.getResourceAbsolutePath(Activator.PLUGIN_ID, source)); 97 | String text = ""; 98 | try (Scanner scanner = new Scanner(testFile)) { 99 | scanner.useDelimiter("\\Z"); 100 | text = scanner.next(); 101 | } catch (FileNotFoundException e) { 102 | log.error("Resource missing: can't find a failing test case to copy (" + source + ")!"); 103 | } 104 | log.info("Text in active text editor was replaced with content of the file: " + source + "."); 105 | return text; 106 | } 107 | 108 | /** 109 | * Compares content of the active XML editor with content of the given file 110 | * 111 | * @param file path to the file 112 | * @return true - content of the file and the text editor is the same, false - 113 | * otherwise 114 | * @throws ParserConfigurationException 115 | * @throws IOException 116 | * @throws SAXException 117 | */ 118 | public static boolean isEditorContentEqualsFile(String file) throws SAXException, IOException, ParserConfigurationException { 119 | String editorText = new DefaultStyledText().getText(); 120 | if (file.equals("resources/camel-context-all.xml")) { 121 | XPathEvaluator xpath = new XPathEvaluator(new StringReader(editorText)); 122 | return ((xpath.evaluateBoolean("/beans/camelContext/route/*[1]/@uri = 'file:src/data?noop=true'")) 123 | && (xpath.evaluateString("/beans/camelContext/route/choice/*[1]/*[1][text()]") 124 | .equals("/person/city = 'London'")) 125 | && (xpath.evaluateBoolean("/beans/camelContext/route/choice/*[1]/*[2]/@message = 'UK message'")) 126 | && (xpath.evaluateBoolean( 127 | "/beans/camelContext/route/choice/*[1]/*[3]/@uri = 'file:target/messages/uk'")) 128 | && (xpath.evaluateBoolean("/beans/camelContext/route/choice/*[2]/*[1]/@message = 'Other message'")) 129 | && (xpath.evaluateBoolean( 130 | "/beans/camelContext/route/choice/*[2]/*[2]/@uri = 'file:target/messages/others'"))); 131 | } else { 132 | String fileText = getFileContent(file); 133 | return editorText.equals(fileText); 134 | } 135 | } 136 | } 137 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/tests/com.github.cameltooling.lsp.ui.tests/src/com/github/cameltooling/lsp/ui/tests/utils/TimeoutPeriodManipulator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.github.cameltooling.lsp.ui.tests.utils; 18 | 19 | import org.eclipse.reddeer.common.properties.RedDeerProperties; 20 | import org.eclipse.reddeer.common.wait.TimePeriod; 21 | 22 | /** 23 | * @author fpospisi 24 | */ 25 | public class TimeoutPeriodManipulator { 26 | 27 | private static final String TIMEOUT_PERIOD_FACTOR_PROPERTY_NAME = RedDeerProperties.TIME_PERIOD_FACTOR.getName(); 28 | 29 | /** 30 | * Changes Timeout Period to required value. 31 | * 32 | * @param value 33 | */ 34 | public static void setFactor(int value) { 35 | System.setProperty(TIMEOUT_PERIOD_FACTOR_PROPERTY_NAME, String.valueOf(value)); 36 | TimePeriod.updateFactor(); 37 | } 38 | 39 | /** 40 | * Changes Timeout Period back to default. 41 | */ 42 | public static void clearFactor() { 43 | System.clearProperty(TIMEOUT_PERIOD_FACTOR_PROPERTY_NAME); 44 | TimePeriod.updateFactor(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/tests/com.github.cameltooling.lsp.ui.tests/src/log4j.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client.tests.ui/tests/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.github.camel-tooling.lsp 8 | com.github.camel-tooling.lsp.eclipse.client.tests.ui 9 | 1.0.0-SNAPSHOT 10 | 11 | com.github.camel-tooling.lsp 12 | tests 13 | ${base.name} :: UI Tests :: Tests 14 | 1.0.0-SNAPSHOT 15 | pom 16 | 17 | com.github.cameltooling.lsp.ui.tests 18 | 19 | 20 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | Camel LSP Eclipse Client 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.pde.ManifestBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.pde.SchemaBuilder 20 | 21 | 22 | 23 | 24 | org.sonarlint.eclipse.core.sonarlintBuilder 25 | 26 | 27 | 28 | 29 | org.eclipse.m2e.core.maven2Builder 30 | 31 | 32 | 33 | 34 | 35 | org.eclipse.m2e.core.maven2Nature 36 | org.eclipse.pde.PluginNature 37 | org.eclipse.jdt.core.javanature 38 | 39 | 40 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 3 | org.eclipse.jdt.core.compiler.compliance=17 4 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 5 | org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning 8 | org.eclipse.jdt.core.compiler.release=enabled 9 | org.eclipse.jdt.core.compiler.source=17 10 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Bundle-ManifestVersion: 2 3 | Bundle-Name: %Bundle-Name 4 | Bundle-SymbolicName: com.github.camel-tooling.eclipse.client;singleton:=true 5 | Bundle-Version: 1.0.0.qualifier 6 | Bundle-Vendor: %Bundle-Vendor 7 | Bundle-RequiredExecutionEnvironment: JavaSE-17 8 | Bundle-ActivationPolicy: lazy 9 | Require-Bundle: org.eclipse.lsp4e;bundle-version="0.6.0", 10 | org.eclipse.core.runtime;bundle-version="3.13.0", 11 | org.eclipse.jface.text;bundle-version="3.12.0", 12 | org.eclipse.wst.sse.ui;bundle-version="1.3.600", 13 | org.eclipse.jdt.ui;bundle-version="3.18.0", 14 | org.eclipse.ui;bundle-version="3.113.0", 15 | com.google.gson;bundle-version="2.7.0", 16 | org.eclipse.lsp4e.jdt;bundle-version="0.10.1" 17 | Export-Package: com.github.cameltooling.eclipse.client;x-friends:="com.github.camel-tooling.eclipse.client.tests.integration", 18 | com.github.cameltooling.eclipse.preferences, 19 | com.github.cameltooling.eclipse.preferences.runtimeprovider 20 | Eclipse-BundleShape: dir 21 | Bundle-Activator: com.github.cameltooling.eclipse.client.ActivatorCamelLspClient 22 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client/OSGI-INF/l10n/bundle.properties: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Copyright (c) 2013 Red Hat, Inc. and others. 3 | # All rights reserved. This program and the accompanying materials 4 | # are made available under the terms of the Eclipse Public License v1.0 5 | # which accompanies this distribution, and is available at 6 | # http://www.eclipse.org/legal/epl-v10.html 7 | # 8 | # Contributors: 9 | # JBoss by Red Hat - Initial implementation. 10 | ############################################################################## 11 | Bundle-Vendor = JBoss by Red Hat 12 | Bundle-Name = Apache Camel LSP Client Extensions Plugin 13 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client/build.properties: -------------------------------------------------------------------------------- 1 | source.. = src/ 2 | output.. = bin/ 3 | bin.includes = META-INF/,\ 4 | .,\ 5 | plugin.xml,\ 6 | OSGI-INF/,\ 7 | OSGI-INF/l10n/bundle.properties,\ 8 | libs/ 9 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 10 | 11 | 15 | 16 | 20 | 21 | 25 | 26 | 30 | 31 | 35 | 36 | 40 | 41 | 45 | 46 | 50 | 51 | 55 | 56 | 60 | 61 | 65 | 66 | 67 | 71 | 72 | 76 | 77 | 78 | 80 | 83 | 84 | 85 | 90 | 91 | 92 | 93 | 95 | 101 | 102 | 108 | 109 | 115 | 116 | 122 | 123 | 124 | 126 | 130 | 131 | 132 | 133 | 134 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | 8 | com.github.camel-tooling.lsp 9 | eclipse 10 | 1.0.0-SNAPSHOT 11 | 12 | com.github.camel-tooling.eclipse.client 13 | ${base.name} :: Implementation 14 | eclipse-plugin 15 | 16 | 17 | 1.29.0 18 | 0.26.0 19 | 20 | 21 | 22 | 23 | sonatype-snapshots 24 | Sonatype Snapshots 25 | https://oss.sonatype.org/content/repositories/snapshots 26 | false 27 | true 28 | 29 | 30 | 31 | 32 | 33 | 34 | org.apache.maven.plugins 35 | maven-dependency-plugin 36 | 37 | 38 | get-deps 39 | 40 | copy 41 | 42 | generate-resources 43 | 44 | 45 | 46 | 47 | 48 | com.github.camel-tooling 49 | camel-lsp-server 50 | ${camel-lsp-server-version} 51 | 52 | 53 | true 54 | false 55 | ${basedir}/libs/ 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client/src/com/github/cameltooling/eclipse/client/ActivatorCamelLspClient.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.github.cameltooling.eclipse.client; 18 | 19 | import org.eclipse.core.runtime.Plugin; 20 | 21 | public class ActivatorCamelLspClient extends Plugin { 22 | 23 | public static final String ID = "com.github.camel-tooling.eclipse.client"; 24 | private static ActivatorCamelLspClient instance; 25 | 26 | public ActivatorCamelLspClient() { 27 | setInstance(this); 28 | } 29 | 30 | private static void setInstance(ActivatorCamelLspClient activatorCamelLspClient) { 31 | ActivatorCamelLspClient.instance = activatorCamelLspClient; 32 | } 33 | 34 | public static ActivatorCamelLspClient getInstance() { 35 | return instance; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client/src/com/github/cameltooling/eclipse/client/CamelLSPStreamConnectionProvider.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.github.cameltooling.eclipse.client; 18 | 19 | import java.io.File; 20 | import java.io.IOException; 21 | import java.net.URI; 22 | import java.net.URISyntaxException; 23 | import java.net.URL; 24 | import java.util.ArrayList; 25 | import java.util.Arrays; 26 | import java.util.List; 27 | 28 | import org.eclipse.core.runtime.FileLocator; 29 | import org.eclipse.core.runtime.IStatus; 30 | import org.eclipse.core.runtime.Platform; 31 | import org.eclipse.core.runtime.Status; 32 | import org.eclipse.core.runtime.URIUtil; 33 | import org.eclipse.lsp4e.server.ProcessStreamConnectionProvider; 34 | import org.osgi.framework.Bundle; 35 | 36 | import com.github.cameltooling.eclipse.preferences.CamelLanguageServerPreferenceManager; 37 | 38 | public class CamelLSPStreamConnectionProvider extends ProcessStreamConnectionProvider { 39 | 40 | private static final String DEBUG_FLAG = "debugLSPServer"; 41 | 42 | public CamelLSPStreamConnectionProvider() { 43 | super(computeCommands(), computeWorkingDir()); 44 | } 45 | 46 | private static String computeWorkingDir() { 47 | return System.getProperty("user.dir"); 48 | } 49 | 50 | private static List computeCommands() { 51 | List commands = new ArrayList<>(); 52 | commands.add("java"); 53 | if (isDebugEnabled()) 54 | commands.addAll(debugArguments()); 55 | commands.add("-jar"); 56 | commands.add(computeCamelLanguageServerJarPath()); 57 | return commands; 58 | } 59 | 60 | private static String computeCamelLanguageServerJarPath() { 61 | String camelLanguageServerJarPath = ""; 62 | Bundle bundle = Platform.getBundle(ActivatorCamelLspClient.ID); 63 | URL fileURL = bundle.findEntries("/libs", "camel-lsp-server-*.jar", false).nextElement(); 64 | try { 65 | URL resolvedUrl = FileLocator.resolve(fileURL); 66 | File file = new File(URIUtil.toURI(resolvedUrl)); 67 | if (Platform.OS_WIN32.equals(Platform.getOS())) { 68 | camelLanguageServerJarPath = "\"" + file.getAbsolutePath() + "\""; 69 | } else { 70 | camelLanguageServerJarPath = file.getAbsolutePath(); 71 | } 72 | } catch (URISyntaxException | IOException exception) { 73 | ActivatorCamelLspClient.getInstance().getLog().log(new Status(IStatus.ERROR, ActivatorCamelLspClient.ID, 74 | "Cannot get the Camel LSP Server jar.", exception)); //$NON-NLS-1$ 75 | } 76 | return camelLanguageServerJarPath; 77 | } 78 | 79 | private static boolean isDebugEnabled() { 80 | return Boolean.parseBoolean(System.getProperty(DEBUG_FLAG, "false")); 81 | } 82 | 83 | private static List debugArguments() { 84 | return Arrays.asList("-Xdebug", "-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=3000"); 85 | } 86 | 87 | @Override 88 | public Object getInitializationOptions(URI rootUri) { 89 | return new CamelLanguageServerPreferenceManager().getPreferenceAsLanguageServerFormat(); 90 | } 91 | 92 | } 93 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client/src/com/github/cameltooling/eclipse/internal/l10n/Messages.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.github.cameltooling.eclipse.internal.l10n; 18 | 19 | import org.eclipse.osgi.util.NLS; 20 | 21 | public class Messages extends NLS { 22 | 23 | private static final String BASE_NAME = "com.github.cameltooling.eclipse.internal.l10n.messages"; 24 | public static String camelPreferencePageDescription; 25 | public static String camelCatalogVersionSettings; 26 | public static String camelAdditionalComponentSettings; 27 | public static String camelCatalogRuntimeProviderSettings; 28 | public static String kafkaConnectionUrlSettings; 29 | static { 30 | NLS.initializeMessages(BASE_NAME, Messages.class); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client/src/com/github/cameltooling/eclipse/internal/l10n/messages.properties: -------------------------------------------------------------------------------- 1 | camelCatalogVersionSettings=Catalog version 2 | camelPreferencePageDescription=To take effect, it requires to close and then reopen editors 3 | camelAdditionalComponentSettings=Extra components 4 | camelCatalogRuntimeProviderSettings=Runtime provider 5 | kafkaConnectionUrlSettings=Kafka connection URL -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client/src/com/github/cameltooling/eclipse/preferences/CamelLanguageServerPreferenceManager.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.github.cameltooling.eclipse.preferences; 18 | 19 | import java.util.Collections; 20 | import java.util.HashMap; 21 | import java.util.List; 22 | import java.util.Map; 23 | 24 | import org.eclipse.core.runtime.IStatus; 25 | import org.eclipse.core.runtime.Status; 26 | import org.eclipse.core.runtime.preferences.IEclipsePreferences; 27 | import org.eclipse.core.runtime.preferences.InstanceScope; 28 | import org.osgi.service.prefs.BackingStoreException; 29 | 30 | import com.github.cameltooling.eclipse.client.ActivatorCamelLspClient; 31 | import com.google.gson.Gson; 32 | 33 | public class CamelLanguageServerPreferenceManager { 34 | 35 | private static final String TOP_NODE_CAMEL_KEY = "camel"; 36 | static final String CAMEL_CATALOG_VERSION_PREF_KEY = "Camel catalog version"; 37 | static final String CAMEL_ADDITIONAL_COMPONENT_PREF_KEY = "extra-components"; 38 | static final String CAMEL_CATALOG_RUNTIME_PROVIDER_PREF_KEY = "Camel catalog runtime provider"; 39 | public static final String KAFKA_CONNECTION_URL = "Kafka Connection URL"; 40 | 41 | public Map> getPreferenceAsLanguageServerFormat() { 42 | IEclipsePreferences preferences = getCamelPreferenceNode(); 43 | Map> settings = new HashMap<>(); 44 | Map camelSettings = new HashMap<>(); 45 | camelSettings.put(CAMEL_CATALOG_VERSION_PREF_KEY, preferences.get(CAMEL_CATALOG_VERSION_PREF_KEY, null)); 46 | camelSettings.put(CAMEL_CATALOG_RUNTIME_PROVIDER_PREF_KEY, preferences.get(CAMEL_CATALOG_RUNTIME_PROVIDER_PREF_KEY, null)); 47 | camelSettings.put(CAMEL_ADDITIONAL_COMPONENT_PREF_KEY, getAdditionalComponentIfValid(preferences)); 48 | camelSettings.put(KAFKA_CONNECTION_URL, preferences.get(KAFKA_CONNECTION_URL, "localhost:9092")); 49 | settings.put(TOP_NODE_CAMEL_KEY, camelSettings ); 50 | return settings; 51 | } 52 | 53 | private List getAdditionalComponentIfValid(IEclipsePreferences preferences) { 54 | String additionalComponentAsString = preferences.get(CAMEL_ADDITIONAL_COMPONENT_PREF_KEY, null); 55 | if(additionalComponentAsString != null && !additionalComponentAsString.isEmpty()) { 56 | try { 57 | return new Gson().fromJson(additionalComponentAsString, List.class); 58 | } catch (Exception ex) { 59 | ActivatorCamelLspClient.getInstance().getLog().log(new Status(IStatus.ERROR, ActivatorCamelLspClient.ID, "Invalid JSON provided for extra Camel components.", ex)); 60 | return Collections.emptyList(); 61 | } 62 | } 63 | return Collections.emptyList(); 64 | } 65 | 66 | public void setCamelCatalogVersion(String camelVersion) throws BackingStoreException { 67 | setPreferenceValue(camelVersion, CAMEL_CATALOG_VERSION_PREF_KEY); 68 | } 69 | 70 | private void setPreferenceValue(String camelVersion, String key) throws BackingStoreException { 71 | IEclipsePreferences preferences = getCamelPreferenceNode(); 72 | if (camelVersion == null || camelVersion.isEmpty()) { 73 | preferences.remove(key); 74 | } else { 75 | preferences.put(key, camelVersion); 76 | } 77 | preferences.flush(); 78 | } 79 | 80 | public void setCamelAdditionalComponents(String additionalComponents) throws BackingStoreException { 81 | setPreferenceValue(additionalComponents, CAMEL_ADDITIONAL_COMPONENT_PREF_KEY); 82 | } 83 | 84 | private IEclipsePreferences getCamelPreferenceNode() { 85 | return InstanceScope.INSTANCE.getNode(ActivatorCamelLspClient.ID); 86 | } 87 | 88 | public void setRuntimeProvider(String runtimeProvider) throws BackingStoreException { 89 | setPreferenceValue(runtimeProvider, CAMEL_CATALOG_RUNTIME_PROVIDER_PREF_KEY); 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client/src/com/github/cameltooling/eclipse/preferences/CamelLanguageServerPreferencePage.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.github.cameltooling.eclipse.preferences; 18 | 19 | import org.eclipse.core.runtime.preferences.InstanceScope; 20 | import org.eclipse.jface.layout.GridDataFactory; 21 | import org.eclipse.jface.preference.ComboFieldEditor; 22 | import org.eclipse.jface.preference.FieldEditorPreferencePage; 23 | import org.eclipse.jface.preference.StringFieldEditor; 24 | import org.eclipse.swt.widgets.Composite; 25 | import org.eclipse.ui.IWorkbench; 26 | import org.eclipse.ui.IWorkbenchPreferencePage; 27 | import org.eclipse.ui.preferences.ScopedPreferenceStore; 28 | 29 | import com.github.cameltooling.eclipse.client.ActivatorCamelLspClient; 30 | import com.github.cameltooling.eclipse.internal.l10n.Messages; 31 | import com.github.cameltooling.eclipse.preferences.runtimeprovider.CamelRuntimeProvider; 32 | 33 | public class CamelLanguageServerPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage { 34 | 35 | @Override 36 | public void init(IWorkbench workbench) { 37 | setPreferenceStore(new ScopedPreferenceStore(InstanceScope.INSTANCE, ActivatorCamelLspClient.ID)); 38 | setDescription(Messages.camelPreferencePageDescription); 39 | } 40 | 41 | @Override 42 | protected void createFieldEditors() { 43 | Composite fieldEditorParent = getFieldEditorParent(); 44 | fieldEditorParent.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); 45 | addField(new StringFieldEditor(CamelLanguageServerPreferenceManager.CAMEL_CATALOG_VERSION_PREF_KEY, Messages.camelCatalogVersionSettings, fieldEditorParent)); 46 | addField(new ComboFieldEditor(CamelLanguageServerPreferenceManager.CAMEL_CATALOG_RUNTIME_PROVIDER_PREF_KEY, Messages.camelCatalogRuntimeProviderSettings, 47 | CamelRuntimeProvider.getComboFieldEditorInputs(), 48 | fieldEditorParent)); 49 | addField(new MultilineStringFieldEditor(CamelLanguageServerPreferenceManager.CAMEL_ADDITIONAL_COMPONENT_PREF_KEY, Messages.camelAdditionalComponentSettings, fieldEditorParent)); 50 | addField(new StringFieldEditor(CamelLanguageServerPreferenceManager.KAFKA_CONNECTION_URL, Messages.kafkaConnectionUrlSettings, fieldEditorParent)); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client/src/com/github/cameltooling/eclipse/preferences/MultilineStringFieldEditor.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.github.cameltooling.eclipse.preferences; 18 | 19 | import org.eclipse.core.runtime.Assert; 20 | import org.eclipse.jface.preference.StringFieldEditor; 21 | import org.eclipse.swt.SWT; 22 | import org.eclipse.swt.events.FocusAdapter; 23 | import org.eclipse.swt.events.FocusEvent; 24 | import org.eclipse.swt.events.KeyAdapter; 25 | import org.eclipse.swt.events.KeyEvent; 26 | import org.eclipse.swt.layout.GridData; 27 | import org.eclipse.swt.widgets.Composite; 28 | import org.eclipse.swt.widgets.Label; 29 | import org.eclipse.swt.widgets.Text; 30 | 31 | public class MultilineStringFieldEditor extends StringFieldEditor { 32 | 33 | private int validateStrategyMultiline; 34 | private int textLimitMultiline; 35 | private Text textControlMultiline; 36 | 37 | public MultilineStringFieldEditor(String camelAdditionalComponentPrefKey, String camelAdditionalComponentSettings, Composite fieldEditorParent) { 38 | super(camelAdditionalComponentPrefKey, camelAdditionalComponentSettings, fieldEditorParent); 39 | } 40 | 41 | @Override 42 | public void setValidateStrategy(int value) { 43 | super.setValidateStrategy(value); 44 | validateStrategyMultiline = value; 45 | } 46 | 47 | @Override 48 | public void setTextLimit(int limit) { 49 | super.setTextLimit(limit); 50 | textLimitMultiline = limit; 51 | } 52 | 53 | @Override 54 | public Text getTextControl(Composite parent) { 55 | textControlMultiline = super.getTextControl(); 56 | if (textControlMultiline == null) { 57 | textControlMultiline = new Text(parent, SWT.MULTI | SWT.BORDER | SWT.WRAP | SWT.LEFT | SWT.V_SCROLL); 58 | textControlMultiline.setFont(parent.getFont()); 59 | switch (validateStrategyMultiline) { 60 | case VALIDATE_ON_KEY_STROKE: 61 | textControlMultiline.addKeyListener(new KeyAdapter() { 62 | 63 | @Override 64 | public void keyReleased(KeyEvent e) { 65 | valueChanged(); 66 | } 67 | }); 68 | textControlMultiline.addFocusListener(new FocusAdapter() { 69 | // Ensure that the value is checked on focus loss in case we 70 | // missed a keyRelease or user hasn't released key. 71 | // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=214716 72 | @Override 73 | public void focusLost(FocusEvent e) { 74 | valueChanged(); 75 | } 76 | }); 77 | 78 | 79 | break; 80 | case VALIDATE_ON_FOCUS_LOST: 81 | textControlMultiline.addKeyListener(new KeyAdapter() { 82 | @Override 83 | public void keyPressed(KeyEvent e) { 84 | clearErrorMessage(); 85 | } 86 | }); 87 | textControlMultiline.addFocusListener(new FocusAdapter() { 88 | @Override 89 | public void focusGained(FocusEvent e) { 90 | refreshValidState(); 91 | } 92 | 93 | @Override 94 | public void focusLost(FocusEvent e) { 95 | valueChanged(); 96 | } 97 | }); 98 | break; 99 | default: 100 | Assert.isTrue(false, "Unknown validate strategy");//$NON-NLS-1$ 101 | } 102 | textControlMultiline.addDisposeListener(event -> textControlMultiline = null); 103 | if (textLimitMultiline > 0) {//Only set limits above 0 - see SWT spec 104 | textControlMultiline.setTextLimit(textLimitMultiline); 105 | } 106 | } else { 107 | checkParent(textControlMultiline, parent); 108 | } 109 | return textControlMultiline; 110 | } 111 | 112 | @Override 113 | protected void doFillIntoGrid(Composite parent, int numColumns) { 114 | super.doFillIntoGrid(parent, numColumns); 115 | 116 | textControlMultiline = super.getTextControl(); 117 | GridData gd = (GridData) textControlMultiline.getLayoutData(); 118 | gd.verticalAlignment = GridData.FILL; 119 | gd.grabExcessVerticalSpace = true; 120 | textControlMultiline.setLayoutData(gd); 121 | 122 | Label label = getLabelControl(parent); 123 | gd = new GridData(); 124 | gd.verticalAlignment = SWT.TOP; 125 | label.setLayoutData(gd); 126 | } 127 | 128 | } 129 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client/src/com/github/cameltooling/eclipse/preferences/runtimeprovider/CamelRuntimeProvider.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.github.cameltooling.eclipse.preferences.runtimeprovider; 18 | 19 | public enum CamelRuntimeProvider { 20 | DEFAULT, 21 | KARAF, 22 | SPRINGBOOT, 23 | QUARKUS; 24 | 25 | @Override 26 | public String toString() { 27 | switch (this) { 28 | case DEFAULT: 29 | return "Default"; 30 | case KARAF: 31 | return "Karaf"; 32 | case SPRINGBOOT: 33 | return "Spring Boot"; 34 | case QUARKUS: 35 | return "Quarkus"; 36 | } 37 | return super.toString(); 38 | } 39 | 40 | public static String[][] getComboFieldEditorInputs(){ 41 | return new String[][] { 42 | new String[] {DEFAULT.toString(), DEFAULT.name()}, 43 | new String[] {SPRINGBOOT.toString(), SPRINGBOOT.name()}, 44 | new String[] {QUARKUS.toString(), QUARKUS.name()}, 45 | new String[] {KARAF.toString(), KARAF.name()}, 46 | }; 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.client/src/com/github/cameltooling/eclipse/xml/completion/CamelURICompletionProposalComputer.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.github.cameltooling.eclipse.xml.completion; 18 | 19 | import java.util.Arrays; 20 | import java.util.List; 21 | 22 | import org.eclipse.core.runtime.IProgressMonitor; 23 | import org.eclipse.jface.text.contentassist.ICompletionProposal; 24 | import org.eclipse.jface.text.contentassist.IContextInformation; 25 | import org.eclipse.lsp4e.operations.completion.LSContentAssistProcessor; 26 | import org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext; 27 | import org.eclipse.wst.sse.ui.contentassist.ICompletionProposalComputer; 28 | 29 | public class CamelURICompletionProposalComputer implements ICompletionProposalComputer { 30 | 31 | @Override 32 | public List computeCompletionProposals(CompletionProposalInvocationContext context, IProgressMonitor monitor) { 33 | return Arrays.asList(new LSContentAssistProcessor().computeCompletionProposals(context.getViewer(), context.getInvocationOffset())); 34 | } 35 | 36 | @Override 37 | public List computeContextInformation(CompletionProposalInvocationContext context, IProgressMonitor monitor) { 38 | return Arrays.asList(new LSContentAssistProcessor().computeContextInformation(context.getViewer(), context.getInvocationOffset())); 39 | } 40 | 41 | @Override 42 | public String getErrorMessage() { 43 | return null; 44 | } 45 | 46 | @Override 47 | public void sessionEnded() { 48 | // nothing to do 49 | } 50 | 51 | @Override 52 | public void sessionStarted() { 53 | // nothing to do 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.updatesite/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | Camel LSP Eclipse Update Site 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.pde.UpdateSiteBuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.pde.UpdateSiteNature 16 | 17 | 18 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.updatesite/category.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Provides Camel URI completion for xml DSL in Eclipse XML Editor and Language Server Editor 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /com.github.camel-tooling.lsp.eclipse.updatesite/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | 8 | com.github.camel-tooling.lsp 9 | eclipse 10 | 1.0.0-SNAPSHOT 11 | 12 | com.github.camel-tooling.eclipse.updatesite 13 | ${base.name} :: Update Site 14 | eclipse-repository 15 | 16 | -------------------------------------------------------------------------------- /com.github.cameltooling.lsp.eclipse.client.feature/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | com.github.cameltooling.lsp.eclipse.client.feature 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.pde.FeatureBuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.pde.FeatureNature 16 | 17 | 18 | -------------------------------------------------------------------------------- /com.github.cameltooling.lsp.eclipse.client.feature/build.properties: -------------------------------------------------------------------------------- 1 | bin.includes = feature.xml 2 | -------------------------------------------------------------------------------- /com.github.cameltooling.lsp.eclipse.client.feature/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | 8 | com.github.camel-tooling.lsp 9 | eclipse 10 | 1.0.0-SNAPSHOT 11 | 12 | 13 | eclipse-feature 14 | com.github.cameltooling.lsp.eclipse.client.feature 15 | ${base.name} :: Feature 16 | 17 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 4.0.0 7 | 8 | com.github.camel-tooling.lsp 9 | eclipse 10 | 1.0.0-SNAPSHOT 11 | ${base.name} 12 | pom 13 | 14 | 15 | 4.0.13 16 | Eclipse Client for Apache Camel Language Server 17 | UTF-8 18 | 19 | 17 20 | 21 | camel-tooling 22 | https://sonarcloud.io 23 | jacoco 24 | reuseReports 25 | **/*Test.*,**/tests/**/*,**/*IT.*,**/**reddeer**/**/* 26 | 27 | ../target/jacoco.exec 28 | ../target/jacoco-it.exec 29 | ${sonar.jacoco.reportPath},${sonar.jacoco.itReportPath} 30 | 31 | 32 | camel-lsp-target-platform 33 | com.github.camel-tooling.lsp.eclipse.updatesite 34 | com.github.camel-tooling.lsp.eclipse.client 35 | com.github.cameltooling.lsp.eclipse.client.feature 36 | com.github.camel-tooling.lsp.eclipse.client.tests.ui 37 | com.github.camel-tooling.lsp.eclipse.client.tests.integration 38 | 39 | 40 | 41 | 42 | org.eclipse.tycho 43 | tycho-maven-plugin 44 | ${tycho.version} 45 | true 46 | 47 | 48 | org.eclipse.tycho 49 | target-platform-configuration 50 | ${tycho.version} 51 | 52 | 53 | 54 | ${project.groupId} 55 | camel-lsp-target-platform 56 | ${project.version} 57 | 58 | 59 | 60 | 61 | win32 62 | win32 63 | x86_64 64 | 65 | 66 | linux 67 | gtk 68 | x86_64 69 | 70 | 71 | macosx 72 | cocoa 73 | x86_64 74 | 75 | 76 | 77 | 78 | 79 | org.jacoco 80 | jacoco-maven-plugin 81 | 0.8.13 82 | 83 | true 84 | com.github.cameltooling.lsp.*,com.github.cameltooling.* 85 | 86 | 87 | 88 | agent-for-ut 89 | 90 | prepare-agent 91 | 92 | 93 | ${sonar.jacoco.reportPath} 94 | 95 | 96 | 97 | agent-for-it 98 | 99 | prepare-agent-integration 100 | 101 | 102 | ${sonar.jacoco.itReportPath} 103 | 104 | 105 | 106 | 107 | 108 | maven-surefire-plugin 109 | 3.5.3 110 | 111 | ${argLine} 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | org.apache.maven.plugins 120 | maven-compiler-plugin 121 | 3.14.0 122 | 123 | ${maven.compiler.source} 124 | ${maven.compiler.target} 125 | 126 | 127 | 128 | 129 | org.apache.maven.plugins 130 | maven-clean-plugin 131 | 3.5.0 132 | 133 | 134 | 135 | ${basedir}/libs 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | -------------------------------------------------------------------------------- /website/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Camel Tooling - Eclipse ##TYPE## Update Site - ­ ##VERSION## 4 | 5 | 6 |
7 | 8 |

Language Support for Apache Camel - Eclipse Update Site (##TYPE##)

9 |

Latest Build: ##VERSION##

10 | 11 |

This is the Update Site for Camel Tooling Language Server for Eclipse 12 |

13 |
14 | To install from this site, start up Eclipse, then do:
15 | Help > Install New Software... >
16 | Copy this site's URL into Eclipse, and hit Enter.
17 | When the site loads, select the features to install, or click the Select All button.
18 | To properly resolve all dependencies, check
19 | [x] Contact all update sites during install to find required software
20 | Click Next, agree to the license terms, and install.
21 |

22 | You can also download Camel Tooling Language Server plugin as individual zip for 23 | offline installation. See Github Releases.
24 | If you downloaded this site as a zip, you have to extract it into your local Eclipse folder. 25 |

26 |
27 |
28 |

29 | 30 |

Stable Releases

31 | Stable releases are - as indicated by their name - stable.
32 | You can also install the latest stable release by using the below install button. Just drag it to an open Eclipse instance.
33 | Drag to your running Eclipse* workspace. *Requires Eclipse Marketplace Client 34 |
35 |

Nightly Builds

36 | The bleeding edge contains the latest and greatest new features, but nothing is 37 | stable or guaranteed - yet. If you're using a Release and need a fix, you can update to the latest Nightly, or wait for the next release.
38 |
39 | 40 | --------------------------------------------------------------------------------