Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicole00 committed Dec 27, 2021
1 parent 0d743f6 commit 071237b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,9 @@ import org.scalatest.Assertions.assertThrows
import scala.collection.JavaConverters._

class EdgeProcessorSuite {
val spark = SparkSession
.builder()
.master("local")
.appName("test")
.getOrCreate()
val config: Configs = Configs.parse(new File("src/test/resources/process_application.conf"))

var data: DataFrame = spark.read.option("header", "true").csv("src/test/resources/edge.csv")
var data: DataFrame = null
var edgeConfig: EdgeConfigEntry = config.edgesConfig.head
val fieldKeys = List("col1",
"col2",
Expand Down Expand Up @@ -69,11 +64,8 @@ class EdgeProcessorSuite {
"col13",
"col14")

val batchSuccess = spark.sparkContext.longAccumulator(s"batchSuccess")
val batchFailure = spark.sparkContext.longAccumulator(s"batchFailure")

val processClazz =
new EdgeProcessor(data, edgeConfig, fieldKeys, nebulaKeys, config, batchSuccess, batchFailure)
new EdgeProcessor(data, edgeConfig, fieldKeys, nebulaKeys, config, null, null)
@Test
def isEdgeValidSuite(): Unit = {
val stringIdValue = List("Bob", "Tom")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,19 +191,20 @@ class ProcessorSuite extends Processor {
val point = Geography.ptVal(new Point(new Coordinate(3, 8)))
assert(convertJTSGeometryToGeography(pointGeom) == point)

val lineWkt = "LINE(1 2,2 4)"
val lineWkt = "LINESTRING(1 2,2 4)"
val lineGeom = new org.locationtech.jts.io.WKTReader().read(lineWkt)
val coordList = List(new Coordinate(1, 2), new Coordinate(2, 4))
val line = Geography.lsVal(new LineString(coordList.asJava))
assert(convertJTSGeometryToGeography(lineGeom) == line)

val polygonWkt = "POLYGON((1 2,2 4,3 5,5 6))"
val polygonWkt = "POLYGON((1 2,2 4,3 5,5 6,1 2))"
val polygonGeom = new org.locationtech.jts.io.WKTReader().read(polygonWkt)
val list = new ListBuffer[Coordinate]()
list.append(new Coordinate(1, 2))
list.append(new Coordinate(2, 4))
list.append(new Coordinate(3, 5))
list.append(new Coordinate(5, 6))
list.append(new Coordinate(1, 2))
val coordListList: java.util.ArrayList[java.util.List[Coordinate]] =
new java.util.ArrayList[java.util.List[Coordinate]]
coordListList.add(list.asJava)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,9 @@ import org.scalatest.Assertions.assertThrows
import scala.collection.JavaConverters._

class VerticesProcessorSuite {
val spark = SparkSession
.builder()
.master("local")
.appName("test")
.getOrCreate()
val config: Configs = Configs.parse(new File("src/test/resources/process_application.conf"))

var data: DataFrame = spark.read.option("header", "true").csv("src/test/resources/vertex.csv")
var data: DataFrame = null
var tagConfig: TagConfigEntry = config.tagsConfig.head
val fieldKeys = List("col1",
"col2",
Expand Down Expand Up @@ -69,16 +64,8 @@ class VerticesProcessorSuite {
"col13",
"col14")

val batchSuccess = spark.sparkContext.longAccumulator(s"batchSuccess")
val batchFailure = spark.sparkContext.longAccumulator(s"batchFailure")

val processClazz = new VerticesProcessor(data,
tagConfig,
fieldKeys,
nebulaKeys,
config,
batchSuccess,
batchFailure)
val processClazz =
new VerticesProcessor(data, tagConfig, fieldKeys, nebulaKeys, config, null, null)
@Test
def isVertexValidSuite(): Unit = {
val stringIdValue = List("Bob")
Expand Down Expand Up @@ -123,7 +110,7 @@ class VerticesProcessorSuite {
val vertex = processClazz.convertToVertex(row, tagConfig, true, fieldKeys, map)
assert(vertex.vertexID.equals("\"1\""))
assert(vertex.toString.equals(
"Vertex ID: \"1\", Values: \"\", \"fixedBob\", 12, 200, 1000, 100000, date(\"2021-01-01\"), datetime(\"2021-01-01T12:00:00.100\"), time(\"12:00:00.100\"), timestamp(\"2021-01-01T12:00:00\"), true, 12.01, 22.12, ST_GeogFromText(\"POINT(3 8)\")"))
"Vertex ID: \"1\", Values: \"\", \"fixedBob\", 12, 200, 1000, 100000, date(\"2021-01-01\"), datetime(\"2021-01-01T12:00:00.100\"), time(\"12:00:00.100\"), 345436232, true, 12.01, 22.12, ST_GeogFromText(\"POINT(3 8)\")"))
}

@Test
Expand Down

0 comments on commit 071237b

Please sign in to comment.