{"id":27156970,"url":"https://github.com/engineerdogita/cursor-test-uat","last_synced_at":"2025-07-14T00:07:12.070Z","repository":{"id":286604904,"uuid":"952196025","full_name":"EngineerDogIta/cursor-test-uat","owner":"EngineerDogIta","description":null,"archived":false,"fork":false,"pushed_at":"2025-04-07T12:21:23.000Z","size":433,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-07T12:42:28.498Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/EngineerDogIta.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-20T22:17:53.000Z","updated_at":"2025-03-24T09:44:33.000Z","dependencies_parsed_at":"2025-04-07T12:52:36.658Z","dependency_job_id":null,"html_url":"https://github.com/EngineerDogIta/cursor-test-uat","commit_stats":null,"previous_names":["engineerdogita/cursor-test-uat"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/EngineerDogIta/cursor-test-uat","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EngineerDogIta%2Fcursor-test-uat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EngineerDogIta%2Fcursor-test-uat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EngineerDogIta%2Fcursor-test-uat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EngineerDogIta%2Fcursor-test-uat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EngineerDogIta","download_url":"https://codeload.github.com/EngineerDogIta/cursor-test-uat/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EngineerDogIta%2Fcursor-test-uat/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265224158,"owners_count":23730342,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-04-08T20:53:17.668Z","updated_at":"2025-07-14T00:07:12.031Z","avatar_url":"https://github.com/EngineerDogIta.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Spring AI Application with Test Generation\n\nThis project demonstrates using Spring AI to interact with LLMs via Ollama for various tasks, including chat and automated UAT test generation via a secured API.\n\n## Features\n\n*   **AI Chat:** Basic chat functionality via a REST endpoint (`/chat`).\n*   **UAT Test Generation API:** Asynchronously generates UAT tests from provided content (e.g., Jira ticket descriptions) via secured REST endpoints under `/api/uat/`.\n*   **Persistence:** Uses Hibernate/JPA for persistence, configured via Spring Profiles:\n    *   **`dev` profile (default):** Uses a SQLite database (`data/test_generation.db`).\n    *   **`prod` profile:** Uses an Oracle database (connection details configured via environment variables).\n\n## Prerequisites\n\n*   Java 17 or higher\n*   Maven\n*   Ollama installed and running locally (See [Ollama Website](https://ollama.com/))\n*   An Ollama model downloaded (defaults to `mistral`). Pull it using:\n    ```bash\n    ollama pull mistral\n    ```\n    *(Note: The model can be changed in `src/main/resources/application.yml`)*\n*   (For `prod` profile) Access to an Oracle database.\n\n## Configuration\n\n1.  **Ollama:** Ensure Ollama is running. By default, the application connects to `http://localhost:11434`. This can be overridden using the `OLLAMA_HOST` environment variable or by modifying `spring.ai.ollama.base-url` in `src/main/resources/application.yml`.\n2.  **Model:** The default model is `mistral`. You can configure the model name and its parameters (`temperature`, `top_p`, etc.) under `spring.ai.ollama` in `src/main/resources/application.yml`.\n3.  **Database (via Profiles):**\n    *   Configuration is managed using Spring Profiles. Common settings are in `src/main/resources/application.yml`.\n    *   **Development (`dev` profile):** Uses SQLite. Configuration is in `src/main/resources/application-dev.yml`. The database file is `data/test_generation.db` relative to the application run location.\n    *   **Production (`prod` profile):** Uses Oracle. Configuration is in `src/main/resources/application-prod.yml`. Connection details (URL, username, password) should be provided via environment variables:\n        *   `SPRING_DATASOURCE_URL` (e.g., `jdbc:oracle:thin:@//your-oracle-host:1521/YOUR_SERVICE`)\n        *   `DB_USERNAME`\n        *   `DB_PASSWORD`\n4.  **API Key:** The UAT Generation API requires an API key. Set this securely in `src/main/resources/application.yml` under `api.security.key` or via the `API_SECURITY_KEY` environment variable (recommended for production).\n5.  **Application Settings:** Other settings, like test generation parameters and validation prompts, are also configurable in `src/main/resources/application.yml`.\n\n## Compiling and Running\n\n1.  **Compile:**\n    ```bash\n    ./mvnw clean package\n    # or mvn clean package if you have Maven installed globally\n    ```\n\n2.  **Run (Select Profile):**\n    *   **Development (SQLite - Default if not specified):**\n        ```bash\n        # Using Maven plugin (activates 'dev' profile by default implicitly if no other active)\n        ./mvnw spring-boot:run \n        # Or explicitly:\n        ./mvnw spring-boot:run -Dspring-boot.run.profiles=dev\n        # Or using the JAR:\n        java -Dspring.profiles.active=dev -jar target/spring-ai-ollama-demo-*.jar\n        ```\n    *   **Production (Oracle):**\n        ```bash\n        # Set environment variables first (example)\n        export SPRING_DATASOURCE_URL=jdbc:oracle:thin:@//your-oracle-host:1521/YOUR_SERVICE\n        export DB_USERNAME=your_user\n        export DB_PASSWORD=your_secret_password\n        export API_SECURITY_KEY=your_prod_api_key \n\n        # Using Maven plugin:\n        ./mvnw spring-boot:run -Dspring-boot.run.profiles=prod\n        # Or using the JAR:\n        java -Dspring.profiles.active=prod -jar target/spring-ai-ollama-demo-*.jar\n        ```\n    *(Replace `*` with the actual version in JAR commands)*\n\n## Usage\n\n*   **Chat Endpoint:**\n    ```bash\n    curl -X POST -H \"Content-Type: text/plain\" -d \"Hello AI!\" http://localhost:8080/chat\n    ```\n*   **UAT Test Generation API (Requires `X-API-Key` Header):**\n    *   Start Asynchronous Test Generation:\n        ```bash\n        # Replace YOUR_API_KEY with the actual key\n        curl -X POST -H \"Content-Type: application/json\" -H \"X-API-Key: YOUR_API_KEY\" -d '{ \n          \"content\": \"User should be able to login with valid credentials.\", \n          \"ticketId\": \"PROJ-123\", \n          \"components\": [\"Authentication\"] \n        }' http://localhost:8080/api/uat/generate\n        ```\n        (This returns a `jobId`)\n    *   Check Job Status:\n        ```bash\n        # Replace {jobId} and YOUR_API_KEY\n        curl -H \"X-API-Key: YOUR_API_KEY\" http://localhost:8080/api/uat/jobs/{jobId}/status \n        ```\n    *   Get Test Result:\n        ```bash\n        # Replace {jobId} and YOUR_API_KEY\n        curl -H \"X-API-Key: YOUR_API_KEY\" http://localhost:8080/api/uat/jobs/{jobId}/test-result\n        ```\n    *   Get Job Logs:\n        ```bash\n        # Replace {jobId} and YOUR_API_KEY\n        curl -H \"X-API-Key: YOUR_API_KEY\" http://localhost:8080/api/uat/jobs/{jobId}/logs \n        ```\n    *   Delete Job:\n        ```bash\n        # Replace {jobId} and YOUR_API_KEY\n        curl -X DELETE -H \"X-API-Key: YOUR_API_KEY\" http://localhost:8080/api/uat/jobs/{jobId}\n        ```\n\n## Key Technologies\n\n*   Java 17\n*   Spring Boot 3.x\n*   Spring AI\n*   Spring Profiles\n*   Ollama\n*   Maven\n*   SQLite (for `dev` profile)\n*   Oracle (for `prod` profile)\n*   Hibernate/JPA\n*   Docker (optional, for containerization - see `Dockerfile` and `docker-compose.yml`) ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fengineerdogita%2Fcursor-test-uat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fengineerdogita%2Fcursor-test-uat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fengineerdogita%2Fcursor-test-uat/lists"}