use of de.tudarmstadt.ukp.clarin.webanno.api.annotation.feature.FeatureSupportRegistryImpl in project webanno by webanno.
the class CopyAnnotationTest method setup.
@Before
public void setup() {
project = new Project();
tokenLayer = new AnnotationLayer(Token.class.getName(), "Token", SPAN_TYPE, null, true);
tokenPosFeature = new AnnotationFeature();
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);
posLayer.setAttachType(tokenLayer);
posLayer.setAttachFeature(tokenPosFeature);
posFeature = new AnnotationFeature();
posFeature.setName("PosValue");
posFeature.setEnabled(true);
posFeature.setType(CAS.TYPE_NAME_STRING);
posFeature.setUiName("PosValue");
posFeature.setLayer(posLayer);
posFeature.setProject(project);
posFeature.setVisible(true);
slotLayer = new AnnotationLayer(DiffUtils.HOST_TYPE, DiffUtils.HOST_TYPE, SPAN_TYPE, project, false);
slotFeature = new AnnotationFeature();
slotFeature.setName("links");
slotFeature.setEnabled(true);
slotFeature.setType(Token.class.getName());
slotFeature.setLinkMode(LinkMode.WITH_ROLE);
slotFeature.setUiName("f1");
slotFeature.setLayer(slotLayer);
slotFeature.setProject(project);
slotFeature.setVisible(true);
stringFeature = new AnnotationFeature();
stringFeature.setName("f1");
stringFeature.setEnabled(true);
stringFeature.setType(CAS.TYPE_NAME_STRING);
stringFeature.setUiName("f1");
stringFeature.setLayer(slotLayer);
stringFeature.setProject(project);
stringFeature.setVisible(true);
annotationSchemaService = new MockUp<AnnotationSchemaService>() {
@Mock
List<AnnotationFeature> listAnnotationFeature(AnnotationLayer type) {
if (type.getName().equals(POS.class.getName())) {
return asList(posFeature);
}
if (type.getName().equals(DiffUtils.HOST_TYPE)) {
return asList(slotFeature, stringFeature);
}
throw new IllegalStateException("Unknown layer type: " + type.getName());
}
@Mock
TypeAdapter getAdapter(AnnotationLayer aLayer) {
return AnnotationSchemaServiceImpl.getAdapter(annotationSchemaService, featureSupportRegistry, null, aLayer);
}
}.getMockInstance();
featureSupportRegistry = new FeatureSupportRegistryImpl(asList(new PrimitiveUimaFeatureSupport(), new SlotFeatureSupport()));
featureSupportRegistry.init();
}
Aggregations