Skip to content

Commit

Permalink
Fixed config version
Browse files Browse the repository at this point in the history
  • Loading branch information
fazpiazu committed Dec 3, 2024
1 parent 96436f4 commit 32d93e7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 19 deletions.
15 changes: 11 additions & 4 deletions src/main/scala/com/metabolic/data/mapper/domain/Config.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import com.metabolic.data.mapper.domain.ops.Mapping
import com.typesafe.config.ConfigFactory

class Config(val name: String, val sources: Seq[Source], val mappings: Seq[Mapping], val sink: Sink,
defaults: Defaults, environment: Environment, val owner: Option[String], val sqlUrl: String, val confUrl: String) extends CoreConfig(defaults, environment) {
defaults: Defaults, environment: Environment, val owner: String="", val sqlUrl: String="", val confUrl: String="") extends CoreConfig(defaults, environment) {

def getCanonicalName() = {
//regex to remove all non-alphanumeric characters
Expand All @@ -26,11 +26,18 @@ class Config(val name: String, val sources: Seq[Source], val mappings: Seq[Mappi
object Config {

def apply(name: String, sources: Seq[Source], mappings: Seq[Mapping], sink: Sink,
defaults: Defaults, platform: Environment, owner: Option[String], sqlUrl: String, confUrl: String): Config = {
new Config(name, sources, mappings, sink, defaults, platform, owner, sqlUrl, confUrl)
defaults: Defaults, platform: Environment): Config = {
new Config(name, sources, mappings, sink, defaults, platform, "", "", "")
}

def apply(name: String, sources: Seq[Source], mappings: Seq[Mapping], sink: Sink, owner: Option[String], sqlUrl: String, confUrl: String): Config = {
def apply(name: String, sources: Seq[Source], mappings: Seq[Mapping], sink: Sink): Config = {
val defaults: Defaults = Defaults(ConfigFactory.load())
val environment: Environment = Environment("", EngineMode.Batch, "", false,"test","",
Regions.fromName("eu-central-1"),Option.empty, Option.empty, Option.empty)
new Config(name, sources, mappings, sink, defaults, environment, "", "", "")
}

def apply(name: String, sources: Seq[Source], mappings: Seq[Mapping], sink: Sink, owner: String, sqlUrl: String, confUrl: String): Config = {
val defaults: Defaults = Defaults(ConfigFactory.load())
val environment: Environment = Environment("", EngineMode.Batch, "", false,"test","",
Regions.fromName("eu-central-1"),Option.empty, Option.empty, Option.empty)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,11 @@ class ConfigParserService(implicit region: Regions) extends Logging {
fileUrl.replace(".sql", s".$urlType").replace("s3://factorial-metabolic/data-lake-confs/production", "https://github.com/factorialco/data-lake/tree/main")
}

private def parseOwner(config: HoconConfig): Option[String] = {
private def parseOwner(config: HoconConfig): String = {
if (config.hasPathOrNull("owner")) {
Option.apply(config.getString("owner"))
config.getString("owner")
} else {
Option.empty
""
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,7 @@ class AtlanServiceTest extends AnyFunSuite
List(new SQLFileMapping("src/test/resources/simple.sql", region)),
io.FileSink("test", "src/test/tmp/gold/stripe_f_fake_employee_t/version=4/", WriteMode.Overwrite, IOFormat.PARQUET),
Defaults(ConfigFactory.load()),
Environment("", EngineMode.Batch, "", false, "test", "", region, Option(""), Option(""), Option(""), false, false,Seq("raw", "clean", "gold", "bronze"), Seq("raw_stripe", "raw_hubspot")),
Option("Test User"),
"",
""
Environment("", EngineMode.Batch, "", false, "test", "", region, Option(""), Option(""), Option(""), false, false,Seq("raw", "clean", "gold", "bronze"), Seq("raw_stripe", "raw_hubspot"))
)

val expectedJson =
Expand Down Expand Up @@ -125,10 +122,7 @@ class AtlanServiceTest extends AnyFunSuite
List(new SQLFileMapping("src/test/resources/simple.sql", region)),
io.StreamSink("Name test",Seq("test"), "test", "test", "topic2", Option.empty, IOFormat.KAFKA, Seq.empty),
Defaults(ConfigFactory.load()),
Environment("", EngineMode.Batch, "", false, "test", "", region, Option(""), Option(""), Option(""), false, false,Seq("raw", "clean", "gold", "bronze"), Seq("raw_stripe", "raw_hubspot")),
Option("Test User"),
"",
""
Environment("", EngineMode.Batch, "", false, "test", "", region, Option(""), Option(""), Option(""), false, false,Seq("raw", "clean", "gold", "bronze"), Seq("raw_stripe", "raw_hubspot"))
)

val expectedJson =
Expand Down Expand Up @@ -209,10 +203,7 @@ class AtlanServiceTest extends AnyFunSuite
List(new SQLFileMapping("src/test/resources/simple.sql", region)),
io.FileSink("test", "src/test/tmp/gold/stripe_f_fake_employee_t/version=4/", WriteMode.Overwrite, IOFormat.PARQUET),
Defaults(ConfigFactory.load()),
Environment("", EngineMode.Batch, "", false, "test", "", region, Option(""),Option(""), Option(""), false, false, Seq("raw", "clean", "gold", "bronze"), Seq("raw_stripe", "raw_hubspot")),
Option("Test User"),
"",
""
Environment("", EngineMode.Batch, "", false, "test", "", region, Option(""),Option(""), Option(""), false, false, Seq("raw", "clean", "gold", "bronze"), Seq("raw_stripe", "raw_hubspot"))
)
val calculatedJson = new AtlanService("foo", "foo", "foo")
.generateMetadaBody(testingConfig)
Expand Down

0 comments on commit 32d93e7

Please sign in to comment.