Skip to content

Instantly share code, notes, and snippets.

@billydh
billydh / application.yml
Last active January 8, 2020 09:10
With localhost dynamo endpoint
application:
dynamo:
customer-table-name: "demo-customer-info"
region: "ap-southeast-2"
endpoint: "http://localhost:8042"
@billydh
billydh / build.gradle.kts
Last active January 9, 2020 12:01
build.gradle.kts for wiremockdemo
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("org.springframework.boot") version "2.1.11.RELEASE"
id("io.spring.dependency-management") version "1.0.8.RELEASE"
kotlin("jvm") version "1.2.71"
kotlin("plugin.spring") version "1.2.71"
}
group = "io.codebrews"
{
"coord": {
"lon": 151.21,
"lat": -33.87
},
"weather": [
{
"id": 500,
"main": "Rain",
"description": "light rain",
@billydh
billydh / RouteTest.kt
Last active January 12, 2020 04:10
RouteTest.kt with Open Weather API response loaded and WebTestClient auto configuration annotation
package io.codebrews.wiremockdemo
import com.github.tomakehurst.wiremock.client.WireMock.*
import com.github.tomakehurst.wiremock.junit.WireMockRule
import org.junit.ClassRule
import org.junit.Test
import org.junit.runner.RunWith
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired
@billydh
billydh / RouteTest.kt
Last active January 12, 2020 04:31
RouteTest with test case
package io.codebrews.wiremockdemo
import com.github.tomakehurst.wiremock.client.WireMock.*
import com.github.tomakehurst.wiremock.junit.WireMockRule
import org.junit.ClassRule
import org.junit.Test
import org.junit.runner.RunWith
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired
@billydh
billydh / application.properties
Created January 12, 2020 04:22
application.properties to unit test
app.openweather.baseurl=http://localhost:8089
@billydh
billydh / docker-compose
Created January 13, 2020 08:40
Docker compose command to start local DynamoDB container
$ docker-compose -f docker-compose-dynamodb-local.yaml up -d
@billydh
billydh / put-item
Last active January 13, 2020 11:00
DynamoDB put item request via aws cli
aws dynamodb put-item --endpoint-url http://localhost:8042 --table-name demo-customer-info \
--item '{"customerId": {"S": "1111"}, "email": {"S": "[email protected]"}}'
aws dynamodb get-item --endpoint-url http://localhost:8042 --table-name demo-customer-info \
--key '{"customerId": {"S": "1111"}}'
aws dynamodb update-item --endpoint-url http://localhost:8042 --table-name demo-customer-info \
--key '{"customerId": {"S": "1111"}}' \
--update-expression 'SET #email = :newEmail' \
--expression-attribute-names '{"#email": "email"}' \
--expression-attribute-values '{":newEmail": {"S": "[email protected]"}}'