• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java DatabaseConfigurationImportRule类的典型用法和代码示例

java 2次浏览

本文整理汇总了Java中org.pentaho.di.imp.rules.DatabaseConfigurationImportRule的典型用法代码示例。如果您正苦于以下问题:Java DatabaseConfigurationImportRule类的具体用法?Java DatabaseConfigurationImportRule怎么用?Java DatabaseConfigurationImportRule使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

DatabaseConfigurationImportRule类属于org.pentaho.di.imp.rules包,在下文中一共展示了DatabaseConfigurationImportRule类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getComposite

点赞 3

import org.pentaho.di.imp.rules.DatabaseConfigurationImportRule; //导入依赖的package包/类
public Composite getComposite(Composite parent, ImportRuleInterface importRule) {
  rule = (DatabaseConfigurationImportRule) importRule;
  databaseMeta = rule.getDatabaseMeta();
  PropsUI props = PropsUI.getInstance();
  
  composite = new Composite(parent, SWT.NONE);
  props.setLook(composite);
  composite.setLayout(new FillLayout());

  label = new Label(composite, SWT.SINGLE | SWT.BORDER | SWT.LEFT);
  props.setLook(label);
  label.setText("Database configuration : (not configured)");

  button = new Button(composite, SWT.PUSH);
  button.setText("Edit...");
  button.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { editDatabase(); } });
  
  return composite;
}
 

开发者ID:yintaoxue,
项目名称:read-open-source-code,
代码行数:20,
代码来源:DatabaseConfigurationImportRuleComposite.java

示例2: getComposite

点赞 3

import org.pentaho.di.imp.rules.DatabaseConfigurationImportRule; //导入依赖的package包/类
public Composite getComposite( Composite parent, ImportRuleInterface importRule ) {
  rule = (DatabaseConfigurationImportRule) importRule;
  databaseMeta = rule.getDatabaseMeta();
  PropsUI props = PropsUI.getInstance();

  composite = new Composite( parent, SWT.NONE );
  props.setLook( composite );
  composite.setLayout( new FillLayout() );

  label = new Label( composite, SWT.SINGLE | SWT.BORDER | SWT.LEFT );
  props.setLook( label );
  label.setText( "Database configuration : (not configured)" );

  button = new Button( composite, SWT.PUSH );
  button.setText( "Edit..." );
  button.addSelectionListener( new SelectionAdapter() {
    public void widgetSelected( SelectionEvent event ) {
      editDatabase();
    }
  } );

  return composite;
}
 

开发者ID:pentaho,
项目名称:pentaho-kettle,
代码行数:24,
代码来源:DatabaseConfigurationImportRuleComposite.java

示例3: testRule

点赞 2

import org.pentaho.di.imp.rules.DatabaseConfigurationImportRule; //导入依赖的package包/类
public void testRule() throws Exception {

    // Assemble a new database.
    //
    String DBNAME="test";
    String HOSTNAME="localhost";
    String PORT="3306";
    String USERNAME="foo";
    String PASSWORD="bar";
    DatabaseMeta verifyMeta = new DatabaseMeta("LOGDB", "MYSQL", "JDBC", HOSTNAME, DBNAME, PORT, USERNAME, PASSWORD);
    
    // Create a transformation to test.
    //
    TransMeta transMeta = new TransMeta();
    transMeta.addDatabase((DatabaseMeta)verifyMeta.clone());
   
    // Load the plugin to test from the registry.
    //
    PluginRegistry registry = PluginRegistry.getInstance();
    PluginInterface plugin = registry.findPluginWithId(ImportRulePluginType.class, "DatabaseConfiguration");
    assertNotNull("The 'database configuration' rule could not be found in the plugin registry!", plugin);
    DatabaseConfigurationImportRule rule = (DatabaseConfigurationImportRule) registry.loadClass(plugin);
    assertNotNull("The 'database configuration' class could not be loaded by the plugin registry!", plugin);

    // Set the appropriate rule..
    //
    rule.setEnabled(true);
    
    List<ImportValidationFeedback> feedback = rule.verifyRule(transMeta);
    assertTrue("We didn't get any feedback from the 'database configuration'", !feedback.isEmpty());
    assertTrue("An error ruling was expected", feedback.get(0).getResultType()==ImportValidationResultType.ERROR);

    rule.setDatabaseMeta(verifyMeta);

    feedback = rule.verifyRule(transMeta);
    assertTrue("We didn't get any feedback from the 'transformation has description rule'", !feedback.isEmpty());
    assertTrue("An approval ruling was expected", feedback.get(0).getResultType()==ImportValidationResultType.APPROVAL);

    // Create some errors...
    //
    verifyMeta.setDBName("incorrect-test");
    feedback = rule.verifyRule(transMeta);
    assertTrue("We didn't get any feedback from the 'transformation has description rule'", !feedback.isEmpty());
    assertTrue("An error ruling was expected validating the db name", feedback.get(0).getResultType()==ImportValidationResultType.ERROR);
    verifyMeta.setDBName(DBNAME);

    verifyMeta.setHostname("incorrect-hostname");
    feedback = rule.verifyRule(transMeta);
    assertTrue("We didn't get any feedback from the 'transformation has description rule'", !feedback.isEmpty());
    assertTrue("An error ruling was expected validating the db hostname", feedback.get(0).getResultType()==ImportValidationResultType.ERROR);
    verifyMeta.setHostname(HOSTNAME);
    
    verifyMeta.setDBPort("incorrect-port");
    feedback = rule.verifyRule(transMeta);
    assertTrue("We didn't get any feedback from the 'transformation has description rule'", !feedback.isEmpty());
    assertTrue("An error ruling was expected validating the db port", feedback.get(0).getResultType()==ImportValidationResultType.ERROR);
    verifyMeta.setDBPort(PORT);

    verifyMeta.setUsername("incorrect-username");
    feedback = rule.verifyRule(transMeta);
    assertTrue("We didn't get any feedback from the 'transformation has description rule'", !feedback.isEmpty());
    assertTrue("An error ruling was expected validating the db username", feedback.get(0).getResultType()==ImportValidationResultType.ERROR);
    verifyMeta.setUsername(USERNAME);

    verifyMeta.setPassword("incorrect-password");
    feedback = rule.verifyRule(transMeta);
    assertTrue("We didn't get any feedback from the 'transformation has description rule'", !feedback.isEmpty());
    assertTrue("An error ruling was expected validating the db password", feedback.get(0).getResultType()==ImportValidationResultType.ERROR);
    verifyMeta.setPassword(PASSWORD);

    // No feedback expected!
    //
    rule.setEnabled(false);

    feedback = rule.verifyRule(transMeta);
    assertTrue("We didn't expect any feedback from the 'transformation has trans log table configured' since disabled", feedback.isEmpty());
  }
 

开发者ID:bsspirit,
项目名称:kettle-4.4.0-stable,
代码行数:78,
代码来源:DatabaseConfigurationImportRuleTest.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)