use of org.guvnor.common.services.project.categories.Decision in project kie-wb-common by kiegroup.
the class AddAssetScreenTest method testFilterByCategory.
@Test
public void testFilterByCategory() {
NewResourceHandler resourceHandler = mock(NewResourceHandler.class, Answers.RETURNS_DEEP_STUBS.get());
when(resourceHandler.getDescription()).thenReturn("demo");
when(resourceHandler.getResourceType().getCategory()).thenReturn(new Decision());
{
List<NewResourceHandler> filtered = this.addAssetScreen.filterAndSortHandlers(Arrays.asList(resourceHandler), "", new Decision());
assertEquals(resourceHandler, filtered.get(0));
}
{
List<NewResourceHandler> filtered = this.addAssetScreen.filterAndSortHandlers(Arrays.asList(resourceHandler), "", new Others());
assertTrue(filtered.isEmpty());
}
}
use of org.guvnor.common.services.project.categories.Decision in project drools-wb by kiegroup.
the class ScenarioEditorPresenterTest method setUp.
@Before
public void setUp() throws Exception {
promises = new SyncPromises();
final AsyncPackageDataModelOracleFactory modelOracleFactory = mock(AsyncPackageDataModelOracleFactory.class);
fakeService = new CallerMock<>(service);
editor = spy(new ScenarioEditorPresenter(view, user, importsWidget, fakeService, new TestScenarioResourceType(new Decision()), modelOracleFactory, settingsPage, auditPage, testRunnerReportingPanel, testReportingDocksHandler, showTestPanelEvent, hideTestPanelEvent) {
{
docks = ScenarioEditorPresenterTest.this.docks;
kieView = ScenarioEditorPresenterTest.this.kieView;
versionRecordManager = ScenarioEditorPresenterTest.this.versionRecordManager;
overviewWidget = ScenarioEditorPresenterTest.this.overviewWidget;
notification = ScenarioEditorPresenterTest.this.notificationEventMock;
fileMenuBuilder = ScenarioEditorPresenterTest.this.fileMenuBuilder;
projectController = ScenarioEditorPresenterTest.this.projectController;
workbenchContext = ScenarioEditorPresenterTest.this.workbenchContext;
versionRecordManager = ScenarioEditorPresenterTest.this.versionRecordManager;
alertsButtonMenuItemBuilder = ScenarioEditorPresenterTest.this.alertsButtonMenuItemBuilder;
perspectiveManager = ScenarioEditorPresenterTest.this.perspectiveManager;
placeManager = ScenarioEditorPresenterTest.this.placeManager;
promises = ScenarioEditorPresenterTest.this.promises;
}
@Override
protected Command getSaveAndRename() {
return mock(Command.class);
}
});
doNothing().when(editor).addDownloadMenuItem(any());
scenarioRunResult = new Scenario();
scenario = new Scenario();
overview = new Overview();
when(user.getIdentifier()).thenReturn("userName");
when(workbenchContext.getActiveOrganizationalUnit()).thenReturn(Optional.empty());
when(workbenchContext.getActiveWorkspaceProject()).thenReturn(Optional.empty());
final TestScenarioModelContent testScenarioModelContent = new TestScenarioModelContent(scenario, overview, "org.test", new PackageDataModelOracleBaselinePayload());
when(service.loadContent(any())).thenReturn(testScenarioModelContent);
final TestScenarioResult result = new TestScenarioResult(scenarioRunResult, Collections.EMPTY_SET, mock(TestResultMessage.class));
when(service.runScenario(eq("userName"), any(), eq(scenario))).thenReturn(result);
final AsyncPackageDataModelOracle dmo = mock(AsyncPackageDataModelOracle.class);
when(modelOracleFactory.makeAsyncPackageDataModelOracle(any(), any(), any())).thenReturn(dmo);
when(alertsButtonMenuItemBuilder.build()).thenReturn(alertsButtonMenuItem);
when(perspectiveManager.getCurrentPerspective()).thenReturn(mock(PerspectiveActivity.class));
}
use of org.guvnor.common.services.project.categories.Decision in project kie-wb-common by kiegroup.
the class DMNDiagramResourceTypeTest method setup.
@Before
public void setup() {
final Decision category = new Decision();
this.definitionSetResourceType = new DMNDefinitionSetResourceType(category);
this.resourceType = new DMNDiagramResourceType(category, translationService);
doAnswer((i) -> i.getArguments()[0].toString()).when(translationService).getTranslation(Mockito.<String>any());
}
use of org.guvnor.common.services.project.categories.Decision in project kie-wb-common by kiegroup.
the class AddAssetScreenTest method testFilterByName.
@Test
public void testFilterByName() {
NewResourceHandler resourceHandler = mock(NewResourceHandler.class, Answers.RETURNS_DEEP_STUBS.get());
when(resourceHandler.getDescription()).thenReturn("demo");
when(resourceHandler.getResourceType().getCategory()).thenReturn(new Decision());
{
List<NewResourceHandler> filtered = this.addAssetScreen.filterAndSortHandlers(Arrays.asList(resourceHandler), "de", new Undefined());
assertEquals(resourceHandler, filtered.get(0));
}
{
List<NewResourceHandler> filtered = this.addAssetScreen.filterAndSortHandlers(Arrays.asList(resourceHandler), "ja", new Undefined());
assertTrue(filtered.isEmpty());
}
}
use of org.guvnor.common.services.project.categories.Decision in project kie-wb-common by kiegroup.
the class CategoryUtilsTest method testCreateCategories.
@Test
public void testCreateCategories() {
when(this.categoriesManagerCache.getCategories()).thenReturn(new HashSet<>(Arrays.asList(new Others(), new Decision())));
List<SelectOption> categories = this.categoryUtils.createCategories();
assertEquals(3, categories.size());
assertTrue(categories.stream().anyMatch(selectOption -> selectOption.getSelector().equals("ALL")));
assertTrue(categories.stream().anyMatch(selectOption -> selectOption.getSelector().equals(new Others().getName())));
assertTrue(categories.stream().anyMatch(selectOption -> selectOption.getSelector().equals(new Decision().getName())));
}
Aggregations