use of org.eclipse.scanning.api.points.models.StaticModel in project gda-core by openGDA.
the class MScanSubmitterTest method willAllowStaticScanWithDefaultSizeAndNoDetectorParams.
@Test
public void willAllowStaticScanWithDefaultSizeAndNoDetectorParams() throws Exception {
Object[] arr = { Scanpath.STATIC, detectorRunnableDevice };
when(resolver.resolveScanClauses()).thenReturn(Arrays.asList(Arrays.asList(new ScanpathElementProcessor(Scanpath.STATIC)), Arrays.asList(new IRunnableDeviceDetectorElementProcessor(detectorRunnableDevice))));
builder.buildAndSubmitBlockingScanRequest(arr);
verify(submitter).blockingSubmit(beanCaptor.capture());
verify(eventSubscriber).addListener(any(IScanListener.class));
ScanBean bean = beanCaptor.getValue();
assertThat(bean.getScanRequest().getCompoundModel(), is(equalTo(new CompoundModel(new StaticModel()))));
assertThat(bean.getScanRequest().getDetectors().values(), contains(detectorRunnableDevice.getModel()));
}
use of org.eclipse.scanning.api.points.models.StaticModel in project gda-core by openGDA.
the class MScanSubmitterTest method willAllowStaticScanWithOnlyDetectorAndParams.
@Test
public void willAllowStaticScanWithOnlyDetectorAndParams() throws Exception {
Object[] arr = { Scanpath.STATIC, detectorRunnableDevice, 2.5 };
when(resolver.resolveScanClauses()).thenReturn(Arrays.asList(Arrays.asList(new ScanpathElementProcessor(Scanpath.STATIC)), Arrays.asList(new IRunnableDeviceDetectorElementProcessor(detectorRunnableDevice), new NumberElementProcessor(2.5))));
builder.buildAndSubmitBlockingScanRequest(arr);
verify(submitter).blockingSubmit(beanCaptor.capture());
verify(eventSubscriber).addListener(any(IScanListener.class));
ScanBean bean = beanCaptor.getValue();
assertThat(bean.getScanRequest().getCompoundModel(), is(equalTo(new CompoundModel(new StaticModel()))));
assertThat(bean.getScanRequest().getDetectors().values(), contains(detectorRunnableDevice.getModel()));
}
use of org.eclipse.scanning.api.points.models.StaticModel in project gda-core by openGDA.
the class MScanSubmitterTest method willAllowStaticScanWithOnlyDetector.
@Test
public void willAllowStaticScanWithOnlyDetector() throws Exception {
Object[] arr = { detector };
when(resolver.resolveScanClauses()).thenReturn(Arrays.asList(Arrays.asList(new ScanpathElementProcessor(Scanpath.STATIC)), Arrays.asList(new ScannableDetectorElementProcessor(detector))));
builder.buildAndSubmitBlockingScanRequest(arr);
verify(submitter).blockingSubmit(beanCaptor.capture());
verify(eventSubscriber).addListener(any(IScanListener.class));
ScanBean bean = beanCaptor.getValue();
assertThat(bean.getScanRequest().getCompoundModel(), is(equalTo(new CompoundModel(new StaticModel()))));
}
use of org.eclipse.scanning.api.points.models.StaticModel in project gda-core by openGDA.
the class MScanSubmitterTest method willNotAllowStaticScanWithoutDetectors.
@Test
public void willNotAllowStaticScanWithoutDetectors() throws Exception {
// No Size, so default size=1
Object[] arr = { Scanpath.STATIC };
when(resolver.resolveScanClauses()).thenReturn(Arrays.asList(Arrays.asList(new ScanpathElementProcessor(Scanpath.STATIC))));
builder.buildAndSubmitBlockingScanRequest(arr);
verify(submitter).blockingSubmit(beanCaptor.capture());
verify(eventSubscriber).addListener(any(IScanListener.class));
ScanBean bean = beanCaptor.getValue();
assertThat(bean.getScanRequest().getCompoundModel(), is(equalTo(new CompoundModel(new StaticModel()))));
}
use of org.eclipse.scanning.api.points.models.StaticModel 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