Revision 46806 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.db/org.gvsig.fmap.dal.db.jdbc/src/test/java/org/gvsig/fmap/dal/store/jdbc2/AbstractTestUtils.java

View differences:

AbstractTestUtils.java
129 129
        x.normaliceSpaces = false;
130 130
        x.removeNL = true;
131 131
        x.stripStart = true;
132
        x.end_of_item = null;
132 133
        File f = getResourceAsFile(getExpectedsPath() + "/" + name);
133 134
        x.parse(f);
134 135
        return x;
......
146 147
        
147 148

  
148 149
        public String startLineComment = "-- ";
150
        public String end_of_item = ";";
149 151
        
150 152
        private static class CommandLine {
151 153

  
......
184 186
            boolean localStripStart = false;
185 187
            boolean localRemoveNL = false;
186 188
            boolean local_replace_nl_by_space = false;
187
            boolean local_trim_end = false;
189
            boolean local_trim_end = false;            
188 190
            String name = f.getName();
189 191

  
190 192
            List<String> lines = FileUtils.readLines(f);
......
200 202
                        if (line.toLowerCase().startsWith(startLineComment + "normalize-spaces")) {
201 203
                            CommandLine cmd = new CommandLine(line, startLineComment);
202 204
                            normaliceSpaces = cmd.isTrue(1, true);
205
                        } else if (line.toLowerCase().startsWith(startLineComment + "end-of-item")) {
206
                            CommandLine cmd = new CommandLine(line, startLineComment);
207
                            end_of_item = cmd.get(1);
203 208
                        } else if (line.toLowerCase().startsWith(startLineComment + "strip-start")) {
204 209
                            CommandLine cmd = new CommandLine(line, startLineComment);
205 210
                            stripStart = cmd.isTrue(1, true);
......
265 270
                                value = new ArrayList<>();
266 271
                                expecteds.put(currentItem, value);
267 272
                            }
268
                            value.add(s);
273
                            if( StringUtils.isNotBlank(s) ) {
274
                                value.add(s);
275
                            }
269 276
                            state = SEARCHING_ITEM;
270 277

  
271 278
                        } else if (line.toLowerCase().startsWith(startLineComment + "rem ")) {
......
281 288
                                line = StringUtils.remove(line, "\n");
282 289
                                line = StringUtils.remove(line, "\r");
283 290
                            }
284
                            sb.append(line);
291
                            if( this.end_of_item!=null ) {
292
                                String s = StringUtils.stripEnd(line, null);
293
                                if( s!=null && s.endsWith(this.end_of_item) ) {
294
                                    List<String> value = expecteds.get(currentItem);
295
                                    if( value == null ) {
296
                                        value = new ArrayList<>();
297
                                        expecteds.put(currentItem, value);
298
                                    }
299
                                    s = s.substring(0, s.length() - this.end_of_item.length());
300
                                    value.add(s);
301
                                    line = null;
302
                                }
303
                            }
304
                            if( StringUtils.isNotBlank(line) ) {
305
                                sb.append(line);
306
                            }
307
                            
285 308
                        }
286 309
                        break;
287 310
                }

Also available in: Unified diff