예제 #1
0
        public void Execute_TestFixtureSetup()
        {
            //Setup for testing
            //Setup for testing
            TestHelper helper = new TestHelper();

            servicesManager = helper.GetServicesManager();

            // implement_IHelper
            //create client
            _client        = helper.GetServicesManager().GetProxy <IRSAPIClient>(ConfigurationHelper.ADMIN_USERNAME, ConfigurationHelper.DEFAULT_PASSWORD);
            _eddsDbContext = helper.GetDBContext(-1);

            //Create workspace
            _workspaceId = CreateWorkspace.CreateWorkspaceAsync(_workspaceName, ConfigurationHelper.TEST_WORKSPACE_TEMPLATE_NAME, servicesManager, ConfigurationHelper.ADMIN_USERNAME, ConfigurationHelper.DEFAULT_PASSWORD).Result;
            dbContext    = helper.GetDBContext(_workspaceId);
            _client.APIOptions.WorkspaceID = _workspaceId;

            _rootFolderArtifactId = APIHelpers.GetRootFolderArtifactID(_client, _workspaceName);

            //Import Application containing script, fields, and choices
            Relativity.Test.Helpers.Application.ApplicationHelpers.ImportApplication(_client, _workspaceId, true, FilepathData);

            //Import custodians
            var custodians = GetCustodiansDatatable();

            var identityFieldArtifactId = GetArtifactIDOfCustodianField("Full Name", _workspaceId, _client);

            ImportAPIHelpers.ImportObjects(_workspaceId, "Custodian", identityFieldArtifactId, custodians, String.Empty);

            //Import Documents
            var documents = GetDocumentDataTable(_rootFolderArtifactId, _workspaceId);

            ImportAPIHelpers.CreateDocuments(_workspaceId, _rootFolderArtifactId, documents);
        }
예제 #2
0
        public async Task SetupWorkspaceAudits(string baseTemplateName, string primaryServerName, string username, string password, string injectAuditDataQuery, IServicesMgr servicesManager)
        {
            // Setup
            var testWorkspaceName = "TestWorkspaceName";

            DataSetup.Setup();

            // Create Workspace
            var workspaceId = await CreateWorkspace.CreateWorkspaceAsync(testWorkspaceName, baseTemplateName, servicesManager, username, password);

            // Inject Audits by running SQL script against the workspace database
            using (var conn = await connectionFactory.GetWorkspaceConnectionAsync(workspaceId))
            {
                await conn.ExecuteAsync(
                    injectAuditDataQuery,
                    new
                {
                    workspace = workspaceId,
                    startHour = DateTime.UtcNow.AddDays(-7),
                    endHour   = DateTime.UtcNow,
                    suggestedExecutionTime = (int?)null,
                    usersPerHour           = 3,
                    minExecutionTime       = 1000,
                    maxExecutionTime       = 10000,
                    auditsPerHour          = 1000,
                    primaryServerName
                });
            }
        }
        public void SetUp()
        {
            // Setup helper
            _helper = new TestHelper(ConfigurationHelper.ADMIN_USERNAME, ConfigurationHelper.DEFAULT_PASSWORD);

            // Create new workspace to test in
            _workspaceId = CreateWorkspace.CreateWorkspaceAsync(ConfigurationHelper.TEST_WORKSPACE_NAME, ConfigurationHelper.TEST_WORKSPACE_TEMPLATE_NAME,
                                                                _helper.GetServicesManager(), ConfigurationHelper.ADMIN_USERNAME, ConfigurationHelper.DEFAULT_PASSWORD).Result;

            // Gather sql scripts to use for DAPI
            _sqlList = GatherSqlScripts();

            // Setup DapiHelper
            Sut = new DapiHelper(ConfigurationHelper.ADMIN_USERNAME, ConfigurationHelper.DEFAULT_PASSWORD, ConfigurationHelper.SERVER_BINDING_TYPE, ConfigurationHelper.REST_SERVER_ADDRESS,
                                 _workspaceId, YamlFileName, YamlFileFullPath, DapiFullFilePath, _sqlList);
        }
예제 #4
0
        public void Execute_TestFixtureSetup()
        {
            try
            {
                //Start of test and setup
                Console.WriteLine("Test START.....");
                Console.WriteLine("Enter Test Fixture Setup.....");
                var helper = new TestHelper();

                //Setup for testing
                Console.WriteLine("Creating Test Helper Services Manager based on App.Config file settings.");
                _servicesManager = helper.GetServicesManager();
                Console.WriteLine("Services Manager Created.");

                Console.WriteLine("Creating workspace.....");
                if (!_debug)
                {
                    _workspaceId =
                        CreateWorkspace.CreateWorkspaceAsync(_workspaceName,
                                                             ConfigurationHelper.TEST_WORKSPACE_TEMPLATE_NAME, _servicesManager, ConfigurationHelper.ADMIN_USERNAME,
                                                             ConfigurationHelper.DEFAULT_PASSWORD).Result;
                    Console.WriteLine($"Workspace created [WorkspaceArtifactId= {_workspaceId}].....");
                }
                else
                {
                    //must point _workspaceId = valid workspace with application already installed
                    _workspaceId = _debugWorkspaceId;
                    Console.WriteLine($"Using existing workspace [WorkspaceArtifactId= {_workspaceId}].....");
                }


                Console.WriteLine("Creating RSAPI and Service Factory.....");
                try
                {
                    _eddsDbContext = helper.GetDBContext(-1);
                    _dbContext     = helper.GetDBContext(_workspaceId);

                    //create client
                    _client = _servicesManager.GetProxy <IRSAPIClient>(ConfigurationHelper.ADMIN_USERNAME, ConfigurationHelper.DEFAULT_PASSWORD);

                    LogStart("Application Import");
                    if (!_debug)
                    {
                        //Import Application
                        Relativity.Test.Helpers.Application.ApplicationHelpers.ImportApplication(_client, _workspaceId, true, _applicationFilePath, _applicationName);
                        LogEnd("Application Import");
                    }
                    else
                    {
                        Console.WriteLine($"Using existing application");
                    }



                    _client.APIOptions.WorkspaceID = _workspaceId;
                }
                catch (Exception ex)
                {
                    throw new Exception("Error encountered while creating new RSAPI Client and/or Service Proxy.", ex);
                }
                finally
                {
                    Console.WriteLine("Created RSAPI and Service Factory.....");
                }

                Console.WriteLine("Creating TestObject Helper.");
                //1 retry setting because I want to know if it fails quickly while debugging, may bump up for production
                _testObjectHelper = new TestObjectHelper(_servicesManager, _workspaceId, 1);
                Console.WriteLine("TestObject Helper Created.");
            }
            catch (Exception ex)
            {
                throw new Exception("Error encountered in Test Setup.", ex);
            }
            finally
            {
                Console.WriteLine("Exit Test Fixture Setup.....");
            }
        }