in bulkimport/src/main/java/com/microsoft/azure/documentdb/bulkimport/Main.java [221:246]
public static HashMap<String, Object> loadDocumentToPartitionKeyValueMap(int numberOfDocuments, PartitionKeyDefinition partitionKeyDefinition) {
Preconditions.checkArgument(partitionKeyDefinition != null &&
partitionKeyDefinition.getPaths().size() > 0, "there is no partition key definition");
Collection<String> partitionKeyPath = partitionKeyDefinition.getPaths();
Preconditions.checkArgument(partitionKeyPath.size() == 1,
"the command line benchmark tool only support simple partition key path");
String partitionKeyName = partitionKeyPath.iterator().next().replaceFirst("^/", "");
HashMap<String, Object> documentsToPartitionKeyValue = new HashMap<String, Object>(numberOfDocuments);
// the size of each document is approximately 1KB
// return collection of <document, partitionKeyValue> to be bulk imported
// if you are reading documents from disk you can change this to read documents from disk
IntStream.range(0, numberOfDocuments).mapToObj(i ->
{
String partitionKeyValue = UUID.randomUUID().toString();
String doc = generateDocument(partitionKeyName, partitionKeyValue);
return new AbstractMap.SimpleEntry<String, Object>(doc, partitionKeyValue);
}).forEach(entry -> documentsToPartitionKeyValue.put(entry.getKey(), entry.getValue()));
return documentsToPartitionKeyValue;
}