use of streamer.debug.FakeSource in project cloudstack by apache.
the class OutputStreamSink method main.
/**
* Example.
*/
public static void main(String[] args) {
Element source = new FakeSource("source") {
{
verbose = true;
numBuffers = 3;
incommingBufLength = 5;
delay = 100;
}
};
OutputStreamSink sink = new OutputStreamSink("sink") {
{
verbose = true;
}
};
Link link = new SyncLink();
source.setLink(STDOUT, link, Direction.OUT);
sink.setLink(STDIN, link, Direction.IN);
sink.setOutputStream(new ByteArrayOutputStream());
link.sendEvent(Event.STREAM_START, Direction.IN);
link.run();
}
use of streamer.debug.FakeSource in project cloudstack by apache.
the class PipelineImpl method main.
/**
* Example.
*/
public static void main(String[] args) {
// System.setProperty("streamer.Link.debug", "true");
// System.setProperty("streamer.Element.debug", "true");
// System.setProperty("streamer.Pipeline.debug", "true");
Pipeline pipeline = new PipelineImpl("main");
// Create elements
pipeline.add(new FakeSource("source") {
{
incommingBufLength = 3;
numBuffers = 10;
delay = 100;
}
});
pipeline.add(new BaseElement("tee"));
pipeline.add(new FakeSink("sink") {
{
verbose = true;
}
});
pipeline.add(new FakeSink("sink2") {
{
verbose = true;
}
});
// Link elements
pipeline.link("source", "tee", "sink");
pipeline.link("tee >out2", "sink2");
// Run main loop
pipeline.runMainLoop("source", STDOUT, false, false);
}
use of streamer.debug.FakeSource in project cloudstack by apache.
the class AwtBellAdapter method main.
/**
* Example.
*/
public static void main(String[] args) {
System.setProperty("streamer.Element.debug", "true");
Element source = new FakeSource("source") {
{
incommingBufLength = 0;
delay = 1000;
numBuffers = 3;
}
};
Element sink = new AwtBellAdapter("sink");
Pipeline pipeline = new PipelineImpl("test");
pipeline.addAndLink(source, sink);
pipeline.runMainLoop("source", STDOUT, false, false);
}
use of streamer.debug.FakeSource in project cloudstack by apache.
the class Queue method main.
/**
* Example.
*/
public static void main(String[] args) {
// System.setProperty("streamer.Link.debug", "true");
System.setProperty("streamer.Element.debug", "true");
Element source1 = new FakeSource("source1") {
{
delay = 100;
numBuffers = 10;
incommingBufLength = 10;
}
};
Element source2 = new FakeSource("source2") {
{
delay = 100;
numBuffers = 10;
incommingBufLength = 10;
}
};
Pipeline pipeline = new PipelineImpl("test");
pipeline.add(source1);
pipeline.add(source2);
pipeline.add(new Queue("queue"));
pipeline.add(new FakeSink("sink"));
// Main flow
pipeline.link("source1", "in1< queue");
pipeline.link("source2", "in2< queue");
pipeline.link("queue", "sink");
new Thread(pipeline.getLink("source1", STDOUT)).start();
new Thread(pipeline.getLink("source2", STDOUT)).start();
pipeline.getLink("sink", STDIN).run();
}
Aggregations