Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: replace kotlin-logging io.github.microutils with io.github.oshai #1091

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bom/parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@

<!-- Logging -->
<dependency>
<groupId>io.github.microutils</groupId>
<groupId>io.github.oshai</groupId>
<artifactId>kotlin-logging-jvm</artifactId>
<version>${kotlin-logging.version}</version>
</dependency>
Expand Down Expand Up @@ -273,7 +273,7 @@
<artifactId>kotlin-reflect</artifactId>
</dependency>
<dependency>
<groupId>io.github.microutils</groupId>
<groupId>io.github.oshai</groupId>
<artifactId>kotlin-logging-jvm</artifactId>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,20 @@

import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import io.github.oshai.kotlinlogging.KotlinLogging
import io.holunda.polyflow.bus.jackson.annotation.ConditionalOnMissingQualifiedBean
import io.holunda.polyflow.bus.jackson.configurePolyflowJacksonObjectMapper
import mu.KLogging
import org.springframework.beans.factory.annotation.Qualifier
import org.springframework.context.annotation.Bean

private val logger = KotlinLogging.logger {}

/**
* No @configuration required, used as autoconfiguration.
*/
class FallbackPayloadObjectMapperAutoConfiguration {

companion object : KLogging() {
companion object {
const val PAYLOAD_OBJECT_MAPPER = "payloadObjectMapper"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import io.holunda.polyflow.datapool.core.business.DataEntryAggregate
import io.holunda.polyflow.datapool.core.business.upcaster.DataEntryCreatedEventUpcaster
import io.holunda.polyflow.datapool.core.repository.FirstEventOnlyEventSourcingRepository
import mu.KLogging
import org.axonframework.common.caching.Cache
import org.axonframework.common.caching.WeakReferenceCache
import org.axonframework.eventsourcing.EventCountSnapshotTriggerDefinition
Expand All @@ -22,7 +21,6 @@
import org.springframework.context.annotation.Configuration
import org.springframework.context.annotation.Import


/**
* Configuration of polyflow data pool core axon setup.
*/
Expand All @@ -33,7 +31,7 @@
DataEntryCreatedEventUpcaster::class
)
class DataPoolCoreAxonConfiguration {
companion object : KLogging() {
companion object {
const val DATA_ENTRY_REPOSITORY = "dataEntryEventSourcingRepository"
const val DATA_ENTRY_SNAPSHOTTER = "dataEntrySnapshotter"
const val DATA_ENTRY_CACHE = "dataEntryCache"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package io.holunda.polyflow.datapool.core

import mu.KLogging
import io.github.oshai.kotlinlogging.KotlinLogging
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.context.annotation.Import

private val logger = KotlinLogging.logger {}

/**
* Configuration of polyflow data pool core.
Expand All @@ -17,7 +17,6 @@ import org.springframework.context.annotation.Import
)
class DataPoolCoreConfiguration {

companion object: KLogging()
/**
* Deletion strategy for lax handling of updates after deletion (default).
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package io.holunda.polyflow.datapool.core.business

import io.github.oshai.kotlinlogging.KotlinLogging
import io.holunda.camunda.taskpool.api.business.CreateDataEntryCommand
import io.holunda.camunda.taskpool.api.business.CreateOrUpdateDataEntryCommand
import io.holunda.camunda.taskpool.api.business.UpdateDataEntryCommand
import io.holunda.polyflow.datapool.core.DeletionStrategy
import mu.KLogging
import org.axonframework.commandhandling.CommandHandler
import org.axonframework.eventsourcing.EventSourcingRepository
import org.axonframework.messaging.MetaData
Expand All @@ -13,6 +13,8 @@ import org.axonframework.modelling.command.AggregateNotFoundException
import org.springframework.stereotype.Component
import java.util.*

private val logger = KotlinLogging.logger {}

/**
* Handler taking care of existence of data entry aggregate.
*/
Expand All @@ -22,8 +24,6 @@ class CreateOrUpdateCommandHandler(
private val deletionStrategy: DeletionStrategy
) {

companion object : KLogging()

/**
* Receives create-or-update and decides what to do.
* @param command command to create or update the aggregate.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package io.holunda.polyflow.datapool.core.business

import io.github.oshai.kotlinlogging.KotlinLogging
import io.holunda.camunda.taskpool.api.business.*
import io.holunda.polyflow.datapool.core.DataPoolCoreAxonConfiguration
import io.holunda.polyflow.datapool.core.DataPoolCoreConfiguration
import io.holunda.polyflow.datapool.core.DeletionStrategy
import mu.KLogging
import org.axonframework.commandhandling.CommandHandler
import org.axonframework.eventsourcing.AggregateDeletedException
import org.axonframework.eventsourcing.EventSourcingHandler
Expand All @@ -13,6 +12,8 @@ import org.axonframework.modelling.command.AggregateLifecycle
import org.axonframework.spring.stereotype.Aggregate
import org.springframework.beans.factory.annotation.Autowired

private val logger = KotlinLogging.logger {}

/**
* Aggregate representing a data entry.
* Currently, it has no state.
Expand All @@ -25,8 +26,6 @@ import org.springframework.beans.factory.annotation.Autowired
)
class DataEntryAggregate() {

companion object : KLogging()

@AggregateIdentifier
private lateinit var dataIdentity: String
private var deleted: Boolean = false
Expand Down Expand Up @@ -95,10 +94,10 @@ class DataEntryAggregate() {
if (this.deleted) {
this.deleted = false
}
if (logger.isDebugEnabled) {
if (logger.isDebugEnabled()) {
logger.debug { "Created $dataIdentity." }
}
if (logger.isTraceEnabled) {
if (logger.isTraceEnabled()) {
logger.trace { "Created $dataIdentity with: $event" }
}
}
Expand All @@ -111,10 +110,10 @@ class DataEntryAggregate() {
if (this.deleted) {
this.deleted = false
}
if (logger.isDebugEnabled) {
if (logger.isDebugEnabled()) {
logger.debug { "Updated $dataIdentity." }
}
if (logger.isTraceEnabled) {
if (logger.isTraceEnabled()) {
logger.trace { "Updated $dataIdentity with: $event" }
}
}
Expand All @@ -124,10 +123,10 @@ class DataEntryAggregate() {
*/
@EventSourcingHandler
fun on(event: DataEntryDeletedEvent) {
if (logger.isDebugEnabled) {
if (logger.isDebugEnabled()) {
logger.debug { "Deleted $dataIdentity." }
}
if (logger.isTraceEnabled) {
if (logger.isTraceEnabled()) {
logger.trace { "Deleted $dataIdentity with: $event" }
}
// Don't use AggregateLifecycle.markDeleted() because then the combination of entryType / entryId is then really deleted forever
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.holunda.polyflow.datapool.core.business

import io.github.oshai.kotlinlogging.KotlinLogging
import io.holunda.camunda.taskpool.api.business.*
import io.holunda.polyflow.datapool.core.itest.TestApplication
import mu.KLogging
import org.assertj.core.api.Assertions.assertThat
import org.axonframework.commandhandling.gateway.CommandGateway
import org.axonframework.eventhandling.EventBus
Expand All @@ -16,14 +16,13 @@ import org.springframework.boot.test.context.SpringBootTest
import org.springframework.test.context.ActiveProfiles
import org.springframework.test.context.junit.jupiter.SpringExtension

private val logger = KotlinLogging.logger {}

@SpringBootTest(classes = [TestApplication::class])
@ActiveProfiles("itest-first-event-only")
@ExtendWith(SpringExtension::class)
internal class DataEntryAggregateFirstEventOnlyEventSourcingRepositoryITest {

companion object: KLogging()

@Autowired
private lateinit var commandGateway: CommandGateway

Expand Down Expand Up @@ -93,4 +92,4 @@ internal class DataEntryAggregateFirstEventOnlyEventSourcingRepositoryITest {

assertThat(receivedEvents).hasSize(4)
}
}
}
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
package io.holunda.polyflow.taskpool.core.process

import io.github.oshai.kotlinlogging.KotlinLogging
import io.holunda.camunda.taskpool.api.process.instance.*
import io.holunda.camunda.taskpool.api.process.variable.ChangeProcessVariablesForExecutionCommand
import io.holunda.camunda.taskpool.api.process.variable.ProcessVariablesChangedEvent
import io.holunda.camunda.taskpool.mapper.process.*
import io.holunda.polyflow.taskpool.core.TaskPoolCoreConfiguration
import mu.KLogging
import org.axonframework.commandhandling.CommandHandler
import org.axonframework.eventsourcing.EventSourcingHandler
import org.axonframework.modelling.command.AggregateIdentifier
import org.axonframework.modelling.command.AggregateLifecycle
import org.axonframework.spring.stereotype.Aggregate

private val logger = KotlinLogging.logger {}

/**
* Aggregate representing the process instance.
*/
@Aggregate(repository = TaskPoolCoreConfiguration.PROCESS_INSTANCE_AGGREGATE_REPOSITORY)
class ProcessInstanceAggregate() {

companion object : KLogging()

@AggregateIdentifier
lateinit var processInstanceId: String

Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
package io.holunda.polyflow.taskpool.core.task

import io.github.oshai.kotlinlogging.KotlinLogging
import io.holunda.camunda.taskpool.api.task.*
import io.holunda.camunda.taskpool.mapper.task.*
import io.holunda.camunda.taskpool.model.Task
import io.holunda.polyflow.taskpool.core.TaskPoolCoreConfiguration
import mu.KLogging
import org.axonframework.commandhandling.CommandHandler
import org.axonframework.eventsourcing.EventSourcingHandler
import org.axonframework.messaging.MetaData
import org.axonframework.modelling.command.AggregateIdentifier
import org.axonframework.modelling.command.AggregateLifecycle
import org.axonframework.spring.stereotype.Aggregate

private val logger = KotlinLogging.logger {}

/**
* Main representation of the tasks available in the system.
*/
Expand All @@ -21,8 +23,6 @@ import org.axonframework.spring.stereotype.Aggregate
)
class TaskAggregate() {

companion object : KLogging()

@AggregateIdentifier
private lateinit var id: String
internal lateinit var task: Task
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
package io.holunda.camunda.taskpool.upcast.definition

import io.github.oshai.kotlinlogging.KotlinLogging
import io.holunda.camunda.taskpool.upcast.AnnotatedEventUpcaster
import io.holunda.camunda.taskpool.upcast.AnnotationBasedSingleEventUpcaster
import io.holunda.camunda.taskpool.upcast.RepresentationContentType
import io.holunda.camunda.taskpool.upcast.RepresentationContentType.JSON
import mu.KLogging
import org.axonframework.serialization.SimpleSerializedType
import org.axonframework.serialization.upcasting.event.IntermediateEventRepresentation
import org.dom4j.Document
import java.util.function.Function

private val logger = KotlinLogging.logger {}

/**
* Upcaster to put revision 1 into the event and remove unneeded attributes.
*/
@AnnotatedEventUpcaster("io.holunda.camunda.taskpool.api.task.ProcessDefinitionRegisteredEvent")
class ProcessDefinitionEventXMLNullTo1Upcaster : AnnotationBasedSingleEventUpcaster() {

companion object : KLogging() {
companion object {
const val RESULT_OBJECT_TYPE = "io.holunda.camunda.taskpool.api.process.definition.ProcessDefinitionRegisteredEvent"
}

Expand Down Expand Up @@ -47,7 +48,7 @@
@AnnotatedEventUpcaster("io.holunda.camunda.taskpool.api.task.ProcessDefinitionRegisteredEvent", representationContentType = JSON)
class ProcessDefinitionEventJSONNullTo1Upcaster : AnnotationBasedSingleEventUpcaster() {

companion object : KLogging() {
companion object {
const val RESULT_OBJECT_TYPE = "io.holunda.camunda.taskpool.api.process.definition.ProcessDefinitionRegisteredEvent"
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
package io.holunda.camunda.taskpool.upcast.task

import io.github.oshai.kotlinlogging.KotlinLogging
import io.holunda.camunda.taskpool.upcast.AnnotatedEventUpcaster
import io.holunda.camunda.taskpool.upcast.AnnotationBasedSingleEventUpcaster
import mu.KLogging
import org.axonframework.serialization.SimpleSerializedType
import org.axonframework.serialization.upcasting.event.IntermediateEventRepresentation
import org.dom4j.Document

private val logger = KotlinLogging.logger {}

/**
* Upcaster fixing payload and correlation changes introduced by #305, by adding the missing attributes to XML.
*/
@AnnotatedEventUpcaster(TaskAttributeUpdatedEngineEvent4To5Upcaster.RESULT_OBJECT_TYPE, "4")
class TaskAttributeUpdatedEngineEvent4To5Upcaster : AnnotationBasedSingleEventUpcaster() {

companion object : KLogging() {
companion object {
const val RESULT_OBJECT_TYPE = "io.holunda.camunda.taskpool.api.task.TaskAttributeUpdatedEngineEvent"
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.holunda.camunda.taskpool.upcast.task

import io.github.oshai.kotlinlogging.KotlinLogging
import io.holunda.camunda.taskpool.upcast.AnnotatedEventUpcaster
import io.holunda.camunda.taskpool.upcast.AnnotationBasedSingleEventUpcaster
import mu.KLogging
import org.axonframework.serialization.SimpleSerializedType
import org.axonframework.serialization.upcasting.event.IntermediateEventRepresentation
import org.dom4j.Document
Expand Down Expand Up @@ -145,20 +145,22 @@
*/
@AnnotatedEventUpcaster(TaskUndeferredEvent2To4Upcaster.RESULT_OBJECT_TYPE, "2")
class TaskUndeferredEvent2To4Upcaster : AbstractSourceReferenceElementRemovingUpcaster() {
companion object {

Check notice

Code scanning / Detekt (reported by Codacy)

Public classes, interfaces and objects require documentation. Note

Companion is missing required documentation.
const val RESULT_OBJECT_TYPE = "io.holunda.camunda.taskpool.api.task.TaskUndeferredEvent"
}

override fun getType(): String = RESULT_OBJECT_TYPE
}

private val logger = KotlinLogging.logger {}

/**
* Abstract upcaster to be used for all task events. Removes the element duplicates from the source-reference tag introduced by the
* usage of a sealed class instead of the interface.
*/
abstract class AbstractSourceReferenceElementRemovingUpcaster : AnnotationBasedSingleEventUpcaster() {

companion object : KLogging() {
companion object {
val TAG_NAMES = arrayOf("instanceId", "executionId", "definitionId", "definitionKey", "name", "applicationName")
}

Expand Down
Loading
Loading