@Override
    public Path copy(final Path source, final Path target, final TransferStatus status, final ConnectionCallback callback, final StreamListener listener) throws BackgroundException {
        try {
            final CopyFileRequest copy = new CopyFileRequest()
                .name(target.getName())
                .parentID(fileid.getFileId(target.getParent()))
                .mode(1); // Overwrite
            final File file = new FilesApi(session.getClient()).filesCopy(
                fileid.getFileId(source), copy);
            listener.sent(status.getLength());
            fileid.cache(target, file.getId());
            return target.withAttributes(new StoregateAttributesFinderFeature(session, fileid).toAttributes(file));
        }
        catch(ApiException e) {
            throw new StoregateExceptionMappingService(fileid).map("Cannot copy {0}", e, source);
        }
    }
@Test
    public void testCopyFileWithRename() throws Exception {
        final StoregateIdProvider fileid = new StoregateIdProvider(session);
        final Path room = new StoregateDirectoryFeature(session, fileid).mkdir(new Path(
            String.format("/My files/%s", new AlphanumericRandomStringService().random()), EnumSet.of(Path.Type.directory, Path.Type.volume)), new TransferStatus());
        final Path test = new StoregateTouchFeature(session, fileid).touch(new Path(room, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus());
        final Path copy = new Path(new StoregateDirectoryFeature(session, fileid).mkdir(new Path(room, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory)), new TransferStatus()), new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file));
        assertNotEquals(test.attributes().getFileId(), new StoregateCopyFeature(session, fileid).copy(test, copy, new TransferStatus(), new DisabledConnectionCallback(), new DisabledStreamListener()).attributes().getFileId());
        assertTrue(new DefaultFindFeature(session).find(test));
        assertTrue(new DefaultFindFeature(session).find(copy));
        new StoregateDeleteFeature(session, fileid).delete(Collections.singletonList(room), new DisabledLoginCallback(), new Delete.DisabledCallback());
    }