@@ -276,4 +276,59 @@ public void testImportWithErrors() throws IOException {
276276 PAssert .that (writtenToServing ).satisfies (hasCount (0 ));
277277 testPipeline .run ();
278278 }
279+
280+
281+ @ Test
282+ public void testImportWithoutWarehouseStore () throws IOException {
283+ ImportSpec importSpec =
284+ ProtoUtil .decodeProtoYaml (
285+ "---\n "
286+ + "type: file\n "
287+ + "options:\n "
288+ + " format: csv\n "
289+ + " # path: to be overwritten in tests\n "
290+ + "entities:\n "
291+ + " - testEntity\n "
292+ + "schema:\n "
293+ + " entityIdColumn: id\n "
294+ + " timestampValue: 2018-09-25T00:00:00.000Z\n "
295+ + " fields:\n "
296+ + " - name: id\n "
297+ + " - featureId: testEntity.none.testInt64NoWarehouse\n "
298+ + " - featureId: testEntity.none.testStringNoWarehouse\n "
299+ + "\n " ,
300+ ImportSpec .getDefaultInstance ());
301+
302+ File csvFile = folder .newFile ("data.csv" );
303+
304+ // Note the string and integer features are in the wrong positions for the import spec.
305+ Files .asCharSink (csvFile , Charsets .UTF_8 ).write ("1,101,a\n 2,202,b\n 3,303,c\n " );
306+ importSpec = initImportSpec (importSpec , csvFile .toString ());
307+
308+ ImportJobOptions options = initOptions ();
309+ options .setErrorsStoreType (MOCK_ERRORS_STORE_TYPE );
310+
311+ Injector injector =
312+ Guice .createInjector (
313+ new ImportJobModule (options , importSpec ), new TestPipelineModule (testPipeline ));
314+
315+ ImportJob job = injector .getInstance (ImportJob .class );
316+
317+ injector .getInstance (ImportJob .class );
318+ job .expand ();
319+
320+ PCollection <FeatureRowExtended > writtenToServing =
321+ PCollectionList .of (ServingStoreService .get (MockServingStore .class ).getWrite ().getInputs ())
322+ .apply ("flatten serving input" , Flatten .pCollections ());
323+
324+ PCollection <FeatureRowExtended > writtenToErrors =
325+ PCollectionList .of (ErrorsStoreService .get (MockErrorsStore .class ).getWrite ().getInputs ())
326+ .apply ("flatten errors input" , Flatten .pCollections ());
327+
328+ PAssert .that (writtenToErrors )
329+ .satisfies (hasCount (0 ));
330+
331+ PAssert .that (writtenToServing ).satisfies (hasCount (3 ));
332+ testPipeline .run ();
333+ }
279334}
0 commit comments