// Use this for initialization
 void Start()
 {
     serverControl = GetComponent<ServerControls>();
     sk = GetComponent<Seeker>();
     SinglePathReander = new GameObject("LineRenderer_Single", typeof(LineRenderer));
     lr = SinglePathReander.GetComponent<LineRenderer>();
     lr.SetWidth(0.1f, 0.1f);
 }
Example #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldMountUnmanagedExtensionsByPackage()
        public virtual void ShouldMountUnmanagedExtensionsByPackage()
        {
            // When
            using (ServerControls server = GetTestServerBuilder(TestDir.directory()).withExtension("/path/to/my/extension", "org.neo4j.harness.extensionpackage").newServer())
            {
                // Then
                assertThat(HTTP.GET(server.HttpURI().ToString() + "path/to/my/extension/myExtension").status(), equalTo(234));
            }
        }
Example #3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void assertQueryGetsValue(ServerControls server, String query, long value) throws Throwable
        private void AssertQueryGetsValue(ServerControls server, string query, long value)
        {
            HTTP.Response response = HTTP.POST(server.HttpURI().resolve("db/data/transaction/commit").ToString(), quotedJson("{ 'statements': [ { 'statement': '" + query + "' } ] }"));

            assertEquals("[]", response.Get("errors").ToString());
            JsonNode result = response.Get("results").get(0);

            assertEquals("value", result.get("columns").get(0).asText());
            assertEquals(value, result.get("data").get(0).get("row").get(0).asLong());
        }
Example #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldWorkWithInjectableFromKernelExtensionWithMorePower() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldWorkWithInjectableFromKernelExtensionWithMorePower()
        {
            // When
            using (ServerControls server = CreateServer(typeof(MyFunctionsUsingMyCoreAPI)).newServer())
            {
                HTTP.POST(server.HttpURI().resolve("db/data/transaction/commit").ToString(), quotedJson("{ 'statements': [ { 'statement': 'CREATE (), (), ()' } ] }"));

                // Then
                AssertQueryGetsValue(server, "RETURN my.countNodes() AS value", 3L);
                AssertQueryGetsError(server, "RETURN my.willFail() AS value", "Write operations are not allowed");
            }
        }
Example #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldGetHelpfulErrorOnProcedureThrowsException() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldGetHelpfulErrorOnProcedureThrowsException()
        {
            // When
            using (ServerControls server = CreateServer(typeof(MyFunctions)).newServer())
            {
                // Then
                HTTP.Response response = HTTP.POST(server.HttpURI().resolve("db/data/transaction/commit").ToString(), quotedJson("{ 'statements': [ { 'statement': 'RETURN org.neo4j.harness.funcThatThrows()' } ] }"));

                string error = response.Get("errors").get(0).get("message").asText();
                assertEquals("Failed to invoke function `org.neo4j.harness.funcThatThrows`: Caused by: java.lang" + ".RuntimeException: This is an exception", error);
            }
        }
Example #6
0
    private void Start()
    {
        if (lm == null)
        {
            lm = GetComponent <LoginManager>();
        }

        if (server == null)
        {
            server = GetComponent <ServerControls>();
        }
    }
Example #7
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldFindFreePort()
        public virtual void ShouldFindFreePort()
        {
            // Given one server is running
            using (ServerControls firstServer = GetTestServerBuilder(TestDir.directory()).newServer())
            {
                // When I start a second server
                using (ServerControls secondServer = GetTestServerBuilder(TestDir.directory()).newServer())
                {
                    // Then
                    assertThat(secondServer.HttpURI().Port, not(firstServer.HttpURI().Port));
                }
            }
        }
Example #8
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldOpenBoltPort() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldOpenBoltPort()
        {
            // given
            using (ServerControls controls = GetTestServerBuilder(TestDir.directory()).newServer())
            {
                URI uri = controls.BoltURI();

                // when
                (new SocketConnection()).connect(new HostnamePort(uri.Host, uri.Port));

                // then no exception
            }
        }
Example #9
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldWorkWithInjectableFromKernelExtensionWithMorePower() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldWorkWithInjectableFromKernelExtensionWithMorePower()
        {
            // When
            using (ServerControls server = CreateServer(typeof(MyProceduresUsingMyCoreAPI)).withConfig(GraphDatabaseSettings.record_id_batch_size, "1").newServer())
            {
                // Then
                AssertQueryGetsValue(server, "CALL makeNode(\\'Test\\')", 0L);
                AssertQueryGetsValue(server, "CALL makeNode(\\'Test\\')", 1L);
                AssertQueryGetsValue(server, "CALL makeNode(\\'Test\\')", 2L);
                AssertQueryGetsValue(server, "CALL countNodes", 3L);
                AssertQueryGetsError(server, "CALL willFail", "Write operations are not allowed");
            }
        }
Example #10
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }

        DontDestroyOnLoad(gameObject);
    }
Example #11
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldLaunchWithDeclaredFunctions() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldLaunchWithDeclaredFunctions()
        {
            // When
            using (ServerControls server = CreateServer(typeof(MyFunctions)).newServer())
            {
                // Then
                HTTP.Response response = HTTP.POST(server.HttpURI().resolve("db/data/transaction/commit").ToString(), quotedJson("{ 'statements': [ { 'statement': 'RETURN org.neo4j.harness.myFunc() AS someNumber' } ] " + "}"));

                JsonNode result = response.Get("results").get(0);
                assertEquals("someNumber", result.get("columns").get(0).asText());
                assertEquals(1337, result.get("data").get(0).get("row").get(0).asInt());
                assertEquals("[]", response.Get("errors").ToString());
            }
        }
Example #12
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldWorkWithInjectableFromKernelExtension() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldWorkWithInjectableFromKernelExtension()
        {
            // When
            using (ServerControls server = CreateServer(typeof(MyFunctionsUsingMyService)).newServer())
            {
                // Then
                HTTP.Response response = HTTP.POST(server.HttpURI().resolve("db/data/transaction/commit").ToString(), quotedJson("{ 'statements': [ { 'statement': 'RETURN my.hello() AS result' } ] }"));

                assertEquals("[]", response.Get("errors").ToString());
                JsonNode result = response.Get("results").get(0);
                assertEquals("result", result.get("columns").get(0).asText());
                assertEquals("world", result.get("data").get(0).get("row").get(0).asText());
            }
        }
Example #13
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldHandleStringFixtures() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldHandleStringFixtures()
        {
            // Given two files in the root folder
            File targetFolder = TestDir.directory();

            // When
            using (ServerControls server = GetServerBuilder(targetFolder).withFixture("CREATE (a:User)").newServer())
            {
                // Then
                HTTP.Response response = HTTP.POST(server.HttpURI().ToString() + "db/data/transaction/commit", quotedJson("{'statements':[{'statement':'MATCH (n:User) RETURN n'}]}"));

                assertThat(response.Get("results").get(0).get("data").size(), equalTo(1));
            }
        }
Example #14
0
        private void TestStartupWithConnectors(bool httpEnabled, bool httpsEnabled, bool boltEnabled)
        {
            TestServerBuilder serverBuilder = newInProcessBuilder(TestDir.directory()).withConfig("dbms.connector.http.enabled", Convert.ToString(httpEnabled)).withConfig("dbms.connector.http.listen_address", ":0").withConfig("dbms.connector.https.enabled", Convert.ToString(httpsEnabled)).withConfig("dbms.connector.https.listen_address", ":0").withConfig("dbms.connector.bolt.enabled", Convert.ToString(boltEnabled)).withConfig("dbms.connector.bolt.listen_address", ":0");

            using (ServerControls server = serverBuilder.NewServer())
            {
                GraphDatabaseService db = server.Graph();

                AssertDbAccessible(db);
                verifyConnector(db, "http", httpEnabled);
                verifyConnector(db, "https", httpsEnabled);
                verifyConnector(db, "bolt", boltEnabled);
            }
        }
Example #15
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldLaunchAServerInSpecifiedDirectory()
        public virtual void ShouldLaunchAServerInSpecifiedDirectory()
        {
            // Given
            File workDir = TestDir.directory("specific");

            // When
            using (ServerControls server = GetTestServerBuilder(workDir).newServer())
            {
                // Then
                assertThat(HTTP.GET(server.HttpURI().ToString()).status(), equalTo(200));
                assertThat(workDir.list().length, equalTo(1));
            }

            // And after it's been closed, it should've cleaned up after itself.
            assertThat(Arrays.ToString(workDir.list()), workDir.list().length, equalTo(0));
        }
Example #16
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldRunBuilderOnExistingStoreDir() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldRunBuilderOnExistingStoreDir()
        {
            // When
            // create graph db with one node upfront
            File existingStoreDir   = TestDir.directory("existingStore");
            File storeDir           = Config.defaults(GraphDatabaseSettings.data_directory, existingStoreDir.toPath().ToString()).get(GraphDatabaseSettings.database_path);
            GraphDatabaseService db = (new TestGraphDatabaseFactory()).newEmbeddedDatabase(storeDir);

            try
            {
                Db.execute("create ()");
            }
            finally
            {
                Db.shutdown();
            }

            using (ServerControls server = GetTestServerBuilder(TestDir.databaseDir()).copyFrom(existingStoreDir).newServer())
            {
                // Then
                using (Transaction tx = server.Graph().beginTx())
                {
                    ResourceIterable <Node> allNodes = Iterables.asResourceIterable(server.Graph().AllNodes);

                    assertTrue(Iterables.count(allNodes) > 0);

                    // When: create another node
                    server.Graph().createNode();
                    tx.Success();
                }
            }

            // Then: we still only have one node since the server is supposed to work on a copy
            db = (new TestGraphDatabaseFactory()).newEmbeddedDatabase(storeDir);
            try
            {
                using (Transaction tx = Db.beginTx())
                {
                    assertEquals(1, Iterables.count(Db.AllNodes));
                    tx.Success();
                }
            }
            finally
            {
                Db.shutdown();
            }
        }
Example #17
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldIgnoreEmptyFixtureFiles() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldIgnoreEmptyFixtureFiles()
        {
            // Given two files in the root folder
            File targetFolder = TestDir.directory();

            FileUtils.writeToFile(new File(targetFolder, "fixture1.cyp"), "CREATE (u:User)\n" + "CREATE (a:OtherUser)", false);
            FileUtils.writeToFile(new File(targetFolder, "fixture2.cyp"), "", false);

            // When
            using (ServerControls server = GetServerBuilder(targetFolder).withFixture(targetFolder).newServer())
            {
                // Then
                HTTP.Response response = HTTP.POST(server.HttpURI().ToString() + "db/data/transaction/commit", quotedJson("{'statements':[{'statement':'MATCH (n:User) RETURN n'}]}"));

                assertThat(response.Get("results").get(0).get("data").size(), equalTo(1));
            }
        }
Example #18
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void terminateSingleInstanceRestTransactionThatWaitsForLock() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void TerminateSingleInstanceRestTransactionThatWaitsForLock()
        {
            ServerControls server = _cleanupRule.add(TestServerBuilders.newInProcessBuilder().withConfig(GraphDatabaseSettings.auth_enabled, Settings.FALSE).withConfig(GraphDatabaseSettings.lock_manager, LockManagerName).withConfig(OnlineBackupSettings.online_backup_enabled, Settings.FALSE).newServer());

            GraphDatabaseService db = server.Graph();

            HTTP.Builder http = withBaseUri(server.HttpURI());

            long value1 = 1L;
            long value2 = 2L;

            CreateNode(db);

            HTTP.Response tx1 = StartTx(http);
            HTTP.Response tx2 = StartTx(http);

            AssertNumberOfActiveTransactions(2, db);

            HTTP.Response update1 = ExecuteUpdateStatement(tx1, value1, http);
            assertThat(update1.Status(), equalTo(200));
            assertThat(update1, containsNoErrors());

            System.Threading.CountdownEvent latch = new System.Threading.CountdownEvent(1);
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: java.util.concurrent.Future<?> tx2Result = executeInSeparateThread("tx2", () ->
            Future <object> tx2Result = ExecuteInSeparateThread("tx2", () =>
            {
                latch.Signal();
                Response update2 = ExecuteUpdateStatement(tx2, value2, http);
                AssertTxWasTerminated(update2);
            });

            Await(latch);
            SleepForAWhile();

            Terminate(tx2, http);
            Commit(tx1, http);

            HTTP.Response update3 = ExecuteUpdateStatement(tx2, value2, http);
            assertThat(update3.Status(), equalTo(404));

            tx2Result.get(1, TimeUnit.MINUTES);

            AssertNodeExists(db, value1);
        }
Example #19
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldReturnBoltUriWhenDefaultBoltConnectorOffAndOtherConnectorConfigured()
        public virtual void ShouldReturnBoltUriWhenDefaultBoltConnectorOffAndOtherConnectorConfigured()
        {
            TestServerBuilder serverBuilder = newInProcessBuilder(TestDir.directory()).withConfig("dbms.connector.bolt.enabled", "false").withConfig("dbms.connector.another_bolt.type", "BOLT").withConfig("dbms.connector.another_bolt.enabled", "true").withConfig("dbms.connector.another_bolt.listen_address", ":0");

            using (ServerControls server = serverBuilder.NewServer())
            {
                HostnamePort boltHostPort        = connectorAddress(server.Graph(), "bolt");
                HostnamePort anotherBoltHostPort = connectorAddress(server.Graph(), "another_bolt");

                assertNull(boltHostPort);
                assertNotNull(anotherBoltHostPort);

                URI boltUri = server.BoltURI();
                assertEquals("bolt", boltUri.Scheme);
                assertEquals(anotherBoltHostPort.Host, boltUri.Host);
                assertEquals(anotherBoltHostPort.Port, boltUri.Port);
            }
        }
Example #20
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private static java.net.URI getHttpsUriFromNeo4jRule(java.net.URI configuredHttpsUri) throws Throwable
        private static URI GetHttpsUriFromNeo4jRule(URI configuredHttpsUri)
        {
            ServerControls serverControls = mock(typeof(ServerControls));

            when(serverControls.HttpsURI()).thenReturn(Optional.ofNullable(configuredHttpsUri));
            TestServerBuilder serverBuilder = mock(typeof(TestServerBuilder));

            when(serverBuilder.NewServer()).thenReturn(serverControls);

            Neo4jRule rule = new Neo4jRule(serverBuilder);

            AtomicReference <URI> uriRef    = new AtomicReference <URI>();
            Statement             statement = rule.apply(new StatementAnonymousInnerClass(rule, uriRef)
                                                         , createTestDescription(typeof(Neo4jRuleTest), "test"));

            statement.evaluate();
            return(uriRef.get());
        }
Example #21
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void evaluate() throws Throwable
            public override void evaluate()
            {
                using (ServerControls sc = _outerInstance.controls = _outerInstance.builder.newServer())
                {
                    try
                    {
                        @base.evaluate();
                    }
                    catch (Exception t)
                    {
                        if (_outerInstance.dumpLogsOnFailureTarget != null)
                        {
                            sc.PrintLogs(_outerInstance.dumpLogsOnFailureTarget.get());
                        }

                        throw t;
                    }
                }
            }
Example #22
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void assertDBConfig(ServerControls server, String expected, String key) throws org.neo4j.server.rest.domain.JsonParseException
        private void AssertDBConfig(ServerControls server, string expected, string key)
        {
            JsonNode beans             = HTTP.GET(server.HttpURI().ToString() + "db/manage/server/jmx/domain/org.neo4j/").get("beans");
            JsonNode configurationBean = FindNamedBean(beans, "Configuration").get("attributes");
            bool     foundKey          = false;

            foreach (JsonNode attribute in configurationBean)
            {
                if (attribute.get("name").asText().Equals(key))
                {
                    assertThat(attribute.get("value").asText(), equalTo(expected));
                    foundKey = true;
                    break;
                }
            }
            if (!foundKey)
            {
                fail("No config key '" + key + "'.");
            }
        }
Example #23
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldFailWhenProvidingANonDirectoryAsSource() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldFailWhenProvidingANonDirectoryAsSource()
        {
            File notADirectory = File.createTempFile("prefix", "suffix");

            assertFalse(notADirectory.Directory);

            try
            {
                using (ServerControls ignored = GetTestServerBuilder(TestDir.directory()).copyFrom(notADirectory).newServer())
                {
                    fail("server should not start");
                }
            }
            catch (Exception rte)
            {
                Exception cause = rte.InnerException;
                assertTrue(cause is IOException);
                assertTrue(cause.Message.contains("exists but is not a directory"));
            }
        }
Example #24
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldHandleFixturesWithSyntaxErrorsGracefully() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldHandleFixturesWithSyntaxErrorsGracefully()
        {
            // Given two files in the root folder
            File targetFolder = TestDir.directory();

            FileUtils.writeToFile(new File(targetFolder, "fixture1.cyp"), "this is not a valid cypher statement", false);

            // When
            try
            {
                using (ServerControls ignore = GetServerBuilder(targetFolder).withFixture(targetFolder).newServer())
                {
                    fail("Should have thrown exception");
                }
            }
            catch (Exception e)
            {
                assertThat(e.Message, equalTo("Invalid input 't': expected <init> (line 1, column 1 (offset: 0))" + lineSeparator() + "\"this is not a valid cypher statement\"" + lineSeparator() + " ^"));
            }
        }
Example #25
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldAllowCustomServerAndDbConfig() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldAllowCustomServerAndDbConfig()
        {
            // Given
            TrustAllSSLCerts();

            // Get default trusted cypher suites
            SSLServerSocketFactory ssf = ( SSLServerSocketFactory )SSLServerSocketFactory.Default;

            string[] defaultCiphers = ssf.DefaultCipherSuites;

            // When
            HttpConnector httpConnector  = new HttpConnector("0", HttpConnector.Encryption.NONE);
            HttpConnector httpsConnector = new HttpConnector("1", HttpConnector.Encryption.TLS);

            using (ServerControls server = GetTestServerBuilder(TestDir.directory()).withConfig(httpConnector.Type, "HTTP").withConfig(httpConnector.Enabled, "true").withConfig(httpConnector.Encryption, "NONE").withConfig(httpConnector.ListenAddress, "localhost:0").withConfig(httpsConnector.Type, "HTTP").withConfig(httpsConnector.Enabled, "true").withConfig(httpsConnector.Encryption, "TLS").withConfig(httpsConnector.ListenAddress, "localhost:0").withConfig(GraphDatabaseSettings.dense_node_threshold, "20").withConfig("https.ssl_policy", "test").withConfig("dbms.ssl.policy.test.base_directory", TestDir.directory("certificates").AbsolutePath).withConfig("dbms.ssl.policy.test.allow_key_generation", "true").withConfig("dbms.ssl.policy.test.ciphers", string.join(",", defaultCiphers)).withConfig("dbms.ssl.policy.test.tls_versions", "TLSv1.2, TLSv1.1, TLSv1").withConfig("dbms.ssl.policy.test.client_auth", ClientAuth.NONE.name()).withConfig("dbms.ssl.policy.test.trust_all", "true").newServer())
            {
                // Then
                assertThat(HTTP.GET(server.HttpURI().ToString()).status(), equalTo(200));
                assertThat(HTTP.GET(server.HttpsURI().get().ToString()).status(), equalTo(200));
                AssertDBConfig(server, "20", GraphDatabaseSettings.dense_node_threshold.name());
            }
        }
Example #26
0
    // Use this for initialization
    void Start()
    {
        //user = transform.GetComponent<UserData> ();
        server = GameObject.Find("GaudyBG").transform.GetComponent <ServerControls>();
        if (server == null)
        {
            server = GetComponent <ServerControls>();
        }
        casesToDownload = new Queue <string>(10);
        system          = EventSystem.current;

        //The following things toggle on/off depending on whether or not demo is false/true respectively
        if (GlobalData.demo)
        {
            transform.Find("SidePanel/TopPanel/LogInButton").GetComponent <Button>().interactable = !GlobalData.demo;
            transform.Find("SidePanel/TopPanel/SettingsPanel/SettingsImage").GetComponent <Button>().interactable = !GlobalData.demo;
            transform.Find("ContentPanel/TopRightControls/ImportButton").gameObject.SetActive(!GlobalData.demo);
            loggedOutButtons.Find("LoginButton").GetComponent <Button>().interactable          = !GlobalData.demo;
            loggedOutButtons.Find("RegisterButton").GetComponent <Button>().interactable       = !GlobalData.demo;
            loggedOutButtons.Find("ForgotPasswordButton").GetComponent <Button>().interactable = !GlobalData.demo;
            GameObject.Find("BigLoginPanel/SceneSwitch/ReturnToLogin").gameObject.SetActive(!GlobalData.demo);
            transform.Find("SidePanel/ReturnToLogin").gameObject.SetActive(!GlobalData.demo);
            server.infoPanel.Find("ButtonRow").gameObject.SetActive(!GlobalData.demo);
            transform.Find("SidePanel/TopPanel/LogInButton/UserText").GetComponent <TextMeshProUGUI>().text = "Guest";
            GlobalData.filePath = Application.streamingAssetsPath + GlobalData.menuFilePath;
            server.RemoveMenuItems();
            LoginGuest();
            //StartCoroutine(server.DownloadMenuItems());
            return;
        }

        GlobalData.recommendedCases = null;
        if (!GlobalData.username.Equals(""))
        {
            loggedIn = true;
            server.DisableLoginScreen();

            StartCoroutine(server.DownloadMenuItems());
        }
        else
        {
            //transform.Find("SplashScreen").gameObject.SetActive(false);
            GlobalData.username = "";
            GlobalData.password = "";
            GlobalData.email    = "";
        }
        GlobalData.stayLoggedIn = PlayerPrefs.GetInt("StayLoggedIn", 0) > 0;

        if (!loggedIn)
        {
            //transform.Find ("Logout button").GetComponent<Button> ().interactable = false;
        }
        if (!LoginInfoGroup)
        {
            LoginInfoGroup   = transform.Find("Login Info");
            loggedInButtons  = transform.Find("LoggedInButtons");
            loggedOutButtons = transform.Find("LoggedOutButtons");
            submitButton     = loggedInButtons.Find("SubmitButton");
            submitButton.gameObject.SetActive(false);
        }
        HandleCommandLineArguments();
        if (!loggedIn && GlobalData.stayLoggedIn)
        {
            StartCoroutine(CheckPreviousLoginSession());
        }
        else
        {
            // Splash screen shouldn't be shown when coming out of a case
            GameObject.Find("SplashScreen")?.gameObject.SetActive(false);
        }
    }
Example #27
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void assertQueryGetsError(ServerControls server, String query, String error) throws Throwable
        private void AssertQueryGetsError(ServerControls server, string query, string error)
        {
            HTTP.Response response = HTTP.POST(server.HttpURI().resolve("db/data/transaction/commit").ToString(), quotedJson("{ 'statements': [ { 'statement': '" + query + "' } ] }"));

            assertThat(response.Get("errors").ToString(), containsString(error));
        }
        // Private methods.
        /// <summary>
        /// Adds a new server to the servers control.
        /// </summary>
        /// <param name="server">The server.</param>
        private void AddServer(DbServerSql server)
        {
            // Create a new server item.
            ListViewItem item = new ListViewItem(new string[] {
                    server.Name,
                    this.crawler.Database.Sql.IsPrimary(server) ? "Primary" : "Backup",
                    server.State.ToString(),
                    server.Version,
                    server.Id.ToString()
                });
            item.ImageKey = ControlServersSql.imageKeys[(int)server.State];
            item.Tag = server.Id;
            this.listView.Items.Add(item);
            // Create a new tree node for the server.
            TreeNode nodeServer = new TreeNode(this.GetServerTreeName(server));
            nodeServer.ImageKey = ControlServersSql.imageKeys[(int)server.State];
            nodeServer.SelectedImageKey = ControlServersSql.imageKeys[(int)server.State];
            this.treeNode.Nodes.Add(nodeServer);
            // Create a new tree node for the server query.
            TreeNode nodeQuery = new TreeNode("Query");
            nodeQuery.ImageKey = "QueryDatabase";
            nodeQuery.SelectedImageKey = "QueryDatabase";
            // Create a new tree node for the server log.
            TreeNode nodeLog = new TreeNode("Server log");
            nodeLog.ImageKey = "Log";
            nodeLog.SelectedImageKey = "Log";
            // Add the children nodes to the server node.
            nodeServer.Nodes.AddRange(new TreeNode[] {
                    nodeQuery,
                    nodeLog
                });
            this.treeNode.ExpandAll();

            // Create a new controls item.
            ServerControls controls = new ServerControls(item, nodeServer);

            // Initialize the server controls.
            controls.ControlServer.Initialize(this.crawler, server, nodeServer);
            controls.ControlLog.Initialize(this.crawler.Config, server.Log);
            controls.ControlQuery.Initialize(this.crawler, server);

            // Add the controls to the panel.
            this.controls.Add(controls.ControlServer);
            this.controls.Add(controls.ControlQuery);
            this.controls.Add(controls.ControlLog);

            // Set the tree nodes tag.
            nodeServer.Tag = controls.ControlServer;
            nodeQuery.Tag = controls.ControlQuery;
            nodeLog.Tag = controls.ControlLog;

            // Add the servers controls to the dictionary.
            this.items.Add(server.Id, controls);
        }