Request request = getRequestWithCookie(Method.POST, "");
shareV2Interface.setRequest(request);
shareV2Interface.setResponse(new Response(request));
shareV2Interface.doInit();
SharePojo share_ref = new SharePojo();
share_ref.setTitle("test_ref");
share_ref.setDescription("123");
share_ref.setType("test1");
List<ShareCommunityPojo> communities = new ArrayList<SharePojo.ShareCommunityPojo>();
ShareCommunityPojo scp = new ShareCommunityPojo();
scp.set_id(new ObjectId("4c927585d591d31d7b37097a")); //this is inf system i think
communities.add(scp);
share_ref.setCommunities(communities);
DocumentLocationPojo dlp = new DocumentLocationPojo();
dlp.setDatabase("doc_metadata");
dlp.setCollection("metadata");
dlp.set_id(new ObjectId("53fe2c83e4b060b5b2a6e779")); //this needs to be a valid doc
share_ref.setDocumentLocation(dlp);
String share_string = share_ref.toDb().toString();
Representation entity = new StringRepresentation(share_string);
Representation rep = shareV2Interface.post(entity);
ResponsePojo rp = ResponsePojo.fromApi( rep.getText(), null, ResponsePojo.class);
SharePojo share = ApiManager.mapFromApi((JsonElement)rp.getData(), SharePojo.class, new SharePojoApiMap(null));
return share;
}