Skip to content

Commit e8a0ef0

Browse files
committed
Polishing
1 parent cc06183 commit e8a0ef0

File tree

5 files changed

+53
-21
lines changed

5 files changed

+53
-21
lines changed

spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/SimpleJdbcCall.java

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,19 @@
3939
* the JDBC driver. Since we rely on the JDBC driver, this "auto-detection"
4040
* can only be used for databases that are known to provide accurate meta data.
4141
* These currently include Derby, MySQL, Microsoft SQL Server, Oracle, DB2,
42-
* Sybase and PostgreSQL. For any other databases you are required to declare all
43-
* parameters explicitly. You can of course declare all parameters explicitly even
44-
* if the database provides the necessary meta data. In that case your declared
45-
* parameters will take precedence. You can also turn off any meta data processing
46-
* if you want to use parameter names that do not match what is declared during
47-
* the stored procedure compilation.
42+
* Sybase and PostgreSQL. For any other databases you are required to declare
43+
* all parameters explicitly. You can of course declare all parameters
44+
* explicitly even if the database provides the necessary meta data. In that
45+
* case your declared parameters will take precedence. You can also turn off
46+
* any metadata processing if you want to use parameter names that do not
47+
* match what is declared during the stored procedure compilation.
4848
*
4949
* <p>The actual insert is being handled using Spring's
5050
* {@link org.springframework.jdbc.core.JdbcTemplate}.
5151
*
52-
* <p>Many of the configuration methods return the current instance of the SimpleJdbcCall
53-
* to provide the ability to chain multiple ones together in a "fluent" interface style.
52+
* <p>Many of the configuration methods return the current instance of the
53+
* SimpleJdbcCall in order to provide the ability to chain multiple ones
54+
* together in a "fluent" interface style.
5455
*
5556
* @author Thomas Risberg
5657
* @author Stephane Nicoll
@@ -61,8 +62,8 @@
6162
public class SimpleJdbcCall extends AbstractJdbcCall implements SimpleJdbcCallOperations {
6263

6364
/**
64-
* Constructor that takes one parameter with the JDBC DataSource to use when creating the
65-
* JdbcTemplate.
65+
* Constructor that takes one parameter with the JDBC DataSource to use when
66+
* creating the underlying JdbcTemplate.
6667
* @param dataSource the {@code DataSource} to use
6768
* @see org.springframework.jdbc.core.JdbcTemplate#setDataSource
6869
*/

spring-jdbc/src/test/java/org/springframework/jdbc/core/simple/CallMetaDataContextTests.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Copyright 2002-2015 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
package org.springframework.jdbc.core.simple;
218

319
import java.sql.Connection;
@@ -29,11 +45,14 @@
2945
public class CallMetaDataContextTests {
3046

3147
private DataSource dataSource;
48+
3249
private Connection connection;
50+
3351
private DatabaseMetaData databaseMetaData;
3452

3553
private CallMetaDataContext context = new CallMetaDataContext();
3654

55+
3756
@Before
3857
public void setUp() throws Exception {
3958
connection = mock(Connection.class);
@@ -48,6 +67,7 @@ public void verifyClosed() throws Exception {
4867
verify(connection).close();
4968
}
5069

70+
5171
@Test
5272
public void testMatchParameterValuesAndSqlInOutParameters() throws Exception {
5373
final String TABLE = "customers";

spring-jdbc/src/test/java/org/springframework/jdbc/core/simple/SimpleJdbcCallTests.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,18 @@
4949
*/
5050
public class SimpleJdbcCallTests {
5151

52-
@Rule
53-
public ExpectedException thrown = ExpectedException.none();
54-
5552
private Connection connection;
53+
5654
private DatabaseMetaData databaseMetaData;
55+
5756
private DataSource dataSource;
57+
5858
private CallableStatement callableStatement;
5959

60+
@Rule
61+
public ExpectedException thrown = ExpectedException.none();
62+
63+
6064
@Before
6165
public void setUp() throws Exception {
6266
connection = mock(Connection.class);
@@ -67,6 +71,7 @@ public void setUp() throws Exception {
6771
given(dataSource.getConnection()).willReturn(connection);
6872
}
6973

74+
7075
@Test
7176
public void testNoSuchStoredProcedure() throws Exception {
7277
final String NO_SUCH_PROC = "x";

spring-jdbc/src/test/java/org/springframework/jdbc/core/simple/SimpleJdbcInsertTests.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 the original author or authors.
2+
* Copyright 2002-2015 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -39,13 +39,16 @@
3939
*/
4040
public class SimpleJdbcInsertTests {
4141

42-
@Rule
43-
public ExpectedException thrown = ExpectedException.none();
44-
4542
private Connection connection;
43+
4644
private DatabaseMetaData databaseMetaData;
45+
4746
private DataSource dataSource;
4847

48+
@Rule
49+
public ExpectedException thrown = ExpectedException.none();
50+
51+
4952
@Before
5053
public void setUp() throws Exception {
5154
connection = mock(Connection.class);
@@ -60,6 +63,7 @@ public void verifyClosed() throws Exception {
6063
verify(connection).close();
6164
}
6265

66+
6367
@Test
6468
public void testNoSuchTable() throws Exception {
6569
ResultSet resultSet = mock(ResultSet.class);
@@ -81,4 +85,5 @@ public void testNoSuchTable() throws Exception {
8185
verify(resultSet).close();
8286
}
8387
}
88+
8489
}

spring-jdbc/src/test/java/org/springframework/jdbc/core/simple/TableMetaDataContextTests.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 the original author or authors.
2+
* Copyright 2002-2015 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -43,11 +43,14 @@
4343
public class TableMetaDataContextTests {
4444

4545
private Connection connection;
46+
4647
private DataSource dataSource;
48+
4749
private DatabaseMetaData databaseMetaData;
4850

4951
private TableMetaDataContext context = new TableMetaDataContext();
5052

53+
5154
@Before
5255
public void setUp() throws Exception {
5356
connection = mock(Connection.class);
@@ -57,9 +60,6 @@ public void setUp() throws Exception {
5760
given(dataSource.getConnection()).willReturn(connection);
5861
}
5962

60-
public void verifyClosed() throws Exception {
61-
verify(connection).close();
62-
}
6363

6464
@Test
6565
public void testMatchInParametersAndSqlTypeInfoWrapping() throws Exception {
@@ -153,4 +153,5 @@ public void testTableWithSingleColumnGeneratedKey() throws Exception {
153153
verify(metaDataResultSet).close();
154154
verify(columnsResultSet).close();
155155
}
156+
156157
}

0 commit comments

Comments
 (0)