示例#1
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);
        }
示例#4
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);
        }
示例#5
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);
            }
        }
示例#6
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);
                 }
             }
         }
     }
 }