Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#50: Create or adjust endpoint for accepting and saving checkpoint data #74

Conversation

TebaleloS
Copy link
Collaborator

@TebaleloS TebaleloS commented Sep 18, 2023

  • This PR implement a functionality of saving data into the postgreSQL database using slickpg.
  • Added Fa-db library for communication with the database.
  • impelemented a checkpoint controller as PrototypeController and injected DatabaseService for communicating with the db.
  • Changed checkpoint service to DatabaseService.
  • Defined postgres engine in the application.properties in the server package.
  • Added postgres configuration in the AtumConfig.
  • Created and instantiated runs class for the server to be able to communicate with the sql function that create a checkpoint in the database.
  • Added the package for access provider and implemented access providers.
    Closes Create (adjust) endpoint for accepting and saving checkpoint data #50

@github-actions
Copy link

github-actions bot commented Sep 18, 2023

JaCoCo agent module code coverage report - spark:2 - scala 2.12.12

There is no coverage information present for the Files changed

Total Project Coverage 83.26% 🍏

@github-actions
Copy link

github-actions bot commented Sep 18, 2023

JaCoCo server module code coverage report - scala 2.12.12

File Coverage [21.32%]
AtumConfig.scala 100% 🍏
TestService.scala 100% 🍏
PostgresAccessProvider.scala 95.45% 🍏
CheckpointController.scala 42.86%
DatabaseService.scala 42.11%
Runs.scala 22.08%
BaseApiService.scala 10.91%
ControlMeasureService.scala 9.85%
BaseApiController.scala 8.11%
ControlMeasureController.scala 4.76%
Checkpoint.scala 2.66%
Total Project Coverage 18.31%

@benedeki benedeki added the work in progress Work on this item is not yet finished (mainly intended for PRs) label Sep 18, 2023
@lsulak lsulak changed the base branch from master to feature/37-dao-between-agent-server-adjustments September 21, 2023 10:44
lsulak and others added 5 commits September 21, 2023 12:46
…ver-adjustments' into feature/#50-Create-or-adjust-endpoint-for-accepting-and-saving-checkpoint-data

# Conflicts:
#	server/src/main/scala/za/co/absa/atum/web/model/Checkpoint.scala
…ver-adjustments' into feature/#50-Create-or-adjust-endpoint-for-accepting-and-saving-checkpoint-data

# Conflicts:
#	project/plugins.sbt
@TebaleloS TebaleloS marked this pull request as ready for review September 28, 2023 10:30
Base automatically changed from feature/37-dao-between-agent-server-adjustments to master October 6, 2023 15:55
@TebaleloS TebaleloS force-pushed the feature/#50-Create-or-adjust-endpoint-for-accepting-and-saving-checkpoint-data branch from 32cf9e7 to 1238951 Compare October 10, 2023 12:27
@TebaleloS TebaleloS force-pushed the feature/#50-Create-or-adjust-endpoint-for-accepting-and-saving-checkpoint-data branch from 3581485 to e710558 Compare October 31, 2023 06:43
Copy link
Collaborator

@miroslavpojer miroslavpojer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • pull
  • run test (sbt clean test)
    • BaseApiController.scala - problem with imports - failing tests
      Solution proposal (tested):
    import jakarta.servlet.http.HttpServletRequest   ---- remove
    import javax.servlet.http.HttpServletRequest      ---- add
    
    • ControlMeasureController.scala
      Solution proposal (tested):
    import jakarta.servlet.http.HttpServletRequest   ---- remove
    import javax.servlet.http.HttpServletRequest      ---- add
    
    • failing test "TestServiceSpec"
    An exception or error caused a run to abort: Failed to load ApplicationContext 
    java.lang.IllegalStateException: Failed to load ApplicationContext
    
  • code coverage - visible very low code coverage of changed/touched scala files.

@miroslavpojer
Copy link
Collaborator

Is here plan to focus the low code coverage of changed/touched classes?

private val config = ConfigFactory.load("application.properties")

override def dbConfig: Config = config.getConfig("postgres")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice.


private def databaseConfig: Config = {
val baseConfig = AtumConfig.dbConfig
Map.empty.foldLeft(baseConfig) { case (acc, (configPath, configVal)) =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the point of this code?
It's a foldLeft on an empty Map, so no op.

Copy link
Collaborator

@lsulak lsulak Nov 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a TODO comment as promised & created a new ticket for this

Copy link
Collaborator

@miroslavpojer miroslavpojer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • pull
  • code review
  • build
  • test run
  • code coverage analysis: Missing unit tests at least for new code. Better for improved/changed code.
  • manual API test

class CheckpointStatusTypeRef extends TypeReference[CheckpointStatus.type]


// To check By Forgiveness
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgotten comment?

@miroslavpojer
Copy link
Collaborator

I am missing unit tests for at least new code. Is their implementation planned?

@miroslavpojer
Copy link
Collaborator

After last commit build is failing:

08:14:07.848 [pool-8-thread-3-ScalaTest-running-MeasureTest] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.maxCachedByteBuffersPerChunk: 1023
[error] /Users/ab024ll/repos/absa/branches/atum-service_74/server/src/main/scala/za/co/absa/atum/web/api/service/DatabaseService.scala:36:46: missing parameter type
[error]     wroteCheckpointFuture.thenApply[Boolean](_ => TRUE)
[error]                                              ^
[error] one error found

Copy link
Contributor

@benedeki benedeki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • code reviewed
  • pulled
  • built
  • run

@lsulak
Copy link
Collaborator

lsulak commented Nov 6, 2023

@miroslavpojer tests will be part of DB test PR, it would be too big here; otherwise, no need to test model/ and server/ so far is actually not doing too much - no crazy data transformations etc, mostly just calling DB

@lsulak lsulak merged commit c8ba0c6 into master Nov 6, 2023
5 of 6 checks passed
@lsulak lsulak deleted the feature/#50-Create-or-adjust-endpoint-for-accepting-and-saving-checkpoint-data branch November 6, 2023 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create (adjust) endpoint for accepting and saving checkpoint data
5 participants