@Test public void test_setEnterpriseContextViews_IsSupportedForOlderWorkspaces() { ViewSet views = new Workspace("", "").getViews(); SystemLandscapeView systemLandscapeView = views.createSystemLandscapeView("key", "Description"); views.setEnterpriseContextViews(Collections.singleton(systemLandscapeView)); assertEquals(1, views.getSystemLandscapeViews().size()); assertSame(systemLandscapeView, views.getSystemLandscapeViews().iterator().next()); }
/** * Writes the views in the given workspace as PlantUML definitions, to the specified writer. * * @param workspace the workspace containing the views to be written * @param writer the Writer to write to */ public void write(Workspace workspace, Writer writer) { if (workspace == null) { throw new IllegalArgumentException("A workspace must be provided."); } if (writer == null) { throw new IllegalArgumentException("A writer must be provided."); } workspace.getViews().getSystemLandscapeViews().forEach(v -> write(v, writer)); workspace.getViews().getSystemContextViews().forEach(v -> write(v, writer)); workspace.getViews().getContainerViews().forEach(v -> write(v, writer)); workspace.getViews().getComponentViews().forEach(v -> write(v, writer)); workspace.getViews().getDynamicViews().forEach(v -> write(v, writer)); workspace.getViews().getDeploymentViews().forEach(v -> write(v, writer)); }
@Test public void test_writeEnterpriseContextView() throws Exception { populateWorkspace(); SystemLandscapeView systemLandscapeView = workspace.getViews().getSystemLandscapeViews() .stream().findFirst().get(); plantUMLWriter.write(systemLandscapeView, stringWriter); assertEquals(SYSTEM_LANDSCAPE_VIEW, stringWriter.toString()); }
getViews().getSystemLandscapeViews().stream() .filter(v -> v.getKey() == null) .forEach(v -> warnings.add("System Landscape view \"" + v.getName() + "\": Missing key"));
@Test public void test_writeView_ThrowsAnExceptionWhenPassedANullWriter() throws Exception { populateWorkspace(); try { plantUMLWriter.write((View) workspace.getViews().getSystemLandscapeViews().stream().findFirst().get(), null); fail(); } catch (Exception e) { assertEquals("A writer must be provided.", e.getMessage()); } }
@Test public void test_backwardsCompatibilityOfRenamingEnterpriseContextViewsToSystemLandscapeViews() throws Exception { Workspace workspace = new Workspace("Name", "Description"); workspace.getViews().createSystemLandscapeView("key", "description"); JsonWriter jsonWriter = new JsonWriter(false); StringWriter stringWriter = new StringWriter(); jsonWriter.write(workspace, stringWriter); String workspaceAsJson = stringWriter.toString(); workspaceAsJson = workspaceAsJson.replaceAll("systemLandscapeViews", "enterpriseContextViews"); JsonReader jsonReader = new JsonReader(); StringReader stringReader = new StringReader(workspaceAsJson); workspace = jsonReader.read(stringReader); assertEquals(1, workspace.getViews().getSystemLandscapeViews().size()); }
public void copyLayoutInformationFrom(ViewSet source) { for (SystemLandscapeView view : systemLandscapeViews) { SystemLandscapeView sourceView = findView(source.getSystemLandscapeViews(), view); if (sourceView != null) { view.copyLayoutInformationFrom(sourceView);