当前位置: 首页>>代码示例>>Java>>正文


Java MockResultSet.addRow方法代码示例

本文整理汇总了Java中com.mockrunner.mock.jdbc.MockResultSet.addRow方法的典型用法代码示例。如果您正苦于以下问题:Java MockResultSet.addRow方法的具体用法?Java MockResultSet.addRow怎么用?Java MockResultSet.addRow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.mockrunner.mock.jdbc.MockResultSet的用法示例。


在下文中一共展示了MockResultSet.addRow方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testVerifyPatchesTable

import com.mockrunner.mock.jdbc.MockResultSet; //导入方法依赖的package包/类
/**
 * Validates that the system recognizes an existing patches table.
 * 
 * @throws Exception if an unexpected error occurs
 */
public void testVerifyPatchesTable() throws Exception
{
    // Test-specific setup
    handler = conn.getPreparedStatementResultSetHandler();
    MockResultSet rs = handler.createResultSet();
    
    MockDatabaseMetaData mdmd = (MockDatabaseMetaData) conn.getMetaData();
    MockResultSet mrs = handler.createResultSet();
    mrs.addRow(new String[]{"", "", "", "system_name"});
    mrs.addRow(new String[]{"", "", "", "patch_level"});
    mdmd.setPrimaryKeys(mrs);
    handler.prepareGlobalResultSet(rs);
    rs.addRow(new Integer[] {new Integer(13)});
    
    table.createPatchStoreIfNeeded();
    
    commonVerifications();
    verifyNotCommitted();
    verifyPreparedStatementParameter(0, 1, "milestone");
    verifyPreparedStatementNotPresent(table.getSql("patches.upgrade"));
    verifyPreparedStatementNotPresent(table.getSql("patches.create"));
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:28,代码来源:PatchTableTest.java

示例2: testVerifyAndUpgradePatchesTable

import com.mockrunner.mock.jdbc.MockResultSet; //导入方法依赖的package包/类
/**
 * Validates that the system recognizes an existing patches table.
 * 
 * @throws Exception if an unexpected error occurs
 */
public void testVerifyAndUpgradePatchesTable() throws Exception
{
    // Test-specific setup
    handler = conn.getPreparedStatementResultSetHandler();
    MockResultSet rs = handler.createResultSet();
    
    MockDatabaseMetaData mdmd = (MockDatabaseMetaData) conn.getMetaData();
    MockResultSet mrs = handler.createResultSet();
    mrs.addRow(new String[]{"", "", "", "system_name"});
    mdmd.setPrimaryKeys(mrs);
    handler.prepareGlobalResultSet(rs);
    rs.addRow(new Integer[] {new Integer(13)});
    
    table.createPatchStoreIfNeeded();
    
    commonVerifications();
    verifyCommitted();
    verifyPreparedStatementParameter(0, 1, "milestone");
    verifyPreparedStatementPresent(table.getSql("patches.upgrade"));
    verifyPreparedStatementNotPresent(table.getSql("patches.create"));
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:27,代码来源:PatchTableTest.java

示例3: testGetPatchLevel

import com.mockrunner.mock.jdbc.MockResultSet; //导入方法依赖的package包/类
/**
 * Validates that <code>getPatchLevel</code> works on an existing system.
 * 
 * @throws Exception if an unexpected error occurs
 */
public void testGetPatchLevel() throws Exception
{
    // Test-specific setup
    handler = conn.getPreparedStatementResultSetHandler();
    
    MockDatabaseMetaData mdmd = (MockDatabaseMetaData) conn.getMetaData();
    MockResultSet mrs = handler.createResultSet();
    mrs.addRow(new String[]{"", "", "", "system_name"});
    mrs.addRow(new String[]{"", "", "", "patch_level"});
    mdmd.setPrimaryKeys(mrs);
    
    MockResultSet rs = handler.createResultSet();
    rs.addRow(new Integer[]{new Integer(13)});
    handler.prepareGlobalResultSet(rs);

    int i = table.getPatchLevel();

    assertEquals(13, i);
    commonVerifications();
    verifyNotCommitted();
    verifyPreparedStatementParameter(1, 1, "milestone");
    verifyPreparedStatementNotPresent(table.getSql("patches.upgrade"));
    verifyPreparedStatementNotPresent(table.getSql("level.create"));
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:30,代码来源:PatchTableTest.java

示例4: testUpdatePatchLevel

import com.mockrunner.mock.jdbc.MockResultSet; //导入方法依赖的package包/类
/**
 * Validates that the patch level can be updated.
 *  
 * @throws Exception if an unexpected error occurs
 */
public void testUpdatePatchLevel() throws Exception
{
    handler = conn.getPreparedStatementResultSetHandler();
    
    MockDatabaseMetaData mdmd = (MockDatabaseMetaData) conn.getMetaData();
    MockResultSet mrs = handler.createResultSet();
    mrs.addRow(new String[]{"", "", "", "system_name"});
    mrs.addRow(new String[]{"", "", "", "patch_level"});
    mdmd.setPrimaryKeys(mrs);
    
    MockResultSet rs = handler.createResultSet();
    rs.addRow(new Integer[]{new Integer(12)});
    handler.prepareResultSet(table.getSql("level.read"), rs, new String[]{"milestone"});

    table.updatePatchLevel(13);
    
    verifyPreparedStatementParameter(table.getSql("level.update"), 1, new Integer(13));
    verifyPreparedStatementParameter(table.getSql("level.update"), 2, "milestone");
    commonVerifications();
    verifyCommitted();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:27,代码来源:PatchTableTest.java

示例5: testIsPatchTableNotLocked

import com.mockrunner.mock.jdbc.MockResultSet; //导入方法依赖的package包/类
/**
 * Validates that <code>isPatchTableLocked</code> works when no lock exists.
 * 
 * @throws Exception if an unexpected error occurs
 */
public void testIsPatchTableNotLocked() throws Exception
{
    // Test-specific setup
    // Return a non-empty set in response to the patch lock query
    handler = conn.getPreparedStatementResultSetHandler();
    
    MockDatabaseMetaData mdmd = (MockDatabaseMetaData) conn.getMetaData();
    MockResultSet mrs = handler.createResultSet();
    mrs.addRow(new String[]{"", "", "", "system_name"});
    mrs.addRow(new String[]{"", "", "", "patch_level"});
    mdmd.setPrimaryKeys(mrs);
    
    MockResultSet rs = handler.createResultSet();
    rs.addRow(new String[]{"F"});
    handler.prepareResultSet(table.getSql("lock.read"), rs, new String[]{"milestone", "milestone"});
    
    assertFalse(table.isPatchStoreLocked());
    commonVerifications();
    verifyNotCommitted();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:26,代码来源:PatchTableTest.java

示例6: testIsPatchTableLocked

import com.mockrunner.mock.jdbc.MockResultSet; //导入方法依赖的package包/类
/**
 * Validates that <code>isPatchTableLocked</code> works when a lock already exists.
 * 
 * @throws Exception if an unexpected error occurs
 */
public void testIsPatchTableLocked() throws Exception
{
    // Test-specific setup
    // Return a non-empty set in response to the patch lock query
    handler = conn.getPreparedStatementResultSetHandler();
    
    MockDatabaseMetaData mdmd = (MockDatabaseMetaData) conn.getMetaData();
    MockResultSet mrs = handler.createResultSet();
    mrs.addRow(new String[]{"", "", "", "system_name"});
    mrs.addRow(new String[]{"", "", "", "patch_level"});
    mdmd.setPrimaryKeys(mrs);
    
    MockResultSet rs = handler.createResultSet();
    rs.addRow(new String[]{"T"});
    handler.prepareResultSet(table.getSql("lock.read"), rs, new String[]{"milestone", "milestone"});
    
    assertTrue(table.isPatchStoreLocked());
    commonVerifications();
    verifyNotCommitted();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:26,代码来源:PatchTableTest.java

示例7: testLockPatchTableWhenNotAlreadyLocked

import com.mockrunner.mock.jdbc.MockResultSet; //导入方法依赖的package包/类
/**
 * Validates that the patches table can be locked as long as no other lock
 * is in place.
 * 
 * @throws Exception if an unexpected error occurs
 */
public void testLockPatchTableWhenNotAlreadyLocked() throws Exception
{
    // Test-specific setup
    // Return an empty set in response to the patch lock query
    handler = conn.getPreparedStatementResultSetHandler();
    
    MockDatabaseMetaData mdmd = (MockDatabaseMetaData) conn.getMetaData();
    MockResultSet mrs = handler.createResultSet();
    mrs.addRow(new String[]{"", "", "", "system_name"});
    mrs.addRow(new String[]{"", "", "", "patch_level"});
    mdmd.setPrimaryKeys(mrs);
    
    MockResultSet rs = handler.createResultSet();
    handler.prepareUpdateCount(table.getSql("lock.obtain"), 1, new String[] {"milestone", "milestone"});
    
    table.lockPatchStore();
    verifyPreparedStatementParameter(table.getSql("lock.obtain"), 1, "milestone");
    verifyPreparedStatementParameter(table.getSql("lock.obtain"), 2, "milestone");
    commonVerifications();
    verifyCommitted();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:28,代码来源:PatchTableTest.java

示例8: testPatchRetrievesSetWithPatchesApplied

import com.mockrunner.mock.jdbc.MockResultSet; //导入方法依赖的package包/类
public void testPatchRetrievesSetWithPatchesApplied () throws SQLException, MigrationException {
    
    handler = conn.getPreparedStatementResultSetHandler();
    
	MockDatabaseMetaData mdmd = (MockDatabaseMetaData) conn.getMetaData();
    MockResultSet mrs = handler.createResultSet();
    mrs.addRow(new String[]{"", "", "", "system_name"});
    mrs.addRow(new String[]{"", "", "", "patch_level"});
    mdmd.setPrimaryKeys(mrs);
    
    MockResultSet rs = handler.createResultSet();
    rs.addColumn("patch_level", new Object[]{1, 2});
    handler.prepareGlobalResultSet(rs);

    Set<Integer> expected = new HashSet<Integer>();
    expected.add(1);
    expected.add(2);
    assertEquals(expected, table.getPatchesApplied());
    commonVerifications();
    verifyPreparedStatementPresent(table.getSql("patches.all"));
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:PatchTableTest.java

示例9: testLockPatchTableWhenAlreadyLocked

import com.mockrunner.mock.jdbc.MockResultSet; //导入方法依赖的package包/类
/**
 * Validates that an <code>IllegalStateException</code> is thrown when trying
 * to lock an already locked patches table.
 * 
 * @throws Exception if an unexpected error occurs
 */
public void testLockPatchTableWhenAlreadyLocked() throws Exception
{
    // Test-specific setup
    // Return a non-empty set in response to the patch lock query
    handler = conn.getPreparedStatementResultSetHandler();
    
    MockDatabaseMetaData mdmd = (MockDatabaseMetaData) conn.getMetaData();
    MockResultSet mrs = handler.createResultSet();
    mrs.addRow(new String[]{"", "", "", "system_name"});
    mrs.addRow(new String[]{"", "", "", "patch_level"});
    mdmd.setPrimaryKeys(mrs);
    
    handler.prepareUpdateCount(table.getSql("lock.obtain"), 0, new String[] {"milestone", "milestone"});
    
    try
    {
        table.lockPatchStore();
        fail("Expected an IllegalStateException since a lock already exists.");
    }
    catch (IllegalStateException e)
    {
        // Expected
    }
    
    verifyPreparedStatementParameter(table.getSql("lock.obtain"), 1, "milestone");
    verifyPreparedStatementParameter(table.getSql("lock.obtain"), 2, "milestone");
    commonVerifications();
    verifyCommitted();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:36,代码来源:PatchTableTest.java

示例10: testIsPatchApplied

import com.mockrunner.mock.jdbc.MockResultSet; //导入方法依赖的package包/类
public void testIsPatchApplied() throws MigrationException
{
    handler = conn.getPreparedStatementResultSetHandler();
    MockResultSet rs = handler.createResultSet();
    rs.addRow(new Integer[]{new Integer(3)});
    handler.prepareGlobalResultSet(rs);

    assertEquals(true, table.isPatchApplied(3));
    commonVerifications();
    verifyPreparedStatementPresent(table.getSql("level.exists"));

}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:13,代码来源:PatchTableTest.java

示例11: createMockConnection

import com.mockrunner.mock.jdbc.MockResultSet; //导入方法依赖的package包/类
protected MockConnection createMockConnection() {
  // this query must be the same as the query in TestMapper.xml
  MockResultSet rs = new MockResultSet("SELECT 1");
  rs.addRow(new Object[] { 1 });

  MockConnection con = new MockConnection();
  con.getPreparedStatementResultSetHandler().prepareResultSet("SELECT 1", rs);

  return con;
}
 
开发者ID:lindzh,项目名称:mybatis-spring-1.2.2,代码行数:11,代码来源:AbstractMyBatisSpringTest.java

示例12: prepareResultsetReturningLong

import com.mockrunner.mock.jdbc.MockResultSet; //导入方法依赖的package包/类
private void prepareResultsetReturningLong() {
    MockConnection connection = getJDBCMockObjectFactory().getMockConnection();
    PreparedStatementResultSetHandler statementHandler = connection.getPreparedStatementResultSetHandler();
    MockResultSet keysResult = statementHandler.createResultSet();
    keysResult.addColumn("id");
    keysResult.addRow(new Object[] {Long.valueOf(11L)});
    
    statementHandler.prepareGeneratedKeys("insert", keysResult);
}
 
开发者ID:nortal,项目名称:petit,代码行数:10,代码来源:GeneratedKeysTest.java

示例13: prepareResultsetReturningBigDecimal

import com.mockrunner.mock.jdbc.MockResultSet; //导入方法依赖的package包/类
private void prepareResultsetReturningBigDecimal() {
    MockConnection connection = getJDBCMockObjectFactory().getMockConnection();
    PreparedStatementResultSetHandler statementHandler = connection.getPreparedStatementResultSetHandler();
    MockResultSet keysResult = statementHandler.createResultSet();
    keysResult.addColumn("id");
    keysResult.addRow(new Object[] {BigDecimal.valueOf(11L)});
    
    statementHandler.prepareGeneratedKeys("insert", keysResult);
}
 
开发者ID:nortal,项目名称:petit,代码行数:10,代码来源:GeneratedKeysTest.java

示例14: prepareResultsetReturningString

import com.mockrunner.mock.jdbc.MockResultSet; //导入方法依赖的package包/类
private void prepareResultsetReturningString() {
    MockConnection connection = getJDBCMockObjectFactory().getMockConnection();
    PreparedStatementResultSetHandler statementHandler = connection.getPreparedStatementResultSetHandler();
    MockResultSet keysResult = statementHandler.createResultSet();
    keysResult.addColumn("kood");
    keysResult.addRow(new Object[] {"1234"});
    
    statementHandler.prepareGeneratedKeys("insert", keysResult);
}
 
开发者ID:nortal,项目名称:petit,代码行数:10,代码来源:GeneratedKeysTest.java

示例15: prepareResultsetReturningMultipleKeys

import com.mockrunner.mock.jdbc.MockResultSet; //导入方法依赖的package包/类
private void prepareResultsetReturningMultipleKeys() {
       MockConnection connection = getJDBCMockObjectFactory().getMockConnection();
       PreparedStatementResultSetHandler statementHandler = connection.getPreparedStatementResultSetHandler();
       MockResultSet keysResult = statementHandler.createResultSet();
       keysResult.addColumn("id");
       keysResult.addRow(new Object[] {BigDecimal.valueOf(11L)});
       keysResult.addRow(new Object[] {BigDecimal.valueOf(12L)});
       keysResult.addRow(new Object[] {BigDecimal.valueOf(13L)});
       
       statementHandler.prepareGeneratedKeys("insert", keysResult);
}
 
开发者ID:nortal,项目名称:petit,代码行数:12,代码来源:InsertStatementInterceptorTest.java


注:本文中的com.mockrunner.mock.jdbc.MockResultSet.addRow方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。