Revision 46170

View differences:

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/resources/org/gvsig/fmap/dal/store/jdbc2/operations/usecases/arena2/ARENA2_DIC_FESTIVOS.csv
1
"FESSTR/String/set/size=10/set/order=0";"FESTIVO/Date/set/order=10/set/locale=es";"TIPO/Integer/set/order=20";"PK/Long/set/readOnly=true/set/pk=true/set/automatic=true/set/order=30"
2
"01-01-2005";"01/01/2005";;
3
"06-01-2005";"06/01/2005";;
4
"25-03-2005";"25/03/2005";;
5
"01-05-2005";"01/05/2005";;
6
"24-06-2005";"24/06/2005";;
7
"15-08-2005";"15/08/2005";;
8
"09-10-2005";"09/10/2005";;
9
"12-10-2005";"12/10/2005";;
10
"01-11-2005";"01/11/2005";;
11
"06-12-2005";"06/12/2005";;
12
"08-12-2005";"08/12/2005";;
13
"25-12-2005";"25/12/2005";;
14
"02-01-2006";"02/01/2006";;
15
"06-01-2006";"06/01/2006";;
16
"20-03-2006";"20/03/2006";;
17
"01-05-2006";"01/05/2006";;
18
"15-08-2006";"15/08/2006";;
19
"12-10-2006";"12/10/2006";;
20
"01-11-2006";"01/11/2006";;
21
"06-12-2006";"06/12/2006";;
22
"08-12-2006";"08/12/2006";;
23
"01-01-2007";"01/01/2007";;
24
"06-01-2007";"06/01/2007";;
25
"19-03-2007";"19/03/2007";;
26
"01-05-2007";"01/05/2007";;
27
"15-08-2007";"15/08/2007";;
28
"12-10-2007";"12/10/2007";;
29
"01-11-2007";"01/11/2007";;
30
"06-12-2007";"06/12/2007";;
31
"08-12-2007";"08/12/2007";;
32
"01-01-2008";"01/01/2008";;
33
"19-03-2008";"19/03/2008";;
34
"01-05-2008";"01/05/2008";;
35
"15-08-2008";"15/08/2008";;
36
"13-10-2008";"13/10/2008";;
37
"01-11-2008";"01/11/2008";;
38
"06-12-2008";"06/12/2008";;
39
"08-12-2008";"08/12/2008";;
40
"01-01-2009";"01/01/2009";;
41
"06-01-2009";"06/01/2009";;
42
"19-03-2009";"19/03/2009";;
43
"01-05-2009";"01/05/2009";;
44
"15-08-2009";"15/08/2009";;
45
"12-10-2009";"12/10/2009";;
46
"02-11-2009";"02/11/2009";;
47
"07-12-2009";"07/12/2009";;
48
"08-12-2009";"08/12/2009";;
49
"01-01-2010";"01/01/2010";;
50
"06-01-2010";"06/01/2010";;
51
"19-03-2010";"19/03/2010";;
52
"01-05-2010";"01/05/2010";;
53
"16-08-2010";"16/08/2010";;
54
"12-10-2010";"12/10/2010";;
55
"01-11-2010";"01/11/2010";;
56
"06-12-2010";"06/12/2010";;
57
"08-12-2010";"08/12/2010";;
58
"01-01-2011";"01/01/2011";;
59
"06-01-2011";"06/01/2011";;
60
"19-03-2011";"19/03/2011";;
61
"21-04-2011";"21/04/2011";;
62
"25-04-2011";"25/04/2011";;
63
"02-05-2011";"02/05/2011";;
64
"15-08-2011";"15/08/2011";;
65
"12-10-2011";"12/10/2011";;
66
"01-11-2011";"01/11/2011";;
67
"06-12-2011";"06/12/2011";;
68
"08-12-2011";"08/12/2011";;
69
"26-12-2011";"26/12/2011";;
70
"06-01-2012";"06/01/2012";;
71
"19-03-2012";"19/03/2012";;
72
"06-04-2012";"06/04/2012";;
73
"09-04-2012";"09/04/2012";;
74
"01-05-2012";"01/05/2012";;
75
"15-08-2012";"15/08/2012";;
76
"09-10-2012";"09/10/2012";;
77
"12-10-2012";"12/10/2012";;
78
"01-11-2012";"01/11/2012";;
79
"06-12-2012";"06/12/2012";;
80
"08-12-2012";"08/12/2012";;
81
"25-12-2012";"25/12/2012";;
82
"01-01-2013";"01/01/2013";;
83
"18-03-2013";"18/03/2013";;
84
"19-03-2013";"19/03/2013";;
85
"29-03-2013";"29/03/2013";;
86
"01-04-2013";"01/04/2013";;
87
"01-05-2013";"01/05/2013";;
88
"15-08-2013";"15/08/2013";;
89
"09-10-2013";"09/10/2013";;
90
"12-10-2013";"12/10/2013";;
91
"01-11-2013";"01/11/2013";;
92
"06-12-2013";"06/12/2013";;
93
"25-12-2013";"25/12/2013";;
94
"01-01-2014";"01/01/2014";;
95
"06-01-2014";"06/01/2014";;
96
"19-03-2014";"19/03/2014";;
97
"18-04-2014";"18/04/2014";;
98
"21-04-2014";"21/04/2014";;
99
"01-05-2014";"01/05/2014";;
100
"15-08-2014";"15/08/2014";;
101
"09-10-2014";"09/10/2014";;
102
"01-11-2014";"01/11/2014";;
103
"06-12-2014";"06/12/2014";;
104
"08-12-2014";"08/12/2014";;
105
"25-12-2014";"25/12/2014";;
106
"01-01-2015";"01/01/2015";;
107
"06-01-2015";"06/01/2015";;
108
"19-03-2015";"19/03/2015";;
109
"03-04-2015";"03/04/2015";;
110
"06-04-2015";"06/04/2015";;
111
"01-05-2015";"01/05/2015";;
112
"15-08-2015";"15/08/2015";;
113
"09-10-2015";"09/10/2015";;
114
"12-10-2015";"12/10/2015";;
115
"07-12-2015";"07/12/2015";;
116
"08-12-2015";"08/12/2015";;
117
"25-12-2015";"25/12/2015";;
118
"01-01-2016";"01/01/2016";;
119
"06-01-2016";"06/01/2016";;
120
"19-03-2016";"19/03/2016";;
121
"24-03-2016";"24/03/2016";;
122
"25-03-2016";"25/03/2016";;
123
"28-03-2016";"28/03/2016";;
124
"15-08-2016";"15/08/2016";;
125
"12-10-2016";"12/10/2016";;
126
"01-11-2016";"01/11/2016";;
127
"06-12-2016";"06/12/2016";;
128
"08-12-2016";"08/12/2016";;
129
"26-12-2016";"26/12/2016";;
130
"06-01-2017";"06/01/2017";;
131
"13-04-2017";"13/04/2017";;
132
"14-04-2017";"14/04/2017";;
133
"17-04-2017";"17/04/2017";;
134
"01-05-2017";"01/05/2017";;
135
"15-08-2017";"15/08/2017";;
136
"09-10-2017";"09/10/2017";;
137
"12-10-2017";"12/10/2017";;
138
"01-11-2017";"01/11/2017";;
139
"06-12-2017";"06/12/2017";;
140
"08-12-2017";"08/12/2017";;
141
"25-12-2017";"25/12/2017";;
142
"01-01-2018";"01/01/2018";;
143
"06-01-2018";"06/01/2018";;
144
"19-03-2018";"19/03/2018";;
145
"30-03-2018";"30/03/2018";;
146
"02-04-2018";"02/04/2018";;
147
"01-05-2018";"01/05/2018";;
148
"15-05-2018";"15/05/2018";;
149
"09-10-2018";"09/10/2018";;
150
"12-10-2018";"12/10/2018";;
151
"01-11-2018";"01/11/2018";;
152
"06-12-2018";"06/12/2018";;
153
"08-12-2018";"08/12/2018";;
154
"25-12-2018";"25/12/2018";;
155
"01-01-2019";"01/01/2019";;
156
"19-03-2019";"19/03/2019";;
157
"19-04-2019";"19/04/2019";;
158
"22-04-2019";"22/04/2019";;
159
"01-05-2019";"01/05/2019";;
160
"24-06-2019";"24/06/2019";;
161
"15-08-2019";"15/08/2019";;
162
"09-10-2019";"09/10/2019";;
163
"12-10-2019";"12/10/2019";;
164
"01-11-2019";"01/11/2019";;
165
"06-12-2019";"06/12/2019";;
166
"25-12-2019";"25/12/2019";;
167
"01-01-2020";"01/01/2020";;
168
"06-01-2020";"06/01/2020";;
169
"19-03-2020";"19/03/2020";;
170
"10-04-2020";"10/04/2020";;
171
"13-04-2020";"13/04/2020";;
172
"01-05-2020";"01/05/2020";;
173
"25-06-2020";"25/06/2020";;
174
"15-08-2020";"15/08/2020";;
175
"09-10-2020";"09/10/2020";;
176
"12-10-2020";"12/10/2020";;
177
"08-12-2020";"08/12/2020";;
178
"25-12-2020";"25/12/2020";;
179
"01-01-2021";"01/01/2021";;
180
"06-01-2021";"06/01/2021";;
181
"19-03-2021";"19/03/2021";;
182
"02-04-2021";"02/04/2021";;
183
"05-04-2021";"05/04/2021";;
184
"01-05-2021";"01/05/2021";;
185
"24-06-2021";"24/06/2021";;
186
"09-10-2021";"09/10/2021";;
187
"12-10-2021";"12/10/2021";;
188
"01-11-2021";"01/11/2021";;
189
"06-12-2021";"06/12/2021";;
190
"08-12-2021";"08/12/2021";;
191
"25-12-2021";"25/12/2021";;
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/AbstractTestWhereWithComputedField.java
1
package org.gvsig.fmap.dal.store.jdbc2;
2

  
3
import java.util.ArrayList;
4
import java.util.List;
5
import junit.framework.TestCase;
6
import static junit.framework.TestCase.assertEquals;
7
import org.gvsig.expressionevaluator.ExpressionUtils;
8
import org.gvsig.fmap.dal.DataTypes;
9
import org.gvsig.fmap.dal.feature.EditableFeatureAttributeDescriptor;
10
import org.gvsig.fmap.dal.feature.EditableFeatureType;
11
import org.gvsig.fmap.dal.feature.Feature;
12
import org.gvsig.fmap.dal.feature.FeatureQuery;
13
import org.gvsig.fmap.dal.feature.FeatureStore;
14
import org.gvsig.fmap.dal.feature.FeatureType;
15
import org.gvsig.fmap.dal.impl.expressionevaluator.DefaultFeatureAttributeEmulatorExpression;
16
import org.gvsig.tools.dispose.DisposeUtils;
17
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer;
18
import org.slf4j.Logger;
19
import org.slf4j.LoggerFactory;
20

  
21
public abstract class AbstractTestWhereWithComputedField extends TestCase {
22

  
23
    protected static final Logger LOGGER = LoggerFactory.getLogger(AbstractTestWhereWithComputedField.class);
24

  
25
    protected AbstractTestUtils utils;
26

  
27
    public AbstractTestWhereWithComputedField(String testName) {
28
        super(testName);
29
    }
30

  
31
    @Override
32
    protected void setUp() throws Exception {
33
        super.setUp();
34
        new DefaultLibrariesInitializer().fullInitialize();
35
    }
36

  
37
    @Override
38
    protected void tearDown() throws Exception {
39
        super.tearDown();
40
    }
41

  
42
    public AbstractTestUtils utils() {
43
        if (this.utils == null) {
44
            this.utils = this.createUtils();
45
        }
46
        return this.utils;
47
    }
48

  
49
    protected abstract AbstractTestUtils createUtils();
50

  
51
    // TODO add test methods here. The name must begin with 'test'. For example:
52
    // public void testHello() {}
53
    protected void testWhereWithComputedField() throws Exception {
54
        try {
55
            if (!utils().isTheDatabaseAvailable()) {
56
                return;
57
            }
58
            FeatureStore sourceStore = utils().openSourceStore2();
59
            JDBCServerExplorer explorer = utils().openServerExplorer("testCreate");
60
            utils().initWorkspace("testCreate");
61
            
62
            utils().info_jdbc(explorer);
63

  
64
            utils().drop_tables(explorer, "testCreateTarget2");
65
            utils().create_table_from(explorer, "testCreateTarget2", sourceStore);
66
            utils().insert_into_from(explorer, "testCreateTarget2", sourceStore, FeatureStore.MODE_APPEND);
67

  
68
            FeatureStore dbstore = utils().openStore(explorer, "testCreateTarget2");
69
            dbstore.edit();
70
            FeatureType featureType = dbstore.getDefaultFeatureType();
71
            EditableFeatureType eFeatureType = featureType.getEditable();
72
            eFeatureType.add("Compu1",
73
                    DataTypes.INTEGER,
74
                    new DefaultFeatureAttributeEmulatorExpression(
75
                            eFeatureType,
76
                            ExpressionUtils.createExpression("ID*2")
77
                    ));
78
            eFeatureType.add("Compu2",
79
                    DataTypes.INTEGER,
80
                    new DefaultFeatureAttributeEmulatorExpression(
81
                            eFeatureType,
82
                            ExpressionUtils.createExpression("Poblacion+10000+Compu1")
83
                    ));
84
            dbstore.update(eFeatureType);
85
            dbstore.finishEditing();
86
            List<Feature> features1 = dbstore.getFeatures("Compu1>8");
87
            System.out.println("## in output");
88
            assertEquals("Features 1 size:", 5, features1.size());
89
            for (int i = 0; i < features1.size(); i++) {
90
                Feature feature = features1.get(i);
91
                System.out.println("field Compu1: "+feature.format("Compu1") + " feature "+i+": "+feature.toString());
92
            }
93
            List<Feature> features2 = dbstore.getFeatures("Compu1<=8");
94
            System.out.println("## in output");
95
            assertEquals("Features 2 size:", 5, features2.size());
96
            for (int i = 0; i < features2.size(); i++) {
97
                Feature feature = features2.get(i);
98
                System.out.println("field Compu1: "+feature.format("Compu1") + " feature "+i+": "+feature.toString());
99
            }
100
            
101
            System.out.println("## end output");
102
            DisposeUtils.dispose(dbstore);
103
        } catch (Throwable th) {
104
            LOGGER.warn("", th);
105
            throw th;
106
        }
107
    }
108

  
109
}
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.h2spatial/org.gvsig.h2spatial.h2gis132/org.gvsig.h2spatial.h2gis132.provider/src/test/java/org/gvsig/fmap/dal/store/h2/operations/TestWhereWithComputedField.java
1
package org.gvsig.fmap.dal.store.h2.operations;
2

  
3
import org.gvsig.fmap.dal.store.h2.*;
4
import org.gvsig.fmap.dal.store.jdbc2.AbstractTestUtils;
5
import org.gvsig.fmap.dal.store.jdbc2.AbstractTestWhereWithComputedField;
6

  
7
public class TestWhereWithComputedField extends AbstractTestWhereWithComputedField {
8
    
9
    public TestWhereWithComputedField(String testName) {
10
        super(testName);
11
    }
12

  
13
    @Override
14
    protected AbstractTestUtils createUtils() {
15
        return new TestUtilsH2Spatial();
16
    }
17

  
18
    @Override
19
    public void testWhereWithComputedField() throws Exception {
20
        super.testWhereWithComputedField(); 
21
    }
22

  
23
}

Also available in: Unified diff