@Override
    public void setConfiguration(final Path container, final LifecycleConfiguration configuration) throws BackgroundException {
        try {
            if(LifecycleConfiguration.empty().equals(configuration)) {
                session.getClient().updateBucket(
                    fileid.getVersionId(containerService.getContainer(container)),
                    new B2BucketTypeFeature(session, fileid).toBucketType(container.attributes().getAcl())
                );
            }
            else {
                session.getClient().updateBucket(
                        fileid.getVersionId(containerService.getContainer(container)),
                        new B2BucketTypeFeature(session, fileid).toBucketType(container.attributes().getAcl()),
                        new LifecycleRule(
                                null == configuration.getExpiration() ? null : configuration.getExpiration().longValue(),
                                null == configuration.getTransition() ? null : configuration.getTransition().longValue(),
                                StringUtils.EMPTY)
                );
            }
        }
        catch(B2ApiException e) {
            throw new B2ExceptionMappingService(fileid).map("Failure to write attributes of {0}", e, container);
        }
        catch(IOException e) {
            throw new DefaultIOExceptionMappingService().map("Failure to write attributes of {0}", e, container);
        }
    }
@Test
    public void testSetConfiguration() throws Exception {
        final Path bucket = new Path(new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory, Path.Type.volume));
        final B2VersionIdProvider fileid = new B2VersionIdProvider(session);
        new B2DirectoryFeature(session, fileid).mkdir(bucket, new TransferStatus());
        assertEquals(LifecycleConfiguration.empty(), new B2LifecycleFeature(session, fileid).getConfiguration(bucket));
        new B2LifecycleFeature(session, fileid).setConfiguration(bucket, new LifecycleConfiguration(1, 30));
        final LifecycleConfiguration configuration = new B2LifecycleFeature(session, fileid).getConfiguration(bucket);
        assertEquals(30, configuration.getExpiration(), 0L);
        assertEquals(1, configuration.getTransition(), 0L);
        new B2LifecycleFeature(session, fileid).setConfiguration(bucket, LifecycleConfiguration.empty());
        assertEquals(LifecycleConfiguration.empty(), new B2LifecycleFeature(session, fileid).getConfiguration(bucket));
        new B2DeleteFeature(session, fileid).delete(Collections.singletonList(bucket), new DisabledLoginCallback(), new Delete.DisabledCallback());
    }