use of org.eclipse.scanning.api.event.scan.ScanBean in project gda-core by openGDA.
the class MScanSubmitterTest method createsCorrectProcessorListForCircularStepScanWithAliasedSyntaxAndSubmits.
@Test
public void createsCorrectProcessorListForCircularStepScanWithAliasedSyntaxAndSubmits() throws Exception {
Object[] arr = { scannable, anotherScannable, RegionShape.CIRCLE, circle.getPointX(), circle.getPointY(), circle.getRadius(), Scanpath.LINE_STEP, steppedGrid.getxAxisStep(), steppedGrid.getyAxisStep(), detectorRunnableDevice };
when(resolver.resolveScanClauses()).thenReturn(Arrays.asList(Arrays.asList(new ScannableElementProcessor(scannable), new ScannableElementProcessor(anotherScannable), new RegionShapeElementProcessor(RegionShape.CIRCLE), new NumberElementProcessor(circle.getPointX()), new NumberElementProcessor(circle.getPointY()), new NumberElementProcessor(circle.getRadius()), new ScanpathElementProcessor(Scanpath.GRID_STEP), new NumberElementProcessor(steppedGrid.getxAxisStep()), new NumberElementProcessor(steppedGrid.getyAxisStep())), Arrays.asList(new IRunnableDeviceDetectorElementProcessor(detectorRunnableDevice))));
builder.buildAndSubmitBlockingScanRequest(arr);
List<IClauseElementProcessor> processors = captor.getValue();
assertThat(processors.size(), is(10));
assertThat(processors.get(0), instanceOf(ScannableElementProcessor.class));
assertThat(processors.get(0).getElement(), is(scannable));
assertThat(processors.get(1), instanceOf(ScannableElementProcessor.class));
assertThat(processors.get(1).getElement(), is(anotherScannable));
assertThat(processors.get(2), instanceOf(RegionShapeElementProcessor.class));
assertThat(processors.get(2).getElement(), is(RegionShape.CIRCLE));
assertThat(processors.get(3), instanceOf(NumberElementProcessor.class));
assertThat(processors.get(3).getElement(), is(circle.getPointX()));
assertThat(processors.get(4), instanceOf(NumberElementProcessor.class));
assertThat(processors.get(4).getElement(), is(circle.getPointY()));
assertThat(processors.get(5), instanceOf(NumberElementProcessor.class));
assertThat(processors.get(5).getElement(), is(circle.getRadius()));
assertThat(processors.get(6), instanceOf(ScanpathElementProcessor.class));
assertThat(processors.get(6).getElement(), is(Scanpath.GRID_STEP));
assertThat(processors.get(7), instanceOf(NumberElementProcessor.class));
assertThat(processors.get(7).getElement(), is(steppedGrid.getxAxisStep()));
assertThat(processors.get(8), instanceOf(NumberElementProcessor.class));
assertThat(processors.get(8).getElement(), is(steppedGrid.getyAxisStep()));
assertThat(processors.get(9), instanceOf(IRunnableDeviceDetectorElementProcessor.class));
assertThat(processors.get(9).getElement(), is(detectorRunnableDevice));
verify(eventSubscriber).addListener(any(IScanListener.class));
verify(submitter).blockingSubmit(beanCaptor.capture());
ScanBean bean = beanCaptor.getValue();
assertThat(bean.getScanRequest().getCompoundModel(), is(equalTo(getBoundedCompoundModel(steppedGrid, circle))));
assertThat(bean.getScanRequest().getDetectors().values(), contains(detectorRunnableDevice.getModel()));
}
use of org.eclipse.scanning.api.event.scan.ScanBean in project gda-core by openGDA.
the class MScanSubmitterTest method createsCorrectProcessorListForAxialStepScanWithFullSyntaxAndSubmits.
@Test
public void createsCorrectProcessorListForAxialStepScanWithFullSyntaxAndSubmits() throws Exception {
Object[] arr = { scannable, RegionShape.AXIAL, line.getPointX(), line.getIntEndPoint()[0], Scanpath.AXIS_STEP, axStep.getStep(), detectorRunnableDevice };
when(resolver.resolveScanClauses()).thenReturn(Arrays.asList(Arrays.asList(new ScannableElementProcessor(scannable), new RegionShapeElementProcessor(RegionShape.AXIAL), new NumberElementProcessor(line.getPointX()), new NumberElementProcessor(line.getIntEndPoint()[0]), new ScanpathElementProcessor(Scanpath.AXIS_STEP), new NumberElementProcessor(axStep.getStep())), Arrays.asList(new IRunnableDeviceDetectorElementProcessor(detectorRunnableDevice))));
builder.buildAndSubmitBlockingScanRequest(arr);
List<IClauseElementProcessor> processors = captor.getValue();
assertThat(processors.size(), is(7));
assertThat(processors.get(0), instanceOf(ScannableElementProcessor.class));
assertThat(processors.get(0).getElement(), is(scannable));
assertThat(processors.get(1), instanceOf(RegionShapeElementProcessor.class));
assertThat(processors.get(1).getElement(), is(RegionShape.AXIAL));
assertThat(processors.get(2), instanceOf(NumberElementProcessor.class));
assertThat(processors.get(2).getElement(), is(line.getPointX()));
assertThat(processors.get(3), instanceOf(NumberElementProcessor.class));
assertThat(processors.get(3).getElement(), is(line.getIntEndPoint()[0]));
assertThat(processors.get(4), instanceOf(ScanpathElementProcessor.class));
assertThat(processors.get(4).getElement(), is(Scanpath.AXIS_STEP));
assertThat(processors.get(5), instanceOf(NumberElementProcessor.class));
assertThat(processors.get(5).getElement(), is(axStep.getStep()));
assertThat(processors.get(6), instanceOf(IRunnableDeviceDetectorElementProcessor.class));
assertThat(processors.get(6).getElement(), is(detectorRunnableDevice));
verify(eventSubscriber).addListener(any(IScanListener.class));
verify(submitter).blockingSubmit(beanCaptor.capture());
ScanBean bean = beanCaptor.getValue();
assertThat(bean.getScanRequest().getCompoundModel(), is(equalTo(getCompoundModel(axStep, line))));
assertThat(bean.getScanRequest().getDetectors().values(), contains(detectorRunnableDevice.getModel()));
}
use of org.eclipse.scanning.api.event.scan.ScanBean 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.event.scan.ScanBean 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.event.scan.ScanBean in project gda-core by openGDA.
the class MScanSubmitterTest method createsCorrectProcessorListForRectangularPointsScanWithAliasedSyntaxAndSubmits.
@Test
public void createsCorrectProcessorListForRectangularPointsScanWithAliasedSyntaxAndSubmits() throws Exception {
Object[] arr = { scannable, anotherScannable, RegionShape.RECTANGLE, rectangle.getPointX(), rectangle.getPointY(), rectangleX2, rectangleY2, Scanpath.LINE_POINTS, grid.getxAxisPoints(), grid.getyAxisPoints(), detectorRunnableDevice };
when(resolver.resolveScanClauses()).thenReturn(Arrays.asList(Arrays.asList(new ScannableElementProcessor(scannable), new ScannableElementProcessor(anotherScannable), new RegionShapeElementProcessor(RegionShape.RECTANGLE), new NumberElementProcessor(rectangle.getPointX()), new NumberElementProcessor(rectangle.getPointY()), new NumberElementProcessor(rectangleX2), new NumberElementProcessor(rectangleY2), new ScanpathElementProcessor(Scanpath.GRID_POINTS), new NumberElementProcessor(grid.getxAxisPoints()), new NumberElementProcessor(grid.getyAxisPoints())), Arrays.asList(new IRunnableDeviceDetectorElementProcessor(detectorRunnableDevice))));
builder.buildAndSubmitBlockingScanRequest(arr);
List<IClauseElementProcessor> processors = captor.getValue();
assertThat(processors.size(), is(11));
assertThat(processors.get(0), instanceOf(ScannableElementProcessor.class));
assertThat(processors.get(0).getElement(), is(scannable));
assertThat(processors.get(1), instanceOf(ScannableElementProcessor.class));
assertThat(processors.get(1).getElement(), is(anotherScannable));
assertThat(processors.get(2), instanceOf(RegionShapeElementProcessor.class));
assertThat(processors.get(2).getElement(), is(RegionShape.RECTANGLE));
assertThat(processors.get(3), instanceOf(NumberElementProcessor.class));
assertThat(processors.get(3).getElement(), is(rectangle.getPointX()));
assertThat(processors.get(4), instanceOf(NumberElementProcessor.class));
assertThat(processors.get(4).getElement(), is(rectangle.getPointY()));
assertThat(processors.get(5), instanceOf(NumberElementProcessor.class));
assertThat(processors.get(5).getElement(), is(rectangleX2));
assertThat(processors.get(6), instanceOf(NumberElementProcessor.class));
assertThat(processors.get(6).getElement(), is(rectangleY2));
assertThat(processors.get(7), instanceOf(ScanpathElementProcessor.class));
assertThat(processors.get(7).getElement(), is(Scanpath.GRID_POINTS));
assertThat(processors.get(8), instanceOf(NumberElementProcessor.class));
assertThat(processors.get(8).getElement(), is(grid.getxAxisPoints()));
assertThat(processors.get(9), instanceOf(NumberElementProcessor.class));
assertThat(processors.get(9).getElement(), is(grid.getyAxisPoints()));
assertThat(processors.get(10), instanceOf(IRunnableDeviceDetectorElementProcessor.class));
assertThat(processors.get(10).getElement(), is(detectorRunnableDevice));
verify(eventSubscriber).addListener(any(IScanListener.class));
verify(submitter).blockingSubmit(beanCaptor.capture());
ScanBean bean = beanCaptor.getValue();
assertThat(bean.getScanRequest().getCompoundModel(), is(equalTo(getBoundedCompoundModel(grid, rectangle))));
assertThat(bean.getScanRequest().getDetectors().values(), contains(detectorRunnableDevice.getModel()));
}
Aggregations