diff --git a/java-analyzer-bundle.test/README.md b/java-analyzer-bundle.test/README.md
index e5f76c8..34e11e1 100644
--- a/java-analyzer-bundle.test/README.md
+++ b/java-analyzer-bundle.test/README.md
@@ -16,7 +16,7 @@ make phase2 # Integration tests only
### Run Specific Tests
```bash
-# Maven unit tests (48 tests)
+# Maven unit tests (76 tests)
mvn clean integration-test
# Go integration tests (specific test)
@@ -31,12 +31,17 @@ This module contains two phases of testing:
### Phase 1: Unit Tests (Maven/JUnit)
**Location**: `src/main/java/`
**Technology**: JUnit-Plugin (runs in Eclipse environment)
-**Count**: 48 tests
+**Count**: 76 tests
-Tests command handling, parameter parsing, and error cases:
+Tests command handling, parameter parsing, AST visitors, symbol providers, and error cases:
- `RuleEntryParamsTest` (14 tests)
- `AnnotationQueryTest` (18 tests)
- `SampleDelegateCommandHandlerTest` (16 tests)
+- `CustomASTVisitorTest` (16 tests)
+- `MethodDeclarationSymbolProviderTest` (8 tests)
+- `CommandHandlerTest` (2 tests)
+- `JavaAnnotationTest` (1 test)
+- `PomDependencyTest` (1 test)
**Run**: `mvn clean integration-test`
@@ -132,7 +137,7 @@ Real-world Spring MVC application:
- **Java 17** - Target platform and tests
- **Eclipse Tycho 3.0.1** - Build system
-- **JDT.LS 1.35.0** - Language server
+- **JDT.LS 1.51.0** - Language server
- **Go 1.21+** - Integration test framework
- **Podman/Docker** - Container runtime for CI/CD
- **JUnit 4** - Unit test framework
@@ -179,7 +184,7 @@ java-analyzer-bundle.test/
org.eclipse.tycho
tycho-surefire-plugin
- true
+ false
false
@@ -193,7 +198,12 @@ java-analyzer-bundle.test/
**Two-Phase Execution**:
1. **Phase 1**: Maven unit tests (`mvn clean integration-test`)
-2. **Phase 2**: Build container β Go integration tests
+2. **Phase 2**: Build self-contained container (default `Dockerfile`) β Go integration tests
+
+**Container Images**:
+- **CI** uses the default `Dockerfile` which builds the plugin JAR from source inside the container
+- **Local** (`make phase2`) uses `Dockerfile.test` which expects a pre-built JAR on the host
+- Both produce equivalent images with JDT.LS + the analyzer plugin
**Triggers**:
- Push to `main` or `maven-index` branches
@@ -242,8 +252,9 @@ go test -v -run TestSpecificTest
### Build Test Container
```bash
-# From repository root
-podman build -t jdtls-analyzer:test .
+# From repository root (requires pre-built JAR via mvn install)
+mvn clean install -DskipTests
+podman build -t jdtls-analyzer:test -f Dockerfile.test .
```
---
diff --git a/java-analyzer-bundle.test/docs/README.md b/java-analyzer-bundle.test/docs/README.md
index 7396181..5a71b5d 100644
--- a/java-analyzer-bundle.test/docs/README.md
+++ b/java-analyzer-bundle.test/docs/README.md
@@ -125,15 +125,20 @@ Detailed overview of the Java test projects:
## π§ͺ Test Structure
-### Phase 1: Maven Unit Tests (48 tests)
+### Phase 1: Maven Unit Tests (76 tests)
**Location**: `../src/main/java/`
**Framework**: JUnit-Plugin
-**Coverage**: Command handling, parameter parsing, error cases
+**Coverage**: Command handling, parameter parsing, AST visitors, symbol providers, error cases
**Tests**:
- `RuleEntryParamsTest` (14 tests)
- `AnnotationQueryTest` (18 tests)
- `SampleDelegateCommandHandlerTest` (16 tests)
+- `CustomASTVisitorTest` (16 tests)
+- `MethodDeclarationSymbolProviderTest` (8 tests)
+- `CommandHandlerTest` (2 tests)
+- `JavaAnnotationTest` (1 test)
+- `PomDependencyTest` (1 test)
**Run**: `mvn clean integration-test`
@@ -171,8 +176,8 @@ Detailed overview of the Java test projects:
## ποΈ Test Projects
### test-project
-**Purpose**: Systematic coverage of all location types
-**Files**: 8 Java files covering all 15 location types
+**Purpose**: Systematic coverage of all location types + advanced features
+**Files**: 19 Java files covering all 15 location types
**Key**: `SampleApplication.java` - main test file with comprehensive patterns
### customers-tomcat-legacy
@@ -200,8 +205,8 @@ make phase2
cd ../integration
go test -v -run TestInheritanceSearch
-# Build test container
-podman build -t jdtls-analyzer:test ..
+# Build test container (run from repository root, requires pre-built JAR via mvn install)
+cd ../.. && podman build -t jdtls-analyzer:test -f Dockerfile.test .
# Run tests in container
cd ../integration
diff --git a/java-analyzer-bundle.test/docs/integration-tests.md b/java-analyzer-bundle.test/docs/integration-tests.md
index f1fc3bf..8c259cd 100644
--- a/java-analyzer-bundle.test/docs/integration-tests.md
+++ b/java-analyzer-bundle.test/docs/integration-tests.md
@@ -21,7 +21,7 @@ Unlike Phase 1 unit tests that only verify commands execute without errors, Phas
β ββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Podman Container β β
β β ββββββββββββββββββββββββββββββββββββββββββββ β β
-β β β JDT.LS Server (1.38.0) β β β
+β β β JDT.LS Server (1.51.0) β β β
β β β + Java Analyzer Bundle Plugin β β β
β β ββββββββββββββββββββββββββββββββββββββββ β β
β β βοΈ LSP over stdio β β
@@ -55,7 +55,8 @@ Go LSP client that communicates with JDT.LS via JSON-RPC 2.0 over stdio using th
- `Initialize()` - Initialize LSP connection and workspace
- `ExecuteCommand()` - Execute workspace commands
- `SearchSymbols()` - Execute analyzer searches via `io.konveyor.tackle.ruleEntry`
-- `Shutdown()` - Gracefully shutdown server
+- `SearchSymbolsWithAnnotation()` - Execute searches with annotation element matching
+- `Shutdown()` / `Close()` - Gracefully shutdown server
**Protocol**: LSP (Language Server Protocol) over stdin/stdout using `jsonrpc2.Connection`
@@ -143,9 +144,12 @@ cd java-analyzer-bundle.test/integration
Or manually with **Podman** (preferred):
```bash
+# First, build the plugin JAR (required by Dockerfile.test)
+mvn clean install -DskipTests
+
# Build the container image from repository root
cd /path/to/java-analyzer-bundle
-podman build -t jdtls-analyzer:test .
+podman build -t jdtls-analyzer:test -f Dockerfile.test .
# Run integration tests with go test
podman run --rm \
@@ -155,14 +159,17 @@ podman run --rm \
--workdir /tests/integration \
--entrypoint /bin/sh \
jdtls-analyzer:test \
- -c "microdnf install -y golang && go mod download && go test -v"
+ -c "go mod download && go test -v"
```
Or with **Docker**:
```bash
+# First, build the plugin JAR (required by Dockerfile.test)
+mvn clean install -DskipTests
+
# Build the Docker image
-docker build -t jdtls-analyzer:test .
+docker build -t jdtls-analyzer:test -f Dockerfile.test .
# Run integration tests with go test
docker run --rm \
@@ -172,10 +179,12 @@ docker run --rm \
--workdir /tests/integration \
--entrypoint /bin/sh \
jdtls-analyzer:test \
- -c "microdnf install -y golang && go mod download && go test -v"
+ -c "go mod download && go test -v"
```
-**Note**: Podman uses `:Z` suffix on volumes for SELinux relabeling. Docker doesn't require this.
+**Notes**:
+- Podman uses `:Z` suffix on volumes for SELinux relabeling. Docker doesn't require this.
+- `Dockerfile.test` requires the plugin JAR to be pre-built on the host (via `mvn install`). It pre-installs golang in the image.
### Via GitHub Actions
@@ -187,12 +196,14 @@ Workflow: `.github/workflows/integration-tests.yml`
The workflow:
1. Runs Phase 1 unit tests with Maven
-2. Builds the JDT.LS container image with Podman
-3. Runs `go test -v` inside the container
+2. Builds a self-contained container image using the default `Dockerfile` (which builds the plugin JAR from source inside the container)
+3. Installs golang at runtime and runs `go test -v` inside the container
+
+**Note**: CI uses the default `Dockerfile` (self-contained, builds JAR from source). Local development uses `Dockerfile.test` (lighter, expects pre-built JAR). Both produce equivalent images with JDT.LS + the analyzer plugin.
### Manually (without containers)
-Requires JDT.LS 1.38.0 and Go 1.21+ installed locally:
+Requires JDT.LS 1.51.0+ and Go 1.21+ installed locally:
```bash
cd java-analyzer-bundle.test/integration
@@ -218,17 +229,17 @@ go test -v -run "TestMethod.*"
### Default Search (Location 0)
```go
-// Search for all List usage across all location types
+// Search for File usage across all location types
symbols, err := c.SearchSymbols(
"test-project",
- "java.util.List",
+ "java.io.File",
0, // location type: default (all locations)
"source-only",
nil,
)
// Expected Results:
-// β Finds List in imports, fields, variables, type references, etc.
+// β Finds File in imports, constructors, type references, fields, variables, etc.
```
### Inheritance (Location 1)
@@ -422,7 +433,7 @@ symbols, err := c.SearchSymbols(
"java.sql.PreparedStatement",
8, // location type: import
"source-only",
- &includedPaths,
+ includedPaths,
)
// Expected Results:
@@ -432,118 +443,71 @@ symbols, err := c.SearchSymbols(
## Test Assertions
-Tests verify using helper functions from `tests/test_utils.go`:
+Tests verify using helper functions from `test_helpers.go`:
-1. **Symbol Existence**:
+1. **Symbol Existence** (check name, optionally kind):
```go
- if VerifySymbolInResults(symbols, "SampleApplication") {
- results.AddPass("Test passed")
- } else {
- results.AddFail("Test failed", "SampleApplication not found")
+ if !verifySymbolInResults(symbols, "SampleApplication") {
+ t.Errorf("SampleApplication not found in results")
}
```
-2. **Symbol Kind**:
+2. **Symbol Location** (check name appears in expected file):
```go
- if VerifySymbolInResults(symbols, "Customer", protocol.Class) {
- results.AddPass("Test passed")
+ if !verifySymbolLocationContains(symbols, "processData", "SampleApplication") {
+ t.Errorf("processData not found in SampleApplication")
}
```
-3. **Symbol Location**:
+3. **Result Count** (verify non-empty results):
```go
- if VerifySymbolLocationContains(symbols, "Customer", "Customer.java") {
- results.AddPass("Test passed")
+ if len(symbols) == 0 {
+ t.Errorf("Expected symbols but got 0 results")
}
```
-4. **Result Count**:
+4. **Container Matching** (check annotation on specific class):
```go
- if count := CountSymbols(symbols); count > 0 {
- results.AddPass(fmt.Sprintf("Found %d results", count))
+ for _, symbol := range symbols {
+ if symbol.Name == "Entity" && symbol.ContainerName == "Customer" {
+ found = true
+ }
}
```
## Expected Output
-```
-============================================================
-Phase 2 Integration Tests - JDT.LS Search Verification
-============================================================
-
-JDT.LS Path: /jdtls
-Workspace: /tests/projects
-
-Initializing JDT.LS client...
-Started JDT.LS server with PID 1234
-JDT.LS initialized successfully
-JDT.LS ready for testing
-
---- Testing Default Searches (Location 0) ---
-β PASS: Default: Find all List usage across all location types
-
---- Testing Inheritance Searches (Location 1) ---
-β PASS: Inheritance: Find SampleApplication extends BaseService
-β PASS: Inheritance: Find DataService extends BaseService
-β PASS: Inheritance: Find CustomException extends Exception
-
---- Testing Method Call Searches (Location 2) ---
-β PASS: Method Call: Find println calls (8 found)
-β PASS: Method Call: Find List.add in SampleApplication
-
---- Testing Constructor Call Searches (Location 3) ---
-β PASS: Constructor: Find ArrayList instantiations (3 found)
-β PASS: Constructor: Find File instantiations (5 found)
-
---- Testing Annotation Searches (Location 4) ---
-β PASS: Annotation: Find @CustomAnnotation on SampleApplication
-
---- Testing Implements Type Searches (Location 5) ---
-β PASS: Implements: Find BaseService implements Serializable
-
---- Testing Enum Constant Searches (Location 6) ---
-β PASS: Enum Constant: Find ACTIVE enum constant references
+The tests use Go's standard `testing` framework and produce output like:
---- Testing Return Type Searches (Location 7) ---
-β PASS: Return Type: Find methods returning String
-
---- Testing Import Searches (Location 8) ---
-β PASS: Import: Find java.io.* imports (2 found)
-
---- Testing Variable Declaration Searches (Location 9) ---
-β PASS: Variable Declaration: Find String variable declarations
-
---- Testing Type Searches (Location 10) ---
-β PASS: Type: Find String type references (15 found)
-
---- Testing Package Declaration Searches (Location 11) ---
-β PASS: Package Declaration: Find io.konveyor.demo package
-
---- Testing Field Declaration Searches (Location 12) ---
-β PASS: Field Declaration: Find String fields
+```
+=== RUN TestDefaultSearch
+=== RUN TestDefaultSearch/Find_BaseService_across_all_locations
+=== RUN TestDefaultSearch/Find_println_across_all_locations
+=== RUN TestDefaultSearch/Find_File_across_all_locations
+--- PASS: TestDefaultSearch (0.15s)
---- Testing Method Declaration Searches (Location 13) ---
-β PASS: Method Declaration: Find getter methods with wildcard
+=== RUN TestInheritanceSearch
+=== RUN TestInheritanceSearch/Find_SampleApplication_extends_BaseService
+=== RUN TestInheritanceSearch/Find_DataService_extends_BaseService
+=== RUN TestInheritanceSearch/Find_CustomException_extends_Exception
+--- PASS: TestInheritanceSearch (0.12s)
---- Testing Class Declaration Searches (Location 14) ---
-β PASS: Class Declaration: Find SampleApplication class
+...
---- Testing customers-tomcat-legacy Project ---
-β PASS: Legacy Project: Find @Entity on Customer
-β PASS: Legacy Project: Find @Service on CustomerService
-β PASS: Legacy Project: Find javax.persistence imports (9 found)
+=== RUN TestAnnotatedElementMatching
+=== RUN TestAnnotatedElementMatching/Find_@ActivationConfigProperty_with_propertyName=destinationLookup
+=== RUN TestAnnotatedElementMatching/Find_@DataSourceDefinition_with_className=org.postgresql.Driver
+=== RUN TestAnnotatedElementMatching/Find_@DataSourceDefinition_with_className=com.mysql.jdbc.Driver
+=== RUN TestAnnotatedElementMatching/Find_@Column_with_nullable=false
+--- PASS: TestAnnotatedElementMatching (0.16s)
---- Testing Priority 1 Advanced Features ---
-β PASS: Annotated Element Matching: Find @ActivationConfigProperty with propertyName=destinationLookup
-β PASS: Annotated Element Matching: Find @DataSourceDefinition with PostgreSQL driver
-β PASS: Annotated Element Matching: Find @DataSourceDefinition with MySQL driver
-β PASS: Annotated Element Matching: Find @Column with nullable=false
-β PASS: File Path Filtering: Find PreparedStatement imports in persistence package
-β PASS: File Path Filtering: Verify filtering excludes other packages
+=== RUN TestFilePathFiltering
+=== RUN TestFilePathFiltering/Find_PreparedStatement_imports_with_package-level_filtering
+=== RUN TestFilePathFiltering/Verify_file_path_filtering_excludes_other_packages
+--- PASS: TestFilePathFiltering (0.08s)
-============================================================
-Test Results: 18/18 passed (100%)
-============================================================
+PASS
+ok github.com/konveyor/java-analyzer-bundle/integration 5.234s
```
## Troubleshooting
@@ -772,15 +736,18 @@ public class SampleApplication extends BaseService { }
#### β
Location 0: Default
**Java Features**: Default search behavior (all locations)
-**Test**: `TestDefaultSearch`
+**Test**: `TestDefaultSearch` (3 sub-tests)
**Queries**:
-- `java.util.List` β finds all List usage across all location types
+- `io.konveyor.demo.inheritance.BaseService` β finds BaseService across all locations
+- `println` β finds println across all locations
+- `java.io.File` β finds File in imports, constructors, type references, fields, variables
**Java Code Pattern**:
```java
// Matches in multiple contexts: imports, fields, variables, types, etc.
-import java.util.List;
-private List items;
+import java.io.File;
+private File configFile;
+File tempFile = new File("/tmp/data.txt");
```
**Symbol Results**: All occurrences across all location types
@@ -813,19 +780,24 @@ EnumExample status = EnumExample.ACTIVE;
#### β
Location 7: Return Types
**Java Features**: Method return type declarations
-**Test**: `TestReturnTypeSearch`
+**Test**: `TestReturnTypeSearch` (3 sub-tests)
**Queries**:
- `java.lang.String` β finds all methods returning String
-- `java.util.List` β finds all methods returning List
+- `int` β finds `add` method in Calculator
+- `io.konveyor.demo.EnumExample` β finds `getStatus` method in Calculator
-**Java Code Pattern** (test-project/SampleApplication.java):
+**Java Code Pattern**:
```java
-public String getName() { // String return type
+public String getName() { // String return type (SampleApplication)
return applicationName;
}
-public List getItems() { // List return type
- return items;
+public int add(int a, int b) { // int return type (Calculator)
+ return a + b;
+}
+
+public EnumExample getStatus() { // Custom return type (Calculator)
+ return status;
}
```
@@ -854,19 +826,27 @@ public void processData() {
---
#### β
Location 11: Package Declarations
-**Java Features**: Package statements at top of Java files
-**Test**: `TestPackageDeclarationSearch`
+**Java Features**: Package usage via imports and references (not literal package statements)
+**Test**: `TestPackageDeclarationSearch` (8 sub-tests)
**Queries**:
-- `io.konveyor.demo` β finds all classes in this package
-- `io.konveyor.demo.*` β finds all classes in this package and subpackages
+- `io.konveyor.demo` β may return 0 results (base package never referenced directly)
+- `io.konveyor.demo.inheritance` β finds classes referencing this sub-package
+- `io.konveyor.d*` β wildcard matching across demo sub-packages
+- `java.util` β finds SampleApplication.java (uses java.util imports)
+- `java.sql` β finds persistence package files (uses java.sql imports)
+- `jakarta.*` β finds ServletExample.java (uses jakarta imports)
+- `javax.persistence` β finds entity/Product.java and persistence files
+- `java.io` β finds ServletExample.java (uses java.io imports)
+
+**Note**: PACKAGE search with REFERENCES finds where packages are used in imports/FQNs, not literal `package` statements.
**Java Code Pattern** (all test files):
```java
-package io.konveyor.demo;
-package io.konveyor.demo.ordermanagement.model;
+import java.util.List; // java.util package reference
+import javax.persistence.Entity; // javax.persistence package reference
```
-**Symbol Results**: Package declaration locations
+**Symbol Results**: Package reference locations in import statements and FQNs
---
@@ -891,17 +871,19 @@ private static final int MAX_RETRIES = 3; // static final field
#### β
Location 13: Method Declarations
**Java Features**: Method signature declarations
-**Test**: `TestMethodDeclarationSearch`
+**Test**: `TestMethodDeclarationSearch` (4 sub-tests)
**Queries**:
-- `processData` β finds processData method declarations
-- `get*` β finds all getter methods (wildcard)
-- `print*` β finds all methods starting with print
+- `processData` β finds processData method declaration
+- `getName` β finds getName method declaration
+- `add` β finds add method in Calculator
+- `initialize` β finds initialize method declaration
-**Java Code Pattern** (test-project/SampleApplication.java):
+**Java Code Pattern** (test-project/SampleApplication.java, Calculator.java):
```java
public void processData() { } // processData method
public String getName() { } // getName method
-public static void printVersion() { } // static method
+public int add(int a, int b) { } // add method (Calculator)
+public void initialize() { } // initialize method
```
**Symbol Results**: Method declaration locations
@@ -993,7 +975,7 @@ The integration tests use the following Go packages:
```go
require (
- github.com/konveyor/analyzer-lsp v0.4.0-alpha.1
+ github.com/konveyor/analyzer-lsp v0.8.0
github.com/sirupsen/logrus v1.9.3
)
```
diff --git a/java-analyzer-bundle.test/docs/query-reference.md b/java-analyzer-bundle.test/docs/query-reference.md
index e8d1df4..cf84668 100644
--- a/java-analyzer-bundle.test/docs/query-reference.md
+++ b/java-analyzer-bundle.test/docs/query-reference.md
@@ -433,15 +433,15 @@ Some location types accept simple names:
| `TestImportSearch` | 8 | 1 | Verify import statements |
| `TestVariableDeclarationSearch` | 9 | 3 | Verify local variable declarations |
| `TestTypeSearch` | 10 | 1 | Verify type reference count |
-| `TestPackageDeclarationSearch` | 11 | 2 | Verify package declarations |
+| `TestPackageDeclarationSearch` | 11 | 8 | Verify package references in imports/FQNs |
| `TestFieldDeclarationSearch` | 12 | 3 | Verify field declarations |
| `TestMethodDeclarationSearch` | 13 | 4 | Verify method declarations |
| `TestClassDeclarationSearch` | 14 | 1 | Verify class declaration |
| `TestCustomersTomcatLegacy` | 4, 8 | 3 | Migration pattern verification |
| `TestAnnotatedElementMatching` | 4 | 4 | Annotation attributes matching |
-| `TestFilePathFiltering` | 9 | 2 | File path filtering with includedPaths |
+| `TestFilePathFiltering` | 8 | 2 | File path filtering with includedPaths |
-**Total Query Executions**: 40+ unique search queries across 18 test functions covering all 15 location types
+**Total Query Executions**: 47 search queries across 18 test functions covering all 15 location types
---
@@ -451,15 +451,28 @@ Some location types accept simple names:
**Purpose**: Systematic coverage of all location types
-**Key Files**:
+**Key Files** (19 Java files):
- `SampleApplication.java` - Main test file with method calls, constructors, fields, variables
-- `BaseService.java` - Inheritance base class, implements Serializable
-- `DataService.java` - Another BaseService subclass
-- `CustomException.java` - Exception inheritance
-- `CustomAnnotation.java` - Custom annotation definition
+- `Calculator.java` - Return type examples (int, EnumExample)
- `EnumExample.java` - Enum with constants (location 6)
-
-**Coverage**: Designed to test all 15 location types systematically
+- `PackageUsageExample.java` - Package reference patterns
+- `ServletExample.java` - Jakarta servlet example
+- `annotations/CustomAnnotation.java` - Custom annotation definition
+- `annotations/DeprecatedApi.java` - Deprecated API annotation
+- `inheritance/BaseService.java` - Abstract base class, implements Serializable
+- `inheritance/DataService.java` - Another BaseService subclass
+- `inheritance/CustomException.java` - Exception inheritance
+- `jms/MessageProcessor.java` - @MessageDriven with @ActivationConfigProperty
+- `jms/TopicMessageProcessor.java` - Additional JMS example
+- `config/DataSourceConfig.java` - @DataSourceDefinition (PostgreSQL)
+- `config/MySQLDataSourceConfig.java` - @DataSourceDefinition (MySQL)
+- `entity/Product.java` - @Entity, @Column with attributes
+- `persistence/ServiceWithEntityManager.java` - Mixed JPA/JDBC
+- `persistence/JdbcOnlyService.java` - Pure JDBC with PreparedStatement
+- `persistence/AnotherMixedService.java` - Additional mixed pattern
+- `persistence/PureJpaService.java` - Pure JPA (no JDBC)
+
+**Coverage**: Designed to test all 15 location types + advanced features systematically
---
diff --git a/java-analyzer-bundle.test/docs/quick-reference.md b/java-analyzer-bundle.test/docs/quick-reference.md
index f8c2f6c..a3cb74c 100644
--- a/java-analyzer-bundle.test/docs/quick-reference.md
+++ b/java-analyzer-bundle.test/docs/quick-reference.md
@@ -6,9 +6,9 @@ Quick reference for what's tested and what's not in the Java Analyzer Bundle int
```
Location Types: 15/15 tested (100%) β
-Test Functions: 18
+Test Functions: 18 (47 sub-tests total)
Advanced Features: 2/2 tested (Priority 1)
-Query Patterns: 40+ unique queries
+Query Patterns: 47 unique queries
Test Projects: 2 (systematic + real-world)
```
@@ -31,7 +31,7 @@ Test Projects: 2 (systematic + real-world)
| **8** | Imports | `java.io.File`, `javax.persistence.Entity` | both |
| **9** | Variable Decls | `java.lang.String`, `java.io.File` | test-project |
| **10** | Type Refs | `java.util.ArrayList` | test-project |
-| **11** | Package Decls | `io.konveyor.demo` | test-project |
+| **11** | Package Decls | `io.konveyor.demo.*`, `java.util`, `jakarta.*`, etc. | test-project |
| **12** | Field Decls | `java.util.List`, `java.io.File` | test-project |
| **13** | Method Decls | `processData`, `getName`, `add` | test-project |
| **14** | Class Decls | `SampleApplication` | test-project |
@@ -52,17 +52,35 @@ integration/
### Java Test Projects
```
projects/
-βββ test-project/ # Systematic pattern coverage
+βββ test-project/ # Systematic pattern coverage (19 Java files)
β βββ src/main/java/io/konveyor/demo/
-β βββ SampleApplication.java # Main test file
-β βββ inheritance/BaseService.java
+β βββ SampleApplication.java # Main test file
+β βββ Calculator.java # Return type examples
+β βββ EnumExample.java # Enum constant examples
+β βββ PackageUsageExample.java # Package reference examples
+β βββ ServletExample.java # Jakarta servlet example
β βββ annotations/CustomAnnotation.java
-β βββ EnumExample.java
+β βββ annotations/DeprecatedApi.java
+β βββ inheritance/BaseService.java
+β βββ inheritance/DataService.java
+β βββ inheritance/CustomException.java
+β βββ jms/MessageProcessor.java # JMS/EJB annotations
+β βββ jms/TopicMessageProcessor.java
+β βββ config/DataSourceConfig.java # PostgreSQL @DataSourceDefinition
+β βββ config/MySQLDataSourceConfig.java # MySQL @DataSourceDefinition
+β βββ entity/Product.java # JPA @Entity, @Column
+β βββ persistence/ServiceWithEntityManager.java
+β βββ persistence/JdbcOnlyService.java
+β βββ persistence/AnotherMixedService.java
+β βββ persistence/PureJpaService.java
β
-βββ customers-tomcat-legacy/ # Real-world migration
+βββ customers-tomcat-legacy/ # Real-world migration (10 Java files)
βββ src/main/java/io/konveyor/demo/ordermanagement/
βββ model/Customer.java # JPA entity
- βββ service/CustomerService.java # Spring service
+ βββ service/CustomerService.java # Spring service
+ βββ controller/CustomerController.java
+ βββ repository/CustomerRepository.java
+ βββ config/PersistenceConfig.java
```
## Test Functions
@@ -82,7 +100,7 @@ projects/
| `TestImportSearch` | 8 | 1 | Verify import statements |
| `TestVariableDeclarationSearch` | 9 | 3 | Verify local variable declarations |
| `TestTypeSearch` | 10 | 1 | Verify type references |
-| `TestPackageDeclarationSearch` | 11 | 2 | Verify package declarations |
+| `TestPackageDeclarationSearch` | 11 | 8 | Verify package references in imports/FQNs |
| `TestFieldDeclarationSearch` | 12 | 3 | Verify field declarations |
| `TestMethodDeclarationSearch` | 13 | 4 | Verify method declarations |
| `TestClassDeclarationSearch` | 14 | 1 | Verify class declaration |
@@ -180,8 +198,9 @@ make phase2 # Just integration tests
### Manual Container Run
```bash
-# Build image
-podman build -t jdtls-analyzer:test .
+# Build plugin JAR first, then build image (from repository root)
+mvn clean install -DskipTests
+podman build -t jdtls-analyzer:test -f Dockerfile.test .
# Run tests
podman run --rm \
@@ -191,9 +210,12 @@ podman run --rm \
--workdir /tests/integration \
--entrypoint /bin/sh \
jdtls-analyzer:test \
- -c "microdnf install -y golang && go mod download && go test -v"
+ -c "go mod download && go test -v"
```
+**Note**: `Dockerfile.test` requires a pre-built JAR and pre-installs golang. CI uses the
+default `Dockerfile` which builds the JAR from source and installs golang at runtime.
+
### Run Specific Test
```bash
go test -v -run TestInheritanceSearch
diff --git a/java-analyzer-bundle.test/docs/test-projects.md b/java-analyzer-bundle.test/docs/test-projects.md
index 180c92b..4515820 100644
--- a/java-analyzer-bundle.test/docs/test-projects.md
+++ b/java-analyzer-bundle.test/docs/test-projects.md
@@ -12,16 +12,39 @@ A comprehensive test project designed to cover all search location types (0-14)
**Technologies**:
- Java 17
- Jakarta Servlet API 5.0
+- javax.persistence-api 2.2 (JPA annotations)
+- javax.ejb-api 3.2.2 (EJB/JMS annotations)
+- javax.jms-api 2.0.1 (JMS API)
+- javax.annotation-api 1.3.2 (@DataSourceDefinition)
-**Package Structure**:
+**Package Structure** (19 Java files):
```
io.konveyor.demo/
-βββ annotations/ - Custom annotations
-βββ inheritance/ - Inheritance and interface examples
-βββ SampleApplication.java - Main test class with various patterns
-βββ Calculator.java - Return type examples
-βββ EnumExample.java - Enum constant examples
-βββ ServletExample.java - Jakarta EE servlet example
+βββ SampleApplication.java - Main test class with various patterns
+βββ Calculator.java - Return type examples (int, EnumExample)
+βββ EnumExample.java - Enum constant examples
+βββ PackageUsageExample.java - Package reference patterns
+βββ ServletExample.java - Jakarta EE servlet example
+βββ annotations/
+β βββ CustomAnnotation.java - Custom annotation definition
+β βββ DeprecatedApi.java - Deprecated API annotation
+βββ inheritance/
+β βββ BaseService.java - Abstract base class (Serializable)
+β βββ DataService.java - Extends BaseService
+β βββ CustomException.java - Extends Exception
+βββ jms/
+β βββ MessageProcessor.java - @MessageDriven with @ActivationConfigProperty
+β βββ TopicMessageProcessor.java - Additional JMS example
+βββ config/
+β βββ DataSourceConfig.java - @DataSourceDefinition (PostgreSQL)
+β βββ MySQLDataSourceConfig.java - @DataSourceDefinition (MySQL)
+βββ entity/
+β βββ Product.java - @Entity, @Column with attributes
+βββ persistence/
+ βββ ServiceWithEntityManager.java - Mixed JPA/JDBC
+ βββ JdbcOnlyService.java - Pure JDBC with PreparedStatement
+ βββ AnotherMixedService.java - Additional mixed pattern
+ βββ PureJpaService.java - Pure JPA (no JDBC)
```
**Covered Location Types**:
@@ -197,33 +220,18 @@ expectedResults: CustomerRepository.java
---
-## Integration Test Strategy
-
-### Phase 1: Basic Verification Tests (Current)
-- β
Verify commands execute without exceptions
-- β
Verify parameter parsing
-- β
Verify non-null results
-
-### Phase 2: Search Result Verification (Next)
-1. **Load test projects into Eclipse workspace**
-2. **Verify search result counts**:
- ```java
- assertEquals(expectedCount, results.size());
- ```
-3. **Verify symbol information**:
- ```java
- assertEquals("Customer", symbol.getName());
- assertEquals(SymbolKind.Class, symbol.getKind());
- assertTrue(symbol.getLocation().getUri().contains("Customer.java"));
- ```
-
-### Phase 3: Migration Pattern Testing
-Test common migration scenarios:
-- **javax β jakarta** namespace migration
-- **Oracle β PostgreSQL** driver migration
-- **JBoss β SLF4J** logging migration
-- **Spring Framework** version upgrades
-- **Legacy servlet β Spring Boot** migration
+## Integration Test Status
+
+All planned testing phases are complete:
+
+- β
Commands execute without exceptions
+- β
Parameter parsing and validation
+- β
Real JDT.LS server with analyzer plugin loaded
+- β
Search result verification (symbol names, kinds, locations)
+- β
Migration pattern testing (javaxβjakarta, Spring, JMS)
+- β
Advanced features: annotated element matching, file path filtering
+
+**18 test functions, 47 sub-tests, 100% pass rate.**
---
@@ -278,11 +286,12 @@ When adding new test projects:
---
-## Next Steps
+## Completed Milestones
-1. **β
Create test project structures**
-2. **β
Add sample code covering all location types**
-3. **β³ Create workspace initialization in tests**
-4. **β³ Add result verification tests**
-5. **β³ Create migration scenario tests**
-6. **β³ Add test documentation for each scenario**
+1. β
Create test project structures
+2. β
Add sample code covering all location types
+3. β
Create workspace initialization in tests (Go LSP client)
+4. β
Add result verification tests (18 functions, 47 sub-tests)
+5. β
Create migration scenario tests (javaxβjakarta, JMS, database drivers)
+6. β
Add annotated element matching tests (4 sub-tests)
+7. β
Add file path filtering tests (2 sub-tests)
diff --git a/java-analyzer-bundle.tp/java-analyzer-bundle.target b/java-analyzer-bundle.tp/java-analyzer-bundle.target
index b20db48..6e2ddad 100644
--- a/java-analyzer-bundle.tp/java-analyzer-bundle.target
+++ b/java-analyzer-bundle.tp/java-analyzer-bundle.target
@@ -11,18 +11,10 @@
-
-
-
-