# pvkcseaccet/stresster architecture

> Architecture diagram of the GitHub repository pvkcseaccet/stresster, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pvkcseaccet/stresster
- Repository: https://github.com/pvkcseaccet/stresster

## Overview

##### Main Components
- Main Entry Point: Use the StressTester class (located at src/main/java/com/stresster/StressTester.java) as the central controller for initiating tests.
- Core Infrastructure: The “core” package (e.g., ConcurrentRequestHandler.java and Util.java) manages concurrency and utility functions.
- Domain Model: The “domain” package (e.g., TestType.java) encapsulates the different test types.
- Exception Handling: The “exception” package holds custom exceptions (e.g., StressterException, StressterExceptionStore).
- Parsing Modules: The “parser” package (DataFetcher.java, DataParser.java) is responsible for reading and interpreting the JSON test definitions.
- Reporting: The “reports” package (HtmlReportGenerator.java, ReportingDataAccumulator.java) generates formatted performance reports, with supplementary resources under the “resources/reports” directory.
- Resource Models: The “resources” package defines the data structures (e.g., Request, Response, TestProps, and TestResults) used throughout the application.
- Templates: HTML templates (src/main/resources/templates/report.html) are used for report visualization.

##### Relationships and Interactions
- Initialization: StressTester acts as the main driver, reading configuration from a test properties file (provided externally) and using the DataParser/DataFetcher to read the actual test data.
- Concurrency Management: The ConcurrentRequestHandler coordinates the concurrent HTTP request execution using Java’s concurrency utilities (like CyclicBarrier and FutureTask) as mentioned in the README.
- Request/Response Flow: Data moves from the parsed request definitions (located in TestProps and request-related resources) through the ConcurrentRequestHandler, which then passes HTTP responses back to be accumulated.
- Reporting: Reporting components accumulate performance metrics and generate an HTML report via the HtmlReportGenerator using the pre-defined template.
- Exception Handling: Any issues during test execution are managed by the custom exception components.

##### Architectural Patterns and Key Technologies
- Modularity: The clear separation of concerns across packages (domain, core, parser, reports, exception, and resources) supports maintainability and scalability.
- Concurrency Pattern: Synchronized and asynchronous execution patterns are used (via utilities such as CyclicBarrier and FutureTask) to manage high parallelism.
- Reporting & Data Flow: Data aggregation and transformation for producing performance results, which is a crucial part of the architecture.
- Tech Stack: Java (JDK 11+), Gradle for build automation (indicated by build.gradle.kts, gradlew, and settings.gradle.kts), JSON library for parsing, and Lombok for code generation.

##### Final Checklist
- Use clear, descriptive labels (e.g., “StressTester (Main Driver)”, “Concurrent Request Handler”, “Data Parser”, “Html Report Generator”).
- Differentiate between the layers (Frontend: Reporting outputs, Core: Concurrency and Processing, Backend: Request/Response handling).
- Depicting external dependencies briefly (e.g., JSON and Lombok) since they affect how certain modules operate.
- Maintain a high level of detail so that every key component and its connection to others is visibly mapped.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Main Controller Layer"
        ST["StressTester (Main Driver)"]:::controller
    end

    subgraph "Parsing Layer"
        DP["DataParser"]:::parser
        DF["DataFetcher"]:::parser
    end

    subgraph "Core Concurrency Layer"
        CR["ConcurrentRequestHandler"]:::core
        UT["Util"]:::core
    end

    subgraph "Domain & Exception Layer"
        DM["TestType (Domain Model)"]:::domain
        EH["StressterException & Store (Exception Handling)"]:::exception
    end

    subgraph "Resource Models Layer"
        RM["Request / Response / TestProps / TestResults"]:::resources
    end

    subgraph "Reporting Layer"
        RG["HtmlReportGenerator & ReportingDataAccumulator"]:::reporting
        TR["HTML Template Report"]:::templates
        SR["Supplementary Report Resources"]:::reporting
    end

    %% Data Flow Connections
    ST -->|"initTestConfig"| DP
    ST -->|"initTestConfig"| DF
    DP -->|"definesTestTypes"| DM
    DP -->|"suppliesTestData"| CR
    DF -->|"suppliesTestData"| CR
    ST -->|"monitorsExecution"| EH
    CR -->|"executesHTTPCalls"| RM
    CR -->|"handlesExceptions"| EH
    RM -->|"aggregatesResponses"| RG
    RG -->|"usesTemplate"| TR
    RG -->|"includesSupplementary"| SR

    %% Click Events
    click ST "https://github.com/pvkcseaccet/stresster/blob/master/src/main/java/com/stresster/StressTester.java"
    click DP "https://github.com/pvkcseaccet/stresster/tree/master/src/main/java/com/stresster/parser"
    click DF "https://github.com/pvkcseaccet/stresster/tree/master/src/main/java/com/stresster/parser"
    click CR "https://github.com/pvkcseaccet/stresster/tree/master/src/main/java/com/stresster/core"
    click UT "https://github.com/pvkcseaccet/stresster/tree/master/src/main/java/com/stresster/core"
    click DM "https://github.com/pvkcseaccet/stresster/tree/master/src/main/java/com/stresster/domain"
    click EH "https://github.com/pvkcseaccet/stresster/tree/master/src/main/java/com/stresster/exception"
    click RM "https://github.com/pvkcseaccet/stresster/tree/master/src/main/java/com/stresster/resources"
    click RG "https://github.com/pvkcseaccet/stresster/tree/master/src/main/java/com/stresster/reports"
    click SR "https://github.com/pvkcseaccet/stresster/tree/master/data/reports"
    click TR "https://github.com/pvkcseaccet/stresster/tree/master/src/main/resources/templates"

    %% Styles
    classDef controller fill:#ffcccc,stroke:#333,stroke-width:2px;
    classDef parser fill:#cce5ff,stroke:#333,stroke-width:2px;
    classDef core fill:#ffe5cc,stroke:#333,stroke-width:2px;
    classDef domain fill:#e5ccff,stroke:#333,stroke-width:2px;
    classDef exception fill:#ffd9e6,stroke:#333,stroke-width:2px;
    classDef resources fill:#d9ffd9,stroke:#333,stroke-width:2px;
    classDef reporting fill:#ccffff,stroke:#333,stroke-width:2px;
    classDef templates fill:#e0e0ff,stroke:#333,stroke-width:2px;
```
