@Test
public void createAndUpdateEntityTwoKeys() throws Exception {
EdmEntitySet edmEntitySet = createMockedEdmEntitySet("Photos");
Photo photo = new Photo();
final String nameKeyValue = "BigPicture";
final String typeKeyValue = "PNG";
photo.setName(nameKeyValue);
photo.setType(typeKeyValue);
photo.setImageUri("https://localhost/image.png");
photo.setImageType("image/png");
datasource.createData(edmEntitySet, photo);
Map<String, Object> keys = new HashMap<String, Object>();
keys.put("Name", "BigPicture");
keys.put("ImageFormat", "PNG");
Photo read = (Photo) datasource.readData(edmEntitySet, keys);
Assert.assertEquals("BigPicture", read.getName());
Assert.assertEquals("PNG", read.getType());
Assert.assertEquals("image/png", read.getImageType());
Assert.assertEquals("https://localhost/image.png", read.getImageUri());
// update
Photo updatedPhoto = new Photo();
updatedPhoto.setName(nameKeyValue);
updatedPhoto.setType(typeKeyValue);
updatedPhoto.setImageUri("https://localhost/image.jpg");
updatedPhoto.setImageType("image/jpg");
datasource.updateData(edmEntitySet, updatedPhoto);
Map<String, Object> updatedKeys = new HashMap<String, Object>();
updatedKeys.put("Name", nameKeyValue);
updatedKeys.put("ImageFormat", typeKeyValue);
Photo readUpdated = (Photo) datasource.readData(edmEntitySet, updatedKeys);
Assert.assertEquals("BigPicture", readUpdated.getName());
Assert.assertEquals("PNG", readUpdated.getType());
Assert.assertEquals("image/jpg", readUpdated.getImageType());
Assert.assertEquals("https://localhost/image.jpg", readUpdated.getImageUri());
}