use of org.kie.workbench.common.profile.api.preferences.ProfilePreferences in project kie-wb-common by kiegroup.
the class HomePresenterTest method setup.
@Before
public void setup() {
doReturn(mock(ShortcutPresenter.class)).when(shortcutPresenters).get();
executeParametrizedCommandWith(0, new ProfilePreferences(Profile.FULL)).when(profilePreferences).load(any(ParameterizedCommand.class), any(ParameterizedCommand.class));
modelProvider = new HomeModelProvider() {
@Override
public void initialize(Runnable done) {
done.run();
}
@Override
public HomeModel get(ProfilePreferences profilePreferences) {
final HomeModel homeModel = new HomeModel("welcome", "description", "backgroundImageUrl");
homeModel.addShortcut(ModelUtils.makeShortcut("iconCss1", "heading1", "subHeading1", mock(Command.class)));
homeModel.addShortcut(ModelUtils.makeShortcut("iconCss2", "heading2", "subHeading2", mock(Command.class), "resourceId2", ResourceType.UNKNOWN, ResourceAction.READ));
homeModel.addShortcut(ModelUtils.makeShortcut("iconCss3", "heading3", "subHeading3", mock(Command.class), "perspectiveId"));
return homeModel;
}
};
presenter = new HomePresenter(view, translationService, modelProvider, shortcutPresenters, profilePreferences);
}
use of org.kie.workbench.common.profile.api.preferences.ProfilePreferences in project kie-wb-common by kiegroup.
the class AddAssetScreenTest method setUp.
@Before
public void setUp() {
this.addAssetScreen = spy(new AddAssetScreen(this.view, this.ts, this.resourceHandlerManager, this.categoriesManagerCache, this.newAssetHandlerCardWidgets, this.libraryConstants, this.categoryUtils, this.libraryPlaces, this.profilePreferences));
doNothing().when(addAssetScreen).update();
executeParametrizedCommandWith(0, new ProfilePreferences(Profile.FULL)).when(profilePreferences).load(any(ParameterizedCommand.class), any(ParameterizedCommand.class));
}
use of org.kie.workbench.common.profile.api.preferences.ProfilePreferences in project kie-wb-common by kiegroup.
the class AddAssetScreenTest method testOnOpenProfileFilter.
@Test
public void testOnOpenProfileFilter() {
NewResourceHandler rhFull = mockResourceHandler(Profile.FULL);
NewResourceHandler rhDroolsPlanner = mockResourceHandler(Profile.PLANNER_AND_RULES);
NewResourceHandler rhAll = mockResourceHandler(Profile.values());
addAssetScreen.initialize();
doReturn(Arrays.asList(rhFull, rhDroolsPlanner, rhAll)).when(resourceHandlerManager).getNewResourceHandlers();
addAssetScreen.onOpen();
assertEquals(2, addAssetScreen.newResourceHandlers.size());
assertTrue(addAssetScreen.newResourceHandlers.contains(rhFull));
assertTrue(addAssetScreen.newResourceHandlers.contains(rhAll));
assertTrue(!addAssetScreen.newResourceHandlers.contains(rhDroolsPlanner));
executeParametrizedCommandWith(0, new ProfilePreferences(Profile.PLANNER_AND_RULES)).when(profilePreferences).load(any(ParameterizedCommand.class), any(ParameterizedCommand.class));
addAssetScreen.onOpen();
assertEquals(2, addAssetScreen.newResourceHandlers.size());
assertTrue(!addAssetScreen.newResourceHandlers.contains(rhFull));
assertTrue(addAssetScreen.newResourceHandlers.contains(rhAll));
assertTrue(addAssetScreen.newResourceHandlers.contains(rhDroolsPlanner));
}
use of org.kie.workbench.common.profile.api.preferences.ProfilePreferences in project kie-wb-common by kiegroup.
the class AddAssetScreenTest method testProfileFilter.
@Test
public void testProfileFilter() {
NewResourceHandler rhFull = mockResourceHandler(Profile.FULL);
NewResourceHandler rhDroolsPlanner = mockResourceHandler(Profile.PLANNER_AND_RULES);
NewResourceHandler rhAll = mockResourceHandler(Profile.values());
addAssetScreen.initialize();
doReturn(Arrays.asList(rhFull, rhDroolsPlanner, rhAll)).when(resourceHandlerManager).getNewResourceHandlers();
List<NewResourceHandler> filteredResourceHandlers = this.addAssetScreen.filterNewResourceHandlers(new ProfilePreferences(Profile.FULL));
assertEquals(2, filteredResourceHandlers.size());
filteredResourceHandlers = this.addAssetScreen.filterNewResourceHandlers(new ProfilePreferences(Profile.PLANNER_AND_RULES));
assertEquals(2, filteredResourceHandlers.size());
doReturn(Arrays.asList(rhFull, rhDroolsPlanner)).when(resourceHandlerManager).getNewResourceHandlers();
filteredResourceHandlers = this.addAssetScreen.filterNewResourceHandlers(new ProfilePreferences(Profile.PLANNER_AND_RULES));
assertEquals(1, filteredResourceHandlers.size());
assertEquals(Profile.PLANNER_AND_RULES, filteredResourceHandlers.get(0).getProfiles().get(0));
filteredResourceHandlers = this.addAssetScreen.filterNewResourceHandlers(new ProfilePreferences(Profile.FULL));
assertEquals(1, filteredResourceHandlers.size());
assertEquals(Profile.FULL, filteredResourceHandlers.get(0).getProfiles().get(0));
}
use of org.kie.workbench.common.profile.api.preferences.ProfilePreferences in project kie-wb-common by kiegroup.
the class DefaultWorkbenchFeaturesMenusHelperTest method setup.
@Before
public void setup() {
mockConstants();
mockDefaultPerspective();
mockRoles();
mockGroups();
mockIocManager();
executeParametrizedCommandWith(0, new ProfilePreferences(Profile.FULL)).when(profilePreferences).load(any(ParameterizedCommand.class), any(ParameterizedCommand.class));
}
Aggregations