protected List<SchemaAndValueField> schemaAndValuesForPostgisTypes() { Schema geomSchema = Geometry.builder().optional().build(); Schema geogSchema = Geography.builder().optional().build(); return Arrays.asList( // geometries are encoded here as HexEWKB new SchemaAndValueField("p", geomSchema, // 'SRID=3187;POINT(174.9479 -36.7208)'::postgis.geometry Geometry.createValue(geomSchema, DatatypeConverter.parseHexBinary("0101000020730C00001C7C613255DE6540787AA52C435C42C0"), 3187)), new SchemaAndValueField("ml", geogSchema, // 'MULTILINESTRING((169.1321 -44.7032, 167.8974 -44.6414))'::postgis.geography Geography.createValue(geogSchema, DatatypeConverter.parseHexBinary("0105000020E610000001000000010200000002000000A779C7293A2465400B462575025A46C0C66D3480B7FC6440C3D32B65195246C0"), 4326)) ); }
@Test public void shouldLoadSchemaForPostgisTypes() throws Exception { TestHelper.executeDDL("init_postgis.ddl"); TestHelper.executeDDL("postgis_create_tables.ddl"); PostgresConnectorConfig config = new PostgresConnectorConfig(TestHelper.defaultConfig().build()); schema = TestHelper.getSchema(config); try (PostgresConnection connection = TestHelper.create()) { schema.refresh(connection, false); final String[] testTables = new String[] {"public.postgis_table"}; assertTablesIncluded(testTables); Arrays.stream(testTables).forEach(tableId -> assertKeySchema(tableId, "pk", Schema.INT32_SCHEMA)); assertTableSchema("public.postgis_table", "p, ml", Geometry.builder().optional().build(), Geography.builder().optional().build()); } }
protected List<SchemaAndValueField> schemaAndValuesForPostgisTypes() { Schema geomSchema = Geometry.builder().optional().build(); Schema geogSchema = Geography.builder().optional().build(); return Arrays.asList( // geometries are encoded here as HexEWKB new SchemaAndValueField("p", geomSchema, // 'SRID=3187;POINT(174.9479 -36.7208)'::postgis.geometry Geometry.createValue(geomSchema, DatatypeConverter.parseHexBinary("0101000020730C00001C7C613255DE6540787AA52C435C42C0"), 3187)), new SchemaAndValueField("ml", geogSchema, // 'MULTILINESTRING((169.1321 -44.7032, 167.8974 -44.6414))'::postgis.geography Geography.createValue(geogSchema, DatatypeConverter.parseHexBinary("0105000020E610000001000000010200000002000000A779C7293A2465400B462575025A46C0C66D3480B7FC6440C3D32B65195246C0"), 4326)) ); }
@Test public void shouldLoadSchemaForPostgisTypes() throws Exception { TestHelper.executeDDL("init_postgis.ddl"); TestHelper.executeDDL("postgis_create_tables.ddl"); PostgresConnectorConfig config = new PostgresConnectorConfig(TestHelper.defaultConfig().build()); schema = TestHelper.getSchema(config); try (PostgresConnection connection = TestHelper.create()) { schema.refresh(connection, false); final String[] testTables = new String[] {"public.postgis_table"}; assertTablesIncluded(testTables); Arrays.stream(testTables).forEach(tableId -> assertKeySchema(tableId, "pk", Schema.INT32_SCHEMA)); assertTableSchema("public.postgis_table", "p, ml", Geometry.builder().optional().build(), Geography.builder().optional().build()); } }