Search in sources :

Example 6 with DataModelerService

use of org.kie.workbench.common.screens.datamodeller.service.DataModelerService 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);
}
Also used : AnnotationDefinition(org.kie.workbench.common.services.datamodeller.core.AnnotationDefinition) DataModelerService(org.kie.workbench.common.screens.datamodeller.service.DataModelerService) AnnotationValuePairDefinition(org.kie.workbench.common.services.datamodeller.core.AnnotationValuePairDefinition) Test(org.junit.Test)

Aggregations

DataModelerService (org.kie.workbench.common.screens.datamodeller.service.DataModelerService)6 Test (org.junit.Test)5 AnnotationDefinition (org.kie.workbench.common.services.datamodeller.core.AnnotationDefinition)3 AnnotationValuePairDefinition (org.kie.workbench.common.services.datamodeller.core.AnnotationValuePairDefinition)3 Entity (javax.persistence.Entity)2 AnnotationDefinitionRequest (org.kie.workbench.common.services.datamodeller.driver.model.AnnotationDefinitionRequest)2 AnnotationDefinitionResponse (org.kie.workbench.common.services.datamodeller.driver.model.AnnotationDefinitionResponse)2 WizardPageStatusChangeEvent (org.uberfire.ext.widgets.core.client.wizards.WizardPageStatusChangeEvent)2 ArrayList (java.util.ArrayList)1 Before (org.junit.Before)1 DataModelChangeNotifier (org.kie.workbench.common.screens.datamodeller.client.command.DataModelChangeNotifier)1 DataModelCommandBuilder (org.kie.workbench.common.screens.datamodeller.client.command.DataModelCommandBuilder)1 DomainHandler (org.kie.workbench.common.screens.datamodeller.client.handlers.DomainHandler)1 JPADomainHandler (org.kie.workbench.common.screens.datamodeller.client.handlers.jpadomain.JPADomainHandler)1 ValidatorService (org.kie.workbench.common.screens.datamodeller.client.validation.ValidatorService)1 ValidationService (org.kie.workbench.common.services.shared.validation.ValidationService)1