Skip to content

Commit

Permalink
Merge pull request #375 from navikt/feature/oppdatere-versjoner
Browse files Browse the repository at this point in the history
Feature/oppdatere versjoner
  • Loading branch information
LarsOttoHaugen authored Jan 9, 2025
2 parents 42c8664 + d3427aa commit 941d391
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 62 deletions.
50 changes: 27 additions & 23 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.2.5</version>
<version>3.4.1</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

Expand All @@ -20,21 +20,25 @@
<properties>

<!-- build/language -->
<kotlin.version>1.9.24</kotlin.version>
<kotlin.version>2.1.0</kotlin.version>
<build-helper-maven.version>3.2.0</build-helper-maven.version>
<token-support.version>3.2.0</token-support.version>

<!-- dependencies -->
<bidrag-felles.version>2024.12.31.102412</bidrag-felles.version>
<bidrag-felles.version>2025.01.03.105420</bidrag-felles.version>
<bidrag-tilgangskontroll.version>1.9.22</bidrag-tilgangskontroll.version>
<mockito-kotlin.version>5.3.1</mockito-kotlin.version>
<mockito-kotlin.version>5.4.0</mockito-kotlin.version>
<nimbus-jose-jwt.version>9.40</nimbus-jose-jwt.version>
<springframework-cloud.version>4.1.2</springframework-cloud.version>
<com.squareup.okhttp3.version>4.12.0</com.squareup.okhttp3.version>
<jackson-datatype-jsr310.version>2.17.2</jackson-datatype-jsr310.version>
<springdoc-openapi-ui.version>2.5.0</springdoc-openapi-ui.version>
<ktlint-cli.version>1.2.1</ktlint-cli.version>
<springframework-cloud.version>4.2.0</springframework-cloud.version>
<springdoc-openapi-ui.version>2.8.0</springdoc-openapi-ui.version>
<ktlint-cli.version>1.5.0</ktlint-cli.version>
<mockk.version>4.0.2</mockk.version>
<com.squareup.okhttp3.version>4.12.0</com.squareup.okhttp3.version>
<snakeyaml.version>2.3</snakeyaml.version>
<scala-library.version>2.13.15</scala-library.version>
<httpclient.version>4.5.14</httpclient.version>
<kafka-clients.version>3.8.0</kafka-clients.version>
<swagger-annotations.version>2.2.27</swagger-annotations.version>

</properties>

Expand All @@ -43,30 +47,31 @@
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>2.2</version>
<version>${snakeyaml.version}</version>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>2.13.14</version>
<version>${scala-library.version}</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.14</version>
<version>${httpclient.version}</version>
</dependency>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
<version>3.7.0</version>
<version>${kafka-clients.version}</version>
</dependency>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations</artifactId>
<version>2.2.22</version>
<version>${swagger-annotations.version}</version>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<!-- spring -->
<dependency>
Expand Down Expand Up @@ -103,23 +108,18 @@
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>${jackson-datatype-jsr310.version}</version>
</dependency>

<!-- nav -->
<!-- <dependency>
<groupId>no.nav.bidrag</groupId>
<artifactId>bidrag-transport-felles</artifactId>
<version>${bidrag-felles.version}</version>
</dependency>-->
<dependency>
<groupId>com.nimbusds</groupId>
<artifactId>nimbus-jose-jwt</artifactId>
<version>${nimbus-jose-jwt.version}</version>
</dependency>

<!-- nav -->
<dependency>
<groupId>no.nav.bidrag</groupId>
<artifactId>bidrag-commons-felles</artifactId>
Expand Down Expand Up @@ -160,8 +160,12 @@
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-database-postgresql</artifactId>
</dependency>

<!-- swagger -->
<dependency>
<groupId>org.springdoc</groupId>
Expand Down
8 changes: 2 additions & 6 deletions src/main/kotlin/no/nav/bidrag/vedtak/BidragVedtakConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ const val LOKAL_NAIS_PROFILE = "lokal-nais"
@Import(CorrelationIdFilter::class, UserMdcFilter::class, DefaultCorsFilter::class, RestOperationsAzure::class)
class BidragVedtakConfig {
@Bean
fun timedAspect(registry: MeterRegistry): TimedAspect {
return TimedAspect(registry)
}
fun timedAspect(registry: MeterRegistry): TimedAspect = TimedAspect(registry)

@Bean
@Profile(LIVE_PROFILE, LOKAL_NAIS_PROFILE)
Expand All @@ -64,9 +62,7 @@ class BidragVedtakConfig {
)

@Bean
fun exceptionLogger(): ExceptionLogger {
return ExceptionLogger(BidragVedtak::class.java.simpleName)
}
fun exceptionLogger(): ExceptionLogger = ExceptionLogger(BidragVedtak::class.java.simpleName)

@Bean
fun clientRequestObservationConvention() = DefaultClientRequestObservationConvention()
Expand Down
7 changes: 3 additions & 4 deletions src/main/kotlin/no/nav/bidrag/vedtak/service/VedtakService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ import no.nav.bidrag.vedtak.util.VedtakUtil.Companion.tilJson
import org.slf4j.LoggerFactory
import org.springframework.stereotype.Service
import org.springframework.transaction.annotation.Transactional
import java.util.*
import java.util.UUID

@Service
@Transactional
Expand Down Expand Up @@ -361,9 +361,8 @@ class VedtakService(val persistenceService: PersistenceService, val hendelserSer
}

// Hent vedtaksdata
fun hentVedtakForBehandlingsreferanse(kilde: BehandlingsrefKilde, behandlingsreferanse: String): List<Int> {
return persistenceService.hentVedtaksidForBehandlingsreferanse(kilde.name, behandlingsreferanse)
}
fun hentVedtakForBehandlingsreferanse(kilde: BehandlingsrefKilde, behandlingsreferanse: String): List<Int> =
persistenceService.hentVedtaksidForBehandlingsreferanse(kilde.name, behandlingsreferanse)

private fun alleVedtaksdataMatcher(vedtakId: Int, vedtakRequest: OpprettVedtakRequestDto): Boolean = vedtakMatcher(vedtakId, vedtakRequest) &&
stønadsendringerOgPerioderMatcher(vedtakId, vedtakRequest) &&
Expand Down
12 changes: 5 additions & 7 deletions src/test/kotlin/no/nav/bidrag/vedtak/BidragVedtakLocal.kt
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,9 @@ fun stubHentSaksbehandler() {
),
)
}
private fun jsonToString(data: Any): String {
return try {
ObjectMapper().findAndRegisterModules().writeValueAsString(data)
} catch (e: JsonProcessingException) {
Assert.fail(e.message)
""
}
private fun jsonToString(data: Any): String = try {
ObjectMapper().findAndRegisterModules().writeValueAsString(data)
} catch (e: JsonProcessingException) {
Assert.fail(e.message)
""
}
9 changes: 4 additions & 5 deletions src/test/kotlin/no/nav/bidrag/vedtak/TestUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -933,11 +933,10 @@ class TestUtil {
grunnlag = grunnlag,
)

fun byggStønadsendringGrunnlag(stønadsendring: Stønadsendring = byggStønadsendring(), grunnlag: Grunnlag = byggGrunnlag()) =
StønadsendringGrunnlag(
stønadsendring = stønadsendring,
grunnlag = grunnlag,
)
fun byggStønadsendringGrunnlag(stønadsendring: Stønadsendring = byggStønadsendring(), grunnlag: Grunnlag = byggGrunnlag()) = StønadsendringGrunnlag(
stønadsendring = stønadsendring,
grunnlag = grunnlag,
)

fun byggEngangsbeløp(
engangsbeløpId: Int = (1..100).random(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,25 +215,15 @@ class VedtakControllerTest {
)
}

private fun fullUrlForNyttVedtak(): String {
return UriComponentsBuilder.fromHttpUrl(makeFullContextPath() + VedtakController.OPPRETT_VEDTAK).toUriString()
}
private fun fullUrlForNyttVedtak(): String = UriComponentsBuilder.fromHttpUrl(makeFullContextPath() + VedtakController.OPPRETT_VEDTAK).toUriString()

private fun fullUrlForHentVedtak(): String {
return UriComponentsBuilder.fromHttpUrl(makeFullContextPath() + VedtakController.HENT_VEDTAK).toUriString()
}
private fun fullUrlForHentVedtak(): String = UriComponentsBuilder.fromHttpUrl(makeFullContextPath() + VedtakController.HENT_VEDTAK).toUriString()

private fun fullUrlForHentVedtakForBehandlingsreferanse(): String {
return UriComponentsBuilder.fromHttpUrl(makeFullContextPath() + VedtakController.HENT_VEDTAK_FOR_BEHANDLINGSREFERANSE).toUriString()
}
private fun fullUrlForHentVedtakForBehandlingsreferanse(): String = UriComponentsBuilder.fromHttpUrl(makeFullContextPath() + VedtakController.HENT_VEDTAK_FOR_BEHANDLINGSREFERANSE).toUriString()

private fun makeFullContextPath(): String {
return "http://localhost:$port"
}
private fun makeFullContextPath(): String = "http://localhost:$port"

private fun byggVedtakRequest(): HttpEntity<OpprettVedtakRequestDto> {
return initHttpEntity(TestUtil.byggVedtakRequest())
}
private fun byggVedtakRequest(): HttpEntity<OpprettVedtakRequestDto> = initHttpEntity(TestUtil.byggVedtakRequest())

// Les inn fil med request-data (json)
private fun lesFilOgByggRequest(filnavn: String): HttpEntity<String> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ import org.mockito.Mockito.verify
import org.mockito.kotlin.anyOrNull
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.boot.test.mock.mockito.MockBean
import org.springframework.test.context.ActiveProfiles
import org.springframework.test.context.bean.override.mockito.MockitoBean
import java.math.BigDecimal
import java.time.LocalDate
import java.time.LocalDateTime
Expand All @@ -47,7 +47,7 @@ class HendelserServiceTest {
@Autowired
private lateinit var hendelserService: HendelserService

@MockBean
@MockitoBean
private lateinit var vedtakEventProducerMock: VedtakKafkaEventProducer

@Test
Expand Down

0 comments on commit 941d391

Please sign in to comment.