use of org.pentaho.ui.xul.XulDomContainer in project pdi-dataservice-server-plugin by pentaho.
the class DataServiceRemapNoStepsDialogTest 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);
DataServiceRemapNoStepsDialog dialog = mock(DataServiceRemapNoStepsDialog.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();
}
use of org.pentaho.ui.xul.XulDomContainer 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();
}
use of org.pentaho.ui.xul.XulDomContainer in project pdi-dataservice-server-plugin by pentaho.
the class ParameterGenerationOverlayTest method testApply.
@Test
public void testApply() throws Exception {
ParameterGenerationController controller = mock(ParameterGenerationController.class);
XulDomContainer xulDomContainer = mock(XulDomContainer.class);
TransMeta transMeta = mock(TransMeta.class);
StepMeta supportedStep = new StepMeta("supportedStep", mock(StepMetaInterface.class));
when(dialog.getModel()).thenReturn(model);
when(model.getTransMeta()).thenReturn(transMeta);
when(transMeta.getSteps()).thenReturn(ImmutableList.of(supportedStep, mock(StepMeta.class)));
when(factory.supportsStep(supportedStep)).thenReturn(true);
when(factory.createController(model)).thenReturn(controller);
when(dialog.applyOverlay(same(overlay), anyString())).thenReturn(xulDomContainer);
overlay.apply(dialog);
verify(xulDomContainer).addEventHandler(controller);
verify(controller).initBindings(ImmutableList.of("supportedStep"));
}
use of org.pentaho.ui.xul.XulDomContainer in project data-access by pentaho.
the class GwtImportDialog method xulLoaded.
public void xulLoaded(GwtXulRunner runner) {
try {
XulDomContainer container = runner.getXulDomContainers().get(0);
BindingFactory bf = new GwtBindingFactory(container.getDocumentRoot());
ResourceBundle resBundle = (ResourceBundle) container.getResourceBundles().get(0);
datasourceMessages = new GwtDatasourceMessages();
datasourceMessages.setMessageBundle(resBundle);
metadataImportDialogController = new MetadataImportDialogController();
metadataImportDialogController.setBindingFactory(bf);
container.addEventHandler(metadataImportDialogController);
metadataImportDialogController.setDatasourceMessages(datasourceMessages);
analysisImportDialogController = new AnalysisImportDialogController();
analysisImportDialogController.setBindingFactory(bf);
container.addEventHandler(analysisImportDialogController);
analysisImportDialogController.setDatasourceMessages(datasourceMessages);
importDialogController = new ImportDialogController();
importDialogController.addImportPerspective(0, metadataImportDialogController);
importDialogController.addImportPerspective(1, analysisImportDialogController);
container.addEventHandler(importDialogController);
runner.initialize();
runner.start();
importDialogController.init();
metadataImportDialogController.init();
analysisImportDialogController.init();
if (constructorListener != null) {
constructorListener.asyncConstructorDone(this);
}
} catch (Exception e) {
e.printStackTrace();
}
}
use of org.pentaho.ui.xul.XulDomContainer in project pentaho-kettle by pentaho.
the class FragmentHandlerTest method testRefreshOptions.
@Test
public void testRefreshOptions() throws Exception {
XulListbox connectionBox = mock(XulListbox.class);
when(document.getElementById("connection-type-list")).thenReturn(connectionBox);
when(connectionBox.getSelectedItem()).thenReturn("myDb");
XulListbox accessBox = mock(XulListbox.class);
when(document.getElementById("access-type-list")).thenReturn(accessBox);
when(accessBox.getSelectedItem()).thenReturn("Native");
DataHandler dataHandler = mock(DataHandler.class);
when(xulDomContainer.getEventHandler("dataHandler")).thenReturn(dataHandler);
DatabaseInterface dbInterface = mock(DatabaseInterface.class);
when(dbInterface.getDefaultDatabasePort()).thenReturn(5309);
DataHandler.connectionMap.put("myDb", dbInterface);
XulComponent component = mock(XulComponent.class);
XulComponent parent = mock(XulComponent.class);
when(component.getParent()).thenReturn(parent);
when(document.getElementById("database-options-box")).thenReturn(component);
XulDomContainer fragmentContainer = mock(XulDomContainer.class);
Document mockDoc = mock(Document.class);
XulComponent firstChild = mock(XulComponent.class);
when(mockDoc.getFirstChild()).thenReturn(firstChild);
when(fragmentContainer.getDocumentRoot()).thenReturn(mockDoc);
when(xulDomContainer.loadFragment(anyString(), any(Object.class))).thenReturn(fragmentContainer);
XulTextbox portBox = mock(XulTextbox.class);
when(document.getElementById("port-number-text")).thenReturn(portBox);
fragmentHandler.refreshOptions();
// Iterate through the other database access types
when(accessBox.getSelectedItem()).thenReturn("JNDI");
fragmentHandler.refreshOptions();
when(accessBox.getSelectedItem()).thenReturn("ODBC");
fragmentHandler.refreshOptions();
when(accessBox.getSelectedItem()).thenReturn("OCI");
fragmentHandler.refreshOptions();
when(accessBox.getSelectedItem()).thenReturn("Plugin");
fragmentHandler.refreshOptions();
}
Aggregations