public async Task <IRawGraphClient> CreateAndConnectGraphClient(Neo4jVersion version = Neo4jVersion.Neo19) { var graphClient = CreateGraphClient(version); await graphClient.ConnectAsync(); return(graphClient); }
public IRawGraphClient CreateAndConnectGraphClient(Neo4jVersion version = Neo4jVersion.Neo19) { var graphClient = CreateGraphClient(version); graphClient.Connect(); return(graphClient); }
public GraphClient CreateGraphClient(Neo4jVersion neoVersion) { if (!recordedResponses.Keys.Any(r => r.Resource == "" || r.Resource == "/")) { MockResponse response; switch (neoVersion) { case Neo4jVersion.Neo19: response = MockResponse.NeoRoot(1, 9, 0); break; case Neo4jVersion.Neo20: response = MockResponse.NeoRoot20(); break; case Neo4jVersion.Neo22: response = MockResponse.NeoRoot(2, 2, 0); break; case Neo4jVersion.Neo225: response = MockResponse.NeoRoot(2, 2, 5); break; case Neo4jVersion.Neo226: response = MockResponse.NeoRoot(2, 2, 6); break; case Neo4jVersion.Neo23: response = MockResponse.NeoRoot(2, 3, 0); break; case Neo4jVersion.Neo30: response = MockResponse.NeoRoot(3, 0, 0); break; case Neo4jVersion.Neo40: response = MockResponse.NeoRoot(4, 0, 0); break; default: throw new ArgumentOutOfRangeException(nameof(neoVersion), neoVersion, null); } Add(MockRequest.Get(""), response); } var httpClient = GenerateHttpClient(BaseUri); var graphClient = new GraphClient(new Uri(BaseUri), httpClient); return(graphClient); }
protected Neo4jV3ProcessBasedInstanceProvider(string neo4jHomeFolder, IFileCopy fileCopy, Neo4jVersion neo4jVersion, Neo4jEndpoints endpoints) { this.neo4jHomeFolder = neo4jHomeFolder; this.fileCopy = fileCopy; neo4jConfigFolder = Path.Combine(neo4jHomeFolder, "conf"); Version = neo4jVersion; Endpoints = endpoints; configEditors = new Dictionary <string, ConfigEditor> { { Neo4jConfigFile, new ConfigEditor(Path.Combine(neo4jConfigFolder, Neo4jConfigFile)) } }; }
public GraphClient CreateGraphClient(Neo4jVersion neoVersion) { if (!recordedResponses.Keys.Any(r => r.Resource == "" || r.Resource == "/")) { MockResponse response; switch (neoVersion) { case Neo4jVersion.Neo19: response = MockResponse.NeoRoot(); break; case Neo4jVersion.Neo20: response = MockResponse.NeoRoot20(); break; case Neo4jVersion.Neo22: response = MockResponse.NeoRoot(2,2,0); break; case Neo4jVersion.Neo225: response = MockResponse.NeoRoot(2,2,5); break; case Neo4jVersion.Neo226: response = MockResponse.NeoRoot(2,2,6); break; case Neo4jVersion.Neo23: response = MockResponse.NeoRoot(2,3,0); break; default: throw new ArgumentOutOfRangeException("neoVersion", neoVersion, null); } Add(MockRequest.Get(""), response); } var httpClient = GenerateHttpClient(BaseUri); var graphClient = new GraphClient(new Uri(BaseUri), httpClient); return graphClient; }
public Neo4jV3JavaInstanceProvider(string javaPath, string neo4jHomeFolder, IFileCopy fileCopy, Neo4jVersion neo4jVersion, Neo4jEndpoints endpoints) :base(neo4jHomeFolder, fileCopy, neo4jVersion, endpoints) { this.javaPath = javaPath; }
public DeploymentsModule(INeo4jDeploymentsPool pool, IMapper mapper, INeo4jVersionRepository versionRepository) : base("/deployments") { // Get all deployments Get("/", _ => { var viewModel = new DeploymentsViewModel { Deployments = mapper.Map <IEnumerable <Deployment> >(pool) }; return(Negotiate .WithModel(viewModel) .WithView("Deployments")); }); // Get single deployment Get("/{Id}", ctx => { string id = ctx.Id.ToString(); var viewModel = mapper.Map <Deployment>(pool.Single(d => d.Key == id)); return(Negotiate .WithModel(viewModel) .WithView("Deployment")); }); // Create new deployment Get("/create", _ => { var viewModel = new DeploymentRequest { Versions = versionRepository.GetVersions(), Id = $"{pool.Count + 1}" }; return(Negotiate .WithModel(viewModel) .WithView("Create")); }); // Create deployment Post("/create", async(ctx, ct) => { var deployment = this.Bind <DeploymentRequest>(); var version = versionRepository.GetVersions().Single(v => v.VersionNumber == deployment.Version); var neo4jVersion = new Neo4jVersion { Architecture = (Neo4jArchitecture)Enum.Parse(typeof(Neo4jArchitecture), version.Architecture), DownloadUrl = version.DownloadUrl, Version = version.VersionNumber, ZipFileName = version.ZipFileName }; await Task.Run(() => pool.Create(neo4jVersion, deployment.Id)); var location = $"{ModulePath}/{deployment.Id}"; return(Response.AsRedirect(location)); }); // Delete all deployments Delete("/all", async(ctx, ct) => { await Task.Run(() => pool.DeleteAll()); await Task.Run(() => Helper.KillNeo4jServices()); await Task.Run(() => HostHelper.KillJavaProcesses()); return((Response)null); }); // Delete single deployment Delete("/{Id}", async(ctx, ct) => { string id = ctx.Id.ToString(); await Task.Run(() => pool.Delete(id)); return(HttpStatusCode.NoContent); }); // Start instance Post("/{Id}/start", async(ctx, ct) => { string id = ctx.Id.ToString(); await pool[id].Start(ct); return((Response)null); }); // Stop instance Post("/{Id}/stop", async(ctx, ct) => { string id = ctx.Id.ToString(); await pool[id].Stop(ct); return((Response)null); }); // Restart instance Post("/{Id}/restart", async(ctx, ct) => { string id = ctx.Id.ToString(); await pool[id].Restart(ct); return((Response)null); }); // Clear instance (delete data) Post("/{Id}/clear", async(ctx, ct) => { string id = ctx.Id.ToString(); await pool[id].Clear(ct); return((Response)null); }); // Backup instance data Post("/{Id}/backup", async(ctx, ct) => { string id = ctx.Id.ToString(); var backup = this.Bind <BackupRequest>(); await pool[id].Backup(ct, backup.DestinationPath, backup.StopInstanceBeforeBackup); return((Response)null); }); // Restore instance data Post("/{Id}/restore", async(ctx, ct) => { string id = ctx.Id.ToString(); var restore = this.Bind <RestoreRequest>(); await pool[id].Restore(ct, restore.SourcePath); return((Response)null); }); // Modify instance config Post("/{Id}/config", async(ctx, ct) => { string id = ctx.Id.ToString(); var config = this.Bind <ConfigureRequest>(); await Task.Run(() => pool[id].Configure(config.ConfigFile, config.Key, config.Value)); return((Response)null); }); }
public IRawGraphClient CreateAndConnectGraphClient(Neo4jVersion version = Neo4jVersion.Neo19) { var graphClient = CreateGraphClient(version); graphClient.Connect(); return graphClient; }
public Neo4jV3PowerShellInstanceProvider(string neo4jHomeFolder, IFileCopy fileCopy, Neo4jVersion neo4jVersion, Neo4jEndpoints endpoints) : base(neo4jHomeFolder, fileCopy, neo4jVersion, endpoints) { }
public async Task <ITransactionalGraphClient> CreateAndConnectTransactionalGraphClient(Neo4jVersion version = Neo4jVersion.Neo20) { var graphClient = CreateGraphClient(version); await graphClient.ConnectAsync(); return(graphClient); }