protected void SendRequest(string rPath, Dict<string, string> rArgs, ServerType rType, Action<WWW> rOnResponse) { var url = HttpServerHost + rPath; useServerType = rType; WaitingLayer.Show(); this.StartCoroutine(GET(url, rArgs, rOnResponse)); }
public static BsonDocument CreateReadPreferenceDocument(ServerType serverType, ReadPreference readPreference) { if (readPreference == null) { return null; } if (serverType != ServerType.ShardRouter) { return null; } BsonArray tagSets = null; if (readPreference.TagSets != null && readPreference.TagSets.Any()) { tagSets = new BsonArray(readPreference.TagSets.Select(ts => new BsonDocument(ts.Tags.Select(t => new BsonElement(t.Name, t.Value))))); } else if (readPreference.ReadPreferenceMode == ReadPreferenceMode.Primary || readPreference.ReadPreferenceMode == ReadPreferenceMode.SecondaryPreferred) { return null; } var readPreferenceString = readPreference.ReadPreferenceMode.ToString(); readPreferenceString = Char.ToLowerInvariant(readPreferenceString[0]) + readPreferenceString.Substring(1); return new BsonDocument { { "mode", readPreferenceString }, { "tags", tagSets, tagSets != null } }; }
private async Task ExistingPage(ServerType server, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl) { await TestServices.RunSiteTest( SiteName, server, runtimeFlavor, architecture, applicationBaseUrl, async (httpClient, logger, token) => { var response = await RetryHelper.RetryRequest(async () => { return await httpClient.GetAsync(string.Empty); }, logger, token, retryCount: 30); var responseText = await response.Content.ReadAsStringAsync(); logger.LogResponseOnFailedAssert(response, responseText, () => { string expectedText = "Hello World, try /bob to get a 404"; Assert.Equal(expectedText, responseText); Assert.Equal(HttpStatusCode.OK, response.StatusCode); }); }); }
/// <summary> /// Creates an instance of <see cref="DeploymentParameters"/>. /// </summary> /// <param name="applicationPath">Source code location of the target location to be deployed.</param> /// <param name="serverType">Where to be deployed on.</param> /// <param name="runtimeFlavor">Flavor of the clr to run against.</param> /// <param name="runtimeArchitecture">Architecture of the runtime to be used.</param> public DeploymentParameters( string applicationPath, ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture runtimeArchitecture) { if (string.IsNullOrEmpty(applicationPath)) { throw new ArgumentException("Value cannot be null.", nameof(applicationPath)); } if (!Directory.Exists(applicationPath)) { throw new DirectoryNotFoundException(string.Format("Application path {0} does not exist.", applicationPath)); } if (runtimeArchitecture == RuntimeArchitecture.x86) { throw new NotSupportedException("32 bit compilation is not yet supported. Don't remove the tests, just disable them for now."); } ApplicationPath = applicationPath; ServerType = serverType; RuntimeFlavor = runtimeFlavor; EnvironmentVariables.Add(new KeyValuePair<string, string>("ASPNETCORE_DETAILEDERRORS", "true")); }
public static IMetadataReader GetReader(ServerType serverType, string connectionStr) { IMetadataReader metadataReader; switch(serverType) { case ServerType.Oracle: metadataReader = new OracleMetadataReader(connectionStr); break; case ServerType.SqlServer: metadataReader = new SqlServerMetadataReader(connectionStr); break; case ServerType.SqlCe: metadataReader = new SqlCeMetadataReader(connectionStr); break; default: metadataReader = new OracleMetadataReader(connectionStr); break; } /*if (serverType == ServerType.Oracle) { } else { }*/ return metadataReader; }
private async Task RunSite(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl) { await TestServices.RunSiteTest( SiteName, serverType, runtimeFlavor, architecture, applicationBaseUrl, async (httpClient, logger, token) => { var response = await RetryHelper.RetryRequest(async () => { return await httpClient.GetAsync(string.Empty); }, logger, token, retryCount: 30); var responseText = await response.Content.ReadAsStringAsync(); string expectedText = "Retry Count 42\r\n" + "Default Ad Block House\r\n" + "Ad Block Contoso Origin sql-789 Product Code contoso2014\r\n" + "Ad Block House Origin blob-456 Product Code 123\r\n"; logger.LogResponseOnFailedAssert(response, responseText, () => { Assert.Equal(expectedText, responseText); }); }); }
public ApplicationSettings(string connectionString, ServerType serverType, string nameSpace, string assemblyName) { ConnectionString = connectionString; ServerType = serverType; NameSpace = nameSpace; AssemblyName = assemblyName; }
public static async Task RunSiteTest(string siteName, ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, Func<HttpClient, ILogger, CancellationToken, Task> validator) { var logger = new LoggerFactory() .AddConsole() .CreateLogger(string.Format("{0}:{1}:{2}:{3}", siteName, serverType, runtimeFlavor, architecture)); using (logger.BeginScope("RunSiteTest")) { var deploymentParameters = new DeploymentParameters(GetPathToApplication(siteName), serverType, runtimeFlavor, architecture) { ApplicationBaseUriHint = applicationBaseUrl, SiteName = "HttpTestSite", }; using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, logger)) { var deploymentResult = deployer.Deploy(); var httpClientHandler = new HttpClientHandler(); var httpClient = new HttpClient(httpClientHandler) { BaseAddress = new Uri(deploymentResult.ApplicationBaseUri), Timeout = TimeSpan.FromSeconds(10) }; await validator(httpClient, logger, deploymentResult.HostShutdownToken); } } }
//----------------------------------------------------------------------------- public SilkroadServer CreateNew(string bind_addr, int bind_port, string module_addr, int module_port, ServerType srvtype, bool blowfish, bool sec_bytes, bool handshake, PacketDispatcher packetProcessor, DelayedPacketDispatcher delayedPacketDispatcher, List<RedirectRule> redirs = null) { if (BindExists(bind_addr, bind_port)) { Global.logmgr.WriteLog(LogLevel.Error, "Server with given bind address already exists [{0}:{1}]", bind_addr, bind_port); return null; } try { SilkroadServer ServerItem = new SilkroadServer( new IPEndPoint(IPAddress.Parse(bind_addr), bind_port), new IPEndPoint(IPAddress.Parse(module_addr), module_port), srvtype, blowfish, sec_bytes, handshake, packetProcessor, delayedPacketDispatcher, redirs ); m_servers.Add(ServerItem); ServerItem.Start(); return ServerItem; } catch { Global.logmgr.WriteLog(LogLevel.Error, "ServerManager failed to start server, SilkroadServer start error"); } return null; }
public void Open(string aConnectionString, ServerType serverType) { dbCache.ConnectionString = aConnectionString; dbCache.ServerType = serverType; switch (serverType) { case ServerType.Firebird: connection = new FbConnection {ConnectionString = aConnectionString}; break; case ServerType.MsSql: connection = new SqlConnection { ConnectionString = aConnectionString }; break; } connection.Open(); if (serverType==ServerType.Firebird) using (var transaction = connection.BeginTransaction()) { DbData.GetFieldValue(connection, transaction, "select rdb$set_context('USER_SESSION','RPL_SERVICE','1') from rdb$database;"); transaction.Commit(); } var t = new Thread(LoadData); t.Start(); }
private static void AssertMappedTypes(ServerType serverType, DataTypeMapper mapper, Type expectedType, params string[] dataTypes) { foreach (string dataType in dataTypes) { Assert.AreEqual(expectedType, mapper.MapFromDBType(serverType, dataType, null, null, null)); } }
public static BsonDocument CreateReadPreferenceDocument(ServerType serverType, ReadPreference readPreference) { if (serverType != ServerType.ShardRouter || readPreference == null) { return null; } BsonArray tagSets = null; if (readPreference.TagSets != null && readPreference.TagSets.Count > 0) { tagSets = new BsonArray(readPreference.TagSets.Select(ts => new BsonDocument(ts.Tags.Select(t => new BsonElement(t.Name, t.Value))))); } // simple ReadPreferences of Primary and SecondaryPreferred are encoded in the slaveOk bit if (readPreference.ReadPreferenceMode == ReadPreferenceMode.Primary || readPreference.ReadPreferenceMode == ReadPreferenceMode.SecondaryPreferred) { if (tagSets == null && !readPreference.MaxStaleness.HasValue) { return null; } } var modeString = readPreference.ReadPreferenceMode.ToString(); modeString = Char.ToLowerInvariant(modeString[0]) + modeString.Substring(1); return new BsonDocument { { "mode", modeString }, { "tags", tagSets, tagSets != null }, { "maxStalenessSeconds", () => (int)readPreference.MaxStaleness.Value.TotalSeconds, readPreference.MaxStaleness.HasValue } }; }
private async Task RunSite(ServerType server, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl) { await TestServices.RunSiteTest( SiteName, server, runtimeFlavor, architecture, applicationBaseUrl, async (httpClient, logger, token) => { // ===== English ===== var response = await RetryHelper.RetryRequest(async () => { return await httpClient.GetAsync(string.Empty); }, logger, token, retryCount: 30); var responseText = await response.Content.ReadAsStringAsync(); var headingIndex = responseText.IndexOf("<h2>Application uses</h2>"); Assert.True(headingIndex >= 0); // ===== French ===== response = await RetryHelper.RetryRequest(async () => { return await httpClient.GetAsync("?culture=fr&ui-culture=fr"); }, logger, token, retryCount: 30); responseText = await response.Content.ReadAsStringAsync(); headingIndex = responseText.IndexOf("<h2>Utilisations d'application</h2>"); Assert.True(headingIndex >= 0); }); }
internal static string GetVersionHint(SqlVersion version, ServerType serverType) { if (serverType == ServerType.Cloud) { Debug.Assert(version >= SqlVersion.Sql11); return SqlProviderManifest.TokenAzure11; } switch (version) { case SqlVersion.Sql8: return SqlProviderManifest.TokenSql8; case SqlVersion.Sql9: return SqlProviderManifest.TokenSql9; case SqlVersion.Sql10: return SqlProviderManifest.TokenSql10; case SqlVersion.Sql11: return SqlProviderManifest.TokenSql11; default: throw new ArgumentException(Strings.UnableToDetermineStoreVersion); } }
public MessageEventArgs(MessageType messtype, ServerType servertype, String arguments, String message) { messagetype = messtype; type = servertype; args = arguments; Message = message; }
public bool Contains(ServerType serverType) { if ((this.ServerType & serverType) == 0) { return false; } return true; }
public async Task OpenIdConnect_OnX86( ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl) { await OpenIdConnectTestSuite(serverType, runtimeFlavor, architecture, applicationBaseUrl); }
public async Task NtlmAuthenticationTest(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl) { var logger = new LoggerFactory() .AddConsole(LogLevel.Warning) .CreateLogger(string.Format("Ntlm:{0}:{1}:{2}", serverType, runtimeFlavor, architecture)); using (logger.BeginScope("NtlmAuthenticationTest")) { var musicStoreDbName = Guid.NewGuid().ToString().Replace("-", string.Empty); var connectionString = string.Format(DbUtils.CONNECTION_STRING_FORMAT, musicStoreDbName); var deploymentParameters = new DeploymentParameters(Helpers.GetApplicationPath(), serverType, runtimeFlavor, architecture) { ApplicationBaseUriHint = applicationBaseUrl, EnvironmentName = "NtlmAuthentication", //Will pick the Start class named 'StartupNtlmAuthentication' ApplicationHostConfigTemplateContent = (serverType == ServerType.IISExpress) ? File.ReadAllText("NtlmAuthentation.config") : null, SiteName = "MusicStoreNtlmAuthentication", //This is configured in the NtlmAuthentication.config UserAdditionalCleanup = parameters => { if (!Helpers.RunningOnMono) { // Mono uses InMemoryStore DbUtils.DropDatabase(musicStoreDbName, logger); } } }; // Override the connection strings using environment based configuration deploymentParameters.EnvironmentVariables .Add(new KeyValuePair<string, string>( "SQLAZURECONNSTR_DefaultConnection", string.Format(DbUtils.CONNECTION_STRING_FORMAT, musicStoreDbName))); using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, logger)) { var deploymentResult = deployer.Deploy(); var httpClientHandler = new HttpClientHandler() { UseDefaultCredentials = true }; var httpClient = new HttpClient(httpClientHandler) { BaseAddress = new Uri(deploymentResult.ApplicationBaseUri) }; // Request to base address and check if various parts of the body are rendered & measure the cold startup time. var response = await RetryHelper.RetryRequest(async () => { return await httpClient.GetAsync(string.Empty); }, logger: logger, cancellationToken: deploymentResult.HostShutdownToken); Assert.False(response == null, "Response object is null because the client could not " + "connect to the server after multiple retries"); var validator = new Validator(httpClient, httpClientHandler, logger, deploymentResult); await validator.VerifyNtlmHomePage(response); //Should be able to access the store as the Startup adds necessary permissions for the current user await validator.AccessStoreWithPermissions(); logger.LogInformation("Variation completed successfully."); } } }
public async Task HelloWorld(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, ServerType delegateServer, ApplicationType applicationType) { var logger = new LoggerFactory() .AddConsole() .AddDebug() .CreateLogger($"HelloWorld:{serverType}:{runtimeFlavor}:{architecture}:{delegateServer}"); using (logger.BeginScope("HelloWorldTest")) { var deploymentParameters = new DeploymentParameters(Helpers.GetTestSitesPath(applicationType), serverType, runtimeFlavor, architecture) { ApplicationBaseUriHint = applicationBaseUrl, EnvironmentName = "HelloWorld", // Will pick the Start class named 'StartupHelloWorld', ServerConfigTemplateContent = (serverType == ServerType.IISExpress) ? File.ReadAllText("Http.config") : null, SiteName = "HttpTestSite", // This is configured in the Http.config TargetFramework = runtimeFlavor == RuntimeFlavor.Clr ? "net451" : "netcoreapp1.0", ApplicationType = applicationType }; using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, logger)) { var deploymentResult = deployer.Deploy(); var httpClientHandler = new HttpClientHandler(); var httpClient = new HttpClient(httpClientHandler) { BaseAddress = new Uri(deploymentResult.ApplicationBaseUri), Timeout = TimeSpan.FromSeconds(5), }; // Request to base address and check if various parts of the body are rendered & measure the cold startup time. var response = await RetryHelper.RetryRequest(() => { return httpClient.GetAsync(string.Empty); }, logger, deploymentResult.HostShutdownToken, retryCount: 30); var responseText = await response.Content.ReadAsStringAsync(); try { Assert.Equal("Hello World", responseText); response = await httpClient.GetAsync("/Path%3F%3F?query"); responseText = await response.Content.ReadAsStringAsync(); Assert.Equal("/Path??", responseText); response = await httpClient.GetAsync("/Query%3FPath?query?"); responseText = await response.Content.ReadAsStringAsync(); Assert.Equal("?query?", responseText); } catch (XunitException) { logger.LogWarning(response.ToString()); logger.LogWarning(responseText); throw; } } } }
public static IDeployOperation GetOperationImp(ServerType serverType) { if (serverType == ServerType.MSFolder) return new MSFolderOperation(); if (serverType == ServerType.SSH) return new SSHOperation(); return new SVNOperation(); }
private async Task OpenIdConnectTestSuite(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl) { var logger = new LoggerFactory() .AddConsole(LogLevel.Warning) .CreateLogger(string.Format("OpenId:{0}:{1}:{2}", serverType, runtimeFlavor, architecture)); using (logger.BeginScope("OpenIdConnectTestSuite")) { var musicStoreDbName = Guid.NewGuid().ToString().Replace("-", string.Empty); var connectionString = string.Format(DbUtils.CONNECTION_STRING_FORMAT, musicStoreDbName); var deploymentParameters = new DeploymentParameters(Helpers.GetApplicationPath(), serverType, runtimeFlavor, architecture) { ApplicationBaseUriHint = applicationBaseUrl, EnvironmentName = "OpenIdConnectTesting", UserAdditionalCleanup = parameters => { if (!Helpers.RunningOnMono && TestPlatformHelper.IsWindows) { // Mono uses InMemoryStore DbUtils.DropDatabase(musicStoreDbName, logger); } } }; // Override the connection strings using environment based configuration deploymentParameters.EnvironmentVariables .Add(new KeyValuePair<string, string>( "SQLAZURECONNSTR_DefaultConnection", string.Format(DbUtils.CONNECTION_STRING_FORMAT, musicStoreDbName))); using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, logger)) { var deploymentResult = deployer.Deploy(); var httpClientHandler = new HttpClientHandler() { AllowAutoRedirect = false }; var httpClient = new HttpClient(httpClientHandler) { BaseAddress = new Uri(deploymentResult.ApplicationBaseUri) }; // Request to base address and check if various parts of the body are rendered & measure the cold startup time. var response = await RetryHelper.RetryRequest(async () => { return await httpClient.GetAsync(string.Empty); }, logger: logger, cancellationToken: deploymentResult.HostShutdownToken); Assert.False(response == null, "Response object is null because the client could not " + "connect to the server after multiple retries"); var validator = new Validator(httpClient, httpClientHandler, logger, deploymentResult); await validator.VerifyHomePage(response); // OpenIdConnect login. await validator.LoginWithOpenIdConnect(); logger.LogInformation("Variation completed successfully."); } } }
public async Task NonWindowsOS( ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl) { var smokeTestRunner = new SmokeTests(); await smokeTestRunner.SmokeTestSuite(serverType, runtimeFlavor, architecture, applicationBaseUrl); }
public void BroadcastPacketToServerClients(Packet pck, ServerType srvtype) { foreach (var srv in m_servers) { if (srv.SrvType == srvtype) { srv.BroadcastClientPacket(pck); } } }
public void AvailableServers(ServerType[] servers) { List<ServerType> meh = new List<ServerType>(servers); if (AvailableServerListReceived != null) { AvailableServerEventArgs asea = new AvailableServerEventArgs(); asea.ServerList = meh; AvailableServerListReceived(this, asea); } }
public async Task NtlmAuthenticationTest(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, ApplicationType applicationType, string applicationBaseUrl) { using (_logger.BeginScope("NtlmAuthenticationTest")) { var musicStoreDbName = DbUtils.GetUniqueName(); var deploymentParameters = new DeploymentParameters(Helpers.GetApplicationPath(applicationType), serverType, runtimeFlavor, architecture) { PublishApplicationBeforeDeployment = true, TargetFramework = runtimeFlavor == RuntimeFlavor.Clr ? "net451" : "netcoreapp1.0", ApplicationType = applicationType, ApplicationBaseUriHint = applicationBaseUrl, EnvironmentName = "NtlmAuthentication", //Will pick the Start class named 'StartupNtlmAuthentication' ServerConfigTemplateContent = (serverType == ServerType.IISExpress) ? File.ReadAllText("NtlmAuthentation.config") : null, SiteName = "MusicStoreNtlmAuthentication", //This is configured in the NtlmAuthentication.config UserAdditionalCleanup = parameters => { DbUtils.DropDatabase(musicStoreDbName, _logger); } }; // Override the connection strings using environment based configuration deploymentParameters.EnvironmentVariables .Add(new KeyValuePair<string, string>( MusicStore.StoreConfig.ConnectionStringKey, DbUtils.CreateConnectionString(musicStoreDbName))); using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, _logger)) { var deploymentResult = deployer.Deploy(); var httpClientHandler = new HttpClientHandler() { UseDefaultCredentials = true }; var httpClient = new HttpClient(httpClientHandler) { BaseAddress = new Uri(deploymentResult.ApplicationBaseUri) }; // Request to base address and check if various parts of the body are rendered & measure the cold startup time. var response = await RetryHelper.RetryRequest(async () => { return await httpClient.GetAsync(string.Empty); }, logger: _logger, cancellationToken: deploymentResult.HostShutdownToken); Assert.False(response == null, "Response object is null because the client could not " + "connect to the server after multiple retries"); var validator = new Validator(httpClient, httpClientHandler, _logger, deploymentResult); Console.WriteLine("Verifying home page"); await validator.VerifyNtlmHomePage(response); Console.WriteLine("Verifying access to store with permissions"); await validator.AccessStoreWithPermissions(); _logger.LogInformation("Variation completed successfully."); } } }
public async Task WindowsOS( ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, bool noSource) { var testRunner = new PublishAndRunTests(_logger); await testRunner.Publish_And_Run_Tests( serverType, runtimeFlavor, architecture, applicationBaseUrl, noSource); }
/** * Method creates an instance of EzeAPI with the given API configuration settings */ public static EzeAPI create(ServerType serverType) { if (null == API) { API = new EzeAPI(); API.initialize(); } API.setServerType(serverType); return API; }
public SocketServerSettings(ServerType serverType, Int32 maxConnections, Int32 backlog, Int32 maxSimultaneousAcceptOps, Int32 receiveBufferSize, Int32 opsToPreAlloc, IPEndPoint theLocalEndPoint) { this.ServerType = serverType; this.MaxConnections = maxConnections; this.NumberOfSaeaForReceiveSend = maxConnections; this.Backlog = backlog; this.MaxAcceptOps = maxSimultaneousAcceptOps; this.BufferSize = receiveBufferSize; this.OpsToPreAllocate = opsToPreAlloc; this.LocalEndPoint = theLocalEndPoint; }
public static ServerDescription Connected(ClusterId clusterId, EndPoint endPoint = null, ServerType serverType = ServerType.Standalone, TagSet tags = null, TimeSpan? averageRoundTripTime = null, Range<int> wireVersionRange = null) { return Disconnected(clusterId, endPoint).With( averageRoundTripTime: averageRoundTripTime ?? TimeSpan.FromMilliseconds(1), replicaSetConfig: null, state: ServerState.Connected, tags: tags, type: serverType, version: new SemanticVersion(2, 6, 3), wireVersionRange: wireVersionRange ?? new Range<int>(0, 2)); }
public IBaseObject Create(ServerType type) { switch (type) { case ServerType.Login: return new ServerLogin(new ServiceConfiguration()); //return new ServerLogin(new FreeUniverseServiceConfiguration(FreeUniverseServiceConfiguration.DEFAULT_CONFIG_FILE_PATH)); } return null; }
/// <summary> /// create server /// создать сервер /// </summary> /// <param name="type"> server type / тип сервера </param> /// <param name="neadLoadTicks"> shows whether upload ticks from storage. this is need for bots with QUIK or Plaza2 servers / нужно ли подгружать тики из хранилища. Актуально в режиме робота для серверов Квик, Плаза 2 </param> public static void CreateServer(ServerType type, bool neadLoadTicks) { try { if (_servers == null) { _servers = new List <IServer>(); } if (_servers.Find(server => server.ServerType == type) != null) { return; } IServer newServer = null; if (type == ServerType.FTX) { newServer = new FTXServer(); } if (type == ServerType.HuobiFuturesSwap) { newServer = new HuobiFuturesSwapServer(); } if (type == ServerType.HuobiFutures) { newServer = new HuobiFuturesServer(); } if (type == ServerType.HuobiSpot) { newServer = new HuobiSpotServer(); } if (type == ServerType.MfdWeb) { newServer = new MfdServer(); } if (type == ServerType.MoexDataServer) { newServer = new MoexDataServer(); } if (type == ServerType.Tinkoff) { newServer = new TinkoffServer(); } if (type == ServerType.Hitbtc) { newServer = new HitbtcServer(); } if (type == ServerType.GateIo) { newServer = new GateIoServer(); } if (type == ServerType.GateIoFutures) { newServer = new GateIoFuturesServer(); } if (type == ServerType.Bybit) { newServer = new BybitServer(); } if (type == ServerType.Zb) { newServer = new ZbServer(); } if (type == ServerType.Exmo) { newServer = new ExmoServer(); } if (type == ServerType.Livecoin) { newServer = new LivecoinServer(); } if (type == ServerType.BitMax) { newServer = new BitMaxProServer(); } if (type == ServerType.Transaq) { newServer = new TransaqServer(); } if (type == ServerType.Lmax) { newServer = new LmaxServer(); } if (type == ServerType.Bitfinex) { newServer = new BitfinexServer(); } if (type == ServerType.Binance) { newServer = new BinanceServer(); } if (type == ServerType.BinanceFutures) { newServer = new BinanceServerFutures(); } if (type == ServerType.NinjaTrader) { newServer = new NinjaTraderServer(); } if (type == ServerType.BitStamp) { newServer = new BitStampServer(); } if (type == ServerType.Kraken) { newServer = new KrakenServer(neadLoadTicks); } if (type == ServerType.Oanda) { newServer = new OandaServer(); } if (type == ServerType.BitMex) { newServer = new BitMexServer(); } if (type == ServerType.QuikLua) { newServer = new QuikLuaServer(); } if (type == ServerType.QuikDde) { newServer = new QuikServer(); } if (type == ServerType.InteractivBrokers) { newServer = new InteractivBrokersServer(); } else if (type == ServerType.SmartCom) { newServer = new SmartComServer(); } else if (type == ServerType.Plaza) { newServer = new PlazaServer(); } else if (type == ServerType.AstsBridge) { newServer = new AstsBridgeServer(neadLoadTicks); } else if (type == ServerType.Tester) { newServer = new TesterServer(); } else if (type == ServerType.Finam) { newServer = new FinamServer(); } if (newServer == null) { return; } _servers.Add(newServer); if (ServerCreateEvent != null) { ServerCreateEvent(newServer); } SendNewLogMessage(OsLocalization.Market.Message3 + _servers[_servers.Count - 1].ServerType, LogMessageType.System); } catch (Exception error) { SendNewLogMessage(error.ToString(), LogMessageType.Error); } }
public ServerEvent(ServerType type, int key, ByteBuffer buf) { _type = type; Key = key; Value = buf; }
public static IServerPermission GetServerPermission(ServerType type) { IServerPermission serverPermission = null; if (type == ServerType.Bitfinex) { serverPermission = _serversPermissions.Find(s => s.ServerType == type); if (serverPermission == null) { serverPermission = new BitFinexServerPermission(); _serversPermissions.Add(serverPermission); } return(serverPermission); } if (type == ServerType.MoexDataServer) { serverPermission = _serversPermissions.Find(s => s.ServerType == type); if (serverPermission == null) { serverPermission = new MoexIssPermission(); _serversPermissions.Add(serverPermission); } return(serverPermission); } if (type == ServerType.MfdWeb) { serverPermission = _serversPermissions.Find(s => s.ServerType == type); if (serverPermission == null) { serverPermission = new MfdServerPermission(); _serversPermissions.Add(serverPermission); } return(serverPermission); } if (type == ServerType.Finam) { serverPermission = _serversPermissions.Find(s => s.ServerType == type); if (serverPermission == null) { serverPermission = new FinamServerPermission(); _serversPermissions.Add(serverPermission); } return(serverPermission); } if (type == ServerType.Tinkoff) { serverPermission = _serversPermissions.Find(s => s.ServerType == type); if (serverPermission == null) { serverPermission = new TinkoffServerPermission(); _serversPermissions.Add(serverPermission); } return(serverPermission); } if (type == ServerType.HuobiSpot) { serverPermission = _serversPermissions.Find(s => s.ServerType == type); if (serverPermission == null) { serverPermission = new HuobiSpotServerPermission(); _serversPermissions.Add(serverPermission); } return(serverPermission); } if (type == ServerType.HuobiFutures) { serverPermission = _serversPermissions.Find(s => s.ServerType == type); if (serverPermission == null) { serverPermission = new HuobiFuturesServerPermission(); _serversPermissions.Add(serverPermission); } return(serverPermission); } if (type == ServerType.HuobiFuturesSwap) { serverPermission = _serversPermissions.Find(s => s.ServerType == type); if (serverPermission == null) { serverPermission = new HuobiFuturesSwapServerPermission(); _serversPermissions.Add(serverPermission); } return(serverPermission); } if (type == ServerType.GateIoFutures) { serverPermission = _serversPermissions.Find(s => s.ServerType == type); if (serverPermission == null) { serverPermission = new GateIoFuturesServerPermission(); _serversPermissions.Add(serverPermission); } return(serverPermission); } if (type == ServerType.Bybit) { serverPermission = _serversPermissions.Find(s => s.ServerType == type); if (serverPermission == null) { serverPermission = new BybitServerPermission(); _serversPermissions.Add(serverPermission); } return(serverPermission); } return(null); }
private async Task NtlmAuthenticationTest(ServerType serverType, RuntimeFlavor runtimeFlavor, ApplicationType applicationType) { var architecture = RuntimeArchitecture.x64; var testName = $"NtlmAuthentication_{serverType}_{runtimeFlavor}_{applicationType}"; using (StartLog(out var loggerFactory, testName)) { var logger = loggerFactory.CreateLogger("NtlmAuthenticationTest"); var musicStoreDbName = DbUtils.GetUniqueName(); var deploymentParameters = new DeploymentParameters(Helpers.GetApplicationPath(), serverType, runtimeFlavor, architecture) { PublishApplicationBeforeDeployment = true, PreservePublishedApplicationForDebugging = Helpers.PreservePublishedApplicationForDebugging, TargetFramework = Helpers.GetTargetFramework(runtimeFlavor), Configuration = Helpers.GetCurrentBuildConfiguration(), ApplicationType = applicationType, EnvironmentName = "NtlmAuthentication", //Will pick the Start class named 'StartupNtlmAuthentication' ServerConfigTemplateContent = (serverType == ServerType.IISExpress) ? File.ReadAllText(Path.Combine(AppContext.BaseDirectory, "NtlmAuthentation.config")) : null, SiteName = "MusicStoreNtlmAuthentication", //This is configured in the NtlmAuthentication.config UserAdditionalCleanup = parameters => { DbUtils.DropDatabase(musicStoreDbName, logger); } }; // Override the connection strings using environment based configuration deploymentParameters.EnvironmentVariables .Add(new KeyValuePair <string, string>( MusicStoreConfig.ConnectionStringKey, DbUtils.CreateConnectionString(musicStoreDbName))); using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, loggerFactory)) { var deploymentResult = await deployer.DeployAsync(); var httpClientHandler = new HttpClientHandler() { UseDefaultCredentials = true }; var httpClient = deploymentResult.CreateHttpClient(httpClientHandler); // Request to base address and check if various parts of the body are rendered & measure the cold startup time. var response = await RetryHelper.RetryRequest(async() => { return(await httpClient.GetAsync(string.Empty)); }, logger : logger, cancellationToken : deploymentResult.HostShutdownToken); Assert.False(response == null, "Response object is null because the client could not " + "connect to the server after multiple retries"); var validator = new Validator(httpClient, httpClientHandler, logger, deploymentResult); logger.LogInformation("Verifying home page"); await validator.VerifyNtlmHomePage(response); logger.LogInformation("Verifying access to store with permissions"); await validator.AccessStoreWithPermissions(); logger.LogInformation("Variation completed successfully."); } } }
/// <summary> /// Specifies a value that filters the server entries to return from the enumeration /// </summary> /// <param name="aServerType"></param> public Servers(ServerType aServerType) { Type = aServerType; }
public EmptyMessage(ServerType type) : base(type) { }
public Task CreateServerSimple(string serverName, string minecraftVersion, string minRam, string maxRam, string workingFolder, string jarFile, string secondaryVersionNumber, ServerType serverType, int port) { throw new NotImplementedException(); }
public void RegisterMethod(string method, string internalMethodName, string date) { if (ServerType == null) { throw new NullReferenceException("server type must be registered first"); } validateDate(date); validateEndpoint(method); FieldInfo schema; var methodInfo = ServerType.GetMethod(internalMethodName); var responseType = methodInfo.ReturnType; var requestType = methodInfo.GetParameters()[0]; if (methodInfo.GetParameters().Length != 1) { throw new Exception("methods can only have 1 parameter"); } if (method == null) { throw new Exception("no method could be found with that name"); } Dictionary <string, CrpcVersionRegistration> registration; if (Registrations.ContainsKey(method)) { registration = Registrations[method]; } else { registration = new Dictionary <string, CrpcVersionRegistration>(); } if (registration.ContainsKey(date)) { throw new Exception("duplicate date version found"); } var version = new CrpcVersionRegistration { ResponseType = responseType, Method = methodInfo, Date = date, }; // Request types are optional, and we only need to load the schema in if // a request as a payload. if (requestType != null) { schema = ServerType.GetField($"{internalMethodName}Schema"); if (schema == null) { throw new Exception("no schema could be found"); } if (!schema.IsStatic) { throw new Exception("schema must be static"); } if (schema.FieldType != typeof(string)) { throw new Exception("schema field must be a string"); } version.RequestType = requestType.ParameterType; version.Schema = JSchema.Parse(schema.GetValue(null) as string); } registration.Add(date, version); Registrations[method] = registration; }
/// <summary> /// the method in which the processing queue _candleSeriesNeadToStart is running /// метод, в котором работает поток обрабатывающий очередь _candleSeriesNeadToStart /// </summary> private async void CandleStarter() { try { while (true) { await Task.Delay(50); if (_isDisposed == true) { return; } if (MainWindow.ProccesIsWorked == false) { return; } if (_candleSeriesNeadToStart.Count != 0) { CandleSeries series = _candleSeriesNeadToStart.Dequeue(); if (series == null || series.IsStarted) { continue; } ServerType serverType = _server.ServerType; if (serverType == ServerType.Tester) { series.IsStarted = true; } else if (serverType == ServerType.Plaza || serverType == ServerType.QuikDde || serverType == ServerType.AstsBridge || serverType == ServerType.NinjaTrader || serverType == ServerType.Lmax || (serverType == ServerType.InteractivBrokers && (series.CandlesAll == null || series.CandlesAll.Count == 0))) { series.CandlesAll = null; // further, we try to load candles with ticks // далее, пытаемся пробуем прогрузить свечи при помощи тиков List <Trade> allTrades = _server.GetAllTradesToSecurity(series.Security); series.PreLoad(allTrades); // if there is a preloading of candles on the server and something is downloaded // если на сервере есть предзагрузка свечек и что-то скачалось series.UpdateAllCandles(); series.IsStarted = true; } else if (serverType == ServerType.SmartCom) { SmartComServer smart = (SmartComServer)_server; if (series.CandleCreateMethodType != CandleCreateMethodType.Simple || series.TimeFrameSpan.TotalMinutes < 1) { List <Trade> allTrades = _server.GetAllTradesToSecurity(series.Security); series.PreLoad(allTrades); } else { List <Candle> candles = smart.GetSmartComCandleHistory(series.Security.Name, series.TimeFrameSpan, 170); if (candles != null) { candles.Reverse(); series.CandlesAll = candles; } } series.UpdateAllCandles(); series.IsStarted = true; } else if (serverType == ServerType.Tinkoff) { TinkoffServer smart = (TinkoffServer)_server; if (series.CandleCreateMethodType != CandleCreateMethodType.Simple || series.TimeFrameSpan.TotalMinutes < 1 || series.TimeFrame == TimeFrame.Hour2 || series.TimeFrame == TimeFrame.Hour4 || series.TimeFrame == TimeFrame.Min20 || series.TimeFrame == TimeFrame.Min45) { List <Trade> allTrades = _server.GetAllTradesToSecurity(series.Security); series.PreLoad(allTrades); } else { List <Candle> candles = smart.GetCandleHistory(series.Security.NameId, series.TimeFrame); if (candles != null) { series.CandlesAll = candles; } } series.UpdateAllCandles(); series.IsStarted = true; } else if (serverType == ServerType.Tester || serverType == ServerType.InteractivBrokers || serverType == ServerType.Optimizer || serverType == ServerType.Oanda || serverType == ServerType.BitStamp ) { series.IsStarted = true; } else if (serverType == ServerType.QuikLua) { QuikLuaServer luaServ = (QuikLuaServer)_server; if (series.CandleCreateMethodType != CandleCreateMethodType.Simple || series.TimeFrameSpan.TotalMinutes < 1) { List <Trade> allTrades = luaServ.GetQuikLuaTickHistory(series.Security); if (allTrades != null && allTrades.Count != 0) { series.PreLoad(allTrades); } } else { List <Candle> candles = luaServ.GetQuikLuaCandleHistory(series.Security, series.TimeFrameSpan); if (candles != null) { //candles.Reverse(); series.CandlesAll = candles; } } series.UpdateAllCandles(); series.IsStarted = true; } else if (serverType == ServerType.BitMex) { BitMexServer bitMex = (BitMexServer)_server; if (series.CandleCreateMethodType != CandleCreateMethodType.Simple || series.TimeFrameSpan.TotalMinutes < 1) { List <Trade> allTrades = _server.GetAllTradesToSecurity(series.Security); series.PreLoad(allTrades); } else { List <Candle> candles = bitMex.GetBitMexCandleHistory(series.Security.Name, series.TimeFrameSpan); if (candles != null) { series.CandlesAll = candles; } } series.UpdateAllCandles(); series.IsStarted = true; } else if (serverType == ServerType.Kraken) { KrakenServer kraken = (KrakenServer)_server; if (series.CandleCreateMethodType != CandleCreateMethodType.Simple || series.TimeFrameSpan.TotalMinutes < 1) { List <Trade> allTrades = _server.GetAllTradesToSecurity(series.Security); series.PreLoad(allTrades); } else { List <Candle> candles = kraken.GetHistory(series.Security.Name, Convert.ToInt32(series.TimeFrameSpan.TotalMinutes)); if (candles != null) { series.CandlesAll = candles; } } series.UpdateAllCandles(); series.IsStarted = true; } else if (serverType == ServerType.Binance) { BinanceServer binance = (BinanceServer)_server; if (series.CandleCreateMethodType != CandleCreateMethodType.Simple || series.TimeFrameSpan.TotalMinutes < 1) { List <Trade> allTrades = _server.GetAllTradesToSecurity(series.Security); series.PreLoad(allTrades); } else { List <Candle> candles = binance.GetCandleHistory(series.Security.Name, series.TimeFrameSpan); if (candles != null) { series.CandlesAll = candles; } } series.UpdateAllCandles(); series.IsStarted = true; } else if (serverType == ServerType.BinanceFutures) { if (series.CandleCreateMethodType != CandleCreateMethodType.Simple || series.TimeFrameSpan.TotalMinutes < 1) { List <Trade> allTrades = _server.GetAllTradesToSecurity(series.Security); series.PreLoad(allTrades); } else { BinanceServerFutures binance = (BinanceServerFutures)_server; List <Candle> candles = binance.GetCandleHistory(series.Security.Name, series.TimeFrameSpan); if (candles != null) { series.CandlesAll = candles; } } series.UpdateAllCandles(); series.IsStarted = true; } else if (serverType == ServerType.BitMax) { BitMaxProServer bitMax = (BitMaxProServer)_server; if (series.CandleCreateMethodType != CandleCreateMethodType.Simple || series.TimeFrameSpan.TotalMinutes < 1) { List <Trade> allTrades = _server.GetAllTradesToSecurity(series.Security); series.PreLoad(allTrades); } else { List <Candle> candles = bitMax.GetCandleHistory(series.Security.Name, series.TimeFrameSpan); if (candles != null) { series.CandlesAll = candles; } } series.UpdateAllCandles(); series.IsStarted = true; } else if (serverType == ServerType.Bitfinex) { BitfinexServer bitfinex = (BitfinexServer)_server; if (series.CandleCreateMethodType != CandleCreateMethodType.Simple || series.TimeFrameSpan.TotalMinutes < 1) { List <Trade> allTrades = _server.GetAllTradesToSecurity(series.Security); series.PreLoad(allTrades); } else { List <Candle> candles = bitfinex.GetCandleHistory(series.Security.Name, series.TimeFrameSpan); if (candles != null) { series.CandlesAll = candles; } } series.UpdateAllCandles(); series.IsStarted = true; } else if (serverType == ServerType.Transaq) { TransaqServer transaq = (TransaqServer)_server; if (series.CandleCreateMethodType != CandleCreateMethodType.Simple || series.TimeFrameSpan.TotalMinutes < 1) { List <Trade> allTrades = _server.GetAllTradesToSecurity(series.Security); series.PreLoad(allTrades); series.UpdateAllCandles(); series.IsStarted = true; } else { transaq.GetCandleHistory(series); } } else if (serverType == ServerType.Livecoin || serverType == ServerType.Exmo) { List <Trade> allTrades = _server.GetAllTradesToSecurity(series.Security); series.PreLoad(allTrades); series.UpdateAllCandles(); series.IsStarted = true; } else if (serverType == ServerType.Zb) { ZbServer zbServer = (ZbServer)_server; if (series.CandleCreateMethodType != CandleCreateMethodType.Simple || series.TimeFrameSpan.TotalMinutes < 1) { List <Trade> allTrades = _server.GetAllTradesToSecurity(series.Security); series.PreLoad(allTrades); } else { List <Candle> candles = zbServer.GetCandleHistory(series.Security.Name, series.TimeFrameSpan); if (candles != null) { series.CandlesAll = candles; } } series.UpdateAllCandles(); series.IsStarted = true; } else if (serverType == ServerType.GateIo) { GateIoServer gateIoServer = (GateIoServer)_server; if (series.CandleCreateMethodType != CandleCreateMethodType.Simple || series.TimeFrameSpan.TotalMinutes < 1) { List <Trade> allTrades = _server.GetAllTradesToSecurity(series.Security); series.PreLoad(allTrades); } else { List <Candle> candles = gateIoServer.GetCandleHistory(series.Security.Name, series.TimeFrameSpan); if (candles != null) { series.CandlesAll = candles; } } series.UpdateAllCandles(); series.IsStarted = true; } else if (serverType == ServerType.GateIoFutures) { GateIoFuturesServer gateIoFutures = (GateIoFuturesServer)_server; if (series.CandleCreateMethodType != CandleCreateMethodType.Simple || series.TimeFrameSpan.TotalMinutes < 1) { List <Trade> allTrades = _server.GetAllTradesToSecurity(series.Security); series.PreLoad(allTrades); } else { List <Candle> candles = gateIoFutures.GetCandleHistory(series.Security.Name, series.TimeFrameSpan); if (candles != null) { series.CandlesAll = candles; } } series.UpdateAllCandles(); series.IsStarted = true; } else if (serverType == ServerType.Hitbtc) { HitbtcServer hitbtc = (HitbtcServer)_server; if (series.CandleCreateMethodType != CandleCreateMethodType.Simple || series.TimeFrameSpan.TotalMinutes < 1) { List <Trade> allTrades = _server.GetAllTradesToSecurity(series.Security); series.PreLoad(allTrades); } else { List <Candle> candles = hitbtc.GetCandleHistory(series.Security.Name, series.TimeFrameSpan); if (candles != null) { series.CandlesAll = candles; } } series.UpdateAllCandles(); series.IsStarted = true; } else if (serverType == ServerType.HuobiSpot) { HuobiSpotServer huobiSpot = (HuobiSpotServer)_server; if (series.CandleCreateMethodType != CandleCreateMethodType.Simple || series.TimeFrameSpan.TotalMinutes < 1) { List <Trade> allTrades = _server.GetAllTradesToSecurity(series.Security); series.PreLoad(allTrades); } else { List <Candle> candles = huobiSpot.GetCandleHistory(series.Security.Name, series.TimeFrameSpan); if (candles != null) { series.CandlesAll = candles; } } series.UpdateAllCandles(); series.IsStarted = true; } else if (serverType == ServerType.HuobiFutures) { HuobiFuturesServer huobi = (HuobiFuturesServer)_server; if (series.CandleCreateMethodType != CandleCreateMethodType.Simple || series.TimeFrameSpan.TotalMinutes < 1) { List <Trade> allTrades = _server.GetAllTradesToSecurity(series.Security); series.PreLoad(allTrades); } else { List <Candle> candles = huobi.GetCandleHistory(series.Security.Name, series.TimeFrameSpan); if (candles != null) { series.CandlesAll = candles; } } series.UpdateAllCandles(); series.IsStarted = true; } else if (serverType == ServerType.HuobiFuturesSwap) { HuobiFuturesSwapServer huobi = (HuobiFuturesSwapServer)_server; if (series.CandleCreateMethodType != CandleCreateMethodType.Simple || series.TimeFrameSpan.TotalMinutes < 1) { List <Trade> allTrades = _server.GetAllTradesToSecurity(series.Security); series.PreLoad(allTrades); } else { List <Candle> candles = huobi.GetCandleHistory(series.Security.Name, series.TimeFrameSpan); if (candles != null) { series.CandlesAll = candles; } } series.UpdateAllCandles(); series.IsStarted = true; } else if (serverType == ServerType.FTX) { FTXServer ftxServer = (FTXServer)_server; if (series.CandleCreateMethodType != CandleCreateMethodType.Simple || series.TimeFrameSpan.TotalMinutes < 1) { List <Trade> allTrades = _server.GetAllTradesToSecurity(series.Security); series.PreLoad(allTrades); } else { List <Candle> candles = ftxServer.GetCandleHistory(series.Security.Name, series.TimeFrameSpan); if (candles != null) { series.CandlesAll = candles; } } series.UpdateAllCandles(); series.IsStarted = true; } else if (serverType == ServerType.Bybit) { BybitServer bybit = (BybitServer)_server; if (series.CandleCreateMethodType != CandleCreateMethodType.Simple || series.TimeFrameSpan.TotalMinutes < 1) { List <Trade> allTrades = _server.GetAllTradesToSecurity(series.Security); series.PreLoad(allTrades); } else { List <Candle> candles = bybit.GetCandleHistory(series.Security.Name, series.TimeFrameSpan); if (candles != null) { series.CandlesAll = candles; } } series.UpdateAllCandles(); series.IsStarted = true; } } } } catch (Exception error) { SendLogMessage(error.ToString(), LogMessageType.Error); } }
public SoundsServer(ServerType serverType, ServerItemsReader serversReader) : base(serverType, serversReader) { }
private async Task RunSite(ServerType server, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl) { // calltwo and callthree in the expression below // increment on every call. // The test verifies that everything else stays the same // and that the two values that change are increasing in value string responseMatcher = @"---------- MyMiddleware ctor\r\n" + @"CallOne\[1\]\r\n" + @"CallTwo\[2\]\r\n" + @"CallThree\[3\]\r\n" + @"---------- context\.RequestServices\r\n" + @"CallOne\[1\]\r\n" + @"CallTwo\[(?<calltwo>\d+)\]\r\n" + @"CallThree\[(?<callthree>\d+)\]\r\n" + @"---------- Done\r\n"; var responseRegex = new Regex(responseMatcher, RegexOptions.Compiled | RegexOptions.Multiline); await TestServices.RunSiteTest( SiteName, server, runtimeFlavor, architecture, applicationBaseUrl, async (httpClient, logger, token) => { // ===== First call ===== var response = await RetryHelper.RetryRequest(async() => { return(await httpClient.GetAsync(string.Empty)); }, logger, token, retryCount: 30); var responseText = await response.Content.ReadAsStringAsync(); var match = responseRegex.Match(responseText); Assert.True(match.Success); var callTwo1 = int.Parse(match.Groups["calltwo"].Value); var callThree1 = int.Parse(match.Groups["callthree"].Value); // ===== Second call ===== response = await RetryHelper.RetryRequest(async() => { return(await httpClient.GetAsync(string.Empty)); }, logger, token, retryCount: 30); responseText = await response.Content.ReadAsStringAsync(); logger.LogResponseOnFailedAssert(response, responseText, () => { match = responseRegex.Match(responseText); Assert.True(match.Success); var callTwo2 = int.Parse(match.Groups["calltwo"].Value); var callThree2 = int.Parse(match.Groups["callthree"].Value); Assert.True(callTwo1 < callTwo2); Assert.True(callThree1 < callThree2); }); }); }
/// <summary> /// Gets servers of the specified type /// </summary> /// <param name="type"></param> /// <returns></returns> public IReadOnlyCollection <Server> GetServers(ServerType type) { return(_servers.ContainsKey(type) ? _servers[type] : ImmutableHashSet <Server> .Empty); }
public LocationMessage(ServerType type) : base(type) { }
public async Task Publish_And_Run_Tests( ServerType serverType, RuntimeArchitecture architecture, ApplicationType applicationType, bool noSource) { var noSourceStr = noSource ? "NoSource" : "WithSource"; var testName = $"PublishAndRunTests_{serverType}_{architecture}_{applicationType}_{noSourceStr}"; using (StartLog(out var loggerFactory, testName)) { var logger = loggerFactory.CreateLogger("Publish_And_Run_Tests"); var musicStoreDbName = DbUtils.GetUniqueName(); var deploymentParameters = new DeploymentParameters( Helpers.GetApplicationPath(applicationType), serverType, RuntimeFlavor.CoreClr, architecture) { PublishApplicationBeforeDeployment = true, PreservePublishedApplicationForDebugging = Helpers.PreservePublishedApplicationForDebugging, TargetFramework = "netcoreapp2.0", Configuration = Helpers.GetCurrentBuildConfiguration(), ApplicationType = applicationType, UserAdditionalCleanup = parameters => { DbUtils.DropDatabase(musicStoreDbName, logger); } }; // Override the connection strings using environment based configuration deploymentParameters.EnvironmentVariables .Add(new KeyValuePair <string, string>( MusicStoreConfig.ConnectionStringKey, DbUtils.CreateConnectionString(musicStoreDbName))); using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, loggerFactory)) { var deploymentResult = await deployer.DeployAsync(); var httpClientHandler = new HttpClientHandler() { UseDefaultCredentials = true }; var httpClient = deploymentResult.CreateHttpClient(httpClientHandler); // Request to base address and check if various parts of the body are rendered & // measure the cold startup time. // Add retry logic since tests are flaky on mono due to connection issues var response = await RetryHelper.RetryRequest(async() => await httpClient.GetAsync(string.Empty), logger : logger, cancellationToken : deploymentResult.HostShutdownToken); Assert.False(response == null, "Response object is null because the client could not " + "connect to the server after multiple retries"); var validator = new Validator(httpClient, httpClientHandler, logger, deploymentResult); logger.LogInformation("Verifying home page"); await validator.VerifyHomePage(response); logger.LogInformation("Verifying static files are served from static file middleware"); await validator.VerifyStaticContentServed(); if (serverType != ServerType.IISExpress) { if (Directory.GetFiles( deploymentParameters.ApplicationPath, "*.cmd", SearchOption.TopDirectoryOnly).Length > 0) { throw new Exception("publishExclude parameter values are not honored."); } } logger.LogInformation("Variation completed successfully."); } } }
public void LogUnknownIncomingPacket(NecConnection connection, NecPacket packet, ServerType serverType) { NecClient client = connection.client; if (client != null) { LogUnknownIncomingPacket(client, packet, serverType); return; } if (!_setting.logIncomingPackets) { return; } NecLogPacket logPacket = new NecLogPacket(connection.identity, packet, NecLogType.PacketUnhandled, serverType); WritePacket(logPacket); }
// private method private void AssertEvent(ServerDescriptionChangedEvent @event, EndPoint expectedEndPoint, ServerType expectedServerType, string expectedReasonStart, Type exceptionType = null) { @event.ServerId.ClusterId.Should().Be(__clusterId); @event.NewDescription.EndPoint.Should().Be(expectedEndPoint); @event.NewDescription.Type.Should().Be(expectedServerType); @event.NewDescription.State.Should().Be(expectedServerType == ServerType.Unknown ? ServerState.Disconnected : ServerState.Connected); if (exceptionType != null) { @event.NewDescription.HeartbeatException.Should().BeOfType(exceptionType); } else { @event.NewDescription.HeartbeatException.Should().BeNull(); } @event.NewDescription.ReasonChanged.Should().StartWith(expectedReasonStart); }
private bool IsArchitectureSupportedOnServer(RuntimeArchitecture arch, ServerType server) { // No x86 Mac/Linux runtime, don't generate a test variation that will always be skipped. return(!(arch == RuntimeArchitecture.x86 && ServerType.Nginx == server)); }
/// <summary> /// 安装下一个类型 /// </summary> protected override void nextCreate() { if ((Attribute.IsAbstract || Type.Type.IsSealed || !Type.Type.IsAbstract) && !Type.Type.IsInterface) { defaultServerName = Attribute.ServerName; defaultServer = null; defaultType = null; if (defaultServerName != null) { HashString nameKey = defaultServerName; if (!servers.TryGetValue(nameKey, out defaultServer)) { servers.Add(nameKey, defaultServer = new Server()); } defaultServer.Attribute.Name = defaultServerName; defaultServer.Types.Add(defaultType = new ServerType { Type = Type, Attribute = Attribute }); if (Attribute.IsServer) { defaultServer.AttributeType = Type; defaultServer.Attribute.CopyFrom(Attribute); } } foreach (MethodIndex method in MethodIndex.GetMethods <AutoCSer.Net.TcpStaticStreamServer.MethodAttribute>(Type, Attribute.GetMemberFilters, false, Attribute.IsAttribute, Attribute.IsBaseTypeAttribute)) { next(new TcpMethod { Method = method, MethodType = Type }); } if (!Type.Type.IsGenericType) { foreach (MemberIndexInfo member in StaticMemberIndexGroup.Get <AutoCSer.Net.TcpStaticStreamServer.MethodAttribute>(Type, Attribute.GetMemberFilters, false, Attribute.IsAttribute, Attribute.IsBaseTypeAttribute)) { if (member.IsField) { FieldInfo field = (FieldInfo)member.Member; TcpMethod getMethod = new TcpMethod { Method = new Metadata.MethodIndex(field, true), MemberIndex = member, MethodType = Type }; if (!getMethod.Attribute.IsOnlyGetMember) { getMethod.SetMethod = new TcpMethod { Method = new Metadata.MethodIndex(field, false), MemberIndex = member, MethodType = Type }; } next(getMethod); if (getMethod.SetMethod != null) { next(getMethod.SetMethod); } } else if (member.CanGet) { PropertyInfo property = (PropertyInfo)member.Member; TcpMethod getMethod = new TcpMethod { Method = new Metadata.MethodIndex(property, true), MemberIndex = member, MethodType = Type }; if (member.CanSet && !getMethod.Attribute.IsOnlyGetMember) { getMethod.SetMethod = new TcpMethod { Method = new Metadata.MethodIndex(property, false), MemberIndex = member, MethodType = Type }; } next(getMethod); if (getMethod.SetMethod != null) { next(getMethod.SetMethod); } } } } serverTypes.Empty(); } }
private void AssertNextEvent(EventCapturer eventCapturer, EndPoint expectedEndPoint, ServerType expectedServerType, string expectedReasonStart, Type exceptionType = null) { var @event = eventCapturer.Next().Should().BeOfType<ServerDescriptionChangedEvent>().Subject; AssertEvent(@event, expectedEndPoint, expectedServerType, expectedReasonStart, exceptionType); }
/// <summary> /// подгрузить в чарт новый инструмент /// </summary> /// <param name="security">бумага</param> /// <param name="timeFrameBuilder">объект хранящий в себе настройки построения свечей</param> /// <param name="portfolioName">портфель</param> /// <param name="serverType">тип сервера</param> public void SetNewSecurity(string security, TimeFrameBuilder timeFrameBuilder, string portfolioName, ServerType serverType) { if (ChartCandle != null) { ChartCandle.ClearDataPointsAndSizeValue(); ChartCandle.SetNewTimeFrame(timeFrameBuilder.TimeFrameTimeSpan, timeFrameBuilder.TimeFrame); } if (_securityOnThisChart == security && _timeFrameSecurity == timeFrameBuilder.TimeFrame) { return; } string lastSecurity = _securityOnThisChart; List <Position> positions = _myPosition; _timeFrameBuilder = timeFrameBuilder; _securityOnThisChart = security; _timeFrameSecurity = timeFrameBuilder.TimeFrame; _serverType = serverType; Clear(); PaintLabelOnSlavePanel(); if (lastSecurity == security && positions != null) { SetPosition(positions); } }
public static bool Process(ServerVersion version, string targetConnection, string repositoryConnection, int snapshotid, int databaseId, string databaseName, ServerType serverType) { Debug.Assert(version != ServerVersion.Unsupported); Debug.Assert(!string.IsNullOrEmpty(targetConnection)); Debug.Assert(!string.IsNullOrEmpty(repositoryConnection)); bool isOk = true; if (serverType != ServerType.AzureSQLDatabase) { targetConnection = Sql.SqlHelper.AppendDatabaseToConnectionString(targetConnection, "master"); } Program.ImpersonationContext wi = Program.SetLocalImpersonationContext(); if (version == ServerVersion.SQL2000) { return(true); } using (SqlConnection target = new SqlConnection(targetConnection), repository = new SqlConnection(repositoryConnection)) { try { // Open repository and target connections. repository.Open(); Program.SetTargetSQLServerImpersonationContext(); target.Open(); // Use bulk copy object to write to repository. using (SqlBulkCopy bcp = new SqlBulkCopy(repository)) { // Set the destination table. bcp.DestinationTableName = EncryptionKeyDataTable.RepositoryTable; bcp.BulkCopyTimeout = SQLCommandTimeout.GetSQLCommandTimeoutFromRegistry(); // Create the datatable to write to the repository. using (DataTable dataTable = EncryptionKeyDataTable.Create()) { // Process each rule to collect the table objects. string query = string.Format(GetQuery(version), databaseName); Debug.Assert(!string.IsNullOrEmpty(query)); // Query to get the table objects. using (SqlDataReader rdr = Sql.SqlHelper.ExecuteReader(target, null, CommandType.Text, query, null)) { while (rdr.Read()) { // Retrieve the object information. SqlString name = rdr.GetSqlString(ColName); SqlString algorithm = rdr.GetSqlString(ColAlgorithm); SqlString algorithmDesc = rdr.GetSqlString(ColAlgorithmDesc); SqlString provType = rdr.GetSqlString(ColProviderType); SqlString type = rdr.GetSqlString(ColType); SqlInt32 principalId = rdr.IsDBNull(ColPrincipalId) ? SqlInt32.Null : rdr.GetInt32(ColPrincipalId); SqlInt32 dbId = rdr.IsDBNull(ColDbKeyId) ? SqlInt32.Null : rdr.GetInt32(ColDbKeyId); SqlInt32 keyLength = rdr.IsDBNull(ColKeyLength) ? SqlInt32.Null : rdr.GetInt32(ColKeyLength); //todo add database id DataRow dr = dataTable.NewRow(); dr[EncryptionKeyDataTable.ParamSnapshotId] = snapshotid; dr[EncryptionKeyDataTable.ParamName] = name; dr[EncryptionKeyDataTable.ParamAlgorithm] = algorithm; dr[EncryptionKeyDataTable.ParamAlgorithmDesc] = algorithmDesc; dr[EncryptionKeyDataTable.ParamProviderType] = provType; dr[EncryptionKeyDataTable.ParamPrincipalId] = principalId; dr[EncryptionKeyDataTable.ParamDbKeyId] = dbId; dr[EncryptionKeyDataTable.ParamKeyLength] = keyLength; dr[EncryptionKeyDataTable.ParamDatabaseId] = databaseId; dr[EncryptionKeyDataTable.ParamType] = type; dataTable.Rows.Add(dr); if (dataTable.Rows.Count > Constants.RowBatchSize) { try { bcp.WriteToServer(dataTable); dataTable.Clear(); } catch (SqlException ex) { string strMessage = "Writing to Repository sql server keys faild"; logX.loggerX.Error("ERROR - " + strMessage, ex); throw; } } } // Write any items still in the data table. if (dataTable.Rows.Count > 0) { try { bcp.WriteToServer(dataTable); dataTable.Clear(); } catch (SqlException ex) { string strMessage = "Writing to Repository sql server keys faild"; logX.loggerX.Error("ERROR - " + strMessage, ex); throw; } } } } } } catch (SqlException ex) { string strMessage = "Processing sql server keys failed"; logX.loggerX.Error("ERROR - " + strMessage, ex); Database.CreateApplicationActivityEventInRepository(repositoryConnection, snapshotid, Collector.Constants.ActivityType_Error, Collector.Constants.ActivityEvent_Error, strMessage + ex.Message); AppLog.WriteAppEventError(SQLsecureEvent.ExErrExceptionRaised, SQLsecureCat.DlDataLoadCat, " SQL Server = " + new SqlConnectionStringBuilder(targetConnection).DataSource + strMessage, ex.Message); isOk = false; } finally { Program.RestoreImpersonationContext(wi); } } return(isOk); }
/// <summary> /// SQLsecure 3.1 (Anshul) - Validate server edition based on server type. /// </summary> public static bool ValidateServerEdition(ServerType serverType, string edition) { return(serverType == ServerType.AzureSQLDatabase ? edition == EditionName.SQLAzure : edition != EditionName.SQLAzure); }
/// <summary> /// /// </summary> /// <param name="serverType"></param> protected internal ServerEnumerator(ServerType serverType) : this(serverType, null) { }
public GenericFlagDialog(string text, Type enumType) : base(_getDisplay(Description.GetAnyDescription(enumType)), "cde.ico", SizeToContent.WidthAndHeight, ResizeMode.CanResize) { InitializeComponent(); _value = text.ToInt(); if (enumType.BaseType != typeof(Enum)) { throw new Exception("Invalid argument type, excepted an enum."); } if (enumType == typeof(MobModeType)) { if (DbPathLocator.GetServerType() == ServerType.RAthena && !ProjectConfiguration.UseOldRAthenaMode) { enumType = typeof(MobModeTypeNew); } } var values = Enum.GetValues(enumType).Cast <Enum>().ToList(); var valuesEnum = Enum.GetValues(enumType).Cast <int>().ToList(); string[] commands = Description.GetAnyDescription(enumType).Split('#'); if (commands.Any(p => p.StartsWith("max_col_width:"))) { _maxColWidth = Int32.Parse(commands.First(p => p.StartsWith("max_col_width")).Split(':')[1]); } GridIndexProvider provider = _findGrid(values); var toolTips = new string[values.Count]; if (!commands.Contains("disable_tooltips")) { for (int i = 0; i < values.Count; i++) { toolTips[i] = _getTooltip(Description.GetDescription(values[i])); } } AbstractProvider iProvider = new DefaultIndexProvider(0, values.Count); if (commands.Any(p => p.StartsWith("order:"))) { List <int> order = commands.First(p => p.StartsWith("order:")).Split(':')[1].Split(',').Select(Int32.Parse).ToList(); for (int i = 0; i < values.Count; i++) { if (!order.Contains(i)) { order.Add(i); } } iProvider = new SpecifiedIndexProvider(order); } ToolTipsBuilder.Initialize(toolTips, this); int row; int col; ServerType currentType = DbPathLocator.GetServerType(); for (int i = 0; i < values.Count; i++) { provider.Next(out row, out col); int index = (int)iProvider.Next(); CheckBox box = new CheckBox { Content = _getDisplay(Description.GetDescription(values[index])), Margin = new Thickness(3, 6, 3, 6), VerticalAlignment = VerticalAlignment.Center }; ServerType type = _getEmuRestrition(Description.GetDescription(values[index])); if ((type & currentType) != currentType) { box.IsEnabled = false; } box.Tag = valuesEnum[index]; WpfUtils.AddMouseInOutEffectsBox(box); _boxes.Add(box); _upperGrid.Children.Add(box); WpfUtilities.SetGridPosition(box, row, 2 * col); } _boxes.ForEach(_addEvents); }
public void ServerType_should_parse_document_correctly(string json, ServerType expected) { var subject = new IsMasterResult(BsonDocument.Parse(json)); subject.ServerType.Should().Be(expected); }
public AutobahnExpectations(ServerType server, bool ssl) { Server = server; Ssl = ssl; }
private bool CheckTfmIsSupportedForServer(string tfm, ServerType server) { // Not a combination we test return(!(Tfm.Matches(Tfm.Net461, tfm) && ServerType.Nginx == server)); }
/// <summary> /// create server /// создать сервер /// </summary> /// <param name="type"> server type / тип сервера </param> /// <param name="neadLoadTicks"> shows whether upload ticks from storage. this is need for bots with QUIK or Plaza2 servers / нужно ли подгружать тики из хранилища. Актуально в режиме робота для серверов Квик, Плаза 2 </param> public static void CreateServer(ServerType type, bool neadLoadTicks) { try { if (_servers == null) { _servers = new List <IServer>(); } if (_servers.Find(server => server.ServerType == type) != null) { return; } IServer newServer = null; if (type == ServerType.BitMax) { newServer = new BitMaxServer(); } if (type == ServerType.Transaq) { newServer = new TransaqServer(); } if (type == ServerType.Lmax) { newServer = new LmaxServer(); } if (type == ServerType.Bitfinex) { newServer = new BitfinexServer(); } if (type == ServerType.Binance) { newServer = new BinanceServer(); } if (type == ServerType.NinjaTrader) { newServer = new NinjaTraderServer(); } if (type == ServerType.BitStamp) { newServer = new BitStampServer(); } if (type == ServerType.Kraken) { newServer = new KrakenServer(neadLoadTicks); } if (type == ServerType.Oanda) { newServer = new OandaServer(); } if (type == ServerType.BitMex) { newServer = new BitMexServer(); } if (type == ServerType.QuikLua) { newServer = new QuikLuaServer(); } if (type == ServerType.QuikDde) { newServer = new QuikServer(); } if (type == ServerType.InteractivBrokers) { newServer = new InteractivBrokersServer(); } else if (type == ServerType.SmartCom) { newServer = new SmartComServer(); } else if (type == ServerType.Plaza) { newServer = new PlazaServer(); } else if (type == ServerType.AstsBridge) { newServer = new AstsBridgeServer(neadLoadTicks); } else if (type == ServerType.Tester) { newServer = new TesterServer(); } else if (type == ServerType.Finam) { newServer = new FinamServer(); } if (newServer == null) { return; } _servers.Add(newServer); if (ServerCreateEvent != null) { ServerCreateEvent(newServer); } SendNewLogMessage(OsLocalization.Market.Message3 + _servers[_servers.Count - 1].ServerType, LogMessageType.System); } catch (Exception error) { SendNewLogMessage(error.ToString(), LogMessageType.Error); } }
public async Task RunSite_AllPlatforms(ServerType server, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl) { await RunSite(server, runtimeFlavor, architecture, applicationBaseUrl); }
public async Task RunSite_NonWindowsOnly(ServerType server, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl) { await RunSite(server, runtimeFlavor, architecture, applicationBaseUrl); }