@Before public void setup() { LayoutEditorModel layoutEditorModel = new LayoutEditorModel("layout", PluginType.PERSPECTIVE_LAYOUT, path2, "").emptyLayout(); when(pluginServices.createNewPlugin(anyString(), any())).thenReturn(plugin); when(plugin.getPath()).thenReturn(path); when(pluginServices.copy(any(), anyString(), anyString())).thenReturn(path2); when(pluginServices.copy(any(), anyString(), any(), anyString())).thenReturn(path2); when(pluginServices.rename(any(), anyString(), anyString())).thenReturn(path2); when(pluginServices.getLayoutEditor(eq(path2), eq(PluginType.PERSPECTIVE_LAYOUT))).thenReturn(layoutEditorModel); perspectiveServices = spy(new PerspectiveServicesImpl(pluginServices, layoutServices, saveAndRenameService)); }
@Before public void setup() { LayoutEditorModel layoutEditorModel = new LayoutEditorModel("layout", PluginType.PERSPECTIVE_LAYOUT, path2, "").emptyLayout(); when(pluginServices.createNewPlugin(anyString(), any())).thenReturn(plugin); when(plugin.getPath()).thenReturn(path); when(pluginServices.copy(any(), anyString(), anyString())).thenReturn(path2); when(pluginServices.copy(any(), anyString(), any(), anyString())).thenReturn(path2); when(pluginServices.rename(any(), anyString(), anyString())).thenReturn(path2); when(pluginServices.getLayoutEditor(eq(path2), eq(PluginType.PERSPECTIVE_LAYOUT))).thenReturn(layoutEditorModel); perspectiveServices = spy(new PerspectiveServicesImpl(pluginServices, layoutServices, saveAndRenameService)); }
private LayoutEditorModel loadLayoutEditor(String pluginName, org.uberfire.backend.vfs.Path path, PluginType type) { final Path path1 = getLayoutEditorPath(getPluginPath(pluginName), type.toString().toLowerCase()); if (getIoService().exists(path1)) { String fileContent = getIoService().readAllString(path1); return new LayoutEditorModel(pluginName, PluginType.PERSPECTIVE_LAYOUT, path, fileContent); } return new LayoutEditorModel(pluginName, PluginType.PERSPECTIVE_LAYOUT, path, null).emptyLayout(); }