Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit312de17

Browse files
authored
chore: remove deprecated methods (#316)
* chore: remove deprecated methods
1 parent5cbb1e8 commit312de17

File tree

5 files changed

+35
-110
lines changed

5 files changed

+35
-110
lines changed

‎src/main/java/io/kurrent/dbclient/EventData.java

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -55,30 +55,6 @@ public byte[] getUserMetadata() {
5555
returnuserMetadata;
5656
}
5757

58-
/**
59-
* Configures an event data builder to host a JSON payload.
60-
* @param eventType event's type.
61-
* @param eventData event's payload.
62-
* @return an event data builder.
63-
* @param <A> a type that can be serialized in JSON.
64-
*/
65-
@Deprecated
66-
publicstatic <A>EventDataBuilderbuilderAsJson(StringeventType,AeventData) {
67-
returnbuilderAsJson(null,eventType,eventData);
68-
}
69-
70-
/**
71-
* Configures an event data builder to host a JSON payload.
72-
* @param eventId event's id.
73-
* @param eventType event's type.
74-
* @param eventData event's payload.
75-
* @return an event data builder.
76-
* @param <A> a type that can be serialized in JSON.
77-
*/
78-
publicstatic <A>EventDataBuilderbuilderAsJson(UUIDeventId,StringeventType,AeventData) {
79-
returnEventDataBuilder.json(eventId,eventType,eventData);
80-
}
81-
8258
/**
8359
* Configures an event data builder to host a JSON payload.
8460
* @param eventType event's type.

‎src/main/java/io/kurrent/dbclient/EventDataBuilder.java

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -17,35 +17,6 @@ public class EventDataBuilder {
1717

1818
EventDataBuilder(){}
1919

20-
/**
21-
* Configures builder to serialize event data as JSON.
22-
* @param eventType event's type.
23-
* @param eventData event's payload.
24-
* @return an event data builder.
25-
* @param <A> a type that can be serialized in JSON.
26-
*/
27-
publicstatic <A>EventDataBuilderjson(StringeventType,AeventData) {
28-
returnjson(null,eventType,eventData);
29-
}
30-
31-
/**
32-
* Configures an event data builder to host a JSON payload.
33-
* @param id event's id.
34-
* @param eventType event's type.
35-
* @param eventData event's payload.
36-
* @return an event data builder.
37-
* @param <A> a type that can be serialized in JSON.
38-
*/
39-
@Deprecated
40-
publicstatic <A>EventDataBuilderjson(UUIDid,StringeventType,AeventData) {
41-
try {
42-
JsonMappermapper =newJsonMapper();
43-
returnjson(id,eventType,mapper.writeValueAsBytes(eventData));
44-
}catch (JsonProcessingExceptione) {
45-
thrownewRuntimeException(e);
46-
}
47-
}
48-
4920
/**
5021
* Configures an event data builder to host a JSON payload.
5122
* @param eventType event's type.
@@ -115,22 +86,6 @@ public EventDataBuilder eventId(UUID id) {
11586
returnthis;
11687
}
11788

118-
/**
119-
* Sets event's custom user metadata.
120-
* @param <A> an object that can be serialized in JSON.
121-
*/
122-
@Deprecated
123-
public <A>EventDataBuildermetadataAsJson(Avalue) {
124-
try {
125-
JsonMappermapper =newJsonMapper();
126-
this.metadata =mapper.writeValueAsBytes(value);
127-
}catch (JsonProcessingExceptione) {
128-
thrownewRuntimeException(e);
129-
}
130-
131-
returnthis;
132-
}
133-
13489
/**
13590
* Sets event's custom user metadata.
13691
*/

‎src/test/java/io/kurrent/dbclient/samples/appending_events/AppendingEvents.java

Lines changed: 26 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,26 @@
11
packageio.kurrent.dbclient.samples.appending_events;
22

3+
importcom.fasterxml.jackson.core.JsonProcessingException;
34
importio.kurrent.dbclient.*;
45
importio.kurrent.dbclient.samples.TestEvent;
56

67
importjava.util.UUID;
78
importjava.util.concurrent.ExecutionException;
89

10+
importcom.fasterxml.jackson.databind.ObjectMapper;
11+
12+
913
publicclassAppendingEvents {
10-
privatestaticvoidappendToStream(KurrentDBClientclient)throwsExecutionException,InterruptedException {
14+
privatestaticvoidappendToStream(KurrentDBClientclient)throwsExecutionException,InterruptedException,JsonProcessingException {
1115
// region append-to-stream
16+
ObjectMapperobjectMapper =newObjectMapper();
17+
1218
EventDataeventData =EventData
1319
.builderAsJson(
1420
UUID.randomUUID(),
1521
"some-event",
16-
newTestEvent(
17-
"1",
18-
"some value"
19-
))
22+
objectMapper.writeValueAsBytes(newTestEvent("1","some value"))
23+
)
2024
.build();
2125

2226
AppendToStreamOptionsoptions =AppendToStreamOptions.get()
@@ -27,16 +31,15 @@ private static void appendToStream(KurrentDBClient client) throws ExecutionExcep
2731
// endregion append-to-stream
2832
}
2933

30-
privatestaticvoidappendWithSameId(KurrentDBClientclient)throwsExecutionException,InterruptedException {
34+
privatestaticvoidappendWithSameId(KurrentDBClientclient)throwsExecutionException,InterruptedException,JsonProcessingException {
3135
// region append-duplicate-event
36+
ObjectMapperobjectMapper =newObjectMapper();
37+
3238
EventDataeventData =EventData
3339
.builderAsJson(
3440
UUID.randomUUID(),
3541
"some-event",
36-
newTestEvent(
37-
"1",
38-
"some value"
39-
))
42+
objectMapper.writeValueAsBytes(newTestEvent("1","some value")))
4043
.build();
4144

4245
AppendToStreamOptionsoptions =AppendToStreamOptions.get()
@@ -51,26 +54,22 @@ private static void appendWithSameId(KurrentDBClient client) throws ExecutionExc
5154
// endregion append-duplicate-event
5255
}
5356

54-
privatestaticvoidappendWithNoStream(KurrentDBClientclient)throwsExecutionException,InterruptedException {
57+
privatestaticvoidappendWithNoStream(KurrentDBClientclient)throwsExecutionException,InterruptedException,JsonProcessingException {
5558
// region append-with-no-stream
59+
ObjectMapperobjectMapper =newObjectMapper();
60+
5661
EventDataeventDataOne =EventData
5762
.builderAsJson(
5863
UUID.randomUUID(),
5964
"some-event",
60-
newTestEvent(
61-
"1",
62-
"some value"
63-
))
65+
objectMapper.writeValueAsBytes(newTestEvent("1","some value")))
6466
.build();
6567

6668
EventDataeventDataTwo =EventData
6769
.builderAsJson(
6870
UUID.randomUUID(),
6971
"some-event",
70-
newTestEvent(
71-
"2",
72-
"some other value"
73-
))
72+
objectMapper.writeValueAsBytes(newTestEvent("2","some other value")))
7473
.build();
7574

7675
AppendToStreamOptionsoptions =AppendToStreamOptions.get()
@@ -85,8 +84,9 @@ private static void appendWithNoStream(KurrentDBClient client) throws ExecutionE
8584
// endregion append-with-no-stream
8685
}
8786

88-
privatestaticvoidappendWithConcurrencyCheck(KurrentDBClientclient)throwsExecutionException,InterruptedException {
87+
privatestaticvoidappendWithConcurrencyCheck(KurrentDBClientclient)throwsExecutionException,InterruptedException,JsonProcessingException {
8988
// region append-with-concurrency-check
89+
ObjectMapperobjectMapper =newObjectMapper();
9090

9191
ReadStreamOptionsreadStreamOptions =ReadStreamOptions.get()
9292
.forwards()
@@ -99,20 +99,14 @@ private static void appendWithConcurrencyCheck(KurrentDBClient client) throws Ex
9999
.builderAsJson(
100100
UUID.randomUUID(),
101101
"some-event",
102-
newTestEvent(
103-
"1",
104-
"clientOne"
105-
))
102+
objectMapper.writeValueAsBytes(newTestEvent("1","clientOne")))
106103
.build();
107104

108105
EventDataclientTwoData =EventData
109106
.builderAsJson(
110107
UUID.randomUUID(),
111108
"some-event",
112-
newTestEvent(
113-
"2",
114-
"clientTwo"
115-
))
109+
objectMapper.writeValueAsBytes(newTestEvent("2","clientTwo")))
116110
.build();
117111

118112

@@ -127,15 +121,14 @@ private static void appendWithConcurrencyCheck(KurrentDBClient client) throws Ex
127121
// endregion append-with-concurrency-check
128122
}
129123

130-
publicvoidappendOverridingUserCredentials(KurrentDBClientclient)throwsExecutionException,InterruptedException {
124+
publicvoidappendOverridingUserCredentials(KurrentDBClientclient)throwsExecutionException,InterruptedException,JsonProcessingException {
125+
ObjectMapperobjectMapper =newObjectMapper();
126+
131127
EventDataeventData =EventData
132128
.builderAsJson(
133129
UUID.randomUUID(),
134130
"some-event",
135-
newTestEvent(
136-
"1",
137-
"some value"
138-
))
131+
objectMapper.writeValueAsBytes(newTestEvent("1","some value")))
139132
.build();
140133
//region overriding-user-credentials
141134
UserCredentialscredentials =newUserCredentials("admin","changeit");

‎src/test/java/io/kurrent/dbclient/samples/opentelemetry/Instrumentation.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
packageio.kurrent.dbclient.samples.opentelemetry;
2+
importorg.testcontainers.shaded.com.fasterxml.jackson.core.JsonProcessingException;
23

34
importio.kurrent.dbclient.*;
45
importio.kurrent.dbclient.samples.TestEvent;
@@ -9,6 +10,7 @@
910
importio.opentelemetry.sdk.resources.Resource;
1011
importio.opentelemetry.sdk.trace.SdkTracerProvider;
1112
importio.opentelemetry.sdk.trace.export.SimpleSpanProcessor;
13+
importorg.testcontainers.shaded.com.fasterxml.jackson.databind.ObjectMapper;
1214
// endregion import-required-packages
1315

1416
importjava.util.UUID;
@@ -17,7 +19,9 @@
1719
importstaticio.opentelemetry.semconv.ServiceAttributes.SERVICE_NAME;
1820

1921
publicclassInstrumentation {
20-
privatestaticvoidtracing(KurrentDBClientclient)throwsExecutionException,InterruptedException {
22+
privatestaticvoidtracing(KurrentDBClientclient)throwsExecutionException,InterruptedException,JsonProcessingException {
23+
ObjectMapperobjectMapper =newObjectMapper();
24+
2125
Resourceresource =Resource.getDefault().toBuilder()
2226
.put(SERVICE_NAME,"sample")
2327
.build();
@@ -47,10 +51,7 @@ private static void tracing(KurrentDBClient client) throws ExecutionException, I
4751
.builderAsJson(
4852
UUID.randomUUID(),
4953
"some-event",
50-
newTestEvent(
51-
"1",
52-
"some value"
53-
))
54+
objectMapper.writeValueAsBytes(newTestEvent("1","some value")))
5455
.build();
5556
// endregion setup-client-for-tracing
5657

‎src/test/java/io/kurrent/dbclient/streams/MetadataTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ default void testSetStreamMetadata() throws Throwable {
2727

2828
metadata.setAcl(acl);
2929

30-
HashMap<String,Object>payload =newHashMap<>();
30+
byte[]payload ="data".getBytes();
3131

3232
StringstreamName =generateName();
3333

@@ -43,7 +43,7 @@ default void testSetStreamMetadata() throws Throwable {
4343
defaultvoidtestReadNoExistingMetadata()throwsThrowable {
4444
KurrentDBClientclient =getDatabase().defaultClient();
4545
StringstreamName =generateName();
46-
client.appendToStream(streamName,EventDataBuilder.json("bar",newHashMap<String,Object>()).build()).get();
46+
client.appendToStream(streamName,EventDataBuilder.json("bar","data".getBytes()).build()).get();
4747

4848
StreamMetadatagot =client.getStreamMetadata(streamName).get();
4949

@@ -54,7 +54,7 @@ default void testReadNoExistingMetadata() throws Throwable {
5454
defaultvoidtestReadMetadataAfterStreamDeletion()throwsThrowable {
5555
KurrentDBClientclient =getDatabase().defaultClient();
5656
StringstreamName =generateName();
57-
client.appendToStream(streamName,EventDataBuilder.json("bar",newHashMap<String,Object>()).build()).get();
57+
client.appendToStream(streamName,EventDataBuilder.json("bar","data".getBytes()).build()).get();
5858

5959
client.deleteStream(streamName).get();
6060
client.getStreamMetadata(streamName).get();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp