use of com.google.appengine.api.memcache.AsyncMemcacheServiceImpl.IdentifiableValueImpl in project appengine-java-standard by GoogleCloudPlatform.
the class MemcacheServiceImplTest method multiGetIdentifiableTest.
private void multiGetIdentifiableTest(MemcacheService memcache, String namespace) {
MemcacheGetRequest request = MemcacheGetRequest.newBuilder().setNameSpace(namespace).setForCas(true).addKey(ByteString.copyFrom(makePbKey(ONE))).addKey(ByteString.copyFrom(makePbKey(null))).addKey(ByteString.copyFrom(makePbKey("Missing"))).build();
MemcacheGetResponse response = MemcacheGetResponse.newBuilder().addItem(MemcacheGetResponse.Item.newBuilder().setKey(ByteString.copyFrom(makePbKey(ONE))).setCasId(10).setFlags(Flag.OBJECT.ordinal()).setValue(ByteString.copyFrom(serialize(null).value))).addItem(MemcacheGetResponse.Item.newBuilder().setKey(ByteString.copyFrom(makePbKey(null))).setCasId(20).setFlags(Flag.INTEGER.ordinal()).setValue(ByteString.copyFrom(serialize(456).value))).build();
expectAsyncCall("Get", request, response);
ArrayList<String> collection = new ArrayList<>();
collection.add(ONE);
collection.add(null);
collection.add("Missing");
Map<String, IdentifiableValue> result = memcache.getIdentifiables(collection);
assertThat(result).hasSize(2);
assertThat(result.get(ONE).getValue()).isEqualTo(null);
assertThat(((IdentifiableValueImpl) result.get(ONE)).getCasId()).isEqualTo(10);
assertThat(result.get(null).getValue()).isEqualTo(456);
assertThat(((IdentifiableValueImpl) result.get(null)).getCasId()).isEqualTo(20);
verifyAsyncCall("Get", request);
}
Aggregations