//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldAllowVoidOutput() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldAllowVoidOutput() { // When CallableProcedure proc = Compile(typeof(ProcedureWithVoidOutput))[0]; // Then assertEquals(0, proc.Signature().outputSignature().size()); assertFalse(proc.Apply(null, new object[0], _resourceTracker).hasNext()); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public org.neo4j.collection.RawIterator<Object[],org.neo4j.internal.kernel.api.exceptions.ProcedureException> callProcedure(org.neo4j.kernel.api.proc.Context ctx, org.neo4j.internal.kernel.api.procs.QualifiedName name, Object[] input, org.neo4j.kernel.api.ResourceTracker resourceTracker) throws org.neo4j.internal.kernel.api.exceptions.ProcedureException public virtual RawIterator <object[], ProcedureException> CallProcedure(Context ctx, QualifiedName name, object[] input, ResourceTracker resourceTracker) { CallableProcedure proc = _procedures.get(name); if (proc == null) { throw NoSuchProcedure(name); } return(proc.Apply(ctx, input, resourceTracker)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldRunSimpleReadOnlyProcedure() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldRunSimpleReadOnlyProcedure() { // Given CallableProcedure proc = Compile(typeof(SingleReadOnlyProcedure))[0]; // When RawIterator <object[], ProcedureException> @out = proc.Apply(new BasicContext(), new object[0], _resourceTracker); // Then assertThat(asList(@out), contains(new object[] { "Bonnie" }, new object[] { "Clyde" })); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldCompileAndRunProcedure() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldCompileAndRunProcedure() { // Given CallableProcedure proc = _compiler.compileProcedure(typeof(ProcedureWithInjectedAPI), null, true)[0]; // Then IList <object[]> @out = Iterators.asList(proc.Apply(new BasicContext(), new object[0], _resourceTracker)); // Then assertThat(@out[0], equalTo(new object[] { "Bonnie" })); assertThat(@out[1], equalTo(new object[] { "Clyde" })); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldGiveHelpfulErrorOnNullMessageException() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldGiveHelpfulErrorOnNullMessageException() { // Given CallableProcedure proc = Compile(typeof(ProcedureThatThrowsNullMsgExceptionAtInvocation))[0]; // Expect Exception.expect(typeof(ProcedureException)); Exception.expectMessage("Failed to invoke procedure `org.neo4j.kernel.impl.proc.throwsAtInvocation`: " + "Caused by: java.lang.IndexOutOfBoundsException"); // When proc.Apply(new BasicContext(), new object[0], _resourceTracker); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldCompileAndRunUnsafeProcedureUnsafeMode() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldCompileAndRunUnsafeProcedureUnsafeMode() { // Given CallableProcedure proc = _compiler.compileProcedure(typeof(ProcedureWithUnsafeAPI), null, true)[0]; // Then IList <object[]> @out = Iterators.asList(proc.Apply(new BasicContext(), new object[0], _resourceTracker)); // Then assertThat(@out[0], equalTo(new object[] { "Morpheus" })); assertThat(@out[1], equalTo(new object[] { "Trinity" })); assertThat(@out[2], equalTo(new object[] { "Neo" })); assertThat(@out[3], equalTo(new object[] { "Emil" })); }
//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"); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldRunSimpleProcedure() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldRunSimpleProcedure() { // Given CallableProcedure procedure = Compile(typeof(ClassWithProcedureWithSimpleArgs))[0]; // When RawIterator <object[], ProcedureException> @out = procedure.Apply(new BasicContext(), new object[] { "Pontus", 35L }, _resourceTracker); // Then IList <object[]> collect = new IList <object[]> { @out }; assertThat(collect[0][0], equalTo("Pontus is 35 years old.")); }
//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"); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldRunClassWithMultipleProceduresDeclared() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldRunClassWithMultipleProceduresDeclared() { // Given IList <CallableProcedure> compiled = Compile(typeof(MultiProcedureProcedure)); CallableProcedure bananaPeople = compiled[0]; CallableProcedure coolPeople = compiled[1]; // When RawIterator <object[], ProcedureException> coolOut = coolPeople.Apply(new BasicContext(), new object[0], _resourceTracker); RawIterator <object[], ProcedureException> bananaOut = bananaPeople.Apply(new BasicContext(), new object[0], _resourceTracker); // Then assertThat(asList(coolOut), contains(new object[] { "Bonnie" }, new object[] { "Clyde" })); assertThat(asList(bananaOut), contains(new object[] { "Jake", 18L }, new object[] { "Pontus", 2L })); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldInjectLogging() throws org.neo4j.internal.kernel.api.exceptions.KernelException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldInjectLogging() { // Given Log log = spy(typeof(Log)); _components.register(typeof(Log), ctx => log); CallableProcedure procedure = _procedureCompiler.compileProcedure(typeof(LoggingProcedure), null, true)[0]; // When procedure.Apply(new BasicContext(), new object[0], _resourceTracker); // Then verify(log).debug("1"); verify(log).info("2"); verify(log).warn("3"); verify(log).error("4"); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldRunGenericProcedure() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldRunGenericProcedure() { // Given CallableProcedure procedure = Compile(typeof(ClassWithProcedureWithGenericArgs))[0]; // When RawIterator <object[], ProcedureException> @out = procedure.Apply(new BasicContext(), new object[] { Arrays.asList("Roland", "Eddie", "Susan", "Jake"), Arrays.asList(1000L, 23L, 29L, 12L) }, _resourceTracker); // Then IList <object[]> collect = new IList <object[]> { @out }; assertThat(collect[0][0], equalTo("Roland is 1000 years old.")); assertThat(collect[1][0], equalTo("Eddie is 23 years old.")); assertThat(collect[2][0], equalTo("Susan is 29 years old.")); assertThat(collect[3][0], equalTo("Jake is 12 years old.")); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldCloseResourcesAndGiveHelpfulErrorOnMidStreamException() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldCloseResourcesAndGiveHelpfulErrorOnMidStreamException() { // Given CallableProcedure proc = Compile(typeof(ProcedureThatThrowsNullMsgExceptionMidStream))[0]; // Expect Exception.expect(typeof(ProcedureException)); Exception.expectMessage("Failed to invoke procedure `org.neo4j.kernel.impl.proc.throwsInStream`: " + "Caused by: java.lang.IndexOutOfBoundsException"); // Expect that we get a suppressed exception from Stream.onClose (which also verifies that we actually call // onClose on the first exception) Exception.expect(new BaseMatcherAnonymousInnerClass(this)); // When RawIterator <object[], ProcedureException> stream = proc.Apply(new BasicContext(), new object[0], _resourceTracker); if (stream.HasNext()) { stream.Next(); } }