コード例 #1
0
        public void connectTest1()
        {
            IReceptaclesServant target       = new IReceptaclesServant(context);
            string             name          = "SimpleReceptacle";
            string             interfaceName = Repository.GetRepositoryID(typeof(IMetaInterface));
            MarshalByRefObject servant       = new IMetaInterfaceServant(context);

            context.AddReceptacle(name, interfaceName, false);

            target.connect(name, servant);
            target.connect(name, servant);
        }
コード例 #2
0
        public void getReceptaclesByNameTest()
        {
            IMetaInterfaceServant target = new IMetaInterfaceServant(context);

            foreach (var name in receptacleNames)
            {
                context.AddReceptacle(name, interfaceName, false);
            }

            string[] names = receptacleNames.ToArray();
            ReceptacleDescription[] actual = target.getReceptaclesByName(names);
            Assert.AreEqual(receptacleNames.Count, actual.Length);
            foreach (var receptacle in actual)
            {
                Receptacle expected = context.GetReceptacleByName(receptacle.name);
                Assert.IsNotNull(expected);
            }
        }
コード例 #3
0
 public void BeforeTest()
 {
     context = new DefaultComponentContext(componentId);
     servant = new IComponentServant(context);
     foreach (var name in receptacleNames)
     {
         context.AddReceptacle(name, interfaceName, true);
     }
 }
コード例 #4
0
        /// <summary>
        /// Adiciona os receptáculos do arquivo de descrição ao componente.
        /// </summary>
        /// <param name="context">O componente.</param>
        private void AddReceptacles(ComponentContext context)
        {
            XmlNodeList receptaclesNodeList =
                xmlComponent.GetElementsByTagName(RECEPTACLE_ELEMENT);

            foreach (XmlNode receptacleNode in receptaclesNodeList)
            {
                String  name          = receptacleNode[RECEPTACLE_NAME].InnerText;
                String  interfaceName = receptacleNode[RECEPTACLE_REP_ID].InnerText;
                Boolean isMultiple    =
                    XmlConvert.ToBoolean(receptacleNode[RECEPTACLE_MULTIPLE].InnerText);

                logger.Debug(String.Format("Adicionando o receptáculo {0}", name));
                context.AddReceptacle(name, interfaceName, isMultiple);
            }
        }