ibatis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cbe...@apache.org
Subject svn commit: r726386 - in /ibatis/trunk/java/ibatis-3/ibatis-3-core/src: main/java/org/apache/ibatis/api/defaults/DefaultSqlSession.java test/java/org/apache/ibatis/api/SqlSessionTest.java test/java/org/apache/ibatis/parser/AuthorMapper.xml
Date Sun, 14 Dec 2008 07:29:15 GMT
Author: cbegin
Date: Sat Dec 13 23:29:14 2008
New Revision: 726386

URL: http://svn.apache.org/viewvc?rev=726386&view=rev
Log:
Added insert statement test

Modified:
    ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/api/defaults/DefaultSqlSession.java
    ibatis/trunk/java/ibatis-3/ibatis-3-core/src/test/java/org/apache/ibatis/api/SqlSessionTest.java
    ibatis/trunk/java/ibatis-3/ibatis-3-core/src/test/java/org/apache/ibatis/parser/AuthorMapper.xml

Modified: ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/api/defaults/DefaultSqlSession.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/api/defaults/DefaultSqlSession.java?rev=726386&r1=726385&r2=726386&view=diff
==============================================================================
--- ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/api/defaults/DefaultSqlSession.java
(original)
+++ ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/api/defaults/DefaultSqlSession.java
Sat Dec 13 23:29:14 2008
@@ -65,7 +65,7 @@
 
   public Object insert(String statement, Object parameter) {
     //TODO: Return selectKey or autogen key.
-    return update(statement,null);
+    return update(statement, parameter);
   }
 
   public int update(String statement) {
@@ -88,7 +88,7 @@
   }
 
   public int delete(String statement, Object parameter) {
-    return update(statement,null);
+    return update(statement,parameter);
   }
 
   public void commit() {

Modified: ibatis/trunk/java/ibatis-3/ibatis-3-core/src/test/java/org/apache/ibatis/api/SqlSessionTest.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/ibatis-3/ibatis-3-core/src/test/java/org/apache/ibatis/api/SqlSessionTest.java?rev=726386&r1=726385&r2=726386&view=diff
==============================================================================
--- ibatis/trunk/java/ibatis-3/ibatis-3-core/src/test/java/org/apache/ibatis/api/SqlSessionTest.java
(original)
+++ ibatis/trunk/java/ibatis-3/ibatis-3-core/src/test/java/org/apache/ibatis/api/SqlSessionTest.java
Sat Dec 13 23:29:14 2008
@@ -56,4 +56,21 @@
     }
   }
 
+  @Test
+  public void shouldInsertAuthor() throws Exception {
+    SqlSession session = sqlMapper.openSession();
+    try {
+      Author expected = new Author(500, "cbegin", "******", "cbegin@somewhere.com", "Something...",
null);
+      session.insert("com.domain.AuthorMapper.insertAuthor", expected);
+      Author actual = (Author) session.selectOne("com.domain.AuthorMapper.selectAuthor",
new Author(500));
+      Assert.assertEquals(expected.getId(), actual.getId());
+      Assert.assertEquals(expected.getUsername(), actual.getUsername());
+      Assert.assertEquals(expected.getPassword(), actual.getPassword());
+      Assert.assertEquals(expected.getEmail(), actual.getEmail());
+      Assert.assertEquals(expected.getBio(), actual.getBio());
+    } finally {
+      session.close();
+    }
+  }
+
 }

Modified: ibatis/trunk/java/ibatis-3/ibatis-3-core/src/test/java/org/apache/ibatis/parser/AuthorMapper.xml
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/ibatis-3/ibatis-3-core/src/test/java/org/apache/ibatis/parser/AuthorMapper.xml?rev=726386&r1=726385&r2=726386&view=diff
==============================================================================
--- ibatis/trunk/java/ibatis-3/ibatis-3-core/src/test/java/org/apache/ibatis/parser/AuthorMapper.xml
(original)
+++ ibatis/trunk/java/ibatis-3/ibatis-3-core/src/test/java/org/apache/ibatis/parser/AuthorMapper.xml
Sat Dec 13 23:29:14 2008
@@ -22,4 +22,9 @@
     select * from author where id = #{id}
   </select>
 
+  <insert id="insertAuthor" parameterType="domain.blog.Author">
+    insert into Author (id,username,password,email,bio)
+    values (#{id},#{username},#{password},#{email},#{bio})
+  </insert>
+
 </mapper>
\ No newline at end of file



Mime
View raw message