package core.framework.internal.web.sys;

import core.framework.internal.kafka.MessageHeaders;
import core.framework.internal.log.LogManager;
import core.framework.util.Strings;
import org.apache.kafka.clients.producer.ProducerRecord;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import static org.assertj.core.api.Assertions.assertThat;

/**
 * @author neo
 */
class KafkaControllerTest {
    private KafkaController controller;
    private LogManager logManager;

    @BeforeEach
    void createKafkaController() {
        controller = new KafkaController(null);
        logManager = new LogManager();
        logManager.begin("begin", null);
    }

    @AfterEach
    void cleanup() {
        logManager.end("end");
    }

    @Test
    void record() {
        ProducerRecord<byte[], byte[]> record = controller.record("topic", "key", new byte[0]);
        assertThat(record.headers().lastHeader(MessageHeaders.HEADER_TRACE).value()).isEqualTo(Strings.bytes("true"));
    }
}

@@ -161,20 +161,26 @@
 ork.
-util.Strings
+internal.log.Trace
 ;%0Aim
@@ -1012,38 +1012,48 @@
 ()).
-isEqualTo(Strings.bytes(%22true%22
+asString().isEqualTo(Trace.CASCADE.name(
 ));%0A

make kafka controller send message with cascade trace