/** * Adds all other containers in the software system to this view. */ public void addAllContainers() { getSoftwareSystem().getContainers().forEach(this::add); }
@Test public void test_construction() { assertEquals("The System - Web Application - Components", view.getName()); assertEquals("Some description", view.getDescription()); assertEquals(0, view.getElements().size()); assertSame(softwareSystem, view.getSoftwareSystem()); assertEquals(softwareSystem.getId(), view.getSoftwareSystemId()); assertEquals(webApplication.getId(), view.getContainerId()); assertSame(model, view.getModel()); }
view.setContainer(view.getSoftwareSystem().getContainerWithId(view.getContainerId())); hydrateView(view);
/** * Adds the specified software system. * Please note that the parent software system of the container in scope cannot be added to this view. * * @param softwareSystem the SoftwareSystem to add to this view * @param addRelationships whether to add relationships to/from the component */ @Override public void add(@Nonnull SoftwareSystem softwareSystem, boolean addRelationships) { if (softwareSystem != null && !softwareSystem.equals(getSoftwareSystem())) { addElement(softwareSystem, addRelationships); } }
/** * Gets the (computed) name of this view. * * @return the name, as a String */ @Override public String getName() { return getSoftwareSystem().getName() + " - " + getContainer().getName() + " - Components"; }
@Test public void test_createComponentView() { Workspace workspace = new Workspace("Name", "Description"); SoftwareSystem softwareSystem = workspace.getModel().addSoftwareSystem("Software System", "Description"); Container container = softwareSystem.addContainer("Container", "Description", "Technology"); ComponentView componentView = workspace.getViews().createComponentView(container, "key", "Description"); assertEquals("key", componentView.getKey()); assertEquals("Description", componentView.getDescription()); assertSame(softwareSystem, componentView.getSoftwareSystem()); assertSame(container, componentView.getContainer()); }
assertSame(softwareSystem, componentView.getSoftwareSystem()); assertSame(container, componentView.getContainer()); assertSame(component, componentView.getElementView(component).getElement());