def test_multicast_dsl(self): builder = DslPipelineBuilder() builder.source(Source1).to(To1).multicast({})\ .pipeline().to(To1).to(To1).end_pipeline()\ .pipeline().to(To1).to(To1).end_pipeline()\ .end_multicast().to(To1) self.assertIsNotNone(builder._builder_stack[-1])
def test_wiretap(self): plumber = Plumber() builder = DslPipelineBuilder() pipeline = builder.source(Timer, {"period": 1.0}).wiretap((Log, {"name": "wiretap"})).to(Log, {"name": "actual"}) plumber.add_pipeline(pipeline) plumber.start() time.sleep(1) plumber.stop()
def test_simple_pipeline(self): builder = DslPipelineBuilder() pipeline = builder.source(Timer, { "period": 1.0 }).to(MessageModifier).process(process).build() pipeline.start() time.sleep(10) pipeline.stop()
def test_simple_pipeline(self): plumber = Plumber() builder1 = DslPipelineBuilder() pipeline1 = builder1.source(Timer, {"period": 1.0}).filter(Filter()).process(self.function1) plumber.add_pipeline(pipeline1) plumber.start() time.sleep(10) plumber.stop()
def test_process_block(self): builder = DslPipelineBuilder() def function1(x): print(x) builder.source(Source1).to(To1).to(To2).process(function1) self.assertEqual(builder.source_class, Source1) self.assertTrue(inspect.isclass(builder.to_list[2][0]))
def test_log(self): plumber = Plumber() builder = DslPipelineBuilder() pipeline = builder.source(Timer, { "period": 1.0 }).to(Log, {"name": "test"}) plumber.add_pipeline(pipeline) plumber.start() time.sleep(1) plumber.stop()
def test_simple_pipeline(self): plumber = Plumber() builder1 = DslPipelineBuilder() pipeline1 = builder1.source(Timer, { "period": 1.0 }).dynamic_router({ "method": slip }).process(self.function1) plumber.add_pipeline(pipeline1) plumber.start() time.sleep(1) plumber.stop()
def test_simple_pipeline(self): plumber = Plumber() builder1 = DslPipelineBuilder() pipeline1 = builder1.source(Timer, {"period": 1.0}).multicast({"aggregate_method": aggregate}) \ .pipeline().process(self.function1).process(to_upper).process(self.function11).end_pipeline() \ .pipeline().process(self.function111).end_pipeline() \ .end_multicast().process(self.function1V) plumber.add_pipeline(pipeline1) plumber.start() time.sleep(10) plumber.stop()
def test_simple_pipeline(self): plumber = Plumber() builder1 = DslPipelineBuilder() pipeline1 = builder1.source(Timer, {"period": 1.0}).content_based_router() \ .when(lambda ex: int(ex.in_msg.body.split()[-1]) % 3 == 0).pipeline().process(self.function1).end_pipeline() \ .when(lambda ex: int(ex.in_msg.body.split()[-1]) % 3 == 1).pipeline().process(self.function11).end_pipeline() \ .otherwise().pipeline().process(self.function111).end_pipeline() \ .end_content_based_router().process(self.function1V) plumber.add_pipeline(pipeline1) plumber.start() time.sleep(10) plumber.stop()
def test_simple_pipeline(self): plumber = Plumber() builder1 = DslPipelineBuilder() pipeline1 = builder1.source(Timer, { "period": 1.0 }).aggregate({ "method": aggregate, "count": 5, "timeout": 2 }).process(self.function1) plumber.add_pipeline(pipeline1) plumber.start() time.sleep(12) plumber.stop()
def test_simple_pipeline(self): plumber = Plumber() builder1 = DslPipelineBuilder() pipeline1 = builder1.source(Timer, { "period": 1.0 }).process(insert_seq_number).resequencer({ "key_extractor": get_key, "count": 5, "reverse": True }).process(self.function1) plumber.add_pipeline(pipeline1) plumber.start() time.sleep(12) plumber.stop()
def test_simple_pipeline(self): plumber = Plumber() builder1 = DslPipelineBuilder() builder2 = DslPipelineBuilder() pipeline1 = builder1.source(Timer, { "period": 1.0 }).to(MessageModifier).process(self.function1) pipeline2 = builder2.source(Timer, { "period": 2.0 }).to(MessageModifier).process(self.function11) plumber.add_pipeline(pipeline1) plumber.add_pipeline(pipeline2) plumber.start() time.sleep(10) plumber.stop()
def test_simple_pipeline(self): builder = DslPipelineBuilder() builder.source(Source1).to(To1).to(To2) self.assertEqual(builder.source_class, Source1)
def test_build_pipeline(self): builder = DslPipelineBuilder() pipeline = builder.source(Source1).to(To1).to(To2).build() self.assertIsNotNone(pipeline.source.chain)
def test_only_one_source(self): builder = DslPipelineBuilder() with self.assertRaises(AssertionError): builder.source(To1).source(To1)
def __init__(self): self.builder = DslPipelineBuilder() self.pipeline = None self.to_ = None self.from_ = None