You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spot.apache.org by ev...@apache.org on 2017/01/25 18:36:38 UTC
[26/49] incubator-spot git commit: unit_test_cleanup
unit_test_cleanup
added flow time-of-day anomaly test
Project: http://git-wip-us.apache.org/repos/asf/incubator-spot/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-spot/commit/5a75bc5a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-spot/tree/5a75bc5a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-spot/diff/5a75bc5a
Branch: refs/heads/master
Commit: 5a75bc5a925ff5b59753b06ba4a1628001e8a08b
Parents: 8d13d3f
Author: nlsegerl <na...@intel.com>
Authored: Tue Dec 20 16:27:42 2016 -0800
Committer: nlsegerl <na...@intel.com>
Committed: Tue Dec 20 16:27:42 2016 -0800
----------------------------------------------------------------------
.../spot/netflow/FlowSuspiciousConnectsAnalysisTest.scala | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-spot/blob/5a75bc5a/spot-ml/src/test/scala/org/apache/spot/netflow/FlowSuspiciousConnectsAnalysisTest.scala
----------------------------------------------------------------------
diff --git a/spot-ml/src/test/scala/org/apache/spot/netflow/FlowSuspiciousConnectsAnalysisTest.scala b/spot-ml/src/test/scala/org/apache/spot/netflow/FlowSuspiciousConnectsAnalysisTest.scala
index 07bd8b6..d59635d 100644
--- a/spot-ml/src/test/scala/org/apache/spot/netflow/FlowSuspiciousConnectsAnalysisTest.scala
+++ b/spot-ml/src/test/scala/org/apache/spot/netflow/FlowSuspiciousConnectsAnalysisTest.scala
@@ -47,20 +47,19 @@ class FlowSuspiciousConnectsAnalysisTest extends TestingSparkContextFlatSpec wit
val logger = LogManager.getLogger("SuspiciousConnectsAnalysis")
logger.setLevel(Level.OFF)
- val testSqlContext = new org.apache.spark.sql.SQLContext(sparkContext)
val anomalousRecord = FlowRecord("2016-05-05 00:11:01", 2016, 5, 5, 0, 0, 1, 0.972f, "172.16.0.129", "10.0.2.202", 1024, 80, "TCP", 39, 12522, 0, 0)
val typicalRecord = FlowRecord("2016-05-05 13:54:58", 2016, 5, 5, 13, 54, 58, 0.972f, "172.16.0.129", "10.0.2.202", 1024, 80, "TCP", 39, 12522, 0, 0)
- import testSqlContext.implicits._
- val data = sparkContext.parallelize(Seq(anomalousRecord, typicalRecord, typicalRecord, typicalRecord, typicalRecord, typicalRecord,
- typicalRecord, typicalRecord, typicalRecord, typicalRecord)).toDF()
+ val data = sqlContext.createDataFrame(Seq(anomalousRecord, typicalRecord, typicalRecord, typicalRecord, typicalRecord, typicalRecord,
+ typicalRecord, typicalRecord, typicalRecord, typicalRecord))
+
val scoredData : DataFrame = FlowSuspiciousConnectsAnalysis.detectFlowAnomalies(data,
testConfig,
sparkContext,
- testSqlContext,
+ sqlContext,
logger)