Skip to content
This repository has been archived by the owner on Oct 8, 2020. It is now read-only.

Commit

Permalink
fix(spring): Fix rogue camel hump config property
Browse files Browse the repository at this point in the history
  • Loading branch information
robfletcher committed May 5, 2019
1 parent c76528b commit 73a608f
Show file tree
Hide file tree
Showing 9 changed files with 99 additions and 6 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Keiko

Keiko is a simple queueing library originally built for Spinnaker's Orca
Keiko is a simple queueing library originally built for Spinnaker's Orca
µservice.

## Concepts
Expand All @@ -10,7 +10,7 @@ Keiko consists of a number of components:
### The `Queue`

The queue itself accepts unique messages with an associated delivery time/
By default the delivery time is immediate but messages may be pushed for delivery at any point in the future.
By default the delivery time is immediate but messages may be pushed for delivery at any point in the future.

### The `QueueProcessor`

Expand Down Expand Up @@ -40,7 +40,7 @@ Kotlin data classes, Java classes annotated with Lombok's `@Value`, or just simp
Messages should be processed quickly.
If processing time exceeds the `ackTimeout` value specified on the queue or an unhandled exception prevents the handler from returning normally, the message will get re-queued.

Handlers may re-push the same message they are processing in order to implement polling workflows.
Handlers may re-push the same message they are processing in order to implement polling workflows.

## Configuring the queue in Spring Boot

Expand Down
2 changes: 1 addition & 1 deletion gradle/dokka.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ task(dokkaJar, type: Jar) {
description = "Assembles Kotlin docs with Dokka"
classifier = "javadoc"
from(dokka)
}
}
13 changes: 13 additions & 0 deletions keiko-mem-spring/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,17 @@ apply from: "$rootDir/gradle/spek.gradle"
dependencies {
api project(":keiko-mem")
api project(":keiko-spring")

testImplementation "org.junit.jupiter:junit-jupiter-api"
testImplementation "org.springframework:spring-test"
testImplementation "org.springframework.boot:spring-boot-test"
testImplementation "org.assertj:assertj-core"

testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine"
}

test {
useJUnitPlatform {
includeEngines "jupiter"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.netflix.spinnaker.q.mem.spring

import com.netflix.spinnaker.config.MemQueueConfiguration
import com.netflix.spinnaker.config.QueueConfiguration
import com.netflix.spinnaker.q.DeadMessageCallback
import com.netflix.spinnaker.q.Queue
import com.netflix.spinnaker.q.memory.InMemoryQueue
import org.assertj.core.api.Assertions
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.context.SpringBootTest
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.test.context.junit.jupiter.SpringExtension

@ExtendWith(SpringExtension::class)
@SpringBootTest(
classes = [QueueConfiguration::class, MemQueueConfiguration::class, TestConfiguration::class],
webEnvironment = SpringBootTest.WebEnvironment.NONE
)
internal class SpringStartupTests {

@Autowired
lateinit var queue: Queue

@Test
fun `starts up successfully`() {
Assertions.assertThat(queue).isNotNull.isInstanceOf(InMemoryQueue::class.java)
}
}

@Configuration
internal class TestConfiguration {
@Bean
fun deadMessageCallback(): DeadMessageCallback = { _, _ -> }
}
13 changes: 13 additions & 0 deletions keiko-redis-spring/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,17 @@ apply from: "$rootDir/gradle/spek.gradle"
dependencies {
api project(":keiko-redis")
api project(":keiko-spring")

testImplementation "org.junit.jupiter:junit-jupiter-api"
testImplementation "org.springframework:spring-test"
testImplementation "org.springframework.boot:spring-boot-test"
testImplementation "org.assertj:assertj-core"

testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine"
}

test {
useJUnitPlatform {
includeEngines "jupiter"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.netflix.spinnaker.q.redis.spring

import com.netflix.spinnaker.config.QueueConfiguration
import com.netflix.spinnaker.config.RedisQueueConfiguration
import com.netflix.spinnaker.q.Queue
import com.netflix.spinnaker.q.redis.RedisQueue
import org.assertj.core.api.Assertions
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.context.SpringBootTest
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment.NONE
import org.springframework.test.context.junit.jupiter.SpringExtension

@ExtendWith(SpringExtension::class)
@SpringBootTest(
classes = [QueueConfiguration::class, RedisQueueConfiguration::class],
webEnvironment = NONE
)
internal class SpringStartupTests {

@Autowired
lateinit var queue: Queue

@Test
fun `starts up successfully`() {
Assertions.assertThat(queue).isNotNull.isInstanceOf(RedisQueue::class.java)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package com.netflix.spinnaker.config

import org.springframework.boot.context.properties.ConfigurationProperties

@ConfigurationProperties("keiko.objectMapper")
@ConfigurationProperties("keiko.object-mapper")
class ObjectMapperSubtypeProperties {
var messageRootType: String = "com.netflix.spinnaker.q.Message"
var messagePackages: List<String> = listOf("com.netflix.spinnaker.q")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import java.time.Clock
import java.time.Duration

@Configuration
@EnableConfigurationProperties(QueueProperties::class)
@EnableConfigurationProperties(QueueProperties::class, ObjectMapperSubtypeProperties::class)
@ComponentScan(basePackages = ["com.netflix.spinnaker.q"])
@EnableScheduling
class QueueConfiguration {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class SpringObjectMapperConfigurer(
.apply { addIncludeFilter(AssignableTypeFilter(clazz)) }
.findCandidateComponents(pkg)
.map {
check(it.beanClassName != null)
val cls = ClassUtils.resolveClassName(it.beanClassName, ClassUtils.getDefaultClassLoader())

// Enforce all implementing types to have a JsonTypeName class
Expand Down

0 comments on commit 73a608f

Please sign in to comment.