Exemplo n.º 1
0
 @Test
 public void testPropertiesOverride() throws Exception {
   ConnectionImpl conn = Mockito.mock(ConnectionImpl.class);
   Properties p = new Properties();
   p.setProperty(ExecutionProperties.ANSI_QUOTED_IDENTIFIERS, Boolean.TRUE.toString());
   Mockito.stub(conn.getExecutionProperties()).toReturn(p);
   StatementImpl statement =
       new StatementImpl(conn, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
   assertEquals(
       Boolean.TRUE.toString(),
       statement.getExecutionProperty(ExecutionProperties.ANSI_QUOTED_IDENTIFIERS));
   statement.setExecutionProperty(
       ExecutionProperties.ANSI_QUOTED_IDENTIFIERS, Boolean.FALSE.toString());
   assertEquals(
       Boolean.FALSE.toString(),
       statement.getExecutionProperty(ExecutionProperties.ANSI_QUOTED_IDENTIFIERS));
   assertEquals(
       Boolean.TRUE.toString(), p.getProperty(ExecutionProperties.ANSI_QUOTED_IDENTIFIERS));
 }
Exemplo n.º 2
0
  @Test
  public void testUseJDBC4ColumnNameAndLabelSemantics() throws Exception {
    ConnectionImpl conn = Mockito.mock(ConnectionImpl.class);
    Properties p = new Properties();
    p.setProperty(ExecutionProperties.JDBC4COLUMNNAMEANDLABELSEMANTICS, "false");

    Mockito.stub(conn.getExecutionProperties()).toReturn(p);
    StatementImpl statement =
        new StatementImpl(conn, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
    assertEquals(
        Boolean.FALSE.toString(),
        statement.getExecutionProperty(ExecutionProperties.JDBC4COLUMNNAMEANDLABELSEMANTICS));
  }