-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: state unpack in context creation
- Loading branch information
Adriano Santos
committed
Aug 23, 2024
1 parent
7de73b9
commit 0dd89fc
Showing
14 changed files
with
317 additions
and
275 deletions.
There are no files selected for viewing
5 changes: 2 additions & 3 deletions
5
...o/eigr/spawn/internal/ActionBindings.java → ...eigr/spawn/api/actors/ActionBindings.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
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
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
2 changes: 1 addition & 1 deletion
2
...eigr/spawn/AbstractContainerBaseTest.java → ...spawn/test/AbstractContainerBaseTest.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
28 changes: 28 additions & 0 deletions
28
src/test/java/io/eigr/spawn/test/ProtobufSerializationTest.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,28 @@ | ||
package io.eigr.spawn.test; | ||
|
||
import com.google.protobuf.Any; | ||
import com.google.protobuf.InvalidProtocolBufferException; | ||
import domain.actors.State; | ||
import org.junit.jupiter.api.Test; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
|
||
public class ProtobufSerializationTest { | ||
private static final Logger log = LoggerFactory.getLogger(ProtobufSerializationTest.class); | ||
|
||
@Test | ||
public void testAnyUnpack() throws InvalidProtocolBufferException, ClassNotFoundException { | ||
State stateActor = State.newBuilder().buildPartial(); | ||
|
||
Any anyCtxState = Any.pack(stateActor); | ||
|
||
String typeUrl = anyCtxState.getTypeUrl(); | ||
String typeName = typeUrl.substring(typeUrl.lastIndexOf('/') + 1); | ||
|
||
Class protoClass = Class.forName(typeName); | ||
stateActor = (State) anyCtxState.unpack(protoClass); | ||
assertNotNull(stateActor); | ||
} | ||
} |
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
8 changes: 4 additions & 4 deletions
8
src/test/java/io/eigr/spawn/test/actors/ActorWithConstructor.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
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
6 changes: 3 additions & 3 deletions
6
src/test/java/io/eigr/spawn/test/actors/StatelessNamedActor.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
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