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 superClusterRoutingProcedureShouldHaveCorrectSignature()
        public virtual void SuperClusterRoutingProcedureShouldHaveCorrectSignature()
        {
            GetRoutersForAllDatabasesProcedure proc = new GetRoutersForAllDatabasesProcedure(null, Config.defaults());

            ProcedureSignature procSig = proc.Signature();

            IList <FieldSignature> output = Arrays.asList(FieldSignature.outputField("ttl", Neo4jTypes.NTInteger), FieldSignature.outputField("routers", Neo4jTypes.NTList(Neo4jTypes.NTMap)));

            assertEquals("The output signature of the GetRoutersForAllDatabasesProcedure should not change.", procSig.OutputSignature(), output);
        }
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 shouldHaveCorrectSignature()
        public virtual void ShouldHaveCorrectSignature()
        {
            // given
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final LegacyGetServersProcedure proc = new LegacyGetServersProcedure(null, null, config, getInstance());
            LegacyGetServersProcedure proc = new LegacyGetServersProcedure(null, null, Config, Instance);

            // when
            ProcedureSignature signature = proc.Signature();

            // then
            assertThat(signature.OutputSignature(), containsInAnyOrder(FieldSignature.outputField("ttl", NTInteger), FieldSignature.outputField("servers", NTList(NTMap))));
        }
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 shouldHaveCorrectSignature()
        public virtual void ShouldHaveCorrectSignature()
        {
            // given
            GetServersProcedureForMultiDC proc = new GetServersProcedureForMultiDC(null);

            // when
            ProcedureSignature signature = proc.Signature();

            // then
            assertThat(signature.InputSignature(), containsInAnyOrder(FieldSignature.inputField("context", NTMap)));

            assertThat(signature.OutputSignature(), containsInAnyOrder(FieldSignature.outputField("ttl", NTInteger), FieldSignature.outputField("servers", NTList(NTMap))));
        }
Esempio n. 4
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public OutputMapper mapper(Class userClass) throws org.neo4j.internal.kernel.api.exceptions.ProcedureException
        public virtual OutputMapper Mapper(Type userClass)
        {
            AssertIsValidRecordClass(userClass);

            IList <System.Reflection.FieldInfo> fields = InstanceFields(userClass);

            FieldSignature[] signature    = new FieldSignature[fields.Count];
            FieldMapper[]    fieldMappers = new FieldMapper[fields.Count];

            for (int i = 0; i < fields.Count; i++)
            {
                System.Reflection.FieldInfo field = fields[i];
                if (!isPublic(field.Modifiers))
                {
                    throw new ProcedureException(Org.Neo4j.Kernel.Api.Exceptions.Status_Procedure.TypeError, "Field `%s` in record `%s` cannot be accessed. Please ensure the field is marked as `public`.", field.Name, userClass.Name);
                }

                try
                {
                    TypeMappers.TypeChecker checker     = _typeMappers.checkerFor(field.GenericType);
                    MethodHandle            getter      = _lookup.unreflectGetter(field);
                    FieldMapper             fieldMapper = new FieldMapper(getter, checker);

                    fieldMappers[i] = fieldMapper;
                    signature[i]    = FieldSignature.outputField(field.Name, checker.Type(), field.isAnnotationPresent(typeof(Deprecated)));
                }
                catch (ProcedureException e)
                {
                    throw new ProcedureException(e.Status(), e, "Field `%s` in record `%s` cannot be converted to a Neo4j type: %s", field.Name, userClass.Name, e.Message);
                }
                catch (IllegalAccessException e)
                {
                    throw new ProcedureException(Org.Neo4j.Kernel.Api.Exceptions.Status_Procedure.TypeError, e, "Field `%s` in record `%s` cannot be accessed: %s", field.Name, userClass.Name, e.Message);
                }
            }

            return(new OutputMapper(signature, fieldMappers));
        }