public void buildTest1()
        {
            ComponentId      componetId = new ComponentId("Test1", 1, 0, 0, ".Net FrameWork 3.5");
            ComponentContext expected   = new DefaultComponentContext(componetId);

            String             name          = "IComponent_1";
            String             interfaceName = "IDL:scs/core/IComponent:1.0";
            MarshalByRefObject servant       = new IComponentServant(expected);

            expected.AddFacet(name, interfaceName, servant);
            name          = "IComponent_2";
            interfaceName = "IDL:scs/core/IComponent:1.0";
            servant       = new IComponentServant(expected);
            expected.AddFacet(name, interfaceName, servant);
            name          = "IMetaInterface_3";
            interfaceName = "IDL:scs/core/IMetaInterface:1.0";
            servant       = new IMetaInterfaceServant(expected);
            expected.AddFacet(name, interfaceName, servant);

            String              componentModel       = Resources.Component1;
            TextReader          file                 = new StringReader(componentModel);
            XmlTextReader       componentInformation = new XmlTextReader(file);
            XmlComponentBuilder target               = new XmlComponentBuilder(componentInformation);
            ComponentContext    actual               = target.build();

            Assert.IsTrue(expected.Equals(actual));
        }
Пример #2
0
        static void Main()
        {
            log4net.Config.XmlConfigurator.Configure();

            OrbServices.CreateAndRegisterIiopChannel(0);

            String              componentModel       = Resources.ComponentDesc;
            TextReader          file                 = new StringReader(componentModel);
            XmlTextReader       componentInformation = new XmlTextReader(file);
            XmlComponentBuilder builder              = new XmlComponentBuilder(componentInformation);
            ComponentContext    pingContext          = builder.build();

            //Escrevendo a IOR do IComponent no arquivo.
            IComponent  pingComponent = pingContext.GetIComponent();
            OrbServices orb           = OrbServices.GetSingleton();
            String      ior           = orb.object_to_string(pingComponent);

            String       iorPath = Resources.IorFilename;
            StreamWriter stream  = new StreamWriter(iorPath);

            try {
                stream.Write(ior);
            }
            finally {
                stream.Close();
            }

            Console.WriteLine("Componente ping está no ar.");
            Console.ReadLine();
        }
        public void buildTest_UpdateIComponent_WrongInterface()
        {
            String              componentModel       = Resources.Component12;
            TextReader          file                 = new StringReader(componentModel);
            XmlTextReader       componentInformation = new XmlTextReader(file);
            XmlComponentBuilder target               = new XmlComponentBuilder(componentInformation);

            ComponentContext actual = target.build();
        }
        public void buildTest_ContextNoAssembly()
        {
            String              componentModel       = Resources.Component9;
            TextReader          file                 = new StringReader(componentModel);
            XmlTextReader       componentInformation = new XmlTextReader(file);
            XmlComponentBuilder target               = new XmlComponentBuilder(componentInformation);

            ComponentContext actual = target.build();
        }
        public void buildTest_FacetInvalidClassName()
        {
            String              componentModel       = Resources.Component3;
            TextReader          file                 = new StringReader(componentModel);
            XmlTextReader       componentInformation = new XmlTextReader(file);
            XmlComponentBuilder target               = new XmlComponentBuilder(componentInformation);

            ComponentContext actual = target.build();
        }
        public void buildTest5()
        {
            ComponentId      componetId = new ComponentId("Test1", 1, 0, 0, ".Net FrameWork 3.5");
            ComponentContext expected   = new DefaultComponentContext(componetId);

            String              componentModel       = Resources.Component8;
            TextReader          file                 = new StringReader(componentModel);
            XmlTextReader       componentInformation = new XmlTextReader(file);
            XmlComponentBuilder builder              = new XmlComponentBuilder(componentInformation);
            ComponentContext    target               = builder.build();
        }
        public void buildTest3()
        {
            ComponentId      componetId = new ComponentId("Test1", 1, 0, 0, ".Net FrameWork 3.5");
            ComponentContext expected   = new DefaultComponentContext(componetId);

            String              componentModel       = Resources.Component6;
            TextReader          file                 = new StringReader(componentModel);
            XmlTextReader       componentInformation = new XmlTextReader(file);
            XmlComponentBuilder builder              = new XmlComponentBuilder(componentInformation);
            ComponentContext    actual               = builder.build();

            Assert.IsTrue(expected.Equals(actual));
        }
        public void buildTest_UpdateIComponent()
        {
            String              componentModel       = Resources.Component11;
            TextReader          file                 = new StringReader(componentModel);
            XmlTextReader       componentInformation = new XmlTextReader(file);
            XmlComponentBuilder target               = new XmlComponentBuilder(componentInformation);

            ComponentContext   actual         = target.build();
            String             facetInterface = Repository.GetRepositoryID(typeof(IMetaInterface));
            MarshalByRefObject facet          = actual.GetIComponent().getFacet(facetInterface);

            Assert.IsNull(facet);
        }
        public void buildTest4()
        {
            ComponentId      componetId = new ComponentId("Test1", 1, 0, 0, ".Net FrameWork 3.5");
            ComponentContext expected   = new DefaultComponentContext(componetId);

            String              componentModel       = Resources.Component7;
            TextReader          file                 = new StringReader(componentModel);
            XmlTextReader       componentInformation = new XmlTextReader(file);
            XmlComponentBuilder builder              = new XmlComponentBuilder(componentInformation);
            ComponentContext    target               = builder.build();

            Assert.IsInstanceOfType(target, typeof(MockComponentContext));
        }
        public void buildTest2()
        {
            ComponentId      componetId = new ComponentId("Test1", 1, 0, 0, ".Net FrameWork 3.5");
            ComponentContext expected   = new DefaultComponentContext(componetId);

            String name          = "Receptacle1";
            String interfaceName = "IDL:scs/core/IMetaInterface:1.0";

            expected.AddReceptacle(name, interfaceName, false);
            name          = "Receptacle2";
            interfaceName = "IDL:scs/core/IMetaInterface:1.0";
            expected.AddReceptacle(name, interfaceName, true);
            name          = "Receptacle3";
            interfaceName = "IDL:scs/core/IComponent:1.0";
            expected.AddReceptacle(name, interfaceName, false);

            String              componentModel       = Resources.Component5;
            TextReader          file                 = new StringReader(componentModel);
            XmlTextReader       componentInformation = new XmlTextReader(file);
            XmlComponentBuilder target               = new XmlComponentBuilder(componentInformation);
            ComponentContext    actual               = target.build();

            Assert.IsTrue(expected.Equals(actual));
        }
 public void buildTestNull1()
 {
     XmlComponentBuilder builder = new XmlComponentBuilder(null);
 }