import scala.collection.JavaConverters._
val typeName = "foo"
ds.getSchema(typeName) must beNull
ds.createSchema(SimpleFeatureTypes.createType(typeName, "dtg:Date,*geom:Point:srid=4326"))
val sft = ds.getSchema(typeName)
val features = Seq(
Array("0", "2019-03-18T00:00:00.000Z", "POINT (-122.32876 47.75205)"),
Array("1", "2019-03-18T00:00:00.000Z", "POINT (-122.329994 47.751984)")).map { line =>
val sf = ScalaSimpleFeature.create(sft, line.head, line.tail: _*)
sf.getUserData.put(Hints.USE_PROVIDED_FID, java.lang.Boolean.TRUE)
sf
}
val ids = ds.getFeatureSource(typeName).asInstanceOf[SimpleFeatureStore]
.addFeatures(new ListFeatureCollection(sft, features))
ids.asScala.map(_.getID) must containTheSameElementsAs(features.map(_.getID))
val filter = ECQL.toFilter("dtg = '2019-03-18T00:00:00.000Z' AND " +
"bbox(geom, -122.33072251081467,47.75143951177597,-122.32643097639084,47.753048837184906)")
val query = new Query(typeName, filter)
val results = SelfClosingIterator(ds.getFeatureReader(query, Transaction.AUTO_COMMIT)).toList
results must containTheSameElementsAs(features)