Search in sources :

Example 6 with StaticModel

use of org.eclipse.scanning.api.points.models.StaticModel in project gda-core by openGDA.

the class MScanSubmitterTest method willAllowStaticScanWithDetectorAndNoScannable.

@Test
public void willAllowStaticScanWithDetectorAndNoScannable() throws Exception {
    final int size = 5;
    Object[] arr = { Scanpath.STATIC, size, detectorRunnableDevice, EXPOSURE };
    when(resolver.resolveScanClauses()).thenReturn(Arrays.asList(Arrays.asList(new ScanpathElementProcessor(Scanpath.STATIC), new NumberElementProcessor(size)), Arrays.asList(new IRunnableDeviceDetectorElementProcessor(detectorRunnableDevice), new NumberElementProcessor(EXPOSURE))));
    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(size)))));
    assertThat(bean.getScanRequest().getDetectors().values(), contains(detectorRunnableDevice.getModel()));
}
Also used : IScanListener(org.eclipse.scanning.api.event.scan.IScanListener) ScanBean(org.eclipse.scanning.api.event.scan.ScanBean) NumberElementProcessor(gda.mscan.processor.NumberElementProcessor) ScanpathElementProcessor(gda.mscan.processor.ScanpathElementProcessor) CompoundModel(org.eclipse.scanning.api.points.models.CompoundModel) IRunnableDeviceDetectorElementProcessor(gda.mscan.processor.IRunnableDeviceDetectorElementProcessor) StaticModel(org.eclipse.scanning.api.points.models.StaticModel) Test(org.junit.Test)

Example 7 with StaticModel

use of org.eclipse.scanning.api.points.models.StaticModel in project gda-core by openGDA.

the class MScanSubmitterTest method willAllowStaticScanWithDefaultSize.

@Test
public void willAllowStaticScanWithDefaultSize() throws Exception {
    // > 1 exposure time to ensure number not stolen by previous clause
    Object[] arr = { Scanpath.STATIC, detectorRunnableDevice, 2.7 };
    when(resolver.resolveScanClauses()).thenReturn(Arrays.asList(Arrays.asList(new ScanpathElementProcessor(Scanpath.STATIC)), Arrays.asList(new IRunnableDeviceDetectorElementProcessor(detectorRunnableDevice), new NumberElementProcessor(1.7))));
    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()));
}
Also used : IScanListener(org.eclipse.scanning.api.event.scan.IScanListener) ScanBean(org.eclipse.scanning.api.event.scan.ScanBean) NumberElementProcessor(gda.mscan.processor.NumberElementProcessor) ScanpathElementProcessor(gda.mscan.processor.ScanpathElementProcessor) CompoundModel(org.eclipse.scanning.api.points.models.CompoundModel) IRunnableDeviceDetectorElementProcessor(gda.mscan.processor.IRunnableDeviceDetectorElementProcessor) StaticModel(org.eclipse.scanning.api.points.models.StaticModel) Test(org.junit.Test)

Aggregations

ScanBean (org.eclipse.scanning.api.event.scan.ScanBean)7 CompoundModel (org.eclipse.scanning.api.points.models.CompoundModel)7 StaticModel (org.eclipse.scanning.api.points.models.StaticModel)7 ScanpathElementProcessor (gda.mscan.processor.ScanpathElementProcessor)6 IScanListener (org.eclipse.scanning.api.event.scan.IScanListener)6 Test (org.junit.Test)6 IRunnableDeviceDetectorElementProcessor (gda.mscan.processor.IRunnableDeviceDetectorElementProcessor)4 NumberElementProcessor (gda.mscan.processor.NumberElementProcessor)3 ScannableDetectorElementProcessor (gda.mscan.processor.ScannableDetectorElementProcessor)1 HashMap (java.util.HashMap)1 IDetectorModel (org.eclipse.scanning.api.device.models.IDetectorModel)1 IMalcolmModel (org.eclipse.scanning.api.device.models.IMalcolmModel)1 ScanRequest (org.eclipse.scanning.api.event.scan.ScanRequest)1 IScanPointGeneratorModel (org.eclipse.scanning.api.points.models.IScanPointGeneratorModel)1 IScanModelWrapper (uk.ac.diamond.daq.mapping.api.IScanModelWrapper)1