private void createTmpCollection() throws Exception { Response resp = adminExecutor.execute( Request.Put(dbTmpUri) .bodyString("{a:1}", halCT) .addHeader(Headers.CONTENT_TYPE_STRING, Representation.HAL_JSON_MEDIA_TYPE)); check("check put tmp db", resp, HttpStatus.SC_CREATED); resp = adminExecutor.execute( Request.Put(collectionTmpUri) .bodyString("{descr:\"temp coll\"}", halCT) .addHeader(Headers.CONTENT_TYPE_STRING, Representation.HAL_JSON_MEDIA_TYPE)); check("check put tmp coll", resp, HttpStatus.SC_CREATED); }
private void createMetadataAndTestData(String aggregationsMetadata) throws Exception { // get the collection etag String etag = getEtag(collectionTmpUri); // post some data String[] data = new String[] { "{\"name\":\"a\",\"age\":10}", "{\"name\":\"a\",\"age\":20}", "{\"name\":\"a\",\"age\":30}", "{\"name\":\"b\",\"age\":40}", "{\"name\":\"b\",\"age\":50}", "{\"name\":\"b\",\"age\":60}", "{\"obj\":{\"name\":\"x\",\"age\":10}}", "{\"obj\":{\"name\":\"x\",\"age\":20}}", "{\"obj\":{\"name\":\"y\",\"age\":10}}", "{\"obj\":{\"name\":\"y\",\"age\":20}}" }; for (String datum : data) { Response resp = adminExecutor.execute( Request.Post(collectionTmpUri) .bodyString(datum, halCT) .addHeader(Headers.CONTENT_TYPE_STRING, Representation.HAL_JSON_MEDIA_TYPE)); check("check aggregation create test data", resp, HttpStatus.SC_CREATED); } Response resp = adminExecutor.execute( Request.Patch(collectionTmpUri) .bodyString(aggregationsMetadata, halCT) .addHeader(Headers.CONTENT_TYPE_STRING, Representation.HAL_JSON_MEDIA_TYPE) .addHeader(Headers.IF_MATCH_STRING, etag)); check("check update collection with aggregations metadata", resp, HttpStatus.SC_OK); }