Search in sources :

Example 1 with SwtDialog

use of org.pentaho.ui.xul.swt.tags.SwtDialog in project pdi-dataservice-server-plugin by pentaho.

the class DataServiceRemapNoStepsDialog method open.

void open() throws KettleException {
    Document xulDocument;
    try {
        xulDocument = initXul(parent, new KettleXulLoader(), new SwtXulRunner());
    } catch (XulException xulException) {
        throw new KettleException("Failed to initialize RemapNoStepsDialog.", xulException);
    }
    ((SwtDialog) xulDocument.getElementById(XUL_DIALOG_ID)).show();
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) XulException(org.pentaho.ui.xul.XulException) SwtDialog(org.pentaho.ui.xul.swt.tags.SwtDialog) KettleXulLoader(org.pentaho.di.ui.xul.KettleXulLoader) Document(org.pentaho.ui.xul.dom.Document) SwtXulRunner(org.pentaho.ui.xul.swt.SwtXulRunner)

Example 2 with SwtDialog

use of org.pentaho.ui.xul.swt.tags.SwtDialog in project pdi-dataservice-server-plugin by pentaho.

the class DataServiceRemapStepChooserDialog method open.

void open() throws KettleException {
    SwtDialog dialog;
    try {
        dialog = (SwtDialog) initXul(parent, new KettleXulLoader(), new SwtXulRunner()).getElementById(XUL_DIALOG_ID);
    } catch (XulException xulException) {
        throw new KettleException("Failed to initialize DataServiceRemapStepChooserDialog.", xulException);
    }
    dialog.show();
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) XulException(org.pentaho.ui.xul.XulException) SwtDialog(org.pentaho.ui.xul.swt.tags.SwtDialog) KettleXulLoader(org.pentaho.di.ui.xul.KettleXulLoader) SwtXulRunner(org.pentaho.ui.xul.swt.SwtXulRunner)

Example 3 with SwtDialog

use of org.pentaho.ui.xul.swt.tags.SwtDialog in project pdi-dataservice-server-plugin by pentaho.

the class DataServiceDialogControllerTest method testShowHelpUsesDialogShell.

@Test
public void testShowHelpUsesDialogShell() throws Exception {
    controller = mock(DataServiceDialogController.class);
    doCallRealMethod().when(controller).showHelp();
    SwtDialog dialog = mock(SwtDialog.class);
    doReturn(dialog).when(controller).getDialog();
    IllegalStateException runtimeException = new IllegalStateException();
    doThrow(runtimeException).when(dialog).getShell();
    try {
        controller.showHelp();
    } catch (Exception e) {
        MatcherAssert.assertThat(runtimeException, is(sameInstance(e)));
    }
    verify(dialog).getShell();
}
Also used : SwtDialog(org.pentaho.ui.xul.swt.tags.SwtDialog) XulException(org.pentaho.ui.xul.XulException) UndefinedDataServiceException(org.pentaho.di.trans.dataservice.serialization.UndefinedDataServiceException) MetaStoreException(org.pentaho.metastore.api.exceptions.MetaStoreException) DataServiceAlreadyExistsException(org.pentaho.di.trans.dataservice.serialization.DataServiceAlreadyExistsException) Test(org.junit.Test)

Example 4 with SwtDialog

use of org.pentaho.ui.xul.swt.tags.SwtDialog in project pdi-dataservice-server-plugin by pentaho.

the class DataServiceRemapConfirmationDialogControllerTest method testCancel.

@Test
public void testCancel() {
    DataServiceDelegate delegate = mock(DataServiceDelegate.class);
    DataServiceRemapConfirmationDialogController controller = spy(new DataServiceRemapConfirmationDialogController(mock(DataServiceMeta.class), Arrays.asList("Step1"), delegate));
    SwtDialog dialog = mock(SwtDialog.class);
    doReturn(dialog).when(controller).getElementById(anyString());
    controller.cancel();
    verify(dialog).dispose();
}
Also used : SwtDialog(org.pentaho.ui.xul.swt.tags.SwtDialog) DataServiceDelegate(org.pentaho.di.trans.dataservice.ui.DataServiceDelegate) Test(org.junit.Test)

Example 5 with SwtDialog

use of org.pentaho.ui.xul.swt.tags.SwtDialog in project pdi-dataservice-server-plugin by pentaho.

the class DataServiceRemapNoStepsDialogControllerTest method testController.

@Test
public void testController() {
    SwtDialog dialog = mock(SwtDialog.class);
    DataServiceRemapNoStepsDialogController controller = spy(new DataServiceRemapNoStepsDialogController());
    Assert.hasText(controller.getName());
    doReturn(dialog).when(controller).getElementById(anyString());
    controller.close();
    verify(dialog).dispose();
}
Also used : SwtDialog(org.pentaho.ui.xul.swt.tags.SwtDialog) Test(org.junit.Test)

Aggregations

SwtDialog (org.pentaho.ui.xul.swt.tags.SwtDialog)19 Test (org.junit.Test)13 XulException (org.pentaho.ui.xul.XulException)7 KettleException (org.pentaho.di.core.exception.KettleException)6 Document (org.pentaho.ui.xul.dom.Document)5 Shell (org.eclipse.swt.widgets.Shell)4 KettleXulLoader (org.pentaho.di.ui.xul.KettleXulLoader)4 SwtXulRunner (org.pentaho.ui.xul.swt.SwtXulRunner)4 Mockito.doAnswer (org.mockito.Mockito.doAnswer)3 InvocationOnMock (org.mockito.invocation.InvocationOnMock)3 Answer (org.mockito.stubbing.Answer)3 DataServiceDelegate (org.pentaho.di.trans.dataservice.ui.DataServiceDelegate)3 XulLoader (org.pentaho.ui.xul.XulLoader)3 XulRunner (org.pentaho.ui.xul.XulRunner)3 FileNotFoundException (java.io.FileNotFoundException)1 AccessDeniedException (java.nio.file.AccessDeniedException)1 NotDirectoryException (java.nio.file.NotDirectoryException)1 Matchers.anyString (org.mockito.Matchers.anyString)1 DataServiceMeta (org.pentaho.di.trans.dataservice.DataServiceMeta)1 DataServiceAlreadyExistsException (org.pentaho.di.trans.dataservice.serialization.DataServiceAlreadyExistsException)1