use of com.linkedin.data.template.StringMap in project rest.li by linkedin.
the class TestParseqBasedFluentClientApi method testCollectionActionWithNoReturn.
@Test
public void testCollectionActionWithNoReturn() throws Exception {
Greetings greetings = new GreetingsFluentClient(_parSeqRestliClient, _parSeqUnitTestHelper.getEngine());
CompletableFuture<Void> stage = greetings.anotherAction(param -> param.setBitfield(new BooleanArray()).setRequest(new TransferOwnershipRequest()).setSomeString("").setStringMap(new StringMap())).toCompletableFuture();
Assert.assertNull(stage.get(5000, TimeUnit.MILLISECONDS));
assert (!stage.isCompletedExceptionally());
}
use of com.linkedin.data.template.StringMap in project rest.li by linkedin.
the class IndividualResponseConversionTask method toIndividualResponse.
private static IndividualResponse toIndividualResponse(String id, RestResponse restResponse) throws MimeTypeParseException, IOException {
IndividualResponse individualResponse = new IndividualResponse();
individualResponse.setStatus(restResponse.getStatus());
individualResponse.setHeaders(new StringMap(restResponse.getHeaders()));
ByteString entity = restResponse.getEntity();
if (!entity.isEmpty()) {
// TODO Avoid converting bytes to datamap here. Individual response should have only the bytes.
individualResponse.setBody(new IndividualBody(DataMapConverter.bytesToDataMap(restResponse.getHeaders(), entity)));
}
return individualResponse;
}
use of com.linkedin.data.template.StringMap in project rest.li by linkedin.
the class TwitterAccountsResource method closeAccounts.
@Action(name = "closeAccounts")
public StringMap closeAccounts(@ActionParam("emailAddresses") StringArray emailAddresses, @ActionParam("someFlag") boolean someFlag, @ActionParam("options") @Optional StringMap options) {
StringMap res = new StringMap();
res.put("numClosed", "5");
res.put("resultCode", "11");
return new StringMap(res);
}
use of com.linkedin.data.template.StringMap in project rest.li by linkedin.
the class MapGeneratorTest method testWithPrimitivesMap.
@Test
public void testWithPrimitivesMap() throws Throwable {
String json = load("WithPrimitivesMap.json");
WithPrimitivesMap original = new WithPrimitivesMap();
IntegerMap ints = new IntegerMap();
ints.put("a", 1);
ints.put("b", 2);
ints.put("c", 3);
original.setInts(ints);
LongMap longs = new LongMap();
longs.put("a", 10L);
longs.put("b", 20L);
longs.put("c", 30L);
original.setLongs(longs);
FloatMap floats = new FloatMap();
floats.put("a", 1.1f);
floats.put("b", 2.2f);
floats.put("c", 3.3f);
original.setFloats(floats);
DoubleMap doubles = new DoubleMap();
doubles.put("a", 11.1d);
doubles.put("b", 22.2d);
doubles.put("c", 33.3d);
original.setDoubles(doubles);
BooleanMap booleans = new BooleanMap();
booleans.put("a", true);
booleans.put("b", false);
booleans.put("c", true);
original.setBooleans(booleans);
StringMap strings = new StringMap();
strings.put("a", "string1");
strings.put("b", "string2");
strings.put("c", "string3");
original.setStrings(strings);
BytesMap bytes = new BytesMap();
bytes.put("a", SchemaFixtures.bytes1);
bytes.put("b", SchemaFixtures.bytes2);
bytes.put("c", SchemaFixtures.bytes3);
original.setBytes(bytes);
assertJson(original, json);
WithPrimitivesMap roundTripped = new WithPrimitivesMap(roundTrip(original.data()));
assertJson(roundTripped, json);
}
use of com.linkedin.data.template.StringMap in project rest.li by linkedin.
the class TestGreetingsClient method testRecordActionVoidReturn.
@Test(dataProvider = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "requestBuilderDataProvider")
public void testRecordActionVoidReturn(RootBuilderWrapper<Long, Greeting> builders) throws RemoteInvocationException {
Request<Void> requestVoid = builders.<Void>action("AnotherAction").setActionParam("bitfield", new BooleanArray()).setActionParam("request", new TransferOwnershipRequest()).setActionParam("someString", "").setActionParam("stringMap", new StringMap()).build();
ResponseFuture<Void> responseFutureVoid = getClient().sendRequest(requestVoid);
Assert.assertEquals(responseFutureVoid.getResponse().getStatus(), 200);
Assert.assertNull(responseFutureVoid.getResponse().getEntity());
}
Aggregations