use of liquibase.logging.LogFactory in project liquibase by liquibase.
the class LiquibaseTest method before.
// private TestLiquibase testLiquibase;
// private DatabaseConnection connectionForConstructor;
@Before
public void before() throws Exception {
// if (connectionForConstructor != null) {
// reset(connectionForConstructor);
// }
// connectionForConstructor = createMock(DatabaseConnection.class);
// connectionForConstructor.setAutoCommit(false);
// expectLastCall().atLeastOnce();
//
// DatabaseMetaData metaData = createMock(DatabaseMetaData.class);
// expect(metaData.getDatabaseProductName()).andReturn("Oracle");
// replay(metaData);
//
//// expect(connectionForConstructor.getMetaData()).andReturn(metaData);
// replay(connectionForConstructor);
//
// testLiquibase = new TestLiquibase();
mockResourceAccessor = new MockResourceAccessor();
mockDatabase = mock(Database.class);
mockLockService = mock(LockService.class);
mockLockServiceFactory = mock(LockServiceFactory.class);
mockChangeLogParserFactory = mock(ChangeLogParserFactory.class);
mockChangeLogParser = mock(ChangeLogParser.class);
mockChangeLog = mock(DatabaseChangeLog.class);
mockChangeLogIterator = mock(ChangeLogIterator.class);
mockLogger = mock(Logger.class);
LockServiceFactory.setInstance(mockLockServiceFactory);
when(mockLockServiceFactory.getLockService(any(Database.class))).thenReturn(mockLockService);
ChangeLogParserFactory.setInstance(mockChangeLogParserFactory);
when(mockChangeLogParserFactory.getParser(anyString(), Mockito.isA(ResourceAccessor.class))).thenReturn(mockChangeLogParser);
when(mockChangeLogParser.parse(anyString(), any(ChangeLogParameters.class), Mockito.isA(ResourceAccessor.class))).thenReturn(mockChangeLog);
LogFactory.setInstance(new LogFactory() {
@Override
public Logger getLog(String name) {
return mockLogger;
}
});
}
Aggregations