@Test public void getDdlOptionsPreviewTest() { when( teraDataBulkLoaderMetaMock.getDatabaseMeta() ).thenReturn( dataBaseMetaDataMock ); when( dataBaseMetaDataMock.getHostname() ).thenReturn( "hostname" ); when( dataBaseMetaDataMock.getUsername() ).thenReturn( "username" ); String password = "myPassword"; String expectedDdlOptionsPreview = "DEFINE OPERATOR DDL_OPERATOR\n" + "TYPE DDL\n" + "ATTRIBUTES\n" + " (\n" + " VARCHAR TdpId = 'hostname',\n" + " VARCHAR UserName = 'username',\n" + " VARCHAR UserPassword = 'myPassword',\n" + " VARCHAR ErrorList = '3807'\n" + " );\n"; assertEquals( expectedDdlOptionsPreview, teraDataBulkLoaderRoutines.getDdlOptions( true, password ).toString() ); }
@VisibleForTesting DefineSchema getDdlOptions( boolean isPreview, String hiddenPassword ) { DefineSchema ddlOptions = new DefineSchema( "DDL_OPERATOR", "DDL", null ); ddlOptions.addField( "TdpId ", this.meta.getDatabaseMeta().getHostname() ); ddlOptions.addField( "UserName ", this.meta.getDatabaseMeta().getUsername() ); ddlOptions.addField( "UserPassword ", isPreview ? hiddenPassword : this.meta.getDatabaseMeta().getPassword() ); ddlOptions.addField( "ErrorList ", "3807" ); return ddlOptions; }
TeraDataBulkLoaderRoutines { @VisibleForTesting DefineSchema getDdlOptions( boolean isPreview, String hiddenPassword ) { DefineSchema ddlOptions = new DefineSchema( "DDL_OPERATOR", "DDL", null ); ddlOptions.addField( "TdpId ", this.meta.getDatabaseMeta().getHostname() ); ddlOptions.addField( "UserName ", this.meta.getDatabaseMeta().getUsername() ); ddlOptions.addField( "UserPassword ", isPreview ? hiddenPassword : this.meta.getDatabaseMeta().getPassword() ); ddlOptions.addField( "ErrorList ", "3807" ); return ddlOptions; } }
TeraDataBulkLoaderRoutines { @VisibleForTesting DefineSchema getDdlOptions( boolean isPreview, String hiddenPassword ) { DefineSchema ddlOptions = new DefineSchema( "DDL_OPERATOR", "DDL", null ); ddlOptions.addField( "TdpId ", this.meta.getDatabaseMeta().getHostname() ); ddlOptions.addField( "UserName ", this.meta.getDatabaseMeta().getUsername() ); ddlOptions.addField( "UserPassword ", isPreview ? hiddenPassword : this.meta.getDatabaseMeta().getPassword() ); ddlOptions.addField( "ErrorList ", "3807" ); return ddlOptions; } TeraDataBulkLoaderRoutines( TeraDataBulkLoader parent, TeraDataBulkLoaderMeta meta ); }
TeraDataBulkLoaderRoutines { @VisibleForTesting DefineSchema getDdlOptions( boolean isPreview, String hiddenPassword ) { DefineSchema ddlOptions = new DefineSchema( "DDL_OPERATOR", "DDL", null ); ddlOptions.addField( "TdpId ", this.meta.getDatabaseMeta().getHostname() ); ddlOptions.addField( "UserName ", this.meta.getDatabaseMeta().getUsername() ); ddlOptions.addField( "UserPassword ", isPreview ? hiddenPassword : this.meta.getDatabaseMeta().getPassword() ); ddlOptions.addField( "ErrorList ", "3807" ); return ddlOptions; } 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 ); }
TeraDataBulkLoaderRoutines { @VisibleForTesting DefineSchema getDdlOptions( boolean isPreview, String hiddenPassword ) { DefineSchema ddlOptions = new DefineSchema( "DDL_OPERATOR", "DDL", null ); ddlOptions.addField( "TdpId ", this.meta.getDatabaseMeta().getHostname() ); ddlOptions.addField( "UserName ", this.meta.getDatabaseMeta().getUsername() ); ddlOptions.addField( "UserPassword ", isPreview ? hiddenPassword : this.meta.getDatabaseMeta().getPassword() ); ddlOptions.addField( "ErrorList ", "3807" ); return ddlOptions; } 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 );  }