• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

hyperledger / identus-cloud-agent / 11212549041

07 Oct 2024 09:23AM UTC coverage: 48.628% (-0.03%) from 48.653%
11212549041

Pull #1339

bvoiturier
chore: add recordId when dying with "record not found"

Signed-off-by: Benjamin Voiturier <benjamin.voiturier@iohk.io>
Pull Request #1339: feat: ATL-6983 ZIO Stream Kafka PoC in background jobs

189 of 626 new or added lines in 25 files covered. (30.19%)

214 existing lines in 61 files now uncovered.

8048 of 16550 relevant lines covered (48.63%)

0.49 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/shared/core/src/main/scala/org/hyperledger/identus/shared/messaging/Serde.scala
1
package org.hyperledger.identus.shared.messaging
2

3
import org.hyperledger.identus.shared.models.WalletId
4

5
import java.nio.charset.StandardCharsets
6
import java.nio.ByteBuffer
7
import java.util.UUID
8

9
case class ByteArrayWrapper(ba: Array[Byte])
10

11
trait Serde[T] {
12
  def serialize(t: T): Array[Byte]
13
  def deserialize(ba: Array[Byte]): T
NEW
14
}
×
NEW
15

×
NEW
16
object Serde {
×
17
  given byteArraySerde: Serde[ByteArrayWrapper] = new Serde[ByteArrayWrapper] {
NEW
18
    override def serialize(t: ByteArrayWrapper): Array[Byte] = t.ba
×
NEW
19
    override def deserialize(ba: Array[Byte]): ByteArrayWrapper = ByteArrayWrapper(ba)
×
20
  }
21

22
  given stringSerde: Serde[String] = new Serde[String] {
NEW
23
    override def serialize(t: String): Array[Byte] = t.getBytes()
×
NEW
24
    override def deserialize(ba: Array[Byte]): String = new String(ba, StandardCharsets.UTF_8)
×
25
  }
26

27
  given intSerde: Serde[Int] = new Serde[Int] {
NEW
28
    override def serialize(t: Int): Array[Byte] = {
×
NEW
29
      val buffer = java.nio.ByteBuffer.allocate(4)
×
NEW
30
      buffer.putInt(t)
×
NEW
31
      buffer.array()
×
32
    }
NEW
33
    override def deserialize(ba: Array[Byte]): Int = ByteBuffer.wrap(ba).getInt()
×
34
  }
35

36
  given uuidSerde: Serde[UUID] = new Serde[UUID] {
NEW
37
    override def serialize(t: UUID): Array[Byte] = {
×
NEW
38
      val buffer = java.nio.ByteBuffer.allocate(16)
×
NEW
39
      buffer.putLong(t.getMostSignificantBits)
×
NEW
40
      buffer.putLong(t.getLeastSignificantBits)
×
NEW
41
      buffer.array()
×
42
    }
NEW
43
    override def deserialize(ba: Array[Byte]): UUID = {
×
NEW
44
      val byteBuffer = ByteBuffer.wrap(ba)
×
NEW
45
      val high = byteBuffer.getLong
×
NEW
46
      val low = byteBuffer.getLong
×
NEW
47
      new UUID(high, low)
×
48
    }
49
  }
50

NEW
51
  given walletIdSerde(using uuidSerde: Serde[UUID]): Serde[WalletId] = new Serde[WalletId] {
×
NEW
52
    override def serialize(w: WalletId): Array[Byte] = uuidSerde.serialize(w.toUUID)
×
NEW
53
    override def deserialize(ba: Array[Byte]): WalletId = WalletId.fromUUID(uuidSerde.deserialize(ba))
×
54
  }
55
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc