Created
October 1, 2018 12:03
-
-
Save xcesco/a600301f11cbdb8042dfb11b0bbb8b9c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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")); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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