use of org.openmuc.framework.datalogger.sql.TableSetup in project OpenMUC by isc-konstanz.
the class TableSetupTest method setupInitializer.
@BeforeEach
void setupInitializer() throws SQLException {
accessMock = mock(DbAccess.class);
channelList = new ArrayList<>();
channelList.add(getMockedChannel("gridPower"));
channelList.add(getMockedChannel("pvPower"));
ResultSet resultMocked = mock(ResultSet.class);
ResultSetMetaData resultMetaMock = mock(ResultSetMetaData.class);
when(resultMetaMock.getColumnCount()).thenReturn(0);
when(resultMocked.getMetaData()).thenReturn(resultMetaMock);
when(accessMock.executeQuery(any())).thenReturn(resultMocked);
when(accessMock.getColumnLength(anyList(), anyString())).thenReturn(Collections.nCopies(20, 20));
PropertyHandler propHandlerMock = mock(PropertyHandler.class);
when(propHandlerMock.getString(Settings.URL)).thenReturn("jdbc:h2");
PropertyHandlerProvider.getInstance().setPropertyHandler(propHandlerMock);
tableSetup = new TableSetup(channelList, accessMock);
metaBuilder = new MetaBuilder(channelList, accessMock);
}
Aggregations