public void LoadSingleCbrRestaurantMenu()
        {
            #region Create message flow
            var terminator = MessageFlowBuilder.CreateTerminator("termination");
            var sendToA = MessageFlowBuilder.CreateSender("sendToA",
                inputMessage: "input", outputEndpoint: "OutA", nextNode: terminator);
            var cbr = MessageFlowBuilder.CreateCbr(name: "restaurant", testedMessage: "input",
                defaultTarget: terminator, cases: new[] {
                    new CbrCase("RestaurantMenu_schematron", sendToA),
                });
            var messageFlow = new MessageFlowConfiguration("sendToA", 1)
            {
                Nodes = { sendToA, terminator, cbr }
            };
            messageFlow.GetEntryNode().NextNode = sendToA;
            #endregion

            var xrm = configManager.LoadXrmItems(
                new[] { "RestaurantMenu_schematron" }, "Test1");

            var adapters = new AdapterConfiguration[] {
                new AdapterConfiguration("directoryAdapter", "gateway", "directoryAdapter",
                    XDocument.Parse(
            @"<objectConfig>
              <item name='checkingIntervalInSeconds'>0.1</item>
              <item name='inputEndpointToPathMap'>
            <pair>
              <key>In</key>
              <value>C:\XRouterTest\In</value>
            </pair>
              </item>
              <item name='outputEndpointToPathMap'>
            <pair>
              <key>OutB</key>
              <value>C:\XRouterTest\OutB</value>
            </pair>
            <pair>
              <key>OutA</key>
              <value>C:\XRouterTest\OutA</value>
            </pair>
            <pair>
              <key>OutC</key>
              <value>C:\XRouterTest\OutC</value>
            </pair>
              </item>
            </objectConfig>"))
            };

            configManager.ReplaceConfiguration(messageFlow, xrm, adapters);
        }
Beispiel #2
0
        public MessageFlow(MessageFlowConfiguration configuration, ProcessorService processor)
        {
            Configuration = configuration;
            Processor = processor;

            #region Create nodes
            nodesByName = new Dictionary<string, Node>();
            foreach (NodeConfiguration nodeCfg in configuration.Nodes)
            {
                Node node;
                if (nodeCfg is CbrNodeConfiguration)
                {
                    node = new CbrNode();
                }
                else if (nodeCfg is ActionNodeConfiguration)
                {
                    node = new ActionNode();
                }
                else if (nodeCfg is TerminatorNodeConfiguration)
                {
                    node = new TerminatorNode();
                }
                else if (nodeCfg is EntryNodeConfiguration)
                {
                    node = new EntryNode();
                }
                else
                {
                    throw new InvalidOperationException(string.Format(
                        "Cannot create a node named '{0}' of unknown node type.", nodeCfg.Name));
                }

                node.Initialize(nodeCfg, Processor);
                nodesByName.Add(node.Name, node);
            }
            #endregion

            entryNode = (EntryNode)nodesByName[configuration.GetEntryNode().Name];
        }
Beispiel #3
0
        //[Fact]
        public void LoadSingleCbr()
        {
            #region Create message flow
            var terminator = MessageFlowBuilder.CreateTerminator("termination");
            var sendToA = MessageFlowBuilder.CreateSender("sendToA",
                inputMessage: "input", outputEndpoint: "OutA", nextNode: terminator);
            var cbr = MessageFlowBuilder.CreateCbr(name: "restaurant", testedMessage: "input",
                defaultTarget: terminator, cases: new[] {
                    new CbrCase("RestaurantMenu_schematron", sendToA),
                });
            var messageFlow = new MessageFlowConfiguration("sendToA", 1)
            {
                Nodes = { sendToA, terminator, cbr }
            };
            messageFlow.GetEntryNode().NextNode = sendToA;
            #endregion

            var xrm = configManager.LoadXrmItems(
                new[] { "RestaurantMenu_schematron" }, "Test1");

            configManager.ReplaceConfiguration(messageFlow, xrm);
        }