Onboard disruptor into gating
Related: rhbz#2054991
This commit is contained in:
parent
427e62390b
commit
f7da40e740
1
.fmf/version
Normal file
1
.fmf/version
Normal file
@ -0,0 +1 @@
|
||||
1
|
7
gating.yaml
Normal file
7
gating.yaml
Normal file
@ -0,0 +1,7 @@
|
||||
--- !Policy
|
||||
product_versions:
|
||||
- rhel-9
|
||||
decision_contexts:
|
||||
- osci_compose_gate
|
||||
rules:
|
||||
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}
|
51
plans/Smoke.java
Normal file
51
plans/Smoke.java
Normal file
@ -0,0 +1,51 @@
|
||||
import com.lmax.disruptor.dsl.Disruptor;
|
||||
import com.lmax.disruptor.EventFactory;
|
||||
import com.lmax.disruptor.RingBuffer;
|
||||
import com.lmax.disruptor.util.DaemonThreadFactory;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
class LongEvent
|
||||
{
|
||||
private long value;
|
||||
|
||||
public void set(long value)
|
||||
{
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
|
||||
class LongEventFactory implements EventFactory<LongEvent>
|
||||
{
|
||||
public LongEvent newInstance()
|
||||
{
|
||||
return new LongEvent();
|
||||
}
|
||||
}
|
||||
|
||||
public class Smoke
|
||||
{
|
||||
public static void main(String[] args) throws Exception
|
||||
{
|
||||
System.out.println("SMOKE TEST START");
|
||||
|
||||
int bufferSize = 1024;
|
||||
|
||||
Disruptor<LongEvent> disruptor =
|
||||
new Disruptor<>(LongEvent::new, bufferSize, DaemonThreadFactory.INSTANCE);
|
||||
|
||||
disruptor.handleEventsWith((event, sequence, endOfBatch) ->
|
||||
System.out.println("Event: " + event));
|
||||
disruptor.start();
|
||||
|
||||
RingBuffer<LongEvent> ringBuffer = disruptor.getRingBuffer();
|
||||
ByteBuffer bb = ByteBuffer.allocate(8);
|
||||
for (long l = 0; l < 10; l++)
|
||||
{
|
||||
bb.putLong(0, l);
|
||||
ringBuffer.publishEvent((event, sequence, buffer) -> event.set(buffer.getLong(0)), bb);
|
||||
Thread.sleep(100);
|
||||
}
|
||||
|
||||
System.out.println("SMOKE TEST COMPLETE");
|
||||
}
|
||||
}
|
8
plans/smoke.fmf
Normal file
8
plans/smoke.fmf
Normal file
@ -0,0 +1,8 @@
|
||||
summary: Basic smoke test
|
||||
prepare:
|
||||
how: install
|
||||
package: java-devel
|
||||
execute:
|
||||
script:
|
||||
- javac -cp /usr/share/java/disruptor.jar plans/Smoke.java
|
||||
- java -cp /usr/share/java/disruptor.jar:plans Smoke
|
Loading…
Reference in New Issue
Block a user