public static DefaultParameterValue ntList( List<?> value, Neo4jTypes.AnyType inner ) { return new DefaultParameterValue( value, Neo4jTypes.NTList( inner ) ); }
private static DefaultValueConverter toList( DefaultValueConverter inner, Type type ) { return new DefaultValueConverter( NTList( inner.type() ), List.class, new ListConverter( type, inner.type() ) ); }
new Object[]{Map.class, NTMap, null, null}, new Object[]{List.class, NTList( NTAny ), emptyList(), emptyList()}, new Object[]{List.class, NTList( NTAny ), asList( 1, 2, 3, 4 ), asList( 1, 2, 3, 4 )}, new Object[]{List.class, NTList( NTAny ), asList( asList( 1, 2 ), asList( "three", "four" ) ), asList( asList( 1, 2 ), asList( "three", "four" ) )}, new Object[]{List.class, NTList( NTAny ), null, null}, new Object[]{listOfListOfMap, NTList( NTList( NTMap ) ), asList(), asList()},
@SuppressWarnings( "unchecked" ) @Test public void shouldHandleNestedLists() { // Given ParameterizedType type = mock( ParameterizedType.class ); when( type.getActualTypeArguments() ).thenReturn( new Type[]{Object.class} ); ListConverter converter = new ListConverter( type, NTList( NTAny ) ); String mapString = "[42, [42, 1337]]"; // When DefaultParameterValue converted = converter.apply( mapString ); // Then List<Object> list = (List<Object>) converted.value(); assertThat( list.get( 0 ), equalTo( 42L ) ); assertThat( list.get( 1 ), equalTo( asList( 42L, 1337L ) ) ); }
public ListComponentsProcedure( QualifiedName name, String neo4jVersion, String neo4jEdition ) { super( procedureSignature( name ) .out( "name", NTString ) // Since Bolt, Cypher and other components support multiple versions // at the same time, list of versions rather than single version. .out( "versions", NTList( NTString ) ) .out( "edition", NTString ) .mode( Mode.DBMS ) .description( "List DBMS components and their versions." ) .build() ); this.neo4jVersion = neo4jVersion; this.neo4jEdition = neo4jEdition; }
@Test public void shouldCompileFunction() throws Throwable { // When List<CallableUserFunction> function = compile( SingleReadOnlyFunction.class ); // Then assertEquals( 1, function.size() ); assertThat( function.get( 0 ).signature(), Matchers.equalTo( functionSignature( "org", "neo4j", "kernel", "impl", "proc", "listCoolPeople" ) .out( Neo4jTypes.NTList( Neo4jTypes.NTAny ) ) .build() ) ); }
@Test public void shouldCompileAggregationFunction() throws Throwable { // When List<CallableUserAggregationFunction> function = compile( SingleAggregationFunction.class ); // Then assertEquals( 1, function.size() ); assertThat( function.get( 0 ).signature(), Matchers.equalTo( functionSignature( "org", "neo4j", "kernel", "impl", "proc", "collectCool" ) .in( "name", Neo4jTypes.NTString ) .out( Neo4jTypes.NTList( Neo4jTypes.NTAny ) ) .build() ) ); }
@Test public void toStringShouldMatchCypherSyntax() { // When String toStr = functionSignature( "org", "myProcedure" ) .in( "in", Neo4jTypes.NTList( Neo4jTypes.NTString ) ) .out( Neo4jTypes.NTNumber ) .build() .toString(); // Then assertEquals( "org.myProcedure(in :: LIST? OF STRING?) :: (NUMBER?)", toStr ); } }
@Test public void toStringShouldMatchCypherSyntax() { // When String toStr = procedureSignature( "org", "myProcedure" ) .in( "inputArg", Neo4jTypes.NTList( Neo4jTypes.NTString ) ) .out( "outputArg", Neo4jTypes.NTNumber ) .build() .toString(); // Then assertEquals( "org.myProcedure(inputArg :: LIST? OF STRING?) :: (outputArg :: NUMBER?)", toStr ); }
@Test public void toStringForVoidProcedureShouldMatchCypherSyntax() { // Given ProcedureSignature proc = procedureSignature( "org", "myProcedure" ) .in( "inputArg", Neo4jTypes.NTList( Neo4jTypes.NTString ) ) .out( ProcedureSignature.VOID ) .build(); // When String toStr = proc.toString(); // Then assertEquals( "org.myProcedure(inputArg :: LIST? OF STRING?) :: VOID", toStr ); } }
public static DefaultParameterValue ntList( List<?> value, Neo4jTypes.AnyType inner ) { return new DefaultParameterValue( value, Neo4jTypes.NTList( inner ) ); }
public ClusterOverviewProcedure( TopologyService topologyService, LogProvider logProvider ) { super( procedureSignature( new QualifiedName( PROCEDURE_NAMESPACE, PROCEDURE_NAME ) ) .out( "id", Neo4jTypes.NTString ) .out( "addresses", Neo4jTypes.NTList( Neo4jTypes.NTString ) ) .out( "role", Neo4jTypes.NTString ) .out( "groups", Neo4jTypes.NTList( Neo4jTypes.NTString ) ) .out( "database", Neo4jTypes.NTString ) .description( "Overview of all currently accessible cluster members and their roles." ) .build() ); this.topologyService = topologyService; this.log = logProvider.getLog( getClass() ); }
private static DefaultValueConverter toList( DefaultValueConverter inner, Type type ) { return new DefaultValueConverter( NTList( inner.type() ), List.class, new ListConverter( type, inner.type() ) ); }
public ListComponentsProcedure( QualifiedName name, String neo4jVersion, String neo4jEdition ) { super( procedureSignature( name ) .out( "name", NTString ) // Since Bolt, Cypher and other components support multiple versions // at the same time, list of versions rather than single version. .out( "versions", NTList( NTString ) ) .out( "edition", NTString ) .mode( Mode.DBMS ) .description( "List DBMS components and their versions." ) .build() ); this.neo4jVersion = neo4jVersion; this.neo4jEdition = neo4jEdition; }