use of org.eclipse.scanning.api.event.scan.ScanBean in project gda-core by openGDA.
the class QueuePreventingScanSubmitterTest method canSubmitScanToEmptyQueue.
@Test
public void canSubmitScanToEmptyQueue() throws Exception {
ScanBean scan = getTestScanBean();
scanSubmitter.submitScan(scan);
verify(submitter).submit(scan);
}
use of org.eclipse.scanning.api.event.scan.ScanBean in project gda-core by openGDA.
the class QueuePreventingScanSubmitterTest method getTestScanBean.
private ScanBean getTestScanBean() throws UnknownHostException {
IScanPointGeneratorModel model = mock(IScanPointGeneratorModel.class);
CompoundModel compoundModel = mock(CompoundModel.class);
when(compoundModel.getModels()).thenReturn(Arrays.asList(model));
ScanRequest scanRequest = mock(ScanRequest.class);
doReturn(compoundModel).when(scanRequest).getCompoundModel();
ScanBean bean = new ScanBean(scanRequest);
bean.setName("test scan");
return bean;
}
use of org.eclipse.scanning.api.event.scan.ScanBean in project gda-core by openGDA.
the class QueuePreventingScanSubmitterTest method submittingScanToNonEmptyQueueThrows.
@Test
public void submittingScanToNonEmptyQueueThrows() throws Exception {
submissionQueue.add(getTestScanBean());
ScanBean scanBean = getTestScanBean();
exception.expect(ScanningException.class);
exception.expectMessage("Could not submit request for '" + scanBean.getName() + "' because another scan is ongoing");
scanSubmitter.submitScan(scanBean);
}
use of org.eclipse.scanning.api.event.scan.ScanBean in project gda-core by openGDA.
the class TriggerableMap method trigger.
@Override
public ScanBean trigger() {
ScanBean bean = new ScanBean(scanRequest);
bean.setName(name);
return bean;
}
use of org.eclipse.scanning.api.event.scan.ScanBean in project gda-core by openGDA.
the class TimeSeriesScanView method createScanBean.
private ScanBean createScanBean() {
final IMalcolmModel malcolmModel = malcolmModelEditor.getModel();
final String malcolmDeviceName = malcolmModel.getName();
final ScanRequest scanRequest = new ScanRequest();
// add the malcolm model to the scan request
final Map<String, IDetectorModel> detectors = new HashMap<>();
detectors.put(malcolmDeviceName, malcolmModel);
scanRequest.setDetectors(detectors);
// extract the models from the outer scannables
final List<IScanPointGeneratorModel> pointsModels = outerScannablesBlock.getOuterScannables().stream().filter(IScanModelWrapper<IScanPointGeneratorModel>::isIncludeInScan).map(IScanModelWrapper<IScanPointGeneratorModel>::getModel).collect(toCollection(ArrayList::new));
final int numSteps = numStepsSpinner.getSelection();
pointsModels.add(new StaticModel(numSteps));
scanRequest.setCompoundModel(new CompoundModel(pointsModels));
final ScanBean scanBean = new ScanBean(scanRequest);
scanBean.setName(String.format("%s - Time Series", malcolmDeviceName));
return scanBean;
}
Aggregations