Esempio n. 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldSupportProcedureDeprecation() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldSupportProcedureDeprecation()
        {
            // Given
            Log log = mock(typeof(Log));
            ReflectiveProcedureCompiler procedureCompiler = new ReflectiveProcedureCompiler(new TypeMappers(), _components, _components, log, ProcedureConfig.Default);

            // When
            IList <CallableProcedure> procs = procedureCompiler.CompileProcedure(typeof(ProcedureWithDeprecation), null, true);

            // Then
            verify(log).warn("Use of @Procedure(deprecatedBy) without @Deprecated in badProc");
            verifyNoMoreInteractions(log);
            foreach (CallableProcedure proc in procs)
            {
                string name = proc.Signature().name().name();
                proc.Apply(new BasicContext(), new object[0], _resourceTracker);
                switch (name)
                {
                case "newProc":
                    assertFalse("Should not be deprecated", proc.Signature().deprecated().Present);
                    break;

                case "oldProc":
                case "badProc":
                    assertTrue("Should be deprecated", proc.Signature().deprecated().Present);
                    assertThat(proc.Signature().deprecated().get(), equalTo("newProc"));
                    break;

                default:
                    fail("Unexpected procedure: " + name);
                    break;
                }
            }
        }
Esempio n. 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotLoadAnyProcedureIfConfigIsEmpty() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldNotLoadAnyProcedureIfConfigIsEmpty()
        {
            // Given
            ProcedureConfig             config            = new ProcedureConfig(Config.defaults(procedure_whitelist, ""));
            Log                         log               = mock(typeof(Log));
            ReflectiveProcedureCompiler procedureCompiler = new ReflectiveProcedureCompiler(new TypeMappers(), _components, _components, log, config);

            // When
            IList <CallableProcedure> proc = procedureCompiler.CompileProcedure(typeof(SingleReadOnlyProcedure), null, false);

            // Then
            verify(log).warn("The procedure 'org.neo4j.kernel.impl.proc.listCoolPeople' is not on the whitelist and won't be loaded.");
            assertThat(proc.Count == 0, @is(true));
        }
Esempio n. 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldIgnoreWhiteListingIfFullAccess() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldIgnoreWhiteListingIfFullAccess()
        {
            // Given
            ProcedureConfig             config            = new ProcedureConfig(Config.defaults(procedure_whitelist, "empty"));
            Log                         log               = mock(typeof(Log));
            ReflectiveProcedureCompiler procedureCompiler = new ReflectiveProcedureCompiler(new TypeMappers(), _components, _components, log, config);

            // When
            CallableProcedure proc = procedureCompiler.CompileProcedure(typeof(SingleReadOnlyProcedure), null, true)[0];
            // Then
            RawIterator <object[], ProcedureException> result = proc.Apply(new BasicContext(), new object[0], _resourceTracker);

            assertEquals(result.Next()[0], "Bonnie");
        }
Esempio n. 4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldLoadWhiteListedProcedure() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldLoadWhiteListedProcedure()
        {
            // Given
            ProcedureConfig config = new ProcedureConfig(Config.defaults(procedure_whitelist, "org.neo4j.kernel.impl.proc.listCoolPeople"));

            Log log = mock(typeof(Log));
            ReflectiveProcedureCompiler procedureCompiler = new ReflectiveProcedureCompiler(new TypeMappers(), _components, _components, log, config);

            // When
            CallableProcedure proc = procedureCompiler.CompileProcedure(typeof(SingleReadOnlyProcedure), null, false)[0];
            // When
            RawIterator <object[], ProcedureException> result = proc.Apply(new BasicContext(), new object[0], _resourceTracker);

            // Then
            assertEquals(result.Next()[0], "Bonnie");
        }