public PackageInstaller(EnvironmentSettings environmentSettings, IApplicationClientFactory applicationClientFactory, IApplication application, IPackageArchiver packageArchiver, ISqlScriptExecutor scriptExecutor, IServiceUrlBuilder serviceUrlBuilder, IFileSystem fileSystem, ILogger logger) { environmentSettings.CheckArgumentNull(nameof(environmentSettings)); applicationClientFactory.CheckArgumentNull(nameof(applicationClientFactory)); application.CheckArgumentNull(nameof(application)); packageArchiver.CheckArgumentNull(nameof(packageArchiver)); scriptExecutor.CheckArgumentNull(nameof(scriptExecutor)); serviceUrlBuilder.CheckArgumentNull(nameof(serviceUrlBuilder)); fileSystem.CheckArgumentNull(nameof(fileSystem)); _environmentSettings = environmentSettings; _applicationClientFactory = applicationClientFactory; _application = application; _packageArchiver = packageArchiver; _scriptExecutor = scriptExecutor; _serviceUrlBuilder = serviceUrlBuilder; _fileSystem = fileSystem; _logger = logger; _applicationClient = _applicationClientFactory.CreateClient(_environmentSettings); _applicationClientForLog = _applicationClientFactory.CreateClient(_environmentSettings); _developerModeEnabled = _environmentSettings.DeveloperModeEnabled.HasValue && _environmentSettings.DeveloperModeEnabled.Value; }
public PBXConnection(ILogger log, IRegistryConfigurationProvider config, IApplicationClient ac, IClock c) { _log = log; _config = config; _ac = ac; _c = c; }
public string Execute(string sql, IApplicationClient applicationClient, EnvironmentSettings settings) { var scriptData = "{ \"script\":\"" + sql + "\"}"; string responseFormServer = applicationClient.ExecutePostRequest( settings.IsNetCore ? settings.Uri + ExecuteSqlScriptUrl : settings.Uri + "/0" + ExecuteSqlScriptUrl, scriptData); return(CorrectJson(responseFormServer)); }
public PMSParser(PBXConfiguration config, ILogger log, IMessageConnectionFactory cf, IApplicationClient ac, IClock c) : base(config, log, cf, ac, c) { var lexer = new PMSByteStreamLexer(); lexer.EnquireRecieved += EnquireReceived; RegisterLexer(lexer); }
protected PBXParser(PBXConfiguration config, ILogger log, IMessageConnectionFactory cf, IApplicationClient ac, IClock c) { Log = log; CF = cf; AC = ac; C = c; Transport = GetConfiguredTransport(log, config); Transport.DataArrived += TransportDataArrived; }
public Application(EnvironmentSettings environmentSettings, IApplicationClient applicationClient, IServiceUrlBuilder serviceUrlBuilder) { environmentSettings.CheckArgumentNull(nameof(environmentSettings)); applicationClient.CheckArgumentNull(nameof(applicationClient)); serviceUrlBuilder.CheckArgumentNull(nameof(serviceUrlBuilder)); _environmentSettings = environmentSettings; _applicationClient = applicationClient; _serviceUrlBuilder = serviceUrlBuilder; }
public ApplicationPackageListProvider(IApplicationClient applicationClient, IJsonConverter jsonConverter, IServiceUrlBuilder serviceUrlBuilder) { applicationClient.CheckArgumentNull(nameof(applicationClient)); jsonConverter.CheckArgumentNull(nameof(jsonConverter)); serviceUrlBuilder.CheckArgumentNull(nameof(serviceUrlBuilder)); _applicationClient = applicationClient; _jsonConverter = jsonConverter; _packagesListServiceUrl = serviceUrlBuilder.Build("/rest/CreatioApiGateway/GetPackages"); }
public static void TestAdd(int NumUser, int n, ClientContext cc, IApplicationClient ic, Action Completed) { ic.TestAdd(new TestAddRequest { Left = n - 1, Right = n + 1 }).ContinueWith(t => { var r = t.Result; Trace.Assert(r.Result == 2 * n); Completed(); }); }
private static async Task <bool> HandleLine(IApplicationClient InnerClient, Action <SecureContext> SetSecureContext, bool UseOld, string Line) { if (Line == "exit") { await InnerClient.Quit(new QuitRequest()); return(false); } if (Line == "shutdown") { var r = await InnerClient.Shutdown(new ShutdownRequest()); if (r.OnSuccess) { Console.WriteLine("服务器正在关闭。"); } return(false); } if (Line == "secure") { await InnerClient.SendMessage(new SendMessageRequest { Content = Line }); //生成测试用确定Key var ServerToken = Enumerable.Range(0, 41).Select(i => (Byte)(i)).ToArray(); var ClientToken = Enumerable.Range(0, 41).Select(i => (Byte)(40 - i)).ToArray(); SetSecureContext(new SecureContext { ServerToken = ServerToken, ClientToken = ClientToken }); } else if (UseOld) { var r = await InnerClient.SendMessageAt1(new SendMessageAt1Request { Id = 1, Message = new MessageAt2 { Title = "", Lines = new List <String> { Line } } }); if (r.OnTitleTooLong || r.OnLinesTooLong || r.OnLineTooLong) { Console.WriteLine("消息过长。"); } } else { var r = await InnerClient.SendMessage(new SendMessageRequest { Content = Line }); if (r.OnTooLong) { Console.WriteLine("消息过长。"); } } return(true); }
public HealthCheckCommand(IApplicationClient applicationClient, EnvironmentSettings settings) : base(applicationClient, settings) { _handler = new HttpClientHandler(); //Skip SSL cert validation _handler.ClientCertificateOptions = ClientCertificateOption.Manual; _handler.ServerCertificateCustomValidationCallback = (httpRequestMessage, cert, certChail, sslPolicyErrors) => { return(true); }; _httpClient = new HttpClient(_handler); _httpClient.BaseAddress = new Uri(RootPath); }
public string Execute(string sql, IApplicationClient applicationClient, EnvironmentSettings settings) { var scriptData = new { script = sql }; string serializedRequestPayload = JsonConvert.SerializeObject(scriptData); string endpointUri = settings.IsNetCore ? settings.Uri + ExecuteSqlScriptUrl : settings.Uri + "/0" + ExecuteSqlScriptUrl; string responseFormServer = applicationClient.ExecutePostRequest(endpointUri, serializedRequestPayload); return(CorrectJson(responseFormServer)); }
public static void TestMultiply(int NumUser, int n, ClientContext cc, IApplicationClient ic, Action Completed) { double v = n; var o = v * 1000001 * 0.5; ic.TestMultiply(new TestMultiplyRequest { Operand = n }).ContinueWith(t => { var r = t.Result; Trace.Assert(Math.Abs(r.Result - o) < 0.01); Completed(); }); }
public static void TestText(int NumUser, int n, ClientContext cc, IApplicationClient ic, Action Completed) { var ss = n.ToString(); String s = String.Join("", Enumerable.Range(0, 10000 / ss.Length).Select(i => ss).ToArray()).Substring(0, 4096 - 256); ic.TestText(new TestTextRequest { Text = s }).ContinueWith(t => { var r = t.Result; Trace.Assert(String.Equals(r.Result, s)); Completed(); }); }
public void ClearRedisDb_FormsCorrectApplicationRequest_WhenApplicationRunsUnderNetCore() { IApplicationClient applicationClient = Substitute.For <IApplicationClient>(); var testUri = "TestUri"; var settings = new EnvironmentSettings { Uri = testUri, IsNetCore = true }; RedisCommand redisCommand = new RedisCommand(applicationClient, settings); var clearRedisOptions = Substitute.For <ClearRedisOptions>(); redisCommand.Execute(clearRedisOptions); applicationClient.Received(1).ExecutePostRequest( testUri + "/ServiceModel/AppInstallerService.svc/ClearRedisDb", "{}", Timeout.Infinite); }
public static void TestMessage(int NumUser, int n, ClientContext cc, IApplicationClient ic, Action Completed) { var s = n.ToString(); ic.TestMessage(new TestMessageRequest { Message = s }).ContinueWith(t => { //Trace.Assert(r.Success == cc.NumOnline); cc.Num -= 1; if (cc.Num == 0) { Completed(); } }); }
public void Delete_FormsCorrectApplicationRequest_WhenApplicationRunsUnderNetFramework() { IApplicationClient applicationClient = Substitute.For <IApplicationClient>(); DeletePackageCommand deleteCommand = new DeletePackageCommand(applicationClient); var deleteOptions = new DeletePkgOptions { Login = "******", Password = "******", IsNetCore = false, Maintainer = "Test", Uri = "http://test.domain.com", Name = "TestPackage" }; deleteCommand.Delete(deleteOptions); applicationClient.Received(1).ExecutePostRequest( deleteOptions.Uri + "/0/ServiceModel/AppInstallerService.svc/DeletePackage", "\"TestPackage\"", Arg.Any <int>()); }
public void RestartCommand_FormsCorrectApplicationRequest_WhenApplicationRunsUnderNetCoreAndSettingsPickedFromEnvironment() { IApplicationClient applicationClient = Substitute.For <IApplicationClient>(); var environmentSettings = new EnvironmentSettings { Login = "******", Password = "******", IsNetCore = true, Maintainer = "Test", Uri = "http://test.domain.com" }; RestartCommand restartCommand = new RestartCommand(applicationClient, environmentSettings); var options = Substitute.For <RestartOptions>(); restartCommand.Execute(options); applicationClient.Received(1).ExecutePostRequest( environmentSettings.Uri + "/ServiceModel/AppInstallerService.svc/RestartApp", "{}", Timeout.Infinite); }
public FeatureCommand(IApplicationClient applicationClient, EnvironmentSettings settings) : base(applicationClient, settings) { }
protected RemoteCommand(IApplicationClient applicationClient, EnvironmentSettings environmentSettings) { ApplicationClient = applicationClient; EnvironmentSettings = environmentSettings; }
public ZFingerDevice CreateZFingerDevice(IApplicationClient client) { ZFingerDevice ret = new ZFingerDevice(client.SessionId, client.SessionClient, client.FrameClient, client.TransportClient); return(ret); }
public RestartCommand(IApplicationClient applicationClient, EnvironmentSettings settings) : base(applicationClient, settings) { }
public SMDRParser(PBXConfiguration config, ILogger log, IMessageConnectionFactory cf, IApplicationClient ac, IClock c) : base(config, log, cf, ac, c) { RegisterLexer(new CRLFByteSreamLineLexer()); }
public static void TestMessageInitializeClientContext(int NumUser, int n, ClientContext cc, IApplicationClient ic, Action Completed) { ic.TestMessageReceived += e => { var Done = false; lock (cc.Lockee) { cc.Sum += Int32.Parse(e.Message); cc.Num -= 1; Done = cc.Num == 0; } if (Done) { Completed(); } }; cc.NumOnline = NumUser; cc.Num = NumUser; }
public DeletePackageCommand(IApplicationClient applicationClient) : base(applicationClient) { }
public SqlScriptCommand(IApplicationClient applicationClient, EnvironmentSettings settings, ISqlScriptExecutor sqlScriptExecutor) : base(applicationClient, settings) { _sqlScriptExecutor = sqlScriptExecutor; }
public static void TestQuit(int NumUser, int n, ClientContext cc, IApplicationClient ic, Action Completed) { ic.Quit(new QuitRequest { }).ContinueWith(t => Completed()); }
public DeletePackageCommand(IApplicationClient applicationClient, EnvironmentSettings settings) : base(applicationClient, settings) { }
public CompileWorkspaceCommand(IApplicationClient applicationClient, EnvironmentSettings settings) : base(applicationClient, settings) { }
public AssemblyCommand(IApplicationClient applicationClient, EnvironmentSettings settings) : base(applicationClient, settings) { }
public GenerateModelsCommand(IApplicationClient applicationClient, EnvironmentSettings settings) : base(applicationClient, settings) { }