Skip to content

Commit 005f9e0

Browse files
committed
Update Tests and logback
1 parent 5e87b53 commit 005f9e0

File tree

4 files changed

+19
-9
lines changed

4 files changed

+19
-9
lines changed

etl-core/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@
7070
<groupId>org.yaml</groupId>
7171
<artifactId>snakeyaml</artifactId>
7272
</dependency>
73+
<dependency>
74+
<groupId>org.projectlombok</groupId>
75+
<artifactId>lombok</artifactId>
76+
</dependency>
7377

7478
<!-- Test Dependencies -->
7579
<dependency>

etl-jobs/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@
3232
<artifactId>spark-sql_${scala.binary.version}</artifactId>
3333
</dependency>
3434

35+
<!-- Utilities-->
36+
<dependency>
37+
<groupId>org.projectlombok</groupId>
38+
<artifactId>lombok</artifactId>
39+
</dependency>
40+
3541
<!-- Test Dependencies -->
3642
<dependency>
3743
<groupId>org.junit.jupiter</groupId>

etl-jobs/src/main/java/org/apn/etl/jobs/sample/SampleDataTransformer.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
package org.apn.etl.jobs.sample;
1717

1818
import java.util.Map;
19+
import lombok.extern.slf4j.Slf4j;
1920
import org.apache.spark.sql.Dataset;
2021
import org.apache.spark.sql.Row;
2122
import org.apache.spark.sql.functions;
@@ -26,6 +27,7 @@
2627
*
2728
* @author Amit Prakash Nema
2829
*/
30+
@Slf4j
2931
public final class SampleDataTransformer extends AbstractDataTransformer {
3032

3133
private static final String PROCESSED_TIMESTAMP_COL = "processed_timestamp";
@@ -38,7 +40,7 @@ public final class SampleDataTransformer extends AbstractDataTransformer {
3840
@Override
3941
protected Dataset<Row> doTransform(
4042
final Dataset<Row> input, final Map<String, Object> parameters) {
41-
logger.info("Executing sample data transformation");
43+
log.info("Executing sample data transformation");
4244

4345
// Sample transformation: Add current timestamp and filter active records
4446
final Dataset<Row> transformed =
@@ -48,7 +50,7 @@ protected Dataset<Row> doTransform(
4850
.withColumn(MONTH_COL, functions.month(functions.col(DATE_COLUMN_COL)))
4951
.filter(functions.col(STATUS_COL).equalTo(ACTIVE_STATUS));
5052

51-
logger.info(
53+
log.info(
5254
"Sample transformation completed. Input records: {}, Output records: {}",
5355
input.count(),
5456
transformed.count());

etl-jobs/src/main/java/org/apn/etl/jobs/sample/SampleETLJob.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
package org.apn.etl.jobs.sample;
1717

1818
import java.io.IOException;
19+
import lombok.extern.slf4j.Slf4j;
1920
import org.apache.commons.cli.CommandLine;
2021
import org.apache.commons.cli.CommandLineParser;
2122
import org.apache.commons.cli.DefaultParser;
@@ -27,17 +28,14 @@
2728
import org.apn.etl.core.exception.ETLException;
2829
import org.apn.etl.core.model.ETLJobConfig;
2930
import org.apn.etl.core.utils.ETLUtils;
30-
import org.slf4j.Logger;
31-
import org.slf4j.LoggerFactory;
3231

3332
/**
3433
* Sample ETL Job implementation
3534
*
3635
* @author Amit Prakash Nema
3736
*/
37+
@Slf4j
3838
public final class SampleETLJob {
39-
private static final Logger logger = LoggerFactory.getLogger(SampleETLJob.class);
40-
4139
private SampleETLJob() {
4240
// private constructor to hide the implicit public one
4341
}
@@ -65,10 +63,10 @@ public static void main(final String[] args) {
6563
final ETLEngine engine = new ETLEngine(jobConfig);
6664
engine.execute();
6765

68-
logger.info("ETL job execution completed successfully");
66+
log.info("ETL job execution completed successfully");
6967

7068
} catch (final ParseException | IOException | ETLException e) {
71-
logger.error("ETL job execution failed", e);
69+
log.error("ETL job execution failed", e);
7270
System.exit(1);
7371
}
7472
}
@@ -101,7 +99,7 @@ public static CommandLine parseArguments(final String[] args) throws ParseExcept
10199
}
102100

103101
public static ETLJobConfig loadJobConfig(final String configPath) throws IOException {
104-
logger.info("Loading job configuration from: {}", configPath);
102+
log.info("Loading job configuration from: {}", configPath);
105103
return ETLUtils.loadYamlConfig(configPath, ETLJobConfig.class);
106104
}
107105
}

0 commit comments

Comments
 (0)