@Test public void testMetadataMoreSamples() throws TranslatorException { MongoDBMetadataProcessor mp = new MongoDBMetadataProcessor(); mp.setSampleSize(2); MetadataFactory mf = processExampleMetadata(mp); String metadataDDL = DDLStringVisitor.getDDLString(mf.getSchema(), null, null); String expected = "CREATE FOREIGN TABLE \"table\" (\n" + " \"_id\" integer,\n" + " col2 double,\n" + " col3 string OPTIONS (SEARCHABLE 'Unsearchable'),\n" + " col5 boolean,\n" + " col6 string,\n" + " col7 string[] OPTIONS (SEARCHABLE 'Unsearchable'),\n" + " col8 varbinary OPTIONS (NATIVE_TYPE 'org.bson.types.Binary'),\n" + " col9 string,\n" + " CONSTRAINT PK0 PRIMARY KEY(\"_id\")\n" + ") OPTIONS (UPDATABLE TRUE, \"teiid_rel:fqn\" 'collection=table');\n" + "\n" + "CREATE FOREIGN TABLE child (\n" + " col1 string,\n" + " col2 string,\n" + " \"_id\" integer OPTIONS (UPDATABLE FALSE),\n" + " CONSTRAINT PK0 PRIMARY KEY(\"_id\"),\n" + " FOREIGN KEY(\"_id\") REFERENCES \"table\" \n" + ") OPTIONS (UPDATABLE TRUE, \"teiid_mongo:MERGE\" 'table', \"teiid_rel:fqn\" 'collection=table/embedded=child');\n" + "\n" + "CREATE FOREIGN TABLE embedded (\n" + " col1 integer,\n" + " col2 varbinary,\n" + " \"_id\" integer OPTIONS (UPDATABLE FALSE),\n" + " CONSTRAINT PK0 PRIMARY KEY(\"_id\"),\n" + " FOREIGN KEY(\"_id\") REFERENCES \"table\" \n" + ") OPTIONS (UPDATABLE TRUE, \"teiid_mongo:MERGE\" 'table', \"teiid_rel:fqn\" 'collection=table/embedded=embedded');\n" + "\n" + "CREATE FOREIGN TABLE embedded_1 (\n" + " col1 string,\n" + " col2 string\n" + ") OPTIONS (UPDATABLE TRUE, \"teiid_rel:fqn\" 'collection=embedded');\n" + "\n" + "CREATE FOREIGN TABLE emptyFirst (\n" + " \"_id\" string AUTO_INCREMENT OPTIONS (NATIVE_TYPE 'org.bson.types.ObjectId'),\n" + " col2 double,\n" + " col3 long,\n" + " CONSTRAINT PK0 PRIMARY KEY(\"_id\")\n" + ") OPTIONS (UPDATABLE TRUE, \"teiid_rel:fqn\" 'collection=emptyFirst');"; assertEquals(expected, metadataDDL.replace("\t", " ")); }
public void setSampleSize(int sampleSize) { this.sampleSize = sampleSize; }
MongoDBMetadataProcessor implements MetadataProcessor<MongoDBConnection> { public void setSampleSize(int sampleSize) { this.sampleSize = sampleSize; } }
MongoDBMetadataProcessor implements MetadataProcessor<MongoDBConnection> { public void setSampleSize(int sampleSize) { this.sampleSize = sampleSize; }  }
MongoDBMetadataProcessor implements MetadataProcessor<MongoDBConnection> { public void setSampleSize(int sampleSize) { this.sampleSize = sampleSize; }  @Override void process(MetadataFactory metadataFactory, MongoDBConnection connection); @TranslatorProperty(display="Exclude Tables", category=PropertyType.IMPORT, description="A case-insensitive regular expression that when matched against a fully qualified Teiid table name will exclude it from import. Applied after table names are retrieved. Use a negative look-ahead (?!<inclusion pattern>).* to act as an inclusion filter.") String getExcludeTables(); void setExcludeTables(String excludeTables); @TranslatorProperty(display="Include Tables", category=PropertyType.IMPORT, description="A case-insensitive regular expression that when matched against a fully qualified Teiid table name will include it from import. Applied after table names are retrieved. Use a negative look-ahead (?!<inclusion pattern>).* to act as an exclusion filter") String getIncludeTables(); void setIncludeTables(String tableNamePattern); @TranslatorProperty(display="Sample Size", category=PropertyType.IMPORT, description="The number of top level documents of a given collection name to sample.") int getSampleSize(); void setSampleSize(int sampleSize); @TranslatorProperty(display="Full Embedded Names", category=PropertyType.IMPORT, description="Whether to prefix embedded table names with their parents, e.g. parent_embedded") boolean isFullEmbeddedNames(); void setFullEmbeddedNames(boolean fullEmbeddedNames); }
MongoDBMetadataProcessor implements MetadataProcessor<MongoDBConnection> { public void setSampleSize(int sampleSize) { this.sampleSize = sampleSize; }  @Override void process(MetadataFactory metadataFactory, MongoDBConnection connection); @TranslatorProperty(display="Exclude Tables", category=PropertyType.IMPORT, description="A case-insensitive regular expression that when matched against a fully qualified Teiid table name will exclude it from import. Applied after table names are retrieved. Use a negative look-ahead (?!<inclusion pattern>).* to act as an inclusion filter.") String getExcludeTables(); void setExcludeTables(String excludeTables); @TranslatorProperty(display="Include Tables", category=PropertyType.IMPORT, description="A case-insensitive regular expression that when matched against a fully qualified Teiid table name will include it from import. Applied after table names are retrieved. Use a negative look-ahead (?!<inclusion pattern>).* to act as an exclusion filter") String getIncludeTables(); void setIncludeTables(String tableNamePattern); @TranslatorProperty(display="Sample Size", category=PropertyType.IMPORT, description="The number of top level documents of a given collection name to sample.") int getSampleSize(); void setSampleSize(int sampleSize); @TranslatorProperty(display="Full Embedded Names", category=PropertyType.IMPORT, description="Whether to prefix embedded table names with their parents, e.g. parent_embedded") boolean isFullEmbeddedNames(); void setFullEmbeddedNames(boolean fullEmbeddedNames); @ExtensionMetadataProperty(applicable=Table.class, datatype=String.class, display="Merge Into Table", description="Declare the name of table that this table needs to be merged into. No separate copy maintained")
    static final String MERGE; @ExtensionMetadataProperty(applicable=Table.class, datatype=String.class, display="Embedded Into Table", description="Declare the name of table that this table needs to be embedded into. A separate copy is also maintained")
    static final String EMBEDDABLE; }