Search in sources :

Example 1 with AbstractXulLoader

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

the class DriverDetailsDialogTest method testInitXul.

@Test
public void testInitXul() throws Exception {
    DriverDetailsDialog dialog = mock(DriverDetailsDialog.class);
    Shell parentShell = mock(Shell.class);
    AbstractXulLoader xulLoader = mock(AbstractXulLoader.class);
    XulRunner xulRunner = mock(XulRunner.class);
    Document document = mock(Document.class);
    XulDomContainer container = mock(XulDomContainer.class);
    doReturn(container).when(xulLoader).loadXul(anyString(), any(ResourceBundle.class));
    doReturn(document).when(container).getDocumentRoot();
    doCallRealMethod().when(dialog).initXul(parentShell, xulLoader, xulRunner);
    assertThat(document, is(sameInstance(dialog.initXul(parentShell, xulLoader, xulRunner))));
    verify(xulLoader).setOuterContext(parentShell);
    verify(xulLoader).registerClassLoader(dialog.getClass().getClassLoader());
    verify(xulLoader).loadXul(anyString(), any(ResourceBundle.class));
    verify(container).addEventHandler(any(DriverDetailsDialogController.class));
    verify(container).getDocumentRoot();
    verify(xulRunner).addContainer(container);
    verify(xulRunner).initialize();
}
Also used : DriverDetailsDialogController(org.pentaho.di.trans.dataservice.ui.controller.DriverDetailsDialogController) Shell(org.eclipse.swt.widgets.Shell) AbstractXulLoader(org.pentaho.ui.xul.impl.AbstractXulLoader) ResourceBundle(java.util.ResourceBundle) Document(org.pentaho.ui.xul.dom.Document) XulDomContainer(org.pentaho.ui.xul.XulDomContainer) XulRunner(org.pentaho.ui.xul.XulRunner) Test(org.junit.Test)

Example 2 with AbstractXulLoader

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

the class DriverDetailsDialogTest method testInitXulThrowsKettleExceptionOnError.

@Test(expected = KettleException.class)
public void testInitXulThrowsKettleExceptionOnError() throws KettleException {
    DriverDetailsDialog dialog = mock(DriverDetailsDialog.class);
    AbstractXulLoader xulLoader = mock(AbstractXulLoader.class);
    doCallRealMethod().when(dialog).initXul(null, xulLoader, null);
    doThrow(XulException.class).when(xulLoader).setOuterContext(null);
    dialog.initXul(null, xulLoader, null);
}
Also used : AbstractXulLoader(org.pentaho.ui.xul.impl.AbstractXulLoader) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 AbstractXulLoader (org.pentaho.ui.xul.impl.AbstractXulLoader)2 ResourceBundle (java.util.ResourceBundle)1 Shell (org.eclipse.swt.widgets.Shell)1 DriverDetailsDialogController (org.pentaho.di.trans.dataservice.ui.controller.DriverDetailsDialogController)1 XulDomContainer (org.pentaho.ui.xul.XulDomContainer)1 XulRunner (org.pentaho.ui.xul.XulRunner)1 Document (org.pentaho.ui.xul.dom.Document)1