Permalink
Browse files

Removed easymock usage

  • Loading branch information...
nvoxland committed Jan 21, 2016
1 parent 2889d5e commit bf9faf451931e4d25f3f0d34b8b5f2f1b6b2b7c4
@@ -1,8 +1,6 @@
<Project filename="&lt;&lt;unnamed project&gt;&gt;" projectName="liquibase.core">
<Jar>C:\othersvn\liquibase\core\build</Jar>
<AuxClasspathEntry>C:\othersvn\liquibase\core\lib\cglib-nodep-2.1_3.jar</AuxClasspathEntry>
<AuxClasspathEntry>C:\othersvn\liquibase\core\lib\easymock-2.2.jar</AuxClasspathEntry>
<AuxClasspathEntry>C:\othersvn\liquibase\core\lib\easymockclassextension-2.2.jar</AuxClasspathEntry>
<AuxClasspathEntry>C:\othersvn\liquibase\core\lib\junit-4.1.jar</AuxClasspathEntry>
<AuxClasspathEntry>C:\othersvn\liquibase\core\lib\opencsv-1.8.jar</AuxClasspathEntry>
<AuxClasspathEntry>C:\othersvn\liquibase\core\lib-compile\ant-1.6.5.jar</AuxClasspathEntry>
@@ -54,12 +54,6 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymockclassextension</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
@@ -791,7 +791,7 @@ protected void configureClassLoader() throws CommandLineParsingException {
File jar = extract(earZip, entry);
URL newUrl = new URL("jar:" + jar.toURI().toURL() + "!/");
urls.add(newUrl);
logger.debug("Adding '"+newUrl+"' to classpath");
logger.debug("Adding '" + newUrl + "' to classpath");
jar.deleteOnExit();
} else if (entry.getName().toLowerCase().endsWith("war")) {
File warFile = extract(earZip, entry);
@@ -11,19 +11,13 @@ import liquibase.resource.ClassLoaderResourceAccessor
import liquibase.resource.CompositeResourceAccessor
import liquibase.resource.FileSystemResourceAccessor
import liquibase.resource.ResourceAccessor
import org.easymock.Capture
import org.easymock.IAnswer
import org.junit.Assert
import spock.lang.Ignore
import spock.lang.Specification
import java.sql.PreparedStatement
import java.sql.SQLException
import static org.easymock.EasyMock.*
import static org.easymock.classextension.EasyMock.createMock
import static org.easymock.classextension.EasyMock.replay
public class ExecutablePreparedStatementTest extends Specification {
@Ignore
@@ -66,38 +60,38 @@ public class ExecutablePreparedStatementTest extends Specification {
assertSetBinaryStream(columns, changeSet);
}
protected void assertSetBinaryStream(List<ColumnConfig> columns, ChangeSet changeSet)
throws SQLException, DatabaseException {
InsertExecutablePreparedStatement statement =
new InsertExecutablePreparedStatement(
new MockDatabase(), "catalog", "schema", "table", columns, changeSet, createResourceAccessor());
PreparedStatement stmt = createMock(PreparedStatement.class);
final Capture<Integer> index = new Capture<Integer>();
final Capture<InputStream> inStream = new Capture<InputStream>();
final Capture<Integer> length = new Capture<Integer>();
stmt.setBinaryStream(capture(index), capture(inStream), capture(length));
expectLastCall().andAnswer(new IAnswer<Object>() {
@Override
public Object answer() throws Throwable {
Assert.assertEquals(new Integer(1), index.getValue());
Assert.assertNotNull(inStream.getValue());
Assert.assertTrue(inStreamgetValue() instanceof BufferedInputStream);
Assert.assertEquals(new Integer(50), length.getValue());
return null;
}
});
expect(stmt.execute()).andReturn(true);
replay(stmt);
JdbcConnection connection = createMock(JdbcConnection.class);
expect(connection.prepareStatement("INSERT INTO schema.table(null) VALUES(?)")).andReturn(stmt);
replay(connection);
statement.execute(new PreparedStatementFactory(connection));
}
// protected void assertSetBinaryStream(List<ColumnConfig> columns, ChangeSet changeSet)
// throws SQLException, DatabaseException {
//
// InsertExecutablePreparedStatement statement =
// new InsertExecutablePreparedStatement(
// new MockDatabase(), "catalog", "schema", "table", columns, changeSet, createResourceAccessor());
//
// PreparedStatement stmt = createMock(PreparedStatement.class);
//
// final Capture<Integer> index = new Capture<Integer>();
// final Capture<InputStream> inStream = new Capture<InputStream>();
// final Capture<Integer> length = new Capture<Integer>();
// stmt.setBinaryStream(capture(index), capture(inStream), capture(length));
// expectLastCall().andAnswer(new IAnswer<Object>() {
// @Override
// public Object answer() throws Throwable {
// Assert.assertEquals(new Integer(1), index.getValue());
// Assert.assertNotNull(inStream.getValue());
// Assert.assertTrue(inStreamgetValue() instanceof BufferedInputStream);
// Assert.assertEquals(new Integer(50), length.getValue());
// return null;
// }
// });
// expect(stmt.execute()).andReturn(true);
// replay(stmt);
//
// JdbcConnection connection = createMock(JdbcConnection.class);
// expect(connection.prepareStatement("INSERT INTO schema.table(null) VALUES(?)")).andReturn(stmt);
// replay(connection);
//
// statement.execute(new PreparedStatementFactory(connection));
// }
@Ignore
def testValueClobFileFromClassLoader() throws DatabaseException, SQLException {
@@ -141,39 +135,39 @@ public class ExecutablePreparedStatementTest extends Specification {
assertSetCharacterStream(columns, changeSet);
}
protected void assertSetCharacterStream(List<ColumnConfig> columns, ChangeSet changeSet)
throws SQLException, DatabaseException {
InsertExecutablePreparedStatement statement =
new InsertExecutablePreparedStatement(
new MockDatabase(),
"catalog", "schema", "table", columns, changeSet, createResourceAccessor());
PreparedStatement stmt = createMock(PreparedStatement.class);
final Capture<Integer> index = new Capture<Integer>();
final Capture<Reader> reader = new Capture<Reader>();
final Capture<Integer> length = new Capture<Integer>();
stmt.setCharacterStream(capture(index), capture(reader), capture(length));
expectLastCall().andAnswer(new IAnswer<Object>() {
@Override
public Object answer() throws Throwable {
Assert.assertEquals(new Integer(1), index.getValue());
Assert.assertNotNull(reader.getValue());
Assert.assertTrue(reader.getValue() instanceof BufferedReader);
Assert.assertEquals(new Integer(39), length.getValue());
return null;
}
});
expect(stmt.execute()).andReturn(true);
replay(stmt);
JdbcConnection connection = createMock(JdbcConnection.class);
expect(connection.prepareStatement("INSERT INTO schema.table(null) VALUES(?)")).andReturn(stmt);
replay(connection);
statement.execute(new PreparedStatementFactory(connection));
}
// protected void assertSetCharacterStream(List<ColumnConfig> columns, ChangeSet changeSet)
// throws SQLException, DatabaseException {
//
// InsertExecutablePreparedStatement statement =
// new InsertExecutablePreparedStatement(
// new MockDatabase(),
// "catalog", "schema", "table", columns, changeSet, createResourceAccessor());
//
// PreparedStatement stmt = createMock(PreparedStatement.class);
//
// final Capture<Integer> index = new Capture<Integer>();
// final Capture<Reader> reader = new Capture<Reader>();
// final Capture<Integer> length = new Capture<Integer>();
// stmt.setCharacterStream(capture(index), capture(reader), capture(length));
// expectLastCall().andAnswer(new IAnswer<Object>() {
// @Override
// public Object answer() throws Throwable {
// Assert.assertEquals(new Integer(1), index.getValue());
// Assert.assertNotNull(reader.getValue());
// Assert.assertTrue(reader.getValue() instanceof BufferedReader);
// Assert.assertEquals(new Integer(39), length.getValue());
// return null;
// }
// });
// expect(stmt.execute()).andReturn(true);
// replay(stmt);
//
// JdbcConnection connection = createMock(JdbcConnection.class);
// expect(connection.prepareStatement("INSERT INTO schema.table(null) VALUES(?)")).andReturn(stmt);
// replay(connection);
//
// statement.execute(new PreparedStatementFactory(connection));
// }
/**
* Create a test context resource accessor.
Oops, something went wrong.

0 comments on commit bf9faf4

Please sign in to comment.