/// <summary>
        /// Constructor that initializes common resources used by tests.
        /// </summary>
        public StandaloneJobOrchestratorTests()
        {
            _agentConfigModel        = new AgentConfigModel();
            _agentConfigProviderMock = new Mock <IAgentConfigProvider>();
            _agentConfigProviderMock.Setup(p => p.Config).Returns(_agentConfigModel);

            _newtonSoftJsonSerializer    = new NewtonSoftJsonSerializer();
            _newtonSoftJsonSerializerRaw = new NewtonSoftJsonSerializerRaw();
            _publisherJobSerializer      = new PublisherJobSerializer(_newtonSoftJsonSerializer);
            _logger = TraceLogger.Create();

            var engineConfigMock  = new Mock <IEngineConfiguration>();
            var clientConfignMock = new Mock <IClientServicesConfig>();

            _publishedNodesJobConverter = new PublishedNodesJobConverter(_logger, _newtonSoftJsonSerializer,
                                                                         engineConfigMock.Object, clientConfignMock.Object);

            // Note that each test is responsible for setting content of _tempFile;
            Utils.CopyContent("Engine/empty_pn.json", _tempFile);
            _standaloneCliModel = new StandaloneCliModel {
                PublishedNodesFile       = _tempFile,
                PublishedNodesSchemaFile = "Storage/publishednodesschema.json"
            };

            _standaloneCliModelProviderMock = new Mock <IStandaloneCliModelProvider>();
            _standaloneCliModelProviderMock.Setup(p => p.StandaloneCliModel).Returns(_standaloneCliModel);

            _publishedNodesProvider = new PublishedNodesProvider(_standaloneCliModelProviderMock.Object, _logger);
        }
 /// <summary>
 /// Create config
 /// </summary>
 /// <param name="model"></param>
 public PublisherConfigApiModel(AgentConfigModel model)
 {
     AgentId            = model?.AgentId;
     Capabilities       = model?.Capabilities?.ToDictionary(k => k.Key, v => v.Value);
     HeartbeatInterval  = model?.HeartbeatInterval;
     JobCheckInterval   = model?.JobCheckInterval;
     JobOrchestratorUrl = model?.JobOrchestratorUrl;
     ParallelJobs       = model?.MaxWorkers;
 }
示例#3
0
 public TestAgentConfigProvider()
 {
     Config = new AgentConfigModel();
 }
 /// <summary>
 /// Create provider
 /// </summary>
 /// <param name="config"></param>
 public AgentConfigProvider(AgentConfigModel config)
 {
     Config = config;
 }