TeraDataBulkLoaderRoutines { @VisibleForTesting DefineSchema getDataConnector( boolean isPreview ) { DefineSchema dataConnector = new DefineSchema( "ACCESS_MODULE_READER", "DATACONNECTOR PRODUCER", isPreview ? this.meta.getSchemaName() : parent.environmentSubstitute( this.meta.getSchemaName() ) ); dataConnector.addField( "PrivateLogName", isPreview ? this.meta.getAccessLogFile() : parent.environmentSubstitute( this.meta.getAccessLogFile() ) ); dataConnector.addField( "AccessModuleName", "np_axsmod.so" ); dataConnector.addField( "AccessModuleInitStr", null ); dataConnector.addField( "FileName", parent != null ? parent.data.fifoFilename : this.meta.getFifoFileName() ); dataConnector.addField( "Format", "Unformatted" ); dataConnector.addField( "OpenMode", "Read" ); return dataConnector; } TeraDataBulkLoaderRoutines( TeraDataBulkLoader parent, TeraDataBulkLoaderMeta meta ); String dropTable( boolean isPreview, String user, String suffix ); String createScriptFile(); void createFromExistingScriptFile(); String createGeneratedScriptFile(); String createGeneratedScriptFile( Map<String, Integer> inputFieldTypes, Map<String, Integer> inputFieldLength );  }
@Test public void getDataConnectorTest() { when( teraDataBulkLoaderMetaMock.getSchemaName() ).thenReturn( "schemaName" ); when( teraDataBulkLoaderMetaMock.getAccessLogFile() ).thenReturn( "accessLog" ); when( teraDataBulkLoaderMetaMock.getFifoFileName() ).thenReturn( "fifoFileName" ); setInternalState( teraDataBulkLoaderRoutines, "parent", null ); String expectedDataConnector = "DEFINE OPERATOR ACCESS_MODULE_READER\n" + "TYPE DATACONNECTOR PRODUCER\n" + "SCHEMA schemaName\n" + "ATTRIBUTES\n" + " (\n" + " VARCHAR PrivateLogName = 'accessLog',\n" + " VARCHAR AccessModuleName = 'np_axsmod.so',\n" + " VARCHAR FileName = 'fifoFileName',\n" + " VARCHAR Format = 'Unformatted',\n" + " VARCHAR OpenMode = 'Read'\n" + " );\n"; assertEquals( expectedDataConnector, teraDataBulkLoaderRoutines.getDataConnector( true ).toString() ); }