use of org.uberfire.mocks.CallerMock in project kie-wb-common by kiegroup.
the class DatabaseSchemaExplorerTest method setup.
@Before
public void setup() {
schemaExplorer = new DatabaseSchemaExplorer(view, new CallerMock<>(metadataService), translationService);
// emulate the @PostConstruct invocation
schemaExplorer.init();
schemas.add(new SchemaMetadata("schema1"));
schemas.add(new SchemaMetadata("schema2"));
}
use of org.uberfire.mocks.CallerMock in project kie-wb-common by kiegroup.
the class DatabaseObjectExplorerTest method setup.
@Before
public void setup() {
objectExplorer = new DatabaseObjectExplorer(view, new CallerMock<>(metadataService), translationService);
// emulate the @PostConstruct invocation.
objectExplorer.init();
schemas.add(new SchemaMetadata(SCHEMA_NAME));
schemas.add(new SchemaMetadata("schema2"));
schemas.add(new SchemaMetadata("schema3"));
dbObjects.add(new TableMetadata(CATALOG_NAME, SCHEMA_NAME, "table1", DatabaseMetadata.TableType.TABLE.name()));
dbObjects.add(new TableMetadata(CATALOG_NAME, SCHEMA_NAME, "table2", DatabaseMetadata.TableType.TABLE.name()));
}
use of org.uberfire.mocks.CallerMock in project kie-wb-common by kiegroup.
the class PopulatedLibraryScreenTest method setup.
@Before
public void setup() {
libraryServiceCaller = new CallerMock<>(libraryService);
libraryScreen = spy(new PopulatedLibraryScreen(view, libraryPlaces, libraryServiceCaller, projectController, projectContext, tileWidgets, addProjectButtonPresenter, projectCountUpdateEvent));
doReturn(true).when(projectController).canCreateProjects(any());
project1 = mockProject(PROJECT_1);
project2 = mockProject(PROJECT_2);
project3 = mockProject(PROJECT_3);
final List<WorkspaceProject> projects = new ArrayList<>();
projects.add(project1);
projects.add(project2);
projects.add(project3);
when(projectContext.getActiveOrganizationalUnit()).thenReturn(Optional.of(organizationalUnit));
when(projectContext.getActiveWorkspaceProject()).thenReturn(Optional.empty());
when(projectContext.getActiveModule()).thenReturn(Optional.empty());
when(projectContext.getActiveRepositoryRoot()).thenReturn(Optional.empty());
when(projectContext.getActivePackage()).thenReturn(Optional.empty());
final LibraryInfo libraryInfo = new LibraryInfo(projects);
doReturn(libraryInfo).when(libraryService).getLibraryInfo(organizationalUnit);
doReturn(mock(TileWidget.View.class)).when(tileWidget).getView();
when(tileWidgets.get()).thenAnswer((Answer<TileWidget<WorkspaceProject>>) invocationOnMock -> {
TileWidget tile = mock(TileWidget.class);
doReturn(mock(TileWidget.View.class)).when(tile).getView();
doAnswer((Answer<Void>) invocationOnMock1 -> {
when(tile.getContent()).thenReturn(invocationOnMock1.getArgument(0, WorkspaceProject.class));
return null;
}).when(tile).setContent(any());
return tile;
});
doReturn(mock(AddProjectButtonPresenter.View.class)).when(addProjectButtonPresenter).getView();
libraryScreen.setup();
}
use of org.uberfire.mocks.CallerMock in project kie-wb-common by kiegroup.
the class ProjectClientDiagramValidatorTest method setUp.
@Before
public void setUp() {
this.graphTestHandler = new TestingGraphMockHandler();
treeWalkTraverseProcessor = new TreeWalkTraverseProcessorImpl();
backendViolation = new ElementViolationImpl.Builder().setUuid(uuid).build();
Collection<DiagramElementViolation<RuleViolation>> violations = Collections.singletonList(backendViolation);
when(diagram.getName()).thenReturn("Test diagram");
when(diagram.getMetadata()).thenReturn(metadata);
when(validationService.validate(diagram)).thenReturn(violations);
when(validators.spliterator()).thenReturn(Spliterators.emptySpliterator());
when(graphTestHandler.getRuleManager().evaluate(any(), any())).thenReturn(mock(RuleViolations.class));
clientDiagramValidator = new ProjectClientDiagramValidator(graphTestHandler.getDefinitionManager(), graphTestHandler.getRuleManager(), treeWalkTraverseProcessor, modelValidator, new CallerMock<>(validationService), validators);
}
use of org.uberfire.mocks.CallerMock in project kie-wb-common by kiegroup.
the class CaseDefinitionNewResourceHandlerTest method setUp.
@Before
public void setUp() throws Exception {
when(translationService.getDefinitionDescription(CaseDefinitionNewResourceHandler.CASE_DEFINITION)).thenReturn(DESCRIPTION);
when(projectContext.getActiveWorkspaceProject()).thenReturn(Optional.of(workspaceProject));
when(workspaceProject.getRootPath()).thenReturn(rootPath);
caseHelper = new CaseHelper(new CallerMock<>(bpmnDiagramService), projectContext);
tested = new CaseDefinitionNewResourceHandler(definitionManager, projectDiagramService, indicatorView, projectDiagramResourceType, translationService, caseHelper);
}
Aggregations