From a488e052aa75ab0b0ca2aead0e0190a557bcde7c Mon Sep 17 00:00:00 2001 From: Lars Heinemann Date: Fri, 16 Mar 2018 10:36:36 +0100 Subject: [PATCH] refactored repo to only contain eclipse client Signed-off-by: Lars Heinemann --- .project | 17 -- .travis.yml | 66 ----- clients/eclipse/Install.md => Install.md | 2 +- README.md | 66 ++--- .../.project | 0 .../org.eclipse.core.resources.prefs | 0 .../.settings/org.eclipse.m2e.core.prefs | 0 .../camel-lsp-target-platform.target | 0 .../pom.xml | 0 clients/eclipse/README.md | 22 -- .../org.eclipse.core.resources.prefs | 2 - clients/eclipse/pom.xml | 51 ---- clients/pom.xml | 19 -- clients/vscode/.editorconfig | 9 - clients/vscode/.gitignore | 10 - clients/vscode/.project | 11 - clients/vscode/.vscode/extensions.json | 9 - clients/vscode/.vscode/launch.json | 28 --- clients/vscode/.vscode/settings.json | 11 - clients/vscode/.vscode/tasks.json | 77 ------ clients/vscode/.vscodeignore | 13 - clients/vscode/Install.md | 11 - clients/vscode/LICENSE-2.0.txt | 202 --------------- clients/vscode/gulpfile.js | 9 - clients/vscode/icons/icon128.png | Bin 6605 -> 0 bytes clients/vscode/jars/Readme.md | 1 - clients/vscode/language-configuration.json | 27 -- clients/vscode/package.json | 66 ----- clients/vscode/scripts/preinstall.js | 8 - clients/vscode/src/extension.ts | 230 ------------------ clients/vscode/src/protocol.ts | 72 ------ clients/vscode/test/apacheCamel.xml | 1 - clients/vscode/test/index.ts | 22 -- clients/vscode/tsconfig.json | 17 -- clients/vscode/tslint.json | 13 - .../.classpath | 0 .../.project | 0 .../META-INF/MANIFEST.MF | 0 .../build.properties | 0 .../infinitest.filters | 0 .../log-camel-lsp.out | 18 ++ .../pom.xml | 0 .../CamelLSPLoadedByExtensionPointIT.java | 0 .../CamelLSPStreamConnectionProviderIT.java | 3 +- .../.classpath | 0 .../.project | 0 .../META-INF/MANIFEST.MF | 0 .../OSGI-INF/l10n/bundle.properties | 0 .../build.properties | 0 .../plugin.xml | 0 .../pom.xml | 0 .../client/ActivatorCamelLspClient.java | 0 .../CamelLSPStreamConnectionProvider.java | 11 + .../CamelURICompletionProposalComputer.java | 0 .../.project | 0 .../category.xml | 0 .../pom.xml | 0 pom.xml | 36 ++- server/.classpath | 36 --- server/.project | 23 -- .../org.eclipse.core.resources.prefs | 6 - server/.settings/org.eclipse.jdt.core.prefs | 5 - server/.settings/org.eclipse.m2e.core.prefs | 4 - server/pom.xml | 75 ------ .../lsp/internal/AbstractLanguageServer.java | 163 ------------- .../lsp/internal/CamelLanguageServer.java | 120 --------- .../internal/CamelTextDocumentService.java | 197 --------------- .../lsp/internal/CamelWorkspaceService.java | 56 ----- .../camel/tools/lsp/internal/Runner.java | 33 --- ...CamelComponentSchemaCompletionsFuture.java | 38 --- .../CamelEndpointCompletionProcessor.java | 65 ----- .../CamelOptionSchemaCompletionsFuture.java | 64 ----- .../CamelOptionValuesCompletionsFuture.java | 73 ------ .../tools/lsp/internal/hover/HoverFuture.java | 45 ---- .../lsp/internal/hover/HoverProcessor.java | 58 ----- .../lsp/internal/model/ComponentModel.java | 186 -------------- .../internal/model/ComponentOptionModel.java | 121 --------- .../internal/model/EndpointOptionModel.java | 157 ------------ .../lsp/internal/model/util/ModelHelper.java | 95 -------- .../lsp/internal/model/util/StringUtils.java | 207 ---------------- .../parser/CamelComponentURIInstance.java | 44 ---- .../lsp/internal/parser/CamelURIInstance.java | 136 ----------- .../parser/CamelUriElementInstance.java | 49 ---- .../parser/OptionParamKeyURIInstance.java | 50 ---- .../parser/OptionParamURIInstance.java | 74 ------ .../parser/OptionParamValueURIInstance.java | 52 ---- .../lsp/internal/parser/ParserFileHelper.java | 126 ---------- .../internal/parser/PathParamURIInstance.java | 70 ------ server/src/main/resources/log4j.properties | 10 - .../AbstractCamelLanguageServerTest.java | 98 -------- .../lsp/internal/CamelLanguageServerTest.java | 91 ------- .../CamelTextDocumentServiceTest.java | 57 ----- ...CamelComponentOptionBooleanValuesTest.java | 51 ---- ...lComponentOptionEnumerationValuesTest.java | 57 ----- .../CamelComponentOptionsCompletionsTest.java | 74 ------ ...lLanguageServerCompletionPositionTest.java | 106 -------- .../hover/CamelLanguageServerHoverTest.java | 63 ----- .../internal/parser/CamelURIInstanceTest.java | 187 -------------- .../test/resources/workspace/test-file.xml | 0 99 files changed, 86 insertions(+), 4296 deletions(-) delete mode 100644 .project delete mode 100644 .travis.yml rename clients/eclipse/Install.md => Install.md (86%) rename {clients/eclipse/camel-lsp-target-platform => camel-lsp-target-platform}/.project (100%) rename {.settings => camel-lsp-target-platform/.settings}/org.eclipse.core.resources.prefs (100%) rename {clients/eclipse/camel-lsp-target-platform => camel-lsp-target-platform}/.settings/org.eclipse.m2e.core.prefs (100%) rename {clients/eclipse/camel-lsp-target-platform => camel-lsp-target-platform}/camel-lsp-target-platform.target (100%) rename {clients/eclipse/camel-lsp-target-platform => camel-lsp-target-platform}/pom.xml (100%) delete mode 100644 clients/eclipse/README.md delete mode 100644 clients/eclipse/camel-lsp-target-platform/.settings/org.eclipse.core.resources.prefs delete mode 100644 clients/eclipse/pom.xml delete mode 100644 clients/pom.xml delete mode 100644 clients/vscode/.editorconfig delete mode 100644 clients/vscode/.gitignore delete mode 100644 clients/vscode/.project delete mode 100644 clients/vscode/.vscode/extensions.json delete mode 100644 clients/vscode/.vscode/launch.json delete mode 100644 clients/vscode/.vscode/settings.json delete mode 100644 clients/vscode/.vscode/tasks.json delete mode 100644 clients/vscode/.vscodeignore delete mode 100644 clients/vscode/Install.md delete mode 100644 clients/vscode/LICENSE-2.0.txt delete mode 100644 clients/vscode/gulpfile.js delete mode 100644 clients/vscode/icons/icon128.png delete mode 100644 clients/vscode/jars/Readme.md delete mode 100644 clients/vscode/language-configuration.json delete mode 100644 clients/vscode/package.json delete mode 100644 clients/vscode/scripts/preinstall.js delete mode 100644 clients/vscode/src/extension.ts delete mode 100644 clients/vscode/src/protocol.ts delete mode 100644 clients/vscode/test/apacheCamel.xml delete mode 100644 clients/vscode/test/index.ts delete mode 100644 clients/vscode/tsconfig.json delete mode 100644 clients/vscode/tslint.json rename {clients/eclipse/org.apache.camel.lsp.eclipse.client.tests.integration => org.apache.camel.lsp.eclipse.client.tests.integration}/.classpath (100%) rename {clients/eclipse/org.apache.camel.lsp.eclipse.client.tests.integration => org.apache.camel.lsp.eclipse.client.tests.integration}/.project (100%) rename {clients/eclipse/org.apache.camel.lsp.eclipse.client.tests.integration => org.apache.camel.lsp.eclipse.client.tests.integration}/META-INF/MANIFEST.MF (100%) rename {clients/eclipse/org.apache.camel.lsp.eclipse.client.tests.integration => org.apache.camel.lsp.eclipse.client.tests.integration}/build.properties (100%) rename {clients/eclipse/org.apache.camel.lsp.eclipse.client.tests.integration => org.apache.camel.lsp.eclipse.client.tests.integration}/infinitest.filters (100%) create mode 100644 org.apache.camel.lsp.eclipse.client.tests.integration/log-camel-lsp.out rename {clients/eclipse/org.apache.camel.lsp.eclipse.client.tests.integration => org.apache.camel.lsp.eclipse.client.tests.integration}/pom.xml (100%) rename {clients/eclipse/org.apache.camel.lsp.eclipse.client.tests.integration => org.apache.camel.lsp.eclipse.client.tests.integration}/src/main/java/org/apache/camel/lsp/eclipse/client/tests/integration/CamelLSPLoadedByExtensionPointIT.java (100%) rename {clients/eclipse/org.apache.camel.lsp.eclipse.client.tests.integration => org.apache.camel.lsp.eclipse.client.tests.integration}/src/main/java/org/apache/camel/lsp/eclipse/client/tests/integration/CamelLSPStreamConnectionProviderIT.java (95%) rename {clients/eclipse/org.apache.camel.lsp.eclipse.client => org.apache.camel.lsp.eclipse.client}/.classpath (100%) rename {clients/eclipse/org.apache.camel.lsp.eclipse.client => org.apache.camel.lsp.eclipse.client}/.project (100%) rename {clients/eclipse/org.apache.camel.lsp.eclipse.client => org.apache.camel.lsp.eclipse.client}/META-INF/MANIFEST.MF (100%) rename {clients/eclipse/org.apache.camel.lsp.eclipse.client => org.apache.camel.lsp.eclipse.client}/OSGI-INF/l10n/bundle.properties (100%) rename {clients/eclipse/org.apache.camel.lsp.eclipse.client => org.apache.camel.lsp.eclipse.client}/build.properties (100%) rename {clients/eclipse/org.apache.camel.lsp.eclipse.client => org.apache.camel.lsp.eclipse.client}/plugin.xml (100%) rename {clients/eclipse/org.apache.camel.lsp.eclipse.client => org.apache.camel.lsp.eclipse.client}/pom.xml (100%) rename {clients/eclipse/org.apache.camel.lsp.eclipse.client => org.apache.camel.lsp.eclipse.client}/src/org/apache/camel/lsp/eclipse/client/ActivatorCamelLspClient.java (100%) rename {clients/eclipse/org.apache.camel.lsp.eclipse.client => org.apache.camel.lsp.eclipse.client}/src/org/apache/camel/lsp/eclipse/client/CamelLSPStreamConnectionProvider.java (86%) rename {clients/eclipse/org.apache.camel.lsp.eclipse.client => org.apache.camel.lsp.eclipse.client}/src/org/apache/camel/lsp/eclipse/xml/completion/CamelURICompletionProposalComputer.java (100%) rename {clients/eclipse/org.apache.camel.lsp.eclipse.updatesite => org.apache.camel.lsp.eclipse.updatesite}/.project (100%) rename {clients/eclipse/org.apache.camel.lsp.eclipse.updatesite => org.apache.camel.lsp.eclipse.updatesite}/category.xml (100%) rename {clients/eclipse/org.apache.camel.lsp.eclipse.updatesite => org.apache.camel.lsp.eclipse.updatesite}/pom.xml (100%) delete mode 100644 server/.classpath delete mode 100644 server/.project delete mode 100644 server/.settings/org.eclipse.core.resources.prefs delete mode 100644 server/.settings/org.eclipse.jdt.core.prefs delete mode 100644 server/.settings/org.eclipse.m2e.core.prefs delete mode 100644 server/pom.xml delete mode 100644 server/src/main/java/org/apache/camel/tools/lsp/internal/AbstractLanguageServer.java delete mode 100644 server/src/main/java/org/apache/camel/tools/lsp/internal/CamelLanguageServer.java delete mode 100644 server/src/main/java/org/apache/camel/tools/lsp/internal/CamelTextDocumentService.java delete mode 100644 server/src/main/java/org/apache/camel/tools/lsp/internal/CamelWorkspaceService.java delete mode 100644 server/src/main/java/org/apache/camel/tools/lsp/internal/Runner.java delete mode 100644 server/src/main/java/org/apache/camel/tools/lsp/internal/completion/CamelComponentSchemaCompletionsFuture.java delete mode 100644 server/src/main/java/org/apache/camel/tools/lsp/internal/completion/CamelEndpointCompletionProcessor.java delete mode 100644 server/src/main/java/org/apache/camel/tools/lsp/internal/completion/CamelOptionSchemaCompletionsFuture.java delete mode 100644 server/src/main/java/org/apache/camel/tools/lsp/internal/completion/CamelOptionValuesCompletionsFuture.java delete mode 100644 server/src/main/java/org/apache/camel/tools/lsp/internal/hover/HoverFuture.java delete mode 100644 server/src/main/java/org/apache/camel/tools/lsp/internal/hover/HoverProcessor.java delete mode 100644 server/src/main/java/org/apache/camel/tools/lsp/internal/model/ComponentModel.java delete mode 100644 server/src/main/java/org/apache/camel/tools/lsp/internal/model/ComponentOptionModel.java delete mode 100644 server/src/main/java/org/apache/camel/tools/lsp/internal/model/EndpointOptionModel.java delete mode 100644 server/src/main/java/org/apache/camel/tools/lsp/internal/model/util/ModelHelper.java delete mode 100644 server/src/main/java/org/apache/camel/tools/lsp/internal/model/util/StringUtils.java delete mode 100644 server/src/main/java/org/apache/camel/tools/lsp/internal/parser/CamelComponentURIInstance.java delete mode 100644 server/src/main/java/org/apache/camel/tools/lsp/internal/parser/CamelURIInstance.java delete mode 100644 server/src/main/java/org/apache/camel/tools/lsp/internal/parser/CamelUriElementInstance.java delete mode 100644 server/src/main/java/org/apache/camel/tools/lsp/internal/parser/OptionParamKeyURIInstance.java delete mode 100644 server/src/main/java/org/apache/camel/tools/lsp/internal/parser/OptionParamURIInstance.java delete mode 100644 server/src/main/java/org/apache/camel/tools/lsp/internal/parser/OptionParamValueURIInstance.java delete mode 100644 server/src/main/java/org/apache/camel/tools/lsp/internal/parser/ParserFileHelper.java delete mode 100644 server/src/main/java/org/apache/camel/tools/lsp/internal/parser/PathParamURIInstance.java delete mode 100644 server/src/main/resources/log4j.properties delete mode 100644 server/src/test/java/org/apache/camel/tools/lsp/internal/AbstractCamelLanguageServerTest.java delete mode 100644 server/src/test/java/org/apache/camel/tools/lsp/internal/CamelLanguageServerTest.java delete mode 100644 server/src/test/java/org/apache/camel/tools/lsp/internal/CamelTextDocumentServiceTest.java delete mode 100644 server/src/test/java/org/apache/camel/tools/lsp/internal/completion/CamelComponentOptionBooleanValuesTest.java delete mode 100644 server/src/test/java/org/apache/camel/tools/lsp/internal/completion/CamelComponentOptionEnumerationValuesTest.java delete mode 100644 server/src/test/java/org/apache/camel/tools/lsp/internal/completion/CamelComponentOptionsCompletionsTest.java delete mode 100644 server/src/test/java/org/apache/camel/tools/lsp/internal/completion/CamelLanguageServerCompletionPositionTest.java delete mode 100644 server/src/test/java/org/apache/camel/tools/lsp/internal/hover/CamelLanguageServerHoverTest.java delete mode 100644 server/src/test/java/org/apache/camel/tools/lsp/internal/parser/CamelURIInstanceTest.java delete mode 100644 server/src/test/resources/workspace/test-file.xml diff --git a/.project b/.project deleted file mode 100644 index 3477d98..0000000 --- a/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - Camel Language Server Protocol - - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.m2e.core.maven2Nature - - diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 8b9e9d5..0000000 --- a/.travis.yml +++ /dev/null @@ -1,66 +0,0 @@ -matrix: - include: - - language: java - sudo: false - before_install: - - "export DISPLAY=:99.0" - - "sh -e /etc/init.d/xvfb start" - script: - - 'mvn clean verify' - - 'if [[ $TRAVIS_PULL_REQUEST == "false" && $TRAVIS_BRANCH == "master" ]]; then mvn sonar:sonar -Dsonar.login=${SONAR_TOKEN}; fi' - jdk: oraclejdk8 - deploy: - provider: releases - api_key: ${DEPLOY_TOKEN} - file: - - "server/target/camel-lsp-server-1.0.0-SNAPSHOT.jar" - - "clients/eclipse/org.apache.camel.lsp.eclipse.updatesite/target/org.apache.camel.lsp.eclipse.updatesite-1.0.0-SNAPSHOT.zip" - skip_cleanup: true - overwrite: true - on: - branch: master - # tags: true - branches: - only: - - master - cache: - directories: - - $HOME/.m2 - - $HOME/.sonar/cache - - $HOME/.gradle/ - - language: node_js - node_js: "8" - before_install: - - "export DISPLAY=:99.0" - - "sh -e /etc/init.d/xvfb start" - - 'cd clients/vscode' - - 'export PATH=./node_modules/.bin:$PATH' - - 'npm install -g typescript' - install: - - 'npm install --ignore-scripts' - - 'npm install' - - 'npm run vscode:prepublish' - - 'npm install -g vsce' - - 'vsce package' - deploy: - provider: releases - api_key: ${DEPLOY_TOKEN} - file: - - "vscode-apache-camel-0.0.1.vsix" - skip_cleanup: true - overwrite: true - on: - branch: master - # tags: true - branches: - only: - - master - cache: - directories: - - "clients/vscode/node_modules" -env: DISPLAY=:99 -addons: - sonarcloud: - organization: "apupier-github" - branches: - - master diff --git a/clients/eclipse/Install.md b/Install.md similarity index 86% rename from clients/eclipse/Install.md rename to Install.md index e6d89e4..a6b73bc 100644 --- a/clients/eclipse/Install.md +++ b/Install.md @@ -2,7 +2,7 @@ How to Install -------------- * Install Eclipse -* Go to latest release page https://github.com/apupier/camel-language-server/releases/latest/ +* Go to latest release page https://github.com/lhein/camel-language-server/releases/latest/ * Download zipped update site named org.apache.camel.lsp.eclipse.updatesite-1.0.0-SNAPSHOT.zip * In Eclipse, Help -> Install New Software... * Click Add... diff --git a/README.md b/README.md index 9e9fc27..6267718 100644 --- a/README.md +++ b/README.md @@ -1,44 +1,22 @@ -[![Build Status](https://travis-ci.org/apupier/camel-language-server.svg?branch=master)](https://travis-ci.org/apupier/camel-language-server) - -camel-language-server -===================== - -camel-language-server is a server implementation that provides Camel DSL smartness. -The server adheres to the [language server protocol](https://github.com/Microsoft/language-server-protocol) -and can be used with any editor that supports the protocol. The server utilizes [Apache Camel](http://camel.apache.org/) and [M2Eclipse](http://www.eclipse.org/m2e/). - - -Features --------------- -* Code completion -* Hover - -Features planned --------------- -* As you type reporting of parsing and compilation errors -* More advanced Code completion -* Code outline -* Code navigation -* Code lens (references) -* Highlights -* Code formatting - -Installation ------------- - -Please see installation guide for each IDE: - -* [Eclipse](clients/eclipse/Install.md) -* [VS Code](clients/vscode/Install.md) - - -Feedback ---------- - -* File a bug in [GitHub Issues](https://github.com/lhein/camel-language-server/issues). - - -License -------- -ASL 2.0, See [LICENSE](LICENSE) file. - +How to debug Camel Language Server from Eclipse client +====================================================== + +1. Add debug arguments to the list org.apache.camel.lsp.eclipse.client.CamelLSPStreamConnectionProvider.computeCommands() + +You will end up with something like: + + private static List computeCommands() { + List commands = new ArrayList<>(); + commands.add("java"); + commands.addAll(debugArguments()); + commands.add("-jar"); + commands.add(computeCamelLanguageServerJarPath()); + return commands; + } + + private static List debugArguments() { + return Arrays.asList("-Xdebug","-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=3000"); + } + + +2. Create a Remote Java Application Debug Launch configuration in Eclipse \ No newline at end of file diff --git a/clients/eclipse/camel-lsp-target-platform/.project b/camel-lsp-target-platform/.project similarity index 100% rename from clients/eclipse/camel-lsp-target-platform/.project rename to camel-lsp-target-platform/.project diff --git a/.settings/org.eclipse.core.resources.prefs b/camel-lsp-target-platform/.settings/org.eclipse.core.resources.prefs similarity index 100% rename from .settings/org.eclipse.core.resources.prefs rename to camel-lsp-target-platform/.settings/org.eclipse.core.resources.prefs diff --git a/clients/eclipse/camel-lsp-target-platform/.settings/org.eclipse.m2e.core.prefs b/camel-lsp-target-platform/.settings/org.eclipse.m2e.core.prefs similarity index 100% rename from clients/eclipse/camel-lsp-target-platform/.settings/org.eclipse.m2e.core.prefs rename to camel-lsp-target-platform/.settings/org.eclipse.m2e.core.prefs diff --git a/clients/eclipse/camel-lsp-target-platform/camel-lsp-target-platform.target b/camel-lsp-target-platform/camel-lsp-target-platform.target similarity index 100% rename from clients/eclipse/camel-lsp-target-platform/camel-lsp-target-platform.target rename to camel-lsp-target-platform/camel-lsp-target-platform.target diff --git a/clients/eclipse/camel-lsp-target-platform/pom.xml b/camel-lsp-target-platform/pom.xml similarity index 100% rename from clients/eclipse/camel-lsp-target-platform/pom.xml rename to camel-lsp-target-platform/pom.xml diff --git a/clients/eclipse/README.md b/clients/eclipse/README.md deleted file mode 100644 index 6267718..0000000 --- a/clients/eclipse/README.md +++ /dev/null @@ -1,22 +0,0 @@ -How to debug Camel Language Server from Eclipse client -====================================================== - -1. Add debug arguments to the list org.apache.camel.lsp.eclipse.client.CamelLSPStreamConnectionProvider.computeCommands() - -You will end up with something like: - - private static List computeCommands() { - List commands = new ArrayList<>(); - commands.add("java"); - commands.addAll(debugArguments()); - commands.add("-jar"); - commands.add(computeCamelLanguageServerJarPath()); - return commands; - } - - private static List debugArguments() { - return Arrays.asList("-Xdebug","-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=3000"); - } - - -2. Create a Remote Java Application Debug Launch configuration in Eclipse \ No newline at end of file diff --git a/clients/eclipse/camel-lsp-target-platform/.settings/org.eclipse.core.resources.prefs b/clients/eclipse/camel-lsp-target-platform/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 99f26c0..0000000 --- a/clients/eclipse/camel-lsp-target-platform/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -encoding/=UTF-8 diff --git a/clients/eclipse/pom.xml b/clients/eclipse/pom.xml deleted file mode 100644 index 70d4e81..0000000 --- a/clients/eclipse/pom.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - 4.0.0 - - - org.apache.camel.tools.lsp - clients - 1.0.0-SNAPSHOT - - eclipse - ${base.name} :: Clients :: Eclipse Client - pom - - - 1.0.0 - - - - camel-lsp-target-platform - org.apache.camel.lsp.eclipse.client - org.apache.camel.lsp.eclipse.client.tests.integration - org.apache.camel.lsp.eclipse.updatesite - - - - - - org.eclipse.tycho - tycho-maven-plugin - ${tycho.version} - true - - - org.eclipse.tycho - target-platform-configuration - ${tycho.version} - - - - ${project.groupId} - camel-lsp-target-platform - ${project.version} - - - - - - - diff --git a/clients/pom.xml b/clients/pom.xml deleted file mode 100644 index 58046c9..0000000 --- a/clients/pom.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - 4.0.0 - - - org.apache.camel.tools.lsp - parent - 1.0.0-SNAPSHOT - - clients - ${base.name} :: Clients - pom - - - eclipse - - - diff --git a/clients/vscode/.editorconfig b/clients/vscode/.editorconfig deleted file mode 100644 index f9cfb08..0000000 --- a/clients/vscode/.editorconfig +++ /dev/null @@ -1,9 +0,0 @@ -# Tab indentation -[*] -indent_style = tab -indent_size = 4 -trim_trailing_whitespace = true - -[{.travis.yml,npm-shrinkwrap.json,package.json}] -indent_style = space -indent_size = 2 \ No newline at end of file diff --git a/clients/vscode/.gitignore b/clients/vscode/.gitignore deleted file mode 100644 index fadeef7..0000000 --- a/clients/vscode/.gitignore +++ /dev/null @@ -1,10 +0,0 @@ -out -server -node_modules -jars/language-server.jar -*.vsix -.DS_Store -.vscode-test -package-lock.json -undefined -target diff --git a/clients/vscode/.project b/clients/vscode/.project deleted file mode 100644 index e725a3a..0000000 --- a/clients/vscode/.project +++ /dev/null @@ -1,11 +0,0 @@ - - - vscode-apache-camel - - - - - - - - diff --git a/clients/vscode/.vscode/extensions.json b/clients/vscode/.vscode/extensions.json deleted file mode 100644 index ad475c7..0000000 --- a/clients/vscode/.vscode/extensions.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - // See http://go.microsoft.com/fwlink/?LinkId=827846 - // for the documentation about the extensions.json format - "recommendations": [ - // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp - "eg2.tslint", - "EditorConfig.EditorConfig" - ] -} \ No newline at end of file diff --git a/clients/vscode/.vscode/launch.json b/clients/vscode/.vscode/launch.json deleted file mode 100644 index bb13d01..0000000 --- a/clients/vscode/.vscode/launch.json +++ /dev/null @@ -1,28 +0,0 @@ -// A launch configuration that compiles the extension and then opens it inside a new window -{ - "version": "0.1.0", - "configurations": [ - { - "name": "Launch Extension", - "type": "extensionHost", - "request": "launch", - "runtimeExecutable": "${execPath}", - "args": ["--extensionDevelopmentPath=${workspaceRoot}", "--debug" ], - "stopOnEntry": false, - "sourceMaps": true, - "outDir": "${workspaceRoot}/out/src", - "preLaunchTask": "compile" - }, - { - "name": "Launch Tests", - "type": "extensionHost", - "request": "launch", - "runtimeExecutable": "${execPath}", - "args": ["--extensionDevelopmentPath=${workspaceRoot}", "--extensionTestsPath=${workspaceRoot}/out/test" ], - "stopOnEntry": false, - "sourceMaps": true, - "outDir": "${workspaceRoot}/out/test", - "preLaunchTask": "compile" - } - ] -} \ No newline at end of file diff --git a/clients/vscode/.vscode/settings.json b/clients/vscode/.vscode/settings.json deleted file mode 100644 index 0377798..0000000 --- a/clients/vscode/.vscode/settings.json +++ /dev/null @@ -1,11 +0,0 @@ -// Place your settings in this file to overwrite default and user settings. -{ - "files.exclude": { - "out": false // set this to true to hide the "out" folder with the compiled JS files - }, - "search.exclude": { - "out": true // set this to false to include "out" folder in search results - }, - "typescript.tsdk": "./node_modules/typescript/lib", - "vsicons.presets.angular": false // we want to use the TS server from our node_modules folder to control its version -} \ No newline at end of file diff --git a/clients/vscode/.vscode/tasks.json b/clients/vscode/.vscode/tasks.json deleted file mode 100644 index 46c17cb..0000000 --- a/clients/vscode/.vscode/tasks.json +++ /dev/null @@ -1,77 +0,0 @@ -// Available variables which can be used inside of strings. -// ${workspaceRoot}: the root folder of the team -// ${file}: the current opened file -// ${fileBasename}: the current opened file's basename -// ${fileDirname}: the current opened file's dirname -// ${fileExtname}: the current opened file's extension -// ${cwd}: the current working directory of the spawned process -// A task runner that calls a custom npm script that compiles the extension. -{ - "version": "0.1.0", - // we want to run npm - "command": "npm", - // the command is a shell script - "isShellCommand": true, - // show the output window only if unrecognized errors occur. - "showOutput": "silent", - "suppressTaskName": true, - "tasks": [ - { - "taskName": "compile", - // we run the custom script "compile" as defined in package.json - "args": [ - "run", - "compile", - "--loglevel", - "silent" - ], - // The tsc compiler is started in watching mode - "isWatching": true, - // use the standard tsc in watch mode problem matcher to find compile problems in the output. - "problemMatcher": "$tsc-watch", - "isBuildCommand": true - }, - { - "taskName": "test", - "args": [ - "run", - "test" - ], - "isTestCommand": true - }, - { - "taskName": "build-server", - // we run the custom script "compile" as defined in package.json - "args": [ - "run", - "build-server", - "--loglevel", - "silent" - ], - // The tsc compiler is started in watching mode - "isWatching": false - }, - { - "taskName": "tslint", - "args": [ - "run", - "tslint" - ], - "problemMatcher": { - "owner": "tslint", - "fileLocation": [ - "relative", - "${workspaceRoot}" - ], - "severity": "warning", - "pattern": { - "regexp": "^(\\S.*)\\[(\\d+), (\\d+)\\]:\\s+(.*)$", - "file": 1, - "line": 2, - "column": 3, - "message": 4 - } - } - } - ] -} \ No newline at end of file diff --git a/clients/vscode/.vscodeignore b/clients/vscode/.vscodeignore deleted file mode 100644 index 78d0521..0000000 --- a/clients/vscode/.vscodeignore +++ /dev/null @@ -1,13 +0,0 @@ -.vscode/** -typings/** -out/test/** -test/** -src/** -images/** -**/*.map -.gitignore -tsconfig.json -vsc-extension-quickstart.md -undefined/** -CONTRIBUTING.md -.vscode-test/** diff --git a/clients/vscode/Install.md b/clients/vscode/Install.md deleted file mode 100644 index 7526ff8..0000000 --- a/clients/vscode/Install.md +++ /dev/null @@ -1,11 +0,0 @@ -How to install --------------- - -* Install VS Code -* Go to latest release page https://github.com/apupier/camel-language-server/releases/latest/ -* Download the vscode-apache-camel-0.0.1.vsix file -* [Install from *.vsix](https://code.visualstudio.com/docs/editor/extension-gallery#_install-from-a-vsix) -** Open Extensions View (Ctrl+Shift+X) -** Click on the three dots at the top right of the view and then "Install from VSIX..." -** Select the file and click Install -* Enjoy! \ No newline at end of file diff --git a/clients/vscode/LICENSE-2.0.txt b/clients/vscode/LICENSE-2.0.txt deleted file mode 100644 index d645695..0000000 --- a/clients/vscode/LICENSE-2.0.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/clients/vscode/gulpfile.js b/clients/vscode/gulpfile.js deleted file mode 100644 index 33ea9e3..0000000 --- a/clients/vscode/gulpfile.js +++ /dev/null @@ -1,9 +0,0 @@ -'use strict'; -const gulp = require('gulp'); -const gulp_tslint = require('gulp-tslint'); -//... -gulp.task('tslint', () => { - return gulp.src(['**/*.ts', '!**/*.d.ts', '!node_modules/**']) - .pipe(gulp_tslint()) - .pipe(gulp_tslint.report()); -}); \ No newline at end of file diff --git a/clients/vscode/icons/icon128.png b/clients/vscode/icons/icon128.png deleted file mode 100644 index 29b84f292d0b2e9bfbbdf684de007c1268772d94..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6605 zcmV;;88YUHP)JpK{QfZx9n278e}XpmOG`c^DWR$dzlEb5#HU z6aWkty^Ura8y>2EUGwwvfMH4b`S}Iwckw3jix3AVV=FH90_6Mm(E}evNl$LPbj@J2mA102ql$ zL_t(|ob6p{d)i2sHMJliWQ5RyK&(PS0%1VdX0eSS-A?-LNd_k~{r`Wqprh17fc(>hJSxm-9IN}LjbdX#g-Ii zpEFLrFc~l?;R7)XQ%2DHGeqj5JNY*dxdU0K*2k|&xTKMQWuda-M80Bb;4$t+o`L?K z49sGj-O$MD%7%tZLWDCtkS~u%-aRh)FPexa_tOce=Vw`_!rOx83>Fw;b7AqGRe_a^0&W=cOWphQO-G)m|4O z9(4>1^0^1}D&bPDI1cX_b;x^GFW&?m*VP@bcqDj(N|OJe*JjKFd_0+41@0M(<=(ic ze(|kE!F3PwlDhg?n5@a+hfj`Z2D4jYemYJxzmX zr`M_f!~HLRb9OmE0;#quGZ%n)SAB~{0$#WN>EHDpW}lpDD!KkPBl0#dpWR- zg29?e_Oqe@CmE#7>p*IbFG4o1t|rzQEIcOYM&6bT(VWJ;`ZXRv`OQ#lqqY_BXFDOl;w;-+ym86*%= zouD_8RNpX&yFd!4$IYYT=0K7gV?gweE>NxH@l_u{vKYH-HQH6UsT*ElX(iN-z&40G zW; zaE!O|a$t$o$LV-Dp7sh?S92@F3lhu8J49eg1M^D|?=>F(LPR*6;2O2{=lsxBlC>hn z*k-nAlwZN+#N{6H-wnB9w>Q}XB!gwULgTq8h-$Yvk}Q5p`y$z#T+o^F(VGAOHW4}! zU+Pa|vdV|?xIcb%Glh?)g|36U;egw?J@o^~*YBo)_cbp>s<~{r$QP~(|5Orow|8r{ zwvs*CMWhxEVhRi~g;1ibEsXzpSam84|A1L~*65@I{x3|mE+h$h5KkkaW)19t!w|#q zzf)HgH6B~n$N|$nNN=PArYsP;V3Y4XjUOM!_YWUn`EQN3))te#$*UN*kGDo80h5DK zV^*xC0yMfIqw#$Gabg0qSTtWisX4xjxGiP;m6&aqtyI0L4XkFX#Lq%J=-&Z$)7Nlq zrNeoJcf%1VmROn=Xqw`rq6sGBNL5{fRb3u8#ej!`RPcB;FLE1m-b%lOiJ5wjrdi?y zUE}4lTxqv#HZ7G*a~@^p?qTv-th};gX-x#GFZ03!;H>pG6xywQo{jsGDbadMCNc*- zpDmSjERHP|L6l7LPs7LO-c@h*+5cA=1q=&U%_6&!a#*2DVNTU8;ApGD1ieh6-OGwj zOU0MR$i14v@atz$to-qxS^es&57?EBgk@ZM3E_=2P1=?d`_TbNM!0_Xof}u&TTrcR*xOl#*c?MWMUgSb$ zi^k^cqaw-ri?j*|VO7HB`Tocqz-6@CAQU`Z30{(losTIwL|6?s674I|`}QW;fb zc%lk{#2V3DACgfWzEIj)$SG`|?^jKM2$6mbuiNe8Tf!LBhY)#qk!q{>2`Zts16#aR z*5S3`HK&kWIg|y1$rd3J`OzY$D!qNOzeL-(b!(x+eEk*);WsY@aH@^6cR=gjcFXlW3tIZxhY#ctb-Xatp(CE*C`a!)`Cq;?@s zhj6WWK(f&C6uFD9y6u1NFC%m;XlHFdGGNHJQVdd9Y)01dUm!X+P$Wb*YzVDOwj-#U z;6}2m29weUe&Gm;Dp3Ijs?fMJiArTnffVd=AnNM;S|-^J{g^j`U|G<8EeKVfSadB* z)LJpB3JTc{I{1;I7I%IZ$zzc|Q70|8mjz~#{gEQ=TpnaAopZKhvoEmRjpi<5epHfn+JKNkoyUU& z9(ouSE)hARK7u~rb{j9Dlg8)BdBZFTA=~N5@9sw9xX+99URkq3pQU$aMWG$)R3%*5 zi>B?VhfDfy@t^p+=Und~A&U`~2C*a2+#Hz#PTN~dl{>??z6I2|joDitQ8emmUKI9Q zW0)FvD;&(vK{`AQqC&cncm!ra!qZ4x+tGA)JnU;L_fxw$T~2fR zvh_-6*>JV4Fp9*Qk4@@;*X{muM^AB~-vnK(?A^dUi-#4eGITzg#e)`r!ABhTLVZ{S zUEN`RVl!MXD;>?TYK#tvhbtfl8%iF=CD2{8)WlD*aDOcu&9UkgCF@`=mf!at^7j(} zuvJOD)r@(ZhR7A8IaUvctcME*?|3Hp@e81Ap2__Dr3=@Oj;I%H`a-o2E(~hh7UT&7 z*1fL%^Ca90S2$GRGz7*beYhzcmbWz4GckJNuWW@2;zoz5IEKOFzLU5jq6PY6?g7!x zzsQ2PRyE0tXrRj~rFj61zE-`&wXbA;l?73{0*>l-G2wBnItj(n@?_Nkb=HN$H-K7P zRN`@p2O;9uT!j-xwRv+$X;p9S%DF@A}tr+IiVu8jn+On8K8lL&(+ zApOF1^pHd}itvc0iqk6{4s0Uw=LRl?yGZ}5L>wANQp&k4 zrbAbieg#Pq7e=um`*r7N0c8P4G6bbr3_020S22(xNsm74w8=z`uop7UM)Op*Ap$Tu zjwH`ZHsmKteLoMRvC-t+Z_N*t5U2{#WU_ii$-aL3-+wm{$2UY@Z3sMrko_*d253mp z6haD<5`J@p-}?b6VH#4ypboeX6m{r!DMrG>y&Cm#Ckx7SRNdi)QIY+q%t<1V6(Z|$ ze{ch;k0KHw4>u6`F!v-%9#=y^eN;phDUU+aOlu!Pgc$UwDz_eyNs(^tUy+S~M}>|m zW9=b7G1JyhHS&Z5x?#iITMCat6L7WnsiU0&Y;jS~w;lqCj$IYnePXLWIajSYBzI*y0K5RRDJdI42swrw>^>Bu0y-#Cr;+ZD-1gPbp z7^s|T;Yd;~dZ(;~*q1ef1ed`)xWXKpBgxvsd0FlMM@KDTe&^Aq9$3d zG0j{=zx11Xs7Z7C7!I&5(cs*xqhh(W5*$#0K*Sy%d$u5$RG$OM)P2<=sAVS6QWHl>8Rolx~-Zm;AMl*WWTab|DcF zpmg_@&)pwL+7j1_`2j6L#J$=LdEuzbTjgjMf`sYTp^OW04>3)S8fwM)Ud3Ih$W~Ay ziRmL70_9w#!t=an(5-_%K%}GCCH4m?={N^m_eMoYMPx&cNC?t$-hAj3t{wDzkwTe| zO$QRf@s9Fsj7+y;RTBba&N|T*t=h#yga_hp9mV{-6&fI%Rq%$G zT;tk-y;5~{^^%!8Se+<~xL?z179|D_Xls`T(N?N=tc3mg3FM_>Y1PQr^PI^RZQjN@ zMZE{OADJvm@AjQRO#5_%UGad|8Wo&ie-CaFFlEptevXsL(4^%|McA>1& z*zkbm8g=*@YGJnAO_-|KG-$>`WctFAm3trstec%9$G`rvx_k+*dHmto zUJng`F^NQ=C9LyWNMU^*YI?(isdXpE9Q1rAu$kFGJnw3aO6hD$g$%XUO{m3jEniqni8?(xpO{FmTkTqz@x3kYvvXtIu-BJo{ru-p)&asF+}%tBi7AX{@{qFH_vOz6SX zr#N0vn7&|dtPiZ^)YT|HO7apysrBVhXq~!K(CBRCQlJw@i1-9>+OrmFuC`2=R(x{~ z<(2HeG32VT*t%q$9K`XoR*&%THUiah%i~d{eXreGZ3l79Pg&~TpIfmQtbC8-y%&Hf zzs|-B%R*abkaN#fb{%{``{Y}Tghw*Sek3w_Zk5s1N&JND&0J{FJh>k)48Ii}r*I5T{Ij`yumu_H zibo|!K3{GVL|y;qRJEoDvTYnpdBeYAI9GkJRIf-|C$pfwNMr-y6?#22t*gO0+TTG( z6RO`oZ26m2faQ%tWUUVelyiJJPyj)#&M5(zmll0Jkda7T$MG28sKoh;)i;d+sD{Nr zmnPCqDy%vH56^$0>gq8CM}Cb#(8s1fJUNrwWUbxTN(0Ff)JmW9nZ{sP=u|8G${`qh ziy<;3v6SapWmbCEI~ts!(`%!UvECT!I&Bt)pZVqI0NdS{I3nD+Kan~k1cta|2KtXp zb%goPTUGM>)x)c@oZJZ8x3RqKdq;v>=*mZ6qBBwiURX^OhLtngDDxOEAAf=EaXfDn z6I190g)LU!2)dH1N{gl2eyyKWS4%XDlJB4)}q;P2U!ZK3M za$p}vGoMHDuefT46K}-~#jQ0~W}qRN_KP^z=UvSnPbc2X2T9{oTyNYjQ#UfbmUM=M zxk+8{^H}`X`5C_?pa0~I-4}ClxK|$f!0Tbkw1nk&In*Md)LQT}+F7%-@4g{efl!;o zR-vi`#an%w_9dP8B?^Qhw;Un@o$fiQgJ%U*jf~hF#+DxK1J4vAjq_utl#Scuv!$t< zB`t7H#N8}ILr#8simx+Zy5#YL(>*~^Q$`yhttt7gA{5UlIX!$uH+IU1v+OzS%6=V9 z;Qjh0`k_Je^}e&byq8+MJ!Q8sQ5Aad`cIs7kdCjXkd;dmgmT;sV`~(e zpoA%@W@(yc*gD3#AqFxe^i~&a67O{PCTo|nA!C3!y)7mXLYWL=%H`ne%`m+^ga);Q z?H937>>YedG>Rp*MV5||DMrnv;8v5g+r_Zm+#}P{cF!xLU&e-v-AAraQoI>Z-JGB+ z+qVty?w}BIu(td7k#Z3mk{@vvVw@VGVDM@=wX;Tg_qjf#rMJ6YVOF|?4atw_3eV+q zg$M}TX}m{rZg28CF@-ylj*MttkqL=DNDF!;xqqu3LOw?ycwbv*ja`v>iL;x1iNc7r zuJ>1q67nEd6A%1_#?srBaiV(T=pEU`e6e>00>Ubh7@a@#+yPWsX`r`)PF6dj*VIDt z__}+s3(AI&tC6$jf0ejSF+p9sknF7~6|l^mm63~@$Lsdtfs7^4c)1tu&b0Y9AJE3g zNbgRhiK$C$8}}eMIs-zc#8JxQRut`?h8JI_$#S7qZRd@uT>yF39UE=Wy62`vZ!?I*058Z;QrMG=7sDex2 zadma~JnM9DXVe__9{{F&R|JZ=!;_g%Yv<9mi{as6SK_3SmQ3igrfUc6v$`HIMi z`?ALY0KA;ks|!aamqB@(2PB5@0`%?"] - ] -} \ No newline at end of file diff --git a/clients/vscode/package.json b/clients/vscode/package.json deleted file mode 100644 index b485c85..0000000 --- a/clients/vscode/package.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "name": "vscode-apache-camel", - "displayName": "Language Support for Apache Camel", - "description": "Language Support for Apache Camel", - "author": "Aurélien Pupier", - "license": "Apache-2.0", - "version": "0.0.1", - "preview": true, - "publisher": "apache-camel", - "engines": { - "vscode": "^1.18.0" - }, - "repository": {}, - "categories": [ - "Languages", - "Linters" - ], - "activationEvents": [ - "onLanguage:xml", - "workspaceContains:*.xml" - ], - "main": "./out/src/extension", - "contributes": { - "languages": [ - { - "id": "xml", - "extensions": [ - ".xml" - ], - "configuration": "./language-configuration.json" - } - ] - }, - "scripts": { - "vscode:prepublish": "tsc -p ./", - "compile": "tsc -watch -p ./", - "preinstall": "node ./scripts/preinstall.js", - "postinstall": "node ./node_modules/vscode/bin/install", - "test": "node ./node_modules/vscode/bin/test", - "tslint": "gulp tslint" - }, - "devDependencies": { - "typescript": "^2.0.3", - "vscode": "^1.1.10", - "mocha": "^2.3.3", - "@types/node": "^6.0.40", - "@types/mocha": "^2.2.32", - "@types/glob": "5.0.30", - "gulp": "^3.9.1", - "gulp-tslint": "^6.1.2", - "tslint": "^3.15.1" - }, - "dependencies": { - "vscode-languageclient": "^3.5.0", - "find-java-home": "0.1.4", - "http-proxy-agent": "^1.0.0", - "https-proxy-agent": "^1.0.0", - "tmp": "^0.0.31", - "decompress": "^4.0.0", - "progress-stream": "^1.2.0", - "path-exists": "^3.0.0", - "expand-home-dir": "^0.0.3", - "glob": "^7.1.1", - "download": "^6.2.5" - } -} diff --git a/clients/vscode/scripts/preinstall.js b/clients/vscode/scripts/preinstall.js deleted file mode 100644 index 3b2667a..0000000 --- a/clients/vscode/scripts/preinstall.js +++ /dev/null @@ -1,8 +0,0 @@ -'use strict'; -const fs = require('fs'); -const download = require('download') -var url = "https://github.com/apupier/camel-language-server/releases/download/untagged-5a182c0119681071de73/camel-lsp-server-1.0.0-SNAPSHOT.jar" - -download(url).then(data => { - fs.writeFileSync('./jars/language-server.jar', data); -}); diff --git a/clients/vscode/src/extension.ts b/clients/vscode/src/extension.ts deleted file mode 100644 index e640832..0000000 --- a/clients/vscode/src/extension.ts +++ /dev/null @@ -1,230 +0,0 @@ -'use strict'; - -import * as path from 'path'; -import { workspace, ExtensionContext, window, StatusBarAlignment, commands, ViewColumn, Uri, CancellationToken, TextDocumentContentProvider, TextEditor, WorkspaceConfiguration, languages, IndentAction } from 'vscode'; -import { LanguageClient, LanguageClientOptions, Executable } from 'vscode-languageclient'; - -var os = require('os'); -import { StatusNotification,ClassFileContentsRequest,ProjectConfigurationUpdateRequest,MessageType,ActionableNotification,FeatureStatus } from './protocol'; - -var storagePath; -var oldConfig; - -var lastStatus; - -const LANGUAGE_CLIENT_ID = 'LANGUAGE_ID_APACHE_CAMEL'; - -export function activate(context: ExtensionContext) { - // Let's enable Javadoc symbols autocompletion, shamelessly copied from MIT licensed code at - // https://github.com/Microsoft/vscode/blob/9d611d4dfd5a4a101b5201b8c9e21af97f06e7a7/extensions/typescript/src/typescriptMain.ts#L186 - languages.setLanguageConfiguration('xml', { - wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g, - }); - - storagePath = context.storagePath; - if (!storagePath) { - storagePath = getTempWorkspace(); - } - - var path = require('path'); - var camelLanguageServerPath = context.asAbsolutePath(path.join('jars','language-server.jar')); - console.log(camelLanguageServerPath); - - let serverOptions: Executable = { - command: 'java', - args: [ '-jar', camelLanguageServerPath], - options: {stdio:'pipe'} - }; - - // Options to control the language client - let clientOptions: LanguageClientOptions = { - // Register the server for xml - documentSelector: ['xml'], - synchronize: { - configurationSection: 'xml', - // Notify the server about file changes to .xml files contain in the workspace - fileEvents: [ - workspace.createFileSystemWatcher('**/*.xml'), - ], - } - }; - - let item = window.createStatusBarItem(StatusBarAlignment.Right, Number.MIN_VALUE); - oldConfig = getServerConfiguration(); - // Create the language client and start the client. - let languageClient = new LanguageClient(LANGUAGE_CLIENT_ID,'Language Support for Apache Camel', serverOptions, clientOptions); - languageClient.onReady().then(() => { - languageClient.onNotification(StatusNotification.type, (report) => { - console.log(report.message); - switch (report.type) { - case 'Started': - item.text = '$(thumbsup)'; - lastStatus = item.text; - break; - case 'Error': - item.text = '$(thumbsdown)'; - lastStatus = item.text; - break; - case 'Message': - item.text = report.message; - setTimeout(()=> {item.text = lastStatus;}, 3000); - break; - } - item.command = 'java.open.output'; - item.tooltip = report.message; - toggleItem(window.activeTextEditor, item); - }); - languageClient.onNotification(ActionableNotification.type, (notification) => { - let show = null; - console.log(notification.message); - switch (notification.severity) { - case MessageType.Log: - show = logNotification; - break; - case MessageType.Info: - show = window.showInformationMessage; - break; - case MessageType.Warning: - show = window.showWarningMessage; - break; - case MessageType.Error: - show = window.showErrorMessage; - break; - } - if (!show) { - return; - } - const titles = notification.commands.map(a => a.title); - - show(notification.message, ...titles).then((selection )=>{ - for(let action of notification.commands) { - if (action.title === selection) { - let args:any[] = (action.arguments)?action.arguments:[]; - commands.executeCommand(action.command, ...args); - break; - } - } - }); - }); - - commands.registerCommand('java.open.output', ()=>{ - languageClient.outputChannel.show(ViewColumn.Three); - }); - - window.onDidChangeActiveTextEditor((editor) =>{ - toggleItem(editor, item); - }); - - let provider: TextDocumentContentProvider= { - onDidChange: null, - provideTextDocumentContent: (uri: Uri, token: CancellationToken): Thenable => { - return languageClient.sendRequest(ClassFileContentsRequest.type, { uri: uri.toString() }, token).then((v: string):string => { - return v || ''; - }); - } - }; - workspace.registerTextDocumentContentProvider('xml', provider); - - item.text = 'Starting Apache Camel Language Server...'; - toggleItem(window.activeTextEditor, item); -}); - let disposable = languageClient.start(); - // Push the disposable to the context's subscriptions so that the - // client can be deactivated on extension deactivation - context.subscriptions.push(disposable); -} - -function logNotification(message:string, ...items: string[]) { - return new Promise((resolve, reject) => { - console.log(message); - }); -} - -function setIncompleteClasspathSeverity(severity:string) { - const config = getServerConfiguration(); - const section = 'errors.incompleteClasspath.severity'; - config.update(section, severity, true).then( - () => console.log(section + ' globally set to '+severity), - (error) => console.log(error) - ); -} - -function projectConfigurationUpdate(languageClient:LanguageClient, uri?: Uri) { - let resource = uri; - if (!(resource instanceof Uri)) { - if (window.activeTextEditor) { - resource = window.activeTextEditor.document.uri; - } - } -} - -function setProjectConfigurationUpdate(languageClient:LanguageClient, uri: Uri, status:FeatureStatus) { - const config = getServerConfiguration(); - const section = 'configuration.updateBuildConfiguration'; - - const st = FeatureStatus[status]; - config.update(section, st).then( - () => console.log(section + ' set to '+st), - (error) => console.log(error) - ); - if (status !== FeatureStatus.disabled) { - projectConfigurationUpdate(languageClient, uri); - } -} -function toggleItem(editor: TextEditor, item) { - if(editor && editor.document && - (editor.document.languageId === 'xml')){ - item.show(); - } else{ - item.hide(); - } -} - -function hasConfigKeyChanged(key, oldConfig, newConfig) { - return oldConfig.get(key) !== newConfig.get(key); -} - -export function parseVMargs(params:any[], vmargsLine:string) { - if (!vmargsLine) { - return; - } - let vmargs = vmargsLine.match(/(?:[^\s"]+|"[^"]*")+/g); - if (vmargs === null) { - return; - } - vmargs.forEach (arg => { - //remove all standalone double quotes - arg = arg.replace( /(\\)?"/g, function ($0, $1) { return ($1 ? $0 : ''); }); - //unescape all escaped double quotes - arg = arg.replace( /(\\)"/g, '"'); - if (params.indexOf(arg) < 0) { - params.push(arg); - } - }); -} - -function getTempWorkspace() { - return path.resolve(os.tmpdir(),'vscodesws_'+makeRandomHexString(5)); -} - -function makeRandomHexString(length) { - var chars = ['0', '1', '2', '3', '4', '5', '6', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f']; - var result = ''; - for (var i = 0; i < length; i++) { - var idx = Math.floor(chars.length * Math.random()); - result += chars[idx]; - } - return result; -} - -function startedInDebugMode(): boolean { - let args = (process as any).execArgv; - if (args) { - return args.some((arg) => /^--debug=?/.test(arg) || /^--debug-brk=?/.test(arg)); - }; - return false; -} - -function getServerConfiguration():WorkspaceConfiguration { - return workspace.getConfiguration('xml'); -} diff --git a/clients/vscode/src/protocol.ts b/clients/vscode/src/protocol.ts deleted file mode 100644 index 45c139f..0000000 --- a/clients/vscode/src/protocol.ts +++ /dev/null @@ -1,72 +0,0 @@ -'use strict'; - -import { RequestType, NotificationType, TextDocumentIdentifier} from 'vscode-languageclient'; -import { Command } from 'vscode'; - -/** - * The message type. Copied from vscode protocol - */ -export enum MessageType { - /** - * An error message. - */ - Error = 1, - /** - * A warning message. - */ - Warning = 2, - /** - * An information message. - */ - Info = 3, - /** - * A log message. - */ - Log = 4, -} - -/** - * A functionality status - */ -export enum FeatureStatus { - /** - * Disabled. - */ - disabled = 0, - /** - * Enabled manually. - */ - interactive = 1, - /** - * Enabled automatically. - */ - automatic = 2, -} - -export interface StatusReport { - message: string; - type: string; -} - -export interface ActionableMessage { - severity: MessageType; - message: string; - data?: any; - commands?: Command[]; -} - -export namespace StatusNotification { - export const type = new NotificationType('language/status'); -} - -export namespace ClassFileContentsRequest { - export const type= new RequestType ('java/classFileContents'); -} - -export namespace ProjectConfigurationUpdateRequest { - export const type = new NotificationType ('java/projectConfigurationUpdate'); -} - -export namespace ActionableNotification { - export const type = new NotificationType('language/actionableNotification'); -} \ No newline at end of file diff --git a/clients/vscode/test/apacheCamel.xml b/clients/vscode/test/apacheCamel.xml deleted file mode 100644 index db3acf5..0000000 --- a/clients/vscode/test/apacheCamel.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/clients/vscode/test/index.ts b/clients/vscode/test/index.ts deleted file mode 100644 index 335752d..0000000 --- a/clients/vscode/test/index.ts +++ /dev/null @@ -1,22 +0,0 @@ -// -// PLEASE DO NOT MODIFY / DELETE UNLESS YOU KNOW WHAT YOU ARE DOING -// -// This file is providing the test runner to use when running extension tests. -// By default the test runner in use is Mocha based. -// -// You can provide your own test runner if you want to override it by exporting -// a function run(testRoot: string, clb: (error:Error) => void) that the extension -// host can call to run the tests. The test runner is expected to use console.log -// to report the results back to the caller. When the tests are finished, return -// a possible error to the callback or null if none. - -var testRunner = require('vscode/lib/testrunner'); - -// You can directly control Mocha options by uncommenting the following lines -// See https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically#set-options for more info -testRunner.configure({ - ui: 'tdd', // the TDD UI is being used in extension.test.ts (suite, test, etc.) - useColors: true // colored output from test results -}); - -module.exports = testRunner; \ No newline at end of file diff --git a/clients/vscode/tsconfig.json b/clients/vscode/tsconfig.json deleted file mode 100644 index 5b5e439..0000000 --- a/clients/vscode/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "compilerOptions": { - "target": "es6", - "lib": [ - "es6" - ], - "module": "commonjs", - "moduleResolution": "node", - "outDir": "out", - "sourceMap": true - }, - "exclude": [ - "node_modules", - "server", - ".vscode-test" - ] -} \ No newline at end of file diff --git a/clients/vscode/tslint.json b/clients/vscode/tslint.json deleted file mode 100644 index 3233a4e..0000000 --- a/clients/vscode/tslint.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "rules": { - "no-unused-expression": true, - "no-duplicate-variable": true, - "no-duplicate-key": true, - "no-unused-variable": true, - "curly": true, - "class-name": true, - "semicolon": ["always"], - "triple-equals": true, - "quotemark": [true, "single", "avoid-escape"] - } -} \ No newline at end of file diff --git a/clients/eclipse/org.apache.camel.lsp.eclipse.client.tests.integration/.classpath b/org.apache.camel.lsp.eclipse.client.tests.integration/.classpath similarity index 100% rename from clients/eclipse/org.apache.camel.lsp.eclipse.client.tests.integration/.classpath rename to org.apache.camel.lsp.eclipse.client.tests.integration/.classpath diff --git a/clients/eclipse/org.apache.camel.lsp.eclipse.client.tests.integration/.project b/org.apache.camel.lsp.eclipse.client.tests.integration/.project similarity index 100% rename from clients/eclipse/org.apache.camel.lsp.eclipse.client.tests.integration/.project rename to org.apache.camel.lsp.eclipse.client.tests.integration/.project diff --git a/clients/eclipse/org.apache.camel.lsp.eclipse.client.tests.integration/META-INF/MANIFEST.MF b/org.apache.camel.lsp.eclipse.client.tests.integration/META-INF/MANIFEST.MF similarity index 100% rename from clients/eclipse/org.apache.camel.lsp.eclipse.client.tests.integration/META-INF/MANIFEST.MF rename to org.apache.camel.lsp.eclipse.client.tests.integration/META-INF/MANIFEST.MF diff --git a/clients/eclipse/org.apache.camel.lsp.eclipse.client.tests.integration/build.properties b/org.apache.camel.lsp.eclipse.client.tests.integration/build.properties similarity index 100% rename from clients/eclipse/org.apache.camel.lsp.eclipse.client.tests.integration/build.properties rename to org.apache.camel.lsp.eclipse.client.tests.integration/build.properties diff --git a/clients/eclipse/org.apache.camel.lsp.eclipse.client.tests.integration/infinitest.filters b/org.apache.camel.lsp.eclipse.client.tests.integration/infinitest.filters similarity index 100% rename from clients/eclipse/org.apache.camel.lsp.eclipse.client.tests.integration/infinitest.filters rename to org.apache.camel.lsp.eclipse.client.tests.integration/infinitest.filters diff --git a/org.apache.camel.lsp.eclipse.client.tests.integration/log-camel-lsp.out b/org.apache.camel.lsp.eclipse.client.tests.integration/log-camel-lsp.out new file mode 100644 index 0000000..886a369 --- /dev/null +++ b/org.apache.camel.lsp.eclipse.client.tests.integration/log-camel-lsp.out @@ -0,0 +1,18 @@ +Setting client pid to {0} +didOpen: {0} +didClose: TextDocumentIdentifier [ + uri = "file:///home/lheinema/git/camel-lsp-client-eclipse/org.apache.camel.lsp.eclipse.client.tests.integration/target/work%20sp@cé/CamelLSPLoadedByExtensionPointIT/camelFile.xml" +] +Shutting down language server +Setting client pid to {0} +didOpen: {0} +didClose: TextDocumentIdentifier [ + uri = "file:///home/lheinema/git/camel-lsp-client-eclipse/org.apache.camel.lsp.eclipse.client.tests.integration/target/work%20sp@cé/CamelLSPLoadedByExtensionPointIT/camelFile.xml" +] +Shutting down language server +Setting client pid to {0} +didOpen: {0} +didClose: TextDocumentIdentifier [ + uri = "file:///home/lheinema/git/camel-lsp-client-eclipse/org.apache.camel.lsp.eclipse.client.tests.integration/target/work%20sp@cé/CamelLSPLoadedByExtensionPointIT/camelFile.xml" +] +Shutting down language server diff --git a/clients/eclipse/org.apache.camel.lsp.eclipse.client.tests.integration/pom.xml b/org.apache.camel.lsp.eclipse.client.tests.integration/pom.xml similarity index 100% rename from clients/eclipse/org.apache.camel.lsp.eclipse.client.tests.integration/pom.xml rename to org.apache.camel.lsp.eclipse.client.tests.integration/pom.xml diff --git a/clients/eclipse/org.apache.camel.lsp.eclipse.client.tests.integration/src/main/java/org/apache/camel/lsp/eclipse/client/tests/integration/CamelLSPLoadedByExtensionPointIT.java b/org.apache.camel.lsp.eclipse.client.tests.integration/src/main/java/org/apache/camel/lsp/eclipse/client/tests/integration/CamelLSPLoadedByExtensionPointIT.java similarity index 100% rename from clients/eclipse/org.apache.camel.lsp.eclipse.client.tests.integration/src/main/java/org/apache/camel/lsp/eclipse/client/tests/integration/CamelLSPLoadedByExtensionPointIT.java rename to org.apache.camel.lsp.eclipse.client.tests.integration/src/main/java/org/apache/camel/lsp/eclipse/client/tests/integration/CamelLSPLoadedByExtensionPointIT.java diff --git a/clients/eclipse/org.apache.camel.lsp.eclipse.client.tests.integration/src/main/java/org/apache/camel/lsp/eclipse/client/tests/integration/CamelLSPStreamConnectionProviderIT.java b/org.apache.camel.lsp.eclipse.client.tests.integration/src/main/java/org/apache/camel/lsp/eclipse/client/tests/integration/CamelLSPStreamConnectionProviderIT.java similarity index 95% rename from clients/eclipse/org.apache.camel.lsp.eclipse.client.tests.integration/src/main/java/org/apache/camel/lsp/eclipse/client/tests/integration/CamelLSPStreamConnectionProviderIT.java rename to org.apache.camel.lsp.eclipse.client.tests.integration/src/main/java/org/apache/camel/lsp/eclipse/client/tests/integration/CamelLSPStreamConnectionProviderIT.java index 3199752..44b726f 100644 --- a/clients/eclipse/org.apache.camel.lsp.eclipse.client.tests.integration/src/main/java/org/apache/camel/lsp/eclipse/client/tests/integration/CamelLSPStreamConnectionProviderIT.java +++ b/org.apache.camel.lsp.eclipse.client.tests.integration/src/main/java/org/apache/camel/lsp/eclipse/client/tests/integration/CamelLSPStreamConnectionProviderIT.java @@ -19,6 +19,7 @@ import static org.assertj.core.api.Assertions.assertThat; +import java.io.IOException; import java.io.InputStream; import org.apache.camel.lsp.eclipse.client.CamelLSPStreamConnectionProvider; @@ -27,7 +28,7 @@ public class CamelLSPStreamConnectionProviderIT { @Test - public void testStart() throws Exception { + public void testStart() throws IOException { CamelLSPStreamConnectionProvider provider = new CamelLSPStreamConnectionProvider(); provider.start(); InputStream inputStream = provider.getInputStream(); diff --git a/clients/eclipse/org.apache.camel.lsp.eclipse.client/.classpath b/org.apache.camel.lsp.eclipse.client/.classpath similarity index 100% rename from clients/eclipse/org.apache.camel.lsp.eclipse.client/.classpath rename to org.apache.camel.lsp.eclipse.client/.classpath diff --git a/clients/eclipse/org.apache.camel.lsp.eclipse.client/.project b/org.apache.camel.lsp.eclipse.client/.project similarity index 100% rename from clients/eclipse/org.apache.camel.lsp.eclipse.client/.project rename to org.apache.camel.lsp.eclipse.client/.project diff --git a/clients/eclipse/org.apache.camel.lsp.eclipse.client/META-INF/MANIFEST.MF b/org.apache.camel.lsp.eclipse.client/META-INF/MANIFEST.MF similarity index 100% rename from clients/eclipse/org.apache.camel.lsp.eclipse.client/META-INF/MANIFEST.MF rename to org.apache.camel.lsp.eclipse.client/META-INF/MANIFEST.MF diff --git a/clients/eclipse/org.apache.camel.lsp.eclipse.client/OSGI-INF/l10n/bundle.properties b/org.apache.camel.lsp.eclipse.client/OSGI-INF/l10n/bundle.properties similarity index 100% rename from clients/eclipse/org.apache.camel.lsp.eclipse.client/OSGI-INF/l10n/bundle.properties rename to org.apache.camel.lsp.eclipse.client/OSGI-INF/l10n/bundle.properties diff --git a/clients/eclipse/org.apache.camel.lsp.eclipse.client/build.properties b/org.apache.camel.lsp.eclipse.client/build.properties similarity index 100% rename from clients/eclipse/org.apache.camel.lsp.eclipse.client/build.properties rename to org.apache.camel.lsp.eclipse.client/build.properties diff --git a/clients/eclipse/org.apache.camel.lsp.eclipse.client/plugin.xml b/org.apache.camel.lsp.eclipse.client/plugin.xml similarity index 100% rename from clients/eclipse/org.apache.camel.lsp.eclipse.client/plugin.xml rename to org.apache.camel.lsp.eclipse.client/plugin.xml diff --git a/clients/eclipse/org.apache.camel.lsp.eclipse.client/pom.xml b/org.apache.camel.lsp.eclipse.client/pom.xml similarity index 100% rename from clients/eclipse/org.apache.camel.lsp.eclipse.client/pom.xml rename to org.apache.camel.lsp.eclipse.client/pom.xml diff --git a/clients/eclipse/org.apache.camel.lsp.eclipse.client/src/org/apache/camel/lsp/eclipse/client/ActivatorCamelLspClient.java b/org.apache.camel.lsp.eclipse.client/src/org/apache/camel/lsp/eclipse/client/ActivatorCamelLspClient.java similarity index 100% rename from clients/eclipse/org.apache.camel.lsp.eclipse.client/src/org/apache/camel/lsp/eclipse/client/ActivatorCamelLspClient.java rename to org.apache.camel.lsp.eclipse.client/src/org/apache/camel/lsp/eclipse/client/ActivatorCamelLspClient.java diff --git a/clients/eclipse/org.apache.camel.lsp.eclipse.client/src/org/apache/camel/lsp/eclipse/client/CamelLSPStreamConnectionProvider.java b/org.apache.camel.lsp.eclipse.client/src/org/apache/camel/lsp/eclipse/client/CamelLSPStreamConnectionProvider.java similarity index 86% rename from clients/eclipse/org.apache.camel.lsp.eclipse.client/src/org/apache/camel/lsp/eclipse/client/CamelLSPStreamConnectionProvider.java rename to org.apache.camel.lsp.eclipse.client/src/org/apache/camel/lsp/eclipse/client/CamelLSPStreamConnectionProvider.java index 7749489..93fa0d1 100644 --- a/clients/eclipse/org.apache.camel.lsp.eclipse.client/src/org/apache/camel/lsp/eclipse/client/CamelLSPStreamConnectionProvider.java +++ b/org.apache.camel.lsp.eclipse.client/src/org/apache/camel/lsp/eclipse/client/CamelLSPStreamConnectionProvider.java @@ -21,6 +21,7 @@ import java.net.URISyntaxException; import java.net.URL; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import org.eclipse.core.runtime.FileLocator; @@ -32,6 +33,8 @@ public class CamelLSPStreamConnectionProvider extends ProcessStreamConnectionProvider { + private static final String DEBUG_FLAG = "debugLSPServer"; + public CamelLSPStreamConnectionProvider() { super(computeCommands(), computeWorkingDir()); } @@ -43,6 +46,7 @@ private static String computeWorkingDir() { private static List computeCommands() { List commands = new ArrayList<>(); commands.add("java"); + if (isDebugEnabled()) commands.addAll(debugArguments()); commands.add("-jar"); commands.add(computeCamelLanguageServerJarPath()); return commands; @@ -65,4 +69,11 @@ private static String computeCamelLanguageServerJarPath() { return camelLanguageServerJarPath; } + private static boolean isDebugEnabled() { + return Boolean.parseBoolean(System.getProperty(DEBUG_FLAG, "false")); + } + + private static List debugArguments() { + return Arrays.asList("-Xdebug","-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=3000"); + } } diff --git a/clients/eclipse/org.apache.camel.lsp.eclipse.client/src/org/apache/camel/lsp/eclipse/xml/completion/CamelURICompletionProposalComputer.java b/org.apache.camel.lsp.eclipse.client/src/org/apache/camel/lsp/eclipse/xml/completion/CamelURICompletionProposalComputer.java similarity index 100% rename from clients/eclipse/org.apache.camel.lsp.eclipse.client/src/org/apache/camel/lsp/eclipse/xml/completion/CamelURICompletionProposalComputer.java rename to org.apache.camel.lsp.eclipse.client/src/org/apache/camel/lsp/eclipse/xml/completion/CamelURICompletionProposalComputer.java diff --git a/clients/eclipse/org.apache.camel.lsp.eclipse.updatesite/.project b/org.apache.camel.lsp.eclipse.updatesite/.project similarity index 100% rename from clients/eclipse/org.apache.camel.lsp.eclipse.updatesite/.project rename to org.apache.camel.lsp.eclipse.updatesite/.project diff --git a/clients/eclipse/org.apache.camel.lsp.eclipse.updatesite/category.xml b/org.apache.camel.lsp.eclipse.updatesite/category.xml similarity index 100% rename from clients/eclipse/org.apache.camel.lsp.eclipse.updatesite/category.xml rename to org.apache.camel.lsp.eclipse.updatesite/category.xml diff --git a/clients/eclipse/org.apache.camel.lsp.eclipse.updatesite/pom.xml b/org.apache.camel.lsp.eclipse.updatesite/pom.xml similarity index 100% rename from clients/eclipse/org.apache.camel.lsp.eclipse.updatesite/pom.xml rename to org.apache.camel.lsp.eclipse.updatesite/pom.xml diff --git a/pom.xml b/pom.xml index d8b20f7..6be10b4 100644 --- a/pom.xml +++ b/pom.xml @@ -1,13 +1,17 @@ + 4.0.0 + org.apache.camel.tools.lsp - parent + eclipse 1.0.0-SNAPSHOT + ${base.name} :: Clients :: Eclipse Client pom - ${base.name} :: Parent + + 1.0.0 Apache Camel Language Server UTF-8 @@ -22,12 +26,36 @@ ../../../target/jacoco-it.exec ${sonar.jacoco.reportPath},${sonar.jacoco.itReportPath} + - server - clients + camel-lsp-target-platform + org.apache.camel.lsp.eclipse.client + org.apache.camel.lsp.eclipse.client.tests.integration + org.apache.camel.lsp.eclipse.updatesite + + + org.eclipse.tycho + tycho-maven-plugin + ${tycho.version} + true + + + org.eclipse.tycho + target-platform-configuration + ${tycho.version} + + + + ${project.groupId} + camel-lsp-target-platform + ${project.version} + + + + org.jacoco jacoco-maven-plugin diff --git a/server/.classpath b/server/.classpath deleted file mode 100644 index ace8266..0000000 --- a/server/.classpath +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/server/.project b/server/.project deleted file mode 100644 index 87d0a53..0000000 --- a/server/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - Camel LSP Server Impl - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/server/.settings/org.eclipse.core.resources.prefs b/server/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 29abf99..0000000 --- a/server/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,6 +0,0 @@ -eclipse.preferences.version=1 -encoding//src/main/java=UTF-8 -encoding//src/main/resources=UTF-8 -encoding//src/test/java=UTF-8 -encoding//src/test/resources=UTF-8 -encoding/=UTF-8 diff --git a/server/.settings/org.eclipse.jdt.core.prefs b/server/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 714351a..0000000 --- a/server/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.8 diff --git a/server/.settings/org.eclipse.m2e.core.prefs b/server/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index f897a7f..0000000 --- a/server/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/server/pom.xml b/server/pom.xml deleted file mode 100644 index fccbd8c..0000000 --- a/server/pom.xml +++ /dev/null @@ -1,75 +0,0 @@ - - 4.0.0 - - org.apache.camel.tools.lsp - parent - 1.0.0-SNAPSHOT - - camel-lsp-server - ${base.name} :: Server Implementation - - 0.3.0 - 2.20.2 - - - - - org.springframework.boot - spring-boot-maven-plugin - 1.4.0.RELEASE - - - - repackage - - - - - - - - - org.eclipse.lsp4j - org.eclipse.lsp4j.jsonrpc - ${lsp4j.version} - - - org.eclipse.lsp4j - org.eclipse.lsp4j - ${lsp4j.version} - - - org.slf4j - slf4j-api - 1.7.6 - - - org.slf4j - slf4j-log4j12 - 1.7.6 - - - org.apache.camel - camel-catalog - ${camel.version} - - - org.apache.camel - camel-route-parser - ${camel.version} - - - junit - junit - 4.12 - test - - - org.assertj - assertj-core - 3.8.0 - test - - - diff --git a/server/src/main/java/org/apache/camel/tools/lsp/internal/AbstractLanguageServer.java b/server/src/main/java/org/apache/camel/tools/lsp/internal/AbstractLanguageServer.java deleted file mode 100644 index 848d709..0000000 --- a/server/src/main/java/org/apache/camel/tools/lsp/internal/AbstractLanguageServer.java +++ /dev/null @@ -1,163 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.tools.lsp.internal; - -import java.io.IOException; - -import org.eclipse.lsp4j.services.TextDocumentService; -import org.eclipse.lsp4j.services.WorkspaceService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author lhein - */ -public abstract class AbstractLanguageServer { - - private static final String OS = System.getProperty("os.name").toLowerCase(); - - private final class CamelServerRunnable implements Runnable { - @Override - public void run() { - LOGGER.info("Starting Camel Language Server..."); - while (!shutdown && parentProcessStillRunning()) { - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - LOGGER.error(e.getMessage(), e); - Thread.currentThread().interrupt(); - } - } - LOGGER.info("Camel Language Server - Client vanished..."); - } - } - - private static final Logger LOGGER = LoggerFactory.getLogger(AbstractLanguageServer.class); - - private Thread runner; - private volatile boolean shutdown; - private long parentProcessId; - private WorkspaceService workspaceService; - private TextDocumentService textDocumentService; - - /** - * starts the language server process - * - * @return the exit code of the process - */ - public int startServer() { - runner = new Thread(new CamelServerRunnable(), "Camel Language Client Watcher"); - runner.start(); - return 0; - } - - /** - * Checks whether the parent process is still running. - * If not, then we assume it has crashed, and we have to terminate the Camel Language Server. - * - * @return true if the parent process is still running - */ - protected boolean parentProcessStillRunning() { - // Wait until parent process id is available - - if (parentProcessId == 0) { - LOGGER.info("Waiting for a client connection..."); - } else { - LOGGER.info("Checking for client process pid: {0}", parentProcessId); - } - - if (parentProcessId == 0) return true; - - String command; - if (OS.indexOf("win") != -1) { // && "x86".equals(ARCH) - command = "cmd /c \"tasklist /FI \"PID eq " + parentProcessId + "\" | findstr " + parentProcessId + "\""; - } else { - command = "ps -p " + parentProcessId; - } - try { - Process process = Runtime.getRuntime().exec(command); - int processResult = process.waitFor(); - return processResult == 0; - } catch (IOException | InterruptedException e) { - LOGGER.error(e.getMessage(), e); - return true; - } - } - - /** - * stops the server - */ - public void stopServer() { - LOGGER.info("Stopping language server"); - runner.interrupt(); - } - - /** - * shuts the server down - */ - public void shutdownServer() { - LOGGER.info("Shutting down language server"); - shutdown = true; - } - - /** - * returns the parent process id - * - * @return - */ - protected synchronized long getParentProcessId() { - return parentProcessId; - } - - /** - * sets the parent process id - * - * @param processId - */ - protected synchronized void setParentProcessId(long processId) { - LOGGER.info("Setting client pid to {0}", processId); - parentProcessId = processId; - } - - /** - * @return the textDocumentService - */ - public TextDocumentService getTextDocumentService() { - return this.textDocumentService; - } - - /** - * @param textDocumentService the textDocumentService to set - */ - protected void setTextDocumentService(TextDocumentService textDocumentService) { - this.textDocumentService = textDocumentService; - } - - /** - * @return the workspaceService - */ - protected WorkspaceService getWorkspaceService() { - return this.workspaceService; - } - - /** - * @param workspaceService the workspaceService to set - */ - protected void setWorkspaceService(WorkspaceService workspaceService) { - this.workspaceService = workspaceService; - } -} diff --git a/server/src/main/java/org/apache/camel/tools/lsp/internal/CamelLanguageServer.java b/server/src/main/java/org/apache/camel/tools/lsp/internal/CamelLanguageServer.java deleted file mode 100644 index c07d4da..0000000 --- a/server/src/main/java/org/apache/camel/tools/lsp/internal/CamelLanguageServer.java +++ /dev/null @@ -1,120 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.tools.lsp.internal; - -import java.util.Arrays; -import java.util.concurrent.CompletableFuture; - -import org.eclipse.lsp4j.CompletionOptions; -import org.eclipse.lsp4j.InitializeParams; -import org.eclipse.lsp4j.InitializeResult; -import org.eclipse.lsp4j.MessageParams; -import org.eclipse.lsp4j.MessageType; -import org.eclipse.lsp4j.ServerCapabilities; -import org.eclipse.lsp4j.TextDocumentSyncKind; -import org.eclipse.lsp4j.services.LanguageClient; -import org.eclipse.lsp4j.services.LanguageClientAware; -import org.eclipse.lsp4j.services.LanguageServer; -import org.eclipse.lsp4j.services.WorkspaceService; - -/** - * this is the actual server implementation - * - * @author lhein - */ -public class CamelLanguageServer extends AbstractLanguageServer implements LanguageServer, LanguageClientAware { - - public static final String LANGUAGE_ID = "LANGUAGE_ID_APACHE_CAMEL"; - - private LanguageClient client; - - public CamelLanguageServer() { - super.setTextDocumentService(new CamelTextDocumentService()); - super.setWorkspaceService(new CamelWorkspaceService()); - } - - @Override - public void connect(LanguageClient client) { - this.client = client; - sendLogMessageNotification(MessageType.Info, "Connected to Language Server..."); - } - - @Override - public void exit() { - super.stopServer(); - System.exit(0); - } - - @Override - public CompletableFuture initialize(InitializeParams params) { - sendLogMessageNotification(MessageType.Info, "Initializing capabilities of the server..."); - Integer processId = params.getProcessId(); - if(processId != null) { - setParentProcessId(processId.longValue()); - } else { - sendLogMessageNotification(MessageType.Info, "Missing Parent process ID!!"); - setParentProcessId(0); - } - - InitializeResult result = new InitializeResult(); - - ServerCapabilities capabilities = new ServerCapabilities(); - capabilities.setTextDocumentSync(TextDocumentSyncKind.Full); - capabilities.setCompletionProvider(new CompletionOptions(Boolean.TRUE, Arrays.asList(".","?","&", "\"", "="))); - capabilities.setHoverProvider(Boolean.TRUE); - - result.setCapabilities(capabilities); - return CompletableFuture.completedFuture(result); - } - - @Override - public CompletableFuture shutdown() { - super.shutdownServer(); - return CompletableFuture.completedFuture(new Object()); - } - - @Override - public WorkspaceService getWorkspaceService() { - return super.getWorkspaceService(); - } - - /** - * Sends the given log message notification back to the client - * as a notification - * - * @param type - * the type of message - * @param msg - * The message to send back to the client - */ - public void sendLogMessageNotification(final MessageType type, final String msg) { - client.logMessage(new MessageParams(type, msg)); - } - - /** - * Sends the given show message notification back to the client - * as a notification - * - * @param type - * the type of message - * @param msg - * The message to send back to the client - */ - public void sendShowMessageNotification(final MessageType type, final String msg) { - client.showMessage(new MessageParams(type, msg)); - } -} diff --git a/server/src/main/java/org/apache/camel/tools/lsp/internal/CamelTextDocumentService.java b/server/src/main/java/org/apache/camel/tools/lsp/internal/CamelTextDocumentService.java deleted file mode 100644 index 389c884..0000000 --- a/server/src/main/java/org/apache/camel/tools/lsp/internal/CamelTextDocumentService.java +++ /dev/null @@ -1,197 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.tools.lsp.internal; - -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.CompletableFuture; - -import org.apache.camel.catalog.CamelCatalog; -import org.apache.camel.catalog.DefaultCamelCatalog; -import org.apache.camel.tools.lsp.internal.completion.CamelEndpointCompletionProcessor; -import org.apache.camel.tools.lsp.internal.hover.HoverProcessor; -import org.eclipse.lsp4j.CodeActionParams; -import org.eclipse.lsp4j.CodeLens; -import org.eclipse.lsp4j.CodeLensParams; -import org.eclipse.lsp4j.Command; -import org.eclipse.lsp4j.CompletionItem; -import org.eclipse.lsp4j.CompletionList; -import org.eclipse.lsp4j.DidChangeTextDocumentParams; -import org.eclipse.lsp4j.DidCloseTextDocumentParams; -import org.eclipse.lsp4j.DidOpenTextDocumentParams; -import org.eclipse.lsp4j.DidSaveTextDocumentParams; -import org.eclipse.lsp4j.DocumentFormattingParams; -import org.eclipse.lsp4j.DocumentHighlight; -import org.eclipse.lsp4j.DocumentOnTypeFormattingParams; -import org.eclipse.lsp4j.DocumentRangeFormattingParams; -import org.eclipse.lsp4j.DocumentSymbolParams; -import org.eclipse.lsp4j.Hover; -import org.eclipse.lsp4j.Location; -import org.eclipse.lsp4j.ReferenceParams; -import org.eclipse.lsp4j.RenameParams; -import org.eclipse.lsp4j.SignatureHelp; -import org.eclipse.lsp4j.SymbolInformation; -import org.eclipse.lsp4j.TextDocumentContentChangeEvent; -import org.eclipse.lsp4j.TextDocumentItem; -import org.eclipse.lsp4j.TextDocumentPositionParams; -import org.eclipse.lsp4j.TextEdit; -import org.eclipse.lsp4j.WorkspaceEdit; -import org.eclipse.lsp4j.jsonrpc.messages.Either; -import org.eclipse.lsp4j.services.TextDocumentService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author lhein - */ -public class CamelTextDocumentService implements TextDocumentService { - - private static final Logger LOGGER = LoggerFactory.getLogger(CamelTextDocumentService.class); - private Map openedDocuments = new HashMap<>(); - private CompletableFuture camelCatalog; - - public CamelTextDocumentService() { - camelCatalog = CompletableFuture.supplyAsync(() -> { - DefaultCamelCatalog res = new DefaultCamelCatalog(true); - res.loadVersion("2.20.2"); - return res; - }); - } - - @Override - public CompletableFuture, CompletionList>> completion(TextDocumentPositionParams completionRequest) { - LOGGER.info("completion: " + completionRequest.getTextDocument().getUri()); - TextDocumentItem textDocumentItem = openedDocuments.get(completionRequest.getTextDocument().getUri()); - return new CamelEndpointCompletionProcessor(textDocumentItem, camelCatalog).getCompletions(completionRequest.getPosition()).thenApply(Either::forLeft); - } - - @Override - public CompletableFuture resolveCompletionItem(CompletionItem unresolved) { - LOGGER.info("resolveCompletionItem: " + unresolved.getDetail()); - return CompletableFuture.completedFuture(unresolved); - } - - @Override - public CompletableFuture hover(TextDocumentPositionParams position) { - LOGGER.info("hover: " + position.getTextDocument()); - TextDocumentItem textDocumentItem = openedDocuments.get(position.getTextDocument().getUri()); - return new HoverProcessor(textDocumentItem, camelCatalog).getHover(position.getPosition()); - } - - @Override - public CompletableFuture signatureHelp(TextDocumentPositionParams position) { - LOGGER.info("signatureHelp: " + position.getTextDocument()); - return CompletableFuture.completedFuture(null); - } - - @Override - public CompletableFuture> definition(TextDocumentPositionParams position) { - LOGGER.info("definition: " + position.getTextDocument()); - return CompletableFuture.completedFuture(Collections.emptyList()); - } - - @Override - public CompletableFuture> references(ReferenceParams params) { - LOGGER.info("references: " + params.getTextDocument()); - return CompletableFuture.completedFuture(Collections.emptyList()); - } - - @Override - public CompletableFuture> documentHighlight(TextDocumentPositionParams position) { - LOGGER.info("documentHighlight: " + position.getTextDocument()); - return CompletableFuture.completedFuture(Collections.emptyList()); - } - - @Override - public CompletableFuture> documentSymbol(DocumentSymbolParams params) { - LOGGER.info("documentSymbol: " + params.getTextDocument()); - return CompletableFuture.completedFuture(Collections.emptyList()); - } - - @Override - public CompletableFuture> codeAction(CodeActionParams params) { - LOGGER.info("codeAction: " + params.getTextDocument()); - return CompletableFuture.completedFuture(Collections.emptyList()); - } - - @Override - public CompletableFuture> codeLens(CodeLensParams params) { - LOGGER.info("codeLens: " + params.getTextDocument()); - return CompletableFuture.completedFuture(Collections.emptyList()); - } - - @Override - public CompletableFuture resolveCodeLens(CodeLens unresolved) { - LOGGER.info("resolveCodeLens: " + unresolved.getCommand().getCommand()); - return CompletableFuture.completedFuture(null); - } - - @Override - public CompletableFuture> formatting(DocumentFormattingParams params) { - LOGGER.info("formatting: " + params.getTextDocument()); - return CompletableFuture.completedFuture(Collections.emptyList()); - } - - @Override - public CompletableFuture> rangeFormatting(DocumentRangeFormattingParams params) { - LOGGER.info("rangeFormatting: " + params.getTextDocument()); - return CompletableFuture.completedFuture(Collections.emptyList()); - } - - @Override - public CompletableFuture> onTypeFormatting(DocumentOnTypeFormattingParams params) { - LOGGER.info("onTypeFormatting: " + params.getTextDocument()); - return CompletableFuture.completedFuture(Collections.emptyList()); - } - - @Override - public CompletableFuture rename(RenameParams params) { - LOGGER.info("rename: " + params.getTextDocument()); - return CompletableFuture.completedFuture(null); - } - - @Override - public void didOpen(DidOpenTextDocumentParams params) { - TextDocumentItem textDocument = params.getTextDocument(); - LOGGER.info("didOpen: {0}", textDocument); - openedDocuments.put(textDocument.getUri(), textDocument); - } - - @Override - public void didChange(DidChangeTextDocumentParams params) { - LOGGER.info("didChange: " + params.getTextDocument()); - List contentChanges = params.getContentChanges(); - TextDocumentItem textDocumentItem = openedDocuments.get(params.getTextDocument().getUri()); - if (!contentChanges.isEmpty()) { - textDocumentItem.setText(contentChanges.get(0).getText()); - } - } - - @Override - public void didClose(DidCloseTextDocumentParams params) { - LOGGER.info("didClose: " + params.getTextDocument()); - openedDocuments.remove(params.getTextDocument().getUri()); - } - - @Override - public void didSave(DidSaveTextDocumentParams params) { - LOGGER.info("didSave: " + params.getTextDocument()); - } - -} diff --git a/server/src/main/java/org/apache/camel/tools/lsp/internal/CamelWorkspaceService.java b/server/src/main/java/org/apache/camel/tools/lsp/internal/CamelWorkspaceService.java deleted file mode 100644 index b193ce7..0000000 --- a/server/src/main/java/org/apache/camel/tools/lsp/internal/CamelWorkspaceService.java +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.tools.lsp.internal; - -import java.util.Collections; -import java.util.List; -import java.util.concurrent.CompletableFuture; - -import org.eclipse.lsp4j.DidChangeConfigurationParams; -import org.eclipse.lsp4j.DidChangeWatchedFilesParams; -import org.eclipse.lsp4j.FileEvent; -import org.eclipse.lsp4j.SymbolInformation; -import org.eclipse.lsp4j.WorkspaceSymbolParams; -import org.eclipse.lsp4j.services.WorkspaceService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author lhein - */ -public class CamelWorkspaceService implements WorkspaceService { - - private static final Logger LOGGER = LoggerFactory.getLogger(CamelWorkspaceService.class); - - @Override - public CompletableFuture> symbol(WorkspaceSymbolParams params) { - LOGGER.info("SERVER: symbolQuery: " + params.getQuery()); - return CompletableFuture.completedFuture(Collections.emptyList()); - } - - @Override - public void didChangeConfiguration(DidChangeConfigurationParams params) { - Object settings = params.getSettings(); - LOGGER.info("SERVER: changeConfig: settings -> {0}", settings); - } - - @Override - public void didChangeWatchedFiles(DidChangeWatchedFilesParams params) { - List settings = params.getChanges(); - LOGGER.info("SERVER: changeWatchedFiles: size -> {0}", settings.size()); - } -} diff --git a/server/src/main/java/org/apache/camel/tools/lsp/internal/Runner.java b/server/src/main/java/org/apache/camel/tools/lsp/internal/Runner.java deleted file mode 100644 index a5133ff..0000000 --- a/server/src/main/java/org/apache/camel/tools/lsp/internal/Runner.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.tools.lsp.internal; - -import org.eclipse.lsp4j.jsonrpc.Launcher; -import org.eclipse.lsp4j.services.LanguageClient; - -/** - * @author lhein - */ -public class Runner { - - public static void main(String[] args) { - CamelLanguageServer server = new CamelLanguageServer(); - Launcher launcher = Launcher.createLauncher(server, LanguageClient.class, System.in, System.out); - server.connect(launcher.getRemoteProxy()); - launcher.startListening(); - } -} diff --git a/server/src/main/java/org/apache/camel/tools/lsp/internal/completion/CamelComponentSchemaCompletionsFuture.java b/server/src/main/java/org/apache/camel/tools/lsp/internal/completion/CamelComponentSchemaCompletionsFuture.java deleted file mode 100644 index 177a69e..0000000 --- a/server/src/main/java/org/apache/camel/tools/lsp/internal/completion/CamelComponentSchemaCompletionsFuture.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.tools.lsp.internal.completion; - -import java.util.List; -import java.util.function.Function; -import java.util.stream.Collectors; - -import org.apache.camel.catalog.CamelCatalog; -import org.apache.camel.tools.lsp.internal.model.util.ModelHelper; -import org.eclipse.lsp4j.CompletionItem; - -public final class CamelComponentSchemaCompletionsFuture implements Function> { - @Override - public List apply(CamelCatalog catalog) { - return catalog.findComponentNames().stream() - .map(componentName -> ModelHelper.generateComponentModel(catalog.componentJSonSchema(componentName), true)) - .map(componentModel -> { - CompletionItem completionItem = new CompletionItem(componentModel.getSyntax()); - completionItem.setDocumentation(componentModel.getDescription()); - return completionItem; - }).collect(Collectors.toList()); - } -} \ No newline at end of file diff --git a/server/src/main/java/org/apache/camel/tools/lsp/internal/completion/CamelEndpointCompletionProcessor.java b/server/src/main/java/org/apache/camel/tools/lsp/internal/completion/CamelEndpointCompletionProcessor.java deleted file mode 100644 index 0906d09..0000000 --- a/server/src/main/java/org/apache/camel/tools/lsp/internal/completion/CamelEndpointCompletionProcessor.java +++ /dev/null @@ -1,65 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.tools.lsp.internal.completion; - -import java.util.Collections; -import java.util.List; -import java.util.concurrent.CompletableFuture; - -import org.apache.camel.catalog.CamelCatalog; -import org.apache.camel.tools.lsp.internal.parser.CamelURIInstance; -import org.apache.camel.tools.lsp.internal.parser.CamelUriElementInstance; -import org.apache.camel.tools.lsp.internal.parser.ParserFileHelper; -import org.eclipse.lsp4j.CompletionItem; -import org.eclipse.lsp4j.Position; -import org.eclipse.lsp4j.TextDocumentItem; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.w3c.dom.Node; - -public class CamelEndpointCompletionProcessor { - - private static final Logger LOGGER = LoggerFactory.getLogger(CamelEndpointCompletionProcessor.class); - private TextDocumentItem textDocumentItem; - private ParserFileHelper parserFileHelper = new ParserFileHelper(); - private CompletableFuture camelCatalog; - - public CamelEndpointCompletionProcessor(TextDocumentItem textDocumentItem, CompletableFuture camelCatalog) { - this.textDocumentItem = textDocumentItem; - this.camelCatalog = camelCatalog; - } - - public CompletableFuture> getCompletions(Position position) { - if(textDocumentItem != null) { - try { - Node correspondingCamelNode = parserFileHelper.getCorrespondingCamelNodeForCompletion(textDocumentItem, position.getLine()); - if (correspondingCamelNode != null) { - String line = parserFileHelper.getLine(textDocumentItem, position); - String camelComponentUri = parserFileHelper.getCamelComponentUri(textDocumentItem, position); - CamelURIInstance camelURIInstance = new CamelURIInstance(camelComponentUri, correspondingCamelNode); - int positionInCamelUri = position.getCharacter() - line.indexOf("uri=") - 5; - CamelUriElementInstance camelUriElementInstance = camelURIInstance.getSpecificElement(positionInCamelUri); - return camelUriElementInstance.getCompletions(camelCatalog, positionInCamelUri); - } - } catch (Exception e) { - LOGGER.error("Error searching for corresponding node elements", e); - } - } - return CompletableFuture.completedFuture(Collections.emptyList()); - } - -} diff --git a/server/src/main/java/org/apache/camel/tools/lsp/internal/completion/CamelOptionSchemaCompletionsFuture.java b/server/src/main/java/org/apache/camel/tools/lsp/internal/completion/CamelOptionSchemaCompletionsFuture.java deleted file mode 100644 index 413eae5..0000000 --- a/server/src/main/java/org/apache/camel/tools/lsp/internal/completion/CamelOptionSchemaCompletionsFuture.java +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.tools.lsp.internal.completion; - -import java.util.List; -import java.util.function.Function; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import org.apache.camel.catalog.CamelCatalog; -import org.apache.camel.tools.lsp.internal.model.EndpointOptionModel; -import org.apache.camel.tools.lsp.internal.model.util.ModelHelper; -import org.eclipse.lsp4j.CompletionItem; - -public class CamelOptionSchemaCompletionsFuture implements Function> { - - private String camelComponentName; - private boolean isProducer; - - public CamelOptionSchemaCompletionsFuture(String camelComponentName, boolean isProducer) { - this.camelComponentName = camelComponentName; - this.isProducer = isProducer; - } - - @Override - public List apply(CamelCatalog catalog) { - Stream endpointOptions = ModelHelper.generateComponentModel(catalog.componentJSonSchema(camelComponentName), true).getEndpointOptions().stream(); - return endpointOptions - .filter(endpoint -> "parameter".equals(endpoint.getKind())) - .filter(endpoint -> { - String group = endpoint.getGroup(); - if (isProducer) { - return !"consumer".equals(group); - } else { - return !"producer".equals(group); - } - }) - .map(parameter -> { - CompletionItem completionItem = new CompletionItem(parameter.getName()); - String insertText = parameter.getName() + "="; - if(parameter.getDefaultValue() != null) { - insertText += parameter.getDefaultValue(); - } - completionItem.setInsertText(insertText); - return completionItem; - }) - .collect(Collectors.toList()); - } - -} diff --git a/server/src/main/java/org/apache/camel/tools/lsp/internal/completion/CamelOptionValuesCompletionsFuture.java b/server/src/main/java/org/apache/camel/tools/lsp/internal/completion/CamelOptionValuesCompletionsFuture.java deleted file mode 100644 index 3ad27ca..0000000 --- a/server/src/main/java/org/apache/camel/tools/lsp/internal/completion/CamelOptionValuesCompletionsFuture.java +++ /dev/null @@ -1,73 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.tools.lsp.internal.completion; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.Optional; -import java.util.function.Function; - -import org.apache.camel.catalog.CamelCatalog; -import org.apache.camel.tools.lsp.internal.model.EndpointOptionModel; -import org.apache.camel.tools.lsp.internal.model.util.ModelHelper; -import org.apache.camel.tools.lsp.internal.parser.OptionParamValueURIInstance; -import org.eclipse.lsp4j.CompletionItem; - -public class CamelOptionValuesCompletionsFuture implements Function> { - - private static final String BOOLEAN_TYPE = "boolean"; - private OptionParamValueURIInstance optionParamValueURIInstance; - - public CamelOptionValuesCompletionsFuture(OptionParamValueURIInstance optionParamValueURIInstance) { - this.optionParamValueURIInstance = optionParamValueURIInstance; - } - - @Override - public List apply(CamelCatalog camelCatalog) { - Optional endpointModel = retrieveEndpointOptionModel(camelCatalog); - if(endpointModel.isPresent()) { - EndpointOptionModel endpointOptionModel = endpointModel.get(); - String enums = endpointOptionModel.getEnums(); - if (enums != null && !enums.isEmpty()) { - return computeCompletionForEnums(enums); - } else if(BOOLEAN_TYPE.equals(endpointOptionModel.getType())) { - return Arrays.asList(new CompletionItem(Boolean.TRUE.toString()), new CompletionItem(Boolean.FALSE.toString())); - } - } - return Collections.emptyList(); - } - - private List computeCompletionForEnums(String enums) { - List completionItems = new ArrayList<>(); - for(String enumValue : enums.split(",")) { - completionItems.add(new CompletionItem(enumValue)); - } - return completionItems; - } - - private Optional retrieveEndpointOptionModel(CamelCatalog camelCatalog) { - String componentName = optionParamValueURIInstance.getOptionParamURIInstance().getComponentName(); - String keyName = optionParamValueURIInstance.getOptionParamURIInstance().getKey().getKeyName(); - List endpointOptions = ModelHelper.generateComponentModel(camelCatalog.componentJSonSchema(componentName), true).getEndpointOptions(); - return endpointOptions.stream() - .filter(endpoint -> keyName.equals(endpoint.getName())) - .findAny(); - } - -} diff --git a/server/src/main/java/org/apache/camel/tools/lsp/internal/hover/HoverFuture.java b/server/src/main/java/org/apache/camel/tools/lsp/internal/hover/HoverFuture.java deleted file mode 100644 index 30ac679..0000000 --- a/server/src/main/java/org/apache/camel/tools/lsp/internal/hover/HoverFuture.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.tools.lsp.internal.hover; - -import java.util.Collections; -import java.util.function.Function; - -import org.apache.camel.catalog.CamelCatalog; -import org.apache.camel.tools.lsp.internal.model.ComponentModel; -import org.apache.camel.tools.lsp.internal.model.util.ModelHelper; -import org.eclipse.lsp4j.Hover; -import org.eclipse.lsp4j.jsonrpc.messages.Either; - -public class HoverFuture implements Function { - - private String componentName; - - public HoverFuture(String componentName) { - this.componentName = componentName; - } - - @Override - public Hover apply(CamelCatalog camelCatalog) { - Hover hover = new Hover(); - ComponentModel componentModel = ModelHelper.generateComponentModel(camelCatalog.componentJSonSchema(componentName), true); - hover.setContents(Collections.singletonList((Either.forLeft(componentModel.getDescription())))); - return hover; - } - - -} diff --git a/server/src/main/java/org/apache/camel/tools/lsp/internal/hover/HoverProcessor.java b/server/src/main/java/org/apache/camel/tools/lsp/internal/hover/HoverProcessor.java deleted file mode 100644 index 23783ad..0000000 --- a/server/src/main/java/org/apache/camel/tools/lsp/internal/hover/HoverProcessor.java +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.tools.lsp.internal.hover; - -import java.util.Collections; -import java.util.concurrent.CompletableFuture; - -import org.apache.camel.catalog.CamelCatalog; -import org.apache.camel.tools.lsp.internal.model.util.StringUtils; -import org.apache.camel.tools.lsp.internal.parser.ParserFileHelper; -import org.eclipse.lsp4j.Hover; -import org.eclipse.lsp4j.Position; -import org.eclipse.lsp4j.TextDocumentItem; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class HoverProcessor { - - private static final Logger LOGGER = LoggerFactory.getLogger(HoverProcessor.class); - private TextDocumentItem textDocumentItem; - private CompletableFuture camelCatalog; - - public HoverProcessor(TextDocumentItem textDocumentItem, CompletableFuture camelCatalog) { - this.textDocumentItem = textDocumentItem; - this.camelCatalog = camelCatalog; - } - - public CompletableFuture getHover(Position position) { - try { - ParserFileHelper parserFileHelper = new ParserFileHelper(); - if(parserFileHelper.getCorrespondingCamelNodeForCompletion(textDocumentItem, position.getLine()) != null){ - String camelComponentUri = parserFileHelper.getCamelComponentUri(textDocumentItem, position); - String componentName = StringUtils.asComponentName(camelComponentUri); - if (componentName != null) { - return camelCatalog.thenApply(new HoverFuture(componentName)); - } - } - } catch (Exception e) { - LOGGER.error("Error searching hover", e); - } - return CompletableFuture.completedFuture(new Hover(Collections.emptyList())); - } - -} diff --git a/server/src/main/java/org/apache/camel/tools/lsp/internal/model/ComponentModel.java b/server/src/main/java/org/apache/camel/tools/lsp/internal/model/ComponentModel.java deleted file mode 100644 index 0e0b013..0000000 --- a/server/src/main/java/org/apache/camel/tools/lsp/internal/model/ComponentModel.java +++ /dev/null @@ -1,186 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.tools.lsp.internal.model; - -import java.util.ArrayList; -import java.util.List; - -public class ComponentModel { - - private String kind; - private String scheme; - private String syntax; - private String alternativeSyntax; - private String alternativeSchemes; - private String title; - private String description; - private String label; - private String deprecated; - private String consumerOnly; - private String producerOnly; - private String javaType; - private String groupId; - private String artifactId; - private String version; - private final List componentOptions = new ArrayList<>(); - private final List endpointOptions = new ArrayList<>(); - - public String getKind() { - return kind; - } - - public void setKind(String kind) { - this.kind = kind; - } - - public String getScheme() { - return scheme; - } - - public void setScheme(String scheme) { - this.scheme = scheme; - } - - public String getSyntax() { - return syntax; - } - - public void setSyntax(String syntax) { - this.syntax = syntax; - } - - public String getAlternativeSyntax() { - return alternativeSyntax; - } - - public void setAlternativeSyntax(String alternativeSyntax) { - this.alternativeSyntax = alternativeSyntax; - } - - public String getAlternativeSchemes() { - return alternativeSchemes; - } - - public void setAlternativeSchemes(String alternativeSchemes) { - this.alternativeSchemes = alternativeSchemes; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getLabel() { - return label; - } - - public void setLabel(String label) { - this.label = label; - } - - public String getDeprecated() { - return deprecated; - } - - public void setDeprecated(String deprecated) { - this.deprecated = deprecated; - } - - public String getConsumerOnly() { - return consumerOnly; - } - - public void setConsumerOnly(String consumerOnly) { - this.consumerOnly = consumerOnly; - } - - public String getProducerOnly() { - return producerOnly; - } - - public void setProducerOnly(String producerOnly) { - this.producerOnly = producerOnly; - } - - public String getJavaType() { - return javaType; - } - - public void setJavaType(String javaType) { - this.javaType = javaType; - } - - public String getGroupId() { - return groupId; - } - - public void setGroupId(String groupId) { - this.groupId = groupId; - } - - public String getArtifactId() { - return artifactId; - } - - public void setArtifactId(String artifactId) { - this.artifactId = artifactId; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public List getComponentOptions() { - return componentOptions; - } - - public void addComponentOption(ComponentOptionModel option) { - componentOptions.add(option); - } - - public List getEndpointOptions() { - return endpointOptions; - } - - public void addEndpointOption(EndpointOptionModel option) { - endpointOptions.add(option); - } - - public ComponentOptionModel getComponentOption(String name) { - return componentOptions.stream().filter(o -> o.getName().equals(name)).findFirst().orElse(null); - } - - public EndpointOptionModel getEndpointOption(String name) { - return endpointOptions.stream().filter(o -> o.getName().equals(name)).findFirst().orElse(null); - } - -} diff --git a/server/src/main/java/org/apache/camel/tools/lsp/internal/model/ComponentOptionModel.java b/server/src/main/java/org/apache/camel/tools/lsp/internal/model/ComponentOptionModel.java deleted file mode 100644 index dd1487d..0000000 --- a/server/src/main/java/org/apache/camel/tools/lsp/internal/model/ComponentOptionModel.java +++ /dev/null @@ -1,121 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.tools.lsp.internal.model; - -public class ComponentOptionModel { - - private String name; - private String kind; - private String group; - private String required; - private String type; - private String javaType; - private String deprecated; - private String secret; - private String description; - private String defaultValue; - private String enums; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getKind() { - return kind; - } - - public void setKind(String kind) { - this.kind = kind; - } - - public String getGroup() { - return group; - } - - public void setGroup(String group) { - this.group = group; - } - - public String getRequired() { - return required; - } - - public void setRequired(String required) { - this.required = required; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getJavaType() { - return javaType; - } - - public void setJavaType(String javaType) { - this.javaType = javaType; - } - - public String getDeprecated() { - return deprecated; - } - - public void setDeprecated(String deprecated) { - this.deprecated = deprecated; - } - - public String getSecret() { - return secret; - } - - public void setSecret(String secret) { - this.secret = secret; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getDefaultValue() { - return defaultValue; - } - - public void setDefaultValue(String defaultValue) { - this.defaultValue = defaultValue; - } - - public String getEnums() { - return enums; - } - - public void setEnums(String enums) { - this.enums = enums; - } - -} diff --git a/server/src/main/java/org/apache/camel/tools/lsp/internal/model/EndpointOptionModel.java b/server/src/main/java/org/apache/camel/tools/lsp/internal/model/EndpointOptionModel.java deleted file mode 100644 index 0d849fd..0000000 --- a/server/src/main/java/org/apache/camel/tools/lsp/internal/model/EndpointOptionModel.java +++ /dev/null @@ -1,157 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.tools.lsp.internal.model; - -public class EndpointOptionModel { - - private String name; - private String kind; - private String group; - private String label; - private String required; - private String type; - private String javaType; - private String enums; - private String prefix; - private String multiValue; - private String deprecated; - private String secret; - private String defaultValue; - private String description; - private String enumValues; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getKind() { - return kind; - } - - public void setKind(String kind) { - this.kind = kind; - } - - public String getGroup() { - return group; - } - - public void setGroup(String group) { - this.group = group; - } - - public String getLabel() { - return label; - } - - public void setLabel(String label) { - this.label = label; - } - - public String getRequired() { - return required; - } - - public void setRequired(String required) { - this.required = required; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getJavaType() { - return javaType; - } - - public void setJavaType(String javaType) { - this.javaType = javaType; - } - - public String getEnums() { - return enums; - } - - public void setEnums(String enums) { - this.enums = enums; - } - - public String getPrefix() { - return prefix; - } - - public void setPrefix(String prefix) { - this.prefix = prefix; - } - - public String getMultiValue() { - return multiValue; - } - - public void setMultiValue(String multiValue) { - this.multiValue = multiValue; - } - - public String getDeprecated() { - return deprecated; - } - - public void setDeprecated(String deprecated) { - this.deprecated = deprecated; - } - - public String getSecret() { - return secret; - } - - public void setSecret(String secret) { - this.secret = secret; - } - - public String getDefaultValue() { - return defaultValue; - } - - public void setDefaultValue(String defaultValue) { - this.defaultValue = defaultValue; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getEnumValues() { - return enumValues; - } - - public void setEnumValues(String enumValues) { - this.enumValues = enumValues; - } - -} diff --git a/server/src/main/java/org/apache/camel/tools/lsp/internal/model/util/ModelHelper.java b/server/src/main/java/org/apache/camel/tools/lsp/internal/model/util/ModelHelper.java deleted file mode 100644 index 2eb0208..0000000 --- a/server/src/main/java/org/apache/camel/tools/lsp/internal/model/util/ModelHelper.java +++ /dev/null @@ -1,95 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.tools.lsp.internal.model.util; - -import static org.apache.camel.tools.lsp.internal.model.util.StringUtils.getSafeValue; - -import java.util.List; -import java.util.Map; - -import org.apache.camel.catalog.JSonSchemaHelper; -import org.apache.camel.tools.lsp.internal.model.ComponentModel; -import org.apache.camel.tools.lsp.internal.model.ComponentOptionModel; -import org.apache.camel.tools.lsp.internal.model.EndpointOptionModel; - -public final class ModelHelper { - - private ModelHelper() { - // utility class - } - - public static ComponentModel generateComponentModel(String json, boolean includeOptions) { - List> rows = JSonSchemaHelper.parseJsonSchema("component", json, false); - - ComponentModel component = new ComponentModel(); - component.setScheme(getSafeValue("scheme", rows)); - component.setSyntax(getSafeValue("syntax", rows)); - component.setAlternativeSyntax(getSafeValue("alternativeSyntax", rows)); - component.setAlternativeSchemes(getSafeValue("alternativeSchemes", rows)); - component.setTitle(getSafeValue("title", rows)); - component.setDescription(getSafeValue("description", rows)); - component.setLabel(getSafeValue("label", rows)); - component.setDeprecated(getSafeValue("deprecated", rows)); - component.setConsumerOnly(getSafeValue("consumerOnly", rows)); - component.setProducerOnly(getSafeValue("producerOnly", rows)); - component.setJavaType(getSafeValue("javaType", rows)); - component.setGroupId(getSafeValue("groupId", rows)); - component.setArtifactId(getSafeValue("artifactId", rows)); - component.setVersion(getSafeValue("version", rows)); - - if (includeOptions) { - rows = JSonSchemaHelper.parseJsonSchema("componentProperties", json, true); - for (Map row : rows) { - ComponentOptionModel option = new ComponentOptionModel(); - option.setName(getSafeValue("name", row)); - option.setKind(getSafeValue("kind", row)); - option.setGroup(getSafeValue("group", row)); - option.setRequired(getSafeValue("required", row)); - option.setType(getSafeValue("type", row)); - option.setJavaType(getSafeValue("javaType", row)); - option.setEnums(getSafeValue("enum", row)); - option.setDeprecated(getSafeValue("deprecated", row)); - option.setSecret(getSafeValue("secret", row)); - option.setDefaultValue(getSafeValue("defaultValue", row)); - option.setDescription(getSafeValue("description", row)); - component.addComponentOption(option); - } - - rows = JSonSchemaHelper.parseJsonSchema("properties", json, true); - for (Map row : rows) { - EndpointOptionModel option = new EndpointOptionModel(); - option.setName(getSafeValue("name", row)); - option.setKind(getSafeValue("kind", row)); - option.setGroup(getSafeValue("group", row)); - option.setLabel(getSafeValue("label", row)); - option.setRequired(getSafeValue("required", row)); - option.setType(getSafeValue("type", row)); - option.setJavaType(getSafeValue("javaType", row)); - option.setEnums(getSafeValue("enum", row)); - option.setPrefix(getSafeValue("prefix", row)); - option.setMultiValue(getSafeValue("multiValue", row)); - option.setDeprecated(getSafeValue("deprecated", row)); - option.setSecret(getSafeValue("secret", row)); - option.setDefaultValue(getSafeValue("defaultValue", row)); - option.setDescription(getSafeValue("description", row)); - component.addEndpointOption(option); - } - } - - return component; - } -} diff --git a/server/src/main/java/org/apache/camel/tools/lsp/internal/model/util/StringUtils.java b/server/src/main/java/org/apache/camel/tools/lsp/internal/model/util/StringUtils.java deleted file mode 100644 index 1300df8..0000000 --- a/server/src/main/java/org/apache/camel/tools/lsp/internal/model/util/StringUtils.java +++ /dev/null @@ -1,207 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.tools.lsp.internal.model.util; - -import java.util.List; -import java.util.Map; - -/** - * Various utility methods. - */ -public final class StringUtils { - - private StringUtils() { - } - - /** - * Whether to given value has a question mark or not - */ - static boolean hasQuestionMark(String val) { - return val != null && val.indexOf('?') > 0; - } - - /** - * Gets the value as a Camel component name - */ - public static String asComponentName(String val) { - if (val == null) { - return null; - } - - int pos = val.indexOf(':'); - if (pos > 0) { - return val.substring(0, pos); - } - return null; - } - - /** - * Gets the value as a Camel language name - */ - public static String asLanguageName(String val) { - if (val == null) { - return null; - } - - if (val.startsWith("tokenize")) { - return "tokenize"; - } else if (val.equals("js") || val.equals("javascript")) { - return "javaScript"; - } - - return val; - } - - /** - * Gets the value with the key in a safe way, eg returning an empty string if there was no value for the key. - */ - public static String getSafeValue(String key, List> rows) { - for (Map row : rows) { - String value = row.get(key); - if (value != null) { - return value; - } - } - return ""; - } - - /** - * Gets the value with the key in a safe way, eg returning an empty string if there was no value for the key. - */ - public static String getSafeValue(String key, Map rows) { - String value = rows.get(key); - if (value != null) { - return value; - } - return ""; - } - - /** - * To wrap a big line by a separator. - * - * @param line the big line - * @param separator the separator char such as & - * @param newLine the new line to use when breaking into a new line - * @param watermark a watermark to denote the size to cut after - */ - public static String wrapSeparator(String line, String separator, String newLine, int watermark) { - StringBuilder sb = new StringBuilder(); - String[] parts = line.split(separator); - - StringBuilder part = new StringBuilder(); - for (int i = 0; i < parts.length; i++) { - String word = parts[i]; - part.append(word); - if (i < parts.length - 1) { - part.append(separator); - } - // did we hit watermark then reset - if (part.length() >= watermark) { - // move separator to new line - String add = part.toString(); - if (add.endsWith(separator)) { - add = add.substring(0, add.length() - separator.length()); - } - sb.append(add); - sb.append(newLine); - sb.append(separator); - part.setLength(0); - } - } - // any leftover - if (part.length() > 0) { - sb.append(part.toString()); - } - - String answer = sb.toString(); - if (answer.endsWith(newLine)) { - answer = answer.substring(0, answer.length() - newLine.length()); - } - return answer; - } - - /** - * To wrap a big line by words. - * - * @param line the big line - * @param newLine the new line to use when breaking into a new line - * @param watermark a watermark to denote the size to cut after - * @param wrapLongWords whether to wrap long words - */ - public static String wrapWords(String line, String newLine, int watermark, boolean wrapLongWords) { - if (line == null) { - return null; - } else { - if (newLine == null) { - newLine = System.lineSeparator(); - } - - if (watermark < 1) { - watermark = 1; - } - - int inputLineLength = line.length(); - int offset = 0; - StringBuilder sb = new StringBuilder(inputLineLength + 32); - - while (inputLineLength - offset > watermark) { - if (line.charAt(offset) == 32) { - ++offset; - } else { - int spaceToWrapAt = line.lastIndexOf(32, watermark + offset); - if (spaceToWrapAt >= offset) { - sb.append(line.substring(offset, spaceToWrapAt)); - sb.append(newLine); - offset = spaceToWrapAt + 1; - } else if (wrapLongWords) { - sb.append(line.substring(offset, watermark + offset)); - sb.append(newLine); - offset += watermark; - } else { - spaceToWrapAt = line.indexOf(32, watermark + offset); - if (spaceToWrapAt >= 0) { - sb.append(line.substring(offset, spaceToWrapAt)); - sb.append(newLine); - offset = spaceToWrapAt + 1; - } else { - sb.append(line.substring(offset)); - offset = inputLineLength; - } - } - } - } - - sb.append(line.substring(offset)); - return sb.toString(); - } - } - - /** - * Is the string empty - */ - public static boolean isEmpty(String str) { - return str == null || str.trim().length() == 0; - } - - /** - * Is the string NOT empty - */ - public static boolean isNotEmpty(String str) { - return !isEmpty(str); - } - -} diff --git a/server/src/main/java/org/apache/camel/tools/lsp/internal/parser/CamelComponentURIInstance.java b/server/src/main/java/org/apache/camel/tools/lsp/internal/parser/CamelComponentURIInstance.java deleted file mode 100644 index 5cf2d55..0000000 --- a/server/src/main/java/org/apache/camel/tools/lsp/internal/parser/CamelComponentURIInstance.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.tools.lsp.internal.parser; - -import java.util.List; -import java.util.concurrent.CompletableFuture; - -import org.apache.camel.catalog.CamelCatalog; -import org.apache.camel.tools.lsp.internal.completion.CamelComponentSchemaCompletionsFuture; -import org.eclipse.lsp4j.CompletionItem; - -public class CamelComponentURIInstance extends CamelUriElementInstance { - - private String componentName; - - public CamelComponentURIInstance(String componentName, int endPosition) { - super(0, endPosition); - this.componentName = componentName; - } - - public String getComponentName() { - return componentName; - } - - @Override - public CompletableFuture> getCompletions(CompletableFuture camelCatalog, int positionInCamelUri) { - return camelCatalog.thenApply(new CamelComponentSchemaCompletionsFuture()); - } - -} diff --git a/server/src/main/java/org/apache/camel/tools/lsp/internal/parser/CamelURIInstance.java b/server/src/main/java/org/apache/camel/tools/lsp/internal/parser/CamelURIInstance.java deleted file mode 100644 index 0b86450..0000000 --- a/server/src/main/java/org/apache/camel/tools/lsp/internal/parser/CamelURIInstance.java +++ /dev/null @@ -1,136 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.tools.lsp.internal.parser; - -import java.util.Arrays; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.concurrent.CompletableFuture; - -import org.apache.camel.catalog.CamelCatalog; -import org.apache.camel.tools.lsp.internal.completion.CamelComponentSchemaCompletionsFuture; -import org.eclipse.lsp4j.CompletionItem; -import org.w3c.dom.Node; - -public class CamelURIInstance extends CamelUriElementInstance { - - private static final String CAMEL_PATH_SEPARATOR_REGEX = ":|/"; - private static final String PARAMETERS_SEPARATOR = "&"; - private static final List PRODUCER_NODE_TAG = Arrays.asList("to", "interceptSendToEndpoint", "wireTap", "deadLetterChanel"); - private CamelComponentURIInstance component; - private Set pathParams = new HashSet<>(); - private Set optionParams = new HashSet<>(); - private Node node; - - public CamelURIInstance(String uriToParse) { - this(uriToParse, null); - } - - public CamelURIInstance(String uriToParse, Node node) { - super(0, uriToParse != null ? uriToParse.length() : 0); - this.node = node; - if(uriToParse != null && !uriToParse.isEmpty()) { - int posDoubleDot = uriToParse.indexOf(':'); - if (posDoubleDot > 0) { - component = new CamelComponentURIInstance(uriToParse.substring(0, posDoubleDot), posDoubleDot); - int posEndofPathParams = getPosEndOfPathParams(posDoubleDot, uriToParse); - initPathParams(uriToParse, posDoubleDot, posEndofPathParams); - initOptionParams(uriToParse, posEndofPathParams); - } else { - component = new CamelComponentURIInstance(uriToParse, uriToParse.length()); - } - } - } - - private void initOptionParams(String uriToParse, int posEndofPathParams) { - if(uriToParse.length() > posEndofPathParams) { - String[] allOptionParams = uriToParse.substring(posEndofPathParams + 1).split(PARAMETERS_SEPARATOR); - int currentPosition = posEndofPathParams + 1; - for (String optionParam : allOptionParams) { - optionParams.add(new OptionParamURIInstance(this, optionParam, currentPosition, currentPosition + optionParam.length())); - currentPosition += optionParam.length() + 5; - } - if(uriToParse.endsWith(PARAMETERS_SEPARATOR)) { - optionParams.add(new OptionParamURIInstance(this, "", currentPosition, currentPosition)); - } - } - } - - private void initPathParams(String uriToParse, int posDoubleDot, int posEndofPathParams) { - String[] allPathParams = uriToParse.substring(posDoubleDot + 1, posEndofPathParams).split(CAMEL_PATH_SEPARATOR_REGEX); - int currentPosition = posDoubleDot + 1; - for (String pathParam : allPathParams) { - pathParams.add(new PathParamURIInstance(pathParam, currentPosition, currentPosition+pathParam.length())); - currentPosition += pathParam.length() + 1; - } - } - - private int getPosEndOfPathParams(int posDoubleDot, String uriToParse) { - int questionMarkPosition = uriToParse.indexOf('?', posDoubleDot); - if (questionMarkPosition > 0) { - return questionMarkPosition; - } else { - return uriToParse.length(); - } - } - - public CamelComponentURIInstance getComponent() { - return component; - } - - public Set getPathParams() { - return pathParams; - } - - public Set getOptionParams() { - return optionParams; - } - - public CamelUriElementInstance getSpecificElement(int position) { - if (component != null && component.isInRange(position)) { - return component; - } else { - for (PathParamURIInstance pathParamURIInstance : pathParams) { - if(pathParamURIInstance.isInRange(position)) { - return pathParamURIInstance; - } - } - for (OptionParamURIInstance optionParamURIInstance : optionParams) { - if (optionParamURIInstance.isInRange(position)) { - return optionParamURIInstance.getSpecificElement(position); - } - } - } - return this; - } - - @Override - public CompletableFuture> getCompletions(CompletableFuture camelCatalog, int positionInCamelUri) { - if(getStartPosition() <= positionInCamelUri && positionInCamelUri <= getEndPosition()) { - return camelCatalog.thenApply(new CamelComponentSchemaCompletionsFuture()); - } else { - return CompletableFuture.completedFuture(Collections.emptyList()); - } - } - - public boolean isProducer() { - return PRODUCER_NODE_TAG.contains(node.getNodeName()); - } - -} diff --git a/server/src/main/java/org/apache/camel/tools/lsp/internal/parser/CamelUriElementInstance.java b/server/src/main/java/org/apache/camel/tools/lsp/internal/parser/CamelUriElementInstance.java deleted file mode 100644 index cfc1aa6..0000000 --- a/server/src/main/java/org/apache/camel/tools/lsp/internal/parser/CamelUriElementInstance.java +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.tools.lsp.internal.parser; - -import java.util.List; -import java.util.concurrent.CompletableFuture; - -import org.apache.camel.catalog.CamelCatalog; -import org.eclipse.lsp4j.CompletionItem; - -public abstract class CamelUriElementInstance { - - private int startPosition; - private int endPosition; - - public CamelUriElementInstance(int startPosition, int endPosition) { - this.startPosition = startPosition; - this.endPosition = endPosition; - } - - public int getStartPosition() { - return startPosition; - } - - public int getEndPosition() { - return endPosition; - } - - public boolean isInRange(int position) { - return startPosition <= position && position <= endPosition; - } - - public abstract CompletableFuture> getCompletions(CompletableFuture camelCatalog, int positionInCamelUri); - -} diff --git a/server/src/main/java/org/apache/camel/tools/lsp/internal/parser/OptionParamKeyURIInstance.java b/server/src/main/java/org/apache/camel/tools/lsp/internal/parser/OptionParamKeyURIInstance.java deleted file mode 100644 index cff1de9..0000000 --- a/server/src/main/java/org/apache/camel/tools/lsp/internal/parser/OptionParamKeyURIInstance.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.tools.lsp.internal.parser; - -import java.util.List; -import java.util.concurrent.CompletableFuture; - -import org.apache.camel.catalog.CamelCatalog; -import org.apache.camel.tools.lsp.internal.completion.CamelOptionSchemaCompletionsFuture; -import org.eclipse.lsp4j.CompletionItem; - -public class OptionParamKeyURIInstance extends CamelUriElementInstance { - - private String keyName; - private OptionParamURIInstance optionParamURIInstance; - - public OptionParamKeyURIInstance(OptionParamURIInstance optionParamURIInstance, String keyName, int startPosition, int endPosition) { - super(startPosition, endPosition); - this.optionParamURIInstance = optionParamURIInstance; - this.keyName = keyName; - } - - public String getKeyName() { - return keyName; - } - - @Override - public CompletableFuture> getCompletions(CompletableFuture camelCatalog, int positionInCamelUri) { - return camelCatalog.thenApply(new CamelOptionSchemaCompletionsFuture(getComponentName(), optionParamURIInstance.isProducer())); - } - - public String getComponentName() { - return optionParamURIInstance.getComponentName(); - } - -} diff --git a/server/src/main/java/org/apache/camel/tools/lsp/internal/parser/OptionParamURIInstance.java b/server/src/main/java/org/apache/camel/tools/lsp/internal/parser/OptionParamURIInstance.java deleted file mode 100644 index a450236..0000000 --- a/server/src/main/java/org/apache/camel/tools/lsp/internal/parser/OptionParamURIInstance.java +++ /dev/null @@ -1,74 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.tools.lsp.internal.parser; - -import java.util.Collections; -import java.util.List; -import java.util.concurrent.CompletableFuture; - -import org.apache.camel.catalog.CamelCatalog; -import org.eclipse.lsp4j.CompletionItem; - -public class OptionParamURIInstance extends CamelUriElementInstance { - - private OptionParamKeyURIInstance key; - private OptionParamValueURIInstance value; - private CamelURIInstance camelURIInstance; - - public OptionParamURIInstance(CamelURIInstance camelURIInstance, String optionParam, int startPosition, int endPosition) { - super(startPosition, endPosition); - this.camelURIInstance = camelURIInstance; - String[] splittedParams = optionParam.split("="); - String keyName = splittedParams[0]; - key = new OptionParamKeyURIInstance(this, splittedParams[0], startPosition, startPosition + keyName.length()); - if (splittedParams.length > 1) { - value = new OptionParamValueURIInstance(this, splittedParams[1], startPosition + keyName.length() + 1, endPosition); - } else if(optionParam.endsWith("=")){ - value = new OptionParamValueURIInstance(this, null, startPosition + keyName.length() + 1, endPosition); - } - } - - public OptionParamKeyURIInstance getKey() { - return key; - } - - public OptionParamValueURIInstance getValue() { - return value; - } - - public CamelUriElementInstance getSpecificElement(int position) { - if(key.isInRange(position)) { - return key; - } else { - return value; - } - } - - @Override - public CompletableFuture> getCompletions(CompletableFuture camelCatalog, int positionInCamelUri) { - return CompletableFuture.completedFuture(Collections.emptyList()); - } - - public String getComponentName() { - return camelURIInstance.getComponent().getComponentName(); - } - - public boolean isProducer() { - return camelURIInstance.isProducer(); - } - -} diff --git a/server/src/main/java/org/apache/camel/tools/lsp/internal/parser/OptionParamValueURIInstance.java b/server/src/main/java/org/apache/camel/tools/lsp/internal/parser/OptionParamValueURIInstance.java deleted file mode 100644 index d8de62b..0000000 --- a/server/src/main/java/org/apache/camel/tools/lsp/internal/parser/OptionParamValueURIInstance.java +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.tools.lsp.internal.parser; - -import java.util.List; -import java.util.concurrent.CompletableFuture; - -import org.apache.camel.catalog.CamelCatalog; -import org.apache.camel.tools.lsp.internal.completion.CamelOptionValuesCompletionsFuture; -import org.eclipse.lsp4j.CompletionItem; - -public class OptionParamValueURIInstance extends CamelUriElementInstance { - - private String valueName; - private OptionParamURIInstance optionParamURIInstance; - - public OptionParamValueURIInstance(OptionParamURIInstance optionParamURIInstance, String value, int startPosition, int endPosition) { - super(startPosition, endPosition); - this.optionParamURIInstance = optionParamURIInstance; - this.valueName = value; - } - - public String getValueName() { - return valueName; - } - - @Override - public CompletableFuture> getCompletions(CompletableFuture camelCatalog, int positionInCamelUri) { - return camelCatalog.thenApply(new CamelOptionValuesCompletionsFuture(this)); - } - - public OptionParamURIInstance getOptionParamURIInstance() { - return optionParamURIInstance; - } - - - -} diff --git a/server/src/main/java/org/apache/camel/tools/lsp/internal/parser/ParserFileHelper.java b/server/src/main/java/org/apache/camel/tools/lsp/internal/parser/ParserFileHelper.java deleted file mode 100644 index 746754c..0000000 --- a/server/src/main/java/org/apache/camel/tools/lsp/internal/parser/ParserFileHelper.java +++ /dev/null @@ -1,126 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.tools.lsp.internal.parser; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.nio.charset.StandardCharsets; -import java.util.Arrays; -import java.util.List; - -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; - -import org.apache.camel.parser.helper.XmlLineNumberParser; -import org.eclipse.lsp4j.Position; -import org.eclipse.lsp4j.TextDocumentItem; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.SAXException; - -public class ParserFileHelper { - - private static final String NAMESPACEURI_CAMEL_BLUEPRINT = "http://camel.apache.org/schema/blueprint"; - private static final String NAMESPACEURI_CAMEL_SPRING = "http://camel.apache.org/schema/spring"; - private static final List CAMEL_NODES_TAG = Arrays.asList("to", "from"); - - public String getLine(TextDocumentItem textDocumentItem, Position position) { - String text = textDocumentItem.getText(); - String[] lines = text.split("\\r?\\n", position.getLine() + 2); - if (lines.length >= position.getLine() + 1) { - return lines[position.getLine()]; - } - return null; - } - - public String getCamelComponentUri(String line, int characterPosition) { - int uriAttribute = line.indexOf("uri=\""); - if(uriAttribute != -1) { - int nextQuote = line.indexOf('\"', uriAttribute + 5); - if (isBetween(characterPosition, uriAttribute + 5, nextQuote)) { - return line.substring(uriAttribute + 5, nextQuote); - } - } - return null; - } - - public String getCamelComponentUri(TextDocumentItem textDocumentItem, Position position) { - return getCamelComponentUri(getLine(textDocumentItem, position), position.getCharacter()); - } - - private boolean isBetween(int position, int start, int end) { - return end != -1 && position <= end && position >= start; - } - - /** - * @param textDocumentItem - * @param line - * @return Currently returns the first from Camel Node ignoring the exact position - * @throws Exception - */ - public Node getCorrespondingCamelNodeForCompletion(TextDocumentItem textDocumentItem, int line) throws Exception { - if (hasElementFromCamelNamespace(textDocumentItem)) { - Document parseXml = XmlLineNumberParser.parseXml(new ByteArrayInputStream(textDocumentItem.getText().getBytes(StandardCharsets.UTF_8))); - Element documentElement = parseXml.getDocumentElement(); - return findElementAtLine(line, documentElement); - } else { - return null; - } - } - - private boolean hasElementFromCamelNamespace(TextDocumentItem textDocumentItem) throws SAXException, IOException, ParserConfigurationException { - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - dbf.setNamespaceAware(true); - Document xmlParsed = dbf.newDocumentBuilder().parse(new ByteArrayInputStream(textDocumentItem.getText().getBytes(StandardCharsets.UTF_8))); - for (String camelNodeTag : CAMEL_NODES_TAG) { - if(hasElementFromCamelNameSpaces(xmlParsed.getElementsByTagName(camelNodeTag))){ - return true; - } - } - return false; - } - - private Node findElementAtLine(int line, Node node) { - if(CAMEL_NODES_TAG.contains(node.getNodeName())) { - return node; - } - NodeList childNodes = node.getChildNodes(); - for (int i = 0; i < childNodes.getLength(); i++) { - Node childNode = childNodes.item(i); - String nodeLineStart = (String)childNode.getUserData(XmlLineNumberParser.LINE_NUMBER); - String nodeLineEnd = (String)childNode.getUserData(XmlLineNumberParser.LINE_NUMBER_END); - // -1 is due to Camel XMLLineParser which is starting index at 1 although LSP is starting at 0 - if (nodeLineStart != null && nodeLineEnd != null && isBetween(line, Integer.parseInt(nodeLineStart) - 1, Integer.parseInt(nodeLineEnd) - 1)) { - return findElementAtLine(line, childNode); - } - } - return null; - } - - private boolean hasElementFromCamelNameSpaces(NodeList childNodes) { - for (int i = 0; i < childNodes.getLength(); i++) { - Node child = childNodes.item(i); - if (NAMESPACEURI_CAMEL_BLUEPRINT.equals(child.getNamespaceURI()) || NAMESPACEURI_CAMEL_SPRING.equals(child.getNamespaceURI())) { - return true; - } - } - return false; - } - -} diff --git a/server/src/main/java/org/apache/camel/tools/lsp/internal/parser/PathParamURIInstance.java b/server/src/main/java/org/apache/camel/tools/lsp/internal/parser/PathParamURIInstance.java deleted file mode 100644 index fd1fc27..0000000 --- a/server/src/main/java/org/apache/camel/tools/lsp/internal/parser/PathParamURIInstance.java +++ /dev/null @@ -1,70 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.tools.lsp.internal.parser; - -import java.util.Collections; -import java.util.List; -import java.util.Objects; -import java.util.concurrent.CompletableFuture; - -import org.apache.camel.catalog.CamelCatalog; -import org.apache.camel.tools.lsp.internal.completion.CamelComponentSchemaCompletionsFuture; -import org.eclipse.lsp4j.CompletionItem; - -public class PathParamURIInstance extends CamelUriElementInstance { - - private String value; - - public PathParamURIInstance(String value, int startPosition, int endPosition) { - super(startPosition, endPosition); - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public CompletableFuture> getCompletions(CompletableFuture camelCatalog, int positionInCamelUri) { - if(getStartPosition() <= positionInCamelUri && positionInCamelUri <= getEndPosition()) { - return camelCatalog.thenApply(new CamelComponentSchemaCompletionsFuture()); - } else { - return CompletableFuture.completedFuture(Collections.emptyList()); - } - } - - @Override - public boolean equals(Object obj) { - if(obj instanceof PathParamURIInstance) { - return value.equals(((PathParamURIInstance) obj).getValue()) - && getStartPosition() == ((PathParamURIInstance) obj).getStartPosition() - && getEndPosition() == ((PathParamURIInstance) obj).getEndPosition(); - } - return super.equals(obj); - } - - @Override - public int hashCode() { - return Objects.hash(value, getStartPosition(), getEndPosition()); - } - - @Override - public String toString() { - return "Value: "+value+" start position:"+getStartPosition()+ " end position:"+getEndPosition(); - } - -} diff --git a/server/src/main/resources/log4j.properties b/server/src/main/resources/log4j.properties deleted file mode 100644 index 92cfa8d..0000000 --- a/server/src/main/resources/log4j.properties +++ /dev/null @@ -1,10 +0,0 @@ -# Define the root logger with appender file -log4j.rootLogger = DEBUG, FILE -log4j.appender.FILE=org.apache.log4j.RollingFileAppender -log4j.appender.FILE.maxFileSize=20MB -log4j.appender.FILE.File=log-camel-lsp.out -log4j.appender.FILE.ImmediateFlush=true -log4j.appender.FILE.Threshold=debug -log4j.appender.FILE.Append=true -log4j.appender.FILE.layout=org.apache.log4j.PatternLayout -log4j.appender.FILE.layout.conversionPattern=%m%n diff --git a/server/src/test/java/org/apache/camel/tools/lsp/internal/AbstractCamelLanguageServerTest.java b/server/src/test/java/org/apache/camel/tools/lsp/internal/AbstractCamelLanguageServerTest.java deleted file mode 100644 index f2f1bea..0000000 --- a/server/src/test/java/org/apache/camel/tools/lsp/internal/AbstractCamelLanguageServerTest.java +++ /dev/null @@ -1,98 +0,0 @@ -package org.apache.camel.tools.lsp.internal; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.io.File; -import java.net.URISyntaxException; -import java.nio.file.Paths; -import java.util.List; -import java.util.Random; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ExecutionException; - -import org.eclipse.lsp4j.CompletionItem; -import org.eclipse.lsp4j.CompletionList; -import org.eclipse.lsp4j.DidOpenTextDocumentParams; -import org.eclipse.lsp4j.InitializeParams; -import org.eclipse.lsp4j.InitializeResult; -import org.eclipse.lsp4j.MessageActionItem; -import org.eclipse.lsp4j.MessageParams; -import org.eclipse.lsp4j.Position; -import org.eclipse.lsp4j.PublishDiagnosticsParams; -import org.eclipse.lsp4j.ShowMessageRequestParams; -import org.eclipse.lsp4j.TextDocumentIdentifier; -import org.eclipse.lsp4j.TextDocumentItem; -import org.eclipse.lsp4j.TextDocumentPositionParams; -import org.eclipse.lsp4j.jsonrpc.messages.Either; -import org.eclipse.lsp4j.services.LanguageClient; -import org.eclipse.lsp4j.services.TextDocumentService; - -public abstract class AbstractCamelLanguageServerTest { - - protected static final String AHC_DOCUMENTATION = "To call external HTTP services using Async Http Client."; - protected static final String DUMMY_URI = "dummyUri"; - protected CompletionItem expectedAhcCompletioncompletionItem; - - public AbstractCamelLanguageServerTest() { - super(); - expectedAhcCompletioncompletionItem = new CompletionItem("ahc:httpUri"); - expectedAhcCompletioncompletionItem.setDocumentation(AHC_DOCUMENTATION); - } - - final class DummyLanguageClient implements LanguageClient { - @Override - public void telemetryEvent(Object object) { - } - - @Override - public CompletableFuture showMessageRequest(ShowMessageRequestParams requestParams) { - return null; - } - - @Override - public void showMessage(MessageParams messageParams) { - } - - @Override - public void publishDiagnostics(PublishDiagnosticsParams diagnostics) { - } - - @Override - public void logMessage(MessageParams message) { - } - } - - protected CamelLanguageServer initializeLanguageServer(String text) - throws URISyntaxException, InterruptedException, ExecutionException { - InitializeParams params = new InitializeParams(); - params.setProcessId(new Random().nextInt()); - params.setRootUri(getTestResource("/workspace/").toURI().toString()); - CamelLanguageServer camelLanguageServer = new CamelLanguageServer(); - camelLanguageServer.connect(new DummyLanguageClient()); - CompletableFuture initialize = camelLanguageServer.initialize(params); - - assertThat(initialize).isCompleted(); - assertThat(initialize.get().getCapabilities().getCompletionProvider().getResolveProvider()).isTrue(); - - camelLanguageServer.getTextDocumentService().didOpen(new DidOpenTextDocumentParams(createTestTextDocument(text))); - - return camelLanguageServer; - } - - private TextDocumentItem createTestTextDocument(String text) { - return new TextDocumentItem(DUMMY_URI, CamelLanguageServer.LANGUAGE_ID, 0, text); - } - - protected CompletableFuture, CompletionList>> getCompletionFor(CamelLanguageServer camelLanguageServer, Position position) { - TextDocumentService textDocumentService = camelLanguageServer.getTextDocumentService(); - - TextDocumentPositionParams dummyCompletionPositionRequest = new TextDocumentPositionParams(new TextDocumentIdentifier(DUMMY_URI), position); - CompletableFuture, CompletionList>> completions = textDocumentService.completion(dummyCompletionPositionRequest); - return completions; - } - - public File getTestResource(String name) throws URISyntaxException { - return Paths.get(CamelLanguageServerTest.class.getResource(name).toURI()).toFile(); - } - -} \ No newline at end of file diff --git a/server/src/test/java/org/apache/camel/tools/lsp/internal/CamelLanguageServerTest.java b/server/src/test/java/org/apache/camel/tools/lsp/internal/CamelLanguageServerTest.java deleted file mode 100644 index 16c5c7a..0000000 --- a/server/src/test/java/org/apache/camel/tools/lsp/internal/CamelLanguageServerTest.java +++ /dev/null @@ -1,91 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.tools.lsp.internal; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.List; -import java.util.concurrent.CompletableFuture; - -import org.eclipse.lsp4j.CompletionItem; -import org.eclipse.lsp4j.CompletionList; -import org.eclipse.lsp4j.Position; -import org.eclipse.lsp4j.jsonrpc.messages.Either; -import org.junit.Test; - - -public class CamelLanguageServerTest extends AbstractCamelLanguageServerTest { - - @Test - public void testProvideCompletionForCamelBlueprintNamespace() throws Exception { - CamelLanguageServer camelLanguageServer = initializeLanguageServer("\n"); - - CompletableFuture, CompletionList>> completions = getCompletionFor(camelLanguageServer, new Position(0, 11)); - - assertThat(completions.get().getLeft()).contains(expectedAhcCompletioncompletionItem); - } - - @Test - public void testProvideCompletionForToCamelBlueprintNamespace() throws Exception { - CamelLanguageServer camelLanguageServer = initializeLanguageServer("\n"); - - CompletableFuture, CompletionList>> completions = getCompletionFor(camelLanguageServer, new Position(0, 9)); - - assertThat(completions.get().getLeft()).contains(expectedAhcCompletioncompletionItem); - } - - @Test - public void testProvideCompletionForCamelSpringNamespace() throws Exception { - CamelLanguageServer camelLanguageServer = initializeLanguageServer("\n"); - - CompletableFuture, CompletionList>> completions = getCompletionFor(camelLanguageServer, new Position(0, 11)); - - assertThat(completions.get().getLeft()).contains(expectedAhcCompletioncompletionItem); - } - - @Test - public void testProvideCompletionforMultiline() throws Exception { - CamelLanguageServer camelLanguageServer = initializeLanguageServer( - "\n" + - "\n" + - ""); - - CompletableFuture, CompletionList>> completions = getCompletionFor(camelLanguageServer, new Position(1, 9)); - - assertThat(completions.get().getLeft()).contains(expectedAhcCompletioncompletionItem); - } - - @Test - public void testDONTProvideCompletionForNotCamelnamespace() throws Exception { - CamelLanguageServer camelLanguageServer = initializeLanguageServer("\n"); - - CompletableFuture, CompletionList>> completions = getCompletionFor(camelLanguageServer, new Position(0, 11)); - - assertThat(completions.get().getLeft()).isEmpty(); - assertThat(completions.get().getRight()).isNull(); - } - - @Test - public void testDONTProvideCompletionWhenNotAfterURIEqualQuote() throws Exception { - CamelLanguageServer camelLanguageServer = initializeLanguageServer("\n"); - - CompletableFuture, CompletionList>> completions = getCompletionFor(camelLanguageServer, new Position(0, 6)); - - assertThat(completions.get().getLeft()).isEmpty(); - assertThat(completions.get().getRight()).isNull(); - } -} diff --git a/server/src/test/java/org/apache/camel/tools/lsp/internal/CamelTextDocumentServiceTest.java b/server/src/test/java/org/apache/camel/tools/lsp/internal/CamelTextDocumentServiceTest.java deleted file mode 100644 index a9731cc..0000000 --- a/server/src/test/java/org/apache/camel/tools/lsp/internal/CamelTextDocumentServiceTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.tools.lsp.internal; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.Collections; -import java.util.List; -import java.util.concurrent.CompletableFuture; - -import org.eclipse.lsp4j.CompletionItem; -import org.eclipse.lsp4j.CompletionList; -import org.eclipse.lsp4j.DidChangeTextDocumentParams; -import org.eclipse.lsp4j.Position; -import org.eclipse.lsp4j.TextDocumentContentChangeEvent; -import org.eclipse.lsp4j.VersionedTextDocumentIdentifier; -import org.eclipse.lsp4j.jsonrpc.messages.Either; -import org.junit.Test; - -public class CamelTextDocumentServiceTest extends AbstractCamelLanguageServerTest { - - @Test - public void testChangeEventUpdatesStoredText() throws Exception { - CamelLanguageServer camelLanguageServer = initializeLanguageServer("\n"); - - DidChangeTextDocumentParams changeEvent = new DidChangeTextDocumentParams(); - VersionedTextDocumentIdentifier textDocument = new VersionedTextDocumentIdentifier(); - textDocument.setUri(DUMMY_URI); - changeEvent.setTextDocument(textDocument); - TextDocumentContentChangeEvent contentChange = new TextDocumentContentChangeEvent("\n"); - changeEvent.setContentChanges(Collections.singletonList(contentChange)); - camelLanguageServer.getTextDocumentService().didChange(changeEvent); - - //check old position doesn't provide completion - CompletableFuture, CompletionList>> completionsAtOldPosition = getCompletionFor(camelLanguageServer, new Position(0, 11)); - assertThat(completionsAtOldPosition.get().getLeft()).isEmpty(); - - //check new position provides completion - CompletableFuture, CompletionList>> completionsAtNewPosition = getCompletionFor(camelLanguageServer, new Position(0, 58)); - assertThat(completionsAtNewPosition.get().getLeft()).isNotEmpty(); - - } -} diff --git a/server/src/test/java/org/apache/camel/tools/lsp/internal/completion/CamelComponentOptionBooleanValuesTest.java b/server/src/test/java/org/apache/camel/tools/lsp/internal/completion/CamelComponentOptionBooleanValuesTest.java deleted file mode 100644 index b13f1b7..0000000 --- a/server/src/test/java/org/apache/camel/tools/lsp/internal/completion/CamelComponentOptionBooleanValuesTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.tools.lsp.internal.completion; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.net.URISyntaxException; -import java.util.List; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ExecutionException; - -import org.apache.camel.tools.lsp.internal.AbstractCamelLanguageServerTest; -import org.apache.camel.tools.lsp.internal.CamelLanguageServer; -import org.eclipse.lsp4j.CompletionItem; -import org.eclipse.lsp4j.CompletionList; -import org.eclipse.lsp4j.Position; -import org.eclipse.lsp4j.jsonrpc.messages.Either; -import org.junit.Test; - -public class CamelComponentOptionBooleanValuesTest extends AbstractCamelLanguageServerTest { - - @Test - public void testProvideBooleanValues() throws Exception { - testProvideCamelOptions("\n", 0, 37); - } - - private void testProvideCamelOptions(String textTotest, int line, int character) throws URISyntaxException, InterruptedException, ExecutionException { - CamelLanguageServer camelLanguageServer = initializeLanguageServer(textTotest); - - CompletableFuture, CompletionList>> completions = getCompletionFor(camelLanguageServer, new Position(line, character)); - - assertThat(completions.get().getLeft()).contains( - new CompletionItem("true"), - new CompletionItem("false")); - } - -} diff --git a/server/src/test/java/org/apache/camel/tools/lsp/internal/completion/CamelComponentOptionEnumerationValuesTest.java b/server/src/test/java/org/apache/camel/tools/lsp/internal/completion/CamelComponentOptionEnumerationValuesTest.java deleted file mode 100644 index f602a51..0000000 --- a/server/src/test/java/org/apache/camel/tools/lsp/internal/completion/CamelComponentOptionEnumerationValuesTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.tools.lsp.internal.completion; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.net.URISyntaxException; -import java.util.List; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ExecutionException; - -import org.apache.camel.tools.lsp.internal.AbstractCamelLanguageServerTest; -import org.apache.camel.tools.lsp.internal.CamelLanguageServer; -import org.eclipse.lsp4j.CompletionItem; -import org.eclipse.lsp4j.CompletionList; -import org.eclipse.lsp4j.Position; -import org.eclipse.lsp4j.jsonrpc.messages.Either; -import org.junit.Test; - -public class CamelComponentOptionEnumerationValuesTest extends AbstractCamelLanguageServerTest { - - @Test - public void testProvideEnumValues() throws Exception { - testProvideCamelOptions("\n", 0, 43); - } - - private void testProvideCamelOptions(String textTotest, int line, int character) throws URISyntaxException, InterruptedException, ExecutionException { - CamelLanguageServer camelLanguageServer = initializeLanguageServer(textTotest); - - CompletableFuture, CompletionList>> completions = getCompletionFor(camelLanguageServer, new Position(line, character)); - - assertThat(completions.get().getLeft()).contains( - new CompletionItem("InOnly"), - new CompletionItem("RobustInOnly"), - new CompletionItem("InOut"), - new CompletionItem("InOptionalOut"), - new CompletionItem("OutOnly"), - new CompletionItem("RobustOutOnly"), - new CompletionItem("OutIn"), - new CompletionItem("OutOptionalIn")); - } - -} diff --git a/server/src/test/java/org/apache/camel/tools/lsp/internal/completion/CamelComponentOptionsCompletionsTest.java b/server/src/test/java/org/apache/camel/tools/lsp/internal/completion/CamelComponentOptionsCompletionsTest.java deleted file mode 100644 index 2b12174..0000000 --- a/server/src/test/java/org/apache/camel/tools/lsp/internal/completion/CamelComponentOptionsCompletionsTest.java +++ /dev/null @@ -1,74 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.tools.lsp.internal.completion; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.net.URISyntaxException; -import java.util.List; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ExecutionException; - -import org.apache.camel.tools.lsp.internal.AbstractCamelLanguageServerTest; -import org.apache.camel.tools.lsp.internal.CamelLanguageServer; -import org.eclipse.lsp4j.CompletionItem; -import org.eclipse.lsp4j.CompletionList; -import org.eclipse.lsp4j.Position; -import org.eclipse.lsp4j.jsonrpc.messages.Either; -import org.junit.Test; - -public class CamelComponentOptionsCompletionsTest extends AbstractCamelLanguageServerTest { - - @Test - public void testProvideCamelOptions() throws Exception { - testProvideCamelOptions("\n", 0, 21, getBridgeEndpointExpectedCompletionItem()); - } - - @Test - public void testProvideCamelOptionsForConsumerOnly() throws Exception { - CompletionItem completionItem = new CompletionItem("bridgeErrorHandler"); - completionItem.setInsertText("bridgeErrorHandler=false"); - testProvideCamelOptions("\n", 0, 27, completionItem); - } - - @Test - public void testProvideCamelOptionsForConsumerOrProducer() throws Exception { - CompletionItem completionItem = new CompletionItem("clientConfigOptions"); - completionItem.setInsertText("clientConfigOptions="); - testProvideCamelOptions("\n", 0, 23, completionItem); - } - - @Test - public void testProvideCamelOptionsWhenAlreadyContainOptions() throws Exception { - testProvideCamelOptions("\n", 0, 41, getBridgeEndpointExpectedCompletionItem()); - } - - private void testProvideCamelOptions(String textTotest, int line, int character, CompletionItem completionItemExpected) throws URISyntaxException, InterruptedException, ExecutionException { - CamelLanguageServer camelLanguageServer = initializeLanguageServer(textTotest); - - CompletableFuture, CompletionList>> completions = getCompletionFor(camelLanguageServer, new Position(line, character)); - - assertThat(completions.get().getLeft()).contains(completionItemExpected); - } - - private CompletionItem getBridgeEndpointExpectedCompletionItem() { - CompletionItem completionItem = new CompletionItem("bridgeEndpoint"); - completionItem.setInsertText("bridgeEndpoint=false"); - return completionItem; - } - -} diff --git a/server/src/test/java/org/apache/camel/tools/lsp/internal/completion/CamelLanguageServerCompletionPositionTest.java b/server/src/test/java/org/apache/camel/tools/lsp/internal/completion/CamelLanguageServerCompletionPositionTest.java deleted file mode 100644 index 75781af..0000000 --- a/server/src/test/java/org/apache/camel/tools/lsp/internal/completion/CamelLanguageServerCompletionPositionTest.java +++ /dev/null @@ -1,106 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.tools.lsp.internal.completion; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.Arrays; -import java.util.Collection; -import java.util.List; -import java.util.concurrent.CompletableFuture; - -import org.apache.camel.tools.lsp.internal.AbstractCamelLanguageServerTest; -import org.apache.camel.tools.lsp.internal.CamelLanguageServer; -import org.eclipse.lsp4j.CompletionItem; -import org.eclipse.lsp4j.CompletionList; -import org.eclipse.lsp4j.Position; -import org.eclipse.lsp4j.jsonrpc.messages.Either; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; -import org.junit.runners.Parameterized.Parameter; -import org.junit.runners.Parameterized.Parameters; - -@RunWith(Parameterized.class) -public class CamelLanguageServerCompletionPositionTest extends AbstractCamelLanguageServerTest { - - @Parameters(name="{4} - Position ({1},{2})") - public static Collection data() { - return Arrays.asList(new Object[][] { - { "\n", 0, 0, false, "Empty URI" }, - { "\n", 0, 1, false, "Empty URI" }, - { "\n", 0, 2, false, "Empty URI"}, - { "\n", 0, 3, false, "Empty URI"}, - { "\n", 0, 4, false, "Empty URI"}, - { "\n", 0, 5, false, "Empty URI"}, - { "\n", 0, 6, false, "Empty URI"}, - { "\n", 0, 7, false, "Empty URI"}, - { "\n", 0, 8, false, "Empty URI"}, - { "\n", 0, 9, false, "Empty URI"}, - { "\n", 0, 10, false, "Empty URI" }, - { "\n", 0, 11, true, "Empty URI" }, - { "\n", 0, 12, false, "Empty URI" }, - { "\n", 0, 13, false, "Empty URI" }, - { "\n", 0, 14, false, "Empty URI" }, - { "\n", 0, 15, false, "Empty URI" }, - - { "\n", 0, 10, false, "Uri with some value" }, - { "\n", 0, 11, true, "Uri with some value" }, - { "\n", 0, 12, true, "Uri with some value" }, - { "\n", 0, 13, true, "Uri with some value" }, - { "\n", 0, 14, true, "Uri with some value" }, - { "\n", 0, 15, false, "Uri with some value" }, - - { "\n", 0, 14, true, "Uri with a syntax provided" }, - { "\n", 0, 16, true, "Uri with a syntax provided" }, - { "\n", 0, 17, true, "Uri with a syntax provided" }, - { "\n", 0, 18, true, "Uri with a syntax provided" }, - { "\n", 0, 19, true, "Uri with a syntax provided" }, - { "\n", 0, 20, true, "Uri with a syntax provided" }, - { "\n", 0, 21, true, "Uri with a syntax provided" }, - { "\n", 0, 22, true, "Uri with a syntax provided" }, - { "\n", 0, 23, false, "Uri with a syntax provided" }, - { "\n", 0, 24, false, "Uri with a syntax provided" } - - }); - } - - @Parameter - public String textToTest; - @Parameter(1) - public int line; - @Parameter(2) - public int character; - @Parameter(3) - public boolean shouldHaveCompletion; - @Parameter(4) - public String testNameQualification; - - @Test - public void testProvideCompletionForCamelBlueprintNamespace() throws Exception { - CamelLanguageServer camelLanguageServer = initializeLanguageServer(textToTest); - - CompletableFuture, CompletionList>> completions = getCompletionFor(camelLanguageServer, new Position(line, character)); - - if(shouldHaveCompletion) { - assertThat(completions.get().getLeft()).contains(expectedAhcCompletioncompletionItem); - } else { - assertThat(completions.get().getLeft()).doesNotContain(expectedAhcCompletioncompletionItem); - assertThat(completions.get().getRight()).isNull(); - } - } -} diff --git a/server/src/test/java/org/apache/camel/tools/lsp/internal/hover/CamelLanguageServerHoverTest.java b/server/src/test/java/org/apache/camel/tools/lsp/internal/hover/CamelLanguageServerHoverTest.java deleted file mode 100644 index 83833e0..0000000 --- a/server/src/test/java/org/apache/camel/tools/lsp/internal/hover/CamelLanguageServerHoverTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.tools.lsp.internal.hover; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.concurrent.CompletableFuture; - -import org.apache.camel.tools.lsp.internal.AbstractCamelLanguageServerTest; -import org.apache.camel.tools.lsp.internal.CamelLanguageServer; -import org.eclipse.lsp4j.Hover; -import org.eclipse.lsp4j.Position; -import org.eclipse.lsp4j.TextDocumentIdentifier; -import org.eclipse.lsp4j.TextDocumentPositionParams; -import org.junit.Test; - -public class CamelLanguageServerHoverTest extends AbstractCamelLanguageServerTest { - - @Test - public void testProvideDocumentationOnHover() throws Exception { - CamelLanguageServer camelLanguageServer = initializeLanguageServer("\n"); - - TextDocumentPositionParams position = new TextDocumentPositionParams(new TextDocumentIdentifier(DUMMY_URI), new Position(0, 13)); - CompletableFuture hover = camelLanguageServer.getTextDocumentService().hover(position); - - assertThat(hover.get().getContents().get(0).getLeft()).isEqualTo(AHC_DOCUMENTATION); - } - - @Test - public void testDontProvideDocumentationOnHoverForBadPlaces() throws Exception { - CamelLanguageServer camelLanguageServer = initializeLanguageServer("\n"); - - TextDocumentPositionParams position = new TextDocumentPositionParams(new TextDocumentIdentifier(DUMMY_URI), new Position(0, 4)); - CompletableFuture hover = camelLanguageServer.getTextDocumentService().hover(position); - - assertThat(hover.get().getContents()).isEmpty(); - } - - @Test - public void testDontProvideDocumentationOnHoverWhenEndingWithAnd() throws Exception { - CamelLanguageServer camelLanguageServer = initializeLanguageServer("\n"); - - TextDocumentPositionParams position = new TextDocumentPositionParams(new TextDocumentIdentifier(DUMMY_URI), new Position(0, 15)); - CompletableFuture hover = camelLanguageServer.getTextDocumentService().hover(position); - - assertThat(hover.get().getContents()).isEmpty(); - } - -} diff --git a/server/src/test/java/org/apache/camel/tools/lsp/internal/parser/CamelURIInstanceTest.java b/server/src/test/java/org/apache/camel/tools/lsp/internal/parser/CamelURIInstanceTest.java deleted file mode 100644 index e9544d6..0000000 --- a/server/src/test/java/org/apache/camel/tools/lsp/internal/parser/CamelURIInstanceTest.java +++ /dev/null @@ -1,187 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.tools.lsp.internal.parser; - - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.Iterator; - -import org.junit.Test; - -public class CamelURIInstanceTest { - - @Test - public void testEmptyUri() throws Exception { - CamelURIInstance camelURIInstance = new CamelURIInstance(""); - assertThat(camelURIInstance.getComponent()).isNull(); - assertThat(camelURIInstance.getOptionParams()).isEmpty(); - assertThat(camelURIInstance.getOptionParams()).isEmpty(); - } - - @Test - public void testComponentOnlyInUri() throws Exception { - CamelURIInstance camelURIInstance = new CamelURIInstance("timer"); - assertThat(camelURIInstance.getComponent().getComponentName()).isEqualTo("timer"); - assertThat(camelURIInstance.getComponent().getEndPosition()).isEqualTo(5); - } - - @Test - public void testComponentWithSomethingElseInUri() throws Exception { - CamelURIInstance camelURIInstance = new CamelURIInstance("timer:timerName"); - assertThat(camelURIInstance.getComponent().getComponentName()).isEqualTo("timer"); - assertThat(camelURIInstance.getComponent().getEndPosition()).isEqualTo(5); - } - - @Test - public void testPathParam() throws Exception { - CamelURIInstance camelURIInstance = new CamelURIInstance("timer:timerName"); - PathParamURIInstance pathParam = camelURIInstance.getPathParams().iterator().next(); - assertThat(pathParam.getValue()).isEqualTo("timerName"); - assertThat(pathParam.getStartPosition()).isEqualTo(6); - assertThat(pathParam.getEndPosition()).isEqualTo(15); - } - - @Test - public void testMultiplePathParam() throws Exception { - CamelURIInstance camelURIInstance = new CamelURIInstance("amqp:destinationType:destinationName"); - assertThat(camelURIInstance.getPathParams()).containsOnly( - new PathParamURIInstance("destinationType", 5, 20), - new PathParamURIInstance("destinationName", 21, 36)); - } - - @Test - public void testMultiplePathParamWithSomethingElseInUri() throws Exception { - CamelURIInstance camelURIInstance = new CamelURIInstance("amqp:destinationType:destinationName?anOption"); - assertThat(camelURIInstance.getPathParams()).containsOnly( - new PathParamURIInstance("destinationType", 5, 20), - new PathParamURIInstance("destinationName", 21, 36)); - } - - @Test - public void testMultiplePathParamWithSlashDelimiter() throws Exception { - CamelURIInstance camelURIInstance = new CamelURIInstance("atmos:name/operation"); - assertThat(camelURIInstance.getPathParams()).containsOnly( - new PathParamURIInstance("name", 6, 10), - new PathParamURIInstance("operation", 11, 20)); - } - - @Test - public void testOptionParam() throws Exception { - CamelURIInstance camelURIInstance = new CamelURIInstance("timer:timerName?delay=1000"); - OptionParamURIInstance optionParam = camelURIInstance.getOptionParams().iterator().next(); - checkDelayTimerParam(optionParam); - } - - private void checkDelayTimerParam(OptionParamURIInstance optionParam) { - assertThat(optionParam.getStartPosition()).isEqualTo(16); - assertThat(optionParam.getEndPosition()).isEqualTo(26); - assertThat(optionParam.getKey().getKeyName()).isEqualTo("delay"); - assertThat(optionParam.getKey().getStartPosition()).isEqualTo(16); - assertThat(optionParam.getKey().getEndPosition()).isEqualTo(21); - assertThat(optionParam.getValue().getValueName()).isEqualTo("1000"); - assertThat(optionParam.getValue().getStartPosition()).isEqualTo(22); - assertThat(optionParam.getValue().getEndPosition()).isEqualTo(26); - } - - @Test - public void testSeveralOptionParam() throws Exception { - CamelURIInstance camelURIInstance = new CamelURIInstance("timer:timerName?delay=1000&period=2000"); - Iterator iterator = camelURIInstance.getOptionParams().iterator(); - OptionParamURIInstance firstOptionParam = iterator.next(); - OptionParamURIInstance secondOptionParam = iterator.next(); - if("delay".equals(firstOptionParam.getKey().getKeyName())) { - checkDelayTimerParam(firstOptionParam); - checkTimerPeriodParam(secondOptionParam); - } else { - checkDelayTimerParam(secondOptionParam); - checkTimerPeriodParam(firstOptionParam); - } - } - - private void checkTimerPeriodParam(OptionParamURIInstance secondOptionParam) { - assertThat(secondOptionParam.getStartPosition()).isEqualTo(31); - assertThat(secondOptionParam.getEndPosition()).isEqualTo(42); - assertThat(secondOptionParam.getKey().getKeyName()).isEqualTo("period"); - assertThat(secondOptionParam.getKey().getStartPosition()).isEqualTo(31); - assertThat(secondOptionParam.getKey().getEndPosition()).isEqualTo(37); - assertThat(secondOptionParam.getValue().getValueName()).isEqualTo("2000"); - assertThat(secondOptionParam.getValue().getStartPosition()).isEqualTo(38); - assertThat(secondOptionParam.getValue().getEndPosition()).isEqualTo(42); - } - - @Test - public void testEmptyOptionParam() throws Exception { - CamelURIInstance camelURIInstance = new CamelURIInstance("timer:timerName?"); - OptionParamURIInstance optionParam = camelURIInstance.getOptionParams().iterator().next(); - assertThat(optionParam.getStartPosition()).isEqualTo(16); - assertThat(optionParam.getEndPosition()).isEqualTo(16); - assertThat(optionParam.getKey().getKeyName()).isEqualTo(""); - assertThat(optionParam.getKey().getStartPosition()).isEqualTo(16); - assertThat(optionParam.getKey().getEndPosition()).isEqualTo(16); - assertThat(optionParam.getValue()).isNull(); - } - - @Test - public void testEmptyOptionValueParam() throws Exception { - CamelURIInstance camelURIInstance = new CamelURIInstance("timer:timerName?delay"); - OptionParamURIInstance optionParam = camelURIInstance.getOptionParams().iterator().next(); - assertThat(optionParam.getStartPosition()).isEqualTo(16); - assertThat(optionParam.getEndPosition()).isEqualTo(21); - assertThat(optionParam.getKey().getKeyName()).isEqualTo("delay"); - assertThat(optionParam.getKey().getStartPosition()).isEqualTo(16); - assertThat(optionParam.getKey().getEndPosition()).isEqualTo(21); - assertThat(optionParam.getValue()).isNull(); - } - - @Test - public void testEmptyOptionValueParamWithAnd() throws Exception { - CamelURIInstance camelURIInstance = new CamelURIInstance("timer:timerName?delay&"); - Iterator iterator = camelURIInstance.getOptionParams().iterator(); - OptionParamURIInstance firstOptionParam = iterator.next(); - OptionParamURIInstance secondOptionParam = iterator.next(); - if("delay".equals(firstOptionParam.getKey().getKeyName())) { - checkDelayParameter(firstOptionParam); - } else { - checkDelayParameter(secondOptionParam); - } - } - - private void checkDelayParameter(OptionParamURIInstance firstOptionParam) { - assertThat(firstOptionParam.getStartPosition()).isEqualTo(16); - assertThat(firstOptionParam.getEndPosition()).isEqualTo(21); - assertThat(firstOptionParam.getKey().getKeyName()).isEqualTo("delay"); - assertThat(firstOptionParam.getKey().getStartPosition()).isEqualTo(16); - assertThat(firstOptionParam.getKey().getEndPosition()).isEqualTo(21); - assertThat(firstOptionParam.getValue()).isNull(); - } - - @Test - public void testEmptyOptionValueParamWithEqual() throws Exception { - CamelURIInstance camelURIInstance = new CamelURIInstance("timer:timerName?delay="); - OptionParamURIInstance optionParam = camelURIInstance.getOptionParams().iterator().next(); - assertThat(optionParam.getStartPosition()).isEqualTo(16); - assertThat(optionParam.getEndPosition()).isEqualTo(22); - assertThat(optionParam.getKey().getKeyName()).isEqualTo("delay"); - assertThat(optionParam.getKey().getStartPosition()).isEqualTo(16); - assertThat(optionParam.getKey().getEndPosition()).isEqualTo(21); - assertThat(optionParam.getValue().getValueName()).isEqualTo(null); - assertThat(optionParam.getValue().getStartPosition()).isEqualTo(22); - assertThat(optionParam.getValue().getEndPosition()).isEqualTo(22); - } - -} diff --git a/server/src/test/resources/workspace/test-file.xml b/server/src/test/resources/workspace/test-file.xml deleted file mode 100644 index e69de29..0000000