{"id":16455301,"url":"https://github.com/cchantep/acolyte","last_synced_at":"2025-04-05T15:07:48.676Z","repository":{"id":535947,"uuid":"9815476","full_name":"cchantep/acolyte","owner":"cchantep","description":":tiger: Mockup/testing JDBC \u0026 MongoDB driver (or Chmeee's son on the Ringworld).","archived":false,"fork":false,"pushed_at":"2025-03-17T16:07:46.000Z","size":3096,"stargazers_count":61,"open_issues_count":5,"forks_count":14,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-29T14:10:03.000Z","etag":null,"topics":["database","java","jdbc","mockup","persistence","reactivemongo","scala","testing"],"latest_commit_sha":null,"homepage":"http://acolyte.eu.org/","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-2.1","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cchantep.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2013-05-02T14:58:45.000Z","updated_at":"2025-03-17T16:07:50.000Z","dependencies_parsed_at":"2023-10-04T16:15:46.159Z","dependency_job_id":"250a69b0-3d6b-4c34-bd10-f581b5682a8f","html_url":"https://github.com/cchantep/acolyte","commit_stats":{"total_commits":554,"total_committers":8,"mean_commits":69.25,"dds":0.5126353790613718,"last_synced_commit":"12603aca205ce4f3044f321df3ff7c3f89fce8fb"},"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cchantep%2Facolyte","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cchantep%2Facolyte/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cchantep%2Facolyte/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cchantep%2Facolyte/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cchantep","download_url":"https://codeload.github.com/cchantep/acolyte/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247353746,"owners_count":20925329,"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":["database","java","jdbc","mockup","persistence","reactivemongo","scala","testing"],"created_at":"2024-10-11T10:21:54.198Z","updated_at":"2025-04-05T15:07:48.660Z","avatar_url":"https://github.com/cchantep.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Acolyte\n\nAcolyte is a JDBC driver designed for cases like mockup, testing, or any case you would like to be able to handle JDBC query by hand (or maybe that's only Chmeee's son on the Ringworld).\n\n## Motivation\n\nPersistence layer not only apply changes and retrieve raw data. It usually gathers those data from several sources (e.g. various queries), but also converts data types (e.g. integer to boolean) and maps it to structured information.\n\nAutomated testing about that is not trivial.\nUsing test DB requires tools (scripts) to set up environment repeatly, for each time tests are executed.\n\nConsidering integration testing that's fine. It's different for unit testing.\n\nUnit tests must be isolated from each others so each unit can be validated independently.     \n\nA unit test can alter database as executed. Thus tests coming after would have to cope with this altered environment, without asserting which one is runned first (no order assumption).\n\nAs tests can be runned in parallel while considering code accessing same data spaces. Without extra attention to isolation/transaction management, this can lead to tests conflicting between them.\n\nWith Acolyte, connection behaviour can be built, defining which statement is supported with which (query or update) result.\n\nEach prepared connection can supports only queries and updates your code is interested in, and there is no need to simulate a whole data store structure/schema.\n\nAs soon as Acolyte connections don't rely on data store, statement executions are isolated without extra effort.\n\nAs a JDBC driver is provided you can simply update test configuration, so that Acolyte connections are resolved by persistence code without change throught standard mechanisms (JDBC URL, JNDI, ...).\n\nIt also makes simple testing of DB edge cases (e.g. unrecoverable/unexpected error). It's easy to throw an exception from Acolyte connection, so that it can be validated persistence code is properly handling such case.\n\nYou can also use Acolyte to fully benefit from data access abstraction, not only not having to wait persistence (DB) being setup to code accesses, but also not having to wait persistence to code tests for access code.\n\nYou can get a quick interactive tour of Acolyte, online at [tour.acolyte.eu.org](http://tour.acolyte.eu.org).\n\n## Usage\n\nAcolyte is usable with any code relying on JDBC. It makes it available for any JVM language:\n\n* vanilla [Java](http://acolyte.eu.org/java/),\n* [Scala](http://acolyte.eu.org/scala/) (with DSL),\n* [Clojure](http://clojure.com), [Fredge](https://github.com/Frege/frege), ...\n\nYou can get connection defined by Acolyte using the well-known `java.sql.DriverManager.getConnection(jdbcUrl)` (see [connection management](http://acolyte.eu.org/java/#Connection)).\n\n```java\nfinal String jdbcUrl = \"jdbc:acolyte:anything-you-want?handler=my-unique-id\";\n\nStatementHandler handler = new CompositeHandler().\n  withQueryDetection(\"^SELECT \"). // regex test from beginning\n  withQueryDetection(\"EXEC that_proc\"). // second detection regex\n  withUpdateHandler(new CompositeHandler.UpdateHandler() {\n    // Handle execution of update statement (not query)\n    public UpdateResult apply(String sql, List\u003cParameter\u003e parameters) {\n      // ...\n    }\n  }).withQueryHandler(new CompositeHandler.QueryHandler () {\n    public QueryResult apply(String sql, List\u003cParameter\u003e parameters) {\n      // ...\n    }\n  });\n\n// Register prepared handler with expected ID 'my-unique-id'\nacolyte.jdbc.Driver.register(\"my-unique-id\", handler);\n\n// then when existing code do ...\nConnection con = DriverManager.getConnection(jdbcUrl);\n\n// ... Connection |con| is managed through Acolyte |handler|\n```\n\nYou can use Acolyte with various JVM test and persistence frameworks (see [Integration guide](http://acolyte.eu.org/integration/)).\n\nWith [Studio](http://acolyte.eu.org/studio/), you can use data extracted from existing database with Acolyte handler.\n\n_Projects using Acolyte:_\n\n- [Play Framework](http://www.playframework.com/) Anorm ([AnormSpec](https://github.com/playframework/anorm/blob/master/core/src/test/scala/anorm/AnormSpec.scala)). \n- [Youtube Vitess](https://github.com/youtube/vitess).\n\nTo share questions, answers \u0026 ideas, you can go to the [mailing list](https://groups.google.com/forum/#!forum/acolyte-support).\n\n## Requirements\n\n* Java 1.6+\n\n## Limitations\n\n- Limited datatype conversions.\n- Binary datatype are not currently supported.\n- Pseudo-support for transaction.\n- Currency types.\n\n## Related applications\n\n- [Acolyte Studio](http://acolyte.eu.org/studio/): Application with CLI and GUI which is useful when you already have a database and want tests to use data extracted from there.\n- [Acolyte for ReactiveMongo](http://acolyte.eu.org/reactive-mongo/). Acolyte module to unit test persistence based on [ReactiveMongo](http://reactivemongo.org/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcchantep%2Facolyte","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcchantep%2Facolyte","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcchantep%2Facolyte/lists"}