IGNITE=5243: Fixed test failures for geo-spatial indexing.
@@ -30,6 +30,7 @@ import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.cache.query.SqlQuery;
import org.apache.ignite.cache.query.annotations.QuerySqlField;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.processors.cache.GridCacheAbstractSelfTest;
import org.apache.ignite.internal.processors.query.QueryUtils;
@@ -137,7 +138,9 @@ public abstract class H2IndexingAbstractGeoSelfTest extends GridCacheAbstractSel
entity.setIndexes(null);
- IgniteCache<K, V> cache = grid(0).getOrCreateCache(ccfg);
+ grid(0).context().cache().dynamicStartSqlCache(ccfg).get();
+
+ IgniteCache<K, V> cache = grid(0).cache(name);
// Process indexes dynamically.
for (QueryIndex idx : idxs) {
@@ -213,6 +216,20 @@ public abstract class H2IndexingAbstractGeoSelfTest extends GridCacheAbstractSel
return ccfg;
}
+ /**
+ * Destroy cache.
+ *
+ * @param cache Cache.
+ * @param grid Node.
+ * @param dynamic Dynamic flag.
+ */
+ private static void destroy(IgniteCache cache, IgniteEx grid, boolean dynamic) {
+ if (!dynamic)
+ cache.destroy();
+ else
+ grid.context().cache().dynamicDestroyCache(cache.getName(), true, true);
+ }
+
/**
* @throws Exception If failed.
*/
@@ -323,7 +340,7 @@ public abstract class H2IndexingAbstractGeoSelfTest extends GridCacheAbstractSel
cache.query(new SqlFieldsQuery("DROP INDEX \"EnemyCamp_coords_idx\"")).getAll();
}
finally {
- cache.destroy();
+ destroy(cache, grid(0), dynamic);
}
}
@@ -452,7 +469,7 @@ public abstract class H2IndexingAbstractGeoSelfTest extends GridCacheAbstractSel
throw err0;
}
finally {
- cache1.destroy();
+ destroy(cache1, grid(0), dynamic);
}
}
@@ -540,8 +557,8 @@ public abstract class H2IndexingAbstractGeoSelfTest extends GridCacheAbstractSel
checkLocalQuery();
}
finally {
- c1.destroy();
- c2.destroy();
+ destroy(c1, grid(0), dynamic);
+ destroy(c2, grid(0), dynamic);
}
}
