示例#1
0
        private static void DuplicateBatches(ServiceFactorySettings settings)
        {
            try
            {
                using (IRSAPIClient rsapiProxy = new Relativity.Services.ServiceProxy.ServiceFactory(settings).CreateProxy <IRSAPIClient>())
                {
                    rsapiProxy.APIOptions.WorkspaceID = _templateArtifactId;

                    List <DTOs.Result <DTOs.BatchSet> > source = GetSourceBatches(rsapiProxy);

                    if (source == null)
                    {
                        return;
                    }
                    else if (source.Count < 1)
                    {
                        Console.WriteLine("Template workspace has no folders; exiting.");
                        return;
                    }

                    rsapiProxy.APIOptions.WorkspaceID = _targetArtifactId;

                    CreateBatches(source, rsapiProxy);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(String.Format("Exception encountered:\r\n{0}\r\n{1}", ex.Message, ex.InnerException));
            }
        }
示例#2
0
        public T CreateProxy <T>(ExecutionIdentity ident) where T : IDisposable
        {
            Credentials creds = null;

            if (ident == ExecutionIdentity.CurrentUser)
            {
                creds = new UsernamePasswordCredentials(_username, _password);
            }
            else if (ident == ExecutionIdentity.System)
            {
                var username = SharedTestHelpers.ConfigurationHelper.ADMIN_USERNAME;
                var password = SharedTestHelpers.ConfigurationHelper.DEFAULT_PASSWORD;
                creds = new UsernamePasswordCredentials(username, password);
            }

            if (creds == null)
            {
                throw new NotSupportedException($"{ident} is not supported in the Test Service Mangager.");
            }

            var serviceFactorySettings = new ServiceFactorySettings(GetServicesURL(), this.GetKeplerUrl(), creds);
            var serviceFactory         = new Relativity.Services.ServiceProxy.ServiceFactory(serviceFactorySettings);
            T   proxy = serviceFactory.CreateProxy <T>();

            return(proxy);
        }
        public static T GetProxy <T>(this IServicesMgr svcmgr, string username, string password) where T : IDisposable
        {
            //Create the ServiceFactory with the given credentials and urls
            ServiceFactorySettings serviceFactorySettings = new ServiceFactorySettings(svcmgr.GetServicesURL(), svcmgr.GetKeplerUrl(), new Relativity.Services.ServiceProxy.UsernamePasswordCredentials(username, password));

            Relativity.Services.ServiceProxy.ServiceFactory serviceFactory = new Relativity.Services.ServiceProxy.ServiceFactory(serviceFactorySettings);
            //Create proxy
            T proxy = serviceFactory.CreateProxy <T>();

            return(proxy);
        }
        public T CreateProxy <T>(ExecutionIdentity ident) where T : IDisposable
        {
            //Could do something here with the different Security contexts.  I.E.  If ExecutionIdentity.System then use SharedTestHelpers.ConfigurationHelper.SYSTEM_USER_NAME and SharedTestHelpers.ConfigurationHelper.SYSTEM_PASSWORD
            //          and if ExecutionIdentity.CurrentUser then SharedTestHelpers.ConfigurationHelper.STANDARD_USER_NAME, etc

            //Create the ServiceFactory with the given credentials and urls
            ServiceFactorySettings serviceFactorySettings = new ServiceFactorySettings(GetServicesURL(), this.GetKeplerUrl(), new Relativity.Services.ServiceProxy.UsernamePasswordCredentials(_username, _password));

            Relativity.Services.ServiceProxy.ServiceFactory serviceFactory = new Relativity.Services.ServiceProxy.ServiceFactory(serviceFactorySettings);
            //Create proxy
            T proxy = serviceFactory.CreateProxy <T>();

            return(proxy);
        }
示例#5
0
        public T CreateProxy <T>(ExecutionIdentity ident) where T : IDisposable
        {
            Credentials creds = null;

            creds = new UsernamePasswordCredentials(_configs.AdminUsername, _configs.AdminPassword);

            ServiceFactorySettings serviceFactorySettings;

            Relativity.Services.ServiceProxy.ServiceFactory serviceFactory;

            serviceFactorySettings = new ServiceFactorySettings(GetServicesURL(), this.GetKeplerUrl(this._configs), creds);
            serviceFactory         = new Relativity.Services.ServiceProxy.ServiceFactory(serviceFactorySettings);
            T proxy = serviceFactory.CreateProxy <T>();

            return(proxy);
        }
        public ServiceFactory getNewServiceFactory()
        {

            // DevVm Address
            String restServerAddress = "{my_company_name}/Relativity.Rest/Api";
            string rsapiAddress = "{my_company_name}/Relativity.Services";

            Uri keplerUri = new Uri(restServerAddress);
            Uri servicesUri = new Uri(rsapiAddress);

            ServiceFactorySettings settings = new ServiceFactorySettings(
                servicesUri, keplerUri, new Relativity.Services.ServiceProxy.UsernamePasswordCredentials("username", "password"));

            Relativity.Services.ServiceProxy.ServiceFactory _serviceFactory = new Relativity.Services.ServiceProxy.ServiceFactory(settings);

            return _serviceFactory;
        }
示例#7
0
        public static int Create_Client(IRSAPIClient client, Relativity.Services.ServiceProxy.ServiceFactory serviceFactory, string name)
        {
            var workspaceId = client.APIOptions.WorkspaceID;

            client.APIOptions.WorkspaceID = -1;

            using (IClientManager proxy = serviceFactory.CreateProxy <IClientManager>())
            {
                List <ChoiceRef> choiceRefs = proxy.GetStatusChoicesForClientAsync().Result;
                ChoiceRef        statusRef  = choiceRefs.Find(x => x.Name == "Active");
                var newClient = new Relativity.Services.Client.Client {
                    Name = name, Number = Guid.NewGuid().ToString(), Status = statusRef, Keywords = "Temp Client", Notes = "Used in the Disable Inactve User Integration Test."
                };
                int clientArtifactId = proxy.CreateSingleAsync(newClient).Result;
                client.APIOptions.WorkspaceID = workspaceId;
                return(clientArtifactId);
            }
        }
示例#8
0
 public static void Delete_Client(Relativity.Services.ServiceProxy.ServiceFactory serviceFactory, int artifactId)
 {
     using (IClientManager proxy = serviceFactory.CreateProxy <IClientManager>())
     {
         int j = 1;
         while (j <= 5)
         {
             try
             {
                 proxy.DeleteSingleAsync(artifactId).Wait();
                 j++;
                 break;
             }
             catch (Exception ex)
             {
                 if (j >= 5)
                 {
                     throw new Exception("Error deleting Client", ex);
                 }
             }
         }
     }
 }