private Set<SyncBeanDef<Activity>> resolveByPath(final PathPlaceRequest place) { if (place == null) { return emptySet(); } final SyncBeanDef<Activity> result = activityBeansCache.getActivity(place.getIdentifier()); if (result != null) { return singleton(result); } return asSet(activityBeansCache.getActivity(place.getPath())); }
private boolean verifyEventIdentifier(AbstractPlaceEvent event) { return activityBeansCache.getActivity(event.getPlace().getIdentifier()).getQualifiers().stream() .anyMatch(a -> a instanceof DiagramEditor); } }
private boolean verifyIsDiagramEditor(AbstractPlaceEvent event) { return activityBeansCache.getActivity(event.getPlace().getIdentifier()).getQualifiers().stream() .anyMatch(a -> a instanceof DiagramEditor); } }
public PerspectiveActivity getSelectedPerspective() { String selected = selectionHandler.getSelectedKey(); if (selected == null) { return null; } SyncBeanDef beanDef = activityBeansCache.getActivity(selected); PerspectiveActivity p = (PerspectiveActivity) beanDef.getInstance(); return p; }
private PerspectiveEditorActivity updatePerspective(LayoutTemplate layoutTemplate, PerspectiveEditorScreenActivity screen) { final SyncBeanDef<Activity> activity = activityBeansCache.getActivity(layoutTemplate.getName()); final PerspectiveEditorActivity perspectiveEditorActivity = (PerspectiveEditorActivity) activity.getInstance(); perspectiveEditorActivity.update(layoutTemplate, screen); return perspectiveEditorActivity; }
private PerspectiveEditorActivity updatePerspective(LayoutTemplate layoutTemplate, PerspectiveEditorScreenActivity screen) { final SyncBeanDef<Activity> activity = activityBeansCache.getActivity(layoutTemplate.getName()); final PerspectiveEditorActivity perspectiveEditorActivity = (PerspectiveEditorActivity) activity.getInstance(); perspectiveEditorActivity.update(layoutTemplate, screen); return perspectiveEditorActivity; }
private void updatePerspective( PerspectiveEditor editor, DefaultPerspectiveEditorScreenActivity screen ) { final IOCBeanDef<Activity> activity = activityBeansCache.getActivity( editor.getName() ); final DefaultPerspectiveEditorActivity perspectiveEditorActivity = (DefaultPerspectiveEditorActivity) activity.getInstance(); perspectiveEditorActivity.update( editor, screen ); }
@Test public void testGetUnknownEditorByPathWithoutDefaultEditor() { Path path = mock(Path.class); when(path.getFileName()).thenReturn(ANY_RESOURCE); Assertions.assertThatThrownBy(() -> { activityBeansCache.getActivity(path); }).isInstanceOf(ActivityBeansCache.EditorResourceTypeNotFound.class); }
@Test public void testGetUnknownEditorByPathWithoutDefaultEditor() { Path path = mock(Path.class); when(path.getFileName()).thenReturn(ANY_RESOURCE); Assertions.assertThatThrownBy(() -> { activityBeansCache.getActivity(path); }).isInstanceOf(ActivityBeansCache.EditorResourceTypeNotFound.class); }
@Test public void testGetEditorByPath() { Path path = mock(Path.class); when(path.getFileName()).thenReturn("any." + MODEL_TYPE); Assertions.assertThat(activityBeansCache.getActivity(path)) .isNotNull() .isEqualTo(modelEditorDef.getEditorActivityBeanDef()); when(path.getFileName()).thenReturn("any." + FORM_TYPE); Assertions.assertThat(activityBeansCache.getActivity(path)) .isNotNull() .isEqualTo(formEditorDef.getEditorActivityBeanDef()); }
@Test public void testGetEditorByPath() { Path path = mock(Path.class); when(path.getFileName()).thenReturn("any." + MODEL_TYPE); Assertions.assertThat(activityBeansCache.getActivity(path)) .isNotNull() .isEqualTo(modelEditorDef.getEditorActivityBeanDef()); when(path.getFileName()).thenReturn("any." + FORM_TYPE); Assertions.assertThat(activityBeansCache.getActivity(path)) .isNotNull() .isEqualTo(formEditorDef.getEditorActivityBeanDef()); }
private PerspectiveEditorScreenActivity updateScreen(LayoutTemplate layoutTemplate) { final String perspectiveScreenId = PerspectiveEditorScreenActivity.buildScreenId(layoutTemplate.getName()); final SyncBeanDef<Activity> activity = activityBeansCache.getActivity(perspectiveScreenId); final PerspectiveEditorScreenActivity screenActivity = (PerspectiveEditorScreenActivity) activity.getInstance(); screenActivity.setLayoutTemplate(layoutTemplate); return screenActivity; }
private DefaultPerspectiveEditorScreenActivity updateScreen( PerspectiveEditor editor ) { final IOCBeanDef<Activity> activity = activityBeansCache.getActivity( editor.getName()+DefaultPerspectiveEditorScreenActivity.screenSufix() ); final DefaultPerspectiveEditorScreenActivity screenActivity = (DefaultPerspectiveEditorScreenActivity) activity.getInstance(); screenActivity.build( editor ); return screenActivity; }
@Test public void testGetDefaultEditoFromDisabledExperimentalEditorByPath() { Path path = mock(Path.class); when(path.getFileName()).thenReturn("any." + FORM_TYPE); registerDefaultResourceType(); // Removing this will make Experimental FormEditorActivity disabled experimentalTestActivities.remove(FormEditorActivity.class); Assertions.assertThat(activityBeansCache.getActivity(path)) .isNotNull() .isEqualTo(defaultEditorDef.getEditorActivityBeanDef()); }
private PerspectiveEditorScreenActivity updateScreen(LayoutTemplate layoutTemplate) { final String perspectiveScreenId = PerspectiveEditorScreenActivity.buildScreenId(layoutTemplate.getName()); final SyncBeanDef<Activity> activity = activityBeansCache.getActivity(perspectiveScreenId); final PerspectiveEditorScreenActivity screenActivity = (PerspectiveEditorScreenActivity) activity.getInstance(); screenActivity.setLayoutTemplate(layoutTemplate); return screenActivity; }
@Test public void testGetDefaultEditoFromDisabledExperimentalEditorByPath() { Path path = mock(Path.class); when(path.getFileName()).thenReturn("any." + FORM_TYPE); registerDefaultResourceType(); // Removing this will make Experimental FormEditorActivity disabled experimentalTestActivities.remove(FormEditorActivity.class); Assertions.assertThat(activityBeansCache.getActivity(path)) .isNotNull() .isEqualTo(defaultEditorDef.getEditorActivityBeanDef()); }
@Test public void testGetUnknownEditorByPathWithDefaultEditor() { registerDefaultResourceType(); Path path = mock(Path.class); when(path.getFileName()).thenReturn(ANY_RESOURCE); Assertions.assertThat(activityBeansCache.getActivity(path)) .isNotNull() .isEqualTo(defaultEditorDef.getEditorActivityBeanDef()); }
@Test public void shouldNotLeakUnauthorizedActivityInstances() throws Exception { when(authzManager.authorize(any(Resource.class), eq(dorothy))).thenReturn(false); activityManager.getActivities(kansas); // this overspecified; all we care is that any activity that was created has also been destroyed. // it would be equally okay if the bean was never instantiated in the first place. verify(activityBeansCache).getActivity("kansas"); verify(iocManager).destroyBean(kansasActivity); }
@Test public void testGetUnknownEditorByPathWithDefaultEditor() { registerDefaultResourceType(); Path path = mock(Path.class); when(path.getFileName()).thenReturn(ANY_RESOURCE); Assertions.assertThat(activityBeansCache.getActivity(path)) .isNotNull() .isEqualTo(defaultEditorDef.getEditorActivityBeanDef()); }
@Test public void shouldNotLeakUnauthorizedActivityInstances() throws Exception { when(authzManager.authorize(any(Resource.class), eq(dorothy))).thenReturn(false); activityManager.getActivities(kansas); // this overspecified; all we care is that any activity that was created has also been destroyed. // it would be equally okay if the bean was never instantiated in the first place. verify(activityBeansCache).getActivity("kansas"); verify(iocManager).destroyBean(kansasActivity); }