@Test public void testMetadata() throws TranslatorException { SolrMetadataProcessor mp = new SolrMetadataProcessor(); MetadataFactory mf = new MetadataFactory("vdb", 1, "solr", SystemMetadata.getInstance().getRuntimeTypeMap(), new Properties(), null); SolrConnection conn = Mockito.mock(SolrConnection.class); Mockito.stub(conn.getCoreName()).toReturn("SomeTable"); LinkedHashMap<String, FieldInfo> fields = new LinkedHashMap<String, LukeResponse.FieldInfo>(); fields.put("col1", buildField("col1", "string", EnumSet.of(FieldFlag.STORED, FieldFlag.INDEXED))); fields.put("col2", buildField("col2", "int", EnumSet.of(FieldFlag.STORED, FieldFlag.INDEXED))); fields.put("col3", buildField("col3", "int", EnumSet.of(FieldFlag.STORED, FieldFlag.INDEXED, FieldFlag.MULTI_VALUED))); fields.put("id", buildField("id", "long", EnumSet.of(FieldFlag.STORED, FieldFlag.INDEXED))); LukeResponse response = Mockito.mock(LukeResponse.class);; Mockito.stub(response.getFieldInfo()).toReturn(fields); Mockito.stub(conn.metadata(Mockito.any(LukeRequest.class))).toReturn(response); mp.process(mf, conn); String metadataDDL = DDLStringVisitor.getDDLString(mf.getSchema(), null, null); String expected = "CREATE FOREIGN TABLE SomeTable (\n" + " col1 string OPTIONS (SEARCHABLE 'Searchable'),\n" + " col2 integer OPTIONS (SEARCHABLE 'Searchable'),\n" + " col3 integer[] OPTIONS (SEARCHABLE 'Searchable'),\n" + " id long OPTIONS (SEARCHABLE 'Searchable'),\n" + " CONSTRAINT PK0 PRIMARY KEY(id)\n" + ") OPTIONS (UPDATABLE TRUE);"; assertEquals(expected, metadataDDL); }
@Override public void process(MetadataFactory metadataFactory, SolrConnection connection) throws TranslatorException { getConnectorMetadata(connection, metadataFactory); }
SolrMetadataProcessor implements MetadataProcessor<SolrConnection> { @Override public void process(MetadataFactory metadataFactory, SolrConnection connection) throws TranslatorException { getConnectorMetadata(connection, metadataFactory); } }
SolrMetadataProcessor implements MetadataProcessor<SolrConnection> { @Override public void process(MetadataFactory metadataFactory, SolrConnection connection) throws TranslatorException { getConnectorMetadata(connection, metadataFactory); }  }
SolrMetadataProcessor implements MetadataProcessor<SolrConnection> { @Override public void process(MetadataFactory metadataFactory, SolrConnection connection) throws TranslatorException { getConnectorMetadata(connection, metadataFactory); }  @Override void process(MetadataFactory metadataFactory,
            SolrConnection connection); void getConnectorMetadata(SolrConnection conn, MetadataFactory metadataFactory); }
SolrMetadataProcessor implements MetadataProcessor<SolrConnection> { @Override public void process(MetadataFactory metadataFactory, SolrConnection connection) throws TranslatorException { getConnectorMetadata(connection, metadataFactory); }  @Override void process(MetadataFactory metadataFactory,
            SolrConnection connection); void getConnectorMetadata(SolrConnection conn, MetadataFactory metadataFactory);  }