• R/O
  • SSH
  • HTTPS

amateras: Commit


Commit MetaInfo

Revisión701 (tree)
Tiempo2012-04-26 12:03:41
Autortakezoe

Log Message

ResultEntityCreator is renamed to EntityOperator.

Cambiar Resumen

Diferencia incremental

--- mirage/trunk/mirage/src/test/java/jp/sf/amateras/mirage/DefaultResultEntityCreatorTest.java (revision 700)
+++ mirage/trunk/mirage/src/test/java/jp/sf/amateras/mirage/DefaultResultEntityCreatorTest.java (nonexistent)
@@ -1,154 +0,0 @@
1-package jp.sf.amateras.mirage;
2-
3-import static org.mockito.Mockito.*;
4-
5-import java.sql.ResultSet;
6-import java.sql.ResultSetMetaData;
7-import java.sql.SQLException;
8-import java.util.ArrayList;
9-import java.util.List;
10-
11-import jp.sf.amateras.mirage.annotation.PrimaryKey;
12-import jp.sf.amateras.mirage.annotation.PrimaryKey.GenerationType;
13-import jp.sf.amateras.mirage.bean.BeanDesc;
14-import jp.sf.amateras.mirage.dialect.Dialect;
15-import jp.sf.amateras.mirage.naming.NameConverter;
16-import jp.sf.amateras.mirage.type.BigDecimalValueType;
17-import jp.sf.amateras.mirage.type.BooleanPrimitiveValueType;
18-import jp.sf.amateras.mirage.type.BooleanValueType;
19-import jp.sf.amateras.mirage.type.ByteArrayValueType;
20-import jp.sf.amateras.mirage.type.DoublePrimitiveValueType;
21-import jp.sf.amateras.mirage.type.DoubleValueType;
22-import jp.sf.amateras.mirage.type.FloatPrimitiveValueType;
23-import jp.sf.amateras.mirage.type.FloatValueType;
24-import jp.sf.amateras.mirage.type.IntegerPrimitiveValueType;
25-import jp.sf.amateras.mirage.type.IntegerValueType;
26-import jp.sf.amateras.mirage.type.LongPrimitiveValueType;
27-import jp.sf.amateras.mirage.type.LongValueType;
28-import jp.sf.amateras.mirage.type.ShortPrimitiveValueType;
29-import jp.sf.amateras.mirage.type.ShortValueType;
30-import jp.sf.amateras.mirage.type.SqlDateValueType;
31-import jp.sf.amateras.mirage.type.StringValueType;
32-import jp.sf.amateras.mirage.type.TimeValueType;
33-import jp.sf.amateras.mirage.type.TimestampValueType;
34-import jp.sf.amateras.mirage.type.UtilDateValueType;
35-import jp.sf.amateras.mirage.type.ValueType;
36-import junit.framework.TestCase;
37-
38-
39-public class DefaultResultEntityCreatorTest extends TestCase {
40-
41- DefaultResultEntityCreator ec = new DefaultResultEntityCreator();
42-
43- public void testDefaultResultEntityCreator() throws SQLException {
44- ResultSet rs = mock(ResultSet.class);
45- ResultSetMetaData meta = mock(ResultSetMetaData.class);
46- BeanDesc beanDesc = mock(BeanDesc.class);
47- Dialect dialect = mock(Dialect.class);
48- NameConverter nc = mock(NameConverter.class);
49-
50- // Although UserInfo doesn't have public no-args constructor,
51- // DefaultResultEntityCreator can create UserInfo instance
52- UserInfo userInfo = ec.createEntity(UserInfo.class, rs, meta, 0,
53- beanDesc, dialect, getDefaultValueTypes(), nc);
54-
55- assertNotNull(userInfo);
56- }
57-
58- private List<ValueType<?>> getDefaultValueTypes(){
59- List<ValueType<?>> valueTypes = new ArrayList<ValueType<?>>();
60- valueTypes.add(new StringValueType());
61- valueTypes.add(new IntegerValueType());
62- valueTypes.add(new IntegerPrimitiveValueType());
63- valueTypes.add(new LongValueType());
64- valueTypes.add(new LongPrimitiveValueType());
65- valueTypes.add(new ShortValueType());
66- valueTypes.add(new ShortPrimitiveValueType());
67- valueTypes.add(new DoubleValueType());
68- valueTypes.add(new DoublePrimitiveValueType());
69- valueTypes.add(new FloatValueType());
70- valueTypes.add(new FloatPrimitiveValueType());
71- valueTypes.add(new BooleanValueType());
72- valueTypes.add(new BooleanPrimitiveValueType());
73- valueTypes.add(new BigDecimalValueType());
74- valueTypes.add(new SqlDateValueType());
75- valueTypes.add(new UtilDateValueType());
76- valueTypes.add(new TimeValueType());
77- valueTypes.add(new TimestampValueType());
78- valueTypes.add(new ByteArrayValueType());
79- return valueTypes;
80- }
81-
82- public static class UserInfo {
83-
84- @PrimaryKey(generationType=GenerationType.IDENTITY)
85- private int userId;
86-
87- private String userName;
88-
89- public UserInfo(int userId, String userName) {
90- this.userId = userId;
91- this.userName = userName;
92- }
93-
94- @SuppressWarnings("unused") // for reflective access
95- private UserInfo() {
96- }
97-
98- public int getUserId() {
99- return userId;
100- }
101-
102- public void setUserId(int userId) {
103- this.userId = userId;
104- }
105-
106- public String getUserName() {
107- return userName;
108- }
109-
110- public void setUserName(String userName) {
111- this.userName = userName;
112- }
113-
114- @Override
115- public String toString() {
116- return userId + " " + userName;
117- }
118- }
119-
120-
121-// public static class UserInfo2 {
122-//
123-// @PrimaryKey(generationType=GenerationType.IDENTITY)
124-// private int userId;
125-//
126-// private String userName;
127-//
128-// public UserInfo2(int userId, String userName) {
129-// this.userId = userId;
130-// this.userName = userName;
131-// }
132-//
133-// public int getUserId() {
134-// return userId;
135-// }
136-//
137-// public void setUserId(int userId) {
138-// this.userId = userId;
139-// }
140-//
141-// public String getUserName() {
142-// return userName;
143-// }
144-//
145-// public void setUserName(String userName) {
146-// this.userName = userName;
147-// }
148-//
149-// @Override
150-// public String toString() {
151-// return userId + " " + userName;
152-// }
153-// }
154-}
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Date Revision Author HeadURL Id
\ No newline at end of property
Deleted: svn:mime-type
## -1 +0,0 ##
-text/plain
\ No newline at end of property
--- mirage/trunk/mirage/src/test/java/jp/sf/amateras/mirage/DefaultEntityOperatorTest.java (nonexistent)
+++ mirage/trunk/mirage/src/test/java/jp/sf/amateras/mirage/DefaultEntityOperatorTest.java (revision 701)
@@ -0,0 +1,154 @@
1+package jp.sf.amateras.mirage;
2+
3+import static org.mockito.Mockito.*;
4+
5+import java.sql.ResultSet;
6+import java.sql.ResultSetMetaData;
7+import java.sql.SQLException;
8+import java.util.ArrayList;
9+import java.util.List;
10+
11+import jp.sf.amateras.mirage.annotation.PrimaryKey;
12+import jp.sf.amateras.mirage.annotation.PrimaryKey.GenerationType;
13+import jp.sf.amateras.mirage.bean.BeanDesc;
14+import jp.sf.amateras.mirage.dialect.Dialect;
15+import jp.sf.amateras.mirage.naming.NameConverter;
16+import jp.sf.amateras.mirage.type.BigDecimalValueType;
17+import jp.sf.amateras.mirage.type.BooleanPrimitiveValueType;
18+import jp.sf.amateras.mirage.type.BooleanValueType;
19+import jp.sf.amateras.mirage.type.ByteArrayValueType;
20+import jp.sf.amateras.mirage.type.DoublePrimitiveValueType;
21+import jp.sf.amateras.mirage.type.DoubleValueType;
22+import jp.sf.amateras.mirage.type.FloatPrimitiveValueType;
23+import jp.sf.amateras.mirage.type.FloatValueType;
24+import jp.sf.amateras.mirage.type.IntegerPrimitiveValueType;
25+import jp.sf.amateras.mirage.type.IntegerValueType;
26+import jp.sf.amateras.mirage.type.LongPrimitiveValueType;
27+import jp.sf.amateras.mirage.type.LongValueType;
28+import jp.sf.amateras.mirage.type.ShortPrimitiveValueType;
29+import jp.sf.amateras.mirage.type.ShortValueType;
30+import jp.sf.amateras.mirage.type.SqlDateValueType;
31+import jp.sf.amateras.mirage.type.StringValueType;
32+import jp.sf.amateras.mirage.type.TimeValueType;
33+import jp.sf.amateras.mirage.type.TimestampValueType;
34+import jp.sf.amateras.mirage.type.UtilDateValueType;
35+import jp.sf.amateras.mirage.type.ValueType;
36+import junit.framework.TestCase;
37+
38+
39+public class DefaultEntityOperatorTest extends TestCase {
40+
41+ DefaultEntityOperator operator = new DefaultEntityOperator();
42+
43+ public void testDefaultResultEntityCreator() throws SQLException {
44+ ResultSet rs = mock(ResultSet.class);
45+ ResultSetMetaData meta = mock(ResultSetMetaData.class);
46+ BeanDesc beanDesc = mock(BeanDesc.class);
47+ Dialect dialect = mock(Dialect.class);
48+ NameConverter nc = mock(NameConverter.class);
49+
50+ // Although UserInfo doesn't have public no-args constructor,
51+ // DefaultResultEntityCreator can create UserInfo instance
52+ UserInfo userInfo = operator.createEntity(UserInfo.class, rs, meta, 0,
53+ beanDesc, dialect, getDefaultValueTypes(), nc);
54+
55+ assertNotNull(userInfo);
56+ }
57+
58+ private List<ValueType<?>> getDefaultValueTypes(){
59+ List<ValueType<?>> valueTypes = new ArrayList<ValueType<?>>();
60+ valueTypes.add(new StringValueType());
61+ valueTypes.add(new IntegerValueType());
62+ valueTypes.add(new IntegerPrimitiveValueType());
63+ valueTypes.add(new LongValueType());
64+ valueTypes.add(new LongPrimitiveValueType());
65+ valueTypes.add(new ShortValueType());
66+ valueTypes.add(new ShortPrimitiveValueType());
67+ valueTypes.add(new DoubleValueType());
68+ valueTypes.add(new DoublePrimitiveValueType());
69+ valueTypes.add(new FloatValueType());
70+ valueTypes.add(new FloatPrimitiveValueType());
71+ valueTypes.add(new BooleanValueType());
72+ valueTypes.add(new BooleanPrimitiveValueType());
73+ valueTypes.add(new BigDecimalValueType());
74+ valueTypes.add(new SqlDateValueType());
75+ valueTypes.add(new UtilDateValueType());
76+ valueTypes.add(new TimeValueType());
77+ valueTypes.add(new TimestampValueType());
78+ valueTypes.add(new ByteArrayValueType());
79+ return valueTypes;
80+ }
81+
82+ public static class UserInfo {
83+
84+ @PrimaryKey(generationType=GenerationType.IDENTITY)
85+ private int userId;
86+
87+ private String userName;
88+
89+ public UserInfo(int userId, String userName) {
90+ this.userId = userId;
91+ this.userName = userName;
92+ }
93+
94+ @SuppressWarnings("unused") // for reflective access
95+ private UserInfo() {
96+ }
97+
98+ public int getUserId() {
99+ return userId;
100+ }
101+
102+ public void setUserId(int userId) {
103+ this.userId = userId;
104+ }
105+
106+ public String getUserName() {
107+ return userName;
108+ }
109+
110+ public void setUserName(String userName) {
111+ this.userName = userName;
112+ }
113+
114+ @Override
115+ public String toString() {
116+ return userId + " " + userName;
117+ }
118+ }
119+
120+
121+// public static class UserInfo2 {
122+//
123+// @PrimaryKey(generationType=GenerationType.IDENTITY)
124+// private int userId;
125+//
126+// private String userName;
127+//
128+// public UserInfo2(int userId, String userName) {
129+// this.userId = userId;
130+// this.userName = userName;
131+// }
132+//
133+// public int getUserId() {
134+// return userId;
135+// }
136+//
137+// public void setUserId(int userId) {
138+// this.userId = userId;
139+// }
140+//
141+// public String getUserName() {
142+// return userName;
143+// }
144+//
145+// public void setUserName(String userName) {
146+// this.userName = userName;
147+// }
148+//
149+// @Override
150+// public String toString() {
151+// return userId + " " + userName;
152+// }
153+// }
154+}
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Date Revision Author HeadURL Id
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Show on old repository browser