@Test public void testCreatePlaceholder() throws Exception { final Host host = new Host(new SpectraProtocol() { @Override public Scheme getScheme() { return Scheme.http; } }, System.getProperties().getProperty("spectra.hostname"), Integer.valueOf(System.getProperties().getProperty("spectra.port")), new Credentials( System.getProperties().getProperty("spectra.user"), System.getProperties().getProperty("spectra.key") )); final SpectraSession session = new SpectraSession(host, new DisabledX509TrustManager(), new DefaultX509KeyManager()); final AtomicBoolean b = new AtomicBoolean(); final Path container = new Path("cyberduck", EnumSet.of(Path.Type.directory, Path.Type.volume)); final String name = UUID.randomUUID().toString(); session.withListener(new TranscriptListener() { @Override public void log(final Type request, final String message) { switch(request) { case request: if((String.format("PUT /%s/%s/ HTTP/1.1", container.getName(), name)).equals(message)) { b.set(true); } } } }); session.open(Proxy.DIRECT, new DisabledHostKeyCallback(), new DisabledLoginCallback()); session.login(Proxy.DIRECT, new DisabledLoginCallback(), new DisabledCancelCallback()); final Path test = new SpectraDirectoryFeature(session, new SpectraWriteFeature(session)).mkdir( new Path(container, name, EnumSet.of(Path.Type.directory)), null, new TransferStatus()); assertTrue(b.get()); assertTrue(new SpectraFindFeature(session).find(test)); assertTrue(new DefaultFindFeature(session).find(test)); new SpectraDeleteFeature(session).delete(Collections.<Path>singletonList(test), new DisabledLoginCallback(), new Delete.DisabledCallback()); session.close(); }
@Override public Path mkdir(final Path folder, final String region, final TransferStatus status) throws BackgroundException { if(containerService.isContainer(folder)) { return super.mkdir(folder, region, status); } else { status.setChecksum(writer.checksum(folder, status).compute(new NullInputStream(0L), status)); return super.mkdir(folder, region, status); } }
SpectraDirectoryFeature extends S3DirectoryFeature { @Override public Path mkdir(final Path folder, final String region, final TransferStatus status) throws BackgroundException { if(containerService.isContainer(folder)) { return super.mkdir(folder, region, status); } else { status.setChecksum(writer.checksum(folder, status).compute(new NullInputStream(0L), status)); return super.mkdir(folder, region, status); } } }
SpectraDirectoryFeature extends S3DirectoryFeature { @Override public Path mkdir(final Path folder, final String region, final TransferStatus status) throws BackgroundException { if(containerService.isContainer(folder)) { return super.mkdir(folder, region, status); } else { status.setChecksum(writer.checksum(folder, status).compute(new NullInputStream(0L), status)); return super.mkdir(folder, region, status); } } SpectraDirectoryFeature(final SpectraSession session, final Write<StorageObject> writer); }
SpectraDirectoryFeature extends S3DirectoryFeature { @Override public Path mkdir(final Path folder, final String region, final TransferStatus status) throws BackgroundException { if(containerService.isContainer(folder)) { return super.mkdir(folder, region, status); } else { status.setChecksum(writer.checksum(folder, status).compute(new NullInputStream(0L), status)); return super.mkdir(folder, region, status); } } SpectraDirectoryFeature(final SpectraSession session, final Write<StorageObject> writer); @Override Path mkdir(final Path folder, final String region, final TransferStatus status); }
SpectraDirectoryFeature extends S3DirectoryFeature { @Override public Path mkdir(final Path folder, final String region, final TransferStatus status) throws BackgroundException { if(containerService.isContainer(folder)) { return super.mkdir(folder, region, status); } else { status.setChecksum(writer.checksum(folder, status).compute(new NullInputStream(0L), status)); return super.mkdir(folder, region, status); } } SpectraDirectoryFeature(final SpectraSession session, final Write<StorageObject> writer); @Override Path mkdir(final Path folder, final String region, final TransferStatus status);  }