/** * Tell the Swift server to expect a multi-part upload by submitting * a 0-byte file with the X-Object-Manifest header * * @param path path of final final * @throws IOException */ public void createManifestForPartUpload(Path path) throws IOException { String pathString = toObjectPath(path).toString(); if (!pathString.endsWith("/")) { pathString = pathString.concat("/"); } if (pathString.startsWith("/")) { pathString = pathString.substring(1); } swiftRestClient.upload(toObjectPath(path), new ByteArrayInputStream(new byte[0]), 0, new Header(SwiftProtocolConstants.X_OBJECT_MANIFEST, pathString)); }
/** * Get a configuration which a small blocksize reported to callers * @return a configuration for this test */ @Override public Configuration getConf() { Configuration conf = super.getConf(); /* * set to 4KB */ conf.setInt(SwiftProtocolConstants.SWIFT_BLOCKSIZE, SWIFT_READ_BLOCKSIZE); return conf; }
/** * Create a config with a 1KB request size * @return a config */ @Override protected Configuration createConfiguration() { Configuration conf = super.createConfiguration(); conf.set(SwiftProtocolConstants.SWIFT_REQUEST_SIZE, "1"); return conf; }
@Override protected Configuration createConfiguration() { Configuration conf = super.createConfiguration(); //set the partition size to 1 KB conf.setInt(SwiftProtocolConstants.SWIFT_PARTITION_SIZE, PART_SIZE); return conf; }
@Override @Before public void setUp() throws Exception { Configuration conf = new Configuration(); //small blocksize for faster remote tests conf.setInt(SwiftProtocolConstants.SWIFT_BLOCKSIZE, 2); URI serviceURI = SwiftTestUtils.getServiceURI(conf); fSys = FileSystem.get(serviceURI, conf); super.setUp(); }
private void assertLocationValid(BlockLocation location) throws IOException { LOG.info(location); String[] hosts = location.getHosts(); String[] names = location.getNames(); assertNotEqual("No hosts supplied for " + location, 0, hosts.length); //for every host, there's a name. assertEquals("Unequal names and hosts in " + location, hosts.length, names.length); assertEquals(SwiftProtocolConstants.BLOCK_LOCATION, location.getNames()[0]); assertEquals(SwiftProtocolConstants.TOPOLOGY_PATH, location.getTopologyPaths()[0]); }