/// <summary>
 /// Creates/Registers the connector at the OpenEngSB and registers the connector to XLink
 /// </summary>
 public void connectToOpenEngSbWithXLink()
 {
     outputLine("Trying to connect to OpenEngSB and XLink...");
     ooSourceConnector = new OOSourceCodeConnector();
     factory           = DomainFactoryProvider.GetDomainFactoryInstance("3.0.0", xlinkServerURL, ooSourceConnector, new ForwardDefaultExceptionHandler());
     connectorUUID     = factory.CreateDomainService(domainId);
     factory.RegisterConnector(connectorUUID, domainId);
     blueprint = factory.ConnectToXLink(connectorUUID, hostIp, programname, initModelViewRelation());
     setCurrentlyInstalledTools(blueprint.registeredTools);
     connected = true;
     outputLine("Connecting done.");
 }
Example #2
0
        /// <summary>
        /// This version works with the OpenEngS 3.0.0-Snapshot Framework
        /// </summary>
        /// <param name="args">System Arguments</param>
        public static void Main(string[] args)
        {
            log4net.Config.BasicConfigurator.Configure();
            ILog    logger;
            Boolean xlink = false;
            ExampleDomainConnector      exampleDomain = new ExampleDomainConnector();
            OOSourceCodeDomainConnector ooconnector   = new OOSourceCodeDomainConnector();

            OpenEngSB300.SetSupport();
            IDomainFactory factory;
            string         domainName;
            string         destination = "tcp://localhost.:6549";

            if (xlink)
            {
                // If you are using xlink for the example, please use an other domain. Example domain is not linkable
                domainName = "oosourcecode";
                logger     = LogManager.GetLogger(typeof(OOSourceCodeDomainConnector));
                factory    = DomainFactoryProvider.GetDomainFactoryInstance("3.0.0", destination, ooconnector, new RetryDefaultExceptionHandler());
            }
            else
            {
                domainName = "example";
                logger     = LogManager.GetLogger(typeof(ExampleDomainConnector));
                factory    = DomainFactoryProvider.GetDomainFactoryInstance("3.0.0", destination, exampleDomain, new ForwardDefaultExceptionHandler());
            }

            logger.Info("Start Example wit the domain " + domainName);

            String connectorId = factory.CreateDomainService(domainName);

            factory.RegisterConnector(connectorId, domainName);
            if (xlink)
            {
                XLinkUrlBlueprint template = factory.ConnectToXLink(connectorId, "localhost", domainName, InitModelViewRelation());
                factory.DisconnectFromXLink(connectorId, "localhost");
            }
            else
            {
                IExampleDomainEventsSoapBinding remotedomain = factory.GetEventhandler <IExampleDomainEventsSoapBinding>(connectorId);
                LogEvent logEvent = new LogEvent();
                logEvent.name    = "Example";
                logEvent.level   = "DEBUG";
                logEvent.message = "remoteTestEventLog";
                remotedomain.raiseEvent(logEvent);
            }

            logger.Info("Press enter to close the Connection");
            Console.ReadKey();
            factory.UnRegisterConnector(connectorId);
            factory.DeleteDomainService(connectorId);
            factory.StopConnection(connectorId);
        }
Example #3
0
        public void TestExampleCodeExecution()
        {
            Boolean xlink = false;
            ExampleDomainConnector      exampleDomain = new ExampleDomainConnector();
            OOSourceCodeDomainConnector ooconnector   = new OOSourceCodeDomainConnector();

            OpenEngSB300.SetSupport();
            IDomainFactory factory;
            string         domainName;
            string         destination = "tcp://localhost.:6549";

            if (xlink)
            {
                // if you are using xlink for the example, please use an other domain. Example domain is not linkable
                domainName = "oosourcecode";
                factory    = DomainFactoryProvider.GetDomainFactoryInstance("3.0.0", destination, ooconnector, new RetryDefaultExceptionHandler());
            }
            else
            {
                domainName = "example";
                factory    = DomainFactoryProvider.GetDomainFactoryInstance("3.0.0", destination, exampleDomain, new ForwardDefaultExceptionHandler());
            }

            String connectorId = factory.CreateDomainService(domainName);

            factory.RegisterConnector(connectorId, domainName);
            if (xlink)
            {
                XLinkUrlBlueprint template = factory.ConnectToXLink(connectorId, "localhost", domainName, InitModelViewRelation());
                factory.DisconnectFromXLink(connectorId, "localhost");
            }
            else
            {
                IExampleDomainEventsSoapBinding remotedomain = factory.GetEventhandler <IExampleDomainEventsSoapBinding>(connectorId);
                LogEvent logEvent = new LogEvent();
                logEvent.name    = "Example";
                logEvent.level   = "DEBUG";
                logEvent.message = "remoteTestEventLog";
                remotedomain.raiseEvent(logEvent);
            }

            factory.UnRegisterConnector(connectorId);
            factory.DeleteDomainService(connectorId);
            factory.StopConnection(connectorId);
        }
        public void TestCreateRegisterConnecttoxlinkDisconnectfromXlinkUnregisterDeleteWithoutCreateMethodConnectorWorksCorrectly()
        {
            uuid = factory.RegisterConnector(null, DomainName);

            Assert.IsTrue(factory.Registered(uuid));
            Assert.IsFalse(factory.Registered("WRONG ID"));
            Assert.IsTrue(factory.GetDomainTypConnectorId(uuid).Equals(DomainName + "+external-connector-proxy+" + uuid));

            XLinkUrlBlueprint template = factory.ConnectToXLink(uuid, "localhost", DomainName, InitModelViewRelation());

            factory.DisconnectFromXLink(uuid, "localhost");
            factory.UnRegisterConnector(uuid);

            Assert.IsFalse(factory.Registered(uuid));

            factory.DeleteDomainService(uuid);

            Assert.IsFalse(factory.Registered(uuid));
        }
 /// <summary>
 /// Creates/Registers the connector at the OpenEngSB and registers the connector to XLink
 /// </summary>
 public void connectToOpenEngSbWithXLink()
 {
     outputLine("Trying to connect to OpenEngSB and XLink...");
     ooSourceConnector = new OOSourceCodeConnector();
     factory = DomainFactoryProvider.GetDomainFactoryInstance("3.0.0", xlinkServerURL, ooSourceConnector, new ForwardDefaultExceptionHandler());
     connectorUUID = factory.CreateDomainService(domainId);
     factory.RegisterConnector(connectorUUID, domainId);
     blueprint = factory.ConnectToXLink(connectorUUID, hostIp, programname, initModelViewRelation());
     setCurrentlyInstalledTools(blueprint.registeredTools);
     connected = true;
     outputLine("Connecting done.");
 }