Search in sources :

Example 6 with CallerMock

use of org.uberfire.mocks.CallerMock in project kie-wb-common by kiegroup.

the class ContainerConfigPresenterTest method setUp.

@Before
public void setUp() {
    when(artifactSelector.getView()).thenReturn(artifactSelectorView);
    m2RepoServiceCaller = spy(new CallerMock<>(m2RepoService));
    provisioningValidationServiceCaller = new CallerMock<>(provisioningValidationService);
    provisioningClientValidationService = new ProvisioningClientValidationService(provisioningValidationServiceCaller);
    presenter = spy(new ContainerConfigPresenter(view, artifactSelector, translationService, popupHelper, m2RepoServiceCaller, provisioningClientValidationService));
    presenter.init();
    verify(view, times(1)).init(presenter);
    verify(artifactSelector, times(1)).setArtifactSelectHandler(any());
    verify(view, times(1)).setArtifactSelectorPresenter(artifactSelectorView);
}
Also used : ProvisioningClientValidationService(org.guvnor.ala.ui.client.validation.ProvisioningClientValidationService) CallerMock(org.uberfire.mocks.CallerMock) Before(org.junit.Before)

Example 7 with CallerMock

use of org.uberfire.mocks.CallerMock in project kie-wb-common by kiegroup.

the class TemplateParamsFormPresenterTest method setUp.

@Before
public void setUp() {
    when(popupHelper.getPopupErrorCallback()).thenReturn(errorCallback);
    exceptionCaptor = ArgumentCaptor.forClass(Throwable.class);
    initializeParams();
    when(templateDescriptorModel.getParams()).thenReturn(allTemplateParams);
    when(paramsEditorPresenter.getView()).thenReturn(paramsEditorPresenterView);
    openshiftClientServiceCaller = spy(new CallerMock<>(openShiftClientService));
    openShiftClientValidationService = new OpenShiftClientValidationService(openshiftClientServiceCaller);
    presenter = spy(new TemplateParamsFormPresenter(view, paramsEditorPresenter, translationService, popupHelper, openshiftClientServiceCaller, openShiftClientValidationService));
    presenter.init();
    verify(view, times(1)).init(presenter);
    verify(view, times(1)).setParamsEditorPresenter(paramsEditorPresenterView);
    verify(paramsEditorPresenter, times(1)).setParamChangeHandler(any());
}
Also used : OpenShiftClientValidationService(org.guvnor.ala.ui.openshift.client.validation.OpenShiftClientValidationService) CallerMock(org.uberfire.mocks.CallerMock) Before(org.junit.Before)

Example 8 with CallerMock

use of org.uberfire.mocks.CallerMock in project kie-wb-common by kiegroup.

the class ActiveOptionsInitParamTest method testParametersInPlaceRequest.

@Test
public void testParametersInPlaceRequest() throws Exception {
    options = new ActiveContextOptions(new CallerMock<ExplorerService>(mock(ExplorerService.class)), changedEvent);
    PlaceRequest placeRequest = mock(PlaceRequest.class);
    when(placeRequest.getParameter("mode", "")).thenReturn(mode);
    options.init(placeRequest, mock(Command.class));
    assertTrue(options.getOptions().contains(option1));
    assertTrue(options.getOptions().contains(option2));
}
Also used : PlaceRequest(org.uberfire.mvp.PlaceRequest) Command(org.uberfire.mvp.Command) ExplorerService(org.kie.workbench.common.screens.explorer.service.ExplorerService) CallerMock(org.uberfire.mocks.CallerMock) Test(org.junit.Test)

Example 9 with CallerMock

use of org.uberfire.mocks.CallerMock in project kie-wb-common by kiegroup.

the class AbstractExecutorTest method setup.

public void setup() {
    specManagementService = new CallerMock<>(specManagementServiceMock);
    buildService = spy(new CallerMock<>(buildServiceMock));
    final POM pom = new POM(new GAV(GROUP, ARTIFACT, VERSION));
    when(buildServiceMock.build(any(KieModule.class))).thenReturn(new BuildResults());
    when(buildServiceMock.buildAndDeploy(any(KieModule.class), any(DeploymentMode.class))).thenReturn(new BuildResults());
    when(repository.getAlias()).thenReturn("repository");
    when(module.getModuleName()).thenReturn("module");
    when(module.getPomXMLPath()).thenReturn(pomPath);
    when(module.getPom()).thenReturn(pom);
    when(module.getRootPath()).thenReturn(mock(Path.class));
    when(pomPath.getFileName()).thenReturn("pom.xml");
}
Also used : Path(org.uberfire.backend.vfs.Path) BuildResults(org.guvnor.common.services.project.builder.model.BuildResults) DeploymentMode(org.guvnor.common.services.project.service.DeploymentMode) GAV(org.guvnor.common.services.project.model.GAV) CallerMock(org.uberfire.mocks.CallerMock) KieModule(org.kie.workbench.common.services.shared.project.KieModule) POM(org.guvnor.common.services.project.model.POM)

Example 10 with CallerMock

use of org.uberfire.mocks.CallerMock in project kie-wb-common by kiegroup.

the class AdvancedAnnotationListEditorTest method setup.

@Before
public void setup() {
    yesCommandCaptor = ArgumentCaptor.forClass(Command.class);
    noCommandCaptor = ArgumentCaptor.forClass(Command.class);
    cancelCommandCaptor = ArgumentCaptor.forClass(Command.class);
    annotationCallbackCaptor = (ArgumentCaptor) ArgumentCaptor.forClass(Callback.class);
    Annotation annotation;
    AnnotationSource annotationSource;
    for (int i = 0; i < MAX_ITEMS; i++) {
        annotation = mock(Annotation.class);
        when(annotation.getClassName()).thenReturn("AnnotationClass" + i);
        annotations.add(annotation);
        annotationSource = mock(AnnotationSource.class);
        annotationSourcesMap.put(annotation.getClassName(), annotationSource);
    }
    setupItemInstances();
    annotationListEditor = new AdvancedAnnotationListEditor(view, new CallerMock(dataModelerService), valuePairEditorInstance, itemInstance) {

        @Override
        protected AnnotationListItem createListItem() {
            if (listItemsCount >= itemInstances.size()) {
                throw new RuntimeException("too many invocations");
            } else {
                super.createListItem();
                return itemInstances.get(listItemsCount++);
            }
        }

        @Override
        protected ValuePairEditorPopup createValuePairEditor() {
            super.createValuePairEditor();
            return valuePairEditor;
        }
    };
    annotationListEditor.addAddAnnotationHandler(addAnnotationHandler);
    annotationListEditor.addDeleteAnnotationHandler(deleteAnnotationHandler);
    annotationListEditor.addValuePairChangeHandler(valuePairChangeHandler);
    annotationListEditor.addClearValuePairHandler(clearValuePairHandler);
}
Also used : AnnotationListItem(org.kie.workbench.common.screens.datamodeller.client.widgets.advanceddomain.annotationlisteditor.item.AnnotationListItem) Command(org.uberfire.mvp.Command) ValuePairEditorPopup(org.kie.workbench.common.screens.datamodeller.client.widgets.advanceddomain.valuepaireditor.ValuePairEditorPopup) AnnotationSource(org.kie.workbench.common.services.datamodeller.driver.model.AnnotationSource) Annotation(org.kie.workbench.common.services.datamodeller.core.Annotation) CallerMock(org.uberfire.mocks.CallerMock) Before(org.junit.Before)

Aggregations

CallerMock (org.uberfire.mocks.CallerMock)16 Before (org.junit.Before)14 KieModule (org.kie.workbench.common.services.shared.project.KieModule)3 Command (org.uberfire.mvp.Command)3 Module (org.guvnor.common.services.project.model.Module)2 WorkspaceProject (org.guvnor.common.services.project.model.WorkspaceProject)2 OrganizationalUnit (org.guvnor.structure.organizationalunit.OrganizationalUnit)2 Repository (org.guvnor.structure.repositories.Repository)2 Test (org.junit.Test)2 SchemaMetadata (org.kie.workbench.common.screens.datasource.management.metadata.SchemaMetadata)2 Path (org.uberfire.backend.vfs.Path)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Optional (java.util.Optional)1 Event (javax.enterprise.event.Event)1 ProvisioningClientValidationService (org.guvnor.ala.ui.client.validation.ProvisioningClientValidationService)1 OpenShiftClientValidationService (org.guvnor.ala.ui.openshift.client.validation.OpenShiftClientValidationService)1 BuildResults (org.guvnor.common.services.project.builder.model.BuildResults)1 WorkspaceProjectContext (org.guvnor.common.services.project.client.context.WorkspaceProjectContext)1 ProjectController (org.guvnor.common.services.project.client.security.ProjectController)1