use of org.kie.workbench.common.services.datamodeller.core.AnnotationDefinition in project kie-wb-common by kiegroup.
the class DataModelerEditorsTestHelper method createTestContext.
public static DataModelerContext createTestContext() {
DataModelerContext context = new DataModelerContext("123456789");
context.init(PropertyTypeFactoryImpl.getInstance().getBasePropertyTypes());
List<AnnotationDefinition> commonAnnotations = CommonAnnotations.getCommonAnnotations();
Map<String, AnnotationDefinition> annotationDefinitions = new HashMap<String, AnnotationDefinition>();
for (AnnotationDefinition annotationDefinition : commonAnnotations) {
annotationDefinitions.put(annotationDefinition.getClassName(), annotationDefinition);
}
context.setAnnotationDefinitions(annotationDefinitions);
EditorModelContent content = new EditorModelContent();
content.setDataModel(createTestModel());
content.setCurrentModule(new KieModule());
context.setEditorModelContent(content);
return context;
}
use of org.kie.workbench.common.services.datamodeller.core.AnnotationDefinition in project kie-wb-common by kiegroup.
the class DataModelerScreenPresenterTestBase method createTestAnnotations.
protected Map<String, AnnotationDefinition> createTestAnnotations() {
Map<String, AnnotationDefinition> annotationsDef = new HashMap<String, AnnotationDefinition>();
AnnotationDefinition annotationDefinition = DriverUtils.buildAnnotationDefinition(Label.class);
annotationsDef.put(annotationDefinition.getClassName(), annotationDefinition);
annotationDefinition = DriverUtils.buildAnnotationDefinition(Description.class);
annotationsDef.put(annotationDefinition.getClassName(), annotationDefinition);
return annotationsDef;
}
use of org.kie.workbench.common.services.datamodeller.core.AnnotationDefinition in project kie-wb-common by kiegroup.
the class DataModelerEditorsTestHelper method createAnnotation.
public static Annotation createAnnotation(Class cls, String memberName, Object value) {
AnnotationDefinition annotationDefinition = DriverUtils.buildAnnotationDefinition(cls);
Annotation annotation = new AnnotationImpl(annotationDefinition);
if (memberName != null) {
annotation.setValue(memberName, value);
}
return annotation;
}
use of org.kie.workbench.common.services.datamodeller.core.AnnotationDefinition in project kie-wb-common by kiegroup.
the class ValuePairEditorPageTest method testPageInitialization.
@Test
public void testPageInitialization() {
modelerServiceCaller = new CallerMock<DataModelerService>(modelerService);
ValuePairEditorPage editorPage = new ValuePairEditorPage(view, valuePairEditorProvider, modelerServiceCaller, wizardPageStatusChangeEvent);
editorPage.prepareView();
AnnotationDefinition annotationDefinition = DriverUtils.buildAnnotationDefinition(Entity.class);
AnnotationValuePairDefinition valuePairDefinition = annotationDefinition.getValuePair("name");
when(valuePairEditorProvider.getValuePairEditor(valuePairDefinition)).thenReturn(valuePairEditor);
editorPage.init(annotationDefinition, valuePairDefinition, ElementType.FIELD, kieModule);
// the view should be properly initialized with the corresponding editor.
verify(view, times(1)).setValuePairEditor(valuePairEditor);
// the "name" value pair is not mandatory, so the page is completed.
WizardTestUtil.assertPageComplete(true, editorPage);
}
use of org.kie.workbench.common.services.datamodeller.core.AnnotationDefinition in project kie-wb-common by kiegroup.
the class JavaRoasterModelDriverTest method createAnnotation.
private Annotation createAnnotation(Class cls, String memberName, Object value) {
AnnotationDefinition annotationDefinition = DriverUtils.buildAnnotationDefinition(cls);
Annotation annotation = new AnnotationImpl(annotationDefinition);
if (memberName != null) {
annotation.setValue(memberName, value);
}
return annotation;
}
Aggregations