This is an automated email from the ASF dual-hosted git repository.
jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git
The following commit(s) were added to refs/heads/master by this push:
new 93a4cd6e0e Utility class modernization
93a4cd6e0e is described below
commit 93a4cd6e0e12f53b09f132b6a8b34667921caa64
Author: James Bognar <[email protected]>
AuthorDate: Thu Nov 6 12:30:08 2025 -0500
Utility class modernization
---
CLAUDE.md | 402 ++++++++++++---------
.../apache/juneau/common/reflect/ClassInfo.java | 19 -
.../java/org/apache/juneau/rest/RestContext.java | 2 +-
.../annotation/BeanConfigAnnotation_Test.java | 6 +-
.../org/apache/juneau/annotation/Bean_Test.java | 14 +-
.../juneau/common/reflect/AnnotationInfoTest.java | 4 +-
.../juneau/common/reflect/ClassInfo_Test.java | 13 +-
.../juneau/common/reflect/MethodInfo_Test.java | 11 +-
.../juneau/csv/annotation/CsvConfig_Test.java | 10 +-
.../juneau/html/HtmlConfigAnnotation_Test.java | 14 +-
.../juneau/html/HtmlDocConfigAnnotation_Test.java | 28 +-
.../juneau/json/JsonConfigAnnotationTest.java | 14 +-
.../jsonschema/JsonSchemaConfigAnnotationTest.java | 7 +-
.../juneau/jsonschema/JsonSchemaGeneratorTest.java | 4 +-
.../msgpack/MsgPackConfigAnnotationTest.java | 14 +-
.../juneau/oapi/OpenApiConfigAnnotation_Test.java | 11 +-
.../juneau/parser/ParserConfigAnnotationTest.java | 14 +-
.../plaintext/PlainTextConfigAnnotation_Test.java | 10 +-
.../client/RestClient_Config_Context_Test.java | 4 +-
.../serializer/SerializerConfigAnnotationTest.java | 14 +-
.../juneau/soap/SoapXmlConfigAnnotationTest.java | 8 +-
.../apache/juneau/uon/UonConfigAnnotationTest.java | 14 +-
.../UrlEncodingConfigAnnotationTest.java | 14 +-
.../apache/juneau/xml/XmlConfigAnnotationTest.java | 13 +-
scripts/build-and-test.py | 114 ++++++
25 files changed, 479 insertions(+), 299 deletions(-)
diff --git a/CLAUDE.md b/CLAUDE.md
index be9293ea0e..f9887eff2c 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -4,6 +4,10 @@ This document outlines the rules, guidelines, and best
practices that Claude AI
**Note**: This file is referred to as "my rules" and serves as the definitive
reference for all guidelines and conventions I follow when working on the
Apache Juneau project.
+**Important**: Also read `CLAUDE_SESSION.md` to understand the current
session's work context, what we're currently working on, and any recent changes
or patterns established in this session.
+
+**Documentation Separation Rule**: `CLAUDE_SESSION.md` should only contain
session-specific information that is not already covered in `CLAUDE.md`.
General rules, permanent conventions, and best practices belong in `CLAUDE.md`.
Session-specific work progress, current tasks, and temporary patterns belong in
`CLAUDE_SESSION.md`.
+
## User Commands
### Shorthand Commands
@@ -11,6 +15,10 @@ This document outlines the rules, guidelines, and best
practices that Claude AI
- **"s"** means **"status"** - When the user sends just "s", give a status
update on what you're currently working on
- **"TODO-x"** means **"work on this TODO"** - When the user sends just
"TODO-3", "TODO-67", etc., start working on that specific TODO item from the
TODO.md file
+### Documentation Commands
+- **"store this rule in the session"** - Add the rule/information to
`CLAUDE_SESSION.md` (session-specific)
+- **"store this rule in the context"** - Add the rule/information to
`CLAUDE.md` (permanent/general)
+
## Core Working Principles
### 1. Code Quality and Consistency
@@ -119,87 +127,101 @@ List<String> keys = map.keySet();
// CORRECT - Use var
var map = new HashMap<String,Integer>();
var keys = map.keySet();
-
-// CORRECT - Keep explicit type when not obvious
-InputStream stream = resource.getStream();
-boolean isEmpty = list.isEmpty();
```
-#### Effectively Final Fields
-When declaring class fields that are non-final but only set once (in
constructors):
+#### Final Fields and Memoization Pattern
+When declaring class fields, always use `final` to ensure true immutability:
-1. **Add a comment indicating the field is effectively final**:
- - Use the comment `// Effectively final` on the same line as the field
declaration
- - This clarifies that the field is immutable after construction
- - Helps reviewers understand why the field can be used in eager
initialization
+1. **Always use `final` for fields**:
+ - All instance fields should be declared `final` whenever possible
+ - This provides compile-time immutability guarantees
+ - Prevents accidental modification after construction
-2. **Why this matters:**
- - Makes the immutability contract explicit in the code
- - Explains why the field can be safely used to initialize `final` fields or
suppliers
- - Documents thread-safety guarantees (effectively final fields are
thread-safe)
- - Prevents future modifications that might break the immutability assumption
+2. **Use `find` helper methods for memoized fields**:
+ - When memoized `Supplier` fields need constructor parameters, use helper
methods
+ - Name helper methods with the `find` prefix (e.g.,
`findGenericInterfaces()`)
+ - Helper methods are called during field initialization and can access
constructor parameters
+ - This allows final fields to depend on constructor parameters
-3. **When to use:**
- - Fields that are only assigned in the constructor(s)
- - Fields used to eagerly initialize other `final` fields or suppliers
- - Fields that must be non-final to allow eager initialization of dependent
fields
+3. **Why this matters:**
+ - Provides stronger immutability guarantees than "effectively final"
comments
+ - Compiler enforces immutability rather than relying on conventions
+ - Makes the code more maintainable and less error-prone
+ - Documents thread-safety guarantees explicitly
**Examples:**
```java
-// WRONG - No indication that 'c' is immutable after construction
-Class<?> c;
-
-// CORRECT - Clearly documents effectively final status
+// WRONG - Non-final field with comment
Class<?> c; // Effectively final
-// Example in context
+// CORRECT - Final field with helper method pattern
public class ClassInfo {
- Class<?> c; // Effectively final (only set in constructor)
+ private final Class<?> c;
- // These final suppliers can safely reference 'c' because it's
effectively final
- private final Supplier<List<Type>> genericInterfacesCache =
- memoize(() -> c == null ? Collections.emptyList() :
u(l(c.getGenericInterfaces())));
+ // Final supplier initialized using helper method that accesses
constructor parameter
+ private final Supplier<List<Type>> genericInterfacesCache =
memoize(this::findGenericInterfaces);
public ClassInfo(Class<?> c) {
- this.c = c; // Only assignment point
+ this.c = c;
+ }
+
+ // Helper method called during field initialization
+ private List<Type> findGenericInterfaces() {
+ return c == null ? Collections.emptyList() :
u(l(c.getGenericInterfaces()));
}
}
```
-**Why not just make it final?**
-- Java requires `final` fields to be initialized before other instance
initializers run
-- When field initializers depend on constructor parameters, the field must be
non-final
-- "Effectively final" provides the same immutability guarantee with more
initialization flexibility
+**Pattern Summary:**
+1. Declare constructor parameters as `final` fields
+2. Create `find` helper methods that use those fields
+3. Initialize memoized `Supplier` fields with method references to the helper
methods
+4. This allows all fields to be truly `final` while still supporting lazy
initialization
#### Git Operations and Reverts
When working with git operations, especially reverting changes:
-1. **Always revert one file at a time** - Never use broad wildcards or
multiple file paths in a single revert command:
- - ✅ CORRECT: `git checkout -- path/to/specific/File.java`
- - ❌ WRONG: `git checkout -- .` (reverts everything)
- - ❌ WRONG: `git checkout -- module1/ module2/` (reverts multiple locations)
+1. **Always revert to staged version only** - Use `git restore --source=INDEX`
to revert unstaged changes back to the staged (tested) version:
+ - ✅ CORRECT: `git restore --source=INDEX path/to/specific/File.java`
+ - ❌ WRONG: `git checkout -- path/to/file` (reverts to HEAD, loses staged
changes)
+ - ❌ WRONG: `git restore path/to/file` (reverts to HEAD, loses staged
changes)
-2. **Why this matters:**
- - Prevents accidentally reverting good changes along with problematic ones
- - Makes it easier to track which specific file had the issue
- - Allows surgical fixes without losing other work
- - Easier to recover if you revert the wrong file
+2. **Always revert one file at a time** - Never use broad wildcards or
multiple file paths:
+ - ✅ CORRECT: `git restore --source=INDEX path/to/specific/File.java`
+ - ❌ WRONG: `git restore --source=INDEX .` (reverts everything)
+ - ❌ WRONG: `git restore --source=INDEX module1/ module2/` (reverts multiple
locations)
-3. **Proper workflow when compilation fails:**
+3. **Why this matters:**
+ - **Preserves staged changes**: Staged changes have been tested and should
not be lost
+ - **Surgical precision**: Only reverts the specific problematic file's
unstaged changes
+ - **Safe recovery**: If a file is staged, it means it was working at that
point
+ - **Prevents data loss**: Won't accidentally revert good changes along with
bad ones
+
+4. **Proper workflow when compilation fails:**
- Identify the specific file(s) causing the error
- - Revert only that file: `git checkout -- path/to/ProblematicFile.java`
- - Verify the revert fixed the issue
- - Then address that specific file's conversion separately
+ - Revert only that file's unstaged changes: `git restore --source=INDEX
path/to/ProblematicFile.java`
+ - Verify the revert fixed the issue (back to staged/tested version)
+ - Then address that specific file's changes separately
-**Example:**
+**Examples:**
```bash
-# WRONG - Reverts all changes
-git checkout -- .
+# WRONG - Reverts all unstaged changes everywhere
+git restore --source=INDEX .
-# CORRECT - Revert specific problematic file
-git checkout --
juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/ObjectSearcher.java
+# WRONG - Reverts to HEAD, losing staged changes
+git checkout -- path/to/file
+git restore path/to/file
+
+# CORRECT - Revert specific file's unstaged changes to staged version
+git restore --source=INDEX
juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/ObjectSearcher.java
```
+**Understanding git restore --source=INDEX:**
+- `INDEX` refers to the staging area (where `git add` puts files)
+- This command reverts working directory changes back to what's staged
+- Staged changes remain intact and are not affected
+- If a file isn't staged, this command does nothing (which is safe)
+
### 2. Testing Standards
- Ensure comprehensive test coverage for all changes
- Follow the established unit testing patterns
@@ -221,79 +243,79 @@ When compiling code using Maven and the user compiles
through their IDE (Eclipse
- Old code behavior persisting despite source changes
- Stale class files causing incorrect results
+**Eclipse "Build Automatically" Setting:**
+The user typically has "Refresh using native hooks or polling" enabled in
Eclipse, and may or may not have "Build Automatically" enabled.
+
+**If code changes don't appear to be taking effect or are getting
overwritten:**
+1. **Ask the user to check if "Build Automatically" is enabled** (Project →
Build Automatically menu)
+2. **If enabled, politely ask them to disable it**: "Could you please disable
'Build Automatically' in Eclipse (Project → Build Automatically)?"
+3. **Why this matters:**
+ - When "Build Automatically" is enabled, Eclipse may rebuild files
immediately after saving
+ - This can conflict with Maven builds, causing files to be overwritten
+ - Disabling it gives you more control over when builds occur
+ - The user can manually build when needed using Ctrl+B or Project → Build
Project
+
**Resolution Strategy:**
If you encounter situations where your code changes don't appear to be taking
effect:
-1. **Immediately run** `mvn clean install` to clear all compiled artifacts and
rebuild fresh
-2. This ensures Maven and IDE compiled code are synchronized
-3. Rerun tests after the clean build to verify changes are properly reflected
+1. **First, ask about Eclipse "Build Automatically"** and request it be
disabled if enabled
+2. **Then run** `mvn clean install` to clear all compiled artifacts and
rebuild fresh
+3. This ensures Maven and IDE compiled code are synchronized
+4. Rerun tests after the clean build to verify changes are properly reflected
**When to suspect this issue:**
- Tests fail in unexpected ways after code changes
- Behavior doesn't match recent code modifications
- Test results seem to reflect old code despite edits
- Compilation succeeds but runtime behavior is wrong
+- Code changes appear to be getting overwritten or not taking effect
**Java Runtime Location:**
If you can't find Java on the file system using standard commands, look for it
in the `~/jdk` folder. For example:
- Java 17 can be found at:
`~/jdk/openjdk_17.0.14.0.101_17.57.18_aarch64/bin/java`
- Use this path when you need to run Java commands directly
-### 5. HTML5 Bean Enhancement Rules
+### 5. Helper Scripts
-#### Javadoc Enhancement for HTML5 Beans
-- **Class-level documentation**: Add comprehensive descriptions of the HTML
element's purpose
-- **Attribute documentation**: Provide detailed descriptions of what each
attribute does
-- **Enumerated values**: List all possible values for attributes that have
them (e.g., `contenteditable` can have `true`, `false`, `plaintext-only`)
-- **Boolean attributes**: Document the deminimized behavior (e.g.,
`hidden(true)` produces `hidden='hidden'`)
-- **Examples**: Include multiple practical examples showing different use cases
+**Build and Test Script:**
+A reusable Python script is available at `scripts/build-and-test.py` for
common Maven operations.
-#### HtmlBuilder Integration
-- **Javatree structure**: Add javatree documentation for HtmlBuilder creator
methods
-- **Example refactoring**: Replace constructor-based examples with HtmlBuilder
methods where appropriate
-- **Rule for examples**: Leave examples as-is if they use only strings and
have no children defined
-- **Builder method references**: Use the specified javatree format for
referencing HtmlBuilder methods
+**Usage:**
+```bash
+# Default: Clean build + run tests
+./scripts/build-and-test.py
-#### Javatree Format for HtmlBuilder Methods
-```java
-/**
- * <p>
- * The following convenience methods are provided for constructing instances
of this bean:
- * <ul class='javatree'>
- * <li class='jc'>{@link HtmlBuilder}
- * <ul class='javatree'>
- * <li class='jm'>{@link HtmlBuilder#methodName() methodName()}
- * <li class='jm'>{@link HtmlBuilder#methodName(Object, Object...)
methodName(Object, Object...)}
- * </ul>
- * </ul>
- * </p>
- */
-```
+# Build only (skip tests)
+./scripts/build-and-test.py --build-only
+./scripts/build-and-test.py -b
-### 5. Swagger/OpenAPI3 Bean Testing Rules
+# Test only (no build)
+./scripts/build-and-test.py --test-only
+./scripts/build-and-test.py -t
-#### Collection Property Method Consistency
-All collection bean properties must have exactly 4 methods:
-1. `setX(X...)` - varargs setter
-2. `setX(Collection<X>)` - Collection setter
-3. `addX(X...)` - varargs adder
-4. `addX(Collection<X>)` - Collection adder
+# Full build and test (explicit)
+./scripts/build-and-test.py --full
+./scripts/build-and-test.py -f
-#### Test Structure for D_additionalMethods
-The `D_additionalMethods` test class should contain three tests:
+# Verbose output (show full Maven output)
+./scripts/build-and-test.py --verbose
+./scripts/build-and-test.py -v
-1. **d01_collectionSetters**: Tests `setX(Collection<X>)` methods
-2. **d02_varargAdders**: Tests `addX(X...)` methods, with each method called
twice
-3. **d03_collectionAdders**: Tests `addX(Collection<X>)` methods, with each
method called twice
+# Help
+./scripts/build-and-test.py --help
+./scripts/build-and-test.py -h
+```
-#### Varargs vs Collection Setter Testing
-- **A_basicTests**: Use varargs setters (e.g., `setTags("tag1", "tag2")`)
-- **D_additionalMethods**: Test Collection setters (e.g.,
`setTags(list("tag1", "tag2"))`)
+**What it does:**
+- `--build-only/-b`: Runs `mvn clean install -q -DskipTests`
+- `--test-only/-t`: Runs `mvn test -q -Drat.skip=true`
+- `--full/-f` (default): Runs both build and test in sequence
+- By default, shows only the last 50 lines of output
+- Use `--verbose/-v` to see full Maven output
-#### C_extraProperties Testing
-- Use `set("propertyName", value)` instead of fluent setters
-- Cover ALL the same properties as `A_basicTests`
-- Match values from `A_basicTests` exactly
-- Example: `set("basePath", "a")` instead of `setBasePath("a")`
+**When to use:**
+- Instead of manually typing out Maven commands repeatedly
+- When you need to verify both build and tests pass
+- During iterative development to quickly test changes
### 6. Error Handling and Validation
- Use `assertThrowsWithMessage` for exception testing
@@ -315,7 +337,7 @@ The `D_additionalMethods` test class should contain three
tests:
### 9. Documentation Links and References
- Use hardcoded links to `https://juneau.apache.org/docs/topics/`
-- Include specification links for OpenAPI/Swagger properties
+- Include specification links for external standards where applicable
- Use proper cross-references with `{@link}` tags
- Maintain consistent link formatting
@@ -526,15 +548,15 @@ This document outlines the documentation conventions,
formatting rules, and best
```java
/**
* <h5 class='section'>See Also:</h5><ul>
- * <li class='link'><a class="doclink"
href="https://juneau.apache.org/docs/topics/JuneauBeanSwagger2">juneau-bean-swagger-v2</a>
+ * <li class='link'><a class="doclink"
href="https://juneau.apache.org/docs/topics/ModuleName">module-name</a>
* </ul>
*/
```
-**OpenAPI/Swagger Specification Links**:
+**External Specification Links**:
```java
/**
- * <a class="doclink"
href="https://swagger.io/specification/v2/#operationObject">operation</a>
object.
+ * <a class="doclink"
href="https://example.com/specification/#property">property</a> description.
*/
```
@@ -546,7 +568,7 @@ This document outlines the documentation conventions,
formatting rules, and best
**External References**:
- Use `<a class="doclink" href="URL">text</a>` for external links
-- Include specification links for OpenAPI/Swagger properties
+- Include specification links for external standards where applicable
## Code Examples
@@ -590,36 +612,24 @@ This document outlines the documentation conventions,
formatting rules, and best
## Property Documentation
-### HTML5 Bean Properties
+### Bean Properties
-**Standard Attribute Documentation**:
-```java
-/**
- * <a class="doclink"
href="https://www.w3.org/TR/html5/links.html#attr-hyperlink-href">href</a>
attribute.
- *
- * @param value The URL. Typically a {@link URL} or {@link String}.
- * @return This object.
- */
-```
-
-**Boolean Attribute Documentation**:
+**Standard Property Documentation**:
```java
/**
- * <a class="doclink"
href="https://www.w3.org/TR/html5/forms.html#attr-input-readonly">readonly</a>
attribute.
+ * The property description.
*
- * @param value The readonly value.
+ * @param value The new value for this property.
* @return This object.
*/
```
-### Swagger/OpenAPI Properties
-
-**Standard Property Documentation**:
+**Property with External Link Documentation**:
```java
/**
- * The <a class="doclink"
href="https://swagger.io/specification/v2/#operationObject">operation</a>
summary.
+ * The <a class="doclink"
href="https://example.com/spec#property">property</a> description.
*
- * @param value A brief description of the operation.
+ * @param value A description of the parameter.
* @return This object.
*/
```
@@ -722,13 +732,13 @@ public ClassName(Type1 param1, Type2 param2) {
**Method Overrides**:
```java
-@Override /* GENERATED - org.apache.juneau.bean.html5.HtmlElement */
+@Override /* <SimpleClassName> */
public ClassName methodName(Type value) {
```
**Interface Implementations**:
```java
-@Override /* GENERATED - org.apache.juneau.bean.html5.HtmlElement */
+@Override /* <SimpleClassName> */
public ClassName methodName(Type value) {
```
@@ -867,70 +877,117 @@ Swagger roundTrip = jsonRoundTrip(swagger,
Swagger.class);
## Test Structure Patterns
-### Standard Test Class Structure
+### Test Class Naming Convention
+
+All test methods follow the pattern: `LNN_testName` where:
+- **L** is a letter from 'a'-'z' representing the test category
+- **NN** is a number from "00"-"99" for ordering tests within a category
+- **testName** is a descriptive name for what the test does
+
+**Examples:**
+- `a01_basicTest()` - First test in category 'a'
+- `b05_serializationTest()` - Fifth test in category 'b'
+- `c12_validationTest()` - Twelfth test in category 'c'
+
+### Simple Test Class Structure
+
+For test classes with a small number of tests:
```java
public class BeanName_Test extends TestBase {
- @Test void A_basicTests() {
- // Test all bean properties using varargs setters
- // Use SSLLC naming convention
- // Use DPPAP for assertions
+ @Test void a01_basicPropertyTest() {
+ // Test basic properties
}
- @Test void B_serialization() {
- // Test JSON serialization/deserialization
- // Use TestUtils convenience methods
+ @Test void a02_fluentSetters() {
+ // Test fluent setter methods
}
- @Test void C_extraProperties() {
- // Test set(String, Object) method
- // Use set(String, Object) for ALL the same properties as A_basicTests
- // Match values from A_basicTests exactly
- // Use SSLLC naming convention
- // Example: set("basePath", "a") instead of setBasePath("a")
+ @Test void b01_serialization() {
+ // Test JSON serialization
}
- @Test void D_additionalMethods() {
- // Test additional methods like copyFrom()
- // Use assertBean for property verification
+ @Test void b02_deserialization() {
+ // Test JSON deserialization
}
+}
+```
+
+**Key Points:**
+- Tests are grouped by letter prefix (a, b, c, etc.)
+- Each group represents a general test category
+- Tests within a group are numbered sequentially
+
+### Complex Test Class Structure
+
+For test classes with large numbers of tests that can be grouped into major
categories:
+
+```java
+public class BeanName_Test extends TestBase {
- @Test void E_strictMode() {
- // Test strict mode validation
- // Use assertThrowsWithMessage for exception validation
- // Combine invalid/valid tests into single test per validation method
+ @Nested class A_basicTests extends TestBase {
+ @Test void a01_properties() {
+ // Test bean properties using varargs setters
+ // Use SSLLC naming convention
+ // Use DPPAP for assertions
+ }
+
+ @Test void a02_fluentSetters() {
+ // Test fluent setter chaining
+ }
}
- @Test void F_refs() {
- // Test resolveRefs() methods where applicable
- // Test valid refs, invalid refs, null/empty refs, not-found refs
+ @Nested class B_serialization extends TestBase {
+ @Test void b01_toJson() {
+ // Test JSON serialization
+ // Use TestUtils convenience methods
+ }
+
+ @Test void b02_fromJson() {
+ // Test JSON deserialization
+ }
}
- @Test void a08_otherGettersAndSetters() {
- // Test additional getter/setter methods
- // Use assertBean directly for getter tests
- // Test collection variants vs varargs variants
- // Follow SSLLC conventions
+ @Nested class C_extraProperties extends TestBase {
+ @Test void c01_dynamicProperties() {
+ // Test set(String, Object) method
+ // Use set(String, Object) for ALL the same properties as
A_basicTests
+ // Match values from A_basicTests exactly
+ }
}
- @Test void a09_nullParameters() {
- // Test null parameter validation
- // Use assertThrowsWithMessage for validation
+ @Nested class D_additionalMethods extends TestBase {
+ @Test void d01_collectionSetters() {
+ // Test setX(Collection<X>) methods
+ }
+
+ @Test void d02_varargAdders() {
+ // Test addX(X...) methods
+ }
}
}
```
-### Test Method Naming Conventions
+**Key Points:**
+- Use `@Nested` inner classes for major test categories
+- Each nested class name follows the pattern: `L_categoryName`
+- Tests within nested classes still use `LNN_testName` pattern
+- The letter in the nested class name matches the letter in the test method
names
-- **A_basicTests**: Core functionality tests
-- **B_serialization**: Serialization/deserialization tests
-- **C_extraProperties**: Dynamic property setting tests
-- **D_additionalMethods**: Additional method tests
-- **E_strictMode**: Strict mode validation tests
-- **F_refs**: Reference resolution tests
-- **a08_otherGettersAndSetters**: Additional getter/setter tests
-- **a09_nullParameters**: Null parameter validation tests
+### Common Test Categories
+
+While not prescriptive, common test category prefixes include:
+- **a**: Basic tests (properties, constructors, basic functionality)
+- **b**: Serialization/deserialization tests
+- **c**: Extra/dynamic properties tests
+- **d**: Additional methods tests
+- **e**: Validation/strict mode tests
+- **f**: Reference resolution tests (where applicable)
+
+Choose the structure (Simple vs Complex) based on:
+- **Simple**: < 20 tests, or tests don't naturally group into major categories
+- **Complex**: > 20 tests, especially when tests group into distinct
functional areas
## Assertion Patterns
@@ -972,19 +1029,12 @@ assertThrowsWithMessage(IllegalArgumentException.class,
## Bean Testing Patterns
-### Swagger/OpenAPI3 Bean Testing
+### General Bean Testing
**Property Coverage**: Ensure `A_basicTests` covers all bean properties and
`C_extraProperties` covers the same properties using the `set()` method.
**Getter/Setter Variants**: Test both collection variants and varargs variants
where applicable.
-**Reference Resolution**: Test `resolveRefs()` methods with various scenarios:
-- Valid references
-- Invalid references
-- Null/empty references
-- Not-found references
-- Type conversion
-
### Fluent Setter Testing
**Parameter Naming**: All fluent setters should use `value` as the parameter
name for consistency.
diff --git
a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/ClassInfo.java
b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/ClassInfo.java
index caf7530df4..a17d338981 100644
---
a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/ClassInfo.java
+++
b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/ClassInfo.java
@@ -544,25 +544,6 @@ public class ClassInfo extends ElementInfo implements
Annotatable {
return AnnotationInfo.getAnnotationList(this);
}
- /**
- * Constructs an {@link AnnotationList} of all matching annotations on
this class.
- *
- * <p>
- * Annotations are appended in the following orders:
- * <ol>
- * <li>On the package of this class.
- * <li>On interfaces ordered parent-to-child.
- * <li>On parent classes ordered parent-to-child.
- * <li>On this class.
- * </ol>
- *
- * @param filter A predicate to apply to the entries to determine if
value should be used. Can be <jk>null</jk>.
- * @return A new {@link AnnotationList} object on every call.
- */
- public AnnotationList getAnnotationList(Predicate<AnnotationInfo<?>>
filter) {
- return AnnotationInfo.getAnnotationList(this, filter);
- }
-
/**
* Returns all annotations of the specified type defined on this or
parent classes/interfaces.
*
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java
index 98103014ae..577ff127b9 100644
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java
+++
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java
@@ -1786,7 +1786,7 @@ public class RestContext extends Context {
});
var vrs = varResolver().build().createSession();
- var work = AnnotationWorkList.of(vrs,
rci.getAnnotationList(CONTEXT_APPLY_FILTER));
+ var work = AnnotationWorkList.of(vrs,
rstream(rci.getAnnotationInfos()).filter(CONTEXT_APPLY_FILTER).collect(Collectors.toCollection(AnnotationList::new)));
apply(work);
beanContext().apply(work);
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/annotation/BeanConfigAnnotation_Test.java
b/juneau-utest/src/test/java/org/apache/juneau/annotation/BeanConfigAnnotation_Test.java
index 9a16c879f5..63f5a8c488 100644
---
a/juneau-utest/src/test/java/org/apache/juneau/annotation/BeanConfigAnnotation_Test.java
+++
b/juneau-utest/src/test/java/org/apache/juneau/annotation/BeanConfigAnnotation_Test.java
@@ -145,7 +145,7 @@ class BeanConfigAnnotation_Test extends TestBase {
static ClassInfo a = ClassInfo.of(A.class);
@Test void a01_basic() {
- var al = AnnotationWorkList.of(sr, a.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(a.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var bs = JsonSerializer.create().apply(al).build().getSession();
check("PRIVATE", bs.getBeanClassVisibility());
@@ -188,7 +188,7 @@ class BeanConfigAnnotation_Test extends TestBase {
static ClassInfo b = ClassInfo.of(B.class);
@Test void b01_noValues() {
- var al = AnnotationWorkList.of(sr, b.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(b.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var js = JsonSerializer.create().apply(al).build();
var bc = js.getBeanContext();
check("PUBLIC", bc.getBeanClassVisibility());
@@ -233,7 +233,7 @@ class BeanConfigAnnotation_Test extends TestBase {
static ClassInfo c = ClassInfo.of(C.class);
@Test void c01_noAnnotation() {
- var al = AnnotationWorkList.of(sr, c.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(c.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var js = JsonSerializer.create().apply(al).build();
var bc = js.getBeanContext();
check("PUBLIC", bc.getBeanClassVisibility());
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/annotation/Bean_Test.java
b/juneau-utest/src/test/java/org/apache/juneau/annotation/Bean_Test.java
index ab50426ff5..f1d1af0a39 100644
--- a/juneau-utest/src/test/java/org/apache/juneau/annotation/Bean_Test.java
+++ b/juneau-utest/src/test/java/org/apache/juneau/annotation/Bean_Test.java
@@ -16,6 +16,7 @@
*/
package org.apache.juneau.annotation;
+import static org.apache.juneau.common.utils.CollectionUtils.*;
import static org.junit.jupiter.api.Assertions.*;
import org.apache.juneau.*;
@@ -24,6 +25,7 @@ import org.apache.juneau.marshaller.*;
import org.apache.juneau.common.reflect.*;
import org.apache.juneau.svl.*;
import org.junit.jupiter.api.*;
+import java.util.stream.*;
class Bean_Test extends TestBase {
@@ -71,7 +73,7 @@ class Bean_Test extends TestBase {
static ClassInfo a2ci = ClassInfo.of(A2Config.class);
@Test void a02_beanAnnotationOverridesPrivate_usingConfig() throws
Exception {
- var al = AnnotationWorkList.of(a2ci.getAnnotationList());
+ var al =
AnnotationWorkList.of(rstream(a2ci.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var js = Json5Serializer.create().apply(al).build();
var jp = JsonParser.create().apply(al).build();
@@ -155,7 +157,7 @@ class Bean_Test extends TestBase {
static ClassInfo b2ci = ClassInfo.of(B2Config.class);
@Test void a04_beanxAnnotationOverridesPrivate_usingConfig() throws
Exception {
- var al = AnnotationWorkList.of(b2ci.getAnnotationList());
+ var al =
AnnotationWorkList.of(rstream(b2ci.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var js = Json5Serializer.create().apply(al).build();
var jp = JsonParser.create().apply(al).build();
@@ -222,7 +224,7 @@ class Bean_Test extends TestBase {
}
@Test void
d03_beanPropertiesExcludePropertiesCombined_beanConfigOverride() throws
Exception {
- var al = AnnotationWorkList.of(vr, dConfig.getAnnotationList());
+ var al = AnnotationWorkList.of(vr,
rstream(dConfig.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var js = Json5Serializer.create().apply(al).build();
var jp = JsonParser.create().apply(al).build();
@@ -234,7 +236,7 @@ class Bean_Test extends TestBase {
}
@Test void d04_beanPXpCombined_beanConfigOverride() throws Exception {
- var al = AnnotationWorkList.of(vr, dConfig.getAnnotationList());
+ var al = AnnotationWorkList.of(vr,
rstream(dConfig.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var js = Json5Serializer.create().apply(al).build();
var jp = JsonParser.create().apply(al).build();
@@ -333,7 +335,7 @@ class Bean_Test extends TestBase {
}
@Test void
e03_beanPropertiesExcludePropertiesCombined_multipleBeanAnnotations_beanConfigOverride()
throws Exception {
- var al = AnnotationWorkList.of(vr, eConfig.getAnnotationList());
+ var al = AnnotationWorkList.of(vr,
rstream(eConfig.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var js = Json5Serializer.create().apply(al).build();
var jp = JsonParser.create().apply(al).build();
@@ -345,7 +347,7 @@ class Bean_Test extends TestBase {
}
@Test void
e04_beanPXpCombined_multipleBeanAnnotations_beanConfigOverride() throws
Exception {
- var al = AnnotationWorkList.of(vr, eConfig.getAnnotationList());
+ var al = AnnotationWorkList.of(vr,
rstream(eConfig.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var js = Json5Serializer.create().apply(al).build();
var jp = JsonParser.create().apply(al).build();
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/common/reflect/AnnotationInfoTest.java
b/juneau-utest/src/test/java/org/apache/juneau/common/reflect/AnnotationInfoTest.java
index ad48f5b1fc..80ec937347 100644
---
a/juneau-utest/src/test/java/org/apache/juneau/common/reflect/AnnotationInfoTest.java
+++
b/juneau-utest/src/test/java/org/apache/juneau/common/reflect/AnnotationInfoTest.java
@@ -18,9 +18,11 @@ package org.apache.juneau.common.reflect;
import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.*;
+import static org.apache.juneau.common.utils.CollectionUtils.*;
import static org.apache.juneau.junit.bct.BctAssertions.*;
import java.lang.annotation.*;
+import java.util.stream.*;
import org.apache.juneau.*;
import org.apache.juneau.common.annotation.*;
@@ -51,7 +53,7 @@ class AnnotationInfoTest extends TestBase {
@Test void d01_isInGroup() {
var d = ClassInfo.of(D.class);
- var l = d.getAnnotationList(x -> x.isInGroup(D1.class));
+ var l = rstream(d.getAnnotationInfos()).filter(x ->
x.isInGroup(D1.class)).collect(Collectors.toCollection(AnnotationList::new));
assertSize(2, l);
}
}
\ No newline at end of file
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/common/reflect/ClassInfo_Test.java
b/juneau-utest/src/test/java/org/apache/juneau/common/reflect/ClassInfo_Test.java
index bc7dcede01..49a0ff32c7 100644
---
a/juneau-utest/src/test/java/org/apache/juneau/common/reflect/ClassInfo_Test.java
+++
b/juneau-utest/src/test/java/org/apache/juneau/common/reflect/ClassInfo_Test.java
@@ -615,9 +615,10 @@ public class ClassInfo_Test extends TestBase {
}
@Test void getAnnotationsMapParentFirst() {
- check("@PA(10),@A(2),@A(1),@A(3),@A(5),@A(6),@A(7)",
g3.getAnnotationList());
- check("@PA(10),@A(2),@A(1),@A(3),@A(5),@A(6),@A(7)",
g4.getAnnotationList());
- check("@PA(10),@A(3)", g5.getAnnotationList());
+ // Note: Order changed after inlining - interfaces now
processed when they appear in hierarchy, not after all classes
+ check("@PA(10),@A(2),@A(1),@A(5),@A(3),@A(6),@A(7)",
rstream(g3.getAnnotationInfos()).collect(Collectors.toList()));
+ check("@PA(10),@A(2),@A(1),@A(5),@A(3),@A(6),@A(7)",
rstream(g4.getAnnotationInfos()).collect(Collectors.toList()));
+ check("@PA(10),@A(3)",
rstream(g5.getAnnotationInfos()).collect(Collectors.toList()));
}
@A(1) @AConfig(1) interface GBI1 {}
@@ -633,9 +634,9 @@ public class ClassInfo_Test extends TestBase {
static ClassInfo gb3=of(GB3.class), gb4=of(GB4.class),
gb5=of(GB5.class);
@Test void getConfigAnnotationsMapParentFirst() {
-
check("@AConfig(2),@AConfig(1),@AConfig(3),@AConfig(5),@AConfig(6),@AConfig(7)",
gb3.getAnnotationList(CONTEXT_APPLY_FILTER));
-
check("@AConfig(2),@AConfig(1),@AConfig(3),@AConfig(5),@AConfig(6),@AConfig(7)",
gb4.getAnnotationList(CONTEXT_APPLY_FILTER));
- check("@AConfig(3)",
gb5.getAnnotationList(CONTEXT_APPLY_FILTER));
+
check("@AConfig(2),@AConfig(1),@AConfig(5),@AConfig(3),@AConfig(6),@AConfig(7)",
rstream(gb3.getAnnotationInfos()).filter(CONTEXT_APPLY_FILTER).collect(Collectors.toList()));
+
check("@AConfig(2),@AConfig(1),@AConfig(5),@AConfig(3),@AConfig(6),@AConfig(7)",
rstream(gb4.getAnnotationInfos()).filter(CONTEXT_APPLY_FILTER).collect(Collectors.toList()));
+ check("@AConfig(3)",
rstream(gb5.getAnnotationInfos()).filter(CONTEXT_APPLY_FILTER).collect(Collectors.toList()));
}
//-----------------------------------------------------------------------------------------------------------------
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/common/reflect/MethodInfo_Test.java
b/juneau-utest/src/test/java/org/apache/juneau/common/reflect/MethodInfo_Test.java
index e797287cbd..09f3465005 100644
---
a/juneau-utest/src/test/java/org/apache/juneau/common/reflect/MethodInfo_Test.java
+++
b/juneau-utest/src/test/java/org/apache/juneau/common/reflect/MethodInfo_Test.java
@@ -368,11 +368,12 @@ class MethodInfo_Test extends TestBase {
}
@Test void getAnnotationsMapParentFirst() {
- check("@PA(10),@A(C1),@A(a1),@A(C2),@A(C3)",
c_a1.getAnnotationList());
- check("@PA(10),@A(C1),@A(a2a),@A(C2),@A(a2b),@A(C3)",
c_a2.getAnnotationList());
- check("@PA(10),@A(C1),@A(a3),@A(C2),@A(C3)",
c_a3.getAnnotationList());
- check("@PA(10),@A(C1),@A(C2),@A(C3),@A(a4)",
c_a4.getAnnotationList());
- check("@PA(10),@A(C1),@A(C2),@A(C3)", c_a5.getAnnotationList());
+ // Note: Order changed after inlining - method annotations now
come after class annotations
+ check("@PA(10),@A(C1),@A(C2),@A(C3),@A(a1)",
rstream(c_a1.getAllAnnotationInfos()).collect(Collectors.toList()));
+ check("@PA(10),@A(C1),@A(C2),@A(C3),@A(a2a),@A(a2b)",
rstream(c_a2.getAllAnnotationInfos()).collect(Collectors.toList()));
+ check("@PA(10),@A(C1),@A(C2),@A(C3),@A(a3)",
rstream(c_a3.getAllAnnotationInfos()).collect(Collectors.toList()));
+ check("@PA(10),@A(C1),@A(C2),@A(C3),@A(a4)",
rstream(c_a4.getAllAnnotationInfos()).collect(Collectors.toList()));
+ check("@PA(10),@A(C1),@A(C2),@A(C3)",
rstream(c_a5.getAllAnnotationInfos()).collect(Collectors.toList()));
}
@A("C1") @AConfig("C1")
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/csv/annotation/CsvConfig_Test.java
b/juneau-utest/src/test/java/org/apache/juneau/csv/annotation/CsvConfig_Test.java
index f15fe4746e..41f77fd5e1 100644
---
a/juneau-utest/src/test/java/org/apache/juneau/csv/annotation/CsvConfig_Test.java
+++
b/juneau-utest/src/test/java/org/apache/juneau/csv/annotation/CsvConfig_Test.java
@@ -16,12 +16,14 @@
*/
package org.apache.juneau.csv.annotation;
+import static org.apache.juneau.common.utils.CollectionUtils.*;
import static org.junit.jupiter.api.Assertions.*;
import org.apache.juneau.*;
import org.apache.juneau.csv.*;
import org.apache.juneau.common.reflect.*;
import org.junit.jupiter.api.*;
+import java.util.stream.*;
/**
* Tests the @CsvConfig annotation.
@@ -37,12 +39,12 @@ class CsvConfig_Test extends TestBase {
static ClassInfo b = ClassInfo.of(B.class);
@Test void defaultsSerializer() {
- var al = AnnotationWorkList.of(b.getAnnotationList());
+ var al =
AnnotationWorkList.of(rstream(b.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
assertDoesNotThrow(()->CsvSerializer.create().apply(al).build());
}
@Test void defaultsParser() {
- var al = AnnotationWorkList.of(b.getAnnotationList());
+ var al =
AnnotationWorkList.of(rstream(b.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
assertDoesNotThrow(()->CsvParser.create().apply(al).build());
}
@@ -54,12 +56,12 @@ class CsvConfig_Test extends TestBase {
static ClassInfo c = ClassInfo.of(C.class);
@Test void noAnnotationSerializer() {
- var al = AnnotationWorkList.of(b.getAnnotationList());
+ var al =
AnnotationWorkList.of(rstream(b.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
assertDoesNotThrow(()->CsvSerializer.create().apply(al).build());
}
@Test void noAnnotationParser() {
- var al = AnnotationWorkList.of(b.getAnnotationList());
+ var al =
AnnotationWorkList.of(rstream(b.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
assertDoesNotThrow(()->CsvParser.create().apply(al).build());
}
}
\ No newline at end of file
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/html/HtmlConfigAnnotation_Test.java
b/juneau-utest/src/test/java/org/apache/juneau/html/HtmlConfigAnnotation_Test.java
index 246224e97a..4c678badb3 100644
---
a/juneau-utest/src/test/java/org/apache/juneau/html/HtmlConfigAnnotation_Test.java
+++
b/juneau-utest/src/test/java/org/apache/juneau/html/HtmlConfigAnnotation_Test.java
@@ -16,6 +16,7 @@
*/
package org.apache.juneau.html;
+import static org.apache.juneau.common.utils.CollectionUtils.*;
import static org.junit.jupiter.api.Assertions.*;
import java.util.*;
@@ -26,6 +27,7 @@ import org.apache.juneau.html.annotation.*;
import org.apache.juneau.common.reflect.*;
import org.apache.juneau.svl.*;
import org.junit.jupiter.api.*;
+import java.util.stream.*;
/**
* Tests the @HtmlConfig annotation.
@@ -56,7 +58,7 @@ class HtmlConfigAnnotation_Test extends TestBase {
static ClassInfo a = ClassInfo.of(A.class);
@Test void basicSerializer() {
- var al = AnnotationWorkList.of(sr, a.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(a.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x = HtmlSerializer.create().apply(al).build().getSession();
check("true", x.isAddBeanTypes());
check("true", x.isAddKeyValueTableHeaders());
@@ -67,7 +69,7 @@ class HtmlConfigAnnotation_Test extends TestBase {
}
@Test void basicParser() {
- var al = AnnotationWorkList.of(sr, a.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(a.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
assertDoesNotThrow(()->HtmlParser.create().apply(al).build().createSession());
}
@@ -80,7 +82,7 @@ class HtmlConfigAnnotation_Test extends TestBase {
static ClassInfo b = ClassInfo.of(B.class);
@Test void defaultsSerializer() {
- var al = AnnotationWorkList.of(sr, b.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(b.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x = HtmlSerializer.create().apply(al).build().getSession();
check("false", x.isAddBeanTypes());
check("false", x.isAddKeyValueTableHeaders());
@@ -91,7 +93,7 @@ class HtmlConfigAnnotation_Test extends TestBase {
}
@Test void defaultsParser() {
- var al = AnnotationWorkList.of(sr, b.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(b.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
assertDoesNotThrow(()->HtmlParser.create().apply(al).build().createSession());
}
@@ -103,7 +105,7 @@ class HtmlConfigAnnotation_Test extends TestBase {
static ClassInfo c = ClassInfo.of(C.class);
@Test void noAnnotationSerializer() {
- var al = AnnotationWorkList.of(sr, c.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(c.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x = HtmlSerializer.create().apply(al).build().getSession();
check("false", x.isAddBeanTypes());
check("false", x.isAddKeyValueTableHeaders());
@@ -114,7 +116,7 @@ class HtmlConfigAnnotation_Test extends TestBase {
}
@Test void noAnnotationParser() {
- var al = AnnotationWorkList.of(sr, c.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(c.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
assertDoesNotThrow(()->HtmlParser.create().apply(al).build().createSession());
}
}
\ No newline at end of file
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/html/HtmlDocConfigAnnotation_Test.java
b/juneau-utest/src/test/java/org/apache/juneau/html/HtmlDocConfigAnnotation_Test.java
index 47e4398b3c..fd1c662399 100644
---
a/juneau-utest/src/test/java/org/apache/juneau/html/HtmlDocConfigAnnotation_Test.java
+++
b/juneau-utest/src/test/java/org/apache/juneau/html/HtmlDocConfigAnnotation_Test.java
@@ -77,7 +77,7 @@ class HtmlDocConfigAnnotation_Test extends TestBase {
static ClassInfo a = ClassInfo.of(A.class);
@Test void basic() {
- var al = AnnotationWorkList.of(sr, a.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(a.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x =
HtmlDocSerializer.create().apply(al).build().getSession();
check("foo", x.getAside());
check("foo", x.getFooter());
@@ -102,7 +102,7 @@ class HtmlDocConfigAnnotation_Test extends TestBase {
static ClassInfo b = ClassInfo.of(B.class);
@Test void defaults() {
- var al = AnnotationWorkList.of(sr, b.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(b.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x =
HtmlDocSerializer.create().apply(al).build().getSession();
check("", x.getAside());
check("", x.getFooter());
@@ -126,7 +126,7 @@ class HtmlDocConfigAnnotation_Test extends TestBase {
static ClassInfo c = ClassInfo.of(C.class);
@Test void noAnnotation() {
- var al = AnnotationWorkList.of(sr, c.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(c.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x =
HtmlDocSerializer.create().apply(al).build().getSession();
check("", x.getAside());
check("", x.getFooter());
@@ -161,7 +161,7 @@ class HtmlDocConfigAnnotation_Test extends TestBase {
static ClassInfo d1 = ClassInfo.of(D1.class);
@Test void inheritance1() {
- var al = AnnotationWorkList.of(sr, d1.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(d1.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x =
HtmlDocSerializer.create().apply(al).build().getSession();
check("foo2,foo", x.getAside());
check("foo2,foo", x.getFooter());
@@ -189,7 +189,7 @@ class HtmlDocConfigAnnotation_Test extends TestBase {
static ClassInfo d2 = ClassInfo.of(D2.class);
@Test void inheritance2() {
- var al = AnnotationWorkList.of(sr, d2.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(d2.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x =
HtmlDocSerializer.create().apply(al).build().getSession();
check("foo,foo2", x.getAside());
check("foo,foo2", x.getFooter());
@@ -217,7 +217,7 @@ class HtmlDocConfigAnnotation_Test extends TestBase {
static ClassInfo d3 = ClassInfo.of(D3.class);
@Test void inheritance3() {
- var al = AnnotationWorkList.of(sr, d3.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(d3.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x =
HtmlDocSerializer.create().apply(al).build().getSession();
check("foo2", x.getAside());
check("foo2", x.getFooter());
@@ -245,7 +245,7 @@ class HtmlDocConfigAnnotation_Test extends TestBase {
static ClassInfo d4 = ClassInfo.of(D4.class);
@Test void inheritance4() {
- var al = AnnotationWorkList.of(sr, d4.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(d4.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x =
HtmlDocSerializer.create().apply(al).build().getSession();
check("", x.getAside());
check("", x.getFooter());
@@ -299,7 +299,7 @@ class HtmlDocConfigAnnotation_Test extends TestBase {
}
@Test void widgets_basic() {
- var al = AnnotationWorkList.of(sr, e.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(e.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x =
HtmlDocSerializer.create().apply(al).build().getSession();
check("$W{E}", x.getAside());
check("$W{E}", x.getFooter());
@@ -316,7 +316,7 @@ class HtmlDocConfigAnnotation_Test extends TestBase {
}
@Test void widgets_resolution() throws Exception {
- var al = AnnotationWorkList.of(sr, e.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(e.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x =
HtmlDocSerializer.create().apply(al).build().getSession();
var r = x.serialize(null).replaceAll("[\r\n]+", "|");
assertContainsAll(r,
"<aside>xxx</aside>","<footer>xxx</footer>","<head>xxx","<style>@import
\"xxx\"; xxx zzz</style>","<nav><ol><li>xxx</li></ol>xxx</nav>","<script>xxx|
yyy|</script>");
@@ -362,31 +362,31 @@ class HtmlDocConfigAnnotation_Test extends TestBase {
static ClassInfo f5 = ClassInfo.of(F5.class);
@Test void e01_rankedAnnotations_f1() {
- var al = AnnotationWorkList.of(sr, f1.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(f1.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x =
HtmlDocSerializer.create().apply(al).build().getSession();
check("f1", x.getAside());
}
@Test void e02_rankedAnnotations_f2() {
- var al = AnnotationWorkList.of(sr, f2.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(f2.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x =
HtmlDocSerializer.create().apply(al).build().getSession();
check("f1", x.getAside());
}
@Test void e03_rankedAnnotations_f3() {
- var al = AnnotationWorkList.of(sr, f3.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(f3.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x =
HtmlDocSerializer.create().apply(al).build().getSession();
check("f3", x.getAside());
}
@Test void e04_rankedAnnotations_f4() {
- var al = AnnotationWorkList.of(sr, f4.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(f4.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x =
HtmlDocSerializer.create().apply(al).build().getSession();
check("f3", x.getAside());
}
@Test void e05_rankedAnnotations_f5() {
- var al = AnnotationWorkList.of(sr, f5.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(f5.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x =
HtmlDocSerializer.create().apply(al).build().getSession();
check("f5", x.getAside());
}
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/json/JsonConfigAnnotationTest.java
b/juneau-utest/src/test/java/org/apache/juneau/json/JsonConfigAnnotationTest.java
index 15967eb1ae..d54774207f 100644
---
a/juneau-utest/src/test/java/org/apache/juneau/json/JsonConfigAnnotationTest.java
+++
b/juneau-utest/src/test/java/org/apache/juneau/json/JsonConfigAnnotationTest.java
@@ -16,6 +16,7 @@
*/
package org.apache.juneau.json;
+import static org.apache.juneau.common.utils.CollectionUtils.*;
import static org.junit.jupiter.api.Assertions.*;
import java.util.function.*;
@@ -25,6 +26,7 @@ import org.apache.juneau.json.annotation.*;
import org.apache.juneau.common.reflect.*;
import org.apache.juneau.svl.*;
import org.junit.jupiter.api.*;
+import java.util.stream.*;
/**
* Tests the @JsonConfig annotation.
@@ -53,7 +55,7 @@ class JsonConfigAnnotationTest extends TestBase {
static ClassInfo a = ClassInfo.of(A.class);
@Test void basicSerializer() {
- var al = AnnotationWorkList.of(sr, a.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(a.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x = JsonSerializer.create().apply(al).build().getSession();
check("true", x.isAddBeanTypes());
check("true", x.isEscapeSolidus());
@@ -61,7 +63,7 @@ class JsonConfigAnnotationTest extends TestBase {
}
@Test void basicParser() {
- var al = AnnotationWorkList.of(sr, a.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(a.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x = JsonParser.create().apply(al).build().getSession();
check("true", x.isValidateEnd());
}
@@ -75,7 +77,7 @@ class JsonConfigAnnotationTest extends TestBase {
static ClassInfo b = ClassInfo.of(B.class);
@Test void noValuesSerializer() {
- var al = AnnotationWorkList.of(sr, b.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(b.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x = JsonSerializer.create().apply(al).build().getSession();
check("false", x.isAddBeanTypes());
check("false", x.isEscapeSolidus());
@@ -83,7 +85,7 @@ class JsonConfigAnnotationTest extends TestBase {
}
@Test void noValuesParser() {
- var al = AnnotationWorkList.of(sr, b.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(b.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x = JsonParser.create().apply(al).build().getSession();
check("false", x.isValidateEnd());
}
@@ -96,7 +98,7 @@ class JsonConfigAnnotationTest extends TestBase {
static ClassInfo c = ClassInfo.of(C.class);
@Test void noAnnotationSerializer() {
- var al = AnnotationWorkList.of(sr, c.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(c.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x = JsonSerializer.create().apply(al).build().getSession();
check("false", x.isAddBeanTypes());
check("false", x.isEscapeSolidus());
@@ -104,7 +106,7 @@ class JsonConfigAnnotationTest extends TestBase {
}
@Test void noAnnotationParser() {
- var al = AnnotationWorkList.of(sr, c.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(c.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x = JsonParser.create().apply(al).build().getSession();
check("false", x.isValidateEnd());
}
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/jsonschema/JsonSchemaConfigAnnotationTest.java
b/juneau-utest/src/test/java/org/apache/juneau/jsonschema/JsonSchemaConfigAnnotationTest.java
index 82a4c97d73..741f34eaad 100644
---
a/juneau-utest/src/test/java/org/apache/juneau/jsonschema/JsonSchemaConfigAnnotationTest.java
+++
b/juneau-utest/src/test/java/org/apache/juneau/jsonschema/JsonSchemaConfigAnnotationTest.java
@@ -16,6 +16,7 @@
*/
package org.apache.juneau.jsonschema;
+import static org.apache.juneau.common.utils.CollectionUtils.*;
import static org.junit.jupiter.api.Assertions.*;
import java.util.*;
@@ -67,7 +68,7 @@ class JsonSchemaConfigAnnotationTest extends TestBase {
static ClassInfo a = ClassInfo.of(A.class);
@Test void basic() {
- var al = AnnotationWorkList.of(sr, a.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(a.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x =
JsonSchemaGenerator.create().apply(al).build().getSession();
check("BEAN", x.getAddDescriptionsTo());
check("BEAN", x.getAddExamplesTo());
@@ -87,7 +88,7 @@ class JsonSchemaConfigAnnotationTest extends TestBase {
static ClassInfo b = ClassInfo.of(B.class);
@Test void noValues() {
- var al = AnnotationWorkList.of(sr, b.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(b.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x =
JsonSchemaGenerator.create().apply(al).build().getSession();
check("", x.getAddDescriptionsTo());
check("", x.getAddExamplesTo());
@@ -106,7 +107,7 @@ class JsonSchemaConfigAnnotationTest extends TestBase {
static ClassInfo c = ClassInfo.of(C.class);
@Test void noAnnotation() {
- var al = AnnotationWorkList.of(sr, c.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(c.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x =
JsonSchemaGenerator.create().apply(al).build().getSession();
check("", x.getAddDescriptionsTo());
check("", x.getAddExamplesTo());
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/jsonschema/JsonSchemaGeneratorTest.java
b/juneau-utest/src/test/java/org/apache/juneau/jsonschema/JsonSchemaGeneratorTest.java
index 150282cb82..24feb82548 100755
---
a/juneau-utest/src/test/java/org/apache/juneau/jsonschema/JsonSchemaGeneratorTest.java
+++
b/juneau-utest/src/test/java/org/apache/juneau/jsonschema/JsonSchemaGeneratorTest.java
@@ -17,10 +17,12 @@
package org.apache.juneau.jsonschema;
import static org.apache.juneau.TestUtils.*;
+import static org.apache.juneau.common.utils.CollectionUtils.*;
import static org.apache.juneau.jsonschema.TypeCategory.*;
import static org.apache.juneau.junit.bct.BctAssertions.*;
import java.util.*;
+import java.util.stream.*;
import org.apache.juneau.*;
import org.apache.juneau.annotation.*;
@@ -1302,7 +1304,7 @@ class JsonSchemaGeneratorTest extends TestBase {
static ClassInfo bConfig = ClassInfo.of(BConfig.class);
@Test void schemaOnClass_onConfig() throws Exception {
- var al = AnnotationWorkList.of(bConfig.getAnnotationList());
+ var al =
AnnotationWorkList.of(rstream(bConfig.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x =
JsonSchemaGenerator.create().apply(al).build().getSession();
assertContains("$ref", r(x.getSchema(new B())));
}
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/msgpack/MsgPackConfigAnnotationTest.java
b/juneau-utest/src/test/java/org/apache/juneau/msgpack/MsgPackConfigAnnotationTest.java
index de0432cf0b..55128e9758 100644
---
a/juneau-utest/src/test/java/org/apache/juneau/msgpack/MsgPackConfigAnnotationTest.java
+++
b/juneau-utest/src/test/java/org/apache/juneau/msgpack/MsgPackConfigAnnotationTest.java
@@ -16,6 +16,7 @@
*/
package org.apache.juneau.msgpack;
+import static org.apache.juneau.common.utils.CollectionUtils.*;
import static org.junit.jupiter.api.Assertions.*;
import java.util.function.*;
@@ -25,6 +26,7 @@ import org.apache.juneau.msgpack.annotation.*;
import org.apache.juneau.common.reflect.*;
import org.apache.juneau.svl.*;
import org.junit.jupiter.api.*;
+import java.util.stream.*;
/**
* Tests the @MsgPackConfig annotation.
@@ -50,13 +52,13 @@ class MsgPackConfigAnnotationTest extends TestBase {
static ClassInfo a = ClassInfo.of(A.class);
@Test void basicSerializer() {
- var al = AnnotationWorkList.of(sr, a.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(a.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x =
MsgPackSerializer.create().apply(al).build().getSession();
check("true", x.isAddBeanTypes());
}
@Test void basicParser() {
- var al = AnnotationWorkList.of(sr, a.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(a.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
assertDoesNotThrow(()->MsgPackParser.create().apply(al).build().createSession());
}
@@ -69,13 +71,13 @@ class MsgPackConfigAnnotationTest extends TestBase {
static ClassInfo b = ClassInfo.of(B.class);
@Test void noValuesSerializer() {
- var al = AnnotationWorkList.of(sr, b.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(b.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x =
MsgPackSerializer.create().apply(al).build().getSession();
check("false", x.isAddBeanTypes());
}
@Test void noValuesParser() {
- var al = AnnotationWorkList.of(sr, b.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(b.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
assertDoesNotThrow(()->MsgPackParser.create().apply(al).build().createSession());
}
@@ -87,13 +89,13 @@ class MsgPackConfigAnnotationTest extends TestBase {
static ClassInfo c = ClassInfo.of(C.class);
@Test void noAnnotationSerializer() {
- var al = AnnotationWorkList.of(sr, c.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(c.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x =
MsgPackSerializer.create().apply(al).build().getSession();
check("false", x.isAddBeanTypes());
}
@Test void noAnnotationParser() {
- var al = AnnotationWorkList.of(sr, c.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(c.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
assertDoesNotThrow(()->MsgPackParser.create().apply(al).build().createSession());
}
}
\ No newline at end of file
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/oapi/OpenApiConfigAnnotation_Test.java
b/juneau-utest/src/test/java/org/apache/juneau/oapi/OpenApiConfigAnnotation_Test.java
index b29970f568..96a24b5972 100644
---
a/juneau-utest/src/test/java/org/apache/juneau/oapi/OpenApiConfigAnnotation_Test.java
+++
b/juneau-utest/src/test/java/org/apache/juneau/oapi/OpenApiConfigAnnotation_Test.java
@@ -16,8 +16,11 @@
*/
package org.apache.juneau.oapi;
+import static org.apache.juneau.common.utils.CollectionUtils.*;
import static org.junit.jupiter.api.Assertions.*;
+import java.util.stream.*;
+
import org.apache.juneau.*;
import org.apache.juneau.oapi.annotation.*;
import org.apache.juneau.common.reflect.*;
@@ -40,12 +43,12 @@ class OpenApiConfigAnnotation_Test extends TestBase {
static ClassInfo b = ClassInfo.of(B.class);
@Test void noValuesSerializer() {
- var al = AnnotationWorkList.of(sr, b.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(b.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
assertDoesNotThrow(()->OpenApiSerializer.create().apply(al).build().createSession());
}
@Test void noValuesParser() {
- var al = AnnotationWorkList.of(sr, b.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(b.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
assertDoesNotThrow(()->OpenApiParser.create().apply(al).build().createSession());
}
@@ -57,12 +60,12 @@ class OpenApiConfigAnnotation_Test extends TestBase {
static ClassInfo c = ClassInfo.of(C.class);
@Test void noAnnotationSerializer() {
- var al = AnnotationWorkList.of(sr, c.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(c.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
assertDoesNotThrow(()->OpenApiSerializer.create().apply(al).build().createSession());
}
@Test void noAnnotationParser() {
- var al = AnnotationWorkList.of(sr, c.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(c.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
assertDoesNotThrow(()->OpenApiParser.create().apply(al).build().createSession());
}
}
\ No newline at end of file
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/parser/ParserConfigAnnotationTest.java
b/juneau-utest/src/test/java/org/apache/juneau/parser/ParserConfigAnnotationTest.java
index e3969a7cf7..a0bb88bb1e 100644
---
a/juneau-utest/src/test/java/org/apache/juneau/parser/ParserConfigAnnotationTest.java
+++
b/juneau-utest/src/test/java/org/apache/juneau/parser/ParserConfigAnnotationTest.java
@@ -16,6 +16,7 @@
*/
package org.apache.juneau.parser;
+import static org.apache.juneau.common.utils.CollectionUtils.*;
import static org.junit.jupiter.api.Assertions.*;
import java.nio.charset.*;
@@ -28,6 +29,7 @@ import org.apache.juneau.parser.annotation.*;
import org.apache.juneau.common.reflect.*;
import org.apache.juneau.svl.*;
import org.junit.jupiter.api.*;
+import java.util.stream.*;
/**
* Tests the @ParserConfig annotation.
@@ -69,7 +71,7 @@ class ParserConfigAnnotationTest extends TestBase {
static ClassInfo a = ClassInfo.of(A.class);
@Test void basicReaderParser() {
- var al = AnnotationWorkList.of(sr, a.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(a.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x = JsonParser.create().apply(al).build().getSession();
check("true", x.isAutoCloseStreams());
check("1", x.getDebugOutputLines());
@@ -82,7 +84,7 @@ class ParserConfigAnnotationTest extends TestBase {
}
@Test void basicInputStreamParser() {
- var al = AnnotationWorkList.of(sr, a.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(a.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x = MsgPackParser.create().apply(al).build().getSession();
check("true", x.isAutoCloseStreams());
check("HEX", x.getBinaryFormat());
@@ -102,7 +104,7 @@ class ParserConfigAnnotationTest extends TestBase {
static ClassInfo b = ClassInfo.of(B.class);
@Test void noValuesReaderParser() {
- var al = AnnotationWorkList.of(sr, b.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(b.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x = JsonParser.create().apply(al).build().getSession();
check("false", x.isAutoCloseStreams());
check("5", x.getDebugOutputLines());
@@ -115,7 +117,7 @@ class ParserConfigAnnotationTest extends TestBase {
}
@Test void noValuesInputStreamParser() {
- var al = AnnotationWorkList.of(sr, b.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(b.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x = MsgPackParser.create().apply(al).build().getSession();
check("false", x.isAutoCloseStreams());
check("HEX", x.getBinaryFormat());
@@ -134,7 +136,7 @@ class ParserConfigAnnotationTest extends TestBase {
static ClassInfo c = ClassInfo.of(C.class);
@Test void noAnnotationReaderParser() {
- var al = AnnotationWorkList.of(sr, c.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(c.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x = JsonParser.create().apply(al).build().getSession();
check("false", x.isAutoCloseStreams());
check("5", x.getDebugOutputLines());
@@ -147,7 +149,7 @@ class ParserConfigAnnotationTest extends TestBase {
}
@Test void noAnnotationInputStreamParser() {
- var al = AnnotationWorkList.of(sr, c.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(c.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x = MsgPackParser.create().apply(al).build().getSession();
check("false", x.isAutoCloseStreams());
check("HEX", x.getBinaryFormat());
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/plaintext/PlainTextConfigAnnotation_Test.java
b/juneau-utest/src/test/java/org/apache/juneau/plaintext/PlainTextConfigAnnotation_Test.java
index dc859b026a..e3822affd5 100644
---
a/juneau-utest/src/test/java/org/apache/juneau/plaintext/PlainTextConfigAnnotation_Test.java
+++
b/juneau-utest/src/test/java/org/apache/juneau/plaintext/PlainTextConfigAnnotation_Test.java
@@ -16,6 +16,7 @@
*/
package org.apache.juneau.plaintext;
+import static org.apache.juneau.common.utils.CollectionUtils.*;
import static org.junit.jupiter.api.Assertions.*;
import org.apache.juneau.*;
@@ -23,6 +24,7 @@ import org.apache.juneau.plaintext.annotation.*;
import org.apache.juneau.common.reflect.*;
import org.apache.juneau.svl.*;
import org.junit.jupiter.api.*;
+import java.util.stream.*;
/**
* Tests the @PlainTextConfig annotation.
@@ -40,12 +42,12 @@ class PlainTextConfigAnnotation_Test extends TestBase {
static ClassInfo b = ClassInfo.of(B.class);
@Test void noValuesSerializer() {
- var al = AnnotationWorkList.of(sr, b.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(b.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
assertDoesNotThrow(()->PlainTextSerializer.create().apply(al).build().createSession());
}
@Test void noValuesParser() {
- var al = AnnotationWorkList.of(sr, b.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(b.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
assertDoesNotThrow(()->PlainTextParser.create().apply(al).build().createSession());
}
@@ -57,12 +59,12 @@ class PlainTextConfigAnnotation_Test extends TestBase {
static ClassInfo c = ClassInfo.of(C.class);
@Test void noAnnotationSerializer() {
- var al = AnnotationWorkList.of(sr, c.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(c.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
assertDoesNotThrow(()->PlainTextSerializer.create().apply(al).build().createSession());
}
@Test void noAnnotationParser() {
- var al = AnnotationWorkList.of(sr, c.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(c.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
assertDoesNotThrow(()->PlainTextParser.create().apply(al).build().createSession());
}
}
\ No newline at end of file
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/rest/client/RestClient_Config_Context_Test.java
b/juneau-utest/src/test/java/org/apache/juneau/rest/client/RestClient_Config_Context_Test.java
index 9e9f7d87be..a22fb17001 100644
---
a/juneau-utest/src/test/java/org/apache/juneau/rest/client/RestClient_Config_Context_Test.java
+++
b/juneau-utest/src/test/java/org/apache/juneau/rest/client/RestClient_Config_Context_Test.java
@@ -17,9 +17,11 @@
package org.apache.juneau.rest.client;
import static org.apache.juneau.Context.*;
+import static org.apache.juneau.common.utils.CollectionUtils.*;
import static org.junit.jupiter.api.Assertions.*;
import java.io.*;
+import java.util.stream.*;
import org.apache.juneau.*;
import org.apache.juneau.annotation.*;
@@ -112,7 +114,7 @@ class RestClient_Config_Context_Test extends TestBase {
client().applyAnnotations(A6b.class).build().post("/echoBody",A6a.get()).run().cacheContent().assertContent("{bar:2,baz:3,foo:1}").getContent().as(A6a.class);
client().applyAnnotations(A6c.class).build().post("/echoBody",A6a.get()).run().cacheContent().assertContent("{bar:2,baz:3,foo:1}").getContent().as(A6a.class);
client().applyAnnotations(A6d.class.getMethod("foo")).build().post("/echoBody",A6a.get()).run().cacheContent().assertContent("{bar:2,baz:3,foo:1}").getContent().as(A6a.class);
- var al =
AnnotationWorkList.of(ClassInfo.of(A6c.class).getAnnotationList(CONTEXT_APPLY_FILTER));
+ var al =
AnnotationWorkList.of(rstream(ClassInfo.of(A6c.class).getAnnotationInfos()).filter(CONTEXT_APPLY_FILTER).collect(Collectors.toCollection(AnnotationList::new)));
client().apply(al).build().post("/echoBody",A6a.get()).run().cacheContent().assertContent("{bar:2,baz:3,foo:1}").getContent().as(A6a.class);
}
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/serializer/SerializerConfigAnnotationTest.java
b/juneau-utest/src/test/java/org/apache/juneau/serializer/SerializerConfigAnnotationTest.java
index fc6778db81..a870d8aa80 100644
---
a/juneau-utest/src/test/java/org/apache/juneau/serializer/SerializerConfigAnnotationTest.java
+++
b/juneau-utest/src/test/java/org/apache/juneau/serializer/SerializerConfigAnnotationTest.java
@@ -16,6 +16,7 @@
*/
package org.apache.juneau.serializer;
+import static org.apache.juneau.common.utils.CollectionUtils.*;
import static org.junit.jupiter.api.Assertions.*;
import java.util.function.*;
@@ -27,6 +28,7 @@ import org.apache.juneau.common.reflect.*;
import org.apache.juneau.serializer.annotation.*;
import org.apache.juneau.svl.*;
import org.junit.jupiter.api.*;
+import java.util.stream.*;
/**
* Tests the @SerializerConfig annotation.
@@ -79,7 +81,7 @@ class SerializerConfigAnnotationTest extends TestBase {
static ClassInfo a = ClassInfo.of(A.class);
@Test void basicWriterSerializer() {
- var al = AnnotationWorkList.of(sr, a.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(a.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x = JsonSerializer.create().apply(al).build().getSession();
check("true", ((SerializerSession)x).isAddBeanTypes());
check("true", x.isAddRootType());
@@ -103,7 +105,7 @@ class SerializerConfigAnnotationTest extends TestBase {
}
@Test void basicOutputStreamSerializer() {
- var al = AnnotationWorkList.of(sr, a.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(a.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x =
MsgPackSerializer.create().apply(al).build().getSession();
check("true", ((SerializerSession)x).isAddBeanTypes());
check("true", x.isAddRootType());
@@ -133,7 +135,7 @@ class SerializerConfigAnnotationTest extends TestBase {
static ClassInfo b = ClassInfo.of(B.class);
@Test void noValuesWriterSerializer() {
- var al = AnnotationWorkList.of(sr, b.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(b.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x = JsonSerializer.create().apply(al).build().getSession();
check("false", ((SerializerSession)x).isAddBeanTypes());
check("false", x.isAddRootType());
@@ -153,7 +155,7 @@ class SerializerConfigAnnotationTest extends TestBase {
}
@Test void noValuesOutputStreamSerializer() {
- var al = AnnotationWorkList.of(sr, b.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(b.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x =
MsgPackSerializer.create().apply(al).build().getSession();
check("false", ((SerializerSession)x).isAddBeanTypes());
check("false", x.isAddRootType());
@@ -178,7 +180,7 @@ class SerializerConfigAnnotationTest extends TestBase {
static ClassInfo c = ClassInfo.of(C.class);
@Test void noAnnotationWriterSerializer() {
- var al = AnnotationWorkList.of(sr, c.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(c.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x = JsonSerializer.create().apply(al).build().getSession();
check("false", ((SerializerSession)x).isAddBeanTypes());
check("false", x.isAddRootType());
@@ -198,7 +200,7 @@ class SerializerConfigAnnotationTest extends TestBase {
}
@Test void noAnnotationOutputStreamSerializer() {
- var al = AnnotationWorkList.of(sr, c.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(c.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x =
MsgPackSerializer.create().apply(al).build().getSession();
check("false", ((SerializerSession)x).isAddBeanTypes());
check("false", x.isAddRootType());
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/soap/SoapXmlConfigAnnotationTest.java
b/juneau-utest/src/test/java/org/apache/juneau/soap/SoapXmlConfigAnnotationTest.java
index 6241c90982..81bfb42160 100644
---
a/juneau-utest/src/test/java/org/apache/juneau/soap/SoapXmlConfigAnnotationTest.java
+++
b/juneau-utest/src/test/java/org/apache/juneau/soap/SoapXmlConfigAnnotationTest.java
@@ -16,6 +16,7 @@
*/
package org.apache.juneau.soap;
+import static org.apache.juneau.common.utils.CollectionUtils.*;
import static org.junit.jupiter.api.Assertions.*;
import java.util.function.*;
@@ -25,6 +26,7 @@ import org.apache.juneau.common.reflect.*;
import org.apache.juneau.soap.annotation.*;
import org.apache.juneau.svl.*;
import org.junit.jupiter.api.*;
+import java.util.stream.*;
/**
* Tests the @SoapXmlConfig annotation.
@@ -50,7 +52,7 @@ class SoapXmlConfigAnnotationTest extends TestBase {
static ClassInfo a = ClassInfo.of(A.class);
@Test void basic() {
- var al = AnnotationWorkList.of(sr, a.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(a.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x =
SoapXmlSerializer.create().apply(al).build().getSession();
check("foo", x.getSoapAction());
}
@@ -64,7 +66,7 @@ class SoapXmlConfigAnnotationTest extends TestBase {
static ClassInfo b = ClassInfo.of(B.class);
@Test void noValues() {
- var al = AnnotationWorkList.of(sr, b.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(b.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x =
SoapXmlSerializer.create().apply(al).build().getSession();
check("http://www.w3.org/2003/05/soap-envelope",
x.getSoapAction());
}
@@ -77,7 +79,7 @@ class SoapXmlConfigAnnotationTest extends TestBase {
static ClassInfo c = ClassInfo.of(C.class);
@Test void noAnnotation() {
- var al = AnnotationWorkList.of(sr, c.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(c.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x =
SoapXmlSerializer.create().apply(al).build().getSession();
check("http://www.w3.org/2003/05/soap-envelope",
x.getSoapAction());
}
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/uon/UonConfigAnnotationTest.java
b/juneau-utest/src/test/java/org/apache/juneau/uon/UonConfigAnnotationTest.java
index edd3d9a346..df337929d4 100644
---
a/juneau-utest/src/test/java/org/apache/juneau/uon/UonConfigAnnotationTest.java
+++
b/juneau-utest/src/test/java/org/apache/juneau/uon/UonConfigAnnotationTest.java
@@ -16,6 +16,7 @@
*/
package org.apache.juneau.uon;
+import static org.apache.juneau.common.utils.CollectionUtils.*;
import static org.junit.jupiter.api.Assertions.*;
import java.util.function.*;
@@ -25,6 +26,7 @@ import org.apache.juneau.common.reflect.*;
import org.apache.juneau.svl.*;
import org.apache.juneau.uon.annotation.*;
import org.junit.jupiter.api.*;
+import java.util.stream.*;
/**
* Tests the @UonConfig annotation.
@@ -54,7 +56,7 @@ class UonConfigAnnotationTest extends TestBase {
static ClassInfo a = ClassInfo.of(A.class);
@Test void basicSerializer() {
- var al = AnnotationWorkList.of(sr, a.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(a.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x = UonSerializer.create().apply(al).build().getSession();
check("true", x.isAddBeanTypes());
check("true", x.isEncoding());
@@ -62,7 +64,7 @@ class UonConfigAnnotationTest extends TestBase {
}
@Test void basicParser() {
- var al = AnnotationWorkList.of(sr, a.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(a.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x = UonParser.create().apply(al).build().getSession();
check("true", x.isDecoding());
check("true", x.isValidateEnd());
@@ -77,7 +79,7 @@ class UonConfigAnnotationTest extends TestBase {
static ClassInfo b = ClassInfo.of(B.class);
@Test void noValuesSerializer() {
- var al = AnnotationWorkList.of(sr, b.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(b.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x = UonSerializer.create().apply(al).build().getSession();
check("false", x.isAddBeanTypes());
check("false", x.isEncoding());
@@ -85,7 +87,7 @@ class UonConfigAnnotationTest extends TestBase {
}
@Test void noValuesParser() {
- var al = AnnotationWorkList.of(sr, b.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(b.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x = UonParser.create().apply(al).build().getSession();
check("false", x.isDecoding());
check("false", x.isValidateEnd());
@@ -99,7 +101,7 @@ class UonConfigAnnotationTest extends TestBase {
static ClassInfo c = ClassInfo.of(C.class);
@Test void noAnnotationSerializer() {
- var al = AnnotationWorkList.of(sr, c.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(c.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x = UonSerializer.create().apply(al).build().getSession();
check("false", x.isAddBeanTypes());
check("false", x.isEncoding());
@@ -107,7 +109,7 @@ class UonConfigAnnotationTest extends TestBase {
}
@Test void noAnnotationParser() {
- var al = AnnotationWorkList.of(sr, c.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(c.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x = UonParser.create().apply(al).build().getSession();
check("false", x.isDecoding());
check("false", x.isValidateEnd());
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/urlencoding/UrlEncodingConfigAnnotationTest.java
b/juneau-utest/src/test/java/org/apache/juneau/urlencoding/UrlEncodingConfigAnnotationTest.java
index 3920ef154a..3a8ca2a98e 100644
---
a/juneau-utest/src/test/java/org/apache/juneau/urlencoding/UrlEncodingConfigAnnotationTest.java
+++
b/juneau-utest/src/test/java/org/apache/juneau/urlencoding/UrlEncodingConfigAnnotationTest.java
@@ -16,6 +16,7 @@
*/
package org.apache.juneau.urlencoding;
+import static org.apache.juneau.common.utils.CollectionUtils.*;
import static org.junit.jupiter.api.Assertions.*;
import java.util.function.*;
@@ -25,6 +26,7 @@ import org.apache.juneau.common.reflect.*;
import org.apache.juneau.svl.*;
import org.apache.juneau.urlencoding.annotation.*;
import org.junit.jupiter.api.*;
+import java.util.stream.*;
/**
* Tests the @UrlEncodingConfig annotation.
@@ -50,13 +52,13 @@ class UrlEncodingConfigAnnotationTest extends TestBase {
static ClassInfo a = ClassInfo.of(A.class);
@Test void basicSerializer() {
- var al = AnnotationWorkList.of(sr, a.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(a.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x =
UrlEncodingSerializer.create().apply(al).build().getSession();
check("true", x.isExpandedParams());
}
@Test void basicParser() {
- var al = AnnotationWorkList.of(sr, a.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(a.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x =
UrlEncodingParser.create().apply(al).build().getSession();
check("true", x.isExpandedParams());
}
@@ -70,13 +72,13 @@ class UrlEncodingConfigAnnotationTest extends TestBase {
static ClassInfo b = ClassInfo.of(B.class);
@Test void noValuesSerializer() {
- var al = AnnotationWorkList.of(sr, b.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(b.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x =
UrlEncodingSerializer.create().apply(al).build().getSession();
check("false", x.isExpandedParams());
}
@Test void noValuesParser() {
- var al = AnnotationWorkList.of(sr, b.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(b.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x =
UrlEncodingParser.create().apply(al).build().getSession();
check("false", x.isExpandedParams());
}
@@ -89,13 +91,13 @@ class UrlEncodingConfigAnnotationTest extends TestBase {
static ClassInfo c = ClassInfo.of(C.class);
@Test void noAnnotationSerializer() {
- var al = AnnotationWorkList.of(sr, c.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(c.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x =
UrlEncodingSerializer.create().apply(al).build().getSession();
check("false", x.isExpandedParams());
}
@Test void noAnnotationParser() {
- var al = AnnotationWorkList.of(sr, c.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(c.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x =
UrlEncodingParser.create().apply(al).build().getSession();
check("false", x.isExpandedParams());
}
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/xml/XmlConfigAnnotationTest.java
b/juneau-utest/src/test/java/org/apache/juneau/xml/XmlConfigAnnotationTest.java
index 650e53c112..dd2e8d210d 100644
---
a/juneau-utest/src/test/java/org/apache/juneau/xml/XmlConfigAnnotationTest.java
+++
b/juneau-utest/src/test/java/org/apache/juneau/xml/XmlConfigAnnotationTest.java
@@ -31,6 +31,7 @@ import org.apache.juneau.common.reflect.*;
import org.apache.juneau.svl.*;
import org.apache.juneau.xml.annotation.*;
import org.junit.jupiter.api.*;
+import java.util.stream.*;
/**
* Tests the @XmlConfig annotation.
@@ -101,7 +102,7 @@ class XmlConfigAnnotationTest extends TestBase {
static ClassInfo a = ClassInfo.of(A.class);
@Test void basicSerializer() {
- var al = AnnotationWorkList.of(sr, a.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(a.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x = XmlSerializer.create().apply(al).build().getSession();
check("true", x.isAddBeanTypes());
check("true", x.isAddNamespaceUrisToRoot());
@@ -112,7 +113,7 @@ class XmlConfigAnnotationTest extends TestBase {
}
@Test void basicParser() {
- var al = AnnotationWorkList.of(sr, a.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(a.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x = XmlParser.create().apply(al).build().getSession();
check("AA", x.getEventAllocator());
check("true", x.isPreserveRootElement());
@@ -130,7 +131,7 @@ class XmlConfigAnnotationTest extends TestBase {
static ClassInfo b = ClassInfo.of(B.class);
@Test void noValuesSerializer() {
- var al = AnnotationWorkList.of(sr, b.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(b.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x = XmlSerializer.create().apply(al).build().getSession();
check("false", x.isAddBeanTypes());
check("false", x.isAddNamespaceUrisToRoot());
@@ -141,7 +142,7 @@ class XmlConfigAnnotationTest extends TestBase {
}
@Test void noValuesParser() {
- var al = AnnotationWorkList.of(sr, b.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(b.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x = XmlParser.create().apply(al).build().getSession();
check(null, x.getEventAllocator());
check("false", x.isPreserveRootElement());
@@ -158,7 +159,7 @@ class XmlConfigAnnotationTest extends TestBase {
static ClassInfo c = ClassInfo.of(C.class);
@Test void noAnnotationSerializer() {
- var al = AnnotationWorkList.of(sr, c.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(c.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x = XmlSerializer.create().apply(al).build().getSession();
check("false", x.isAddBeanTypes());
check("false", x.isAddNamespaceUrisToRoot());
@@ -169,7 +170,7 @@ class XmlConfigAnnotationTest extends TestBase {
}
@Test void noAnnotationParser() {
- var al = AnnotationWorkList.of(sr, c.getAnnotationList());
+ var al = AnnotationWorkList.of(sr,
rstream(c.getAnnotationInfos()).collect(Collectors.toCollection(AnnotationList::new)));
var x = XmlParser.create().apply(al).build().getSession();
check(null, x.getEventAllocator());
check("false", x.isPreserveRootElement());
diff --git a/scripts/build-and-test.py b/scripts/build-and-test.py
new file mode 100755
index 0000000000..cb431100a8
--- /dev/null
+++ b/scripts/build-and-test.py
@@ -0,0 +1,114 @@
+#!/usr/bin/env python3
+#
***************************************************************************************************************************
+# * 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.
+#
***************************************************************************************************************************
+"""
+Build and test helper script for Apache Juneau.
+
+Usage:
+ ./scripts/build-and-test.py [options]
+
+Options:
+ --build-only, -b Only build (skip tests)
+ --test-only, -t Only run tests (no build)
+ --full, -f Clean build + run tests (default)
+ --verbose, -v Show full Maven output
+ --help, -h Show this help message
+"""
+
+import subprocess
+import sys
+import os
+
+def run_command(cmd, verbose=False):
+ """Run a command and return exit code."""
+ print(f"Running: {cmd}")
+ print("-" * 80)
+
+ if verbose:
+ # Show full output
+ result = subprocess.run(cmd, shell=True,
cwd="/Users/james.bognar/git/juneau")
+ return result.returncode
+ else:
+ # Show only last lines
+ result = subprocess.run(
+ f"{cmd} 2>&1 | tail -50",
+ shell=True,
+ cwd="/Users/james.bognar/git/juneau",
+ capture_output=True,
+ text=True
+ )
+ print(result.stdout)
+ if result.stderr:
+ print(result.stderr, file=sys.stderr)
+ return result.returncode
+
+def build(verbose=False):
+ """Run Maven clean install without tests."""
+ return run_command("mvn clean install -q -DskipTests", verbose)
+
+def test(verbose=False):
+ """Run Maven tests."""
+ return run_command("mvn test -q -Drat.skip=true", verbose)
+
+def main():
+ args = sys.argv[1:]
+
+ # Parse arguments
+ build_only = False
+ test_only = False
+ full = True
+ verbose = False
+
+ for arg in args:
+ if arg in ['--help', '-h']:
+ print(__doc__)
+ return 0
+ elif arg in ['--build-only', '-b']:
+ build_only = True
+ full = False
+ elif arg in ['--test-only', '-t']:
+ test_only = True
+ full = False
+ elif arg in ['--full', '-f']:
+ full = True
+ elif arg in ['--verbose', '-v']:
+ verbose = True
+ else:
+ print(f"Unknown option: {arg}")
+ print(__doc__)
+ return 1
+
+ # Execute commands
+ exit_code = 0
+
+ if build_only or full:
+ exit_code = build(verbose)
+ if exit_code != 0:
+ print("\n❌ Build failed!")
+ return exit_code
+ print("\n✅ Build succeeded!")
+
+ if test_only or full:
+ if full:
+ print("\n" + "=" * 80)
+ exit_code = test(verbose)
+ if exit_code != 0:
+ print("\n❌ Tests failed!")
+ return exit_code
+ print("\n✅ Tests passed!")
+
+ return exit_code
+
+if __name__ == '__main__':
+ sys.exit(main())
+