def test48():
    """
    test48: wrap a config class with a sequence of tasks in ConfigClassTask
    wrapper and ensure they all get performed in order, and the set up a final
    task in the outer config class and ensure that is is performed last
    """
    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)
        final = ReportingTask("final", target=NS.default, report=cap)
        with_dependencies(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) == 4 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"))
dataset/ETHPy150Open haxsaw/actuator/src/tests/config_tests.py/test48/original