{"id":32861008,"url":"https://github.com/akarazhev/crypto-scout-test","last_synced_at":"2026-06-16T20:32:31.922Z","repository":{"id":322625508,"uuid":"1090237190","full_name":"akarazhev/crypto-scout-test","owner":"akarazhev","description":"Test support library for crypto-scout: mock data fixtures + Podman Compose-managed TimescaleDB  and RabbitMQ (Streams + AMQP) for integration tests. This project was authored with AI-driven tools.","archived":false,"fork":false,"pushed_at":"2026-02-01T18:16:40.000Z","size":307,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-02T02:01:31.775Z","etag":null,"topics":["bybit","cryprocurrency","java","junit","podman","podman-compose","timescaledb"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/akarazhev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2025-11-05T11:58:32.000Z","updated_at":"2026-02-01T18:16:43.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/akarazhev/crypto-scout-test","commit_stats":null,"previous_names":["akarazhev/crypto-scout-test"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/akarazhev/crypto-scout-test","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akarazhev%2Fcrypto-scout-test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akarazhev%2Fcrypto-scout-test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akarazhev%2Fcrypto-scout-test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akarazhev%2Fcrypto-scout-test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/akarazhev","download_url":"https://codeload.github.com/akarazhev/crypto-scout-test/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akarazhev%2Fcrypto-scout-test/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34423214,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-16T02:00:06.860Z","response_time":126,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["bybit","cryprocurrency","java","junit","podman","podman-compose","timescaledb"],"created_at":"2025-11-08T20:01:51.803Z","updated_at":"2026-06-16T20:32:31.912Z","avatar_url":"https://github.com/akarazhev.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# crypto-scout-test\n\nTest support library for the crypto-scout ecosystem. Provides mock data fixtures and containerized test infrastructure (TimescaleDB + RabbitMQ).\n\n## Features\n\n- **MockData** - Typed access to JSON fixtures (Bybit Spot/Linear, CMC, internal)\n- **PodmanCompose** - Lifecycle management for TimescaleDB and RabbitMQ containers\n- **StreamTestPublisher/Consumer** - RabbitMQ Streams test utilities (thread-safe)\n- **AmqpTestPublisher/Consumer** - AMQP test utilities with confirmation timeouts\n- **DBUtils** - Database cleanup and connection helpers\n- **Assertions** - Database state verification (table counts, etc.)\n\n## Quick Start\n\n### Build\n```bash\nmvn -q -DskipTests install\n```\n\n### Add Dependency\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.github.akarazhev.cryptoscout\u003c/groupId\u003e\n    \u003cartifactId\u003ecrypto-scout-test\u003c/artifactId\u003e\n    \u003cversion\u003e0.0.1\u003c/version\u003e\n    \u003cscope\u003etest\u003c/scope\u003e\n\u003c/dependency\u003e\n```\n\n### Usage\n\n**Mock Data:**\n```java\nvar spotKlines = MockData.get(Source.BYBIT_SPOT, Type.KLINE_1);\nvar fgi = MockData.get(Source.CRYPTO_SCOUT, Type.FGI);\n```\n\n**Container Lifecycle:**\n```java\n@BeforeAll static void setUp() { PodmanCompose.up(); }\n@AfterAll static void tearDown() { PodmanCompose.down(); }\n```\n\n**RabbitMQ Streams:**\n```java\nvar publisher = StreamTestPublisher.create(reactor, executor, env, \"stream\");\npublisher.start().await();\npublisher.publish(payload).await();\n\nvar consumer = StreamTestConsumer.create(reactor, executor, env, \"stream\");\nconsumer.start().await();\nvar result = consumer.getResult().await();\n```\n\n**RabbitMQ AMQP:**\n```java\nvar publisher = AmqpTestPublisher.create(reactor, executor, factory, \"queue\");\npublisher.publish(\"exchange\", \"key\", message).await();\n\nvar consumer = AmqpTestConsumer.create(reactor, executor, factory, \"queue\");\nvar received = consumer.getMessage().await();\n```\n\n**Database Operations:**\n```java\nDBUtils.deleteFromTables(dataSource, \"table1\", \"table2\");\nAssertions.assertTableCount(\"table1\", 5);\n```\n\n## Configuration\n\n| Property | Default | Description |\n|----------|---------|-------------|\n| `podman.compose.cmd` | `podman-compose` | Podman Compose executable |\n| `test.db.jdbc.url` | `jdbc:postgresql://localhost:5432/crypto_scout` | Database URL |\n| `test.db.user` | `crypto_scout_db` | Database username |\n| `test.db.password` | `crypto_scout_db` | Database password |\n| `test.mq.host` | `localhost` | RabbitMQ host |\n| `test.mq.port` | `5552` | RabbitMQ Streams port |\n| `test.mq.user` | `crypto_scout_mq` | RabbitMQ username |\n| `test.mq.password` | `crypto_scout_mq` | RabbitMQ password |\n| `podman.compose.up.timeout.min` | `3` | Startup timeout (minutes) |\n\n### Example\n```bash\nmvn -q -Dpodman.compose.up.timeout.min=5 test\n```\n\n## Requirements\n\n- Java 25\n- Maven 3.9+\n- Podman + podman-compose\n\n## Services\n\n**TimescaleDB** (PostgreSQL 17)\n- Port: 5432\n- Default DB: `crypto_scout`\n- Credentials: `crypto_scout_db` / `crypto_scout_db`\n\n**RabbitMQ** 4.1.4\n- AMQP: 5672\n- Streams: 5552\n- Credentials: `crypto_scout_mq` / `crypto_scout_mq`\n\n## Thread Safety\n\nAll publishers and consumers are thread-safe using `AtomicReference`:\n- `StreamTestPublisher` - Atomic producer state management\n- `StreamTestConsumer` - Atomic result capture (first message only)\n- `AmqpTestPublisher` - Atomic connection/channel state, 5s confirmation timeout\n- `AmqpTestConsumer` - Thread-safe message handling\n\n## Error Handling\n\nAll operations throw `IllegalStateException` on failure:\n- `MockData.get()` - Resource not found\n- `PodmanCompose.up()/down()` - Command failure or timeout\n- `*Publisher.publish()` - Not started, connection closed, or timeout\n- `*Consumer.getResult()/getMessage()` - Not started\n\n## Troubleshooting\n\n| Issue | Solution |\n|-------|----------|\n| Command not found | Set `-Dpodman.compose.cmd=/path/to/podman-compose` |\n| Streams unreachable | Check port 5552 is free |\n| DB unreachable | Verify JDBC URL and credentials |\n| Cleanup failures | Check `DBUtils.deleteFromTables()` return value |\n| Temp directories | Auto-cleaned via shutdown hooks; manual cleanup if JVM killed with -9 |\n\n## License\n\nMIT License. See `LICENSE`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakarazhev%2Fcrypto-scout-test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakarazhev%2Fcrypto-scout-test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakarazhev%2Fcrypto-scout-test/lists"}