/** * Gets the (computed) name of this view. * * @return the name, as a String */ @Override public String getName() { String name; if (getSoftwareSystem() != null) { name = getSoftwareSystem().getName() + " - Deployment"; } else { name = "Deployment"; } if (!StringUtils.isNullOrEmpty(getEnvironment())) { name = name + " - " + getEnvironment(); } return name; }
private boolean addContainerInstancesAndDeploymentNodes(DeploymentNode deploymentNode, boolean addRelationships) { boolean hasContainers = false; for (ContainerInstance containerInstance : deploymentNode.getContainerInstances()) { Container container = containerInstance.getContainer(); if (getSoftwareSystem() == null || container.getParent().equals(getSoftwareSystem())) { addElement(containerInstance, addRelationships); hasContainers = true; } } for (DeploymentNode child : deploymentNode.getChildren()) { hasContainers = hasContainers | addContainerInstancesAndDeploymentNodes(child, addRelationships); } if (hasContainers) { addElement(deploymentNode, addRelationships); } return hasContainers; }
@Test public void test_createDeploymentView() { Workspace workspace = new Workspace("Name", "Description"); DeploymentView deploymentView = workspace.getViews().createDeploymentView("key", "Description"); assertEquals("key", deploymentView.getKey()); assertEquals("Description", deploymentView.getDescription()); assertNull(deploymentView.getSoftwareSystem()); }
@Test public void test_createDeploymentViewForSoftwareSystem() { Workspace workspace = new Workspace("Name", "Description"); SoftwareSystem softwareSystem = workspace.getModel().addSoftwareSystem("Name", "Description"); DeploymentView deploymentView = workspace.getViews().createDeploymentView(softwareSystem, "key", "Description"); assertEquals("key", deploymentView.getKey()); assertEquals("Description", deploymentView.getDescription()); assertSame(softwareSystem, deploymentView.getSoftwareSystem()); }
assertSame(softwareSystem, deploymentView.getSoftwareSystem()); assertSame(deploymentNode, deploymentView.getElementView(deploymentNode).getElement()); assertSame(containerInstance, deploymentView.getElementView(containerInstance).getElement());