-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
end to end test for all the field types in row state
- Loading branch information
1 parent
904f8d3
commit 2524a3a
Showing
5 changed files
with
116 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
akka-javasdk-tests/src/test/java/akkajavasdk/components/views/AllTheTypesKvEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Copyright (C) 2021-2024 Lightbend Inc. <https://www.lightbend.com> | ||
*/ | ||
|
||
package akkajavasdk.components.views; | ||
|
||
import akka.javasdk.annotations.ComponentId; | ||
import akka.javasdk.keyvalueentity.KeyValueEntity; | ||
|
||
import java.time.Instant; | ||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
@ComponentId("all-the-types-kve") | ||
public class AllTheTypesKvEntity extends KeyValueEntity<AllTheTypesKvEntity.AllTheTypes> { | ||
|
||
public enum AnEnum { | ||
ONE, TWO, THREE | ||
} | ||
|
||
// common query parameter for views in this file | ||
public record ByEmail(String email) { | ||
} | ||
|
||
public record Recursive(Recursive recurse) {} | ||
|
||
public record AllTheTypes( | ||
int intValue, | ||
long longValue, | ||
float floatValue, | ||
double doubleValue, | ||
boolean booleanValue, | ||
String stringValue, | ||
Integer wrappedInt, | ||
Long wrappedLong, | ||
Float wrappedFloat, | ||
Double wrappedDouble, | ||
Boolean wrappedBoolean, | ||
Instant instant, | ||
// FIXME bytes does not work yet in runtime Byte[] bytes, | ||
Optional<String> optionalString, | ||
List<String> repeatedString, | ||
ByEmail nestedMessage, | ||
AnEnum anEnum, | ||
Recursive recursive | ||
) {} | ||
|
||
|
||
|
||
public Effect<String> store(AllTheTypes value) { | ||
return effects().updateState(value).thenReply("OK"); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
akka-javasdk-tests/src/test/java/akkajavasdk/components/views/AllTheTypesView.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Copyright (C) 2021-2024 Lightbend Inc. <https://www.lightbend.com> | ||
*/ | ||
|
||
package akkajavasdk.components.views; | ||
|
||
import akka.javasdk.annotations.ComponentId; | ||
import akka.javasdk.annotations.Consume; | ||
import akka.javasdk.annotations.Query; | ||
import akka.javasdk.view.TableUpdater; | ||
import akka.javasdk.view.View; | ||
|
||
@ComponentId("all_the_field_types_view") | ||
public class AllTheTypesView extends View { | ||
|
||
|
||
@Consume.FromKeyValueEntity(AllTheTypesKvEntity.class) | ||
public static class Events extends TableUpdater<AllTheTypesKvEntity.AllTheTypes> { } | ||
|
||
@Query("SELECT * FROM events") | ||
public QueryStreamEffect<AllTheTypesKvEntity.AllTheTypes> allRows() { | ||
return queryStreamResult(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters