@Test(expectedExceptions = IllegalArgumentException.class) public void willFailToCreateCommitRequestBodyWhenThereAreNoParts() { ServerSideMultipartManager.createCommitRequestBody(Stream.empty()); }
static ImmutablePair<byte[], Integer> createCommitRequestBody(final Stream<? extends MantaMultipartUploadTuple> parts) { final JsonNodeFactory nodeFactory = MantaObjectMapper.NODE_FACTORY_INSTANCE; final ObjectNode objectNode = new ObjectNode(nodeFactory); final ArrayNode partsArrayNode = new ArrayNode(nodeFactory); objectNode.set("parts", partsArrayNode); try (Stream<? extends MantaMultipartUploadTuple> sorted = parts.sorted()) { sorted.forEach(tuple -> partsArrayNode.add(tuple.getEtag())); } Validate.isTrue(partsArrayNode.size() > 0, "Can't commit multipart upload with no parts"); try { return ImmutablePair.of(MantaObjectMapper.INSTANCE.writeValueAsBytes(objectNode), partsArrayNode.size()); } catch (IOException e) { String msg = "Error serializing JSON for commit MPU request body"; throw new MantaMultipartException(msg, e); } }
ServerSideMultipartManager extends AbstractMultipartManager
        <ServerSideMultipartUpload, MantaMultipartUploadPart> { static ImmutablePair<byte[], Integer> createCommitRequestBody(final Stream<? extends MantaMultipartUploadTuple> parts) { final JsonNodeFactory nodeFactory = MantaObjectMapper.NODE_FACTORY_INSTANCE; final ObjectNode objectNode = new ObjectNode(nodeFactory); final ArrayNode partsArrayNode = new ArrayNode(nodeFactory); objectNode.set("parts", partsArrayNode); try (Stream<? extends MantaMultipartUploadTuple> sorted = parts.sorted()) { sorted.forEach(tuple -> partsArrayNode.add(tuple.getEtag())); } Validate.isTrue(partsArrayNode.size() > 0, "Can't commit multipart upload with no parts"); try { return ImmutablePair.of(MantaObjectMapper.INSTANCE.writeValueAsBytes(objectNode), partsArrayNode.size()); } catch (IOException e) { String msg = "Error serializing JSON for commit MPU request body"; throw new MantaMultipartException(msg, e); } } }
ServerSideMultipartManager extends AbstractMultipartManager
        <ServerSideMultipartUpload, MantaMultipartUploadPart> { static ImmutablePair<byte[], Integer> createCommitRequestBody(final Stream<? extends MantaMultipartUploadTuple> parts) { final JsonNodeFactory nodeFactory = MantaObjectMapper.NODE_FACTORY_INSTANCE; final ObjectNode objectNode = new ObjectNode(nodeFactory); final ArrayNode partsArrayNode = new ArrayNode(nodeFactory); objectNode.set("parts", partsArrayNode); try (Stream<? extends MantaMultipartUploadTuple> sorted = parts.sorted()) { sorted.forEach(tuple -> partsArrayNode.add(tuple.getEtag())); } Validate.isTrue(partsArrayNode.size() > 0, "Can't commit multipart upload with no parts"); try { return ImmutablePair.of(MantaObjectMapper.INSTANCE.writeValueAsBytes(objectNode), partsArrayNode.size()); } catch (IOException e) { String msg = "Error serializing JSON for commit MPU request body"; throw new MantaMultipartException(msg, e); } } ServerSideMultipartManager(final MantaClient mantaClient);   ServerSideMultipartManager(final ConfigContext config,
                               final HttpHelper httpHelper,
                               final MantaClient mantaClient); }
ServerSideMultipartManager extends AbstractMultipartManager
        <ServerSideMultipartUpload, MantaMultipartUploadPart> { static ImmutablePair<byte[], Integer> createCommitRequestBody(final Stream<? extends MantaMultipartUploadTuple> parts) { final JsonNodeFactory nodeFactory = MantaObjectMapper.NODE_FACTORY_INSTANCE; final ObjectNode objectNode = new ObjectNode(nodeFactory); final ArrayNode partsArrayNode = new ArrayNode(nodeFactory); objectNode.set("parts", partsArrayNode); try (Stream<? extends MantaMultipartUploadTuple> sorted = parts.sorted()) { sorted.forEach(tuple -> partsArrayNode.add(tuple.getEtag())); } Validate.isTrue(partsArrayNode.size() > 0, "Can't commit multipart upload with no parts"); try { return ImmutablePair.of(MantaObjectMapper.INSTANCE.writeValueAsBytes(objectNode), partsArrayNode.size()); } catch (IOException e) { String msg = "Error serializing JSON for commit MPU request body"; throw new MantaMultipartException(msg, e); } } ServerSideMultipartManager(final MantaClient mantaClient);   ServerSideMultipartManager(final ConfigContext config,
                               final HttpHelper httpHelper,
                               final MantaClient mantaClient); @Override int getMaxParts(); @Override int getMinimumPartSize(); @Override Stream<MantaMultipartUpload> listInProgress(); @Override ServerSideMultipartUpload initiateUpload(final String path); @Override ServerSideMultipartUpload initiateUpload(final String path,
                                                    final MantaMetadata mantaMetadata); @Override ServerSideMultipartUpload initiateUpload(final String path,
                                                    final MantaMetadata mantaMetadata,
                                                    final MantaHttpHeaders httpHeaders); @Override ServerSideMultipartUpload initiateUpload(final String path,
                                                    final Long contentLength,
                                                    final MantaMetadata mantaMetadata,
                                                    final MantaHttpHeaders httpHeaders); @Override MantaMultipartUploadPart getPart(final ServerSideMultipartUpload upload,
                                            final int partNumber); @Override MantaMultipartStatus getStatus(final ServerSideMultipartUpload upload); @Override Stream<MantaMultipartUploadPart> listParts(final ServerSideMultipartUpload upload); @Override void abort(final ServerSideMultipartUpload upload); @Override void complete(final ServerSideMultipartUpload upload,
                         final Iterable<? extends MantaMultipartUploadTuple> parts); @Override void complete(final ServerSideMultipartUpload upload,
                         final Stream<? extends MantaMultipartUploadTuple> partsStream); }
ServerSideMultipartManager extends AbstractMultipartManager
        <ServerSideMultipartUpload, MantaMultipartUploadPart> { static ImmutablePair<byte[], Integer> createCommitRequestBody(final Stream<? extends MantaMultipartUploadTuple> parts) { final JsonNodeFactory nodeFactory = MantaObjectMapper.NODE_FACTORY_INSTANCE; final ObjectNode objectNode = new ObjectNode(nodeFactory); final ArrayNode partsArrayNode = new ArrayNode(nodeFactory); objectNode.set("parts", partsArrayNode); try (Stream<? extends MantaMultipartUploadTuple> sorted = parts.sorted()) { sorted.forEach(tuple -> partsArrayNode.add(tuple.getEtag())); } Validate.isTrue(partsArrayNode.size() > 0, "Can't commit multipart upload with no parts"); try { return ImmutablePair.of(MantaObjectMapper.INSTANCE.writeValueAsBytes(objectNode), partsArrayNode.size()); } catch (IOException e) { String msg = "Error serializing JSON for commit MPU request body"; throw new MantaMultipartException(msg, e); } } ServerSideMultipartManager(final MantaClient mantaClient);   ServerSideMultipartManager(final ConfigContext config,
                               final HttpHelper httpHelper,
                               final MantaClient mantaClient); @Override int getMaxParts(); @Override int getMinimumPartSize(); @Override Stream<MantaMultipartUpload> listInProgress(); @Override ServerSideMultipartUpload initiateUpload(final String path); @Override ServerSideMultipartUpload initiateUpload(final String path,
                                                    final MantaMetadata mantaMetadata); @Override ServerSideMultipartUpload initiateUpload(final String path,
                                                    final MantaMetadata mantaMetadata,
                                                    final MantaHttpHeaders httpHeaders); @Override ServerSideMultipartUpload initiateUpload(final String path,
                                                    final Long contentLength,
                                                    final MantaMetadata mantaMetadata,
                                                    final MantaHttpHeaders httpHeaders); @Override MantaMultipartUploadPart getPart(final ServerSideMultipartUpload upload,
                                            final int partNumber); @Override MantaMultipartStatus getStatus(final ServerSideMultipartUpload upload); @Override Stream<MantaMultipartUploadPart> listParts(final ServerSideMultipartUpload upload); @Override void abort(final ServerSideMultipartUpload upload); @Override void complete(final ServerSideMultipartUpload upload,
                         final Iterable<? extends MantaMultipartUploadTuple> parts); @Override void complete(final ServerSideMultipartUpload upload,
                         final Stream<? extends MantaMultipartUploadTuple> partsStream);  }