private void openDialog() throws Exception { AbstractUIRunner.syncRun( new ThrowableRunnable() { @Override public void run() throws Throwable { mStrategy = createDeployedStrategy("Strategy1"); mStrategy.setUrn(new ModuleURN("metc:strategy:system:Strategy1")); mStrategy.setClassName("Claz"); mStrategy.setLanguage("Lang"); mStrategy.setScriptPath("c:\\path"); mStrategy.setRouteOrdersToServer(true); mEngine = createEngine("Engine"); mEngine.setConnection(new MockUIConnection()); mEngine.getDeployedStrategies().add(mStrategy); mDialog = PropertyDialog.createDialogOn( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), StrategyEngineWorkbenchUI.DEPLOYED_STRATEGY_CONFIGURATION_PROPERTY_PAGE_ID, mStrategy); mDialog.setBlockOnOpen(false); mDialog.open(); } }); mBot.shell("Properties for Strategy1 on Engine"); SWTTestUtil.assertButtonDoesNotExist("Apply"); SWTTestUtil.assertButtonDoesNotExist("Restore Defaults"); SWTTestUtil.testReadOnlyText(mBot.textWithLabel("Instance Name:"), "Strategy1"); SWTTestUtil.testReadOnlyText(mBot.textWithLabel("Class:"), "Claz"); SWTTestUtil.testReadOnlyText(mBot.textWithLabel("Language:"), "Lang"); SWTTestUtil.testReadOnlyText(mBot.textWithLabel("Script:"), "c:\\path"); }
@Test public void testDisabledForRunningStrategy() throws Exception { AbstractUIRunner.syncRun( new ThrowableRunnable() { @Override public void run() throws Throwable { mStrategy = createDeployedStrategy("Strategy1"); mStrategy.setClassName("Claz"); mStrategy.setLanguage("Lang"); mStrategy.setScriptPath("c:\\path"); mStrategy.setRouteOrdersToServer(true); mStrategy.setState(StrategyState.RUNNING); mEngine = createEngine("Engine"); mEngine.setConnection(new MockUIConnection()); mEngine.getDeployedStrategies().add(mStrategy); mDialog = PropertyDialog.createDialogOn( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), StrategyEngineWorkbenchUI.DEPLOYED_STRATEGY_CONFIGURATION_PROPERTY_PAGE_ID, mStrategy); mDialog.setBlockOnOpen(false); mDialog.open(); } }); mBot.shell("Properties for Strategy1 on Engine"); testDisabled(mBot.textWithLabel("Instance Name:"), "Strategy1"); testDisabled(mBot.textWithLabel("Class:"), "Claz"); testDisabled(mBot.textWithLabel("Language:"), "Lang"); testDisabled(mBot.textWithLabel("Script:"), "c:\\path"); assertThat(mBot.checkBox("Route orders to server").isEnabled(), is(false)); assertThat(mBot.checkBox("Route orders to server").isChecked(), is(true)); // use index 1 since first tree is property page navigation tree assertThat(mBot.tree(1).isEnabled(), is(false)); assertThat(mBot.button("Add New Property").isEnabled(), is(false)); }
/** @param bot */ private void createJavaProject(SWTBot bot) throws Exception { bot.menu("File") .menu("New") .menu("Java Project") .click(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ bot.shell("New Java Project").activate(); // $NON-NLS-1$ bot.textWithLabel("Project name:").setText("MyProject"); // $NON-NLS-1$ //$NON-NLS-2$ bot.button("Finish").click(); // $NON-NLS-1$ }
public void setPort(String port) { mBot.textWithLabel("Web Service Port:").setText(port); }
public void setHostname(String hostname) { mBot.textWithLabel("Web Service Hostname:").setText(hostname); }
public void setJmsUrl(String jmsUrl) { mBot.textWithLabel("JMS URL:").setText(jmsUrl); }
public void setDescription(String description) { mBot.textWithLabel("Description:").setText(description); }
public void setName(String name) { mBot.textWithLabel("Name:").setText(name); }