public override void SharedExecute() { var fakeContext = this.Pull <FakeDBContext>(); var fakeMgr = this.Pull <FakeServicesMgr>(); // Setting fake IHelper var mock = new Mock <IHelper>(); // Stubs here mock.Setup(helper => helper.GetDBContext(It.IsAny <Int32>())).Returns(fakeContext.DBContext); mock.Setup(helper => helper.GetServicesManager()).Returns(fakeMgr.ServicesMgr); this.Helper = mock.Object; // Setting fake IAgentHelper var agentMock = new Mock <IAgentHelper>(); // Stubs here agentMock.Setup(ahelper => ahelper.GetDBContext(It.IsAny <Int32>())).Returns(fakeContext.DBContext); agentMock.Setup(helper => helper.GetServicesManager()).Returns(fakeMgr.ServicesMgr); AgentHelper = agentMock.Object; // Setting fake IEHHelper var ehMock = new Mock <IEHHelper>(); // Stubs here ehMock.Setup(ahelper => ahelper.GetDBContext(It.IsAny <Int32>())).Returns(fakeContext.DBContext); ehMock.Setup(helper => helper.GetServicesManager()).Returns(fakeMgr.ServicesMgr); EHHelper = ehMock.Object; }
public static string GetWebApiUrl(IAgentHelper helper, AgentBase aB) { string baseUrl = GetInstanceUrl(helper, aB); baseUrl = baseUrl.ToLower(); baseUrl = baseUrl.Replace(".rest/api/", "webapi/"); return(baseUrl); }
public DtSearchIndexWorker(IAgentHelper agentHelper, int poolId) { _agentHelper = agentHelper; _eddsDbContext = _agentHelper.GetDBContext(-1); Guid = "78880FC6-0A4A-43E5-87EF-9BEB5E55717D"; RespectsResourcePool = true; AgentAgentResourcePool = poolId; }
public RelativityTestAgentJob(IArtifactQueries artifactQueries, IAPILog logger, IServicesMgr svcManager, ExecutionIdentity userIdentity, int workspaceId, IAgentHelper agentHelper) { ArtifactQueries = artifactQueries; Logger = logger; WorkspaceArtifactId = workspaceId; SvcManager = svcManager; CurrentUserIdentity = userIdentity; AgentHelper = agentHelper; }
public GetAgentsDesiredList(IAgentHelper agentHelper, IEnvironmentHelper environment, int poolId, bool isOffHours) { AgentsPerServerObjectList = new List <AgentsDesired>(); _agentHelper = agentHelper; _eddsDbContext = _agentHelper.GetDBContext(-1); _poolId = poolId; _environment = environment; _isOffHours = isOffHours; Run(); }
public ReproduceWorkerJob(int agentId, IAgentHelper agentHelper, IQuery queryHelper, IArtifactQueries artifactQueries, IEnumerable <int> resourceGroupIds, IErrorQueries errorQueries) { AgentId = agentId; AgentHelper = agentHelper; QueryHelper = queryHelper; _artifactQueries = artifactQueries; AgentResourceGroupIds = resourceGroupIds; ErrorQueries = errorQueries; QueueTable = Constant.Tables.ReproduceWorkerQueue; _auditRecordHelper = new AuditRecordHelper(QueryHelper); }
public ReproduceManagerJob(int agentId, IAgentHelper agentHelper, IQuery queryHelper, DateTime processedOnDateTime, IEnumerable <int> resourceGroupIds, IArtifactQueries artifactQueries, Helpers.Utility.IQuery utilityQueryHelper, IErrorQueries errorQueries) { RecordId = 0; WorkspaceArtifactId = -1; AgentId = agentId; AgentHelper = agentHelper; QueryHelper = queryHelper; ProcessedOnDateTime = processedOnDateTime; QueueTable = Constant.Tables.ReproduceManagerQueue; AgentResourceGroupIds = resourceGroupIds; _artifactQueries = artifactQueries; _utilityQueryHelper = utilityQueryHelper; ErrorQueries = errorQueries; }
public ExportWorkerJob(int agentId, IServicesMgr serviceMgr, IAgentHelper agentHelper, IQuery queryHelper, IArtifactQueries artifactQueries, Helpers.Utility.IQuery utilityQueryHelper, DateTime processedOnDateTime, IEnumerable <int> resourceGroupIds, IExportFileCreator exportFileCreator, IErrorQueries errorQueries) { AgentId = agentId; _serviceMgr = serviceMgr; AgentHelper = agentHelper; QueryHelper = queryHelper; _artifactQueries = artifactQueries; _utilityQueryHelper = utilityQueryHelper; ProcessedOnDateTime = processedOnDateTime; AgentResourceGroupIds = resourceGroupIds; _exportFileCreator = exportFileCreator; ErrorQueries = errorQueries; RecordId = 0; WorkspaceArtifactId = -1; QueueTable = Constant.Tables.ExportWorkerQueue; }
public ImportWorkerJob(Int32 agentId, IAgentHelper agentHelper, ISqlQueryHelper sqlQueryHelper, IArtifactQueries artifactQueryHelper, DateTime processedOnDateTime, IRsapiRepositoryGroup rsapiRepositoryGroup, IEnumerable <Int32> resourceGroupIds, IAPILog logger, APIOptions apiOptions, ISerializationHelper serializationHelper) { TableRowId = 0; WorkspaceArtifactId = -1; AgentId = agentId; AgentHelper = agentHelper; SqlQueryHelper = sqlQueryHelper; QueueTable = Constant.Tables.ImportWorkerQueue; ProcessedOnDateTime = processedOnDateTime; AgentResourceGroupIds = resourceGroupIds; Logger = logger; _repositoryGroup = rsapiRepositoryGroup; _artifactQueryHelper = artifactQueryHelper; _apiOptions = apiOptions; _serializationHelper = serializationHelper; }
public ExportManagerJob(int agentId, IServicesMgr serviceMgr, IAgentHelper agentHelper, IQuery queryHelper, DateTime processedOnDateTime, IEnumerable <int> resourceGroupIds, IArtifactQueries artifactQueries, Helpers.Utility.IQuery utilityQueryHelper, IErrorQueries errorQueries, IMarkupTypeHelper markupTypeHelper) { RecordId = 0; WorkspaceArtifactId = -1; AgentId = agentId; AgentHelper = agentHelper; QueryHelper = queryHelper; ProcessedOnDateTime = processedOnDateTime; QueueTable = Constant.Tables.ExportManagerQueue; AgentResourceGroupIds = resourceGroupIds; _serviceMgr = serviceMgr; _artifactQueries = artifactQueries; _utilityQueryHelper = utilityQueryHelper; _markupTypeHelper = markupTypeHelper; ErrorQueries = errorQueries; }
public ImportManagerJob(int agentId, IAgentHelper agentHelper, IQuery queryHelper, DateTime processedOnDateTime, IEnumerable <int> resourceGroupIds, IArtifactQueries artifactQueries, IImportFileParser importFileParser, IWorkspaceQueries workspaceQueryHelper, IErrorQueries errorQueries, IMarkupTypeHelper markupTypeHelper) { RecordId = 0; WorkspaceArtifactId = -1; AgentId = agentId; AgentHelper = agentHelper; QueryHelper = queryHelper; ProcessedOnDateTime = processedOnDateTime; QueueTable = Constant.Tables.ImportManagerQueue; AgentResourceGroupIds = resourceGroupIds; ArtifactQueries = artifactQueries; ImportFileParser = importFileParser; WorkspaceQueryHelper = workspaceQueryHelper; ErrorQueries = errorQueries; MarkupTypeHelper = markupTypeHelper; }
public static string GetInstanceUrl(IAgentHelper helper, AgentBase aB) { string instanceUrl = ""; try { aB.RaiseMessage("Attempting to get URL...", 1); instanceUrl = helper.GetInstanceSettingBundle().GetString("Relativity.Core", "KeplerServicesUri"); aB.RaiseMessage("Acquired URL: " + instanceUrl, 1); } catch (Exception e) { aB.RaiseMessage(e.ToString(), 1); } return(instanceUrl); }
public ImportWorkerJob(int agentId, IAgentHelper agentHelper, IQuery queryHelper, DateTime processedOnDateTime, IEnumerable <int> resourceGroupIds, IErrorQueries errorQueries, IArtifactQueries artifactQueries, IAuditRecordHelper auditRecordHelper, IMarkupTypeHelper markupTypeHelper) { RecordId = 0; WorkspaceArtifactId = -1; AgentId = agentId; AgentHelper = agentHelper; QueryHelper = queryHelper; QueueTable = Constant.Tables.ImportWorkerQueue; ProcessedOnDateTime = processedOnDateTime; AgentResourceGroupIds = resourceGroupIds; ErrorQueries = errorQueries; ArtifactQueries = artifactQueries; _importedRedactionCount = 0; _skippedRedactionCount = 0; _errorRedactionCount = 0; AuditRecordHelper = auditRecordHelper; MarkupTypeHelper = markupTypeHelper; _executionIdentity = ExecutionIdentity.CurrentUser; }
public bool ImportDocument(IAgentHelper helper, int workspaceID, List <WikitivityUploadsAgent.DataObtainedSingleRequestObject> batchedArticleList, AgentBase aB) { var success = false; Int32 workspaceArtifactID = workspaceID; Int32 identifyFieldArtifactID = 1003667; // 'Control Number' Field String relativityWebAPIUrl = GetWebApiUrl(helper, aB); aB.RaiseMessage("Obtained RelativityWebAPI: " + relativityWebAPIUrl, 1); String relativityFolderName = "Name of the Destination Folder"; var url = relativityWebAPIUrl; ImportAPI iapi = ImportAPI.CreateByRsaBearerToken(url); try { var importJob = iapi.NewNativeDocumentImportJob(); importJob.OnMessage += ImportJobOnMessage; importJob.OnComplete += ImportJobOnComplete; importJob.OnFatalException += ImportJobOnFatalException; importJob.Settings.CaseArtifactId = workspaceArtifactID; importJob.Settings.ExtractedTextFieldContainsFilePath = false; // Utilize these fields to set up native import // importJob.Settings.DisableNativeLocationValidation = true; Use these two lines for disabling native import & validation. // importJob.Settings.DisableNativeValidation = true; // importJob.Settings.NativeFilePathSourceFieldName = "Original Folder Path"; importJob.Settings.NativeFileCopyMode = NativeFileCopyModeEnum.DoNotImportNativeFiles; // NativeFileCopyModeEnum.CopyFiles; NativeFileCopyModeEnum.DoNotImportNativeFiles importJob.Settings.OverwriteMode = OverwriteModeEnum.Append; importJob.Settings.IdentityFieldId = identifyFieldArtifactID; importJob.SourceData.SourceData = GetDocumentDataTable(batchedArticleList, aB).CreateDataReader(); importJob.Execute(); success = true; } catch (Exception ex) { aB.RaiseMessage(ex.ToString(), 1); } return(success); }
public WeatherAgent(IRestClient restClient, IAgentHelper agentHelper) { _restClient = restClient; _agentHelper = agentHelper; }
public DeleteAgentApi(IDBContext eddsDbContext, IAgentHelper helper) { _eddsDbContext = eddsDbContext; _helper = helper; }
public override void Execute() { IAPILog logger = Helper.GetLoggerFactory().GetLogger(); try { /* Adding message so time of last check-in updates */ RaiseMessage("Managing the agents.", 10); /* Resource Pool ArtifactID is hard coded for now (Default pool) * Will eventually make this accessible in the UI */ int poolId = 1015040; /* Agent Server Adjustment factor. * Will eventually make this accessible in the UI */ int adjFactor = 10; /* This switch tells Agent Agent to not create any agents on a server containing the dtSearch search agent. * Will eventually make this accessible in the UI*/ bool ignoreSearchServer = true; /*Use API to create/delete agents instead of manually creating in SQL*/ bool useApiCreate = true; bool useApiDelete = true; /* Making stuff */ logger.LogVerbose("Creating new {objectName}", "Agent Helper"); IAgentHelper agentHelper = Helper; logger.LogVerbose("Creating new {objectName}", "EDDS DB Context"); IDBContext eddsDbContext = agentHelper.GetDBContext(-1); logger.LogVerbose("Creating new {objectName}", "Environment Helper"); EnvironmentHelper environment = new EnvironmentHelper(eddsDbContext); logger.LogVerbose("Creating new {objectName}", "Desired Agents List"); List <AgentsDesired> desiredAgentsList = new GetAgentsDesiredList(agentHelper, environment, poolId, IsOffHours()).AgentsPerServerObjectList; logger.LogVerbose("Creating new {objectName}", "Compared List"); List <AgentsDesired> comparedList = new CompareDesiredAgentsToExisting(desiredAgentsList, poolId, environment, logger).Compare(); logger.LogVerbose("Creating new {objectName}", "List Helper"); AgentsDesiredListHelper listHelper = new AgentsDesiredListHelper(comparedList); logger.LogVerbose("Creating new {objectName}", "Create List"); List <AgentsDesired> createList = listHelper.GetAgentCreateList(); logger.LogVerbose("Creating new {objectName}", "Delete List"); List <AgentsDesired> deleteList = listHelper.GetAgentDeleteList(); logger.LogVerbose("Creating new {objectName}", "Spots Per Server List"); List <SpotsPerServer> spotsPerServerList = new GetSpotsPerServerList(eddsDbContext, environment, adjFactor, poolId, ignoreSearchServer).SpotsPerServerList; logger.LogVerbose("Creating {objectName}", "Agent Create"); ICreateAgent createAgent = new CreateAgentSql(eddsDbContext, environment); if (useApiCreate) { createAgent = new CreateAgentApi(eddsDbContext, environment, agentHelper); } logger.LogVerbose("Creating {objectName}", "Agent Delete"); IDeleteAgent deleteAgent = new DeleteAgent(eddsDbContext); if (useApiDelete) { deleteAgent = new DeleteAgentApi(eddsDbContext, agentHelper); } /* Log createList, deleteList, and spotsPerServerList contents */ string createListString = ""; string deleteListString = ""; string spotsPerServerListString = ""; foreach (AgentsDesired cL in createList) { createListString += string.Format("{0} - {1} - {2}\r\n", cL.Guid, cL.Count, cL.RespectsResourcePool); } foreach (AgentsDesired dL in deleteList) { deleteListString += string.Format("{0} - {1} - {2}\r\n", dL.Guid, dL.Count, dL.RespectsResourcePool); } foreach (SpotsPerServer sP in spotsPerServerList) { spotsPerServerListString += string.Format("{0} - {1}\r\n", sP.AgentServerArtifactId, sP.Spots); } logger.LogDebug("Delete List : {deleteList}", deleteListString); logger.LogDebug("Create List: {createList}", createListString); logger.LogDebug("Spots Per Server List = {spotsPerServerList}", spotsPerServerListString); /* Create */ RunAgentCreate agentCreate = new RunAgentCreate(eddsDbContext, environment, createAgent, createList, spotsPerServerList, logger); logger.LogVerbose("Running {objectName}", "Agent Create"); agentCreate.Run(); logger.LogVerbose("Completed {objectName}", "Agent Create"); /* Delete */ RunAgentDelete agentDelete = new RunAgentDelete(eddsDbContext, environment, deleteAgent, poolId, deleteList, logger); logger.LogVerbose("Running {objectName}", "Agent Delete"); agentDelete.Run(); logger.LogVerbose("Completed {objectName}", "Agent Delete"); } catch (Exception ex) { RaiseError(ex.Message, ex.StackTrace); logger.LogError("Exception during agent Execute(): {ex}", ex); RaiseMessage("There has been an error. See log for more details", 1); } }
public CreateAgentApi(IDBContext eddsDbContext, IEnvironmentHelper environment, IAgentHelper helper) { _helper = helper; _eddsDbContext = eddsDbContext; _environment = environment; }