@@ -0,0 +1,2614 @@
+/*%0A * Copyright 2014-2017 Higher Frequency Trading%0A *%0A * http://www.higherfrequencytrading.com%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A * http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage net.openhft.chronicle.queue.impl.single;%0A%0Aimport net.openhft.chronicle.bytes.Bytes;%0Aimport net.openhft.chronicle.queue.ChronicleQueueTestBase;%0Aimport net.openhft.chronicle.queue.ExcerptAppender;%0Aimport net.openhft.chronicle.queue.ExcerptTailer;%0Aimport net.openhft.chronicle.wire.DocumentContext;%0Aimport net.openhft.chronicle.wire.Wire;%0Aimport net.openhft.chronicle.wire.Wires;%0Aimport org.junit.Ignore;%0Aimport org.junit.Test;%0A%0Aimport java.io.File;%0Aimport java.util.concurrent.TimeoutException;%0A%0Aimport static org.junit.Assert.assertFalse;%0Aimport static org.junit.Assert.assertTrue;%0A%0Apublic class TestWriteWhenCurrentCycleGotEOF extends ChronicleQueueTestBase %7B%0A%0A    @Test%0A    @Ignore(%22Synthetic%22)%0A    public void shouldBeAbleToWrite() throws TimeoutException %7B%0A        File tmpDir = getTmpDir();%0A        createQueueWithOnlyHeaderFile(tmpDir);%0A        SingleChronicleQueue queue = SingleChronicleQueueBuilder.binary(tmpDir).testBlockSize().build();%0A%0A        ExcerptAppender appender = queue.acquireAppender();%0A        try (DocumentContext dc = appender.writingDocument()) %7B%0A            assertTrue(dc.isPresent());%0A        %7D%0A    %7D%0A%0A    private void createQueueWithOnlyHeaderFile(File dir) %7B%0A        SingleChronicleQueue queue = SingleChronicleQueueBuilder.binary(dir).testBlockSize().build();%0A%0A        queue.storeForCycle(queue.cycle(), queue.epoch(), true);%0A%0A        ExcerptTailer tailer = queue.acquireTailer();%0A%0A        try (DocumentContext dc = tailer.readingDocument()) %7B%0A            assertFalse(dc.isPresent());%0A        %7D%0A%0A        Wire wire;%0A        ExcerptAppender excerptAppender = queue.acquireAppender();%0A        try (DocumentContext dc = excerptAppender.writingDocument()) %7B%0A            wire = dc.wire();%0A        %7D%0A%0A        // overwrite last record with EOF%0A        Bytes%3C?%3E bytes = wire.bytes();%0A        bytes.writeVolatileInt(bytes.writePosition() - 5, Wires.END_OF_DATA);%0A        bytes.writeVolatileInt(bytes.writePosition() - 1, 0);%0A    %7D%0A%7D%0A

Test for EOF