@Test public void test_createContainerView_ThrowsAnException_WhenADuplicateKeyIsSpecified() { try { Workspace workspace = new Workspace("Name", "Description"); SoftwareSystem softwareSystem = workspace.getModel().addSoftwareSystem("Software System", "Description"); workspace.getViews().createContainerView(softwareSystem, "key", "Description"); workspace.getViews().createContainerView(softwareSystem, "key", "Description"); fail(); } catch (IllegalArgumentException iae) { assertEquals("A view with the key key already exists.", iae.getMessage()); } }
@Test public void test_createContainerView_ThrowsAnException_WhenASoftwareSystemIsSpecified() { try { new Workspace("", "").getViews().createContainerView(null, null, "Description"); fail(); } catch (IllegalArgumentException iae) { assertEquals("A software system must be specified.", iae.getMessage()); } }
@Test public void test_createContainerView_ThrowsAnException_WhenANullKeyIsSpecified() { try { Workspace workspace = new Workspace("Name", "Description"); SoftwareSystem softwareSystem = workspace.getModel().addSoftwareSystem("Software System", "Description"); workspace.getViews().createContainerView(softwareSystem, null, "Description"); fail(); } catch (IllegalArgumentException iae) { assertEquals("A key must be specified.", iae.getMessage()); } }
@Test public void test_createContainerView_ThrowsAnException_WhenAnEmptyKeyIsSpecified() { try { Workspace workspace = new Workspace("Name", "Description"); SoftwareSystem softwareSystem = workspace.getModel().addSoftwareSystem("Software System", "Description"); workspace.getViews().createContainerView(softwareSystem, " ", "Description"); fail(); } catch (IllegalArgumentException iae) { assertEquals("A key must be specified.", iae.getMessage()); } }
contextView.addAllPeople(); ContainerView containerView = views.createContainerView(springPetClinic, "containers", "The Containers diagram for the Spring PetClinic system."); containerView.addAllPeople(); containerView.addAllSoftwareSystems();
@Test public void test_copyLayoutInformationFrom_WhenTheContainerViewKeysMatch() { Workspace workspace1 = createWorkspace(); SoftwareSystem softwareSystem1 = workspace1.getModel().getSoftwareSystemWithName("Software System"); ContainerView view1 = workspace1.getViews().createContainerView(softwareSystem1, "containers", "Description"); view1.addAllElements(); view1.getElements().iterator().next().setX(100); view1.setPaperSize(PaperSize.A3_Landscape); Workspace workspace2 = createWorkspace(); SoftwareSystem softwareSystem2 = workspace2.getModel().getSoftwareSystemWithName("Software System"); ContainerView view2 = workspace2.getViews().createContainerView(softwareSystem2, "containers", "Description"); view2.addAllElements(); workspace2.getViews().copyLayoutInformationFrom(workspace1.getViews()); assertEquals(100, view2.getElements().iterator().next().getX()); assertEquals(PaperSize.A3_Landscape, view2.getPaperSize()); }
@Test public void test_copyLayoutInformationFrom_DoesNotDoAnythingIfThereIsNoContainerViewToCopyInformationFrom() { Workspace workspace1 = createWorkspace(); Workspace workspace2 = createWorkspace(); SoftwareSystem softwareSystem2 = workspace2.getModel().getSoftwareSystemWithName("Software System"); ContainerView view2 = workspace2.getViews().createContainerView(softwareSystem2, "containers", "Description"); view2.addAllElements(); workspace2.getViews().copyLayoutInformationFrom(workspace1.getViews()); assertEquals(0, view2.getElements().iterator().next().getX()); // default assertNull(view2.getPaperSize()); // default }
contextView.addAllPeople(); ContainerView containerView = views.createContainerView(springPetClinic, "containers", "The Container diagram for the Spring PetClinic system."); containerView.addAllPeople(); containerView.addAllSoftwareSystems();
public static void main(String[] args) throws Exception { Workspace workspace = new Workspace("Styling Relationships", "This is a model of my software system."); Model model = workspace.getModel(); Person user = model.addPerson("User", "A user of my software system."); SoftwareSystem softwareSystem = model.addSoftwareSystem("Software System", "My software system."); Container webApplication = softwareSystem.addContainer("Web Application", "My web application.", "Java and Spring MVC"); Container database = softwareSystem.addContainer("Database", "My database.", "Relational database schema"); user.uses(webApplication, "Uses", "HTTPS"); webApplication.uses(database, "Reads from and writes to", "JDBC"); ViewSet views = workspace.getViews(); ContainerView containerView = views.createContainerView(softwareSystem, "containers", "An example of a container diagram."); containerView.addAllElements(); Styles styles = workspace.getViews().getConfiguration().getStyles(); // example 1 // styles.addRelationshipStyle(Tags.RELATIONSHIP).color("#ff0000"); // example 2 // model.getRelationships().stream().filter(r -> "HTTPS".equals(r.getTechnology())).forEach(r -> r.addTags("HTTPS")); // model.getRelationships().stream().filter(r -> "JDBC".equals(r.getTechnology())).forEach(r -> r.addTags("JDBC")); // styles.addRelationshipStyle("HTTPS").color("#ff0000"); // styles.addRelationshipStyle("JDBC").color("#0000ff"); StructurizrClient structurizrClient = new StructurizrClient(API_KEY, API_SECRET); structurizrClient.putWorkspace(WORKSPACE_ID, workspace); }
ContainerView containerView = views.createContainerView(softwareSystem, "containers", "An example of a container diagram."); containerView.addAllElements();
@Test public void test_createContainerView() { Workspace workspace = new Workspace("Name", "Description"); SoftwareSystem softwareSystem = workspace.getModel().addSoftwareSystem("Software System", "Description"); ContainerView containerView = workspace.getViews().createContainerView(softwareSystem, "key", "Description"); assertEquals("key", containerView.getKey()); assertEquals("Description", containerView.getDescription()); assertSame(softwareSystem, containerView.getSoftwareSystem()); }
contextView.addAllElements(); ContainerView containerView = views.createContainerView(adrTools, "Containers", "The container diagram for adr-tools."); containerView.addAllElements();
contextView.addAllElements(); ContainerView containerView = views.createContainerView(softwareSystem, "Containers", "The container diagram from my software system."); containerView.addAllElements();
systemContextView.setPaperSize(PaperSize.A5_Landscape); ContainerView containerView = views.createContainerView(internetBankingSystem, "Containers", "The container diagram for the Internet Banking System."); containerView.add(customer); containerView.addAllContainers();
ContainerView containerView = views.createContainerView(mySoftwareSystem, "Containers", null); containerView.addAllElements();
systemContextView.addAllPeople(); ContainerView containerView = views.createContainerView(mySoftwareSystem, "containers", "Description"); containerView.addAllSoftwareSystems(); containerView.addAllPeople();
systemContextView.addAllElements(); ContainerView containerView = workspace.getViews().createContainerView(softwareSystem, "containers", ""); containerView.setPaperSize(PaperSize.A2_Landscape); containerView.addAllElements();