private static FailedToBuildKernelExtensionException Wrap(KernelExtensionFactory kernelExtensionFactory, Exception e) { StringBuilder message = (new StringBuilder("Failed to build kernel extension ")).Append(kernelExtensionFactory); if (e is LinkageError || e is ReflectiveOperationException) { if (e is LinkageError) { message.Append(" because it is compiled with a reference to a class, method, or field, that is not in the class path: "); } else { message.Append(" because it a reflective access to a class, method, or field, that is not in the class path: "); } message.Append('\'').Append(e.Message).Append('\''); message.Append(". The most common cause of this problem, is that Neo4j has been upgraded without also upgrading all"); message.Append("installed extensions, such as APOC. "); message.Append("Make sure that all of your extensions are build against your specific version of Neo4j."); } else { message.Append(" because of an unanticipated error: '").Append(e.Message).Append("'."); } return(new FailedToBuildKernelExtensionException(message.ToString(), e)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void extensionShouldHavePublicNoArgConstructor() public virtual void ExtensionShouldHavePublicNoArgConstructor() { //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: KernelExtensionFactory<?> instance = null; KernelExtensionFactory <object> instance = null; try { instance = NewInstance(); } catch (System.ArgumentException failure) { Console.WriteLine(failure.ToString()); Console.Write(failure.StackTrace); fail("Contract violation: extension class must have public no-arg constructor (Exception in stderr)"); } assertNotNull(instance); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldBeAbleToLoadExtensionAsAServiceProvider() public virtual void ShouldBeAbleToLoadExtensionAsAServiceProvider() { //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: KernelExtensionFactory<?> instance = null; KernelExtensionFactory <object> instance = null; try { instance = LoadInstance(); } catch (System.InvalidCastException failure) { Console.WriteLine(failure.ToString()); Console.Write(failure.StackTrace); fail("Loaded instance does not match the extension class (Exception in stderr)"); } assertNotNull("Could not load the kernel extension with the provided key", instance); assertSame("Class of the loaded instance is a subclass of the extension class", instance.GetType(), _extClass); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void differentInstancesShouldHaveEqualHashCodesAndBeEqual() public virtual void DifferentInstancesShouldHaveEqualHashCodesAndBeEqual() { //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: KernelExtensionFactory<?> one = newInstance(); KernelExtensionFactory <object> one = NewInstance(); //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: KernelExtensionFactory<?> two = newInstance(); KernelExtensionFactory <object> two = NewInstance(); assertEquals("new instances have different hash codes", one.GetHashCode(), two.GetHashCode()); assertEquals("new instances are not equals", one, two); one = LoadInstance(); two = LoadInstance(); assertEquals("loaded instances have different hash codes", one.GetHashCode(), two.GetHashCode()); assertEquals("loaded instances are not equals", one, two); one = LoadInstance(); two = NewInstance(); assertEquals("loaded instance and new instance have different hash codes", one.GetHashCode(), two.GetHashCode()); assertEquals("loaded instance and new instance are not equals", one, two); }
public void handle(KernelExtensionFactory kernelExtensionFactory, Exception e) { // Just ignore. }
public void handle(KernelExtensionFactory kernelExtensionFactory, UnsatisfiedDependencyException e) { // Just ignore. }
public void handle(KernelExtensionFactory kernelExtensionFactory, Exception e) { throw Wrap(kernelExtensionFactory, e); }
public void handle(KernelExtensionFactory kernelExtensionFactory, UnsatisfiedDependencyException e) { throw Wrap(kernelExtensionFactory, e); }
private static FailedToBuildKernelExtensionException Wrap(KernelExtensionFactory kernelExtensionFactory, UnsatisfiedDependencyException e) { return(new FailedToBuildKernelExtensionException("Failed to build kernel extension " + kernelExtensionFactory + " due to a missing dependency: " + e.Message, e)); }
public void handle(KernelExtensionFactory kernelExtensionFactory, Exception e) { Wrap(kernelExtensionFactory, e).printStackTrace(@out); }
public void handle(KernelExtensionFactory kernelExtensionFactory, UnsatisfiedDependencyException e) { Wrap(kernelExtensionFactory, e).printStackTrace(@out); }