Merge lp:~emmanuel-florent/financisto/financisto1.6.7enhanced into lp:~financisto-dev/financisto/trunk
- financisto1.6.7enhanced
- Merge into trunk
Proposed by
Emmanuel Florent
Status: | Merged |
---|---|
Merged at revision: | 526 |
Proposed branch: | lp:~emmanuel-florent/financisto/financisto1.6.7enhanced |
Merge into: | lp:~financisto-dev/financisto/trunk |
Diff against target: |
1700 lines (+628/-637) 27 files modified
.bzrignore (+5/-1) .idea/ant.xml (+0/-7) .idea/compiler.xml (+0/-31) .idea/copyright/gpl2.xml (+0/-9) .idea/copyright/profiles_settings.xml (+0/-7) .idea/dictionaries/solomonk.xml (+0/-7) .idea/encodings.xml (+0/-5) .idea/misc.xml (+0/-39) .idea/modules.xml (+0/-12) .idea/scopes/scope_settings.xml (+0/-5) .idea/sqldialects.xml (+0/-20) .idea/uiDesigner.xml (+0/-125) .idea/vcs.xml (+0/-7) Financisto.iml (+0/-222) google-play-services_lib/google-play-services_lib.iml (+0/-29) project.properties (+1/-1) robotium_tests/robotium_tests.iml (+0/-33) src/ru/orangesoftware/financisto/activity/FlowzrSyncActivity.java (+17/-3) src/ru/orangesoftware/financisto/db/MyEntityManager.java (+2/-0) src/ru/orangesoftware/financisto/export/flowzr/FlowzrSyncEngine.java (+106/-46) src/ru/orangesoftware/financisto/export/flowzr/FlowzrSyncTask.java (+14/-1) src/ru/orangesoftware/financisto/model/Budget.java (+1/-1) src/ru/orangesoftware/financisto/service/FinancistoService.java (+0/-2) tests/project.properties (+1/-1) tests/src/ru/orangesoftware/financisto/export/FlowzrIntegrationTest.java (+480/-0) tests/src/ru/orangesoftware/financisto/test/CategoryBuilder.java (+1/-1) tests/tests.iml (+0/-22) |
To merge this branch: | bzr merge lp:~emmanuel-florent/financisto/financisto1.6.7enhanced |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Financisto Developers | Pending | ||
Review via email:
|
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Emmanuel Florent (emmanuel-florent) wrote : | # |
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file '.bzrignore' (properties changed: +x to -x) |
2 | --- .bzrignore 2014-01-11 06:52:17 +0000 |
3 | +++ .bzrignore 2014-06-25 21:52:59 +0000 |
4 | @@ -12,4 +12,8 @@ |
5 | tests/coverage.em |
6 | tests/coverage |
7 | robotium_tests/local.properties |
8 | -google-play-services_lib/gen |
9 | \ No newline at end of file |
10 | +google-play-services_lib/gen |
11 | +out |
12 | +lib |
13 | +Financisto.iml |
14 | +*.iml |
15 | |
16 | === removed directory '.idea' |
17 | === removed file '.idea/ant.xml' |
18 | --- .idea/ant.xml 2013-04-15 11:49:43 +0000 |
19 | +++ .idea/ant.xml 1970-01-01 00:00:00 +0000 |
20 | @@ -1,7 +0,0 @@ |
21 | -<?xml version="1.0" encoding="UTF-8"?> |
22 | -<project version="4"> |
23 | - <component name="AntConfiguration"> |
24 | - <buildFile url="file://$PROJECT_DIR$/tests/build.xml" /> |
25 | - </component> |
26 | -</project> |
27 | - |
28 | |
29 | === removed file '.idea/compiler.xml' |
30 | --- .idea/compiler.xml 2012-12-17 13:20:12 +0000 |
31 | +++ .idea/compiler.xml 1970-01-01 00:00:00 +0000 |
32 | @@ -1,31 +0,0 @@ |
33 | -<?xml version="1.0" encoding="UTF-8"?> |
34 | -<project version="4"> |
35 | - <component name="CompilerConfiguration"> |
36 | - <option name="DEFAULT_COMPILER" value="Javac" /> |
37 | - <excludeFromCompile> |
38 | - <directory url="file://$PROJECT_DIR$/GreenDroid/gen" includeSubdirectories="true" /> |
39 | - <directory url="file://$PROJECT_DIR$/gen" includeSubdirectories="true" /> |
40 | - <directory url="file://$PROJECT_DIR$/tests/gen" includeSubdirectories="true" /> |
41 | - <directory url="file://$PROJECT_DIR$/robotium_tests/gen" includeSubdirectories="true" /> |
42 | - </excludeFromCompile> |
43 | - <resourceExtensions /> |
44 | - <wildcardResourcePatterns> |
45 | - <entry name="?*.properties" /> |
46 | - <entry name="?*.xml" /> |
47 | - <entry name="?*.gif" /> |
48 | - <entry name="?*.png" /> |
49 | - <entry name="?*.jpeg" /> |
50 | - <entry name="?*.jpg" /> |
51 | - <entry name="?*.html" /> |
52 | - <entry name="?*.dtd" /> |
53 | - <entry name="?*.tld" /> |
54 | - <entry name="?*.ftl" /> |
55 | - </wildcardResourcePatterns> |
56 | - <annotationProcessing> |
57 | - <profile default="true" name="Default" enabled="false"> |
58 | - <processorPath useClasspath="true" /> |
59 | - </profile> |
60 | - </annotationProcessing> |
61 | - </component> |
62 | -</project> |
63 | - |
64 | |
65 | === removed directory '.idea/copyright' |
66 | === removed file '.idea/copyright/gpl2.xml' |
67 | --- .idea/copyright/gpl2.xml 2011-12-20 13:57:31 +0000 |
68 | +++ .idea/copyright/gpl2.xml 1970-01-01 00:00:00 +0000 |
69 | @@ -1,9 +0,0 @@ |
70 | -<component name="CopyrightManager"> |
71 | - <copyright> |
72 | - <option name="notice" value="Copyright (c) &#36;today.year Denis Solonenko. All rights reserved. This program and the accompanying materials are made available under the terms of the GNU Public License v2.0 which accompanies this distribution, and is available at http://www.gnu.org/licenses/old-licenses/gpl-2.0.html" /> |
73 | - <option name="keyword" value="Copyright" /> |
74 | - <option name="allowReplaceKeyword" value="" /> |
75 | - <option name="myName" value="gpl2" /> |
76 | - <option name="myLocal" value="true" /> |
77 | - </copyright> |
78 | -</component> |
79 | \ No newline at end of file |
80 | |
81 | === removed file '.idea/copyright/profiles_settings.xml' |
82 | --- .idea/copyright/profiles_settings.xml 2011-12-20 13:57:31 +0000 |
83 | +++ .idea/copyright/profiles_settings.xml 1970-01-01 00:00:00 +0000 |
84 | @@ -1,7 +0,0 @@ |
85 | -<component name="CopyrightManager"> |
86 | - <settings default=""> |
87 | - <module2copyright> |
88 | - <element module="All" copyright="gpl2" /> |
89 | - </module2copyright> |
90 | - </settings> |
91 | -</component> |
92 | \ No newline at end of file |
93 | |
94 | === removed directory '.idea/dictionaries' |
95 | === removed file '.idea/dictionaries/solomonk.xml' |
96 | --- .idea/dictionaries/solomonk.xml 2013-02-18 17:26:29 +0000 |
97 | +++ .idea/dictionaries/solomonk.xml 1970-01-01 00:00:00 +0000 |
98 | @@ -1,7 +0,0 @@ |
99 | -<component name="ProjectDictionaryState"> |
100 | - <dictionary name="solomonk"> |
101 | - <words> |
102 | - <w>stacktrace</w> |
103 | - </words> |
104 | - </dictionary> |
105 | -</component> |
106 | \ No newline at end of file |
107 | |
108 | === removed file '.idea/encodings.xml' |
109 | --- .idea/encodings.xml 2011-12-20 13:57:31 +0000 |
110 | +++ .idea/encodings.xml 1970-01-01 00:00:00 +0000 |
111 | @@ -1,5 +0,0 @@ |
112 | -<?xml version="1.0" encoding="UTF-8"?> |
113 | -<project version="4"> |
114 | - <component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" /> |
115 | -</project> |
116 | - |
117 | |
118 | === removed directory '.idea/libraries' |
119 | === removed file '.idea/misc.xml' |
120 | --- .idea/misc.xml 2014-01-11 06:52:17 +0000 |
121 | +++ .idea/misc.xml 1970-01-01 00:00:00 +0000 |
122 | @@ -1,39 +0,0 @@ |
123 | -<?xml version="1.0" encoding="UTF-8"?> |
124 | -<project version="4"> |
125 | - <component name="EntryPointsManager"> |
126 | - <entry_points version="2.0" /> |
127 | - </component> |
128 | - <component name="FacetAutodetectingManager"> |
129 | - <autodetection-disabled> |
130 | - <facet-type id="android"> |
131 | - <modules> |
132 | - <module name="GDocsAPI"> |
133 | - <files> |
134 | - <file url="file://$PROJECT_DIR$/../../android-gdocs-api/GDocsAPI/AndroidManifest.xml" /> |
135 | - </files> |
136 | - </module> |
137 | - <module name="test"> |
138 | - <files> |
139 | - <file url="file://$PROJECT_DIR$/test/AndroidManifest.xml" /> |
140 | - </files> |
141 | - </module> |
142 | - <module name="Tests"> |
143 | - <files> |
144 | - <file url="file://$PROJECT_DIR$/Tests/AndroidManifest.xml" /> |
145 | - </files> |
146 | - </module> |
147 | - </modules> |
148 | - </facet-type> |
149 | - </autodetection-disabled> |
150 | - </component> |
151 | - <component name="ProjectResources"> |
152 | - <default-html-doctype>http://www.w3.org/1999/xhtml</default-html-doctype> |
153 | - </component> |
154 | - <component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true" project-jdk-name="1.6" project-jdk-type="JavaSDK"> |
155 | - <output url="file://$PROJECT_DIR$/classes" /> |
156 | - </component> |
157 | - <component name="SvnBranchConfigurationManager"> |
158 | - <option name="mySupportsUserInfoFilter" value="true" /> |
159 | - </component> |
160 | -</project> |
161 | - |
162 | |
163 | === removed file '.idea/modules.xml' |
164 | --- .idea/modules.xml 2014-01-11 06:52:17 +0000 |
165 | +++ .idea/modules.xml 1970-01-01 00:00:00 +0000 |
166 | @@ -1,12 +0,0 @@ |
167 | -<?xml version="1.0" encoding="UTF-8"?> |
168 | -<project version="4"> |
169 | - <component name="ProjectModuleManager"> |
170 | - <modules> |
171 | - <module fileurl="file://$PROJECT_DIR$/Financisto.iml" filepath="$PROJECT_DIR$/Financisto.iml" /> |
172 | - <module fileurl="file://$PROJECT_DIR$/google-play-services_lib/google-play-services_lib.iml" filepath="$PROJECT_DIR$/google-play-services_lib/google-play-services_lib.iml" /> |
173 | - <module fileurl="file://$PROJECT_DIR$/robotium_tests/robotium_tests.iml" filepath="$PROJECT_DIR$/robotium_tests/robotium_tests.iml" /> |
174 | - <module fileurl="file://$PROJECT_DIR$/tests/tests.iml" filepath="$PROJECT_DIR$/tests/tests.iml" /> |
175 | - </modules> |
176 | - </component> |
177 | -</project> |
178 | - |
179 | |
180 | === removed directory '.idea/scopes' |
181 | === removed file '.idea/scopes/scope_settings.xml' |
182 | --- .idea/scopes/scope_settings.xml 2011-12-20 13:57:31 +0000 |
183 | +++ .idea/scopes/scope_settings.xml 1970-01-01 00:00:00 +0000 |
184 | @@ -1,5 +0,0 @@ |
185 | -<component name="DependencyValidationManager"> |
186 | - <state> |
187 | - <option name="SKIP_IMPORT_STATEMENTS" value="false" /> |
188 | - </state> |
189 | -</component> |
190 | \ No newline at end of file |
191 | |
192 | === removed file '.idea/sqldialects.xml' |
193 | --- .idea/sqldialects.xml 2013-07-14 08:33:04 +0000 |
194 | +++ .idea/sqldialects.xml 1970-01-01 00:00:00 +0000 |
195 | @@ -1,20 +0,0 @@ |
196 | -<?xml version="1.0" encoding="UTF-8"?> |
197 | -<project version="4"> |
198 | - <component name="SqlDialectMappings"> |
199 | - <file url="file://$PROJECT_DIR$/assets/database/view/010[v_all_transactions].sql" dialect="SQLite" /> |
200 | - <file url="file://$PROJECT_DIR$/assets/database/view/015[v_blotter_for_account_with_splits].sql" dialect="SQLite" /> |
201 | - <file url="file://$PROJECT_DIR$/assets/database/view/020[v_blotter].sql" dialect="SQLite" /> |
202 | - <file url="file://$PROJECT_DIR$/assets/database/view/021[v_blotter_for_account].sql" dialect="SQLite" /> |
203 | - <file url="file://$PROJECT_DIR$/assets/database/view/030[v_category].sql" dialect="SQLite" /> |
204 | - <file url="file://$PROJECT_DIR$/assets/database/view/035[v_category_list].sql" dialect="SQLite" /> |
205 | - <file url="file://$PROJECT_DIR$/assets/database/view/050[v_attributes].sql" dialect="SQLite" /> |
206 | - <file url="file://$PROJECT_DIR$/assets/database/view/060[v_report_category].sql" dialect="SQLite" /> |
207 | - <file url="file://$PROJECT_DIR$/assets/database/view/060[v_report_sub_category].sql" dialect="SQLite" /> |
208 | - <file url="file://$PROJECT_DIR$/assets/database/view/061[v_report_period].sql" dialect="SQLite" /> |
209 | - <file url="file://$PROJECT_DIR$/assets/database/view/062[v_report_location].sql" dialect="SQLite" /> |
210 | - <file url="file://$PROJECT_DIR$/assets/database/view/063[v_report_project].sql" dialect="SQLite" /> |
211 | - <file url="file://$PROJECT_DIR$/assets/database/view/064[v_report_payee].sql" dialect="SQLite" /> |
212 | - <file url="file://$PROJECT_DIR$/assets/database/view/080[v_transaction_attributes].sql" dialect="SQLite" /> |
213 | - </component> |
214 | -</project> |
215 | - |
216 | |
217 | === removed file '.idea/uiDesigner.xml' |
218 | --- .idea/uiDesigner.xml 2011-12-20 13:57:31 +0000 |
219 | +++ .idea/uiDesigner.xml 1970-01-01 00:00:00 +0000 |
220 | @@ -1,125 +0,0 @@ |
221 | -<?xml version="1.0" encoding="UTF-8"?> |
222 | -<project version="4"> |
223 | - <component name="Palette2"> |
224 | - <group name="Swing"> |
225 | - <item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false"> |
226 | - <default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" /> |
227 | - </item> |
228 | - <item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false"> |
229 | - <default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" /> |
230 | - </item> |
231 | - <item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false"> |
232 | - <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" /> |
233 | - </item> |
234 | - <item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true"> |
235 | - <default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" /> |
236 | - </item> |
237 | - <item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false"> |
238 | - <default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" /> |
239 | - <initial-values> |
240 | - <property name="text" value="Button" /> |
241 | - </initial-values> |
242 | - </item> |
243 | - <item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false"> |
244 | - <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" /> |
245 | - <initial-values> |
246 | - <property name="text" value="RadioButton" /> |
247 | - </initial-values> |
248 | - </item> |
249 | - <item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false"> |
250 | - <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" /> |
251 | - <initial-values> |
252 | - <property name="text" value="CheckBox" /> |
253 | - </initial-values> |
254 | - </item> |
255 | - <item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false"> |
256 | - <default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" /> |
257 | - <initial-values> |
258 | - <property name="text" value="Label" /> |
259 | - </initial-values> |
260 | - </item> |
261 | - <item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true"> |
262 | - <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1"> |
263 | - <preferred-size width="150" height="-1" /> |
264 | - </default-constraints> |
265 | - </item> |
266 | - <item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true"> |
267 | - <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1"> |
268 | - <preferred-size width="150" height="-1" /> |
269 | - </default-constraints> |
270 | - </item> |
271 | - <item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true"> |
272 | - <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1"> |
273 | - <preferred-size width="150" height="-1" /> |
274 | - </default-constraints> |
275 | - </item> |
276 | - <item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true"> |
277 | - <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> |
278 | - <preferred-size width="150" height="50" /> |
279 | - </default-constraints> |
280 | - </item> |
281 | - <item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true"> |
282 | - <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> |
283 | - <preferred-size width="150" height="50" /> |
284 | - </default-constraints> |
285 | - </item> |
286 | - <item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true"> |
287 | - <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> |
288 | - <preferred-size width="150" height="50" /> |
289 | - </default-constraints> |
290 | - </item> |
291 | - <item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true"> |
292 | - <default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" /> |
293 | - </item> |
294 | - <item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false"> |
295 | - <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> |
296 | - <preferred-size width="150" height="50" /> |
297 | - </default-constraints> |
298 | - </item> |
299 | - <item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false"> |
300 | - <default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3"> |
301 | - <preferred-size width="150" height="50" /> |
302 | - </default-constraints> |
303 | - </item> |
304 | - <item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false"> |
305 | - <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> |
306 | - <preferred-size width="150" height="50" /> |
307 | - </default-constraints> |
308 | - </item> |
309 | - <item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false"> |
310 | - <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3"> |
311 | - <preferred-size width="200" height="200" /> |
312 | - </default-constraints> |
313 | - </item> |
314 | - <item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false"> |
315 | - <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3"> |
316 | - <preferred-size width="200" height="200" /> |
317 | - </default-constraints> |
318 | - </item> |
319 | - <item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true"> |
320 | - <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" /> |
321 | - </item> |
322 | - <item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false"> |
323 | - <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" /> |
324 | - </item> |
325 | - <item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false"> |
326 | - <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" /> |
327 | - </item> |
328 | - <item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false"> |
329 | - <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" /> |
330 | - </item> |
331 | - <item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false"> |
332 | - <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1"> |
333 | - <preferred-size width="-1" height="20" /> |
334 | - </default-constraints> |
335 | - </item> |
336 | - <item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false"> |
337 | - <default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" /> |
338 | - </item> |
339 | - <item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false"> |
340 | - <default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" /> |
341 | - </item> |
342 | - </group> |
343 | - </component> |
344 | -</project> |
345 | - |
346 | |
347 | === removed file '.idea/vcs.xml' |
348 | --- .idea/vcs.xml 2011-12-20 13:57:31 +0000 |
349 | +++ .idea/vcs.xml 1970-01-01 00:00:00 +0000 |
350 | @@ -1,7 +0,0 @@ |
351 | -<?xml version="1.0" encoding="UTF-8"?> |
352 | -<project version="4"> |
353 | - <component name="VcsDirectoryMappings"> |
354 | - <mapping directory="" vcs="Bazaar" /> |
355 | - </component> |
356 | -</project> |
357 | - |
358 | |
359 | === removed file 'Financisto.iml' |
360 | --- Financisto.iml 2014-06-17 15:11:57 +0000 |
361 | +++ Financisto.iml 1970-01-01 00:00:00 +0000 |
362 | @@ -1,222 +0,0 @@ |
363 | -<?xml version="1.0" encoding="UTF-8"?> |
364 | -<module type="JAVA_MODULE" version="4"> |
365 | - <component name="EclipseModuleManager"> |
366 | - <libelement value="jar://$MODULE_DIR$/lib/rfc2445-no-joda.jar!/" /> |
367 | - <libelement value="jar://$MODULE_DIR$/lib/GDocsAPI.jar!/" /> |
368 | - <libelement value="jar://$MODULE_DIR$/lib/CWAC-WakefulIntentService.jar!/" /> |
369 | - <conelement value="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK" /> |
370 | - <src_description expected_position="0"> |
371 | - <src_folder value="file://$MODULE_DIR$/gen" expected_position="0" /> |
372 | - <src_folder value="file://$MODULE_DIR$/src" expected_position="1" /> |
373 | - </src_description> |
374 | - </component> |
375 | - <component name="FacetManager"> |
376 | - <facet type="android" name="Android"> |
377 | - <configuration> |
378 | - <option name="UPDATE_PROPERTY_FILES" value="true" /> |
379 | - <includeAssetsFromLibraries>true</includeAssetsFromLibraries> |
380 | - </configuration> |
381 | - </facet> |
382 | - </component> |
383 | - <component name="NewModuleRootManager" inherit-compiler-output="false"> |
384 | - <output url="file://$MODULE_DIR$/bin" /> |
385 | - <exclude-output /> |
386 | - <content url="file://$MODULE_DIR$"> |
387 | - <sourceFolder url="file://$MODULE_DIR$/gen" isTestSource="false" generated="true" /> |
388 | - <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> |
389 | - </content> |
390 | - <orderEntry type="sourceFolder" forTests="false" /> |
391 | - <orderEntry type="jdk" jdkName="Android 2.2 Google APIs" jdkType="Android SDK" /> |
392 | - <orderEntry type="module-library"> |
393 | - <library> |
394 | - <CLASSES> |
395 | - <root url="jar://$MODULE_DIR$/libs/achartengine-1.0.0.jar!/" /> |
396 | - </CLASSES> |
397 | - <JAVADOC /> |
398 | - <SOURCES /> |
399 | - </library> |
400 | - </orderEntry> |
401 | - <orderEntry type="module-library"> |
402 | - <library> |
403 | - <CLASSES> |
404 | - <root url="jar://$MODULE_DIR$/libs/CWAC-WakefulIntentService.jar!/" /> |
405 | - </CLASSES> |
406 | - <JAVADOC /> |
407 | - <SOURCES /> |
408 | - </library> |
409 | - </orderEntry> |
410 | - <orderEntry type="module-library"> |
411 | - <library> |
412 | - <CLASSES> |
413 | - <root url="jar://$MODULE_DIR$/libs/httpmime-4.0.3.jar!/" /> |
414 | - </CLASSES> |
415 | - <JAVADOC /> |
416 | - <SOURCES /> |
417 | - </library> |
418 | - </orderEntry> |
419 | - <orderEntry type="module-library"> |
420 | - <library> |
421 | - <CLASSES> |
422 | - <root url="jar://$MODULE_DIR$/libs/json_simple-1.1.jar!/" /> |
423 | - </CLASSES> |
424 | - <JAVADOC /> |
425 | - <SOURCES /> |
426 | - </library> |
427 | - </orderEntry> |
428 | - <orderEntry type="module-library" exported=""> |
429 | - <library> |
430 | - <CLASSES> |
431 | - <root url="jar://$MODULE_DIR$/libs/rfc2445-no-joda.jar!/" /> |
432 | - </CLASSES> |
433 | - <JAVADOC /> |
434 | - <SOURCES /> |
435 | - </library> |
436 | - </orderEntry> |
437 | - <orderEntry type="module-library"> |
438 | - <library> |
439 | - <CLASSES> |
440 | - <root url="jar://$MODULE_DIR$/libs/trove-3.0.2-long.jar!/" /> |
441 | - </CLASSES> |
442 | - <JAVADOC /> |
443 | - <SOURCES /> |
444 | - </library> |
445 | - </orderEntry> |
446 | - <orderEntry type="module-library"> |
447 | - <library> |
448 | - <CLASSES> |
449 | - <root url="jar://$MODULE_DIR$/libs/gson-2.2.4.jar!/" /> |
450 | - </CLASSES> |
451 | - <JAVADOC /> |
452 | - <SOURCES /> |
453 | - </library> |
454 | - </orderEntry> |
455 | - <orderEntry type="module-library"> |
456 | - <library> |
457 | - <CLASSES> |
458 | - <root url="jar://$MODULE_DIR$/libs/android-support-v4.jar!/" /> |
459 | - </CLASSES> |
460 | - <JAVADOC /> |
461 | - <SOURCES /> |
462 | - </library> |
463 | - </orderEntry> |
464 | - <orderEntry type="module-library"> |
465 | - <library> |
466 | - <CLASSES> |
467 | - <root url="jar://$MODULE_DIR$/libs/commons-logging-1.1.1.jar!/" /> |
468 | - </CLASSES> |
469 | - <JAVADOC /> |
470 | - <SOURCES /> |
471 | - </library> |
472 | - </orderEntry> |
473 | - <orderEntry type="module-library"> |
474 | - <library> |
475 | - <CLASSES> |
476 | - <root url="jar://$MODULE_DIR$/libs/google-api-client-1.17.0-rc.jar!/" /> |
477 | - </CLASSES> |
478 | - <JAVADOC /> |
479 | - <SOURCES /> |
480 | - </library> |
481 | - </orderEntry> |
482 | - <orderEntry type="module-library"> |
483 | - <library> |
484 | - <CLASSES> |
485 | - <root url="jar://$MODULE_DIR$/libs/google-api-client-android-1.17.0-rc.jar!/" /> |
486 | - </CLASSES> |
487 | - <JAVADOC /> |
488 | - <SOURCES /> |
489 | - </library> |
490 | - </orderEntry> |
491 | - <orderEntry type="module-library"> |
492 | - <library> |
493 | - <CLASSES> |
494 | - <root url="jar://$MODULE_DIR$/libs/google-api-services-drive-v2-rev100-1.17.0-rc.jar!/" /> |
495 | - </CLASSES> |
496 | - <JAVADOC /> |
497 | - <SOURCES /> |
498 | - </library> |
499 | - </orderEntry> |
500 | - <orderEntry type="module-library"> |
501 | - <library> |
502 | - <CLASSES> |
503 | - <root url="jar://$MODULE_DIR$/libs/google-http-client-1.17.0-rc.jar!/" /> |
504 | - </CLASSES> |
505 | - <JAVADOC /> |
506 | - <SOURCES /> |
507 | - </library> |
508 | - </orderEntry> |
509 | - <orderEntry type="module-library"> |
510 | - <library> |
511 | - <CLASSES> |
512 | - <root url="jar://$MODULE_DIR$/libs/google-http-client-android-1.17.0-rc.jar!/" /> |
513 | - </CLASSES> |
514 | - <JAVADOC /> |
515 | - <SOURCES /> |
516 | - </library> |
517 | - </orderEntry> |
518 | - <orderEntry type="module-library"> |
519 | - <library> |
520 | - <CLASSES> |
521 | - <root url="jar://$MODULE_DIR$/libs/google-http-client-gson-1.17.0-rc.jar!/" /> |
522 | - </CLASSES> |
523 | - <JAVADOC /> |
524 | - <SOURCES /> |
525 | - </library> |
526 | - </orderEntry> |
527 | - <orderEntry type="module-library"> |
528 | - <library> |
529 | - <CLASSES> |
530 | - <root url="jar://$MODULE_DIR$/libs/google-http-client-jackson2-1.17.0-rc.jar!/" /> |
531 | - </CLASSES> |
532 | - <JAVADOC /> |
533 | - <SOURCES /> |
534 | - </library> |
535 | - </orderEntry> |
536 | - <orderEntry type="module-library"> |
537 | - <library> |
538 | - <CLASSES> |
539 | - <root url="jar://$MODULE_DIR$/libs/google-oauth-client-1.17.0-rc.jar!/" /> |
540 | - </CLASSES> |
541 | - <JAVADOC /> |
542 | - <SOURCES /> |
543 | - </library> |
544 | - </orderEntry> |
545 | - <orderEntry type="module-library"> |
546 | - <library> |
547 | - <CLASSES> |
548 | - <root url="jar://$MODULE_DIR$/libs/httpclient-4.0.3.jar!/" /> |
549 | - </CLASSES> |
550 | - <JAVADOC /> |
551 | - <SOURCES /> |
552 | - </library> |
553 | - </orderEntry> |
554 | - <orderEntry type="module-library"> |
555 | - <library> |
556 | - <CLASSES> |
557 | - <root url="jar://$MODULE_DIR$/libs/httpcore-4.0.1.jar!/" /> |
558 | - </CLASSES> |
559 | - <JAVADOC /> |
560 | - <SOURCES /> |
561 | - </library> |
562 | - </orderEntry> |
563 | - <orderEntry type="module" module-name="google-play-services_lib" /> |
564 | - <orderEntry type="module-library"> |
565 | - <library> |
566 | - <CLASSES> |
567 | - <root url="jar://$MODULE_DIR$/libs/dropbox-android-sdk-1.5.4.jar!/" /> |
568 | - </CLASSES> |
569 | - <JAVADOC /> |
570 | - <SOURCES /> |
571 | - </library> |
572 | - </orderEntry> |
573 | - <orderEntry type="module-library"> |
574 | - <library> |
575 | - <CLASSES> |
576 | - <root url="jar://$MODULE_DIR$/libs/eventbus-2.2.0.jar!/" /> |
577 | - </CLASSES> |
578 | - <JAVADOC /> |
579 | - <SOURCES /> |
580 | - </library> |
581 | - </orderEntry> |
582 | - </component> |
583 | -</module> |
584 | - |
585 | |
586 | === removed file 'google-play-services_lib/google-play-services_lib.iml' |
587 | --- google-play-services_lib/google-play-services_lib.iml 2014-06-17 15:11:57 +0000 |
588 | +++ google-play-services_lib/google-play-services_lib.iml 1970-01-01 00:00:00 +0000 |
589 | @@ -1,29 +0,0 @@ |
590 | -<?xml version="1.0" encoding="UTF-8"?> |
591 | -<module type="JAVA_MODULE" version="4"> |
592 | - <component name="FacetManager"> |
593 | - <facet type="android" name="Android"> |
594 | - <configuration> |
595 | - <option name="LIBRARY_PROJECT" value="true" /> |
596 | - </configuration> |
597 | - </facet> |
598 | - </component> |
599 | - <component name="NewModuleRootManager" inherit-compiler-output="true"> |
600 | - <exclude-output /> |
601 | - <content url="file://$MODULE_DIR$"> |
602 | - <sourceFolder url="file://$MODULE_DIR$/gen" isTestSource="false" generated="true" /> |
603 | - <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> |
604 | - </content> |
605 | - <orderEntry type="jdk" jdkName="Android 2.2 Platform" jdkType="Android SDK" /> |
606 | - <orderEntry type="sourceFolder" forTests="false" /> |
607 | - <orderEntry type="module-library" exported=""> |
608 | - <library> |
609 | - <CLASSES> |
610 | - <root url="jar://$MODULE_DIR$/libs/google-play-services.jar!/" /> |
611 | - </CLASSES> |
612 | - <JAVADOC /> |
613 | - <SOURCES /> |
614 | - </library> |
615 | - </orderEntry> |
616 | - </component> |
617 | -</module> |
618 | - |
619 | |
620 | === modified file 'project.properties' |
621 | --- project.properties 2014-06-17 15:17:07 +0000 |
622 | +++ project.properties 2014-06-25 21:52:59 +0000 |
623 | @@ -22,7 +22,7 @@ |
624 | # Indicates whether an apk should be generated for each density. |
625 | split.density=false |
626 | # Project target. |
627 | -target=Google Inc.:Google APIs:8 |
628 | +target=Google Inc.:Google APIs (x86 System Image):19 |
629 | apk-configurations= |
630 | android.library.reference.1=google-play-services_lib |
631 | |
632 | |
633 | === removed file 'robotium_tests/robotium_tests.iml' |
634 | --- robotium_tests/robotium_tests.iml 2014-06-17 15:11:57 +0000 |
635 | +++ robotium_tests/robotium_tests.iml 1970-01-01 00:00:00 +0000 |
636 | @@ -1,33 +0,0 @@ |
637 | -<?xml version="1.0" encoding="UTF-8"?> |
638 | -<module type="JAVA_MODULE" version="4"> |
639 | - <component name="FacetManager"> |
640 | - <facet type="android" name="Android"> |
641 | - <configuration> |
642 | - <option name="PACK_TEST_CODE" value="true" /> |
643 | - <includeAssetsFromLibraries>true</includeAssetsFromLibraries> |
644 | - </configuration> |
645 | - </facet> |
646 | - </component> |
647 | - <component name="NewModuleRootManager" inherit-compiler-output="true"> |
648 | - <exclude-output /> |
649 | - <content url="file://$MODULE_DIR$"> |
650 | - <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> |
651 | - <sourceFolder url="file://$MODULE_DIR$/gen" isTestSource="false" generated="true" /> |
652 | - </content> |
653 | - <orderEntry type="jdk" jdkName="Android 4.0.3 Platform" jdkType="Android SDK" /> |
654 | - <orderEntry type="sourceFolder" forTests="false" /> |
655 | - <orderEntry type="module" module-name="Financisto" scope="PROVIDED" /> |
656 | - <orderEntry type="module-library" exported=""> |
657 | - <library> |
658 | - <CLASSES> |
659 | - <root url="jar://$MODULE_DIR$/libs/robotium-solo-3.4.1.jar!/" /> |
660 | - </CLASSES> |
661 | - <JAVADOC> |
662 | - <root url="jar://$MODULE_DIR$/libs/robotium-solo-3.4.1-javadoc.jar!/" /> |
663 | - </JAVADOC> |
664 | - <SOURCES /> |
665 | - </library> |
666 | - </orderEntry> |
667 | - </component> |
668 | -</module> |
669 | - |
670 | |
671 | === modified file 'src/ru/orangesoftware/financisto/activity/FlowzrSyncActivity.java' |
672 | --- src/ru/orangesoftware/financisto/activity/FlowzrSyncActivity.java 2014-05-17 06:59:48 +0000 |
673 | +++ src/ru/orangesoftware/financisto/activity/FlowzrSyncActivity.java 2014-06-25 21:52:59 +0000 |
674 | @@ -187,18 +187,32 @@ |
675 | }) |
676 | .show(); |
677 | } |
678 | - //radio crendentials |
679 | + //checkbox |
680 | + CheckBox chk=(CheckBox)findViewById(R.id.chk_sync_from_zero); |
681 | + OnClickListener chk_listener = new OnClickListener() { |
682 | + public void onClick(View v) { |
683 | + lastSyncLocalTimestamp=0; |
684 | + renderLastTime(0); |
685 | + flowzrSyncEngine.resetLastTime(getApplicationContext()); |
686 | + } |
687 | + }; |
688 | + chk.setOnClickListener(chk_listener); |
689 | + //radio crendentials |
690 | RadioGroup radioGroupCredentials = (RadioGroup)findViewById(R.id.radioCredentials); |
691 | OnClickListener radio_listener = new OnClickListener() { |
692 | public void onClick(View v) { |
693 | RadioButton radioButtonSelected = (RadioButton)findViewById(v.getId()); |
694 | for (Account account: accounts) { |
695 | if (account.name==radioButtonSelected.getText()) { |
696 | - useCredential=account; |
697 | + lastSyncLocalTimestamp=0; |
698 | + renderLastTime(0); |
699 | + flowzrSyncEngine.resetLastTime(getApplicationContext()); |
700 | + useCredential=account; |
701 | } |
702 | } |
703 | } |
704 | - }; |
705 | + }; |
706 | + radioGroupCredentials.setOnClickListener(radio_listener); |
707 | //initialize value |
708 | for (int i = 0; i < accounts.length; i++) { |
709 | RadioButton rb = new RadioButton(this); |
710 | |
711 | === modified file 'src/ru/orangesoftware/financisto/db/MyEntityManager.java' |
712 | --- src/ru/orangesoftware/financisto/db/MyEntityManager.java 2014-01-20 16:30:18 +0000 |
713 | +++ src/ru/orangesoftware/financisto/db/MyEntityManager.java 2014-06-25 21:52:59 +0000 |
714 | @@ -412,6 +412,8 @@ |
715 | |
716 | public long insertBudget(Budget budget) { |
717 | SQLiteDatabase db = db(); |
718 | + budget.remoteKey=null; |
719 | + |
720 | db.beginTransaction(); |
721 | try { |
722 | if (budget.id > 0) { |
723 | |
724 | === modified file 'src/ru/orangesoftware/financisto/export/flowzr/FlowzrSyncEngine.java' |
725 | --- src/ru/orangesoftware/financisto/export/flowzr/FlowzrSyncEngine.java 2014-05-17 06:57:53 +0000 |
726 | +++ src/ru/orangesoftware/financisto/export/flowzr/FlowzrSyncEngine.java 2014-06-25 21:52:59 +0000 |
727 | @@ -9,13 +9,7 @@ |
728 | */ |
729 | |
730 | |
731 | -import java.io.BufferedReader; |
732 | -import java.io.IOException; |
733 | -import java.io.InputStream; |
734 | -import java.io.InputStreamReader; |
735 | -import java.io.PrintWriter; |
736 | -import java.io.StringWriter; |
737 | -import java.io.UnsupportedEncodingException; |
738 | +import java.io.*; |
739 | import java.util.ArrayList; |
740 | import java.util.Collection; |
741 | import java.util.Date; |
742 | @@ -24,6 +18,7 @@ |
743 | import java.util.Map; |
744 | import java.util.TimeZone; |
745 | |
746 | +import com.google.api.client.json.JsonParser; |
747 | import org.apache.http.HttpEntity; |
748 | import org.apache.http.HttpResponse; |
749 | import org.apache.http.NameValuePair; |
750 | @@ -32,9 +27,12 @@ |
751 | import org.apache.http.client.methods.HttpGet; |
752 | import org.apache.http.client.methods.HttpPost; |
753 | import org.apache.http.entity.StringEntity; |
754 | +import org.apache.http.impl.client.BasicCookieStore; |
755 | import org.apache.http.impl.client.DefaultHttpClient; |
756 | import org.apache.http.message.BasicNameValuePair; |
757 | import org.apache.http.protocol.HTTP; |
758 | +import org.apache.http.protocol.HttpContext; |
759 | +import org.apache.http.util.EntityUtils; |
760 | import org.json.JSONArray; |
761 | import org.json.JSONException; |
762 | import org.json.JSONObject; |
763 | @@ -47,6 +45,7 @@ |
764 | import ru.orangesoftware.financisto.db.DatabaseHelper; |
765 | import ru.orangesoftware.financisto.db.MyEntityManager; |
766 | import ru.orangesoftware.financisto.export.flowzr.FlowzrSyncTask.GetAuthTokenCallback; |
767 | +import ru.orangesoftware.financisto.filter.WhereFilter; |
768 | import ru.orangesoftware.financisto.model.Account; |
769 | import ru.orangesoftware.financisto.model.Attribute; |
770 | import ru.orangesoftware.financisto.model.Budget; |
771 | @@ -87,11 +86,11 @@ |
772 | public class FlowzrSyncEngine { |
773 | private static String TAG="flowzr"; |
774 | private final static String FLOWZR_MSG_NET_ERROR="FLOWZR_MSG_NET_ERROR"; |
775 | - |
776 | - private static SQLiteDatabase db; |
777 | - private static DatabaseAdapter dba; |
778 | + public static HttpContext ctx; |
779 | + public static SQLiteDatabase db; |
780 | + public static DatabaseAdapter dba; |
781 | |
782 | - private static MyEntityManager em; |
783 | + public static MyEntityManager em; |
784 | static InputStream isHttpcontent = null; |
785 | static JSONObject jObj = null; |
786 | static String json = ""; |
787 | @@ -99,8 +98,8 @@ |
788 | |
789 | private static Context context; |
790 | |
791 | - private static String[] tableNames= {"attributes","currency","project","payee","account","LOCATIONS","category","transactions",DatabaseHelper.BUDGET_TABLE, "currency_exchange_rate"}; |
792 | - private static Class[] clazzArray = {Attribute.class,Currency.class,Project.class,Payee.class,Account.class,MyLocation.class,Category.class,Transaction.class,Budget.class,ExchangeRate.class}; |
793 | + private static String[] tableNames= {"attributes","currency","project","payee","account","LOCATIONS","category","transactions",DatabaseHelper.BUDGET_TABLE, "currency_exchange_rate"}; |
794 | + private static Class[] clazzArray = {Attribute.class,Currency.class,Project.class,Payee.class,Account.class,MyLocation.class,Category.class,Transaction.class,Budget.class,ExchangeRate.class}; |
795 | |
796 | private static int MAX_PULL_SIZE=50; |
797 | private static int MAX_PUSH_SIZE=20; |
798 | @@ -242,15 +241,19 @@ |
799 | try { |
800 | pushUpdate(); |
801 | } catch (ClientProtocolException e) { |
802 | + e.printStackTrace(); |
803 | sendBackTrace(e); |
804 | recordSyncTime=false; |
805 | } catch (IOException e) { |
806 | + e.printStackTrace(); |
807 | sendBackTrace(e); |
808 | recordSyncTime=false; |
809 | } catch (JSONException e) { |
810 | + e.printStackTrace(); |
811 | sendBackTrace(e); |
812 | recordSyncTime=false; |
813 | } catch (Exception e) { |
814 | + e.printStackTrace(); |
815 | recordSyncTime=false; |
816 | } |
817 | } |
818 | @@ -333,8 +336,8 @@ |
819 | |
820 | } |
821 | |
822 | - public static void resetLastTime () { |
823 | - SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(context).edit(); |
824 | + public static void resetLastTime (Context ctx) { |
825 | + SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(ctx).edit(); |
826 | if (editor!=null) { |
827 | editor.putLong("PROPERTY_LAST_SYNC_TIMESTAMP", 0); |
828 | editor.commit(); |
829 | @@ -419,18 +422,31 @@ |
830 | } |
831 | } |
832 | |
833 | - private static <T extends MyEntity> void pushUpdate(String tableName,Class<T> clazz) throws ClientProtocolException, IOException, JSONException, Exception { |
834 | + public static <T extends Object> void pushUpdate(String tableName,Class<T> clazz) throws ClientProtocolException, IOException, JSONException, Exception { |
835 | SQLiteDatabase db2=dba.db(); |
836 | Cursor cursorCursor; |
837 | String sql; |
838 | long total; |
839 | |
840 | - sql="select count(*) from " + tableName + " where updated_on<0 or (updated_on > " + last_sync_ts + " and updated_on<" + startTimestamp + ")" ; |
841 | + sql="select count(*) from " + tableName + " where updated_on<=0 or remote_key is null or (updated_on > " + last_sync_ts ; |
842 | + if (!tableName.equals(DatabaseHelper.BUDGET_TABLE)) { |
843 | + sql=sql+ " and updated_on<" + startTimestamp + ")" ; |
844 | + } else { |
845 | + sql=sql+ ")"; |
846 | + } |
847 | + |
848 | cursorCursor=db.rawQuery(sql, null); |
849 | cursorCursor.moveToFirst(); |
850 | total=cursorCursor.getLong(0); |
851 | - sql="select * from " + tableName + " where updated_on<0 or (updated_on > " + last_sync_ts + " and updated_on<" + startTimestamp + ")"; |
852 | - |
853 | + |
854 | + |
855 | + sql="select * from " + tableName + " where updated_on<=0 or remote_key is null or (updated_on > " + last_sync_ts ; |
856 | + if (!tableName.equals(DatabaseHelper.BUDGET_TABLE)) { |
857 | + sql=sql+ " and updated_on<" + startTimestamp + ")" ; |
858 | + } else { |
859 | + sql=sql+ ")"; |
860 | + } |
861 | + |
862 | if (tableName.equals(DatabaseHelper.TRANSACTION_TABLE)) { |
863 | sql+= " order by parent_id asc,_id asc"; |
864 | } else if (tableName.equals(DatabaseHelper.BUDGET_TABLE)) { |
865 | @@ -443,10 +459,11 @@ |
866 | JSONArray resultSet = new JSONArray(); |
867 | |
868 | int i=0; |
869 | - if (cursorCursor.moveToFirst() && isCanceled!=true) { |
870 | + if (cursorCursor.moveToFirst() && isCanceled!=true) { |
871 | + Log.i("flowzr","pushing " + tableName); |
872 | do { |
873 | if (i%10==0) { |
874 | - notifyUser(context.getString(R.string.flowzr_sync_sending) + " " + tableName, (int)(Math.round(i*100/total))); |
875 | + //notifyUser(context.getString(R.string.flowzr_sync_sending) + " " + tableName, (int)(Math.round(i*100/total))); |
876 | } |
877 | resultSet.put(cursorToDict(tableName,cursorCursor)); |
878 | i++; |
879 | @@ -467,8 +484,10 @@ |
880 | String resp=makeRequest(tableName, resultSet.toString()); |
881 | if (resp.equals(FLOWZR_MSG_NET_ERROR)) { |
882 | isCanceled=true; |
883 | + Log.e("flowzr",resp); |
884 | } |
885 | if (isCanceled) { |
886 | + Log.i("flowzr","sync canceled!"); |
887 | return ; |
888 | } |
889 | } |
890 | @@ -483,8 +502,10 @@ |
891 | String strResponse; |
892 | |
893 | HttpPost httpPost = new HttpPost(uri); |
894 | + |
895 | httpPost.setEntity(new StringEntity(json,HTTP.UTF_8)); |
896 | - httpPost.setHeader("Accept", "application/json"); |
897 | + httpPost.addHeader("Cookie","dev_appserver_login=test@example.com:False:18580476422013912411"); |
898 | + |
899 | HttpResponse response =http_client.execute(httpPost); |
900 | HttpEntity entity = response.getEntity(); |
901 | int code = response.getStatusLine().getStatusCode(); |
902 | @@ -566,10 +587,11 @@ |
903 | } else if (tableName.equals(DatabaseHelper.CATEGORY_TABLE)) { |
904 | //load parent id |
905 | Category cat=dba.getCategory(c.getInt(0)); // sql build/load parentId |
906 | - if (cat.getParentId()>KEY_CREATE) { |
907 | - Category pcat=em.load(Category.class, cat.getParentId()); |
908 | - rowObject.put( "parent" , pcat.remoteKey); |
909 | - rowObject.put( "parent_id" , pcat.id); |
910 | + if (cat.getParentId()>0) { |
911 | + Category pcat = em.load(Category.class, cat.getParentId()); |
912 | + rowObject.put("parent", pcat.remoteKey); |
913 | + rowObject.put("parent_id", pcat.id); |
914 | + |
915 | } |
916 | String attrPushString=""; |
917 | |
918 | @@ -639,7 +661,7 @@ |
919 | * it is not possible to make alter table add column updated with a default timestamp at current_timestamp |
920 | * so default is set as zero and this pre-sync function make all 0 at last_sync_ts + 1 |
921 | */ |
922 | - private static void fixCreatedEntities() { |
923 | + public static void fixCreatedEntities() { |
924 | long ctime=last_sync_ts + 1; |
925 | for (String t : tableNames) { |
926 | db.execSQL("update " + t + " set updated_on=" + ctime + " where updated_on=0"); |
927 | @@ -764,7 +786,7 @@ |
928 | return null; |
929 | } |
930 | |
931 | - private static Object pushDelete() throws Exception { |
932 | + public static Object pushDelete() throws Exception { |
933 | String sql="select count(*) from " + DatabaseHelper.DELETE_LOG_TABLE ; |
934 | Cursor cursorCursor=db.rawQuery(sql, null); |
935 | cursorCursor.moveToFirst(); |
936 | @@ -775,7 +797,7 @@ |
937 | String del_list=""; |
938 | if (cursor.moveToFirst()) { |
939 | do { |
940 | - notifyUser("push delete",(int)(Math.round(i*100/total))); |
941 | + //notifyUser("push delete",(int)(Math.round(i*100/total))); |
942 | del_list+=cursor.getString(1) + ";"; |
943 | i++; |
944 | } while (cursor.moveToNext()); |
945 | @@ -858,12 +880,13 @@ |
946 | } |
947 | } |
948 | |
949 | - public static <T> Object saveOrUpdateCategoryFromJSON(long id,JSONObject jsonObjectEntity) { |
950 | + public static <T> Object saveOrUpdateCategoryFromJSON(long id,JSONObject jsonObjectEntity) { |
951 | + |
952 | if (!jsonObjectEntity.has("name")) { |
953 | return null; |
954 | } |
955 | Category tEntity=new Category(KEY_CREATE); |
956 | - if (id != KEY_CREATE) { |
957 | + if (id != KEY_CREATE && id!=-2) { |
958 | tEntity = dba.getCategory(id); |
959 | } |
960 | //--- |
961 | @@ -882,7 +905,12 @@ |
962 | e.printStackTrace(); |
963 | } |
964 | } |
965 | - ArrayList<Attribute> attributes = new ArrayList<Attribute>(); |
966 | + |
967 | + if (jsonObjectEntity.has("type") ) { |
968 | + tEntity.type=jsonObjectEntity.getInt("type"); |
969 | + } |
970 | + |
971 | + ArrayList<Attribute> attributes = new ArrayList<Attribute>(); |
972 | if (jsonObjectEntity.has("attributes") ) { |
973 | for (String attr_key: jsonObjectEntity.getString("attributes").split(";")) { |
974 | int l=(int) getLocalKey(DatabaseHelper.ATTRIBUTES_TABLE, attr_key); |
975 | @@ -892,10 +920,16 @@ |
976 | } |
977 | } |
978 | } |
979 | - //updated on + remote key |
980 | - em.saveOrUpdate(tEntity); |
981 | + |
982 | + String r=tEntity.remoteKey; |
983 | + |
984 | //left, right |
985 | dba.insertOrUpdate(tEntity, attributes); |
986 | + String sql="update category set remote_key='"+ r + "' where _id="+ tEntity.id ; |
987 | + db.execSQL(sql); |
988 | + |
989 | + |
990 | + |
991 | |
992 | |
993 | return tEntity; |
994 | @@ -1293,9 +1327,13 @@ |
995 | tEntity.issuer=jsonObjectAccount.getString(DatabaseHelper.AccountColumns.ISSUER); |
996 | } |
997 | //number |
998 | - if (jsonObjectAccount.has("iban")) { |
999 | - tEntity.number=jsonObjectAccount.getString("iban"); |
1000 | + if (jsonObjectAccount.has("code")) { |
1001 | + tEntity.number=jsonObjectAccount.getString("code"); |
1002 | } |
1003 | + //limit |
1004 | + if (jsonObjectAccount.has("total_limit")) { |
1005 | + tEntity.limitAmount=jsonObjectAccount.getLong("total_limit"); |
1006 | + } |
1007 | //is_active |
1008 | if (jsonObjectAccount.has("closed")) { |
1009 | if (jsonObjectAccount.getBoolean("closed")) { |
1010 | @@ -1562,7 +1600,7 @@ |
1011 | } |
1012 | } |
1013 | |
1014 | - private static void pullUpdate() throws IOException, JSONException, Exception { |
1015 | + private static void pullUpdate() throws IOException, JSONException, Exception { |
1016 | int i=0; |
1017 | for (String tableName : tableNames) { |
1018 | Log.i("flowzr", context.getString(R.string.flowzr_sync_receiving) + " " + tableName ); |
1019 | @@ -1571,7 +1609,7 @@ |
1020 | notifyUser(context.getString(R.string.flowzr_sync_receiving) + " " + tableName + ". " + context.getString(R.string.hint_run_background), (int)(Math.round(i*100/tableNames.length))); |
1021 | } else { |
1022 | notifyUser(context.getString(R.string.flowzr_sync_receiving) + " " + tableName, (int)(Math.round(i*100/tableNames.length))); |
1023 | - } |
1024 | + } |
1025 | if (!isCanceled) { |
1026 | pullUpdate(tableName,clazzArray[i],last_sync_ts); |
1027 | } |
1028 | @@ -1579,7 +1617,7 @@ |
1029 | } |
1030 | } |
1031 | |
1032 | - private static <T> void pullUpdate(String tableName,Class<T> clazz,long last_sync_ts) throws IOException, JSONException, Exception { |
1033 | + public static <T> void pullUpdate(String tableName,Class<T> clazz,long last_sync_ts) throws IOException, JSONException, Exception { |
1034 | |
1035 | if (tableName.equals(DatabaseHelper.TRANSACTION_TABLE)) { |
1036 | //pull all remote accounts, accounts by accounts |
1037 | @@ -1605,15 +1643,31 @@ |
1038 | if (url==null) { |
1039 | return 0; |
1040 | } |
1041 | - HttpGet httpGet = new HttpGet(url); |
1042 | + |
1043 | + HttpGet httpGet = new HttpGet(url); |
1044 | + httpGet.addHeader("Cookie","dev_appserver_login=test@example.com:False:185804764220139124118"); |
1045 | HttpResponse httpResponse = http_client.execute(httpGet); |
1046 | + |
1047 | HttpEntity httpEntity = httpResponse.getEntity(); |
1048 | - is = httpEntity.getContent(); |
1049 | - reader = new JsonReader(new InputStreamReader(is, "UTF-8")); |
1050 | + |
1051 | + // All the work is done for you here :) |
1052 | + String jsonContent = EntityUtils.toString(httpEntity); |
1053 | + |
1054 | + // Create a Reader from String |
1055 | + Reader stringReader = new StringReader(jsonContent); |
1056 | + |
1057 | + //is = httpEntity.getContent(); |
1058 | + |
1059 | + reader = new JsonReader(stringReader); |
1060 | + reader.setLenient(true); |
1061 | + |
1062 | reader.beginObject(); |
1063 | - int i=readMessage(reader,tableName,clazz,last_sync_ts); |
1064 | - httpEntity.consumeContent(); |
1065 | + |
1066 | + int i = readMessage(reader, tableName, clazz, last_sync_ts); |
1067 | + httpEntity.consumeContent(); |
1068 | return i; |
1069 | + |
1070 | + |
1071 | } |
1072 | |
1073 | public static <T> void getJSONFromUrl2(String url,String tableName,String account_key, Class<T> clazz,long last_sync_ts) throws IOException, JSONException, Exception { |
1074 | @@ -1626,8 +1680,10 @@ |
1075 | public static <T> int readMessage(JsonReader reader,String tableName,Class<T> clazz,long last_sync_ts) throws IOException, JSONException,Exception { |
1076 | String n = null; |
1077 | int i=0; |
1078 | + |
1079 | while (reader.hasNext()) { |
1080 | JsonToken peek=reader.peek(); |
1081 | + |
1082 | String v = null; |
1083 | if (peek==JsonToken.BEGIN_OBJECT) { |
1084 | reader.beginObject(); |
1085 | @@ -1657,7 +1713,11 @@ |
1086 | reader.endObject(); |
1087 | } else if (peek==JsonToken.END_ARRAY) { |
1088 | reader.endArray(); |
1089 | - } |
1090 | + } else if (peek==JsonToken.STRING) { |
1091 | + reader.skipValue(); |
1092 | + } else { |
1093 | + reader.skipValue(); |
1094 | + } |
1095 | } |
1096 | return i; |
1097 | } |
1098 | @@ -1719,7 +1779,7 @@ |
1099 | } |
1100 | saveEntityFromJson(o, tableName, clazz,i); |
1101 | if (i%10==0) { |
1102 | - notifyUser(context.getString(R.string.flowzr_sync_receiving) + " " + tableName + ". " + context.getString(R.string.hint_run_background), (int)(Math.round(j))); |
1103 | + //notifyUser(context.getString(R.string.flowzr_sync_receiving) + " " + tableName + ". " + context.getString(R.string.hint_run_background), (int)(Math.round(j))); |
1104 | } |
1105 | } |
1106 | } |
1107 | |
1108 | === modified file 'src/ru/orangesoftware/financisto/export/flowzr/FlowzrSyncTask.java' |
1109 | --- src/ru/orangesoftware/financisto/export/flowzr/FlowzrSyncTask.java 2014-06-17 15:17:07 +0000 |
1110 | +++ src/ru/orangesoftware/financisto/export/flowzr/FlowzrSyncTask.java 2014-06-25 21:52:59 +0000 |
1111 | @@ -66,7 +66,20 @@ |
1112 | this.http_client = new DefaultHttpClient(cm, params); |
1113 | this.dba=new DatabaseAdapter(context); |
1114 | } |
1115 | - |
1116 | + |
1117 | + public static android.accounts.Account getAndroidAccount(Context context) { |
1118 | + String accountName=MyPreferences.getFlowzrAccount(context); |
1119 | + AccountManager accountManager = AccountManager.get(context); |
1120 | + android.accounts.Account[] accounts = accountManager.getAccountsByType("com.google"); |
1121 | + Account useCredential = null; |
1122 | + for (int i = 0; i < accounts.length; i++) { |
1123 | + if (accountName.equals(((android.accounts.Account) accounts[i]).name)) { |
1124 | + return accounts[i]; |
1125 | + } |
1126 | + } |
1127 | + return null; |
1128 | + } |
1129 | + |
1130 | protected Object work(Context context, DatabaseAdapter dba, String... params) throws ImportExportException { |
1131 | |
1132 | AccountManager accountManager = AccountManager.get(context); |
1133 | |
1134 | === modified file 'src/ru/orangesoftware/financisto/model/Budget.java' |
1135 | --- src/ru/orangesoftware/financisto/model/Budget.java 2014-01-11 07:30:57 +0000 |
1136 | +++ src/ru/orangesoftware/financisto/model/Budget.java 2014-06-25 21:52:59 +0000 |
1137 | @@ -21,7 +21,7 @@ |
1138 | |
1139 | @Entity |
1140 | @Table(name = "budget") |
1141 | -public class Budget { |
1142 | +public class Budget { |
1143 | |
1144 | @Id |
1145 | @Column(name = "_id") |
1146 | |
1147 | === modified file 'src/ru/orangesoftware/financisto/service/FinancistoService.java' |
1148 | --- src/ru/orangesoftware/financisto/service/FinancistoService.java 2014-05-16 12:24:22 +0000 |
1149 | +++ src/ru/orangesoftware/financisto/service/FinancistoService.java 2014-06-25 21:52:59 +0000 |
1150 | @@ -66,7 +66,6 @@ |
1151 | db = new DatabaseAdapter(this); |
1152 | db.open(); |
1153 | scheduler = new RecurrenceScheduler(db); |
1154 | - Log.i(TAG, "Created Finacisto service ..."); |
1155 | } |
1156 | |
1157 | @Override |
1158 | @@ -74,7 +73,6 @@ |
1159 | if (db != null) { |
1160 | db.close(); |
1161 | } |
1162 | - Log.i(TAG, "Finacisto service ..."); |
1163 | super.onDestroy(); |
1164 | } |
1165 | |
1166 | |
1167 | === modified file 'tests/project.properties' |
1168 | --- tests/project.properties 2013-02-18 17:26:29 +0000 |
1169 | +++ tests/project.properties 2014-06-25 21:52:59 +0000 |
1170 | @@ -19,4 +19,4 @@ |
1171 | #proguard.config=${sdk.dir}\tools\proguard\proguard-android.txt:proguard-project.txt |
1172 | |
1173 | # Project target. |
1174 | -target=android-15 |
1175 | +target=Google Inc.:Google APIs (x86 System Image):19 |
1176 | |
1177 | === added file 'tests/src/ru/orangesoftware/financisto/export/FlowzrIntegrationTest.java' |
1178 | --- tests/src/ru/orangesoftware/financisto/export/FlowzrIntegrationTest.java 1970-01-01 00:00:00 +0000 |
1179 | +++ tests/src/ru/orangesoftware/financisto/export/FlowzrIntegrationTest.java 2014-06-25 21:52:59 +0000 |
1180 | @@ -0,0 +1,480 @@ |
1181 | +/* |
1182 | + * Copyright (c) 2011 Denis Solonenko, Emmanuel Florent |
1183 | + * All rights reserved. This program and the accompanying materials |
1184 | + * are made available under the terms of the GNU Public License v2.0 |
1185 | + * which accompanies this distribution, and is available at |
1186 | + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
1187 | + */ |
1188 | + |
1189 | +package ru.orangesoftware.financisto.activity; |
1190 | + |
1191 | + |
1192 | +import android.content.Context; |
1193 | +import android.database.Cursor; |
1194 | +import android.database.sqlite.SQLiteDatabase; |
1195 | + |
1196 | +import android.test.InstrumentationTestCase; |
1197 | +import android.util.Log; |
1198 | +import org.apache.http.HttpEntity; |
1199 | +import org.apache.http.HttpResponse; |
1200 | +import org.apache.http.client.methods.HttpGet; |
1201 | +import org.apache.http.impl.client.BasicCookieStore; |
1202 | +import org.apache.http.impl.client.DefaultHttpClient; |
1203 | + |
1204 | + |
1205 | +import org.json.JSONArray; |
1206 | +import org.json.JSONException; |
1207 | +import org.json.JSONObject; |
1208 | +import ru.orangesoftware.financisto.db.DatabaseAdapter; |
1209 | +import ru.orangesoftware.financisto.db.DatabaseHelper; |
1210 | +import ru.orangesoftware.financisto.export.flowzr.FlowzrSyncEngine; |
1211 | +import ru.orangesoftware.financisto.export.flowzr.FlowzrSyncTask; |
1212 | +import ru.orangesoftware.financisto.filter.WhereFilter; |
1213 | +import ru.orangesoftware.financisto.model.*; |
1214 | +import ru.orangesoftware.financisto.test.AccountBuilder; |
1215 | +import ru.orangesoftware.financisto.test.CategoryBuilder; |
1216 | +import ru.orangesoftware.financisto.test.CurrencyBuilder; |
1217 | +import ru.orangesoftware.financisto.test.DateTime; |
1218 | +import ru.orangesoftware.financisto.utils.MyPreferences; |
1219 | +import ru.orangesoftware.orb.EntityManager; |
1220 | + |
1221 | +import java.io.BufferedReader; |
1222 | +import java.io.IOException; |
1223 | +import java.io.InputStream; |
1224 | +import java.io.InputStreamReader; |
1225 | +import java.net.URISyntaxException; |
1226 | +import java.util.List; |
1227 | +import java.util.Map; |
1228 | + |
1229 | + |
1230 | +import static java.lang.String.*; |
1231 | + |
1232 | +public class FlowzrIntegrationTest extends InstrumentationTestCase { |
1233 | + |
1234 | + //dev_appserver on this configuration doest not support 127.1 ! |
1235 | + private final static String LAN_IP="10.42.0.32"; |
1236 | + private final static String TEST_ACCOUNT = "colmedis@gmail.com"; |
1237 | + |
1238 | + protected Context context; |
1239 | + public static DefaultHttpClient http_client; |
1240 | + private static DatabaseAdapter dba; |
1241 | + public EntityManager em; |
1242 | + private SQLiteDatabase db; |
1243 | + |
1244 | + @Override |
1245 | + public void setUp() throws Exception { |
1246 | + super.setUp(); |
1247 | + |
1248 | + FlowzrSyncEngine.FLOWZR_BASE_URL = "http://" + LAN_IP + ":8080/"; |
1249 | + FlowzrSyncEngine.FLOWZR_API_URL = "http://" + LAN_IP + ":8080/financisto3/"; |
1250 | + |
1251 | + context = getInstrumentation().getTargetContext(); |
1252 | + |
1253 | + BasicCookieStore cookieStore = new BasicCookieStore(); |
1254 | + HttpGet request = getAuthenticateRequest("/"); |
1255 | + |
1256 | + this.http_client = new DefaultHttpClient(); |
1257 | + this.dba = new DatabaseAdapter(context); |
1258 | + |
1259 | + FlowzrSyncEngine.dba = this.dba; |
1260 | + FlowzrSyncEngine.db = this.dba.db(); |
1261 | + FlowzrSyncEngine.em = this.dba.em(); |
1262 | + |
1263 | + FlowzrSyncEngine.nsString = TEST_ACCOUNT.replace("@","_"); |
1264 | + |
1265 | + FlowzrSyncEngine.http_client = this.http_client; |
1266 | + |
1267 | + FlowzrSyncEngine.last_sync_ts = 1; |
1268 | + FlowzrSyncEngine.resetLastTime(context); |
1269 | + FlowzrSyncEngine.isCanceled = false; |
1270 | + FlowzrSyncEngine.isRunning = false; |
1271 | + FlowzrSyncEngine.startTimestamp = System.currentTimeMillis(); |
1272 | + db=dba.db(); |
1273 | + em = dba.em(); |
1274 | + |
1275 | + } |
1276 | + |
1277 | + public void test_get_android_account() { |
1278 | + MyPreferences.setFlowzrAccount(context, TEST_ACCOUNT); |
1279 | + String accountName = MyPreferences.getFlowzrAccount(context); |
1280 | + assertEquals(TEST_ACCOUNT, accountName); |
1281 | + android.accounts.Account a = FlowzrSyncTask.getAndroidAccount(context); |
1282 | + assertEquals(TEST_ACCOUNT, a.name); |
1283 | + } |
1284 | + |
1285 | + public void test_push_accounts() throws Exception { |
1286 | + if (dba.em().getAllAccounts().getCount()<1) { |
1287 | + Currency c = createCurrency("CZK"); |
1288 | + ru.orangesoftware.financisto.model.Account a = new ru.orangesoftware.financisto.model.Account(); |
1289 | + a.title = "My Bank Account"; |
1290 | + a.type = AccountType.BANK.name(); |
1291 | + a.currency = c; |
1292 | + a.totalAmount = 23450; |
1293 | + a.sortOrder = 50; |
1294 | + a.cardIssuer = "card issuer"; |
1295 | + a.closingDay = 30; |
1296 | + a.creationDate = 0; |
1297 | + a.isActive = true; |
1298 | + a.isIncludeIntoTotals = true; |
1299 | + a.issuer = "issuer"; |
1300 | + a.limitAmount = 1000; |
1301 | + a.note = "note"; |
1302 | + a.number = "6004300"; |
1303 | + a.paymentDay = 1; |
1304 | + a.sortOrder = 1; |
1305 | + a.id = -1; |
1306 | + dba.em().saveAccount(a); |
1307 | + } |
1308 | + |
1309 | + FlowzrSyncEngine.fixCreatedEntities(); |
1310 | + FlowzrSyncEngine.pushUpdate("currency", Currency.class); |
1311 | + FlowzrSyncEngine.pushUpdate("account", ru.orangesoftware.financisto.model.Account.class); |
1312 | + |
1313 | + JSONObject json = getJsonResponse(FlowzrSyncEngine.FLOWZR_API_URL + "admin_example.com/account/?last_sync_ts=0"); |
1314 | + JSONArray arr = json.getJSONArray("account"); |
1315 | + |
1316 | + Cursor cursor=dba.em().getAllAccounts(); |
1317 | + |
1318 | + assertEquals(valueOf(cursor.getCount()), valueOf(arr.length())); |
1319 | + |
1320 | + if (cursor.moveToFirst()) { |
1321 | + do { |
1322 | + //Log.i("flowzr", "account:" + cursor.getInt(0) + " " + cursor.getString(cursor.getColumnIndex("name")) + " " + cursor.getInt(cursor.getColumnIndex("remote_key"))); |
1323 | + // the view doesn't contains remote_key, the test is unoptimized |
1324 | + ru.orangesoftware.financisto.model.Account a = dba.em().getAccount(cursor.getInt(cursor.getColumnIndex("_id"))); |
1325 | + //em.load(Attribute.class, cursor.getInt(cursor.getColumnIndex("_id"))); |
1326 | + boolean gotIt = false; |
1327 | + for (int i = 0; i < arr.length(); i++) { |
1328 | + if (a.remoteKey.equals(arr.getJSONObject(i).getString("key"))) { |
1329 | + Log.i("flowzr", "got account " + a.title); |
1330 | + assertEquals(a.title, arr.getJSONObject(i).getString("name")); |
1331 | + assertEquals(a.type,arr.getJSONObject(i).getString("type")); |
1332 | + assertEquals(a.currency.name,arr.getJSONObject(i).getString("currency_name")); |
1333 | + assertEquals(a.sortOrder,arr.getJSONObject(i).getInt("sort_order"));; |
1334 | + if (a.cardIssuer!=null) { |
1335 | + assertEquals(a.cardIssuer, arr.getJSONObject(i).getString("card_issuer")); |
1336 | + } |
1337 | + assertEquals(a.closingDay,arr.getJSONObject(i).getInt("closing_day"));; |
1338 | + assertFalse(a.isActive == arr.getJSONObject(i).getBoolean("hidden")); |
1339 | + assertEquals(a.isIncludeIntoTotals,arr.getJSONObject(i).getBoolean("is_include_into_totals")); |
1340 | + if (a.issuer!=null) { |
1341 | + assertEquals(a.issuer, arr.getJSONObject(i).getString("issuer")); |
1342 | + } |
1343 | + assertEquals(a.limitAmount,arr.getJSONObject(i).getInt("total_limit")); |
1344 | + if (a.note!=null) { |
1345 | + assertEquals(a.note, arr.getJSONObject(i).getString("description")); |
1346 | + } |
1347 | + if (a.number!=null) { |
1348 | + assertEquals(a.number, arr.getJSONObject(i).getString("code")); |
1349 | + } |
1350 | + assertEquals(a.paymentDay,arr.getJSONObject(i).getInt("payment_day"));; |
1351 | + assertEquals(a.sortOrder,arr.getJSONObject(i).getInt("sort_order"));; |
1352 | + gotIt = true; |
1353 | + } |
1354 | + } |
1355 | + assertTrue(gotIt); |
1356 | + } while (cursor.moveToNext()); |
1357 | + } |
1358 | + cursor.close(); |
1359 | + } |
1360 | + |
1361 | + public void test_pull_accounts() throws Exception { |
1362 | + |
1363 | + |
1364 | + //expect |
1365 | + JSONObject json = getJsonResponse(FlowzrSyncEngine.FLOWZR_API_URL + "test_example.com/account/?last_sync_ts=0"); |
1366 | + JSONArray expect = json.getJSONArray("account"); |
1367 | + |
1368 | + FlowzrSyncEngine.pullUpdate("account", ru.orangesoftware.financisto.model.Account.class, 0); |
1369 | + |
1370 | + for (int i = 0; i < expect.length(); i++) { |
1371 | + Log.i("flowzr" , "checking account " + expect.getJSONObject(i).getString("key")); |
1372 | + long id= FlowzrSyncEngine.getLocalKey(DatabaseHelper.ACCOUNT_TABLE,expect.getJSONObject(i).getString("key")); |
1373 | + ru.orangesoftware.financisto.model.Account c=dba.em().getAccount(id); |
1374 | + assertEquals(expect.getJSONObject(i).getString("name"),c.title ); |
1375 | + assertEquals(expect.getJSONObject(i).getString("type"),c.type); |
1376 | + assertEquals(c.title, expect.getJSONObject(i).getString("name")); |
1377 | + assertEquals(c.type,expect.getJSONObject(i).getString("type")); |
1378 | + assertEquals(c.currency.name,expect.getJSONObject(i).getString("currency_name")); |
1379 | + assertEquals(c.sortOrder,expect.getJSONObject(i).getInt("sort_order")); |
1380 | + if (expect.getJSONObject(i).has("card_issuer")) { |
1381 | + assertEquals(c.cardIssuer, expect.getJSONObject(i).getString("card_issuer")); |
1382 | + } |
1383 | + assertEquals(c.closingDay,expect.getJSONObject(i).getInt("closing_day"));; |
1384 | + assertFalse(c.isActive == expect.getJSONObject(i).getBoolean("hidden")); |
1385 | + assertEquals(c.isIncludeIntoTotals,expect.getJSONObject(i).getBoolean("is_include_into_totals")); |
1386 | + if (expect.getJSONObject(i).has("issuer")) { |
1387 | + assertEquals(c.issuer, expect.getJSONObject(i).getString("issuer")); |
1388 | + } |
1389 | + assertEquals(c.limitAmount,expect.getJSONObject(i).getInt("total_limit")); |
1390 | + if (expect.getJSONObject(i).has("description")) { |
1391 | + assertEquals(c.note, expect.getJSONObject(i).getString("description")); |
1392 | + } |
1393 | + if (expect.getJSONObject(i).has("code")) { |
1394 | + assertEquals(c.number, expect.getJSONObject(i).getString("code")); |
1395 | + } |
1396 | + assertEquals(c.paymentDay,expect.getJSONObject(i).getInt("payment_day"));; |
1397 | + assertEquals(c.sortOrder,expect.getJSONObject(i).getInt("sort_order"));; |
1398 | + } |
1399 | + } |
1400 | + |
1401 | + |
1402 | + public void test_push_attributes() throws Exception { |
1403 | + |
1404 | + if (dba.getAllCategories().getCount() == 2) { //only system categories |
1405 | + Map<String, Category> categories = CategoryBuilder.createDefaultHierarchy(dba); |
1406 | + FlowzrSyncEngine.fixCreatedEntities(); |
1407 | + } |
1408 | + |
1409 | + FlowzrSyncEngine.pushUpdate("attributes", Attribute.class); |
1410 | + |
1411 | + JSONObject json = getJsonResponse(FlowzrSyncEngine.FLOWZR_API_URL + "admin_example.com/attributes/?last_sync_ts=0"); |
1412 | + JSONArray arr = json.getJSONArray("attributes"); |
1413 | + Cursor cursor = dba.getAllAttributes(); |
1414 | + //minus two system attributes ??? |
1415 | + assertEquals(valueOf(cursor.getCount()), valueOf(arr.length())); |
1416 | + |
1417 | + if (cursor.moveToFirst()) { |
1418 | + do { |
1419 | + Log.i("flowzr", "attr:" + cursor.getInt(0) + " " + cursor.getString(cursor.getColumnIndex("name")) + " " + cursor.getInt(cursor.getColumnIndex("remote_key"))); |
1420 | + // the view doesn't contains remote_key, the test is unoptimized |
1421 | + Attribute c = dba.getAttribute(cursor.getInt(cursor.getColumnIndex("_id"))); |
1422 | + //em.load(Attribute.class, cursor.getInt(cursor.getColumnIndex("_id"))); |
1423 | + boolean gotIt = false; |
1424 | + for (int i = 0; i < arr.length(); i++) { |
1425 | + if (c.remoteKey.equals(arr.getJSONObject(i).getString("key"))) { |
1426 | + Log.i("flowzr", "got attribute " + c.name); |
1427 | + assertEquals(c.name,arr.getJSONObject(i).getString("name")); |
1428 | + assertEquals(c.type,arr.getJSONObject(i).getInt("type")); |
1429 | + if (c.listValues!=null) { |
1430 | + assertEquals(c.listValues, arr.getJSONObject(i).getString("list_values")); |
1431 | + } |
1432 | + if (c.defaultValue!=null) { |
1433 | + assertEquals(c.defaultValue, arr.getJSONObject(i).getString("default_value")); |
1434 | + } |
1435 | + gotIt = true; |
1436 | + } |
1437 | + } |
1438 | + //is the object find ? |
1439 | + assertTrue(gotIt); |
1440 | + } while (cursor.moveToNext()); |
1441 | + |
1442 | + } |
1443 | + cursor.close(); |
1444 | + } |
1445 | + |
1446 | + public void test_push_category() throws Exception { |
1447 | + |
1448 | + if (dba.getAllCategories().getCount() == 2) { //only system categories |
1449 | + Map<String, Category> categories = CategoryBuilder.createDefaultHierarchy(dba); |
1450 | + FlowzrSyncEngine.fixCreatedEntities(); |
1451 | + } |
1452 | + |
1453 | + FlowzrSyncEngine.pushUpdate("attributes", Attribute.class); |
1454 | + FlowzrSyncEngine.pushUpdate("category", Category.class); |
1455 | + |
1456 | + JSONObject json = getJsonResponse(FlowzrSyncEngine.FLOWZR_API_URL + "admin_example.com/category/?last_sync_ts=0"); |
1457 | + JSONArray result = json.getJSONArray("category"); |
1458 | + Cursor cursor = dba.getCategories(false); |
1459 | + //minus two system categories |
1460 | + assertEquals(valueOf(cursor.getCount()), valueOf(result.length())); |
1461 | + |
1462 | + if (cursor.moveToFirst()) { |
1463 | + do { |
1464 | + // the view doesn't contains remote_key, the test is unoptimized |
1465 | + Category expect = em.load(Category.class, cursor.getInt(cursor.getColumnIndex("_id"))); |
1466 | + boolean gotIt = false; |
1467 | + for (int i = 0; i < result.length(); i++) { |
1468 | + if (expect.remoteKey.equals(result.getJSONObject(i).getString("key"))) { |
1469 | + |
1470 | + assertEquals(expect.getTitle(), result.getJSONObject(i).getString("name")); |
1471 | + if (expect.getParentId() > 0) { |
1472 | + assertEquals(em.load(Category.class, expect.getParentId()).remoteKey, result.getJSONObject(i).getString("parentCategory")); |
1473 | + } |
1474 | + assertEquals(expect.type, result.getJSONObject(i).getInt("type")); |
1475 | + gotIt = true; |
1476 | + } |
1477 | + } |
1478 | + assertTrue(expect.title, gotIt); |
1479 | + |
1480 | + } while (cursor.moveToNext()); |
1481 | + |
1482 | + } |
1483 | + cursor.close(); |
1484 | + |
1485 | + } |
1486 | + |
1487 | + public void test_pull_category_when_none() throws Exception { |
1488 | + |
1489 | + //expect |
1490 | + JSONObject json = getJsonResponse(FlowzrSyncEngine.FLOWZR_API_URL + "test_example.com/category/?last_sync_ts=0"); |
1491 | + JSONArray expect = json.getJSONArray("category"); |
1492 | + |
1493 | + FlowzrSyncEngine.pullUpdate("category", Category.class, 0); |
1494 | + |
1495 | + for (int i = 0; i < expect.length(); i++) { |
1496 | + Log.i("flowzr" , "checking " + expect.getJSONObject(i).getString("key")); |
1497 | + long id= FlowzrSyncEngine.getLocalKey(DatabaseHelper.CATEGORY_TABLE,expect.getJSONObject(i).getString("key")); |
1498 | + Category c=dba.getCategory(id); |
1499 | + if (expect.getJSONObject(i).has("parentCategory")) { |
1500 | + Category c2=em.load(Category.class, FlowzrSyncEngine.getLocalKey(DatabaseHelper.CATEGORY_TABLE, expect.getJSONObject(i).getString("parentCategory"))); |
1501 | + Category c3=dba.getCategory(c.getParentId()); |
1502 | + assertEquals(c2.id, c3.id); |
1503 | + } |
1504 | + if (expect.getJSONObject(i).has("attributes")) { |
1505 | + String[] attr_arr=expect.getJSONObject(i).getString("attributes").split(";"); |
1506 | + for (int j=0;i<attr_arr.length;j++) { |
1507 | + Long attrId=FlowzrSyncEngine.getLocalKey(DatabaseHelper.CATEGORY_TABLE,expect.getJSONObject(i).getString("key")); |
1508 | + c.attributes.contains(dba.getAttribute(attrId)); |
1509 | + } |
1510 | + |
1511 | + } |
1512 | + assertEquals(expect.getJSONObject(i).getString("name"),c.title ); |
1513 | + assertEquals(expect.getJSONObject(i).getInt("type"),c.type); |
1514 | + } |
1515 | + } |
1516 | + |
1517 | + |
1518 | + public void test_pull_category() throws Exception { |
1519 | + //expect |
1520 | + JSONObject json = getJsonResponse(FlowzrSyncEngine.FLOWZR_API_URL + "test_example.com/category/?last_sync_ts=0"); |
1521 | + JSONArray expect = json.getJSONArray("category"); |
1522 | + //result |
1523 | + FlowzrSyncEngine.pullUpdate("category", Category.class, 0); |
1524 | + |
1525 | + for (int i = 0; i < expect.length(); i++) { |
1526 | + Log.i("flowzr" , "checking " + expect.getJSONObject(i).getString("key")); |
1527 | + long id= FlowzrSyncEngine.getLocalKey(DatabaseHelper.CATEGORY_TABLE,expect.getJSONObject(i).getString("key")); |
1528 | + Category c=dba.getCategory(id); |
1529 | + if (expect.getJSONObject(i).has("parentCategory")) { |
1530 | + Category c2=em.load(Category.class,FlowzrSyncEngine.getLocalKey(DatabaseHelper.CATEGORY_TABLE, expect.getJSONObject(i).getString("parentCategory"))); |
1531 | + Category c3=dba.getCategory(c.getParentId()); |
1532 | + assertEquals(c2.id, c3.id); |
1533 | + } |
1534 | + assertEquals(expect.getJSONObject(i).getString("name"),c.title ); |
1535 | + assertEquals(expect.getJSONObject(i).getInt("type"),c.type); |
1536 | + } |
1537 | + } |
1538 | + |
1539 | + |
1540 | + public void test_push_budgets() throws Exception { |
1541 | + Budget budgetOne; |
1542 | + if (dba.em().getAllBudgets(WhereFilter.empty()).size()==0) { |
1543 | + budgetOne=createBudget(); |
1544 | + } else { |
1545 | + budgetOne=dba.em().getAllBudgets(WhereFilter.empty()).get(0); |
1546 | + } |
1547 | + FlowzrSyncEngine.fixCreatedEntities(); |
1548 | + FlowzrSyncEngine.pushUpdate("currency", Currency.class); |
1549 | + FlowzrSyncEngine.pushUpdate("account", Account.class); |
1550 | + FlowzrSyncEngine.pushUpdate("project", Project.class); |
1551 | + FlowzrSyncEngine.pushUpdate("payee", Payee.class); |
1552 | + FlowzrSyncEngine.pushUpdate("category", Category.class); |
1553 | + |
1554 | + FlowzrSyncEngine.pushUpdate(DatabaseHelper.BUDGET_TABLE, Budget.class); |
1555 | + Thread.sleep(2000); |
1556 | + JSONObject json = getJsonResponse(FlowzrSyncEngine.FLOWZR_API_URL + "test_example.com/budget/?last_sync_ts=0"); |
1557 | + JSONArray result = json.getJSONArray("budget"); |
1558 | + |
1559 | + assertEquals(result.length(),dba.em().getAllBudgets(WhereFilter.empty()).size()); |
1560 | + |
1561 | + |
1562 | + budgetOne.recur="WEEKLY,startDate=1403582400000,period=EXACTLY_TIMES,periodParam=4,days=TUE"; |
1563 | + dba.em().insertBudget(budgetOne); |
1564 | + FlowzrSyncEngine.fixCreatedEntities(); |
1565 | + FlowzrSyncEngine.pushDelete(); |
1566 | + Thread.sleep(2000); |
1567 | + |
1568 | + FlowzrSyncEngine.db=this.db; |
1569 | + FlowzrSyncEngine.pushUpdate(DatabaseHelper.BUDGET_TABLE, Budget.class); |
1570 | + |
1571 | + Thread.sleep(2000); |
1572 | + json = getJsonResponse(FlowzrSyncEngine.FLOWZR_API_URL + "test_example.com/budget/?last_sync_ts=0"); |
1573 | + result = json.getJSONArray("budget"); |
1574 | + assertEquals(result.length(),dba.em().getAllBudgets(WhereFilter.empty()).size()); |
1575 | + |
1576 | + |
1577 | + } |
1578 | + |
1579 | + /** Helper functions **/ |
1580 | + |
1581 | + private Budget createBudget() { |
1582 | + Account account; |
1583 | + Project project; |
1584 | + if (dba.em().getAllAccountsList().size()==0) { |
1585 | + account = AccountBuilder.createDefault(dba); |
1586 | + } else { |
1587 | + account=dba.em().getAllAccountsList().get(0); |
1588 | + } |
1589 | + |
1590 | + Map<String,Category> categoriesMap; |
1591 | + if (dba.em().getAllCategoriesList(true).size()<=2) { |
1592 | + categoriesMap = CategoryBuilder.createDefaultHierarchy(dba); |
1593 | + } else { |
1594 | + categoriesMap = CategoryBuilder.allCategoriesAsMap(dba); |
1595 | + } |
1596 | + |
1597 | + if ( MyEntity.asMap(dba.em().getAllProjectsList(true)).size()==0) { |
1598 | + project = new Project(); |
1599 | + project.title = "P1"; |
1600 | + em.saveOrUpdate(project); |
1601 | + } else { |
1602 | + project= dba.em().getAllProjectsList(true).get(0); |
1603 | + } |
1604 | + |
1605 | + Budget budgetOne = new Budget(); |
1606 | + budgetOne.currency = account.currency; |
1607 | + budgetOne.amount = 1000; |
1608 | + budgetOne.categories = String.valueOf(categoriesMap.get("A").id); |
1609 | + budgetOne.projects = String.valueOf(project.id); |
1610 | + budgetOne.expanded = true; |
1611 | + budgetOne.includeSubcategories = true; |
1612 | + budgetOne.startDate = DateTime.date(2011, 4, 1).atMidnight().asLong(); |
1613 | + budgetOne.endDate = DateTime.date(2011, 4, 30).at(23, 59, 59, 999).asLong(); |
1614 | + budgetOne.recur="WEEKLY,startDate=1403582400000,period=EXACTLY_TIMES,periodParam=12,days=TUE"; |
1615 | + dba.em().insertBudget(budgetOne); |
1616 | + FlowzrSyncEngine.fixCreatedEntities(); |
1617 | + return budgetOne; |
1618 | + } |
1619 | + |
1620 | + |
1621 | + public JSONObject getJsonResponse(String url) throws URISyntaxException, IOException, JSONException { |
1622 | + |
1623 | + HttpGet request = getAuthenticateRequest(url); |
1624 | + HttpResponse response = http_client.execute(request); |
1625 | + HttpEntity entity = response.getEntity(); |
1626 | + StringBuilder builder=new StringBuilder(); |
1627 | + |
1628 | + if (entity != null) { |
1629 | + InputStream inputStream = entity.getContent(); |
1630 | + BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); |
1631 | + for (String line = null; (line = bufferedReader.readLine()) != null;) { |
1632 | + builder.append(line).append("\n"); |
1633 | + } |
1634 | + //Exception getting thrown in below line |
1635 | + |
1636 | + return new JSONObject(builder.toString()); |
1637 | + |
1638 | + } |
1639 | + return null; |
1640 | + |
1641 | + } |
1642 | + |
1643 | + |
1644 | + public HttpGet getAuthenticateRequest(String cont) { |
1645 | + HttpGet h= new HttpGet(FlowzrSyncEngine.FLOWZR_BASE_URL + "_ah/login?&email=test@example.com&action=Login&continue=" + cont); |
1646 | + h.setHeader("Cookie","dev_appserver_login=test@example.com:False:185804764220139124118"); |
1647 | + return h; |
1648 | + } |
1649 | + |
1650 | + private Currency createCurrency(String currency) { |
1651 | + Currency c = CurrencyBuilder.withDb(dba) |
1652 | + .title("Singapore Dollar") |
1653 | + .name(currency) |
1654 | + .separators("''", "'.'") |
1655 | + .symbol("S$") |
1656 | + .create(); |
1657 | + return c; |
1658 | + } |
1659 | + |
1660 | +} |
1661 | |
1662 | === modified file 'tests/src/ru/orangesoftware/financisto/test/CategoryBuilder.java' |
1663 | --- tests/src/ru/orangesoftware/financisto/test/CategoryBuilder.java 2012-07-06 19:20:38 +0000 |
1664 | +++ tests/src/ru/orangesoftware/financisto/test/CategoryBuilder.java 2014-06-25 21:52:59 +0000 |
1665 | @@ -41,7 +41,7 @@ |
1666 | return this; |
1667 | } |
1668 | |
1669 | - private static Map<String, Category> allCategoriesAsMap(DatabaseAdapter db) { |
1670 | + public static Map<String, Category> allCategoriesAsMap(DatabaseAdapter db) { |
1671 | HashMap<String, Category> map = new HashMap<String, Category>(); |
1672 | List<Category> categories = db.getAllCategoriesList(); |
1673 | for (Category category : categories) { |
1674 | |
1675 | === removed file 'tests/tests.iml' |
1676 | --- tests/tests.iml 2014-06-17 15:11:57 +0000 |
1677 | +++ tests/tests.iml 1970-01-01 00:00:00 +0000 |
1678 | @@ -1,22 +0,0 @@ |
1679 | -<?xml version="1.0" encoding="UTF-8"?> |
1680 | -<module type="JAVA_MODULE" version="4"> |
1681 | - <component name="FacetManager"> |
1682 | - <facet type="android" name="Android"> |
1683 | - <configuration> |
1684 | - <includeAssetsFromLibraries>true</includeAssetsFromLibraries> |
1685 | - </configuration> |
1686 | - </facet> |
1687 | - </component> |
1688 | - <component name="NewModuleRootManager" inherit-compiler-output="true"> |
1689 | - <exclude-output /> |
1690 | - <content url="file://$MODULE_DIR$"> |
1691 | - <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> |
1692 | - <sourceFolder url="file://$MODULE_DIR$/gen" isTestSource="false" generated="true" /> |
1693 | - <excludeFolder url="file://$MODULE_DIR$/bin" /> |
1694 | - </content> |
1695 | - <orderEntry type="jdk" jdkName="Android 4.0.3 Platform" jdkType="Android SDK" /> |
1696 | - <orderEntry type="sourceFolder" forTests="false" /> |
1697 | - <orderEntry type="module" module-name="Financisto" scope="PROVIDED" /> |
1698 | - </component> |
1699 | -</module> |
1700 | - |
Following the new integration test, i could fix things more easily.