Exemple #1
0
        private static void CreateProductionProviders()
        {
            // dummy providers have been created here - but these must be properly developed for each system.
            // classes which talk to the task server and the staging server will be defined once and shared across all solutions as a class library.
            // these providers are only stubbed dummies

            Log.Debug("creating task server");
            _taskServer = new DummyTaskServer(ConfigOptions.RobotId);
            Log.Debug("creating staging server");
            _stagingServer = new DummyStagingServer(ConfigOptions.RobotId);
            Log.Debug("creating provider for Entity1");
            _entity1Provider = new DummyEntity1Provider();
            Log.Debug("creating provider for Entity2");
            _entity2Provider = new DummyEntity2Provider();
        }
        public Test1Robot(string robotId, ITaskServer taskServer, IStagingServer stagingServer, IEntity1Provider entity1Provider, IEntity2Provider entity2Provider)
        {
            _robotId         = robotId;
            _taskServer      = taskServer;
            _stagingServer   = stagingServer;
            _entity1Provider = entity1Provider;
            _entity2Provider = entity2Provider;

            // sanity check on critical resources...

            if (string.IsNullOrWhiteSpace(_robotId))
            {
                throw new ArgumentNullException("robotId", "Robot created with no Id!");
            }

            if (_taskServer == null)
            {
                throw new ArgumentNullException("taskServer", "Robot created with no task server defined!");
            }

            if (_stagingServer == null)
            {
                throw new ArgumentNullException("stagingServer", "Robot created with no staging server defined!");
            }

            // for any data types that this robot needs to handle, ensure there is a valid provider ...
            if (_entity1Provider == null)
            {
                throw new ArgumentNullException("entity1Provider", "Robot created with no provider for Entity1 data");
            }

            if (_entity2Provider == null)
            {
                throw new ArgumentNullException("entity2Provider", "Robot created with no provider for Entity2 data");
            }
        }