ZKLogMetadataForWriter extends ZKLogMetadata { public static Future<ZKLogMetadataForWriter> of( final URI uri, final String logName, final String logIdentifier, final ZooKeeper zk, final List<ACL> acl, final boolean ownAllocator, final boolean createIfNotExists) { final String logRootPath = ZKLogMetadata.getLogRootPath(uri, logName, logIdentifier); try { PathUtils.validatePath(logRootPath); } catch (IllegalArgumentException e) { LOG.error("Illegal path value {} for stream {}", new Object[]{logRootPath, logName, e}); return Future.exception(new InvalidStreamNameException(logName, "Log name is invalid")); } return checkLogMetadataPaths(zk, logRootPath, ownAllocator) .flatMap(new AbstractFunction1<List<Versioned<byte[]>>, Future<List<Versioned<byte[]>>>>() { @Override public Future<List<Versioned<byte[]>>> apply(List<Versioned<byte[]>> metadatas) { Promise<List<Versioned<byte[]>>> promise = new Promise<List<Versioned<byte[]>>>(); createMissingMetadata(zk, logRootPath, metadatas, acl, ownAllocator, createIfNotExists, promise); return promise; } }).map(new ExceptionalFunction<List<Versioned<byte[]>>, ZKLogMetadataForWriter>() { @Override public ZKLogMetadataForWriter applyE(List<Versioned<byte[]>> metadatas) throws DLException { return processLogMetadatas(uri, logName, logIdentifier, metadatas, ownAllocator); } }); } private  ZKLogMetadataForWriter(URI uri,
                                   String logName,
                                   String logIdentifier,
                                   Versioned<byte[]> maxLSSNData,
                                   Versioned<byte[]> maxTxIdData,
                                   Versioned<byte[]> allocationData); static Future<ZKLogMetadataForWriter> of(
            final URI uri,
            final String logName,
            final String logIdentifier,
            final ZooKeeper zk,
            final List<ACL> acl,
            final boolean ownAllocator,
            final boolean createIfNotExists); Versioned<byte[]> getMaxLSSNData(); Versioned<byte[]> getMaxTxIdData(); Versioned<byte[]> getAllocationData();  }
@Test(timeout = 60000, expected = LogNotFoundException.class) public void testCreateLogMetadataWithCreateIfNotExistsSetToFalse() throws Exception { URI uri = DLMTestUtil.createDLMURI(zkPort, ""); String logName = testName.getMethodName(); String logIdentifier = "<default>"; FutureUtils.result(ZKLogMetadataForWriter.of(uri, logName, logIdentifier, zkc.get(), zkc.getDefaultACL(), true, false)); }