@Override
    public EueWriteFeature.Chunk upload(final Path file, final Local local, final BandwidthThrottle throttle, final StreamListener listener,
                                        final TransferStatus status, final ConnectionCallback callback) throws BackgroundException {
        final String uploadUri;
        final String resourceId;
        if(status.isExists()) {
            resourceId = fileid.getFileId(file);
            uploadUri = EueUploadHelper.updateResource(session, resourceId, status, UploadType.SIMPLE).getUploadURI();
        }
        else {
            final ResourceCreationResponseEntry uploadResourceCreationResponseEntry = EueUploadHelper.
                    createResource(session, fileid.getFileId(file.getParent()), file.getName(),
                            status, UploadType.SIMPLE);
            resourceId = EueResourceIdProvider.getResourceIdFromResourceUri(uploadResourceCreationResponseEntry.getHeaders().getLocation());
            uploadUri = uploadResourceCreationResponseEntry.getEntity().getUploadURI();
        }
        status.setParameters(Collections.singletonMap(RESOURCE_ID, resourceId));
        status.setUrl(uploadUri);
        status.setChecksum(writer.checksum(file, status).compute(local.getInputStream(), status));
        return super.upload(file, local, throttle, listener, status, callback);
    }
@Test
    public void testUploadSimpleFile() throws Exception {
        final EueResourceIdProvider fileid = new EueResourceIdProvider(session);
        final EueSingleUploadService service = new EueSingleUploadService(session, fileid, new EueWriteFeature(session, fileid));
        final Path container = new EueDirectoryFeature(session, fileid).mkdir(new Path(new AlphanumericRandomStringService().random(), EnumSet.of(AbstractPath.Type.directory)), new TransferStatus().withLength(0L));
        final String name = new AlphanumericRandomStringService().random();
        final Path file = new Path(container, name, EnumSet.of(Path.Type.file));
        final Local local = new Local(System.getProperty("java.io.tmpdir"), name);
        {
            final byte[] content = RandomUtils.nextBytes(2881);
            IOUtils.write(content, local.getOutputStream(false));
            final TransferStatus status = new TransferStatus().withLength(content.length);
            final BytecountStreamListener count = new BytecountStreamListener();
            service.upload(file, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), count, status, new DisabledConnectionCallback());
            assertEquals(content.length, count.getSent());
            assertTrue(status.isComplete());
            assertTrue(new EueFindFeature(session, fileid).find(file));
            assertEquals(content.length, new EueAttributesFinderFeature(session, fileid).find(file).getSize());
            final byte[] compare = new byte[content.length];
            IOUtils.readFully(new EueReadFeature(session, fileid).read(file, new TransferStatus().withLength(content.length), new DisabledConnectionCallback()), compare);
            assertArrayEquals(content, compare);
        }
        {
            final byte[] content = RandomUtils.nextBytes(526);
            IOUtils.write(content, local.getOutputStream(false));
            final TransferStatus status = new TransferStatus().withLength(content.length).exists(true);
            final BytecountStreamListener count = new BytecountStreamListener();
            service.upload(file, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), count, status, new DisabledConnectionCallback());
            assertEquals(content.length, count.getSent());
            assertTrue(status.isComplete());
            assertTrue(new EueFindFeature(session, fileid).find(file));
            assertEquals(content.length, new EueAttributesFinderFeature(session, fileid).find(file).getSize());
            final byte[] compare = new byte[content.length];
            IOUtils.readFully(new EueReadFeature(session, fileid).read(file, new TransferStatus().withLength(content.length), new DisabledConnectionCallback()), compare);
            assertArrayEquals(content, compare);
        }
        // Override
        new EueDeleteFeature(session, fileid).delete(Collections.singletonList(container), new DisabledLoginCallback(), new Delete.DisabledCallback());
        local.delete();
    }