use of de.tudarmstadt.ukp.clarin.webanno.api.annotation.rendering.PreRendererImpl in project webanno by webanno.
the class BratRendererTest method setup.
@Before
public void setup() {
initMocks(this);
project = new Project();
tokenLayer = new AnnotationLayer(Token.class.getName(), "Token", SPAN_TYPE, null, true, SINGLE_TOKEN, NO_OVERLAP);
tokenLayer.setId(1l);
tokenPosFeature = new AnnotationFeature();
tokenPosFeature.setId(1l);
tokenPosFeature.setName("pos");
tokenPosFeature.setEnabled(true);
tokenPosFeature.setType(POS.class.getName());
tokenPosFeature.setUiName("pos");
tokenPosFeature.setLayer(tokenLayer);
tokenPosFeature.setProject(project);
tokenPosFeature.setVisible(true);
posLayer = new AnnotationLayer(POS.class.getName(), "POS", SPAN_TYPE, project, true, SINGLE_TOKEN, NO_OVERLAP);
posLayer.setId(2l);
posLayer.setAttachType(tokenLayer);
posLayer.setAttachFeature(tokenPosFeature);
posFeature = new AnnotationFeature();
posFeature.setId(2l);
posFeature.setName("PosValue");
posFeature.setEnabled(true);
posFeature.setType(CAS.TYPE_NAME_STRING);
posFeature.setUiName("PosValue");
posFeature.setLayer(posLayer);
posFeature.setProject(project);
posFeature.setVisible(true);
FeatureSupportRegistryImpl featureSupportRegistry = new FeatureSupportRegistryImpl(asList(new StringFeatureSupport(), new BooleanFeatureSupport(), new NumberFeatureSupport(), new SlotFeatureSupport(schemaService)));
featureSupportRegistry.init();
LayerBehaviorRegistryImpl layerBehaviorRegistry = new LayerBehaviorRegistryImpl(asList());
layerBehaviorRegistry.init();
LayerSupportRegistryImpl layerRegistry = new LayerSupportRegistryImpl(asList(new SpanLayerSupport(featureSupportRegistry, null, layerBehaviorRegistry), new RelationLayerSupport(featureSupportRegistry, null, layerBehaviorRegistry), new ChainLayerSupport(featureSupportRegistry, null, layerBehaviorRegistry)));
layerRegistry.init();
when(schemaService.listSupportedLayers(any())).thenReturn(asList(posLayer));
when(schemaService.listAnnotationLayer(any())).thenReturn(asList(posLayer));
when(schemaService.listSupportedFeatures(any(Project.class))).thenReturn(asList(posFeature));
when(schemaService.listAnnotationFeature(any(Project.class))).thenReturn(asList(posFeature));
when(schemaService.getAdapter(any(AnnotationLayer.class))).then(_call -> {
AnnotationLayer layer = _call.getArgument(0);
return layerRegistry.getLayerSupport(layer).createAdapter(layer, () -> asList(posFeature));
});
preRenderer = new PreRendererImpl(layerRegistry, schemaService);
}
Aggregations