@Test public void testRename() { Path result = perspectiveServices.rename(path, "newName", ""); ArgumentCaptor<LayoutEditorModel> layoutModelArg = ArgumentCaptor.forClass(LayoutEditorModel.class); verify(pluginServices).saveLayout(layoutModelArg.capture(), anyString()); LayoutEditorModel layoutModelCopy = layoutModelArg.getValue(); assertEquals(layoutModelCopy.getName(), "newName"); assertEquals(layoutModelCopy.getPath(), result); }
@Test public void testRename() { Path result = perspectiveServices.rename(path, "newName", ""); ArgumentCaptor<LayoutEditorModel> layoutModelArg = ArgumentCaptor.forClass(LayoutEditorModel.class); verify(pluginServices).saveLayout(layoutModelArg.capture(), anyString()); LayoutEditorModel layoutModelCopy = layoutModelArg.getValue(); assertEquals(layoutModelCopy.getName(), "newName"); assertEquals(layoutModelCopy.getPath(), result); }
@Test public void testCopy() { Path result = perspectiveServices.copy(path, "newName", ""); ArgumentCaptor<LayoutEditorModel> layoutModelArg = ArgumentCaptor.forClass(LayoutEditorModel.class); verify(pluginServices).saveLayout(layoutModelArg.capture(), anyString()); LayoutEditorModel layoutModelCopy = layoutModelArg.getValue(); assertEquals(layoutModelCopy.getName(), "newName"); assertEquals(layoutModelCopy.getPath(), result); }
@Test public void testCopy() { Path result = perspectiveServices.copy(path, "newName", ""); ArgumentCaptor<LayoutEditorModel> layoutModelArg = ArgumentCaptor.forClass(LayoutEditorModel.class); verify(pluginServices).saveLayout(layoutModelArg.capture(), anyString()); LayoutEditorModel layoutModelCopy = layoutModelArg.getValue(); assertEquals(layoutModelCopy.getName(), "newName"); assertEquals(layoutModelCopy.getPath(), result); }
@Test public void testCopyToTarget() { Path result = perspectiveServices.copy(path, "newName", path2, ""); ArgumentCaptor<LayoutEditorModel> layoutModelArg = ArgumentCaptor.forClass(LayoutEditorModel.class); verify(pluginServices).saveLayout(layoutModelArg.capture(), anyString()); LayoutEditorModel layoutModelCopy = layoutModelArg.getValue(); assertEquals(layoutModelCopy.getName(), "newName"); assertEquals(layoutModelCopy.getPath(), result); assertEquals(result, path2); }
@Test public void testCopyToTarget() { Path result = perspectiveServices.copy(path, "newName", path2, ""); ArgumentCaptor<LayoutEditorModel> layoutModelArg = ArgumentCaptor.forClass(LayoutEditorModel.class); verify(pluginServices).saveLayout(layoutModelArg.capture(), anyString()); LayoutEditorModel layoutModelCopy = layoutModelArg.getValue(); assertEquals(layoutModelCopy.getName(), "newName"); assertEquals(layoutModelCopy.getPath(), result); assertEquals(result, path2); }
@Override public org.uberfire.backend.vfs.Path saveLayout(LayoutEditorModel plugin, String commitMessage) { final Path pluginPath = convert(plugin.getPath()); final boolean isNewPlugin = !getIoService().exists(pluginPath); try { getIoService().startBatch(fileSystem, commentedOption(commitMessage)); final Path itemsPath = getLayoutEditorPath(getPluginPath(plugin.getName()), plugin.getType().toString().toLowerCase()); getIoService().write(itemsPath, plugin.getLayoutEditorModel()); updatePlugin(pluginPath, plugin, isNewPlugin); } finally { getIoService().endBatch(); } return plugin.getPath(); }
@Test public void testLoadEmptyLayout() { Path pluginPath = createPlugin("emptyLayout", PluginType.PERSPECTIVE_LAYOUT, null); LayoutEditorModel layoutEditorModel = pluginServices.getLayoutEditor(pluginPath, PluginType.PERSPECTIVE_LAYOUT); assertEquals(layoutEditorModel.getName(), "emptyLayout"); assertEquals(layoutEditorModel.getPath(), pluginPath); assertTrue(layoutEditorModel.isEmptyLayout()); }
@Test public void testLoadEmptyLayout() { Path pluginPath = createPlugin("emptyLayout", PluginType.PERSPECTIVE_LAYOUT, null); LayoutEditorModel layoutEditorModel = pluginServices.getLayoutEditor(pluginPath, PluginType.PERSPECTIVE_LAYOUT); assertEquals(layoutEditorModel.getName(), "emptyLayout"); assertEquals(layoutEditorModel.getPath(), pluginPath); assertTrue(layoutEditorModel.isEmptyLayout()); }