Skip to content

Commit

Permalink
Merge pull request #6 from navikt/custom-cors
Browse files Browse the repository at this point in the history
Custom cors
  • Loading branch information
chris-santa authored Nov 3, 2020
2 parents 8f27941 + f822882 commit b886eb8
Show file tree
Hide file tree
Showing 19 changed files with 91 additions and 91 deletions.
5 changes: 2 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
plugins {
val kotlinVersion = "1.3.71"
kotlin("jvm") version kotlinVersion
kotlin("plugin.allopen") version kotlinVersion
kotlin("jvm") version Kotlin.version
kotlin("plugin.allopen") version Kotlin.version
}

val libraryVersion = properties["lib_version"] ?: "latest-local"
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ repositories {
maven("https://jitpack.io")
}

val dittNavDependenciesVersion = "2020.09.14-15.09-da9cbe072699"
val dittNavDependenciesVersion = "2020.10.29-14.45-1531b0140397"

dependencies {
implementation("com.github.navikt:dittnav-dependencies:$dittNavDependenciesVersion")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package no.nav.personbruker.dittnav.common.logging.util

import org.amshove.kluent.`should equal`
import org.amshove.kluent.`should be equal to`
import org.junit.jupiter.api.Test
import org.slf4j.LoggerFactory

Expand All @@ -15,6 +15,6 @@ internal class ClassLoggerKtTest {

val classInstance = DummyClass()

classInstance.logger.name `should equal` classInstance.convention.name
classInstance.logger.name `should be equal to` classInstance.convention.name
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package no.nav.personbruker.dittnav.common.logging.util

import org.amshove.kluent.`should be`
import org.amshove.kluent.`should equal`
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should not be`
import org.junit.jupiter.api.Test
import org.slf4j.LoggerFactory
Expand Down Expand Up @@ -36,6 +36,6 @@ internal class LoggerKtTest {

val dummyClass = DummyClass()

dummyClass.logger.name `should equal` dummyClass.convention.name
dummyClass.logger.name `should be equal to` dummyClass.convention.name
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import io.mockk.mockk
import io.mockk.slot
import kotlinx.coroutines.runBlocking
import no.nav.personbruker.dittnav.common.metrics.util.delayUntilTrue
import org.amshove.kluent.`should equal`
import org.amshove.kluent.`should be equal to`
import org.junit.jupiter.api.Test

internal class BufferedDataPointRelayTest {
Expand Down Expand Up @@ -40,7 +40,7 @@ internal class BufferedDataPointRelayTest {
// The 'atMost' value here is a bit arbitrary, but it should suffice. What we want to achieve here
// is to prove that some batching of data points occurred, while acknowledging potential timing issues
coVerify ( atMost = dataPoints.size / 2 ) { sensuClient.submitEvent(any()) }
pointsSubmitted `should equal` dataPoints.size
pointsSubmitted `should be equal to` dataPoints.size
}

@Test
Expand All @@ -62,6 +62,6 @@ internal class BufferedDataPointRelayTest {
}
}

eventSlot.captured.name `should equal` topLevelName
eventSlot.captured.name `should be equal to` topLevelName
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ internal class InfluxMetricsReporterTest {
val end = System.currentTimeMillis()


resultMeasurement `should equal` measurementName
resultFields `should equal` fields
resultMeasurement `should be equal to` measurementName
resultFields `should be equal to` fields
resultTags.values `should contain same` listOf(application, cluster, namespace, tagVal)
resultTime `should be greater or equal to` start
resultTime `should be less or equal to` end
resultPrecision `should equal` TimeUnit.MILLISECONDS
resultPrecision `should be equal to` TimeUnit.MILLISECONDS
}

private inline fun <reified T: Any> Point.getPrivateField(fieldName: String): T {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import io.mockk.mockk
import io.mockk.slot
import kotlinx.coroutines.runBlocking
import no.nav.personbruker.dittnav.common.metrics.influx.InfluxDataPointObjectMother.createSimplePointsForMeasurents
import org.amshove.kluent.`should equal`
import org.amshove.kluent.`should be equal to`
import org.junit.jupiter.api.Test

internal class UnbufferedDataPointRelayTest {
Expand Down Expand Up @@ -43,7 +43,7 @@ internal class UnbufferedDataPointRelayTest {
dataPointRelay.submitDataPoint(dataPoint)
}

eventSlot.captured.name `should equal` topLevelName
eventSlot.captured.name `should be equal to` topLevelName
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import io.mockk.clearMocks
import io.mockk.coEvery
import io.mockk.mockk
import kotlinx.coroutines.runBlocking
import org.amshove.kluent.`should equal`
import org.amshove.kluent.`should be equal to`
import org.junit.jupiter.api.AfterEach
import org.junit.jupiter.api.Test

Expand Down Expand Up @@ -35,7 +35,7 @@ internal class ProducerNameScrubberTest {
producerNameScrubber.getPublicAlias(user)
}

result `should equal` alias
result `should be equal to` alias
}

@Test
Expand All @@ -46,7 +46,7 @@ internal class ProducerNameScrubberTest {
producerNameScrubber.getPublicAlias(user)
}

result `should equal` fallbackName
result `should be equal to` fallbackName
}

@Test
Expand All @@ -57,7 +57,7 @@ internal class ProducerNameScrubberTest {
producerNameScrubber.getPublicAlias(sysUser)
}

result `should equal` sysUserFallbackName
result `should be equal to` sysUserFallbackName
}

@Test
Expand All @@ -70,6 +70,6 @@ internal class ProducerNameScrubberTest {
producerNameScrubber.getPublicAlias(name)
}

result `should equal` fallbackName
result `should be equal to` fallbackName
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import io.mockk.coEvery
import io.mockk.coVerify
import io.mockk.mockk
import kotlinx.coroutines.runBlocking
import org.amshove.kluent.`should equal`
import org.amshove.kluent.`should be equal to`
import org.junit.jupiter.api.AfterEach
import org.junit.jupiter.api.Test

Expand Down Expand Up @@ -33,7 +33,7 @@ internal class PublicAliasResolverTest {
resolver.getProducerNameAlias(name)
}

result `should equal` alias
result `should be equal to` alias
coVerify{ provider.invoke() }
}

Expand All @@ -48,7 +48,7 @@ internal class PublicAliasResolverTest {
resolver.getProducerNameAlias(name)
}

result `should equal` alias
result `should be equal to` alias
coVerify(exactly = 1){ provider.invoke() }
}

Expand All @@ -64,7 +64,7 @@ internal class PublicAliasResolverTest {
resolver.getProducerNameAlias(otherName)
}

result `should equal` null
result `should be equal to` null
coVerify(exactly = 2){ provider.invoke() }
}

Expand Down
1 change: 1 addition & 0 deletions dittnav-common-security/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ dependencies {
api(kotlin("stdlib-jdk8"))
implementation(Logback.classic)
implementation(Logstash.logbackEncoder)
implementation(Kotlin.reflect)
implementation(NAV.tokenValidatorKtor)
testImplementation(kotlin("test-junit5"))
testImplementation(Jjwt.api)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package no.nav.personbruker.dittnav.common.security

import org.amshove.kluent.`should equal`
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should throw`
import org.amshove.kluent.invoking
import org.junit.jupiter.api.Test
Expand All @@ -9,10 +9,10 @@ internal class IdentityClaimTest {

@Test
fun `should convert valid strings to enum`() {
IdentityClaim.fromClaimName("pid") `should equal` IdentityClaim.PID
IdentityClaim.fromClaimName("PID") `should equal` IdentityClaim.PID
IdentityClaim.fromClaimName("sub") `should equal` IdentityClaim.SUBJECT
IdentityClaim.fromClaimName("SUB") `should equal` IdentityClaim.SUBJECT
IdentityClaim.fromClaimName("pid") `should be equal to` IdentityClaim.PID
IdentityClaim.fromClaimName("PID") `should be equal to` IdentityClaim.PID
IdentityClaim.fromClaimName("sub") `should be equal to` IdentityClaim.SUBJECT
IdentityClaim.fromClaimName("SUB") `should be equal to` IdentityClaim.SUBJECT
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ import org.apache.kafka.clients.consumer.ConsumerRecords
import org.apache.kafka.clients.consumer.KafkaConsumer

fun <K, V> KafkaConsumer<K, V>.rollbackToLastCommitted() {
assignment().forEach { partition ->
val lastCommitted = committed(partition)
seek(partition, lastCommitted.offset())
committed(assignment()).forEach { (partition, metadata) ->
seek(partition, metadata.offset())
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import no.nav.personbruker.dittnav.common.util.config.TypedEnvVar.getEnvVarAsTyp
import no.nav.personbruker.dittnav.common.util.config.TypedEnvVar.getEnvVarAsTypedList
import no.nav.personbruker.dittnav.common.util.config.TypedEnvVar.getOptionalEnvVarAsType
import no.nav.personbruker.dittnav.common.util.config.TypedEnvVar.getOptionalEnvVarAsTypedList
import org.amshove.kluent.`should equal`
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should throw`
import org.amshove.kluent.invoking
import org.junit.jupiter.api.AfterEach
Expand Down Expand Up @@ -43,7 +43,7 @@ internal class EnvVarAsTypeKtTest {

val result = getEnvVarAsType(envName, String::toInt, default)

result `should equal` envVal
result `should be equal to` envVal
}

@Test
Expand All @@ -54,7 +54,7 @@ internal class EnvVarAsTypeKtTest {

val result = getEnvVarAsType(envName, String::toInt, default)

result `should equal` default
result `should be equal to` default
}

@Test
Expand All @@ -79,7 +79,7 @@ internal class EnvVarAsTypeKtTest {

val result = getOptionalEnvVarAsType(envName, String::toInt, default)

result `should equal` envVal
result `should be equal to` envVal
}

@Test
Expand All @@ -90,7 +90,7 @@ internal class EnvVarAsTypeKtTest {

val result = getOptionalEnvVarAsType(envName, String::toInt, default)

result `should equal` default
result `should be equal to` default
}

@Test
Expand All @@ -99,7 +99,7 @@ internal class EnvVarAsTypeKtTest {

val result = getOptionalEnvVarAsType(envName, String::toInt)

result `should equal` null
result `should be equal to` null
}

@Test
Expand All @@ -117,7 +117,7 @@ internal class EnvVarAsTypeKtTest {

val result = getEnvVarAsTypedList(envName, String::toInt, default)

result `should equal` listEnvVal
result `should be equal to` listEnvVal
}

@Test
Expand All @@ -128,7 +128,7 @@ internal class EnvVarAsTypeKtTest {

val result = getEnvVarAsTypedList(envName, String::toInt, default)

result `should equal` default
result `should be equal to` default
}

@Test
Expand All @@ -153,7 +153,7 @@ internal class EnvVarAsTypeKtTest {

val expected = listOf(4, 5, 6)

getEnvVarAsTypedList(envName, String::toInt, separator = "|") `should equal` expected
getEnvVarAsTypedList(envName, String::toInt, separator = "|") `should be equal to` expected
}

@Test
Expand All @@ -164,7 +164,7 @@ internal class EnvVarAsTypeKtTest {

val result = getOptionalEnvVarAsTypedList(envName, String::toInt, default)

result `should equal` listEnvVal
result `should be equal to` listEnvVal
}

@Test
Expand All @@ -175,7 +175,7 @@ internal class EnvVarAsTypeKtTest {

val result = getOptionalEnvVarAsTypedList(envName, String::toInt, default)

result `should equal` default
result `should be equal to` default
}

@Test
Expand All @@ -184,7 +184,7 @@ internal class EnvVarAsTypeKtTest {

val result = getOptionalEnvVarAsTypedList(envName, String::toInt)

result `should equal` emptyList()
result `should be equal to` emptyList()
}

@Test
Expand All @@ -202,6 +202,6 @@ internal class EnvVarAsTypeKtTest {

val expected = listOf(7, 8, 9)

getOptionalEnvVarAsTypedList(envName, String::toInt, separator = "|") `should equal` expected
getOptionalEnvVarAsTypedList(envName, String::toInt, separator = "|") `should be equal to` expected
}
}
Loading

0 comments on commit b886eb8

Please sign in to comment.