-
Notifications
You must be signed in to change notification settings - Fork 82
No longer wrapping complex types in an auxiliary JSON object #2599
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
rodinaarssen
wants to merge
13
commits into
main
Choose a base branch
from
fix-jsonrpc-wrapping
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
10fbde8
No longer wrapping complex types in an auxiliary JSON object. Fixes u…
rodinaarssen 42bf046
Extracted jsonrpc test interface to a separate class
rodinaarssen 28b6173
Made test class abstract to allow for code reuse later on
rodinaarssen e876cee
Moved function around a bit
rodinaarssen e29a164
Prepared abstract test class for instantiation
rodinaarssen 713f19e
Improved configuration methods in GsonUtils
rodinaarssen 805ca60
Added deserialization functionality in GsonUtils given a TypeStore in…
rodinaarssen c3a0b31
Improved comments describing what happens with complex values during …
rodinaarssen 34dd61f
Added jsonrpc test class: complex values as JSON objects
rodinaarssen 5eea68a
Added jsonrpc test class: complex values as Base64-enoded string
rodinaarssen 19c4f0b
Added jsonrpc test class: complex values as string
rodinaarssen f1ad106
Added jsonrpc test class: complex values unsupported
rodinaarssen 3e22617
Using renamed configuration method of GsonUtils
rodinaarssen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,110 @@ | ||
| package org.rascalmpl.test.rpc; | ||
|
|
||
| import java.io.IOException; | ||
|
|
||
| import org.junit.BeforeClass; | ||
| import org.rascalmpl.ideservices.GsonUtils; | ||
|
|
||
| import io.usethesource.vallang.IBool; | ||
| import io.usethesource.vallang.IDateTime; | ||
| import io.usethesource.vallang.IInteger; | ||
| import io.usethesource.vallang.IMapWriter; | ||
| import io.usethesource.vallang.IReal; | ||
| import io.usethesource.vallang.type.Type; | ||
| import io.usethesource.vallang.type.TypeFactory; | ||
| import io.usethesource.vallang.type.TypeStore; | ||
|
|
||
| public class ComplexAsBase64String extends IValueOverJsonTests { | ||
| private static TypeFactory tf = TypeFactory.getInstance(); | ||
| private static TypeStore ts = new TypeStore(); | ||
| private static final Type TestAdt = tf.abstractDataType(ts, "TestAdt"); | ||
| private static final Type TestAdt_testCons = tf.constructor(ts, TestAdt, "testCons", tf.stringType(), "id", tf.integerType(), "nr"); | ||
|
|
||
| @BeforeClass | ||
| public static void setup() throws IOException { | ||
| startTestServerAndClient(GsonUtils.complexAsBase64String(ts)); | ||
| } | ||
|
|
||
| @Override | ||
| public void testSendBool() { | ||
| expectSuccessful("IBool", () -> (IBool) prelude.arbBool(), testServer::sendBool); | ||
| } | ||
|
|
||
| @Override | ||
| public void testSendConstructor() { | ||
| expectSuccessful("IConstructor", () -> vf.constructor(TestAdt_testCons, vf.string("hi"), vf.integer(38)), testServer::sendConstructor); | ||
| } | ||
|
|
||
| @Override | ||
| public void testSendDateTime() { | ||
| expectSuccessful("IDateTime", () -> (IDateTime) prelude.arbDateTime(), testServer::sendDateTime); | ||
| } | ||
|
|
||
| @Override | ||
| public void testSendInteger() { | ||
| expectSuccessful("IInteger", () -> (IInteger) math.arbInt(), testServer::sendInteger); | ||
| } | ||
|
|
||
| @Override | ||
| public void testSendNode() { | ||
| expectSuccessful("INode", () -> prelude.arbNode(), testServer::sendNode); | ||
| } | ||
|
|
||
| @Override | ||
| public void testSendRational() { | ||
| // expectSuccessful("IRational", () -> arbRational(), testServer::sendRational); | ||
| } | ||
|
|
||
| @Override | ||
| public void testSendReal() { | ||
| expectSuccessful("IReal", () -> (IReal) math.arbReal(), testServer::sendReal); | ||
| } | ||
|
|
||
| @Override | ||
| public void testSendLocation() { | ||
| expectSuccessful("ISourceLocation", () -> prelude.arbLoc(), testServer::sendLocation); | ||
| } | ||
|
|
||
| @Override | ||
| public void testSendString() { | ||
| expectSuccessful("IString", () -> prelude.arbString(vf.integer(1024)), testServer::sendString); | ||
| } | ||
|
|
||
| @Override | ||
| public void testSendIntAsNumber() { | ||
| expectSuccessful("INumber", () -> (IInteger) math.arbInt(), testServer::sendNumber); | ||
| } | ||
|
|
||
| @Override | ||
| public void testSendRealAsNumber() { | ||
| expectSuccessful("INumber", () -> (IReal) math.arbReal(), testServer::sendNumber); | ||
| } | ||
|
|
||
| @Override | ||
| public void testSendRealAsValue() { | ||
| expectSuccessful("IValue", () -> (IReal) math.arbReal(), testServer::sendReal); | ||
| } | ||
|
|
||
| @Override | ||
| public void testSendList() { | ||
| expectSuccessful("IList", () -> vf.list(vf.string(""), vf.integer(0)), testServer::sendList); | ||
| } | ||
|
|
||
| @Override | ||
| public void testSendMap() { | ||
| IMapWriter writer = vf.mapWriter(); | ||
| writer.put(vf.integer(0), vf.string("zero")); | ||
| writer.put(vf.integer(1), vf.string("one")); | ||
| expectSuccessful("IMap", () -> writer.done(), testServer::sendMap); | ||
| } | ||
|
|
||
| @Override | ||
| public void testSendSet() { | ||
| expectSuccessful("ISet", () -> vf.set(vf.integer(0), vf.integer(1), vf.integer(2)), testServer::sendSet); | ||
| } | ||
|
|
||
| @Override | ||
| public void testSendTuple() { | ||
| expectSuccessful("ITuple", () -> vf.tuple(vf.integer(0), vf.integer(1)), testServer::sendTuple); | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.