Search in sources :

Example 11 with SingleChronicleQueueBuilder

use of net.openhft.chronicle.queue.impl.single.SingleChronicleQueueBuilder in project Chronicle-Queue by OpenHFT.

the class RollCycleDefaultingTest method customDefinitionGetsLoaded.

@Test
public void customDefinitionGetsLoaded() {
    String configuredCycle = MyRollcycle.class.getName();
    System.setProperty(QueueSystemProperties.DEFAULT_ROLL_CYCLE_PROPERTY, configuredCycle);
    SingleChronicleQueueBuilder builder = SingleChronicleQueueBuilder.binary("test");
    assertTrue(builder.rollCycle() instanceof MyRollcycle);
}
Also used : SingleChronicleQueueBuilder(net.openhft.chronicle.queue.impl.single.SingleChronicleQueueBuilder) Test(org.junit.Test)

Example 12 with SingleChronicleQueueBuilder

use of net.openhft.chronicle.queue.impl.single.SingleChronicleQueueBuilder in project Chronicle-Queue by OpenHFT.

the class MoveIndexAfterFailedTailerTest method test.

@Test
public void test() {
    String basePath = OS.getTarget() + "/" + getClass().getSimpleName() + "-" + Time.uniqueId();
    final SingleChronicleQueueBuilder myBuilder = SingleChronicleQueueBuilder.single(basePath).testBlockSize().timeProvider(System::currentTimeMillis).rollCycle(HOURLY);
    int messages = 10;
    try (final ChronicleQueue myWrite = myBuilder.build()) {
        write(myWrite, messages);
    // System.out.println(myWrite.dump());
    }
    try (final ChronicleQueue myRead = myBuilder.build()) {
        read(myRead, messages);
    }
}
Also used : SingleChronicleQueueBuilder(net.openhft.chronicle.queue.impl.single.SingleChronicleQueueBuilder) Test(org.junit.Test)

Example 13 with SingleChronicleQueueBuilder

use of net.openhft.chronicle.queue.impl.single.SingleChronicleQueueBuilder in project Chronicle-Queue by OpenHFT.

the class RollCycleDefaultingTest method correctConfigGetsLoaded.

@Test
public void correctConfigGetsLoaded() {
    String aClass = RollCycles.HOURLY.getClass().getName();
    String configuredCycle = aClass + ":HOURLY";
    System.setProperty(QueueSystemProperties.DEFAULT_ROLL_CYCLE_PROPERTY, configuredCycle);
    SingleChronicleQueueBuilder builder = SingleChronicleQueueBuilder.binary("test");
    assertEquals(RollCycles.HOURLY, builder.rollCycle());
}
Also used : SingleChronicleQueueBuilder(net.openhft.chronicle.queue.impl.single.SingleChronicleQueueBuilder) Test(org.junit.Test)

Example 14 with SingleChronicleQueueBuilder

use of net.openhft.chronicle.queue.impl.single.SingleChronicleQueueBuilder in project Chronicle-Queue by OpenHFT.

the class LatencyDistributionMain method run.

public void run(String[] args) throws InterruptedException {
    File tmpDir = getTmpDir();
    SingleChronicleQueueBuilder builder = SingleChronicleQueueBuilder.fieldlessBinary(tmpDir).blockSize(128 << 20);
    try (ChronicleQueue queue = builder.writeBufferMode(BUFFER_MODE).readBufferMode(BufferMode.None).build();
        ChronicleQueue queue2 = builder.writeBufferMode(BufferMode.None).readBufferMode(BUFFER_MODE).build()) {
        runTest(queue, queue2);
    }
    IOTools.deleteDirWithFiles(tmpDir, 2);
}
Also used : SingleChronicleQueueBuilder(net.openhft.chronicle.queue.impl.single.SingleChronicleQueueBuilder) ChronicleQueue(net.openhft.chronicle.queue.ChronicleQueue) File(java.io.File)

Aggregations

SingleChronicleQueueBuilder (net.openhft.chronicle.queue.impl.single.SingleChronicleQueueBuilder)14 Test (org.junit.Test)9 SingleChronicleQueue (net.openhft.chronicle.queue.impl.single.SingleChronicleQueue)4 File (java.io.File)3 SetTimeProvider (net.openhft.chronicle.core.time.SetTimeProvider)3 ChronicleQueue (net.openhft.chronicle.queue.ChronicleQueue)2 DocumentContext (net.openhft.chronicle.wire.DocumentContext)2 NotNull (org.jetbrains.annotations.NotNull)2 Ignore (org.junit.Ignore)2 IOException (java.io.IOException)1 Files (java.nio.file.Files)1 Path (java.nio.file.Path)1 Paths (java.nio.file.Paths)1 List (java.util.List)1 TimeUnit (java.util.concurrent.TimeUnit)1 AtomicReference (java.util.concurrent.atomic.AtomicReference)1 Consumer (java.util.function.Consumer)1 Function (java.util.function.Function)1 Collectors (java.util.stream.Collectors)1 IntStream (java.util.stream.IntStream)1