Search in sources :

Example 31 with XulDomContainer

use of org.pentaho.ui.xul.XulDomContainer in project pdi-dataservice-server-plugin by pentaho.

the class DataServiceDialogTest method testLoadXul.

@Test
public void testLoadXul() throws Exception {
    Shell shell = mock(Shell.class);
    XulLoader xulLoader = mock(XulLoader.class);
    XulRunner xulRunner = mock(XulRunner.class);
    XulDomContainer xulDomContainer = mock(XulDomContainer.class);
    final ResourceBundle resourceBundle = mock(ResourceBundle.class);
    DataServiceDialog dialog = new DataServiceDialog(controller, model) {

        @Override
        protected ResourceBundle createResourceBundle(Class<?> packageClass) {
            assertThat(packageClass, equalTo((Class) DataServiceDialog.class));
            assertThat(super.createResourceBundle(packageClass), isA(ResourceBundle.class));
            return resourceBundle;
        }
    };
    when(xulLoader.loadXul(anyString(), same(resourceBundle))).thenReturn(xulDomContainer);
    dialog.loadXul(shell, xulLoader, xulRunner);
    verify(xulLoader).setOuterContext(shell);
    verify(xulLoader).registerClassLoader(any(ClassLoader.class));
    verify(xulDomContainer).addEventHandler(controller);
    verify(xulRunner).addContainer(xulDomContainer);
    verify(xulRunner).initialize();
}
Also used : Shell(org.eclipse.swt.widgets.Shell) KettleXulLoader(org.pentaho.di.ui.xul.KettleXulLoader) XulLoader(org.pentaho.ui.xul.XulLoader) ResourceBundle(java.util.ResourceBundle) XulDomContainer(org.pentaho.ui.xul.XulDomContainer) XulRunner(org.pentaho.ui.xul.XulRunner) SwtXulRunner(org.pentaho.ui.xul.swt.SwtXulRunner) Test(org.junit.Test)

Example 32 with XulDomContainer

use of org.pentaho.ui.xul.XulDomContainer in project pdi-dataservice-server-plugin by pentaho.

the class DataServiceRemapConfirmationDialogTest method testInitXul.

@Test
public void testInitXul() throws KettleException, XulException {
    Shell shell = mock(Shell.class);
    XulLoader xulLoader = mock(XulLoader.class);
    XulRunner xulRunner = mock(XulRunner.class);
    XulDomContainer xulDomContainer = mock(XulDomContainer.class);
    when(xulLoader.loadXul(anyString(), any(ResourceBundle.class))).thenReturn(xulDomContainer);
    DataServiceRemapConfirmationDialog dialog = mock(DataServiceRemapConfirmationDialog.class);
    when(dialog.initXul(shell, xulLoader, xulRunner)).thenCallRealMethod();
    dialog.initXul(shell, xulLoader, xulRunner);
    verify(xulLoader).setOuterContext(shell);
    verify(xulLoader).registerClassLoader(any(ClassLoader.class));
    verify(xulRunner).addContainer(xulDomContainer);
    verify(xulRunner).initialize();
}
Also used : Shell(org.eclipse.swt.widgets.Shell) XulLoader(org.pentaho.ui.xul.XulLoader) ResourceBundle(java.util.ResourceBundle) XulDomContainer(org.pentaho.ui.xul.XulDomContainer) XulRunner(org.pentaho.ui.xul.XulRunner) Test(org.junit.Test)

Example 33 with XulDomContainer

use of org.pentaho.ui.xul.XulDomContainer in project pdi-dataservice-server-plugin by pentaho.

the class DataServiceRemapStepChooserDialogTest method testInitXul.

@Test
public void testInitXul() throws KettleException, XulException {
    Shell shell = mock(Shell.class);
    XulLoader xulLoader = mock(XulLoader.class);
    XulRunner xulRunner = mock(XulRunner.class);
    XulDomContainer xulDomContainer = mock(XulDomContainer.class);
    when(xulLoader.loadXul(anyString(), any(ResourceBundle.class))).thenReturn(xulDomContainer);
    DataServiceRemapStepChooserDialog dialog = mock(DataServiceRemapStepChooserDialog.class);
    when(dialog.initXul(shell, xulLoader, xulRunner)).thenCallRealMethod();
    dialog.initXul(shell, xulLoader, xulRunner);
    verify(xulLoader).setOuterContext(shell);
    verify(xulLoader).registerClassLoader(any(ClassLoader.class));
    verify(xulRunner).addContainer(xulDomContainer);
    verify(xulRunner).initialize();
}
Also used : Shell(org.eclipse.swt.widgets.Shell) XulLoader(org.pentaho.ui.xul.XulLoader) ResourceBundle(java.util.ResourceBundle) XulDomContainer(org.pentaho.ui.xul.XulDomContainer) XulRunner(org.pentaho.ui.xul.XulRunner) Test(org.junit.Test)

Aggregations

XulDomContainer (org.pentaho.ui.xul.XulDomContainer)33 ResourceBundle (java.util.ResourceBundle)14 KettleXulLoader (org.pentaho.di.ui.xul.KettleXulLoader)12 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)11 XulLoader (org.pentaho.ui.xul.XulLoader)11 ToolBar (org.eclipse.swt.widgets.ToolBar)8 Test (org.junit.Test)8 KettleException (org.pentaho.di.core.exception.KettleException)8 XulException (org.pentaho.ui.xul.XulException)8 XulRunner (org.pentaho.ui.xul.XulRunner)7 Shell (org.eclipse.swt.widgets.Shell)6 XulComponent (org.pentaho.ui.xul.XulComponent)6 XulSpoonResourceBundle (org.pentaho.di.ui.spoon.XulSpoonResourceBundle)5 Document (org.pentaho.ui.xul.dom.Document)5 Before (org.junit.Before)2 KettleValueException (org.pentaho.di.core.exception.KettleValueException)2 TransMeta (org.pentaho.di.trans.TransMeta)2 Spoon (org.pentaho.di.ui.spoon.Spoon)2 DatabaseConnectionDialog (org.pentaho.ui.database.DatabaseConnectionDialog)2 XulDialog (org.pentaho.ui.xul.containers.XulDialog)2