public void setOldCredentials() { oldUserPassConnectionInfo = new UserPassConnectionInfo(OctaneConfiguration.Username, OctaneConfiguration.Password); oldSsid = OctaneConfiguration.SharedSpaceId; oldWsid = OctaneConfiguration.WorkSpaceId; oldUrl = OctaneConfiguration.Url; }
public static void AssemblyInitialize(TestContext context) { // Check if .runsettings is configured properly EnsurePropertiesSet(context.Properties, "ignoreServerCertificateValidation", "webAppUrl", "userName", "password", "sharedSpaceId", "workspaceId"); var ignoreServerCertificateValidation = context.Properties["ignoreServerCertificateValidation"].ToString(); if (ignoreServerCertificateValidation != null && ignoreServerCertificateValidation.ToLower().Equals("true")) { NetworkSettings.IgnoreServerCertificateValidation(); } NetworkSettings.EnableAllSecurityProtocols(); OctaneConfiguration.Url = context.Properties["webAppUrl"].ToString(); OctaneConfiguration.Username = context.Properties["userName"].ToString(); OctaneConfiguration.Password = context.Properties["password"].ToString(); var connectionInfo = new UserPassConnectionInfo(OctaneConfiguration.Username, OctaneConfiguration.Password); RestConnector.Connect(OctaneConfiguration.Url, connectionInfo); var sharedSpaceId = int.Parse(context.Properties["sharedSpaceId"].ToString()); var workspaceId = int.Parse(context.Properties["workspaceId"].ToString()); WorkspaceContext = new WorkspaceContext(sharedSpaceId, workspaceId); OctaneConfiguration.WorkSpaceId = WorkspaceContext.WorkspaceId; var sharedSpaceContext = new SharedSpaceContext(sharedSpaceId); OctaneConfiguration.SharedSpaceId = sharedSpaceContext.SharedSpaceId; OctaneConfiguration.SsoLogin = bool.Parse(context.Properties["ssoLogin"].ToString()); OctaneConfiguration.CredentialLogin = bool.Parse(context.Properties["credentialLogin"].ToString()); User = GetWorkspaceUser(); CurrentRelease = ReleaseUtilities.CreateRelease(); // create the octaneservices object to be used by the tests OctaneServices.Create(OctaneConfiguration.Url, OctaneConfiguration.SharedSpaceId, OctaneConfiguration.WorkSpaceId); OctaneServices.GetInstance().Connect(); }
public static void InitConnection(TestContext context) { if (!restConnector.IsConnected()) { string ignoreServerCertificateValidation = ConfigurationManager.AppSettings["ignoreServerCertificateValidation"]; if (ignoreServerCertificateValidation != null && ignoreServerCertificateValidation.ToLower().Equals("true")) { NetworkSettings.IgnoreServerCertificateValidation(); } NetworkSettings.EnableAllSecurityProtocols(); host = ConfigurationManager.AppSettings["webAppUrl"]; // If webAppUrl is empty we do not try to connect. if (string.IsNullOrWhiteSpace(host)) { return; } ConnectionInfo connectionInfo; string clientId = ConfigurationManager.AppSettings["clientId"]; if (clientId != null) { userName = clientId; connectionInfo = new APIKeyConnectionInfo(clientId, ConfigurationManager.AppSettings["clientSecret"]); } else { userName = ConfigurationManager.AppSettings["userName"]; password = ConfigurationManager.AppSettings["password"]; connectionInfo = new UserPassConnectionInfo(userName, password); } lwssoAuthenticationStrategy = new LwssoAuthenticationStrategy(connectionInfo); restConnector.Connect(host, lwssoAuthenticationStrategy); var sharedSpaceId = int.Parse(ConfigurationManager.AppSettings["sharedSpaceId"]); var workspaceId = int.Parse(ConfigurationManager.AppSettings["workspaceId"]); workspaceContext = new WorkspaceContext(sharedSpaceId, workspaceId); sharedSpaceContext = new SharedSpaceContext(sharedSpaceId); } }
public ALMOctaneConnection(string host, string userName, string password, string sharedSpaceId, string workspaceId) { RestConnector = new RestConnector(); EntityService = new EntityService(RestConnector); SharedspaceId = sharedSpaceId; WorkspaceId = workspaceId; LwssoAuthenticationStrategy lwssoAuthenticationStrategy; //WorkspaceContext workspaceContext; //SharedSpaceContext sharedSpaceContext; NetworkSettings.IgnoreServerCertificateValidation(); NetworkSettings.EnableAllSecurityProtocols(); ConnectionInfo connectionInfo; connectionInfo = new UserPassConnectionInfo(userName, password); lwssoAuthenticationStrategy = new LwssoAuthenticationStrategy(connectionInfo); RestConnector.Connect(host, lwssoAuthenticationStrategy); //workspaceContext = new WorkspaceContext(sharedSpaceId, workspaceId); //sharedSpaceContext = new SharedSpaceContext(sharedSpaceId); }