Skip to content

Instantly share code, notes, and snippets.

@xcesco
Created October 1, 2018 12:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xcesco/a600301f11cbdb8042dfb11b0bbb8b9c to your computer and use it in GitHub Desktop.
Save xcesco/a600301f11cbdb8042dfb11b0bbb8b9c to your computer and use it in GitHub Desktop.
@BindDataSource(fileName="app.db", version=1, daoSet={DaoPerson.class})
public interface AppDataSource {
/**
* @param daoPerson
* is injected by kripton
* @param name
* is
*/
@BindTransaction
static void execute(DaoPerson daoPerson, String name) {
daoPerson.insert(new Person(-1, name, "Surname"));
}
}
@Test
public void testSelect() throws InterruptedException, ExecutionException {
BindAppDataSource ds = BindAppDataSource.getInstance();
Future<Boolean> result = ds.executeAsync("tonj");
log("Result : "+result.get());
List<Person> list = ds.executeBatch(daoFactory -> {
return daoFactory.getDaoPerson().select("tonj");
});
assertEquals(1, list.size());
Thread.sleep(1000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment