Skip to content

Commit

Permalink
#280: AgentWithServerIntegrationTests should run against local servic…
Browse files Browse the repository at this point in the history
…e and thus HTTP Dispatcher
  • Loading branch information
lsulak committed Oct 2, 2024
1 parent 204f1b1 commit fd2c52f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import org.apache.spark.sql.{Row, SparkSession}
import za.co.absa.atum.agent.model.AtumMeasure.RecordCount
import za.co.absa.balta.DBTestSuite
import za.co.absa.balta.classes.JsonBString
import com.typesafe.config.{Config, ConfigFactory, ConfigValueFactory}

import scala.collection.immutable.ListMap

Expand Down Expand Up @@ -58,12 +59,21 @@ class AgentWithServerIntegrationTests extends DBTestSuite {
val rdd = spark.sparkContext.parallelize(testDataForRDD)
val df = spark.createDataFrame(rdd, testDataSchema)

// Atum Context Stuff Preparation - Partitioning, Measures, Additional Data, Checkpoint
// Atum Agent preparation - Agent configured to work with HTTP Dispatcher and service on localhost
val agent = AtumAgent
agent.dispatcherFromConfig(
ConfigFactory
.empty()
.withValue("atum.dispatcher.type", ConfigValueFactory.fromAnyRef("http"))
.withValue("atum.dispatcher.http.url", ConfigValueFactory.fromAnyRef("http://localhost:8080"))
)

// Atum Context stuff preparation - Partitioning, Measures, Additional Data, Checkpoint
val domainAtumPartitioning = ListMap(
"partition1" -> "valueFromTest1",
"partition2" -> "valueFromTest2"
)
val domainAtumContext = AtumAgent.getOrCreateAtumContext(domainAtumPartitioning)
val domainAtumContext = agent.getOrCreateAtumContext(domainAtumPartitioning)

domainAtumContext.addMeasure(RecordCount("*"))
domainAtumContext.addAdditionalData("author", "Laco")
Expand Down
3 changes: 1 addition & 2 deletions project/JacocoSetup.scala
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ object JacocoSetup {
"za.co.absa.atum.server.Constants*",
"za.co.absa.atum.server.api.database.DoobieImplicits*",
"za.co.absa.atum.server.api.database.TransactorProvider*",
"za.co.absa.atum.model.dto.*",
"za.co.absa.atum.agent.AgentWithServerIntegrationTests"
"za.co.absa.atum.model.dto.*"
)
}

Expand Down

0 comments on commit fd2c52f

Please sign in to comment.