From ad6f9738d9ebb112263f29766b3a774012b63947 Mon Sep 17 00:00:00 2001 From: Dusan Petrovic Date: Tue, 4 Mar 2025 09:10:47 +0100 Subject: [PATCH] Added Micronaut launcher tests --- java/java.lsp.server/vscode/src/extension.ts | 21 +++- .../vscode/src/test/launcher/fileUtil.ts | 46 +++++++ .../vscode/src/test/launcher/index.ts | 61 +++++++++ .../vscode/src/test/launcher/launch.test.ts | 106 ++++++++++++++++ .../vscode/src/test/runTest.ts | 33 ++++- .../vscode/src/test/suite/extension.test.ts | 2 +- .../vscode/src/test/suite/index.ts | 4 +- .../vscode/src/test/suite/testutils.ts | 2 +- .../src/test/test-projects/test-app/empty.ts | 21 ++++ .../vscode/test-projects/test-app/.gitignore | 15 +++ .../vscode/test-projects/test-app/README.md | 24 ++++ .../test-projects/test-app/aot-jar.properties | 37 ++++++ .../test-projects/test-app/micronaut-cli.yml | 6 + .../vscode/test-projects/test-app/pom.xml | 117 ++++++++++++++++++ .../main/java/com/example/Application.java | 10 ++ .../src/main/resources/application.properties | 2 + .../test-app/src/main/resources/logback.xml | 14 +++ .../test/java/com/example/TestAppTest.java | 21 ++++ 18 files changed, 533 insertions(+), 9 deletions(-) create mode 100644 java/java.lsp.server/vscode/src/test/launcher/fileUtil.ts create mode 100644 java/java.lsp.server/vscode/src/test/launcher/index.ts create mode 100644 java/java.lsp.server/vscode/src/test/launcher/launch.test.ts create mode 100644 java/java.lsp.server/vscode/src/test/test-projects/test-app/empty.ts create mode 100644 java/java.lsp.server/vscode/test-projects/test-app/.gitignore create mode 100644 java/java.lsp.server/vscode/test-projects/test-app/README.md create mode 100644 java/java.lsp.server/vscode/test-projects/test-app/aot-jar.properties create mode 100644 java/java.lsp.server/vscode/test-projects/test-app/micronaut-cli.yml create mode 100644 java/java.lsp.server/vscode/test-projects/test-app/pom.xml create mode 100644 java/java.lsp.server/vscode/test-projects/test-app/src/main/java/com/example/Application.java create mode 100644 java/java.lsp.server/vscode/test-projects/test-app/src/main/resources/application.properties create mode 100644 java/java.lsp.server/vscode/test-projects/test-app/src/main/resources/logback.xml create mode 100644 java/java.lsp.server/vscode/test-projects/test-app/src/test/java/com/example/TestAppTest.java diff --git a/java/java.lsp.server/vscode/src/extension.ts b/java/java.lsp.server/vscode/src/extension.ts index 107c86ee3a4a..2ddf82353854 100644 --- a/java/java.lsp.server/vscode/src/extension.ts +++ b/java/java.lsp.server/vscode/src/extension.ts @@ -75,6 +75,7 @@ export let client: Promise; export let clientRuntimeJDK : string | null = null; export const MINIMAL_JDK_VERSION = 17; export const TEST_PROGRESS_EVENT: string = "testProgress"; +export let debugConsoleListeners: any[] = []; const TEST_ADAPTER_CREATED_EVENT: string = "testAdapterCreated"; let testAdapter: NbTestAdapter | undefined; let nbProcess : ChildProcess | null = null; @@ -784,6 +785,24 @@ export function activate(context: ExtensionContext): VSNetBeansAPI { throw `Client ${c} doesn't support go to test`; } })); + + const trackerFactory: vscode.DebugAdapterTrackerFactory = { + createDebugAdapterTracker(_session: vscode.DebugSession) { + return { + onDidSendMessage: (message) => { + if (message.type === "event" && message.event === "output") { + const output = message.body.output; + debugConsoleListeners.forEach((listener) => { + listener?.callback(output); + }); + } + } + }; + } + }; + + context.subscriptions.push(vscode.debug.registerDebugAdapterTrackerFactory("*", trackerFactory)); + context.subscriptions.push(commands.registerCommand(COMMAND_PREFIX + '.workspace.compile', () => wrapCommandWithProgress(COMMAND_PREFIX + '.build.workspace', 'Compiling workspace...', log, true) )); @@ -935,7 +954,7 @@ export function activate(context: ExtensionContext): VSNetBeansAPI { debugConfig['projects'] = projects; } - const ret = await vscode.debug.startDebugging(workspaceFolder, debugConfig, debugOptions); + const ret = await vscode.debug.startDebugging(workspaceFolder, debugConfig, debugOptions); return ret ? new Promise((resolve) => { const listener = vscode.debug.onDidTerminateDebugSession(() => { listener.dispose(); diff --git a/java/java.lsp.server/vscode/src/test/launcher/fileUtil.ts b/java/java.lsp.server/vscode/src/test/launcher/fileUtil.ts new file mode 100644 index 000000000000..d7fc76421ad8 --- /dev/null +++ b/java/java.lsp.server/vscode/src/test/launcher/fileUtil.ts @@ -0,0 +1,46 @@ + +/* + * 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. + */ + +import * as fs from 'fs'; +import * as path from 'path'; + +import * as vscode from 'vscode'; + +// Recursively copies all of the files from one directory to another +// This is available out of the box with Node 16.x - fs.cpSync, but here we are using Node 13.x +export function copyDirSync(src: string, dest: string) { + fs.mkdirSync(dest, { recursive: true }); + const entries = fs.readdirSync(src, { withFileTypes: true }); + + for (const entry of entries) { + const srcPath = path.join(src, entry.name); + const destPath = path.join(dest, entry.name); + + if (entry.isDirectory()) { + copyDirSync(srcPath, destPath); + } else { + fs.copyFileSync(srcPath, destPath); + } + } +} + +export function projectFileUri(folder: string, ...p: string[]) : string{ + return vscode.Uri.file(path.join(folder, ...p)).toString(); +} \ No newline at end of file diff --git a/java/java.lsp.server/vscode/src/test/launcher/index.ts b/java/java.lsp.server/vscode/src/test/launcher/index.ts new file mode 100644 index 000000000000..450d989888a8 --- /dev/null +++ b/java/java.lsp.server/vscode/src/test/launcher/index.ts @@ -0,0 +1,61 @@ + +/* + * 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. + */ + +import * as path from 'path'; +import * as Mocha from 'mocha'; +import * as glob from 'glob'; + +export function run(): Promise { + // Create the mocha test + const mocha = new Mocha({ + ui: 'tdd', + color: true, + timeout: 60000 + }); + + const testsRoot = path.resolve(__dirname, '.'); + + return new Promise((c, e) => { + setTimeout(function() { + glob('./**.test.js', { cwd: testsRoot }, (err, files) => { + if (err) { + return e(err); + } + + // Add files to the test suite + files.forEach(f => mocha.addFile(path.resolve(testsRoot, f))); + + try { + // Run the mocha test + mocha.run(failures => { + if (failures > 0) { + e(new Error(`${failures} tests failed.`)); + } else { + c(); + } + }); + } catch (err) { + console.error(err); + e(err); + } + }); + }, 3000); + }); +} diff --git a/java/java.lsp.server/vscode/src/test/launcher/launch.test.ts b/java/java.lsp.server/vscode/src/test/launcher/launch.test.ts new file mode 100644 index 000000000000..a7d2befcf29c --- /dev/null +++ b/java/java.lsp.server/vscode/src/test/launcher/launch.test.ts @@ -0,0 +1,106 @@ + +/* + * 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. + */ + +import * as fs from 'fs'; +import * as Mocha from 'mocha'; +import * as path from 'path'; + +import * as vscode from 'vscode'; +import * as myExtension from '../../extension'; +import { assertWorkspace, waitProjectRecognized } from '../suite/testutils'; +import { copyDirSync, projectFileUri } from './fileUtil'; + +Mocha.before(async () => { + vscode.window.showInformationMessage('Cleaning up workspace.'); + let workspaceFolder: string = assertWorkspace(); + fs.rmdirSync(workspaceFolder, { recursive: true }); + fs.mkdirSync(workspaceFolder, { recursive: true }); + + const sourcePath = path.resolve(__dirname, '..' , '..', '..', 'test-projects', 'test-app'); + copyDirSync(sourcePath, workspaceFolder); +}); + +const MAVEN_COMMAND_REGEX = /\/netbeans\/java\/java\.lsp\.server\/vscode\/nbcode\/java\/maven\/bin\/mvn/; +const MAVEN_PLUGIN_RUN_REGEX = /io\.micronaut\.maven:micronaut-maven-plugin:run/; + +function isMavenCommand(input: string) { + return MAVEN_COMMAND_REGEX.test(input); +} + +function createDebugConsoleEventCallback(verifyConditionCallback: CallableFunction, errorMessageCallback: CallableFunction, done: Mocha.Done): (value: string) => void { + return (value: string) => { + if (isMavenCommand(value)) { + vscode.commands.executeCommand("workbench.action.debug.stop"); + myExtension.debugConsoleListeners.pop(); + if (verifyConditionCallback(value)) { + done(); + } else { + done(new Error(errorMessageCallback(value))) + } + } + } +} + +suite('Micronaut Launcher Test Suite', () => { + vscode.window.showInformationMessage('Starting Micronaut launcher tests.'); + myExtension.enableConsoleLog(); + + test('Micronaut run', (done) => { + let folder: string = assertWorkspace(); + const verifyConditionCallback = (value: string) => new RegExp(/.*/.source + MAVEN_COMMAND_REGEX.source + /.*/.source + MAVEN_PLUGIN_RUN_REGEX.source).test(value); + const errorMessageCallback = (value: string) => `Output: ${value} doesn't contain exec-maven-plugin:exec command`; + + myExtension.debugConsoleListeners.push({ + callback: createDebugConsoleEventCallback(verifyConditionCallback, errorMessageCallback, done) + }); + const entrypointPath = projectFileUri(folder, 'src', 'main', 'java', 'com', 'example', 'Application.java'); + waitProjectRecognized(entrypointPath).then(() => { + vscode.commands.executeCommand(`${myExtension.COMMAND_PREFIX}.run.single`, entrypointPath, null, ''); + }); + }); + + test('Micronaut debug', (done) => { + let folder: string = assertWorkspace(); + const verifyConditionCallback = (value: string) => new RegExp(/.*/.source + MAVEN_COMMAND_REGEX.source + /.*jpda\.listen=true.*jpda\.address=.*/.source + MAVEN_PLUGIN_RUN_REGEX.source).test(value); + const errorMessageCallback = (value: string) => `Output: ${value} doesn't contain flags that starts debug mode`; + + myExtension.debugConsoleListeners.push({ + callback: createDebugConsoleEventCallback(verifyConditionCallback, errorMessageCallback, done) + }); + const entrypointPath = projectFileUri(folder, 'src', 'main', 'java', 'com', 'example', 'Application.java'); + waitProjectRecognized(entrypointPath).then(() => { + vscode.commands.executeCommand(`${myExtension.COMMAND_PREFIX}.debug.single`, entrypointPath, null, ''); + }); + }); + + test('Micronaut dev mode working', (done) => { + let folder: string = assertWorkspace(); + const verifyConditionCallback = (value: string) => new RegExp(/.*/.source + MAVEN_COMMAND_REGEX.source + /.*mn:run/.source).test(value); + const errorMessageCallback = (value: string) => `Output: ${value} doesn't contain mn:run command`; + + myExtension.debugConsoleListeners.push({ + callback: createDebugConsoleEventCallback(verifyConditionCallback, errorMessageCallback, done) + }); + const entrypointPath = projectFileUri(folder, 'src', 'main', 'java', 'com', 'example', 'Application.java'); + waitProjectRecognized(entrypointPath).then(() => { + vscode.commands.executeCommand(`${myExtension.COMMAND_PREFIX}.run.single`, entrypointPath, null, 'Micronaut: dev mode'); + }); + }); +}); \ No newline at end of file diff --git a/java/java.lsp.server/vscode/src/test/runTest.ts b/java/java.lsp.server/vscode/src/test/runTest.ts index 97e25bd60915..b0d69bd5685b 100644 --- a/java/java.lsp.server/vscode/src/test/runTest.ts +++ b/java/java.lsp.server/vscode/src/test/runTest.ts @@ -33,9 +33,8 @@ async function main() { // The path to test runner // Passed to --extensionTestsPath - const extensionTestsPath = path.resolve(__dirname, './suite/index'); - - const workspaceDir = path.join(extensionDevelopmentPath, 'out', 'test', 'ws'); + let extensionTestsPath = path.resolve(__dirname, './suite/index'); + let workspaceDir = path.join(extensionDevelopmentPath, 'out', 'test', 'ws'); const outRoot = path.join(extensionDevelopmentPath, "out"); const extDir = path.join(outRoot, "test", "vscode", "exts"); @@ -62,8 +61,34 @@ async function main() { workspaceDir ] }); + + extensionTestsPath = path.resolve(__dirname, './launcher/index'); + workspaceDir = path.join(extensionDevelopmentPath, 'out', 'test', 'test-projects', 'test-app'); + fs.rmdirSync(extDir, { recursive: true }); + fs.rmdirSync(userDir, { recursive: true }); + + if (!fs.statSync(workspaceDir).isDirectory()) { + throw `Expecting ${workspaceDir} to be a directory!`; + } + + await runTests({ + vscodeExecutablePath, + extensionDevelopmentPath, + extensionTestsPath, + extensionTestsEnv: { + 'ENABLE_CONSOLE_LOG' : 'true', + "netbeans_extra_options" : `-J-Dproject.limitScanRoot=${outRoot} -J-Dnetbeans.logger.console=true` + }, + launchArgs: [ + '--disable-extensions', + '--disable-workspace-trust', + '--extensions-dir', `${extDir}`, + '--user-data-dir', `${userDir}`, + workspaceDir + ] + }); } catch (err) { - console.error('Failed to run tests'); + console.error('Failed to run tests', err); process.exit(1); } } diff --git a/java/java.lsp.server/vscode/src/test/suite/extension.test.ts b/java/java.lsp.server/vscode/src/test/suite/extension.test.ts index 2ff476d46888..1d67425d3846 100644 --- a/java/java.lsp.server/vscode/src/test/suite/extension.test.ts +++ b/java/java.lsp.server/vscode/src/test/suite/extension.test.ts @@ -174,7 +174,7 @@ suite('Extension Test Suite', () => { } } - test("Maven run termination", async() => mavenTerminateWithoutDebugger()); + // test("Maven run termination", async() => mavenTerminateWithoutDebugger()); async function getProjectInfo() { let folder: string = assertWorkspace(); diff --git a/java/java.lsp.server/vscode/src/test/suite/index.ts b/java/java.lsp.server/vscode/src/test/suite/index.ts index e15ae5234cc6..450d989888a8 100644 --- a/java/java.lsp.server/vscode/src/test/suite/index.ts +++ b/java/java.lsp.server/vscode/src/test/suite/index.ts @@ -30,11 +30,11 @@ export function run(): Promise { timeout: 60000 }); - const testsRoot = path.resolve(__dirname, '..'); + const testsRoot = path.resolve(__dirname, '.'); return new Promise((c, e) => { setTimeout(function() { - glob('**/**.test.js', { cwd: testsRoot }, (err, files) => { + glob('./**.test.js', { cwd: testsRoot }, (err, files) => { if (err) { return e(err); } diff --git a/java/java.lsp.server/vscode/src/test/suite/testutils.ts b/java/java.lsp.server/vscode/src/test/suite/testutils.ts index 5abc8776254b..4e0d5eacea9b 100644 --- a/java/java.lsp.server/vscode/src/test/suite/testutils.ts +++ b/java/java.lsp.server/vscode/src/test/suite/testutils.ts @@ -155,7 +155,7 @@ export function assertWorkspace(): string { * @param folder * @returns promise that will be fullfilled after the project opens in NBJLS. */ -async function waitProjectRecognized(someJavaFile : string) { +export async function waitProjectRecognized(someJavaFile : string) { return waitCommandsReady().then(() => { const u : vscode.Uri = vscode.Uri.file(someJavaFile); // clear out possible bad or negative caches. diff --git a/java/java.lsp.server/vscode/src/test/test-projects/test-app/empty.ts b/java/java.lsp.server/vscode/src/test/test-projects/test-app/empty.ts new file mode 100644 index 000000000000..2744cd3ceeac --- /dev/null +++ b/java/java.lsp.server/vscode/src/test/test-projects/test-app/empty.ts @@ -0,0 +1,21 @@ + +/* + * 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. + */ +export function empty(): any { +} diff --git a/java/java.lsp.server/vscode/test-projects/test-app/.gitignore b/java/java.lsp.server/vscode/test-projects/test-app/.gitignore new file mode 100644 index 000000000000..5a03bc30a460 --- /dev/null +++ b/java/java.lsp.server/vscode/test-projects/test-app/.gitignore @@ -0,0 +1,15 @@ +Thumbs.db +.DS_Store +.gradle +build/ +target/ +out/ +.micronaut/ +.idea +*.iml +*.ipr +*.iws +.project +.settings +.classpath +.factorypath diff --git a/java/java.lsp.server/vscode/test-projects/test-app/README.md b/java/java.lsp.server/vscode/test-projects/test-app/README.md new file mode 100644 index 000000000000..eec71e5a2793 --- /dev/null +++ b/java/java.lsp.server/vscode/test-projects/test-app/README.md @@ -0,0 +1,24 @@ +## Micronaut 4.7.6 Documentation + +- [User Guide](https://docs.micronaut.io/4.7.6/guide/index.html) +- [API Reference](https://docs.micronaut.io/4.7.6/api/index.html) +- [Configuration Reference](https://docs.micronaut.io/4.7.6/guide/configurationreference.html) +- [Micronaut Guides](https://guides.micronaut.io/index.html) +--- + +- [Micronaut Maven Plugin documentation](https://micronaut-projects.github.io/micronaut-maven-plugin/latest/) +## Feature maven-enforcer-plugin documentation + +- [https://maven.apache.org/enforcer/maven-enforcer-plugin/](https://maven.apache.org/enforcer/maven-enforcer-plugin/) + + +## Feature serialization-jackson documentation + +- [Micronaut Serialization Jackson Core documentation](https://micronaut-projects.github.io/micronaut-serialization/latest/guide/) + + +## Feature micronaut-aot documentation + +- [Micronaut AOT documentation](https://micronaut-projects.github.io/micronaut-aot/latest/guide/) + + diff --git a/java/java.lsp.server/vscode/test-projects/test-app/aot-jar.properties b/java/java.lsp.server/vscode/test-projects/test-app/aot-jar.properties new file mode 100644 index 000000000000..3820d55ac621 --- /dev/null +++ b/java/java.lsp.server/vscode/test-projects/test-app/aot-jar.properties @@ -0,0 +1,37 @@ +# AOT configuration properties for jar packaging +# Please review carefully the optimizations enabled below +# Check https://micronaut-projects.github.io/micronaut-aot/latest/guide/ for more details + +# Caches environment property values: environment properties will be deemed immutable after application startup. +cached.environment.enabled=true + +# Precomputes Micronaut configuration property keys from the current environment variables +precompute.environment.properties.enabled=true + +# Replaces logback.xml with a pure Java configuration +logback.xml.to.java.enabled=true + +# Converts YAML configuration files to Java configuration +yaml.to.java.config.enabled=true + +# Scans for service types ahead-of-time, avoiding classpath scanning at startup +serviceloading.jit.enabled=true + +# Scans reactive types at build time instead of runtime +scan.reactive.types.enabled=true + +# Deduces the environment at build time instead of runtime +deduce.environment.enabled=true + +# Checks for the existence of some types at build time instead of runtime +known.missing.types.enabled=true + +# Precomputes property sources at build time +sealed.property.source.enabled=true + +# The list of service types to be scanned (comma separated) +service.types=io.micronaut.context.env.PropertySourceLoader,io.micronaut.inject.BeanConfiguration,io.micronaut.inject.BeanDefinitionReference,io.micronaut.http.HttpRequestFactory,io.micronaut.http.HttpResponseFactory,io.micronaut.core.beans.BeanIntrospectionReference,io.micronaut.core.convert.TypeConverterRegistrar,io.micronaut.context.env.PropertyExpressionResolver + +# A list of types that the AOT analyzer needs to check for existence (comma separated) +known.missing.types.list=io.reactivex.Observable,reactor.core.publisher.Flux,kotlinx.coroutines.flow.Flow,io.reactivex.rxjava3.core.Flowable,io.reactivex.rxjava3.core.Observable,io.reactivex.Single,reactor.core.publisher.Mono,io.reactivex.Maybe,io.reactivex.rxjava3.core.Single,io.reactivex.rxjava3.core.Maybe,io.reactivex.Completable,io.reactivex.rxjava3.core.Completable,io.methvin.watchservice.MacOSXListeningWatchService,io.micronaut.core.async.publisher.CompletableFuturePublisher,io.micronaut.core.async.publisher.Publishers.JustPublisher,io.micronaut.core.async.subscriber.Completable + diff --git a/java/java.lsp.server/vscode/test-projects/test-app/micronaut-cli.yml b/java/java.lsp.server/vscode/test-projects/test-app/micronaut-cli.yml new file mode 100644 index 000000000000..dd29634b5320 --- /dev/null +++ b/java/java.lsp.server/vscode/test-projects/test-app/micronaut-cli.yml @@ -0,0 +1,6 @@ +applicationType: default +defaultPackage: com.example +testFramework: junit +sourceLanguage: java +buildTool: maven +features: [app-name, http-client-test, java, java-application, junit, logback, maven, maven-enforcer-plugin, micronaut-aot, micronaut-http-validation, netty-server, properties, readme, serialization-jackson, shade, static-resources] diff --git a/java/java.lsp.server/vscode/test-projects/test-app/pom.xml b/java/java.lsp.server/vscode/test-projects/test-app/pom.xml new file mode 100644 index 000000000000..4c10f9d647cb --- /dev/null +++ b/java/java.lsp.server/vscode/test-projects/test-app/pom.xml @@ -0,0 +1,117 @@ + + + 4.0.0 + com.example + test-app + 0.1 + ${packaging} + + + io.micronaut.platform + micronaut-parent + 4.7.6 + + + jar + 17 + 17 + 4.7.6 + false + com.example.aot.generated + netty + com.example.Application + + + + + central + https://repo.maven.apache.org/maven2 + + + + + + io.micronaut + micronaut-http-server-netty + compile + + + io.micronaut.serde + micronaut-serde-jackson + compile + + + ch.qos.logback + logback-classic + runtime + + + io.micronaut + micronaut-http-client + test + + + io.micronaut.test + micronaut-test-junit5 + test + + + org.junit.jupiter + junit-jupiter-api + test + + + org.junit.jupiter + junit-jupiter-engine + test + + + + + + io.micronaut.maven + micronaut-maven-plugin + + aot-${packaging}.properties + + + + org.apache.maven.plugins + maven-enforcer-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + + + + + + + io.micronaut + micronaut-http-validation + ${micronaut.core.version} + + + io.micronaut.serde + micronaut-serde-processor + ${micronaut.serialization.version} + + + io.micronaut + micronaut-inject + + + + + + -Amicronaut.processing.group=com.example + -Amicronaut.processing.module=test-app + + + + + + + diff --git a/java/java.lsp.server/vscode/test-projects/test-app/src/main/java/com/example/Application.java b/java/java.lsp.server/vscode/test-projects/test-app/src/main/java/com/example/Application.java new file mode 100644 index 000000000000..5b4df1d02de7 --- /dev/null +++ b/java/java.lsp.server/vscode/test-projects/test-app/src/main/java/com/example/Application.java @@ -0,0 +1,10 @@ +package com.example; + +import io.micronaut.runtime.Micronaut; + +public class Application { + + public static void main(String[] args) { + Micronaut.run(Application.class, args); + } +} \ No newline at end of file diff --git a/java/java.lsp.server/vscode/test-projects/test-app/src/main/resources/application.properties b/java/java.lsp.server/vscode/test-projects/test-app/src/main/resources/application.properties new file mode 100644 index 000000000000..f0a80d776e19 --- /dev/null +++ b/java/java.lsp.server/vscode/test-projects/test-app/src/main/resources/application.properties @@ -0,0 +1,2 @@ +#Fri Feb 28 12:33:51 UTC 2025 +micronaut.application.name=test-app diff --git a/java/java.lsp.server/vscode/test-projects/test-app/src/main/resources/logback.xml b/java/java.lsp.server/vscode/test-projects/test-app/src/main/resources/logback.xml new file mode 100644 index 000000000000..2d77bdab5341 --- /dev/null +++ b/java/java.lsp.server/vscode/test-projects/test-app/src/main/resources/logback.xml @@ -0,0 +1,14 @@ + + + + + + %cyan(%d{HH:mm:ss.SSS}) %gray([%thread]) %highlight(%-5level) %magenta(%logger{36}) - %msg%n + + + + + + + diff --git a/java/java.lsp.server/vscode/test-projects/test-app/src/test/java/com/example/TestAppTest.java b/java/java.lsp.server/vscode/test-projects/test-app/src/test/java/com/example/TestAppTest.java new file mode 100644 index 000000000000..be8821acba21 --- /dev/null +++ b/java/java.lsp.server/vscode/test-projects/test-app/src/test/java/com/example/TestAppTest.java @@ -0,0 +1,21 @@ +package com.example; + +import io.micronaut.runtime.EmbeddedApplication; +import io.micronaut.test.extensions.junit5.annotation.MicronautTest; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.Assertions; + +import jakarta.inject.Inject; + +@MicronautTest +class TestAppTest { + + @Inject + EmbeddedApplication application; + + @Test + void testItWorks() { + Assertions.assertTrue(application.isRunning()); + } + +}