Skip to content

Commit

Permalink
Push works
Browse files Browse the repository at this point in the history
  • Loading branch information
cheroliv committed Sep 27, 2024
1 parent 91bbfef commit 27e66af
Show file tree
Hide file tree
Showing 19 changed files with 53 additions and 1,533 deletions.
5 changes: 5 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,8 @@ arrow-kt_jackson.version=0.14.1
node-gradle.version=7.0.2
jbake-gradle.version=5.5.0
kotlinx-serialization-json.version=1.7.2
#docker_registry=
#docker_hub_login=
#docker_hub_email=
#docker_hub_password=
#docker_hub_login_token=
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ class InvalidPasswordException :
companion object {
private const val serialVersionUID = 1L
}

}
2 changes: 1 addition & 1 deletion springboot/api/src/main/kotlin/webapp/users/User.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@file:Suppress(
"RemoveRedundantQualifierName",
"MemberVisibilityCanBePrivate"
"MemberVisibilityCanBePrivate", "SqlNoDataSourceInspection"
)

package webapp.users
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import org.springframework.context.ApplicationContext
import org.springframework.stereotype.Service

@Service
class SignupService(private val context: ApplicationContext)
class SignupService(private val context: ApplicationContext){

}

/*
package webapp.accounts.signup
Expand Down
88 changes: 44 additions & 44 deletions springboot/api/src/test/kotlin/webapp/users/UserTests.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.fasterxml.jackson.databind.ObjectMapper
import jakarta.validation.Validator
import kotlinx.coroutines.runBlocking
import org.junit.jupiter.api.assertDoesNotThrow
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.beans.factory.getBean
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.context.ApplicationContext
Expand All @@ -19,7 +20,6 @@ import webapp.tests.TestUtils.defaultRoles
import webapp.tests.TestUtils.deleteAllUsersOnly
import webapp.users.User.UserDao.Dao.save
import webapp.users.User.UserDao.Dao.toJson
import javax.inject.Inject
import kotlin.test.AfterTest
import kotlin.test.Test
import kotlin.test.assertEquals
Expand All @@ -29,57 +29,57 @@ import kotlin.test.assertEquals
@ActiveProfiles("test")
class UserTests {

@Inject
lateinit var context: ApplicationContext
val mapper: ObjectMapper by lazy { context.getBean() }
val validator: Validator by lazy { context.getBean() }
@Autowired
lateinit var context: ApplicationContext
val mapper: ObjectMapper by lazy { context.getBean() }
val validator: Validator by lazy { context.getBean() }

@AfterTest
fun cleanUp() = runBlocking { context.deleteAllUsersOnly() }
@AfterTest
fun cleanUp() = runBlocking { context.deleteAllUsersOnly() }


@Test
fun `save default user should work in this context `() = runBlocking {
val count = context.countUsers()
(user to context).save()
assertEquals(expected = count + 1, context.countUsers())
}

@Test
fun `count users, expected 0`() =
runBlocking {
assertEquals(
0,
context.countUsers(),
"because init sql script does not inserts default users."
)
@Test
fun `save default user should work in this context `() = runBlocking {
val count = context.countUsers()
(user to context).save()
assertEquals(expected = count + 1, context.countUsers())
}

@Test
fun `count roles, expected 3`() = runBlocking {
context.run {
assertEquals(
defaultRoles.size,
countRoles(),
"Because init sql script does insert default roles."
)
@Test
fun `count users, expected 0`() =
runBlocking {
assertEquals(
0,
context.countUsers(),
"because init sql script does not inserts default users."
)
}

@Test
fun `count roles, expected 3`() = runBlocking {
context.run {
assertEquals(
defaultRoles.size,
countRoles(),
"Because init sql script does insert default roles."
)
}
}
}

@Test
fun `display user formatted in JSON`() = assertDoesNotThrow {
(user to context).toJson.let(::i)
}
@Test
fun `display user formatted in JSON`() = assertDoesNotThrow {
(user to context).toJson.let(::i)
}

@Test
fun `check toJson build a valid json format`() {
assertDoesNotThrow {
(user to context).toJson.let(mapper::readTree)
@Test
fun `check toJson build a valid json format`() {
assertDoesNotThrow {
(user to context).toJson.let(mapper::readTree)
}
}
}

@Test
fun `test cleanField extension function`() {
assertEquals("`login`".cleanField(), "login","Backtick should be removed")
}
@Test
fun `test cleanField extension function`() {
assertEquals("`login`".cleanField(), "login", "Backtick should be removed")
}
}
3 changes: 0 additions & 3 deletions springboot/doc/.aiexclude

This file was deleted.

Binary file removed springboot/doc/Domain_class.png
Binary file not shown.
61 changes: 0 additions & 61 deletions springboot/doc/cadrage_webapp.adoc

This file was deleted.

Loading

0 comments on commit 27e66af

Please sign in to comment.