def test49():
    """
    test49: wrap a config class with a sequence of tasks in ConfigClassTask
    wrapper and ensure they all get performed in order, and then set up
    initial and final tasks in the outer config and make sure everything is
    happening in the right order
    """
    class Infra(InfraModel):
        setup_server = StaticServer("setup_helper", "127.0.0.1")
    infra = Infra("helper")
    
    class NS(NamespaceModel):
        task_performer = Role("tp", host_ref=Infra.setup_server)
        default = Role("default", host_ref="127.0.1.1")
    ns = NS()
    ns.set_infra_model(infra)
    
    cap = Capture()
    class InnerCfg(ConfigModel):
        t1 = ReportingTask("inner_task1", report=cap)
        t2 = ReportingTask("inner_task2", report=cap)
        t3 = ReportingTask("inner_task3", report=cap)
        
        with_dependencies(t1 | t2 | t3)
        
    class OuterCfg(ConfigModel):
        wrapped_task = ConfigClassTask("wrapper", InnerCfg, task_role=NS.task_performer)
        initial = ReportingTask("initial", target=NS.default, report=cap)
        final = ReportingTask("final", target=NS.default, report=cap)
        
        with_dependencies(initial | wrapped_task | final)
        
    cfg = OuterCfg()
    cfg.set_namespace(ns)
    
    ea = ExecutionAgent(config_model_instance=cfg, namespace_model_instance=ns,
                        infra_model_instance=infra, no_delay=True)
    try:
        ea.perform_config()
    except ExecutionException, e:
        import traceback
        for task, etype, value, tb in ea.get_aborted_tasks():
            print ">>>Task {} failed with the following:".format(task.name)
            traceback.print_exception(etype, value, tb)
            print
        assert False, e.message

    assert (len(cap.performed) == 5 and
            cap.pos("tp", "inner_task1") < cap.pos("tp", "inner_task2") and
            cap.pos("tp", "inner_task2") < cap.pos("tp", "inner_task3") and
            cap.pos("tp", "inner_task3") < cap.pos("default", "final") and
            cap.pos("default", "initial") < cap.pos("tp", "inner_task1"))
dataset/ETHPy150Open haxsaw/actuator/src/tests/config_tests.py/test49/original