#57 Nick Satinover - Completed

Open
nsatinover wants to merge 6 commits from nsatinover/ZCW-ORM-SimpleAccount:master into master

BIN
.DS_Store View File


+ 16
- 0
.idea/compiler.xml View File

@@ -0,0 +1,16 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="CompilerConfiguration">
4
+    <annotationProcessing>
5
+      <profile name="Maven default annotation processors profile" enabled="true">
6
+        <sourceOutputDir name="target/generated-sources/annotations" />
7
+        <sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
8
+        <outputRelativeToContentRoot value="true" />
9
+        <module name="ZCW-ORM-SimpleAccount" />
10
+      </profile>
11
+    </annotationProcessing>
12
+    <bytecodeTargetLevel>
13
+      <module name="ZCW-ORM-SimpleAccount" target="8" />
14
+    </bytecodeTargetLevel>
15
+  </component>
16
+</project>

+ 13
- 0
.idea/libraries/Maven__com_google_protobuf_protobuf_java_3_6_1.xml View File

@@ -0,0 +1,13 @@
1
+<component name="libraryTable">
2
+  <library name="Maven: com.google.protobuf:protobuf-java:3.6.1">
3
+    <CLASSES>
4
+      <root url="jar://$MAVEN_REPOSITORY$/com/google/protobuf/protobuf-java/3.6.1/protobuf-java-3.6.1.jar!/" />
5
+    </CLASSES>
6
+    <JAVADOC>
7
+      <root url="jar://$MAVEN_REPOSITORY$/com/google/protobuf/protobuf-java/3.6.1/protobuf-java-3.6.1-javadoc.jar!/" />
8
+    </JAVADOC>
9
+    <SOURCES>
10
+      <root url="jar://$MAVEN_REPOSITORY$/com/google/protobuf/protobuf-java/3.6.1/protobuf-java-3.6.1-sources.jar!/" />
11
+    </SOURCES>
12
+  </library>
13
+</component>

+ 13
- 0
.idea/libraries/Maven__com_j256_ormlite_ormlite_core_4_48.xml View File

@@ -0,0 +1,13 @@
1
+<component name="libraryTable">
2
+  <library name="Maven: com.j256.ormlite:ormlite-core:4.48">
3
+    <CLASSES>
4
+      <root url="jar://$MAVEN_REPOSITORY$/com/j256/ormlite/ormlite-core/4.48/ormlite-core-4.48.jar!/" />
5
+    </CLASSES>
6
+    <JAVADOC>
7
+      <root url="jar://$MAVEN_REPOSITORY$/com/j256/ormlite/ormlite-core/4.48/ormlite-core-4.48-javadoc.jar!/" />
8
+    </JAVADOC>
9
+    <SOURCES>
10
+      <root url="jar://$MAVEN_REPOSITORY$/com/j256/ormlite/ormlite-core/4.48/ormlite-core-4.48-sources.jar!/" />
11
+    </SOURCES>
12
+  </library>
13
+</component>

+ 13
- 0
.idea/libraries/Maven__com_j256_ormlite_ormlite_jdbc_4_48.xml View File

@@ -0,0 +1,13 @@
1
+<component name="libraryTable">
2
+  <library name="Maven: com.j256.ormlite:ormlite-jdbc:4.48">
3
+    <CLASSES>
4
+      <root url="jar://$MAVEN_REPOSITORY$/com/j256/ormlite/ormlite-jdbc/4.48/ormlite-jdbc-4.48.jar!/" />
5
+    </CLASSES>
6
+    <JAVADOC>
7
+      <root url="jar://$MAVEN_REPOSITORY$/com/j256/ormlite/ormlite-jdbc/4.48/ormlite-jdbc-4.48-javadoc.jar!/" />
8
+    </JAVADOC>
9
+    <SOURCES>
10
+      <root url="jar://$MAVEN_REPOSITORY$/com/j256/ormlite/ormlite-jdbc/4.48/ormlite-jdbc-4.48-sources.jar!/" />
11
+    </SOURCES>
12
+  </library>
13
+</component>

+ 13
- 0
.idea/libraries/Maven__junit_junit_4_12.xml View File

@@ -0,0 +1,13 @@
1
+<component name="libraryTable">
2
+  <library name="Maven: junit:junit:4.12">
3
+    <CLASSES>
4
+      <root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/" />
5
+    </CLASSES>
6
+    <JAVADOC>
7
+      <root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12-javadoc.jar!/" />
8
+    </JAVADOC>
9
+    <SOURCES>
10
+      <root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12-sources.jar!/" />
11
+    </SOURCES>
12
+  </library>
13
+</component>

+ 13
- 0
.idea/libraries/Maven__mysql_mysql_connector_java_8_0_13.xml View File

@@ -0,0 +1,13 @@
1
+<component name="libraryTable">
2
+  <library name="Maven: mysql:mysql-connector-java:8.0.13">
3
+    <CLASSES>
4
+      <root url="jar://$MAVEN_REPOSITORY$/mysql/mysql-connector-java/8.0.13/mysql-connector-java-8.0.13.jar!/" />
5
+    </CLASSES>
6
+    <JAVADOC>
7
+      <root url="jar://$MAVEN_REPOSITORY$/mysql/mysql-connector-java/8.0.13/mysql-connector-java-8.0.13-javadoc.jar!/" />
8
+    </JAVADOC>
9
+    <SOURCES>
10
+      <root url="jar://$MAVEN_REPOSITORY$/mysql/mysql-connector-java/8.0.13/mysql-connector-java-8.0.13-sources.jar!/" />
11
+    </SOURCES>
12
+  </library>
13
+</component>

+ 13
- 0
.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml View File

@@ -0,0 +1,13 @@
1
+<component name="libraryTable">
2
+  <library name="Maven: org.hamcrest:hamcrest-core:1.3">
3
+    <CLASSES>
4
+      <root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar!/" />
5
+    </CLASSES>
6
+    <JAVADOC>
7
+      <root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-javadoc.jar!/" />
8
+    </JAVADOC>
9
+    <SOURCES>
10
+      <root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-sources.jar!/" />
11
+    </SOURCES>
12
+  </library>
13
+</component>

+ 13
- 0
.idea/misc.xml View File

@@ -0,0 +1,13 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="MavenProjectsManager">
4
+    <option name="originalFiles">
5
+      <list>
6
+        <option value="$PROJECT_DIR$/pom.xml" />
7
+      </list>
8
+    </option>
9
+  </component>
10
+  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
11
+    <output url="file://$PROJECT_DIR$/classes" />
12
+  </component>
13
+</project>

+ 8
- 0
.idea/modules.xml View File

@@ -0,0 +1,8 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="ProjectModuleManager">
4
+    <modules>
5
+      <module fileurl="file://$PROJECT_DIR$/ZCW-ORM-SimpleAccount.iml" filepath="$PROJECT_DIR$/ZCW-ORM-SimpleAccount.iml" />
6
+    </modules>
7
+  </component>
8
+</project>

+ 6
- 0
.idea/vcs.xml View File

@@ -0,0 +1,6 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="VcsDirectoryMappings">
4
+    <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+  </component>
6
+</project>

+ 599
- 0
.idea/workspace.xml View File

@@ -0,0 +1,599 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="ChangeListManager">
4
+    <list default="true" id="a5077242-19cb-4de8-ab86-b2f20184190b" name="Default Changelist" comment="">
5
+      <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
6
+      <change beforePath="$PROJECT_DIR$/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/pom.xml" afterDir="false" />
7
+      <change beforePath="$PROJECT_DIR$/src/main/java/AccountApp.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/AccountApp.java" afterDir="false" />
8
+      <change beforePath="$PROJECT_DIR$/src/main/java/MockDao.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/MockDao.java" afterDir="false" />
9
+      <change beforePath="$PROJECT_DIR$/src/test/java/AccountServiceTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/test/java/AccountServiceTest.java" afterDir="false" />
10
+      <change beforePath="$PROJECT_DIR$/target/classes/AccountApp.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/AccountApp.class" afterDir="false" />
11
+      <change beforePath="$PROJECT_DIR$/target/classes/AccountService.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/AccountService.class" afterDir="false" />
12
+      <change beforePath="$PROJECT_DIR$/target/classes/MockDao.class" beforeDir="false" />
13
+    </list>
14
+    <ignored path="$PROJECT_DIR$/target/" />
15
+    <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
16
+    <option name="SHOW_DIALOG" value="false" />
17
+    <option name="HIGHLIGHT_CONFLICTS" value="true" />
18
+    <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
19
+    <option name="LAST_RESOLUTION" value="IGNORE" />
20
+  </component>
21
+  <component name="DockManager">
22
+    <window id="1">
23
+      <content type="file-editors">
24
+        <state>
25
+          <leaf>
26
+            <file pinned="false" current-in-tab="true">
27
+              <entry file="file://$PROJECT_DIR$/src/test/java/AccountServiceTest.java">
28
+                <provider selected="true" editor-type-id="text-editor">
29
+                  <state relative-caret-position="375">
30
+                    <caret line="25" column="48" selection-start-line="25" selection-start-column="48" selection-end-line="25" selection-end-column="48" />
31
+                    <folding>
32
+                      <element signature="imports" expanded="true" />
33
+                    </folding>
34
+                  </state>
35
+                </provider>
36
+              </entry>
37
+            </file>
38
+          </leaf>
39
+        </state>
40
+      </content>
41
+    </window>
42
+  </component>
43
+  <component name="FUSProjectUsageTrigger">
44
+    <session id="-448911281">
45
+      <usages-collector id="statistics.lifecycle.project">
46
+        <counts>
47
+          <entry key="project.open.time.0" value="1" />
48
+          <entry key="project.opened" value="1" />
49
+        </counts>
50
+      </usages-collector>
51
+      <usages-collector id="statistics.file.extensions.open">
52
+        <counts>
53
+          <entry key="class" value="7" />
54
+          <entry key="iml" value="1" />
55
+          <entry key="java" value="19" />
56
+          <entry key="xml" value="2" />
57
+        </counts>
58
+      </usages-collector>
59
+      <usages-collector id="statistics.file.types.open">
60
+        <counts>
61
+          <entry key="CLASS" value="7" />
62
+          <entry key="IDEA_MODULE" value="1" />
63
+          <entry key="JAVA" value="19" />
64
+          <entry key="XML" value="2" />
65
+        </counts>
66
+      </usages-collector>
67
+      <usages-collector id="statistics.file.extensions.edit">
68
+        <counts>
69
+          <entry key="java" value="836" />
70
+          <entry key="txt" value="34" />
71
+        </counts>
72
+      </usages-collector>
73
+      <usages-collector id="statistics.file.types.edit">
74
+        <counts>
75
+          <entry key="JAVA" value="836" />
76
+          <entry key="PLAIN_TEXT" value="34" />
77
+        </counts>
78
+      </usages-collector>
79
+    </session>
80
+  </component>
81
+  <component name="FileEditorManager">
82
+    <splitter split-orientation="horizontal" split-proportion="0.5111821">
83
+      <split-first>
84
+        <leaf>
85
+          <file pinned="false" current-in-tab="false">
86
+            <entry file="file://$PROJECT_DIR$/src/main/java/AccountApp.java">
87
+              <provider selected="true" editor-type-id="text-editor">
88
+                <state relative-caret-position="1065">
89
+                  <caret line="78" column="45" selection-start-line="78" selection-start-column="45" selection-end-line="78" selection-end-column="45" />
90
+                  <folding>
91
+                    <element signature="e#761#762#0" expanded="true" />
92
+                    <element signature="e#800#801#0" expanded="true" />
93
+                    <element signature="e#809#810#0" expanded="true" />
94
+                    <element signature="e#842#843#0" expanded="true" />
95
+                  </folding>
96
+                </state>
97
+              </provider>
98
+            </entry>
99
+          </file>
100
+          <file pinned="false" current-in-tab="true">
101
+            <entry file="file://$PROJECT_DIR$/src/main/java/MockDao.java">
102
+              <provider selected="true" editor-type-id="text-editor">
103
+                <state relative-caret-position="765">
104
+                  <caret line="69" column="26" selection-start-line="69" selection-start-column="26" selection-end-line="69" selection-end-column="26" />
105
+                  <folding>
106
+                    <element signature="imports" expanded="true" />
107
+                  </folding>
108
+                </state>
109
+              </provider>
110
+            </entry>
111
+          </file>
112
+          <file pinned="false" current-in-tab="false">
113
+            <entry file="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home/src.zip!/java/util/List.java">
114
+              <provider selected="true" editor-type-id="text-editor">
115
+                <state relative-caret-position="313">
116
+                  <caret line="110" column="17" selection-start-line="110" selection-start-column="17" selection-end-line="110" selection-end-column="17" />
117
+                </state>
118
+              </provider>
119
+            </entry>
120
+          </file>
121
+        </leaf>
122
+      </split-first>
123
+      <split-second>
124
+        <leaf>
125
+          <file pinned="false" current-in-tab="true">
126
+            <entry file="file://$PROJECT_DIR$/src/main/java/AccountService.java">
127
+              <provider selected="true" editor-type-id="text-editor">
128
+                <state relative-caret-position="-109">
129
+                  <caret line="17" selection-start-line="17" selection-end-line="26" selection-end-column="9" />
130
+                </state>
131
+              </provider>
132
+            </entry>
133
+          </file>
134
+          <file pinned="false" current-in-tab="false">
135
+            <entry file="file://$PROJECT_DIR$/src/main/java/Account.java">
136
+              <provider selected="true" editor-type-id="text-editor">
137
+                <state relative-caret-position="123">
138
+                  <caret line="21" column="16" selection-start-line="21" selection-start-column="16" selection-end-line="21" selection-end-column="16" />
139
+                </state>
140
+              </provider>
141
+            </entry>
142
+          </file>
143
+        </leaf>
144
+      </split-second>
145
+    </splitter>
146
+  </component>
147
+  <component name="FindInProjectRecents">
148
+    <findStrings>
149
+      <find>queryforAll</find>
150
+      <find>create</find>
151
+    </findStrings>
152
+  </component>
153
+  <component name="Git.Settings">
154
+    <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
155
+  </component>
156
+  <component name="IdeDocumentHistory">
157
+    <option name="CHANGED_PATHS">
158
+      <list>
159
+        <option value="$PROJECT_DIR$/src/main/java/AccountService.java" />
160
+        <option value="$PROJECT_DIR$/src/main/java/AccountApp.java" />
161
+        <option value="$PROJECT_DIR$/src/main/java/MockDao.java" />
162
+        <option value="$PROJECT_DIR$/src/test/java/AccountServiceTest.java" />
163
+      </list>
164
+    </option>
165
+  </component>
166
+  <component name="JsBuildToolGruntFileManager" detection-done="true" sorting="DEFINITION_ORDER" />
167
+  <component name="JsBuildToolPackageJson" detection-done="true" sorting="DEFINITION_ORDER" />
168
+  <component name="JsGulpfileManager">
169
+    <detection-done>true</detection-done>
170
+    <sorting>DEFINITION_ORDER</sorting>
171
+  </component>
172
+  <component name="ProjectFrameBounds" extendedState="6">
173
+    <option name="x" value="-1345" />
174
+    <option name="y" value="-1053" />
175
+    <option name="width" value="1895" />
176
+    <option name="height" value="1043" />
177
+  </component>
178
+  <component name="ProjectLevelVcsManager" settingsEditedManually="true" />
179
+  <component name="ProjectView">
180
+    <navigator proportions="" version="1">
181
+      <foldersAlwaysOnTop value="true" />
182
+    </navigator>
183
+    <panes>
184
+      <pane id="ProjectPane">
185
+        <subPane>
186
+          <expand>
187
+            <path>
188
+              <item name="ZCW-ORM-SimpleAccount" type="b2602c69:ProjectViewProjectNode" />
189
+              <item name="ZCW-ORM-SimpleAccount" type="462c0819:PsiDirectoryNode" />
190
+            </path>
191
+            <path>
192
+              <item name="ZCW-ORM-SimpleAccount" type="b2602c69:ProjectViewProjectNode" />
193
+              <item name="ZCW-ORM-SimpleAccount" type="462c0819:PsiDirectoryNode" />
194
+              <item name="src" type="462c0819:PsiDirectoryNode" />
195
+            </path>
196
+            <path>
197
+              <item name="ZCW-ORM-SimpleAccount" type="b2602c69:ProjectViewProjectNode" />
198
+              <item name="ZCW-ORM-SimpleAccount" type="462c0819:PsiDirectoryNode" />
199
+              <item name="src" type="462c0819:PsiDirectoryNode" />
200
+              <item name="main" type="462c0819:PsiDirectoryNode" />
201
+            </path>
202
+            <path>
203
+              <item name="ZCW-ORM-SimpleAccount" type="b2602c69:ProjectViewProjectNode" />
204
+              <item name="ZCW-ORM-SimpleAccount" type="462c0819:PsiDirectoryNode" />
205
+              <item name="src" type="462c0819:PsiDirectoryNode" />
206
+              <item name="main" type="462c0819:PsiDirectoryNode" />
207
+              <item name="java" type="462c0819:PsiDirectoryNode" />
208
+            </path>
209
+            <path>
210
+              <item name="ZCW-ORM-SimpleAccount" type="b2602c69:ProjectViewProjectNode" />
211
+              <item name="ZCW-ORM-SimpleAccount" type="462c0819:PsiDirectoryNode" />
212
+              <item name="src" type="462c0819:PsiDirectoryNode" />
213
+              <item name="test" type="462c0819:PsiDirectoryNode" />
214
+            </path>
215
+            <path>
216
+              <item name="ZCW-ORM-SimpleAccount" type="b2602c69:ProjectViewProjectNode" />
217
+              <item name="ZCW-ORM-SimpleAccount" type="462c0819:PsiDirectoryNode" />
218
+              <item name="src" type="462c0819:PsiDirectoryNode" />
219
+              <item name="test" type="462c0819:PsiDirectoryNode" />
220
+              <item name="java" type="462c0819:PsiDirectoryNode" />
221
+            </path>
222
+            <path>
223
+              <item name="ZCW-ORM-SimpleAccount" type="b2602c69:ProjectViewProjectNode" />
224
+              <item name="ZCW-ORM-SimpleAccount" type="462c0819:PsiDirectoryNode" />
225
+              <item name="target" type="462c0819:PsiDirectoryNode" />
226
+            </path>
227
+          </expand>
228
+          <select />
229
+        </subPane>
230
+      </pane>
231
+      <pane id="PackagesPane" />
232
+      <pane id="Scope" />
233
+    </panes>
234
+  </component>
235
+  <component name="PropertiesComponent">
236
+    <property name="WebServerToolWindowFactoryState" value="false" />
237
+    <property name="aspect.path.notification.shown" value="true" />
238
+    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1543075080387" />
239
+    <property name="last_opened_file_path" value="$PROJECT_DIR$/pom.xml" />
240
+    <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
241
+    <property name="nodejs_npm_path_reset_for_default_project" value="true" />
242
+    <property name="project.structure.last.edited" value="Modules" />
243
+    <property name="project.structure.proportion" value="0.0" />
244
+    <property name="project.structure.side.proportion" value="0.0" />
245
+  </component>
246
+  <component name="RunDashboard">
247
+    <option name="ruleStates">
248
+      <list>
249
+        <RuleState>
250
+          <option name="name" value="ConfigurationTypeDashboardGroupingRule" />
251
+        </RuleState>
252
+        <RuleState>
253
+          <option name="name" value="StatusDashboardGroupingRule" />
254
+        </RuleState>
255
+      </list>
256
+    </option>
257
+  </component>
258
+  <component name="RunManager" selected="JUnit.AccountServiceTest.createTest">
259
+    <configuration name="AccountApp" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
260
+      <option name="MAIN_CLASS_NAME" value="AccountApp" />
261
+      <module name="ZCW-ORM-SimpleAccount" />
262
+      <method v="2">
263
+        <option name="Make" enabled="true" />
264
+      </method>
265
+    </configuration>
266
+    <configuration name="AccountServiceTest.createTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
267
+      <module name="ZCW-ORM-SimpleAccount" />
268
+      <option name="PACKAGE_NAME" value="" />
269
+      <option name="MAIN_CLASS_NAME" value="AccountServiceTest" />
270
+      <option name="METHOD_NAME" value="createTest" />
271
+      <option name="TEST_OBJECT" value="method" />
272
+      <method v="2">
273
+        <option name="Make" enabled="true" />
274
+      </method>
275
+    </configuration>
276
+    <configuration name="AccountServiceTest.queryForIdTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
277
+      <module name="ZCW-ORM-SimpleAccount" />
278
+      <option name="PACKAGE_NAME" value="" />
279
+      <option name="MAIN_CLASS_NAME" value="AccountServiceTest" />
280
+      <option name="METHOD_NAME" value="queryForIdTest" />
281
+      <option name="TEST_OBJECT" value="method" />
282
+      <method v="2">
283
+        <option name="Make" enabled="true" />
284
+      </method>
285
+    </configuration>
286
+    <list>
287
+      <item itemvalue="Application.AccountApp" />
288
+      <item itemvalue="JUnit.AccountServiceTest.queryForIdTest" />
289
+      <item itemvalue="JUnit.AccountServiceTest.createTest" />
290
+    </list>
291
+    <recent_temporary>
292
+      <list>
293
+        <item itemvalue="JUnit.AccountServiceTest.createTest" />
294
+        <item itemvalue="JUnit.AccountServiceTest.queryForIdTest" />
295
+        <item itemvalue="Application.AccountApp" />
296
+      </list>
297
+    </recent_temporary>
298
+  </component>
299
+  <component name="SvnConfiguration">
300
+    <configuration />
301
+  </component>
302
+  <component name="TaskManager">
303
+    <task active="true" id="Default" summary="Default task">
304
+      <changelist id="a5077242-19cb-4de8-ab86-b2f20184190b" name="Default Changelist" comment="" />
305
+      <created>1542746487090</created>
306
+      <option name="number" value="Default" />
307
+      <option name="presentableId" value="Default" />
308
+      <updated>1542746487090</updated>
309
+      <workItem from="1542746488527" duration="13677000" />
310
+    </task>
311
+    <task id="LOCAL-00001" summary="Refactored for use with MockDao">
312
+      <created>1542817617312</created>
313
+      <option name="number" value="00001" />
314
+      <option name="presentableId" value="LOCAL-00001" />
315
+      <option name="project" value="LOCAL" />
316
+      <updated>1542817617312</updated>
317
+    </task>
318
+    <option name="localTasksCounter" value="2" />
319
+    <servers />
320
+  </component>
321
+  <component name="TestHistory">
322
+    <history-entry file="AccountServiceTest_queryForIdTest - 2018.11.21 at 11h 45m 59s.xml">
323
+      <configuration name="AccountServiceTest.queryForIdTest" configurationId="JUnit" />
324
+    </history-entry>
325
+    <history-entry file="AccountServiceTest_queryForIdTest - 2018.11.21 at 11h 49m 13s.xml">
326
+      <configuration name="AccountServiceTest.queryForIdTest" configurationId="JUnit" />
327
+    </history-entry>
328
+    <history-entry file="AccountServiceTest_queryForIdTest - 2018.11.21 at 11h 50m 16s.xml">
329
+      <configuration name="AccountServiceTest.queryForIdTest" configurationId="JUnit" />
330
+    </history-entry>
331
+    <history-entry file="AccountServiceTest_queryForIdTest - 2018.11.21 at 11h 50m 37s.xml">
332
+      <configuration name="AccountServiceTest.queryForIdTest" configurationId="JUnit" />
333
+    </history-entry>
334
+    <history-entry file="AccountServiceTest_queryForIdTest - 2018.11.21 at 11h 50m 43s.xml">
335
+      <configuration name="AccountServiceTest.queryForIdTest" configurationId="JUnit" />
336
+    </history-entry>
337
+  </component>
338
+  <component name="TimeTrackingManager">
339
+    <option name="totallyTimeSpent" value="13677000" />
340
+  </component>
341
+  <component name="ToolWindowManager">
342
+    <frame x="-1362" y="-1057" width="1920" height="1057" extended-state="6" />
343
+    <editor active="true" />
344
+    <layout>
345
+      <window_info id="Image Layers" />
346
+      <window_info id="Designer" />
347
+      <window_info id="UI Designer" />
348
+      <window_info id="Capture Tool" />
349
+      <window_info id="Favorites" side_tool="true" />
350
+      <window_info content_ui="combo" id="Project" order="0" weight="0.24920128" />
351
+      <window_info id="Structure" order="1" side_tool="true" weight="0.25" />
352
+      <window_info anchor="bottom" id="Messages" weight="0.3284974" />
353
+      <window_info anchor="bottom" id="Database Changes" show_stripe_button="false" />
354
+      <window_info anchor="bottom" id="Version Control" show_stripe_button="false" />
355
+      <window_info anchor="bottom" id="Terminal" />
356
+      <window_info anchor="bottom" id="Event Log" side_tool="true" />
357
+      <window_info anchor="bottom" id="Message" order="0" />
358
+      <window_info anchor="bottom" id="Find" order="1" weight="0.32953367" />
359
+      <window_info anchor="bottom" id="Run" order="2" weight="0.21036269" />
360
+      <window_info anchor="bottom" id="Debug" order="3" weight="0.32746115" />
361
+      <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
362
+      <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
363
+      <window_info anchor="bottom" id="TODO" order="6" />
364
+      <window_info anchor="right" id="Palette" />
365
+      <window_info anchor="right" id="Theme Preview" />
366
+      <window_info anchor="right" id="Capture Analysis" />
367
+      <window_info anchor="right" id="Palette&#9;" />
368
+      <window_info anchor="right" id="Database" />
369
+      <window_info anchor="right" id="Maven Projects" />
370
+      <window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
371
+      <window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
372
+      <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
373
+    </layout>
374
+  </component>
375
+  <component name="TypeScriptGeneratedFilesManager">
376
+    <option name="version" value="1" />
377
+  </component>
378
+  <component name="VcsContentAnnotationSettings">
379
+    <option name="myLimit" value="2678400000" />
380
+  </component>
381
+  <component name="VcsManagerConfiguration">
382
+    <MESSAGE value="Refactored for use with MockDao" />
383
+    <option name="LAST_COMMIT_MESSAGE" value="Refactored for use with MockDao" />
384
+  </component>
385
+  <component name="editorHistoryManager">
386
+    <entry file="jar://$MAVEN_REPOSITORY$/com/j256/ormlite/ormlite-jdbc/4.48/ormlite-jdbc-4.48.jar!/com/j256/ormlite/jdbc/JdbcConnectionSource.class">
387
+      <provider selected="true" editor-type-id="text-editor">
388
+        <state relative-caret-position="163">
389
+          <caret line="81" selection-start-line="81" selection-end-line="81" />
390
+        </state>
391
+      </provider>
392
+    </entry>
393
+    <entry file="file://$PROJECT_DIR$/ZCW-ORM-SimpleAccount.iml">
394
+      <provider selected="true" editor-type-id="text-editor" />
395
+    </entry>
396
+    <entry file="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/org/junit/internal/runners/model/EachTestNotifier.class">
397
+      <provider selected="true" editor-type-id="text-editor">
398
+        <state relative-caret-position="240">
399
+          <caret line="24" selection-start-line="24" selection-end-line="24" />
400
+        </state>
401
+      </provider>
402
+    </entry>
403
+    <entry file="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/org/junit/runners/BlockJUnit4ClassRunner.class">
404
+      <provider selected="true" editor-type-id="text-editor">
405
+        <state relative-caret-position="315">
406
+          <caret line="49" selection-start-line="49" selection-end-line="49" />
407
+        </state>
408
+      </provider>
409
+    </entry>
410
+    <entry file="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/org/junit/runner/JUnitCore.class">
411
+      <provider selected="true" editor-type-id="text-editor">
412
+        <state relative-caret-position="310">
413
+          <caret line="71" selection-start-line="71" selection-end-line="71" />
414
+        </state>
415
+      </provider>
416
+    </entry>
417
+    <entry file="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/org/junit/runners/ParentRunner.class">
418
+      <provider selected="true" editor-type-id="text-editor">
419
+        <state relative-caret-position="187">
420
+          <caret line="226" column="16" selection-start-line="226" selection-start-column="16" selection-end-line="226" selection-end-column="16" />
421
+          <folding>
422
+            <element signature="e#2111#2112#0" expanded="true" />
423
+            <element signature="e#2155#2156#0" expanded="true" />
424
+            <element signature="e#5951#6086#0" expanded="true" />
425
+            <element signature="e#6085#6086#0" expanded="true" />
426
+            <element signature="e#6484#6648#0" expanded="true" />
427
+            <element signature="e#6647#6648#0" expanded="true" />
428
+          </folding>
429
+        </state>
430
+      </provider>
431
+    </entry>
432
+    <entry file="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/org/junit/internal/runners/model/ReflectiveCallable.class">
433
+      <provider selected="true" editor-type-id="text-editor">
434
+        <state relative-caret-position="210">
435
+          <caret line="17" selection-start-line="17" selection-end-line="17" />
436
+        </state>
437
+      </provider>
438
+    </entry>
439
+    <entry file="file://$PROJECT_DIR$/src/main/java/Account.java">
440
+      <provider selected="true" editor-type-id="text-editor">
441
+        <state relative-caret-position="123">
442
+          <caret line="21" column="16" selection-start-line="21" selection-start-column="16" selection-end-line="21" selection-end-column="16" />
443
+        </state>
444
+      </provider>
445
+    </entry>
446
+    <entry file="file://$PROJECT_DIR$/src/main/java/Printer.java">
447
+      <provider selected="true" editor-type-id="text-editor">
448
+        <state>
449
+          <caret column="13" selection-start-column="13" selection-end-column="13" />
450
+        </state>
451
+      </provider>
452
+    </entry>
453
+    <entry file="file://$PROJECT_DIR$/src/main/java/Console.java">
454
+      <provider selected="true" editor-type-id="text-editor">
455
+        <state relative-caret-position="180">
456
+          <caret line="13" column="16" lean-forward="true" selection-start-line="13" selection-start-column="16" selection-end-line="13" selection-end-column="16" />
457
+        </state>
458
+      </provider>
459
+    </entry>
460
+    <entry file="file://$PROJECT_DIR$/src/main/java/AccountService.java">
461
+      <provider selected="true" editor-type-id="text-editor">
462
+        <state relative-caret-position="-109">
463
+          <caret line="17" selection-start-line="17" selection-end-line="26" selection-end-column="9" />
464
+        </state>
465
+      </provider>
466
+    </entry>
467
+    <entry file="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home/src.zip!/java/util/List.java">
468
+      <provider selected="true" editor-type-id="text-editor">
469
+        <state relative-caret-position="313">
470
+          <caret line="110" column="17" selection-start-line="110" selection-start-column="17" selection-end-line="110" selection-end-column="17" />
471
+        </state>
472
+      </provider>
473
+    </entry>
474
+    <entry file="file://$PROJECT_DIR$/src/main/java/AccountApp.java">
475
+      <provider selected="true" editor-type-id="text-editor">
476
+        <state relative-caret-position="1065">
477
+          <caret line="78" column="45" selection-start-line="78" selection-start-column="45" selection-end-line="78" selection-end-column="45" />
478
+          <folding>
479
+            <element signature="e#761#762#0" expanded="true" />
480
+            <element signature="e#800#801#0" expanded="true" />
481
+            <element signature="e#809#810#0" expanded="true" />
482
+            <element signature="e#842#843#0" expanded="true" />
483
+          </folding>
484
+        </state>
485
+      </provider>
486
+    </entry>
487
+    <entry file="file://$PROJECT_DIR$/pom.xml">
488
+      <provider selected="true" editor-type-id="text-editor" />
489
+    </entry>
490
+    <entry file="file://$PROJECT_DIR$/src/main/java/MockDao.java">
491
+      <provider selected="true" editor-type-id="text-editor">
492
+        <state relative-caret-position="765">
493
+          <caret line="69" column="26" selection-start-line="69" selection-start-column="26" selection-end-line="69" selection-end-column="26" />
494
+          <folding>
495
+            <element signature="imports" expanded="true" />
496
+          </folding>
497
+        </state>
498
+      </provider>
499
+    </entry>
500
+    <entry file="file://$PROJECT_DIR$/src/test/java/AccountServiceTest.java">
501
+      <provider selected="true" editor-type-id="text-editor">
502
+        <state relative-caret-position="375">
503
+          <caret line="25" column="48" selection-start-line="25" selection-start-column="48" selection-end-line="25" selection-end-column="48" />
504
+          <folding>
505
+            <element signature="imports" expanded="true" />
506
+          </folding>
507
+        </state>
508
+      </provider>
509
+    </entry>
510
+  </component>
511
+  <component name="masterDetails">
512
+    <states>
513
+      <state key="ArtifactsStructureConfigurable.UI">
514
+        <settings>
515
+          <artifact-editor />
516
+          <splitter-proportions>
517
+            <option name="proportions">
518
+              <list>
519
+                <option value="0.2" />
520
+              </list>
521
+            </option>
522
+          </splitter-proportions>
523
+        </settings>
524
+      </state>
525
+      <state key="FacetStructureConfigurable.UI">
526
+        <settings>
527
+          <last-edited>No facets are configured</last-edited>
528
+          <splitter-proportions>
529
+            <option name="proportions">
530
+              <list>
531
+                <option value="0.2" />
532
+              </list>
533
+            </option>
534
+          </splitter-proportions>
535
+        </settings>
536
+      </state>
537
+      <state key="GlobalLibrariesConfigurable.UI">
538
+        <settings>
539
+          <splitter-proportions>
540
+            <option name="proportions">
541
+              <list>
542
+                <option value="0.2" />
543
+              </list>
544
+            </option>
545
+          </splitter-proportions>
546
+        </settings>
547
+      </state>
548
+      <state key="JdkListConfigurable.UI">
549
+        <settings>
550
+          <last-edited>1.8</last-edited>
551
+          <splitter-proportions>
552
+            <option name="proportions">
553
+              <list>
554
+                <option value="0.2" />
555
+              </list>
556
+            </option>
557
+          </splitter-proportions>
558
+        </settings>
559
+      </state>
560
+      <state key="ModuleStructureConfigurable.UI">
561
+        <settings>
562
+          <last-edited>ZCW-ORM-SimpleAccount</last-edited>
563
+          <splitter-proportions>
564
+            <option name="proportions">
565
+              <list>
566
+                <option value="0.2" />
567
+                <option value="0.6" />
568
+              </list>
569
+            </option>
570
+          </splitter-proportions>
571
+        </settings>
572
+      </state>
573
+      <state key="ProjectJDKs.UI">
574
+        <settings>
575
+          <last-edited>1.8</last-edited>
576
+          <splitter-proportions>
577
+            <option name="proportions">
578
+              <list>
579
+                <option value="0.2" />
580
+              </list>
581
+            </option>
582
+          </splitter-proportions>
583
+        </settings>
584
+      </state>
585
+      <state key="ProjectLibrariesConfigurable.UI">
586
+        <settings>
587
+          <last-edited>Maven: com.google.protobuf:protobuf-java:3.6.1</last-edited>
588
+          <splitter-proportions>
589
+            <option name="proportions">
590
+              <list>
591
+                <option value="0.2" />
592
+              </list>
593
+            </option>
594
+          </splitter-proportions>
595
+        </settings>
596
+      </state>
597
+    </states>
598
+  </component>
599
+</project>

+ 21
- 0
ZCW-ORM-SimpleAccount.iml View File

@@ -0,0 +1,21 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
3
+  <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
4
+    <output url="file://$MODULE_DIR$/target/classes" />
5
+    <output-test url="file://$MODULE_DIR$/target/test-classes" />
6
+    <content url="file://$MODULE_DIR$">
7
+      <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
8
+      <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
9
+      <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
10
+      <excludeFolder url="file://$MODULE_DIR$/target" />
11
+    </content>
12
+    <orderEntry type="inheritedJdk" />
13
+    <orderEntry type="sourceFolder" forTests="false" />
14
+    <orderEntry type="library" name="Maven: com.j256.ormlite:ormlite-core:4.48" level="project" />
15
+    <orderEntry type="library" name="Maven: com.j256.ormlite:ormlite-jdbc:4.48" level="project" />
16
+    <orderEntry type="library" name="Maven: mysql:mysql-connector-java:8.0.13" level="project" />
17
+    <orderEntry type="library" name="Maven: com.google.protobuf:protobuf-java:3.6.1" level="project" />
18
+    <orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
19
+    <orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
20
+  </component>
21
+</module>

+ 53
- 0
pom.xml View File

@@ -0,0 +1,53 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project xmlns="http://maven.apache.org/POM/4.0.0"
3
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5
+    <modelVersion>4.0.0</modelVersion>
6
+
7
+    <groupId>NickSatinover</groupId>
8
+    <artifactId>ZCW-ORM-SimpleAccount</artifactId>
9
+    <version>1.0-SNAPSHOT</version>
10
+    <build>
11
+        <plugins>
12
+            <plugin>
13
+                <groupId>org.apache.maven.plugins</groupId>
14
+                <artifactId>maven-compiler-plugin</artifactId>
15
+                <configuration>
16
+                    <source>8</source>
17
+                    <target>8</target>
18
+                </configuration>
19
+            </plugin>
20
+        </plugins>
21
+    </build>
22
+
23
+    <dependencies>
24
+        <!-- https://mvnrepository.com/artifact/com.j256.ormlite/ormlite-core -->
25
+        <dependency>
26
+            <groupId>com.j256.ormlite</groupId>
27
+            <artifactId>ormlite-core</artifactId>
28
+            <version>4.48</version>
29
+        </dependency>
30
+
31
+        <!-- https://mvnrepository.com/artifact/com.j256.ormlite/ormlite-jdbc -->
32
+        <dependency>
33
+            <groupId>com.j256.ormlite</groupId>
34
+            <artifactId>ormlite-jdbc</artifactId>
35
+            <version>4.48</version>
36
+        </dependency>
37
+
38
+        <!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
39
+        <dependency>
40
+            <groupId>mysql</groupId>
41
+            <artifactId>mysql-connector-java</artifactId>
42
+            <version>8.0.13</version>
43
+        </dependency>
44
+        <dependency>
45
+            <groupId>junit</groupId>
46
+            <artifactId>junit</artifactId>
47
+            <version>RELEASE</version>
48
+            <scope>test</scope>
49
+        </dependency>
50
+
51
+    </dependencies>
52
+
53
+</project>

+ 66
- 0
src/main/java/Account.java View File

@@ -0,0 +1,66 @@
1
+import com.j256.ormlite.field.DatabaseField;
2
+import com.j256.ormlite.table.DatabaseTable;
3
+
4
+// create table account(id INT NOT NULL AUTO_INCREMENT, name VARCHAR(20), password VARCHAR(20), PRIMARY KEY(id));
5
+
6
+@DatabaseTable(tableName = "account")
7
+public class Account {
8
+
9
+    public static final String NAME_FIELD_NAME = "name";
10
+    public static final String PASSWORD_FIELD_NAME = "password";
11
+
12
+    @DatabaseField(columnName = "id", generatedId = true)
13
+    private int id;
14
+
15
+    @DatabaseField(columnName = "name", canBeNull = false)
16
+    private String name;
17
+
18
+    @DatabaseField(columnName = "password")
19
+    private String password;
20
+
21
+    Account() {
22
+        // all persisted classes must define a no-arg constructor with at least package visibility
23
+    }
24
+
25
+    public Account(String name) {
26
+        this.name = name;
27
+    }
28
+
29
+    public Account(String name, String password) {
30
+        this.name = name;
31
+        this.password = password;
32
+    }
33
+
34
+    public int getId() {
35
+        return id;
36
+    }
37
+
38
+    public String getName() {
39
+        return name;
40
+    }
41
+
42
+    public void setName(String name) {
43
+        this.name = name;
44
+    }
45
+
46
+    public String getPassword() {
47
+        return password;
48
+    }
49
+
50
+    public void setPassword(String password) {
51
+        this.password = password;
52
+    }
53
+
54
+    @Override
55
+    public int hashCode() {
56
+        return name.hashCode();
57
+    }
58
+
59
+    @Override
60
+    public boolean equals(Object other) {
61
+        if (other == null || other.getClass() != getClass()) {
62
+            return false;
63
+        }
64
+        return name.equals(((Account) other).name);
65
+    }
66
+}

+ 97
- 0
src/main/java/AccountApp.java View File

@@ -0,0 +1,97 @@
1
+import com.j256.ormlite.dao.Dao;
2
+import com.j256.ormlite.dao.DaoManager;
3
+import com.j256.ormlite.dao.RuntimeExceptionDao;
4
+import com.j256.ormlite.jdbc.JdbcConnectionSource;
5
+import com.j256.ormlite.stmt.QueryBuilder;
6
+import com.j256.ormlite.support.ConnectionSource;
7
+
8
+import java.sql.SQLException;
9
+
10
+public class AccountApp {
11
+
12
+    Console console;
13
+    AccountService accountService = new AccountService();
14
+    private final static String DATABASE_URL = "jdbc:mysql://localhost:3306/orm_lab?useUnicode=true";
15
+    private final static String YOURUSERNAME = "root";
16
+    private final static String YOURPASSWORD = "cddvdmp9";
17
+
18
+    private Dao<Account, Integer> accountDao;
19
+    // private RuntimeExceptionDao<Account, Integer> accountRuntimeDao = null;
20
+
21
+    AccountApp(){
22
+        console = new Console();
23
+    }
24
+
25
+    AccountApp(Dao dao){
26
+        console = new Console();
27
+        this.accountDao = dao;
28
+    }
29
+
30
+    public Dao<Account, Integer> getAccountDao() {
31
+        return this.accountDao;
32
+    }
33
+
34
+    public static void main(String[] args) throws Exception {
35
+        // turn our static method into an instance of Main
36
+        new AccountApp().doMain(args);
37
+    }
38
+
39
+    private void doMain(String[] args) throws Exception {
40
+        ConnectionSource connectionSource = null;
41
+        try {
42
+            // create our data-source for the database
43
+            connectionSource = new JdbcConnectionSource(DATABASE_URL, YOURUSERNAME, YOURPASSWORD);
44
+            // setup our  DAOs
45
+            setupDao(connectionSource);
46
+            // read, write and delete some data
47
+            System.out.println("\n\nDatabase connection to \"account\" table is open\n\n");
48
+            processData();
49
+
50
+        } finally {
51
+            // destroy the data source which should close underlying connections
52
+            if (connectionSource != null) {
53
+                connectionSource.close();
54
+            }
55
+        }
56
+    }
57
+
58
+    /**
59
+     * Read and write some example data.
60
+     */
61
+    private void processData() throws Exception {
62
+        boolean connectionOpen = true;
63
+
64
+        while (connectionOpen){
65
+
66
+            int userSelection = console.getMainMenu();
67
+
68
+            switch (userSelection){
69
+                case 1 : //new record
70
+                    accountService.create(accountDao);
71
+                    break;
72
+                case 2 : //view record
73
+                    accountService.read(accountDao);
74
+                    break;
75
+                case 3 : //update record
76
+                    accountService.update(accountDao);
77
+                    break;
78
+                case 4 : //delete record
79
+                    int idToDelete = console.getIdToDelete();
80
+                    accountService.deleteId(getAccountDao(), idToDelete);
81
+                    break;
82
+                case 5 : //quit application
83
+                    Printer.printMessage("Connection is now closed.");
84
+                    connectionOpen = false;
85
+            }
86
+
87
+        }
88
+    }
89
+
90
+    /**
91
+     * Setup our DAOs
92
+     */
93
+    private void setupDao(ConnectionSource connectionSource) throws Exception {
94
+        accountDao = DaoManager.createDao(connectionSource, Account.class);
95
+    }
96
+
97
+}

+ 99
- 0
src/main/java/AccountService.java View File

@@ -0,0 +1,99 @@
1
+import java.sql.SQLException;
2
+import java.util.ArrayList;
3
+import java.util.List;
4
+
5
+import com.j256.ormlite.dao.Dao;
6
+import com.j256.ormlite.dao.DaoManager;
7
+import com.j256.ormlite.dao.GenericRawResults;
8
+import com.j256.ormlite.dao.RuntimeExceptionDao;
9
+import com.j256.ormlite.jdbc.JdbcConnectionSource;
10
+import com.j256.ormlite.stmt.QueryBuilder;
11
+import com.j256.ormlite.support.ConnectionSource;
12
+
13
+public class AccountService {
14
+    // private Dao<Account, Integer> accountDao;
15
+     private Console console = new Console();
16
+
17
+    public void create(Dao<Account, Integer> accountDao){
18
+        try {
19
+            String name = console.getCMDFromUser("Enter name: ");
20
+            String password = console.getCMDFromUser("Set password: ");
21
+            Account account = new Account(name, password);
22
+            accountDao.create(account);
23
+            int id = account.getId();
24
+            Printer.printMessage("\nRecord " + id + " created.\n");
25
+        } catch (SQLException e) {
26
+            e.printStackTrace();
27
+        }
28
+    }
29
+
30
+    public void read(Dao<Account, Integer> accountDao) {
31
+        try {
32
+            List<Account> accountList = accountDao.queryForAll();
33
+            for (Account e: accountList) {
34
+                System.out.printf("|%-3s| |%-10s| |%-10s|" , e.getId(), e.getName(), e.getPassword());
35
+                System.out.println("\n");
36
+            }
37
+        } catch (SQLException e) {
38
+            e.printStackTrace();
39
+        }
40
+    }
41
+
42
+    public void update(Dao<Account, Integer> accountDao) {
43
+        boolean updateAccountMenuOpen = true;
44
+
45
+        while (updateAccountMenuOpen){
46
+            read(accountDao);
47
+            int idToUpdate = Integer.parseInt(console.getCMDFromUser("Enter account to update: \n"));
48
+
49
+            try {
50
+                if (accountDao.idExists(idToUpdate)) {
51
+                        Account accountToUpdate = getById(accountDao, idToUpdate);
52
+                        int userSelection = console.getUpdateMenu();
53
+
54
+                        switch (userSelection){
55
+                            case 1 : //update name
56
+                                accountToUpdate.setName(console.updateField());
57
+                                accountDao.update(accountToUpdate);
58
+
59
+                                break;
60
+                            case 2 : //update password
61
+                                accountToUpdate.setPassword(console.updateField());
62
+                                accountDao.update(accountToUpdate);
63
+                                break;
64
+                            case 3 : //quit
65
+                                Printer.printMessage("Returning to Main\n");
66
+                                updateAccountMenuOpen = false;
67
+                        }
68
+               }
69
+            } catch (SQLException e) {
70
+                e.printStackTrace();
71
+            }
72
+        }
73
+    }
74
+
75
+    public void deleteId(Dao accountDao, int idToDelete){
76
+
77
+        try {
78
+            if (accountDao.idExists(idToDelete)) {
79
+                accountDao.deleteById(idToDelete);
80
+                Printer.printMessage("\nId deleted\n");
81
+            }
82
+            else {
83
+                Printer.printMessage("\nId does not exist\n");
84
+            }
85
+        } catch (SQLException e) {
86
+            e.printStackTrace();
87
+        }
88
+    }
89
+
90
+    public Account getById(Dao accountDao, int id){
91
+        try {
92
+            return (Account)accountDao.queryForId(id);
93
+        } catch (SQLException e) {
94
+            e.printStackTrace();
95
+        }
96
+        Printer.printMessage("Failed to get Account");
97
+        return null;
98
+    }
99
+}

+ 83
- 0
src/main/java/Console.java View File

@@ -0,0 +1,83 @@
1
+import java.util.InputMismatchException;
2
+import java.util.Scanner;
3
+
4
+public class Console {
5
+
6
+    private Scanner scanner = new Scanner(System.in);
7
+
8
+    Console(){
9
+
10
+    }
11
+
12
+    public String getCMDFromUser(String msg){
13
+        try {
14
+            Printer.printMessage(msg);
15
+            String input = scanner.next();
16
+            input.toLowerCase().trim();
17
+            return input;
18
+        }catch (InputMismatchException e){
19
+            Printer.printMessage("Please enter a valid word.");
20
+            scanner.next();
21
+        }
22
+        return "";
23
+    }
24
+
25
+    public int getMainMenu(){
26
+        Printer.printCommandMenu();
27
+        int returnInput = 5;
28
+        try {
29
+            Printer.printMessage("Please choose a main option\n");
30
+            String input = scanner.next();
31
+
32
+            if (Integer.parseInt(input) < 6 && Integer.parseInt(input) > 0){
33
+                returnInput = Integer.parseInt(input);
34
+            }
35
+        }catch (InputMismatchException e){
36
+            Printer.printMessage("Please enter a valid number.");
37
+        }
38
+        finally {
39
+            return returnInput;
40
+        }
41
+    }
42
+
43
+    public int getUpdateMenu(){
44
+        Printer.printUpdateMenu();
45
+        int returnInput = 3;
46
+        try {
47
+            Printer.printMessage("\nPlease choose an update option\n");
48
+            String input = scanner.next();
49
+
50
+            if (Integer.parseInt(input) < 4 && Integer.parseInt(input) > 0){
51
+                returnInput = Integer.parseInt(input);
52
+            }
53
+        }catch (InputMismatchException e){
54
+            Printer.printMessage("Please enter a valid number.");
55
+        }
56
+        finally {
57
+            return returnInput;
58
+        }
59
+    }
60
+
61
+    public String updateField(){
62
+        Printer.printMessage("Enter new field value:\n");
63
+        return scanner.next();
64
+    }
65
+
66
+    public int getIdToDelete(){
67
+        try {
68
+            Printer.printMessage("Please choose ID to delete:\n");
69
+            return scanner.nextInt();
70
+        }catch (InputMismatchException e){
71
+            Printer.printMessage("Please enter a valid number.");
72
+            return -1;
73
+        }
74
+    }
75
+
76
+    public void setScanner(Scanner scanner) {
77
+        this.scanner = scanner;
78
+    }
79
+
80
+    public Scanner getScanner() {
81
+        return scanner;
82
+    }
83
+}

+ 310
- 0
src/main/java/MockDao.java View File

@@ -0,0 +1,310 @@
1
+import com.j256.ormlite.dao.*;
2
+import com.j256.ormlite.field.DataType;
3
+import com.j256.ormlite.field.FieldType;
4
+import com.j256.ormlite.stmt.*;
5
+import com.j256.ormlite.support.ConnectionSource;
6
+import com.j256.ormlite.support.DatabaseConnection;
7
+import com.j256.ormlite.support.DatabaseResults;
8
+import com.j256.ormlite.table.ObjectFactory;
9
+
10
+import java.sql.SQLException;
11
+import java.util.*;
12
+import java.util.concurrent.Callable;
13
+
14
+public class MockDao implements Dao {
15
+    ArrayList<Integer> ids = new ArrayList<>();
16
+    List<Account> accounts = new ArrayList<>();
17
+
18
+    int id = 0;
19
+
20
+
21
+    public Object queryForId(Object o) throws SQLException {
22
+        return null;
23
+    }
24
+
25
+    public Object queryForFirst(PreparedQuery preparedQuery) throws SQLException {
26
+        return null;
27
+    }
28
+
29
+    public List queryForAll() throws SQLException {
30
+        return accounts;
31
+    }
32
+
33
+    public List queryForEq(String s, Object o) throws SQLException {
34
+        return null;
35
+    }
36
+
37
+    public List queryForMatching(Object o) throws SQLException {
38
+        return null;
39
+    }
40
+
41
+    public List queryForMatchingArgs(Object o) throws SQLException {
42
+        return null;
43
+    }
44
+
45
+    public Object queryForSameId(Object o) throws SQLException {
46
+        return null;
47
+    }
48
+
49
+    public QueryBuilder queryBuilder() {
50
+        return null;
51
+    }
52
+
53
+    public UpdateBuilder updateBuilder() {
54
+        return null;
55
+    }
56
+
57
+    public DeleteBuilder deleteBuilder() {
58
+        return null;
59
+    }
60
+
61
+    public List query(PreparedQuery preparedQuery) throws SQLException {
62
+        return null;
63
+    }
64
+
65
+    public int create(Object o) throws SQLException {
66
+        try {
67
+            accounts.add((Account)o);
68
+            return 1;
69
+        }
70
+        catch (Exception e){
71
+            return -1;
72
+        }
73
+    }
74
+
75
+    public Object createIfNotExists(Object o) throws SQLException {
76
+        return null;
77
+    }
78
+
79
+    public CreateOrUpdateStatus createOrUpdate(Object o) throws SQLException {
80
+        return null;
81
+    }
82
+
83
+    public int update(Object o) throws SQLException {
84
+        return 0;
85
+    }
86
+
87
+    public int updateId(Object o, Object o2) throws SQLException {
88
+        return 0;
89
+    }
90
+
91
+    public int update(PreparedUpdate preparedUpdate) throws SQLException {
92
+        return 0;
93
+    }
94
+
95
+    public int refresh(Object o) throws SQLException {
96
+        return 0;
97
+    }
98
+
99
+    public int delete(Object o) throws SQLException {
100
+        return 0;
101
+    }
102
+
103
+    public int deleteById(Object o) throws SQLException {
104
+        return 0;
105
+    }
106
+
107
+    public int delete(Collection collection) throws SQLException {
108
+        return 0;
109
+    }
110
+
111
+    public int deleteIds(Collection collection) throws SQLException {
112
+        return 0;
113
+    }
114
+
115
+    public int delete(PreparedDelete preparedDelete) throws SQLException {
116
+        return 0;
117
+    }
118
+
119
+    public CloseableIterator iterator() {
120
+        return null;
121
+    }
122
+
123
+    public CloseableIterator iterator(int i) {
124
+        return null;
125
+    }
126
+
127
+    public CloseableIterator iterator(PreparedQuery preparedQuery) throws SQLException {
128
+        return null;
129
+    }
130
+
131
+    public CloseableIterator iterator(PreparedQuery preparedQuery, int i) throws SQLException {
132
+        return null;
133
+    }
134
+
135
+    public CloseableWrappedIterable getWrappedIterable() {
136
+        return null;
137
+    }
138
+
139
+    public CloseableWrappedIterable getWrappedIterable(PreparedQuery preparedQuery) {
140
+        return null;
141
+    }
142
+
143
+    public void closeLastIterator() throws SQLException {
144
+
145
+    }
146
+
147
+    public GenericRawResults<String[]> queryRaw(String s, String... strings) throws SQLException {
148
+        return null;
149
+    }
150
+
151
+    public GenericRawResults<Object[]> queryRaw(String s, DataType[] dataTypes, String... strings) throws SQLException {
152
+        return null;
153
+    }
154
+
155
+    public long queryRawValue(String s, String... strings) throws SQLException {
156
+        return 0;
157
+    }
158
+
159
+    public int executeRaw(String s, String... strings) throws SQLException {
160
+        return 0;
161
+    }
162
+
163
+    public int executeRawNoArgs(String s) throws SQLException {
164
+        return 0;
165
+    }
166
+
167
+    public int updateRaw(String s, String... strings) throws SQLException {
168
+        return 0;
169
+    }
170
+
171
+    public String objectToString(Object o) {
172
+        return null;
173
+    }
174
+
175
+    public boolean objectsEqual(Object o, Object t1) throws SQLException {
176
+        return false;
177
+    }
178
+
179
+    public Object extractId(Object o) throws SQLException {
180
+        return null;
181
+    }
182
+
183
+    public Class getDataClass() {
184
+        return null;
185
+    }
186
+
187
+    public boolean isUpdatable() {
188
+        return false;
189
+    }
190
+
191
+    public boolean isTableExists() throws SQLException {
192
+        return false;
193
+    }
194
+
195
+    public long countOf() throws SQLException {
196
+        return 0;
197
+    }
198
+
199
+    public long countOf(PreparedQuery preparedQuery) throws SQLException {
200
+        return 0;
201
+    }
202
+
203
+    public void assignEmptyForeignCollection(Object o, String s) throws SQLException {
204
+
205
+    }
206
+
207
+    public void setObjectCache(boolean b) throws SQLException {
208
+
209
+    }
210
+
211
+    public void setObjectCache(ObjectCache objectCache) throws SQLException {
212
+
213
+    }
214
+
215
+    public ObjectCache getObjectCache() {
216
+        return null;
217
+    }
218
+
219
+    public void clearObjectCache() {
220
+
221
+    }
222
+
223
+    public Object mapSelectStarRow(DatabaseResults databaseResults) throws SQLException {
224
+        return null;
225
+    }
226
+
227
+    public GenericRowMapper getSelectStarRowMapper() throws SQLException {
228
+        return null;
229
+    }
230
+
231
+    public RawRowMapper getRawRowMapper() {
232
+        return null;
233
+    }
234
+
235
+    public boolean idExists(Object o) throws SQLException {
236
+        return false;
237
+    }
238
+
239
+    public DatabaseConnection startThreadConnection() throws SQLException {
240
+        return null;
241
+    }
242
+
243
+    public void endThreadConnection(DatabaseConnection databaseConnection) throws SQLException {
244
+
245
+    }
246
+
247
+    public void setAutoCommit(boolean b) throws SQLException {
248
+
249
+    }
250
+
251
+    public void setAutoCommit(DatabaseConnection databaseConnection, boolean b) throws SQLException {
252
+
253
+    }
254
+
255
+    public boolean isAutoCommit() throws SQLException {
256
+        return false;
257
+    }
258
+
259
+    public boolean isAutoCommit(DatabaseConnection databaseConnection) throws SQLException {
260
+        return false;
261
+    }
262
+
263
+    public void commit(DatabaseConnection databaseConnection) throws SQLException {
264
+
265
+    }
266
+
267
+    public void rollBack(DatabaseConnection databaseConnection) throws SQLException {
268
+
269
+    }
270
+
271
+    public ConnectionSource getConnectionSource() {
272
+        return null;
273
+    }
274
+
275
+    public void setObjectFactory(ObjectFactory objectFactory) {
276
+
277
+    }
278
+
279
+    public ForeignCollection getEmptyForeignCollection(String s) throws SQLException {
280
+        return null;
281
+    }
282
+
283
+    public FieldType findForeignFieldType(Class aClass) {
284
+        return null;
285
+    }
286
+
287
+    public Object callBatchTasks(Callable callable) throws Exception {
288
+        return null;
289
+    }
290
+
291
+    public GenericRawResults queryRaw(String s, DataType[] dataTypes, RawRowObjectMapper rawRowObjectMapper, String... strings) throws SQLException {
292
+        return null;
293
+    }
294
+
295
+    public GenericRawResults queryRaw(String s, RawRowMapper rawRowMapper, String... strings) throws SQLException {
296
+        return null;
297
+    }
298
+
299
+    public List queryForFieldValuesArgs(Map map) throws SQLException {
300
+        return null;
301
+    }
302
+
303
+    public List queryForFieldValues(Map map) throws SQLException {
304
+        return null;
305
+    }
306
+
307
+    public CloseableIterator closeableIterator() {
308
+        return null;
309
+    }
310
+}

+ 32
- 0
src/main/java/Printer.java View File

@@ -0,0 +1,32 @@
1
+public class Printer {
2
+
3
+    public static void printMessage(String string) {
4
+        System.out.println(string);
5
+    }
6
+
7
+    public static void printCommandMenu(){
8
+        String[] commandArr = {"Create", "Read", "Update", "Delete", "Quit"};
9
+
10
+        String commands = "";
11
+
12
+        for(int i = 0; i < commandArr.length; i ++){
13
+            commands += i+1 + ". " + commandArr[i] + "\n";
14
+        }
15
+        commands = commands.trim();
16
+
17
+        printMessage(commands);
18
+    }
19
+
20
+    public static void printUpdateMenu(){
21
+        String[] commandArr = {"Name", "Password", "Quit"};
22
+
23
+        String commands = "";
24
+
25
+        for(int i = 0; i < commandArr.length; i ++){
26
+            commands += i+1 + ". " + commandArr[i] + "\n";
27
+        }
28
+        commands = commands.trim();
29
+
30
+        printMessage(commands);
31
+    }
32
+}

+ 33
- 0
src/test/java/AccountServiceTest.java View File

@@ -0,0 +1,33 @@
1
+import static org.junit.Assert.*;
2
+import com.j256.ormlite.dao.Dao;
3
+import org.junit.Before;
4
+import org.junit.Test;
5
+import java.sql.SQLException;
6
+import org.junit.Assert;
7
+
8
+public class AccountServiceTest {
9
+
10
+    MockDao mockDao = new MockDao();
11
+    AccountApp accountApp = new AccountApp(mockDao);
12
+    Account testAccount = new Account("Test", "Password");
13
+
14
+    @Before
15
+    public void setUp(){
16
+
17
+
18
+    }
19
+
20
+    @Test
21
+    public void createTest(){
22
+        try {
23
+
24
+            int expected = 1;
25
+            int actual = mockDao.create(testAccount);
26
+            Assert.assertEquals(expected, actual);
27
+        } catch (SQLException e) {
28
+            e.printStackTrace();
29
+        }
30
+
31
+    }
32
+
33
+}

BIN
target/.DS_Store View File


BIN
target/classes/Account.class View File


BIN
target/classes/AccountApp.class View File


BIN
target/classes/AccountService.class View File


BIN
target/classes/Console.class View File


BIN
target/classes/MockDao.class View File


BIN
target/classes/Printer.class View File