Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ jobs:
- name: Run unit tests (retry)
id: test-retry
if: steps.test.outcome=='failure'
continue-on-error: true
run: |
set -o pipefail
RESUME_FROM="$({ grep --text 'mvn <args> -rf ' test.log || test $? = 1; } | tail -n1 | sed 's/.*-rf/-rf/')"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import org.locationtech.geomesa.convert.EvaluationContext
import org.locationtech.geomesa.convert.EvaluationContext.{StatefulEvaluationContext, Stats}
import org.locationtech.geomesa.convert2.AbstractConverter.BasicField
import org.locationtech.geomesa.convert2.Field
import org.locationtech.geomesa.convert2.metrics.ConverterMetrics
import org.locationtech.geomesa.convert2.transforms.Expression.{FunctionExpression, Literal}
import org.locationtech.geomesa.utils.text.WKTUtils
import org.locationtech.jts.geom._
Expand Down Expand Up @@ -946,12 +945,15 @@ class ExpressionTest extends Specification {
}
}
"convert integer to boolean" >> {
val trans = Expression("intToBoolean($0)")
trans.apply(Array(Int.box(1))) mustEqual true
trans.apply(Array(Int.box(0))) mustEqual false
trans.apply(Array(Int.box(-20))) mustEqual true
trans.apply(Array(Int.box(10000))) mustEqual true
trans.apply(Array(Double.box(2.2))) must throwA[ClassCastException]
foreach(Seq("intToBoolean", "toBoolean")) { expr =>
val trans = Expression(expr + "($0)")
trans.apply(Array(Int.box(1))) mustEqual true
trans.apply(Array(Int.box(0))) mustEqual false
trans.apply(Array(Int.box(-20))) mustEqual true
trans.apply(Array(Int.box(10000))) mustEqual true
trans.apply(Array(null)) must beNull
trans.apply(Array(Double.box(2.2))) mustEqual true
}
}
"strip quotes" >> {
val trans = Expression("stripQuotes($0)")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,6 @@ import org.specs2.runner.JUnitRunner
class MiscFunctionFactoryTest extends Specification {

"MiscFunctionFactory" >> {
"intToBoolean" should {
"convert a 0 to false" >> {
MiscFunctionFactory.intToBoolean(Array(Int.box(0))) mustEqual false
}
"convert a 1 to true" >> {
MiscFunctionFactory.intToBoolean(Array(Int.box(1))) mustEqual true
}
"convert any int other than 0 to true" >> {
MiscFunctionFactory.intToBoolean(Array(Int.box(1000))) mustEqual true
MiscFunctionFactory.intToBoolean(Array(Int.box(-2))) mustEqual true
}
"return null for null input" >> {
MiscFunctionFactory.intToBoolean(Array(null)) mustEqual null
}
"throw an error if faced with a non-int value" >> {
MiscFunctionFactory.intToBoolean(Array(Double.box(0.55567))) must throwA[ClassCastException]
MiscFunctionFactory.intToBoolean(Array("0")) must throwA[ClassCastException]
}
}

"require" should {
"return the passed-in argument, if it exists" >> {
MiscFunctionFactory.require(Array("a")) mustEqual "a"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class Version1BackwardsCompatTest extends Specification {
}

def readPipeFile(f: File, sft: SimpleFeatureType): List[ScalaSimpleFeature] =
WithClose(Source.fromFile(f)(UTF8))(_.getLines).map(line => ScalaSimpleFeature.copy(DataUtilities.createFeature(sft, line))).toList
WithClose(Source.fromFile(f)(UTF8))(_.getLines.toList).map(line => ScalaSimpleFeature.copy(DataUtilities.createFeature(sft, line)))

def createComplicatedFeatures(numFeatures : Int): Seq[Version1ASF] = {
val geoSchema = "f0:String,f1:Integer,f2:Double,f3:Float,f4:Boolean,f5:UUID,f6:Date,f7:Point:srid=4326,f8:Polygon:srid=4326"
Expand Down
Loading