crummy
12/20/2020, 8:40 PMClaude Brisson
12/20/2020, 9:49 PMPoohrang
12/28/2020, 3:10 PMByron Katz
01/06/2021, 12:39 AMByron Katz
01/06/2021, 12:42 AMdave
01/11/2021, 12:32 PMCheenu Soni
01/22/2021, 2:07 AMCheenu Soni
01/22/2021, 2:08 AMCheenu Soni
01/22/2021, 2:10 AMMaciej Kowalczyk
01/23/2021, 8:50 PMzaleslaw
01/28/2021, 10:25 AMAaron Chancey
02/04/2021, 4:59 PMTRACE io.ktor.auth.jwt - Failed to get JWK: Failed to get key with kid null
Trying to figure out if this is a problem with creating a custom Token:
test("when register for game and userId is not found then NotFound is returned") {
coEvery { userRepositoryMock.getUser(any()) } returns null
withServer {
val req = handleRequest(HttpMethod.Get, "/api/game/1/2") {
addJwtHeader()
}
req.response.status() shouldBe HttpStatusCode.NotFound
req.response.content shouldBe "Could not find user."
}
}
private fun TestApplicationRequest.addJwtHeader() = addHeader("Authorization", "Bearer ${getToken()}")
private fun getToken() = FirebaseAuth.getInstance().createCustomToken(UUID.randomUUID().toString())
@ExperimentalCoroutinesApi
@KtorExperimentalAPI
@ExperimentalTime
private fun withServer(block: TestApplicationEngine.() -> Unit) {
withTestApplication({ module() }, block)
}
Appreciate any advice that can be offered.dave
02/06/2021, 11:49 AMTamer Shahin
02/08/2021, 9:44 AMTamer Shahin
02/08/2021, 9:45 AMopenApiGenerate {
generatorName = "kotlin"
inputSpec = "$rootDir/petstore-v3.0.yaml".toString()
outputDir = "$buildDir/kotlin".toString()
apiPackage = "org.openapitools.example.api"
invokerPackage = "org.openapitools.example.invoker"
modelPackage = "org.openapitools.example.model"
configOptions = [
dateLibrary: "java8"
]
globalProperties = [
modelDocs: "false"
]
skipValidateSpec = true
logToStderr = true
generateAliasAsModel = false
// set to true and set environment variable {LANG}_POST_PROCESS_FILE
// (e.g. SCALA_POST_PROCESS_FILE) to the linter/formatter to be processed.
// This command will be passed one file at a time for most supported post processors.
enablePostProcessFile = false
}
`Tarun Chawla
02/12/2021, 8:28 AMFeb 12, 2021 1:53:39 PM com.impossibl.postgres.jdbc.ThreadedHousekeeper$HousekeeperReference cleanup
WARNING: Cleaning up leaked result-set
Allocation occurred @
at org.jetbrains.exposed.sql.statements.jdbc.JdbcPreparedStatementImpl.executeQuery(JdbcPreparedStatementImpl.kt:21)
at org.jetbrains.exposed.sql.Query.executeInternal(Query.kt:80)
at org.jetbrains.exposed.sql.Query.executeInternal(Query.kt:15)
at org.jetbrains.exposed.sql.statements.Statement.executeIn$exposed_core(Statement.kt:61)
at org.jetbrains.exposed.sql.Transaction.exec(Transaction.kt:126)
at org.jetbrains.exposed.sql.Query.count(Query.kt:245)
at tech.tarunchawla.repository.apis.CompanyOwnerApis$getCompanyDetails$1.invoke(CompanyOwnerApis.kt:242)
at tech.tarunchawla.repository.apis.CompanyOwnerApis$getCompanyDetails$1.invoke(CompanyOwnerApis.kt:13)
at org.jetbrains.exposed.sql.transactions.ThreadLocalTransactionManagerKt$transaction$1.invoke(ThreadLocalTransactionManager.kt:128)
at org.jetbrains.exposed.sql.transactions.ThreadLocalTransactionManagerKt.keepAndRestoreTransactionRefAfterRun(ThreadLocalTransactionManager.kt:219)
at org.jetbrains.exposed.sql.transactions.ThreadLocalTransactionManagerKt.transaction(ThreadLocalTransactionManager.kt:120)
at org.jetbrains.exposed.sql.transactions.ThreadLocalTransactionManagerKt.transaction(ThreadLocalTransactionManager.kt:118)
at org.jetbrains.exposed.sql.transactions.ThreadLocalTransactionManagerKt.transaction$default(ThreadLocalTransactionManager.kt:117)
at tech.tarunchawla.repository.apis.CompanyOwnerApis.getCompanyDetails(CompanyOwnerApis.kt:230)
at tech.tarunchawla.repository.apis.CompanyOwnerApis$getAllCompanies$1.invoke(CompanyOwnerApis.kt:216)
at tech.tarunchawla.repository.apis.CompanyOwnerApis$getAllCompanies$1.invoke(CompanyOwnerApis.kt:13)
Tarun Chawla
02/12/2021, 8:28 AMTarun Chawla
02/12/2021, 8:31 AMimplementation("com.impossibl.pgjdbc-ng:pgjdbc-ng:0.8.6")
YASAN
02/13/2021, 6:14 AMAlex Anisimov
02/15/2021, 3:07 PMAnuj Dutta
03/05/2021, 10:06 AMRay
03/08/2021, 3:44 PMDenis Ambatenne
03/10/2021, 8:33 AMAlina Dolgikh [JB]
evanchooly
03/12/2021, 5:25 PMOwain Evans
03/24/2021, 4:40 AMMurilo Dourado
03/27/2021, 3:46 PMpackage com.api.example.user
import com.api.example.core.entity.User
import com.api.example.core.usecase.UserService
import com.api.example.entrypoint.UserController
import com.ninjasquad.springmockk.MockkBean
import io.mockk.every
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.extension.ExtendWith
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest
import org.springframework.test.context.junit.jupiter.SpringExtension
import org.springframework.test.web.servlet.MockMvc
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders
import org.springframework.test.web.servlet.result.MockMvcResultMatchers.status
import java.time.LocalDateTime
@ExtendWith(SpringExtension::class)
@WebMvcTest(UserController::class)
class UserControllerTest {
@Autowired
lateinit private var mockMvc: MockMvc
@MockkBean
lateinit private var userService: UserService
@BeforeEach
fun setup() {
every { userService.getById(1L) } returns getUser()
}
@Test
fun `should return user by id`() {
mockMvc.perform(MockMvcRequestBuilders.get("/v1/api/user/{id}", 1L))
.andExpect(status().isOk)
.andReturn()
}
private fun getUser(): User {
return User(0L, "test", "<mailto:test@email.com|test@email.com>", LocalDateTime.now())
}
}
Murilo Dourado
03/27/2021, 3:47 PMpackage com.api.example.entrypoint
import com.api.example.core.entity.User
import com.api.example.core.usecase.UserService
import org.springframework.http.HttpStatus
import org.springframework.http.MediaType
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController
@RestController
@RequestMapping("/v1/api/user")
class UserController(private val userService: UserService) {
@PostMapping
fun save(@RequestBody user: User): ResponseEntity<HttpStatus> {
return try {
this.userService.save(user)
ResponseEntity.status(HttpStatus.CREATED).build()
} catch (ex: RuntimeException) {
ResponseEntity.badRequest().build()
}
}
@GetMapping(produces = [MediaType.APPLICATION_JSON_VALUE])
fun find(@PathVariable id: Long): ResponseEntity<User> {
return try {
ResponseEntity.ok(userService.getById(id))
} catch (ex: NoSuchElementException) {
ResponseEntity.notFound().build()
}
}
@GetMapping("/all")
fun findAllUsers(): ResponseEntity<List<User>> {
return try {
ResponseEntity.status(HttpStatus.OK).body(userService.getAll())
} catch (ex: RuntimeException) {
ResponseEntity.badRequest().body(null);
throw ex
}
}
}
Murilo Dourado
03/27/2021, 3:47 PM