Index: 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/usecases/arena2/TestMultipleExpansionOfCalculatedField.java
===================================================================
--- 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/usecases/arena2/TestMultipleExpansionOfCalculatedField.java	(revision 46110)
+++ 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/usecases/arena2/TestMultipleExpansionOfCalculatedField.java	(revision 46111)
@@ -1,108 +1,24 @@
 package org.gvsig.fmap.dal.store.h2.operations.usecases.arena2;
 
-import java.util.List;
-import junit.framework.TestCase;
-import org.gvsig.expressionevaluator.ExpressionUtils;
-import org.gvsig.fmap.dal.DataTypes;
-import org.gvsig.fmap.dal.feature.EditableFeatureAttributeDescriptor;
-import org.gvsig.fmap.dal.feature.EditableFeatureType;
-import org.gvsig.fmap.dal.feature.FeatureQuery;
-import org.gvsig.fmap.dal.feature.FeatureStore;
-import org.gvsig.fmap.dal.feature.FeatureType;
-import org.gvsig.fmap.dal.impl.expressionevaluator.DefaultFeatureAttributeEmulatorExpression;
-import org.gvsig.fmap.dal.store.h2.TestUtils;
-import org.gvsig.fmap.dal.store.jdbc2.JDBCHelper;
-import org.gvsig.fmap.dal.store.jdbc2.OperationsFactory;
-import org.gvsig.fmap.dal.store.jdbc2.OperationsFactory.TableReference;
-import org.gvsig.fmap.dal.store.jdbc2.spi.JDBCSQLBuilderBase;
-import org.gvsig.fmap.dal.store.jdbc2.spi.operations.CountOperation;
-import org.gvsig.fmap.dal.store.jdbc2.spi.operations.ResultSetForSetProviderOperation;
-import org.gvsig.tools.library.impl.DefaultLibrariesInitializer;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.gvsig.fmap.dal.store.h2.TestUtilsH2Spatial;
+import org.gvsig.fmap.dal.store.jdbc2.AbstractTestUtils;
+import org.gvsig.fmap.dal.store.jdbc2.operations.usecases.arena2.AbstractTestMultipleExpansionOfCalculatedField;
 
 @SuppressWarnings("UseSpecificCatch")
-public class TestMultipleExpansionOfCalculatedField extends TestCase {
+public class TestMultipleExpansionOfCalculatedField extends AbstractTestMultipleExpansionOfCalculatedField {
 
-    private static final Logger LOGGER = LoggerFactory.getLogger(TestMultipleExpansionOfCalculatedField.class);
-
     public TestMultipleExpansionOfCalculatedField(String testName) {
         super(testName);
     }
 
     @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-        new DefaultLibrariesInitializer().fullInitialize();
+    protected AbstractTestUtils createUtils() {
+        return new TestUtilsH2Spatial();
     }
-
+    
     @Override
-    protected void tearDown() throws Exception {
-        super.tearDown();
-    }
-
-    protected List<String> getExpectedSQLs(String name) throws Exception {
-        return TestUtils.getSQLs(name);
-    }
-
     public void testMultipleExpansionOfCalculatedField() throws Exception {
-        try {
-            JDBCHelper helper = TestUtils.createJDBCHelper();
-            JDBCSQLBuilderBase sqlbuilder = helper.createSQLBuilder();
-            OperationsFactory operations = helper.getOperations();
-
-            List<String> expectedSQLs = getExpectedSQLs("usecases/arena2/testMultipleExpansionOfCalculatedField.sql");
-
-            FeatureStore arena2_conductores = TestUtils.openStoreTest("usecases/arena2/ARENA2_CONDUCTORES.csv");
-            FeatureStore arena2_accidentes = TestUtils.openStoreTest("usecases/arena2/ARENA2_ACCIDENTES.csv");
-            FeatureStore arena2_vehiculos = TestUtils.openStoreTest("usecases/arena2/ARENA2_VEHICULOS.csv");
-
-            TableReference table = operations.createTableReference(
-                    "dbtest",
-                    "public", //sqlbuilder.default_schema(),
-                    "ARENA2_CONDUCTORES",
-                    null
-            );
-            FeatureType featureType = arena2_conductores.getDefaultFeatureType();
-            EditableFeatureType eFeatureType = featureType.getEditable();
-            FeatureQuery query = arena2_conductores.createFeatureQuery();
-            addExtraColumn(eFeatureType, query, "AccKm0", DataTypes.DOUBLE, "FOREING_VALUE('ID_ACCIDENTE.KM')");
-            addExtraColumn(eFeatureType, query, "AccKm1", DataTypes.DOUBLE, "AccKm0 * 100");
-            addExtraColumn(eFeatureType, query, "AccKm2", DataTypes.DOUBLE, "AccKm0 * 222");
-            
-            CountOperation count = operations.createCount(eFeatureType, table, null, query);
-            String sqlcount = count.getSQL();
-            System.out.println("###### SQL:" + sqlcount);
-            System.out.println("###### EXP:" + expectedSQLs.get(1));
-            assertEquals("Count SQL", expectedSQLs.get(1), sqlcount);
-
-            ResultSetForSetProviderOperation resultSetForSetProvider = operations.createResultSetForSetProvider(
-                    table,
-                    null,
-                    null,
-                    query,
-                    eFeatureType,
-                    eFeatureType,
-                    15,
-                    0,
-                    0
-            );
-            String sql = resultSetForSetProvider.getSQL();
-            System.out.println("###### SQL:" + sql);
-            System.out.println("###### EXP:" + expectedSQLs.get(0));
-
-            assertEquals("Select SQL", expectedSQLs.get(0), sql);
-            
-            
-        } catch (Throwable th) {
-            th.printStackTrace();
-            throw th;
-        }
+       super.testMultipleExpansionOfCalculatedField();
     }
-    
-    private void addExtraColumn(EditableFeatureType eFeatureType, FeatureQuery query, String name, int type, String exp) {
-        EditableFeatureAttributeDescriptor extraColumn = query.getExtraColumn().add(name, type);
-        extraColumn.setFeatureAttributeEmulator(new DefaultFeatureAttributeEmulatorExpression(eFeatureType, ExpressionUtils.createExpression(exp)));
-    }
 
 }
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.h2spatial/org.gvsig.h2spatial.h2gis132/org.gvsig.h2spatial.h2gis132.provider/src/test/resources/org/gvsig/fmap/dal/store/h2/resultSetForSetProvider.sql
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.h2spatial/org.gvsig.h2spatial.h2gis132/org.gvsig.h2spatial.h2gis132.provider/src/test/resources/org/gvsig/fmap/dal/store/h2/resultSetForSetProvider.sql	(revision 46110)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.h2spatial/org.gvsig.h2spatial.h2gis132/org.gvsig.h2spatial.h2gis132.provider/src/test/resources/org/gvsig/fmap/dal/store/h2/resultSetForSetProvider.sql	(revision 46111)
@@ -106,6 +106,6 @@
     ("ID" * 2) AS "Compu1", 
     SUM(("Long" + 300)) AS "Compu2", 
     SUM(((20 + "Byte") + ("ID" * 2))) AS "Extra2", 
-    (("Long" + 10) + (("ID" * 2))) AS "Extra1" 
-FROM "PUBLIC"."test" GROUP BY "test"."Long", (("Long" + 10) + (("ID" * 2))), (("ID" * 2)) 
+    (("Long" + 10) + ("ID" * 2)) AS "Extra1" 
+FROM "PUBLIC"."test" GROUP BY "test"."Long", (("Long" + 10) + (("ID" * 2))), ("ID" * 2) 
 ORDER BY "test"."Long" ASC NULLS LAST, "Extra1" ASC NULLS LAST, "Compu1" ASC NULLS LAST, "ID" ASC NULLS LAST;
