@Before public void setup() { producer = new HomeProducer(placeManager, translationService, shortcutHelper); profilePreferences = new ProfilePreferences(Profile.PLANNER_AND_RULES); doAnswer((InvocationOnMock invocation) -> invocation.getArguments()[0]).when(translationService).format(anyString()); } @Test
@Test public void checkSetupWithProvisioningDenied() { when(shortcutHelper.authorize(PerspectiveIds.PROVISIONING)).thenReturn(false); final HomeModel model = producer.get(profilePreferences); assertHomeModel(model, Constants.DeployDescription1); assertDesign(model); assertEquals(1, model.getShortcuts().get(1).getLinks().size()); assertEquals(Constants.Servers, model.getShortcuts().get(1).getLinks().get(0).getLabel()); assertEquals(PerspectiveIds.SERVER_MANAGEMENT, model.getShortcuts().get(1).getLinks().get(0).getPerspectiveIdentifier()); }
@Override protected HomeShortcut createDesignShortcut() { final HomeShortcut design = ModelUtils.makeShortcut("pficon pficon-blueprint", translationService.format(Constants.Design), getDesignDescription(), () -> placeManager.goTo(LIBRARY), LIBRARY, PERSPECTIVE); design.addLink(new HomeShortcutLink(translationService.format(Constants.Projects), LIBRARY)); if (profilePreferences.getProfile() == Profile.FULL) { design.addLink(new HomeShortcutLink(translationService.format(Constants.Pages), CONTENT_MANAGEMENT)); } return design; }
@Test public void checkSetupWithProvisioningGranted() { when(shortcutHelper.authorize(PerspectiveIds.PROVISIONING)).thenReturn(true); final HomeModel model = producer.get(profilePreferences); assertHomeModel(model, Constants.DeployDescription2); assertDesign(model); assertEquals(2, model.getShortcuts().get(1).getLinks().size()); assertEquals(Constants.Provisioning, model.getShortcuts().get(1).getLinks().get(0).getLabel()); assertEquals(PerspectiveIds.PROVISIONING, model.getShortcuts().get(1).getLinks().get(0).getPerspectiveIdentifier()); assertEquals(Constants.Servers, model.getShortcuts().get(1).getLinks().get(1).getLabel()); assertEquals(PerspectiveIds.SERVER_MANAGEMENT, model.getShortcuts().get(1).getLinks().get(1).getPerspectiveIdentifier()); }
@Test public void checkSetupWithProvisioningDenied() { when(shortcutHelper.authorize(PerspectiveIds.PROVISIONING)).thenReturn(false); final HomeModel model = producer.get(profilePreferences); assertNotNull(model); assertHomeModel(model, Constants.DeployDescription1); assertDesign(model); assertManage(model); assertTrack(model); assertEquals(1, model.getShortcuts().get(1).getLinks().size()); assertEquals(Constants.Servers, model.getShortcuts().get(1).getLinks().get(0).getLabel()); assertEquals(PerspectiveIds.SERVER_MANAGEMENT, model.getShortcuts().get(1).getLinks().get(0).getPerspectiveIdentifier()); }
@Before public void setup() { producer = new HomeProducer(placeManager, translationService, shortcutHelper); profilePreferences = new ProfilePreferences(Profile.FULL); doAnswer((InvocationOnMock invocation) -> invocation.getArguments()[0]).when(translationService).format(anyString()); }
@Test public void checkSetupWithProvisioningGranted() { when(shortcutHelper.authorize(PerspectiveIds.PROVISIONING)).thenReturn(true); final HomeModel model = producer.get(profilePreferences); assertHomeModel(model, Constants.DeployDescription2); assertDesign(model); assertManage(model); assertTrack(model); assertEquals(2, model.getShortcuts().get(1).getLinks().size()); assertEquals(Constants.Provisioning, model.getShortcuts().get(1).getLinks().get(0).getLabel()); assertEquals(PerspectiveIds.PROVISIONING, model.getShortcuts().get(1).getLinks().get(0).getPerspectiveIdentifier()); assertEquals(Constants.Servers, model.getShortcuts().get(1).getLinks().get(1).getLabel()); assertEquals(PerspectiveIds.SERVER_MANAGEMENT, model.getShortcuts().get(1).getLinks().get(1).getPerspectiveIdentifier()); }