Beispiel #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shellConsoleShouldBeEnabledByDefault() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
            public virtual void ShellConsoleShouldBeEnabledByDefault()
            {
                Server = CommunityServerBuilder.server().usingDataDir(Folder.directory(Name.MethodName).AbsolutePath).build();
                Server.start();

                assertThat(Exec("ls", "shell").Status, @is(200));
            }
Beispiel #2
0
        /// <summary>
        /// This test makes sure that the database is able to start after having been stopped during initialization.
        ///
        /// In order to make sure that the server is stopped during startup we create a separate thread that calls stop.
        /// In order to make sure that this thread does not call stop before the startup procedure has started we use a
        /// custom implementation of a PageSwapperFactory, which communicates with the thread that calls stop. We do this
        /// via a static semaphore. </summary>
        /// <exception cref="IOException"> </exception>
        /// <exception cref="InterruptedException"> </exception>

//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldBeAbleToRestartWhenStoppedDuringStartup() throws java.io.IOException, InterruptedException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldBeAbleToRestartWhenStoppedDuringStartup()
        {
            // Make sure that the semaphore is in a clean state.
            _semaphore.drainPermits();
            // Get a server that uses our custom swapper.
            NeoServer server = GetNeoServer(CUSTOM_SWAPPER);

            try
            {
                AtomicBoolean failure = new AtomicBoolean();
                Thread        serverStoppingThread = ThreadTestUtils.fork(StopServerAfterStartingHasStarted(server, failure));
                server.Start();
                // Wait for the server to stop.
                serverStoppingThread.Join();
                // Check if the server stopped successfully.
                if (failure.get())
                {
                    fail("Server failed to stop.");
                }
                // Verify that we can start the server again.
                server = GetNeoServer(CUSTOM_SWAPPER);
                server.Start();
            }
            finally
            {
                server.Stop();
            }
        }
Beispiel #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void givenExplicitlyEnabledServerLoggingConfigurationShouldLogAccess() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void GivenExplicitlyEnabledServerLoggingConfigurationShouldLogAccess()
        {
            // given
            string directoryPrefix = _testName.MethodName;
            File   logDirectory    = _testDirectory.directory(directoryPrefix + "-logdir");
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String query = "?explicitlyEnabled=" + randomString();
            string query = "?explicitlyEnabled=" + RandomString();

            NeoServer server = serverOnRandomPorts().withDefaultDatabaseTuning().persistent().withProperty(ServerSettings.http_logging_enabled.name(), Settings.TRUE).withProperty(GraphDatabaseSettings.logs_directory.name(), logDirectory.AbsolutePath).withProperty((new BoltConnector("bolt")).listen_address.name(), ":0").usingDataDir(_testDirectory.directory(directoryPrefix + "-dbdir").AbsolutePath).build();

            try
            {
                server.Start();

                FunctionalTestHelper functionalTestHelper = new FunctionalTestHelper(server);

                // when
                JaxRsResponse response = (new RestRequest()).get(functionalTestHelper.ManagementUri() + query);
                assertThat(response.Status, @is(HttpStatus.SC_OK));
                response.Close();

                // then
                File httpLog = new File(logDirectory, "http.log");
                assertEventually("request appears in log", FileContentSupplier(httpLog), containsString(query), 5, TimeUnit.SECONDS);
            }
            finally
            {
                server.Stop();
            }
        }
Beispiel #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldShowServerMetrics() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldShowServerMetrics()
        {
            // Given
            File      metrics = Folder.file("metrics");
            NeoServer server  = EnterpriseServerBuilder.serverOnRandomPorts().usingDataDir(Folder.databaseDir().AbsolutePath).withProperty(MetricsSettings.metricsEnabled.name(), "true").withProperty(MetricsSettings.csvEnabled.name(), "true").withProperty(MetricsSettings.csvPath.name(), metrics.Path).withProperty(MetricsSettings.csvInterval.name(), "100ms").persistent().build();

            try
            {
                // when
                server.Start();

                string host = "http://localhost:" + server.BaseUri().Port + ServerSettings.rest_api_path.DefaultValue + "/transaction/commit";

                for (int i = 0; i < 5; i++)
                {
                    ClientResponse r = Client.create().resource(host).accept(APPLICATION_JSON).type(APPLICATION_JSON).post(typeof(ClientResponse), "{ 'statements': [ { 'statement': 'CREATE ()' } ] }");
                    assertEquals(200, r.Status);
                }

                // then
                AssertMetricsExists(metrics, ServerMetrics.THREAD_JETTY_ALL);
                AssertMetricsExists(metrics, ServerMetrics.THREAD_JETTY_IDLE);
            }
            finally
            {
                server.Stop();
            }
        }
Beispiel #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldBeAbleToRestartServer() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldBeAbleToRestartServer()
        {
            // Given
            string dataDirectory1 = _baseDir.directory("data1").AbsolutePath;
            string dataDirectory2 = _baseDir.directory("data2").AbsolutePath;

            Config config = Config.fromFile(EnterpriseServerBuilder.serverOnRandomPorts().withDefaultDatabaseTuning().usingDataDir(dataDirectory1).createConfigFiles()).withHome(_baseDir.directory()).withSetting(GraphDatabaseSettings.logs_directory, _baseDir.directory("logs").Path).build();

            // When
            NeoServer server = _cleanup.add(new OpenEnterpriseNeoServer(config, GraphDbDependencies()));

            server.Start();

            assertNotNull(server.Database.Graph);
            assertEquals(config.Get(GraphDatabaseSettings.database_path).AbsolutePath, server.Database.Location.AbsolutePath);

            // Change the database location
            config.Augment(GraphDatabaseSettings.data_directory, dataDirectory2);
            ServerManagement bean = new ServerManagement(server);

            bean.RestartServer();

            // Then
            assertNotNull(server.Database.Graph);
            assertEquals(config.Get(GraphDatabaseSettings.database_path).AbsolutePath, server.Database.Location.AbsolutePath);
        }
Beispiel #6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void givenExplicitlyDisabledServerLoggingConfigurationShouldNotLogAccesses() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void GivenExplicitlyDisabledServerLoggingConfigurationShouldNotLogAccesses()
        {
            // given
            string directoryPrefix = _testName.MethodName;
            File   logDirectory    = _testDirectory.directory(directoryPrefix + "-logdir");

            NeoServer server = serverOnRandomPorts().withDefaultDatabaseTuning().persistent().withProperty(ServerSettings.http_logging_enabled.name(), Settings.FALSE).withProperty(GraphDatabaseSettings.logs_directory.name(), logDirectory.ToString()).withProperty((new BoltConnector("bolt")).listen_address.name(), ":0").usingDataDir(_testDirectory.directory(directoryPrefix + "-dbdir").AbsolutePath).build();

            try
            {
                server.Start();
                FunctionalTestHelper functionalTestHelper = new FunctionalTestHelper(server);

                // when
                string        query    = "?implicitlyDisabled" + RandomString();
                JaxRsResponse response = (new RestRequest()).get(functionalTestHelper.ManagementUri() + query);

                assertThat(response.Status, @is(HttpStatus.SC_OK));
                response.Close();

                // then
                File httpLog = new File(logDirectory, "http.log");
                assertThat(httpLog.exists(), @is(false));
            }
            finally
            {
                server.Stop();
            }
        }
Beispiel #7
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldBeAbleToExplicitlySetConsolesToEnabled() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
            public virtual void ShouldBeAbleToExplicitlySetConsolesToEnabled()
            {
                Server = CommunityServerBuilder.server().withProperty(ServerSettings.console_module_engines.name(), "").usingDataDir(Folder.directory(Name.MethodName).AbsolutePath).build();
                Server.start();

                assertThat(Exec("ls", "shell").Status, @is(400));
            }
Beispiel #8
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldBeAbleToStartInHAMode() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldBeAbleToStartInHAMode()
        {
            // Given
            int       clusterPort = PortAuthority.allocatePort();
            NeoServer server      = EnterpriseServerBuilder.serverOnRandomPorts().usingDataDir(Folder.Root.AbsolutePath).withProperty(mode.name(), "HA").withProperty(server_id.name(), "1").withProperty(cluster_server.name(), ":" + clusterPort).withProperty(initial_hosts.name(), ":" + clusterPort).persistent().build();

            try
            {
                server.Start();
                server.Database;

                assertThat(server.Database.Graph, @is(instanceOf(typeof(HighlyAvailableGraphDatabase))));

                HTTP.Response haEndpoint = HTTP.GET(GetHaEndpoint(server));
                assertEquals(200, haEndpoint.Status());
                assertThat(haEndpoint.RawContent(), containsString("master"));

                HTTP.Response discovery = HTTP.GET(server.BaseUri().toASCIIString());
                assertEquals(200, discovery.Status());
            }
            finally
            {
                server.Stop();
            }
        }
Beispiel #9
0
 public InProcessServerControls(File serverFolder, File userLogFile, File internalLogFile, NeoServer server, System.IDisposable additionalClosable)
 {
     this._serverFolder       = serverFolder;
     this._userLogFile        = userLogFile;
     this._internalLogFile    = internalLogFile;
     this._server             = server;
     this._additionalClosable = additionalClosable;
 }
Beispiel #10
0
        public override ServerControls NewServer()
        {
            try
            {
                using (FileSystemAbstraction fileSystem = new DefaultFileSystemAbstraction())
                {
                    File userLogFile     = new File(_serverFolder, "neo4j.log");
                    File internalLogFile = new File(_serverFolder, "debug.log");

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.io.OutputStream logOutputStream;
                    Stream logOutputStream;
                    try
                    {
                        logOutputStream = createOrOpenAsOutputStream(fileSystem, userLogFile, true);
                    }
                    catch (IOException e)
                    {
                        throw new Exception("Unable to create log file", e);
                    }

                    _config[ServerSettings.third_party_packages.name()]           = ToStringForThirdPartyPackageProperty(_extensions.toList());
                    _config[GraphDatabaseSettings.store_internal_log_path.name()] = internalLogFile.AbsolutePath;

                    LogProvider userLogProvider            = FormattedLogProvider.withZoneId(LogZoneIdFrom(_config)).toOutputStream(logOutputStream);
                    GraphDatabaseDependencies dependencies = GraphDatabaseDependencies.newDependencies().userLogProvider(userLogProvider);
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: Iterable<org.neo4j.kernel.extension.KernelExtensionFactory<?>> kernelExtensions = append(new Neo4jHarnessExtensions(procedures), dependencies.kernelExtensions());
                    IEnumerable <KernelExtensionFactory <object> > kernelExtensions = append(new Neo4jHarnessExtensions(_procedures), dependencies.KernelExtensions());
                    dependencies = dependencies.KernelExtensions(kernelExtensions);

                    Config       dbConfig             = Config.defaults(_config);
                    GraphFactory graphFactory         = CreateGraphFactory(dbConfig);
                    bool         httpAndHttpsDisabled = dbConfig.EnabledHttpConnectors().Count == 0;

                    NeoServer server = httpAndHttpsDisabled ? new DisabledNeoServer(graphFactory, dependencies, dbConfig) : CreateNeoServer(graphFactory, dbConfig, dependencies);

                    InProcessServerControls controls = new InProcessServerControls(_serverFolder, userLogFile, internalLogFile, server, logOutputStream);
                    controls.Start();

                    try
                    {
                        _fixtures.applyTo(controls);
                    }
                    catch (Exception e)
                    {
                        controls.Close();
                        throw e;
                    }
                    return(controls);
                }
            }
            catch (IOException e)
            {
                throw new Exception(e);
            }
        }
Beispiel #11
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @BeforeClass public static void initServer() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public static void InitServer()
        {
            suppressAll().call((Callable <Void>)() =>
            {
                CommunityServerBuilder serverBuilder = EnterpriseServerBuilder.serverOnRandomPorts();

                PropertyExistenceConstraintsIT._server = ServerHelper.createNonPersistentServer(serverBuilder);
                return(null);
            });
        }
Beispiel #12
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @BeforeClass public static void setupServer() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public static void SetupServer()
        {
            Server = EnterpriseServerBuilder.serverOnRandomPorts().usingDataDir(StaticFolder.Root.AbsolutePath).build();

            suppressAll().call((Callable <Void>)() =>
            {
                Server.start();
                return(null);
            });
            FunctionalTestHelper = new FunctionalTestHelper(Server);
        }
Beispiel #13
0
        public FunctionalTestHelper(NeoServer server)
        {
            if (server.Database == null)
            {
//JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method:
                throw new Exception("Server must be started before using " + this.GetType().FullName);
            }
            this._helper  = new GraphDbHelper(server.Database);
            this._server  = server;
            this._request = new RestRequest(server.BaseUri().resolve("db/data/"));
        }
Beispiel #14
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldMakeJAXRSClassesAvailableViaHTTP() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldMakeJAXRSClassesAvailableViaHTTP()
        {
            CommunityServerBuilder builder = CommunityServerBuilder.server();

            _server = ServerHelper.createNonPersistentServer(builder);
            FunctionalTestHelper functionalTestHelper = new FunctionalTestHelper(_server);

            JaxRsResponse response = (new RestRequest()).get(functionalTestHelper.ManagementUri());

            assertEquals(200, response.Status);
            response.Close();
        }
Beispiel #15
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private static org.neo4j.server.NeoServer createServer(CommunityServerBuilder builder, boolean persistent, java.io.File path) throws java.io.IOException
        private static NeoServer CreateServer(CommunityServerBuilder builder, bool persistent, File path)
        {
            if (persistent)
            {
                builder = builder.Persistent();
            }
            builder.OnRandomPorts();
            NeoServer server = builder.UsingDataDir(path != null ? path.AbsolutePath : null).build();

            server.Start();
            return(server);
        }
Beispiel #16
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected:
//ORIGINAL LINE: public static void cleanTheDatabase(final org.neo4j.server.NeoServer server)
        public static void CleanTheDatabase(NeoServer server)
        {
            if (server == null)
            {
                return;
            }

            RollbackAllOpenTransactions(server);

            CleanTheDatabase(server.Database.Graph);

            RemoveLogs(server);
        }
Beispiel #17
0
        private static void RemoveLogs(NeoServer server)
        {
            File logDir = new File(server.Database.Location + File.separator + ".." + File.separator + "log");

            try
            {
                FileUtils.deleteDirectory(logDir);
            }
            catch (IOException e)
            {
                throw new Exception(e);
            }
        }
Beispiel #18
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testPluginInitialization()
        public virtual void TestPluginInitialization()
        {
            Config    config    = Config.defaults(ServerSettings.transaction_idle_timeout, "600");
            NeoServer neoServer = Mockito.mock(typeof(NeoServer), Mockito.RETURNS_DEEP_STUBS);

            Mockito.when(neoServer.Config).thenReturn(config);
            ExtensionInitializer extensionInitializer = new ExtensionInitializer(neoServer);

//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: java.util.Collection<org.neo4j.server.plugins.Injectable<?>> injectableProperties = extensionInitializer.initializePackages(java.util.Collections.singletonList("org.neo4j.server.modules"));
            ICollection <Injectable <object> > injectableProperties = extensionInitializer.InitializePackages(Collections.singletonList("org.neo4j.server.modules"));

            assertTrue(injectableProperties.Any(i => ServerSettings.transaction_idle_timeout.name().Equals(i.Value)));
        }
Beispiel #19
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @AfterClass public static void shutdownServer()
        public static void ShutdownServer()
        {
            try
            {
                if (_server != null)
                {
                    _server.stop();
                }
            }
            finally
            {
                _server = null;
            }
        }
Beispiel #20
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: static synchronized org.neo4j.server.NeoServer allocate() throws java.io.IOException
        internal static NeoServer Allocate()
        {
            lock (typeof(ServerHolder))
            {
                if (_allocation != null)
                {
                    throw _allocation;
                }
                if (_server == null)
                {
                    _server = StartServer();
                }
                _allocation = new AssertionError("The server was allocated from here but not released properly");
                return(_server);
            }
        }
Beispiel #21
0
 private ThreadStart StopServerAfterStartingHasStarted(NeoServer server, AtomicBoolean failure)
 {
     return(() =>
     {
         try
         {
             // Make sure that we have started the startup procedure before calling stop.
             _semaphore.acquire();
             server.Stop();
         }
         catch (Exception)
         {
             failure.set(true);
         }
     });
 }
Beispiel #22
0
        public NeoPlayerWindow()
        {
            neoServer            = new NeoServer();
            neoServer.OnMessage += OnMessage;
            neoServer.OnConnect += OnConnect;
            neoServer.Run(Settings.Port);

            status      = new Status(neoServer);
            updateState = new SingleRunner(UpdateState);
            slides.CollectionChanged += (s, e) => updateState.Signal();
            music.CollectionChanged  += (s, e) => updateState.Signal();
            queue.CollectionChanged  += (s, e) => { status.Queue = queue.Select(videoFile => videoFile.VideoFileID).ToList(); updateState.Signal(); };

            InitializeComponent();

            // Keep screen/computer on
            Win32.SetThreadExecutionState(Win32.ES_CONTINUOUS | Win32.ES_DISPLAY_REQUIRED | Win32.ES_SYSTEM_REQUIRED);

            var random = new Random();

            Directory.EnumerateFiles(Settings.MusicPath).OrderBy(x => random.Next()).Select(fileName => new MusicFile {
                FileName = fileName, Title = Path.GetFileNameWithoutExtension(fileName)
            }).ForEach(file => music.Add(file));

            SlidesQuery      = Helpers.Debug ? "test" : "saved:pics";
            SlidesSize       = "2mp";
            SlideDisplayTime = 60;
            SlidesPlaying    = true;
            VideoState       = null;
            MusicState       = null;
            Volume           = 50;

            mediaPlayer.MediaEnded  += (s, e) => { AddHistory(); MediaForward(); };
            mediaPlayer.MediaFailed += (s, e) => MediaForward();

            changeSlideTimer = new DispatcherTimer {
                Interval = TimeSpan.FromSeconds(0.25)
            };
            changeSlideTimer.Tick += (s, e) => CheckCycleSlide();
            changeSlideTimer.Start();

            UpdateVideoFiles();

            status.History   = new List <int>();
            status.Queue     = new List <int>();
            status.Downloads = new List <DownloadData>();
        }
Beispiel #23
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldLoadThirdPartyJaxRsClasses() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldLoadThirdPartyJaxRsClasses()
        {
            _server = CommunityServerBuilder.serverOnRandomPorts().withThirdPartyJaxRsPackage("org.dummy.web.service", DummyThirdPartyWebService.DUMMY_WEB_SERVICE_MOUNT_POINT).usingDataDir(Folder.directory(Name.MethodName).AbsolutePath).build();
            _server.start();

            URI    thirdPartyServiceUri = (new URI(_server.baseUri().ToString() + DummyThirdPartyWebService.DUMMY_WEB_SERVICE_MOUNT_POINT)).normalize();
            string response             = CLIENT.resource(thirdPartyServiceUri.ToString()).get(typeof(string));

            assertEquals("hello", response);

            // Assert that extensions gets initialized
            int nodesCreated = CreateSimpleDatabase(_server.Database.Graph);

            thirdPartyServiceUri = (new URI(_server.baseUri().ToString() + DummyThirdPartyWebService.DUMMY_WEB_SERVICE_MOUNT_POINT + "/inject-test")).normalize();
            response             = CLIENT.resource(thirdPartyServiceUri.ToString()).get(typeof(string));
            assertEquals(nodesCreated.ToString(), response);
        }
Beispiel #24
0
 private static void Shutdown()
 {
     lock (typeof(ServerHolder))
     {
         _allocation = null;
         try
         {
             if (_server != null)
             {
                 _server.stop();
             }
         }
         finally
         {
             _builder = null;
             _server  = null;
         }
     }
 }
Beispiel #25
0
 internal static void Release(NeoServer server)
 {
     lock (typeof(ServerHolder))
     {
         if (server == null)
         {
             return;
         }
         if (server != ServerHolder._server)
         {
             throw new AssertionError("trying to suspend a server not allocated from here");
         }
         if (_allocation == null)
         {
             throw new AssertionError("releasing the server although it is not allocated");
         }
         _allocation = null;
     }
 }
Beispiel #26
0
        private string NeoServerEdition(NeoServer neoServer)
        {
//JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method:
            string serverClassName = neoServer.GetType().FullName.ToLower();

            if (serverClassName.Contains("enterpriseneoserver") || serverClassName.Contains("commercialneoserver"))
            {
                return("enterprise");
            }
            else if (serverClassName.Contains("communityneoserver"))
            {
                return("community");
            }
            else
            {
                //            return "unknown";
                throw new System.InvalidOperationException("The Neo Server running is of unknown type. Valid types are Community " + "and Enterprise.");
            }
        }
Beispiel #27
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldRequireAuthorizationForHAStatusEndpoints() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldRequireAuthorizationForHAStatusEndpoints()
        {
            // Given
            int       clusterPort = PortAuthority.allocatePort();
            NeoServer server      = EnterpriseServerBuilder.serverOnRandomPorts().withProperty(GraphDatabaseSettings.auth_enabled.name(), "true").usingDataDir(Folder.Root.AbsolutePath).withProperty(mode.name(), "HA").withProperty(server_id.name(), "1").withProperty(cluster_server.name(), ":" + clusterPort).withProperty(initial_hosts.name(), ":" + clusterPort).persistent().build();

            try
            {
                server.Start();
                server.Database;

                assertThat(server.Database.Graph, @is(instanceOf(typeof(HighlyAvailableGraphDatabase))));

                Client         client = Client.create();
                ClientResponse r      = client.resource(GetHaEndpoint(server)).accept(APPLICATION_JSON).get(typeof(ClientResponse));
                assertEquals(401, r.Status);
            }
            finally
            {
                server.Stop();
            }
        }
Beispiel #28
0
 public ExtensionInitializer(NeoServer neoServer)
 {
     this._neoServer = neoServer;
     _lifecycles     = Service.load(typeof(PluginLifecycle));
 }
Beispiel #29
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setupServer() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void SetupServer()
        {
            _logProvider = new AssertableLogProvider();
            _server      = ServerHelper.createNonPersistentServer(_logProvider);
            ServerHelper.cleanTheDatabase(_server);
        }
Beispiel #30
0
 public ServerManagement(NeoServer server)
 {
     this._server = server;
 }