use of org.apache.cayenne.access.jdbc.SQLTemplateAction in project cayenne by apache.
the class AutoAdapterIT method testCreateSQLTemplateAction.
@Test
public void testCreateSQLTemplateAction() {
Provider<DbAdapter> adapterProvider = mock(Provider.class);
when(adapterProvider.get()).thenReturn(dataNode.getAdapter());
AutoAdapter autoAdapter = new AutoAdapter(adapterProvider, NoopJdbcEventLogger.getInstance());
SQLTemplateAction action = (SQLTemplateAction) autoAdapter.getAction(new SQLTemplate(Artist.class, "select * from artist"), dataNode);
// it is important for SQLTemplateAction to be used with unwrapped
// adapter, as the
// adapter class name is used as a key to the correct SQL template.
assertNotNull(action.getAdapter());
assertFalse(action.getAdapter() instanceof AutoAdapter);
assertSame(dataNode.getAdapter(), action.getAdapter());
}
Aggregations