Source:
public void quotaExceededTest() throws Exception { serverRouter.reset(); String dirPath = PARAMETERS.TEST_TEMP_DIR; final int maxLogSizeInBytes = 1000; FileStore corfuDirBackend = Files.getFileStore(Paths.get(dirPath)); final long fsSize = corfuDirBackend.getTotalSpace(); final double maxLogSizeInPercentage = maxLogSizeInBytes * 100.0 / fsSize; ServerContext sc = serverContext = new ServerContextBuilder() .setMemory(false) .setLogPath(dirPath) .setServerRouter(serverRouter) .setLogSizeQuota(Double.toString(maxLogSizeInPercentage)) .build(); LogUnitServer server = new LogUnitServer(sc); serverRouter.addServer(server); final long address0 = 0L; final long address1 = 1L; final long address2 = 2L; final long address3 = 3L; final long address4 = 4L; byte[] payload = new byte[maxLogSizeInBytes / 2]; client.write(address0, null, payload, Collections.emptyMap()).get(); client.write(address1, null, payload, Collections.emptyMap()).get(); assertThatThrownBy(() -> client.write(address2, null, payload, Collections.emptyMap()).get()) .isInstanceOf(ExecutionException.class) .hasRootCauseInstanceOf(QuotaExceededException.class); client.write(LogData.getHole(address4)).get(); client.setPriorityLevel(PriorityLevel.HIGH); client.write(address3, null, payload, Collections.emptyMap()).get(); assertThat(client.read(address0).get().getAddresses().get(address0).getType()).isEqualTo(DataType.DATA); assertThat(client.read(address1).get().getAddresses().get(address1).getType()).isEqualTo(DataType.DATA); assertThat(client.read(address2).get().getAddresses().get(address2).getType()).isEqualTo(DataType.EMPTY); assertThat(client.read(address3).get().getAddresses().get(address3).getType()).isEqualTo(DataType.DATA); assertThat(client.read(address4).get().getAddresses().get(address4).getType()).isEqualTo(DataType.HOLE); }

Target:
public void quotaExceededTest() throws Exception { serverRouter.reset(); String dirPath = PARAMETERS.TEST_TEMP_DIR; final int maxLogSizeInBytes = 1000; FileStore corfuDirBackend = Files.getFileStore(Paths.get(dirPath)); final long fsSize = corfuDirBackend.getTotalSpace(); final double maxLogSizeInPercentage = maxLogSizeInBytes * 100.0 / fsSize; ServerContext sc = serverContext = new ServerContextBuilder() .setMemory(false) .setLogPath(dirPath) .setServerRouter(serverRouter) .setLogSizeLimitPercentage(Double.toString(maxLogSizeInPercentage)) .build(); LogUnitServer server = new LogUnitServer(sc); serverRouter.addServer(server); final long address0 = 0L; final long address1 = 1L; final long address2 = 2L; final long address3 = 3L; final long address4 = 4L; byte[] payload = new byte[maxLogSizeInBytes / 2]; client.write(address0, null, payload, Collections.emptyMap()).get(); client.write(address1, null, payload, Collections.emptyMap()).get(); assertThatThrownBy(() -> client.write(address2, null, payload, Collections.emptyMap()).get()) .isInstanceOf(ExecutionException.class) .hasRootCauseInstanceOf(QuotaExceededException.class); client.write(LogData.getHole(address4)).get(); client.setPriorityLevel(PriorityLevel.HIGH); client.write(address3, null, payload, Collections.emptyMap()).get(); assertThat(client.read(address0).get().getAddresses().get(address0).getType()).isEqualTo(DataType.DATA); assertThat(client.read(address1).get().getAddresses().get(address1).getType()).isEqualTo(DataType.DATA); assertThat(client.read(address2).get().getAddresses().get(address2).getType()).isEqualTo(DataType.EMPTY); assertThat(client.read(address3).get().getAddresses().get(address3).getType()).isEqualTo(DataType.DATA); assertThat(client.read(address4).get().getAddresses().get(address4).getType()).isEqualTo(DataType.HOLE); }