use of org.eclipse.scanning.api.event.scan.ScanBean in project gda-core by openGDA.
the class MScanSubmitterTest method createsCorrectProcessorListForAxialStepScanWithAliasedSyntaxAndSubmits.
@Test
public void createsCorrectProcessorListForAxialStepScanWithAliasedSyntaxAndSubmits() throws Exception {
Object[] arr = { scannable, RegionShape.AXIAL, line.getPointX(), line.getIntEndPoint()[0], Scanpath.LINE_STEP, liStep.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(liStep.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(liStep.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 createsCorrectProcessorListForPlausibleScan.
@Test
public void createsCorrectProcessorListForPlausibleScan() throws Exception {
Object[] arr = { scannable, anotherScannable, RegionShape.CIRCLE, circle.getPointX(), circle.getPointY(), circle.getRadius(), Scanpath.GRID_POINTS, grid.getxAxisPoints(), grid.getyAxisPoints(), detector, monitor, detectorRunnableDevice, EXPOSURE, scannable, ScanDataConsumer.TEMPLATE, "template1 template2" };
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_POINTS), new NumberElementProcessor(grid.getxAxisPoints()), new NumberElementProcessor(grid.getyAxisPoints())), Arrays.asList(new ScannableDetectorElementProcessor(detector)), Arrays.asList(new ScannableMonitorElementProcessor(monitor)), Arrays.asList(new IRunnableDeviceDetectorElementProcessor(detectorRunnableDevice), new NumberElementProcessor(EXPOSURE)), Arrays.asList(new ScannableElementProcessor(scannable)), Arrays.asList(new ScanDataConsumerElementProcessor(ScanDataConsumer.TEMPLATE), new TokenStringElementProcessor("template1 template2"))));
builder.buildAndSubmitBlockingScanRequest(arr);
List<IClauseElementProcessor> processors = captor.getValue();
assertThat(processors.size(), is(16));
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_POINTS));
assertThat(processors.get(7), instanceOf(NumberElementProcessor.class));
assertThat(processors.get(7).getElement(), is(grid.getxAxisPoints()));
assertThat(processors.get(8), instanceOf(NumberElementProcessor.class));
assertThat(processors.get(8).getElement(), is(grid.getyAxisPoints()));
assertThat(processors.get(9), instanceOf(ScannableDetectorElementProcessor.class));
assertThat(processors.get(9).getElement(), is(detector));
assertThat(processors.get(10), instanceOf(ScannableMonitorElementProcessor.class));
assertThat(processors.get(10).getElement(), is(monitor));
assertThat(processors.get(11), instanceOf(IRunnableDeviceDetectorElementProcessor.class));
assertThat(processors.get(11).getElement(), is(detectorRunnableDevice));
assertThat(processors.get(12), instanceOf(NumberElementProcessor.class));
assertThat(processors.get(12).getElement(), is(EXPOSURE));
assertThat(processors.get(13), instanceOf(ScannableElementProcessor.class));
assertThat(processors.get(13).getElement(), is(scannable));
assertThat(processors.get(14), instanceOf(ScanDataConsumerElementProcessor.class));
assertThat(processors.get(14).getElement(), is(ScanDataConsumer.TEMPLATE));
assertThat(processors.get(15), instanceOf(TokenStringElementProcessor.class));
assertThat(processors.get(15).getElement(), is("template1 template2"));
verify(eventSubscriber).addListener(any(IScanListener.class));
verify(submitter).blockingSubmit(beanCaptor.capture());
ScanBean bean = beanCaptor.getValue();
assertThat(bean.getScanRequest().getCompoundModel(), is(equalTo(getBoundedCompoundModel(grid, 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 createsCorrectProcessorListForAxialArrayScanWithFullSyntaxAndSubmits.
@Test
public void createsCorrectProcessorListForAxialArrayScanWithFullSyntaxAndSubmits() throws Exception {
Object[] arr = { scannable, RegionShape.AXIAL, positions[2], positions[1], Scanpath.AXIS_ARRAY, positions[0], positions[1], positions[2], positions[3], detectorRunnableDevice };
when(resolver.resolveScanClauses()).thenReturn(Arrays.asList(Arrays.asList(new ScannableElementProcessor(scannable), new RegionShapeElementProcessor(RegionShape.AXIAL), new NumberElementProcessor(positions[2]), new NumberElementProcessor(positions[1]), new ScanpathElementProcessor(Scanpath.AXIS_ARRAY), new NumberElementProcessor(positions[0]), new NumberElementProcessor(positions[1]), new NumberElementProcessor(positions[2]), new NumberElementProcessor(positions[3])), 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(RegionShapeElementProcessor.class));
assertThat(processors.get(1).getElement(), is(RegionShape.AXIAL));
assertThat(processors.get(2), instanceOf(NumberElementProcessor.class));
assertThat(processors.get(2).getElement(), is(positions[2]));
assertThat(processors.get(3), instanceOf(NumberElementProcessor.class));
assertThat(processors.get(3).getElement(), is(positions[1]));
assertThat(processors.get(4), instanceOf(ScanpathElementProcessor.class));
assertThat(processors.get(4).getElement(), is(Scanpath.AXIS_ARRAY));
assertThat(processors.get(5), instanceOf(NumberElementProcessor.class));
assertThat(processors.get(5).getElement(), is(positions[0]));
assertThat(processors.get(6), instanceOf(NumberElementProcessor.class));
assertThat(processors.get(6).getElement(), is(positions[1]));
assertThat(processors.get(7), instanceOf(NumberElementProcessor.class));
assertThat(processors.get(7).getElement(), is(positions[2]));
assertThat(processors.get(8), instanceOf(NumberElementProcessor.class));
assertThat(processors.get(8).getElement(), is(positions[3]));
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(getCompoundModel(axArray, 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 createsCorrectProcessorListForAxialPointsScanWithAliasedSyntaxAndSubmits.
@Test
public void createsCorrectProcessorListForAxialPointsScanWithAliasedSyntaxAndSubmits() throws Exception {
Object[] arr = { scannable, RegionShape.AXIAL, line.getPointX(), line.getIntEndPoint()[0], Scanpath.LINE_POINTS, liPoints.getPoints(), 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_POINTS), new NumberElementProcessor(liPoints.getPoints())), 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_POINTS));
assertThat(processors.get(5), instanceOf(NumberElementProcessor.class));
assertThat(processors.get(5).getElement(), is(liPoints.getPoints()));
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(axPoints, 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 createsCorrectProcessorListForAxialPointsScanWithFullSyntaxAndSubmits.
@Test
public void createsCorrectProcessorListForAxialPointsScanWithFullSyntaxAndSubmits() throws Exception {
Object[] arr = { scannable, RegionShape.AXIAL, line.getPointX(), line.getIntEndPoint()[0], Scanpath.AXIS_POINTS, axPoints.getPoints(), 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_POINTS), new NumberElementProcessor(axPoints.getPoints())), 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_POINTS));
assertThat(processors.get(5), instanceOf(NumberElementProcessor.class));
assertThat(processors.get(5).getElement(), is(axPoints.getPoints()));
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(axPoints, line))));
assertThat(bean.getScanRequest().getDetectors().values(), contains(detectorRunnableDevice.getModel()));
}
Aggregations