Compare commits
6 Commits
e880d53938
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 017b60a946 | |||
|
|
90777ec594 | ||
| dd70b1f61f | |||
| f64c30de1c | |||
| a1c02b739d | |||
| e5710d8a26 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -35,3 +35,5 @@ out/
|
|||||||
|
|
||||||
### VS Code ###
|
### VS Code ###
|
||||||
.vscode/
|
.vscode/
|
||||||
|
|
||||||
|
.DS_Store
|
||||||
4
README.md
Normal file
4
README.md
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# gradle-sample-module-example
|
||||||
|
|
||||||
|
- Sprin boot included
|
||||||
|
- Sub-module for gradle and spring
|
||||||
@@ -1,10 +1,13 @@
|
|||||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
|
id("org.springframework.boot")
|
||||||
|
|
||||||
kotlin("jvm")
|
kotlin("jvm")
|
||||||
|
kotlin("plugin.spring")
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
api(project(":cubetiq-utils"))
|
||||||
|
|
||||||
implementation("org.springframework.boot:spring-boot-starter-web")
|
implementation("org.springframework.boot:spring-boot-starter-web")
|
||||||
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
|
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
|
||||||
|
|
||||||
@@ -17,10 +20,3 @@ dependencies {
|
|||||||
tasks.withType<Test> {
|
tasks.withType<Test> {
|
||||||
useJUnitPlatform()
|
useJUnitPlatform()
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<KotlinCompile> {
|
|
||||||
kotlinOptions {
|
|
||||||
freeCompilerArgs = listOf("-Xjsr305=strict")
|
|
||||||
jvmTarget = "11"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +1,5 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.2-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|||||||
@@ -1,11 +1,23 @@
|
|||||||
package com.cubetiqs.modules.example
|
package com.cubetiqs.modules.example
|
||||||
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication
|
import org.springframework.boot.autoconfigure.SpringBootApplication
|
||||||
|
import org.springframework.boot.context.event.ApplicationReadyEvent
|
||||||
import org.springframework.boot.runApplication
|
import org.springframework.boot.runApplication
|
||||||
|
import org.springframework.context.event.EventListener
|
||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
class SampleModuleExampleApplication
|
class SampleModuleExampleApplication {
|
||||||
|
data class Person (
|
||||||
|
val name: String,
|
||||||
|
val age: Int,
|
||||||
|
)
|
||||||
|
|
||||||
|
@EventListener(ApplicationReadyEvent::class)
|
||||||
|
fun onApplicationReady() {
|
||||||
|
println("Application running....")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
runApplication<SampleModuleExampleApplication>(*args)
|
runApplication<SampleModuleExampleApplication>(*args)
|
||||||
}
|
}
|
||||||
|
|||||||
39
src/test/kotlin/com/cubetiqs/modules/example/JsonTests.kt
Normal file
39
src/test/kotlin/com/cubetiqs/modules/example/JsonTests.kt
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
package com.cubetiqs.modules.example
|
||||||
|
|
||||||
|
import com.cubetiqs.enterprise.comutils.json.toJsonNode
|
||||||
|
import com.cubetiqs.enterprise.comutils.json.toModel
|
||||||
|
import org.junit.jupiter.api.Assertions
|
||||||
|
import org.junit.jupiter.api.Test
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest
|
||||||
|
|
||||||
|
@SpringBootTest
|
||||||
|
class JsonTests {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun jsonToModel() {
|
||||||
|
val json = """
|
||||||
|
{
|
||||||
|
"name": "Sambo",
|
||||||
|
"age": 24
|
||||||
|
}
|
||||||
|
""".trimIndent()
|
||||||
|
val node = json.toModel<SampleModuleExampleApplication.Person>()
|
||||||
|
|
||||||
|
Assertions.assertEquals(SampleModuleExampleApplication.Person("Sambo", 24), node)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun jsonToJsonNode() {
|
||||||
|
val json = """
|
||||||
|
{
|
||||||
|
"name": "Sambo",
|
||||||
|
"age": 24
|
||||||
|
}
|
||||||
|
""".trimIndent()
|
||||||
|
val node = json.toJsonNode()
|
||||||
|
|
||||||
|
Assertions.assertEquals("Sambo", node?.get("name")?.asText())
|
||||||
|
Assertions.assertEquals(24, node?.get("age")?.asInt())
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -6,8 +6,8 @@ import org.springframework.boot.test.context.SpringBootTest
|
|||||||
@SpringBootTest
|
@SpringBootTest
|
||||||
class SampleModuleExampleApplicationTests {
|
class SampleModuleExampleApplicationTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun contextLoads() {
|
fun contextLoads() {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user