public void TestInitialize() { // Use the following two lines if Test to Production server. Comment out the Configuration.InstallationType = InstallationType.ServerTest row. Login with your own user. //Configuration.Debug = false; //Configuration.InstallationType = InstallationType.Production; Configuration.SetInstallationType(); WebServiceData.AuthorizationManager = new ArtDatabanken.WebService.Data.AuthorizationManager(); WebServiceData.DatabaseManager = new ArtDatabanken.WebService.TaxonService.Data.DatabaseManager(); WebServiceData.LogManager = new LogManager(); WebServiceData.ReferenceManager = new ArtDatabanken.WebService.Data.ReferenceManager(); WebServiceData.UserManager = new ArtDatabanken.WebService.Data.UserManager(); WebServiceData.WebServiceManager = new WebServiceManager(); _context = new WebServiceContextCached(Settings.Default.TestUserName, Settings.Default.TestApplicationIdentifier); //_context = new WebServiceContext("TestDyntaxaReader", "DyntaxaReader1"); //_webLoginResponse = WebServiceData.UserManager.Login(_context, "TestDyntaxaReader", "DyntaxaReader1", Settings.Default.TestApplicationIdentifier, false); try { _webLoginResponse = WebServiceData.UserManager.Login(_context, Settings.Default.TestUserName, Settings.Default.TestPassword, Settings.Default.TestApplicationIdentifier, false); } catch (Exception e) { // Try Once more if service is turned off... Thread.Sleep(20000); _webLoginResponse = WebServiceData.UserManager.Login(_context, Settings.Default.TestUserName, Settings.Default.TestPassword, Settings.Default.TestApplicationIdentifier, false); } ArtDatabanken.Data.ArtDatabankenService.UserManager.Login(WebServiceData.WebServiceManager.Name, WebServiceData.WebServiceManager.Password, "ArtDatabankenSOA", false); if (_useTransaction) { _context.StartTransaction(_transactionTimeout); } }
public void Constructor() { WebLoginResponse loginResponse; loginResponse = new WebLoginResponse(); Assert.IsNotNull(loginResponse); }
public void TestInitialize() { WebLoginResponse loginResponse; // Production test. // Configuration.InstallationType = InstallationType.Production; // WebServiceProxy.TaxonService.WebServiceAddress = @"Taxon.ArtDatabankenSOA.se/TaxonService.svc"; // Local test // WebServiceProxy.TaxonService.InternetProtocol = InternetProtocol.Http; // WebServiceProxy.TaxonService.WebServiceAddress = @"localhost:4983/TaxonService.svc"; // WebServiceProxy.TaxonService.WebServiceComputer = WebServiceComputer.Local; // WebServiceProxy.TaxonService.WebServiceProtocol = WebServiceProtocol.SOAP11; // Normal test server tests. Configuration.InstallationType = InstallationType.TwoBlueberriesTest; loginResponse = WebServiceProxy.TaxonService.Login(Settings.Default.TestUserName, Settings.Default.TestPassword, Settings.Default.DyntaxaApplicationIdentifier, false); _loginResponse = loginResponse; if (loginResponse.IsNotNull()) { _clientInformation = new WebClientInformation(); _clientInformation.Locale = loginResponse.Locale; _clientInformation.Role = loginResponse.Roles[0]; _clientInformation.Token = loginResponse.Token; } }
private BaseRequest MapperToBaseRequest(WebLoginResponse webLoginResponse) => new BaseRequest { Uin = webLoginResponse.WxUin.ToString(), Sid = webLoginResponse.WxSid, Skey = webLoginResponse.Skey, DeviceID = _deviceId };
private WebLoginResponse GetLoginResponse(Boolean refresh) { if (_loginResponse.IsNull() || refresh) { _loginResponse = new WebLoginResponse(); } return(_loginResponse); }
public async Task Run() { _logger.LogInformation("WeChat Engine Starting....."); var uuid = await _weChatClient.GetUuid(); GenerateQR(UrlEndpoints.QRCode + uuid); _clientLoginResponse = await WaitForLogin(uuid); _webLoginResponse = await Login(_clientLoginResponse); _weChatInitResponse = await InitApp(_webLoginResponse, _clientLoginResponse); await GetContacts(); SyncMessage(); IsReady = true; _logger.LogInformation("WeChat Engine Started....."); }
private async Task <WeChatInitResponse> InitApp(WebLoginResponse webLoginResponse, ClientLoginResponse clientLoginResponse) { var base_request = MapperToBaseRequest(webLoginResponse); var body = new { BaseRequest = base_request }; string initInfo = await _weChatMessageClient.Post(clientLoginResponse.BaseUri + "/webwxinit?r=" + Utility.ConvertDateTimeToInt(DateTime.Now) + "&lang=en_US" + "&pass_ticket=" + webLoginResponse.PassTicket, JsonConvert.SerializeObject(body)); var init = JsonConvert.DeserializeObject <WeChatInitResponse>(initInfo); foreach (var syncKey in init.SyncKey.List) { _syncKey += (syncKey.Key + "_" + syncKey.Val + "%7C"); } _syncKey = _syncKey.TrimEnd('%', '7', 'C'); return(init); }
public void TestInitialize() { Configuration.SetInstallationType(); WebServiceData.ApplicationManager = new WebService.Data.ApplicationManager(); WebServiceData.AuthorizationManager = new AuthorizationManager(); WebServiceData.CoordinateConversionManager = new CoordinateConversionManager(); WebServiceData.DatabaseManager = new DatabaseManager(); WebServiceData.GeometryManager = new GeometryManager(); WebServiceData.LogManager = new LogManager(); WebServiceData.RegionManager = new WebService.Data.RegionManager(); WebServiceData.UserManager = new UserManager(); WebServiceData.WebServiceManager = new WebServiceManager(); WebServiceData.SpeciesActivityManager = new SpeciesActivityManager(); WebServiceData.SpeciesFactManager = new SpeciesFactManager(); WebServiceData.SpeciesObservationManager = new WebService.Data.SpeciesObservationManager(); WebServiceData.TaxonManager = new WebService.Data.TaxonManager(); WebServiceData.AnalysisManager = new WebService.Data.AnalysisManager(); //WebServiceData.GeoReferenceManager = new GeoReferenceManager(); Context = new WebServiceContextCached(Settings.Default.TestUserName, ApplicationIdentifier.PrintObs.ToString()); //Finally login application user try { LoginResponse = WebServiceData.UserManager.Login(Context, Settings.Default.TestUserName, Settings.Default.TestPassword, ApplicationIdentifier.PrintObs.ToString(), false); } catch { // Try Once more if service is turned off... Thread.Sleep(20000); LoginResponse = WebServiceData.UserManager.Login(Context, Settings.Default.TestUserName, Settings.Default.TestPassword, ApplicationIdentifier.PrintObs.ToString(), false); } // Login to Artdatabanken service. ArtDatabanken.Data.ArtDatabankenService.UserManager.Login(WebServiceData.WebServiceManager.Name, WebServiceData.WebServiceManager.Password, ApplicationIdentifier.ArtDatabankenSOA.ToString(), false); if (_useTransaction) { Context.StartTransaction(_transactionTimeout); } }
public WebLoginResponseTest() { _loginResponse = null; }