Java Code Examples for com.structurizr.Workspace#getViews()

The following examples show how to use com.structurizr.Workspace#getViews() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GettingStarted.java    From java with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    // all software architecture models belong to a workspace
    Workspace workspace = new Workspace("Getting Started", "This is a model of my software system.");
    Model model = workspace.getModel();

    // create a model to describe a user using a software system
    Person user = model.addPerson("User", "A user of my software system.");
    SoftwareSystem softwareSystem = model.addSoftwareSystem("Software System", "My software system.");
    user.uses(softwareSystem, "Uses");

    // create a system context diagram showing people and software systems
    ViewSet views = workspace.getViews();
    SystemContextView contextView = views.createSystemContextView(softwareSystem, "SystemContext", "An example of a System Context diagram.");
    contextView.addAllSoftwareSystems();
    contextView.addAllPeople();

    // add some styling to the diagram elements
    Styles styles = views.getConfiguration().getStyles();
    styles.addElementStyle(Tags.SOFTWARE_SYSTEM).background("#1168bd").color("#ffffff");
    styles.addElementStyle(Tags.PERSON).background("#08427b").color("#ffffff").shape(Shape.Person);

    // upload to structurizr.com (you'll need your own workspace ID, API key and API secret)
    StructurizrClient structurizrClient = new StructurizrClient(API_KEY, API_SECRET);
    structurizrClient.putWorkspace(WORKSPACE_ID, workspace);
}
 
Example 2
Source File: ClientSideEncryption.java    From java with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    Workspace workspace = new Workspace("Client-side encrypted workspace", "This is a client-side encrypted workspace. The passphrase is 'password'.");
    Model model = workspace.getModel();

    Person user = model.addPerson("User", "A user of my software system.");
    SoftwareSystem softwareSystem = model.addSoftwareSystem("Software System", "My software system.");
    user.uses(softwareSystem, "Uses");

    ViewSet views = workspace.getViews();
    SystemContextView contextView = views.createSystemContextView(softwareSystem, "SystemContext", "An example of a System Context diagram.");
    contextView.addAllSoftwareSystems();
    contextView.addAllPeople();

    Styles styles = views.getConfiguration().getStyles();
    styles.addElementStyle(Tags.SOFTWARE_SYSTEM).background("#d34407").color("#ffffff");
    styles.addElementStyle(Tags.PERSON).background("#f86628").color("#ffffff").shape(Shape.Person);

    StructurizrClient structurizrClient = new StructurizrClient(API_KEY, API_SECRET);
    structurizrClient.setEncryptionStrategy(new AesEncryptionStrategy("password"));
    structurizrClient.putWorkspace(WORKSPACE_ID, workspace);
}
 
Example 3
Source File: AutomaticDocumentationTemplateExample.java    From java with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    Workspace workspace = new Workspace("Documentation - Automatic", "An empty software architecture document using the Structurizr template.");
    Model model = workspace.getModel();
    ViewSet views = workspace.getViews();

    Person user = model.addPerson("User", "A user of my software system.");
    SoftwareSystem softwareSystem = model.addSoftwareSystem("Software System", "My software system.");
    user.uses(softwareSystem, "Uses");

    SystemContextView contextView = views.createSystemContextView(softwareSystem, "SystemContext", "An example of a System Context diagram.");
    contextView.addAllSoftwareSystems();
    contextView.addAllPeople();

    Styles styles = views.getConfiguration().getStyles();
    styles.addElementStyle(Tags.PERSON).shape(Shape.Person);

    // this directory includes a mix of Markdown and AsciiDoc files
    File documentationRoot = new File("./structurizr-examples/src/com/structurizr/example/documentation/automatic");

    AutomaticDocumentationTemplate template = new AutomaticDocumentationTemplate(workspace);
    template.addSections(softwareSystem, documentationRoot);

    StructurizrClient structurizrClient = new StructurizrClient(API_KEY, API_SECRET);
    structurizrClient.putWorkspace(WORKSPACE_ID, workspace);
}
 
Example 4
Source File: CorporateBranding.java    From java with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    Workspace workspace = new Workspace("Corporate Branding", "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.");
    user.uses(softwareSystem, "Uses");

    ViewSet views = workspace.getViews();
    SystemContextView contextView = views.createSystemContextView(softwareSystem, "SystemContext", "An example of a System Context diagram.");
    contextView.addAllSoftwareSystems();
    contextView.addAllPeople();

    Styles styles = views.getConfiguration().getStyles();
    styles.addElementStyle(Tags.PERSON).shape(Shape.Person);

    StructurizrDocumentationTemplate template = new StructurizrDocumentationTemplate(workspace);
    template.addContextSection(softwareSystem, Format.Markdown, "Here is some context about the software system...\n\n![](embed:SystemContext)");

    Branding branding = views.getConfiguration().getBranding();
    branding.setLogo(ImageUtils.getImageAsDataUri(new File("./docs/images/structurizr-logo.png")));

    StructurizrClient structurizrClient = new StructurizrClient(API_KEY, API_SECRET);
    structurizrClient.putWorkspace(WORKSPACE_ID, workspace);
}
 
Example 5
Source File: StructurizrSimple.java    From tutorials with MIT License 6 votes vote down vote up
private static Workspace getSoftwareSystem() {
    Workspace workspace = new Workspace("Payment Gateway", "Payment Gateway");
    Model model = workspace.getModel();

    Person user = model.addPerson("Merchant", "Merchant");
    SoftwareSystem paymentTerminal = model.addSoftwareSystem(PAYMENT_TERMINAL, "Payment Terminal");
    user.uses(paymentTerminal, "Makes payment");
    SoftwareSystem fraudDetector = model.addSoftwareSystem(FRAUD_DETECTOR, "Fraud Detector");
    paymentTerminal.uses(fraudDetector, "Obtains fraud score");

    ViewSet viewSet = workspace.getViews();

    SystemContextView contextView = viewSet.createSystemContextView(workspace.getModel().getSoftwareSystemWithName(PAYMENT_TERMINAL), SOFTWARE_SYSTEM_VIEW, "Payment Gateway Diagram");
    contextView.addAllElements();

    return workspace;
}
 
Example 6
Source File: Theme.java    From java with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    Workspace workspace = new Workspace("Theme", "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.");
    user.uses(softwareSystem, "Uses");

    ViewSet views = workspace.getViews();
    SystemContextView contextView = views.createSystemContextView(softwareSystem, "SystemContext", "An example of a System Context diagram.");
    contextView.addAllSoftwareSystems();
    contextView.addAllPeople();

    // add a theme
    views.getConfiguration().setTheme("https://raw.githubusercontent.com/structurizr/java/master/structurizr-examples/src/com/structurizr/example/theme/theme.json");

    StructurizrClient structurizrClient = new StructurizrClient(API_KEY, API_SECRET);
    structurizrClient.putWorkspace(WORKSPACE_ID, workspace);
}
 
Example 7
Source File: HttpHealthChecks.java    From java with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    Workspace workspace = new Workspace("HTTP-based health checks example", "An example of how to use the HTTP-based health checks feature");
    Model model = workspace.getModel();
    ViewSet views = workspace.getViews();

    SoftwareSystem structurizr = model.addSoftwareSystem("Structurizr", "A publishing platform for software architecture diagrams and documentation based upon the C4 model.");
    Container webApplication = structurizr.addContainer("structurizr.com", "Provides all of the server-side functionality of Structurizr, serving static and dynamic content to users.", "Java and Spring MVC");
    Container database = structurizr.addContainer("Database", "Stores information about users, workspaces, etc.", "Relational Database Schema");
    database.addTags(DATABASE_TAG);
    webApplication.uses(database, "Reads from and writes to", "JDBC");

    DeploymentNode amazonWebServices = model.addDeploymentNode("Amazon Web Services", "", "us-east-1");
    DeploymentNode pivotalWebServices = amazonWebServices.addDeploymentNode("Pivotal Web Services", "Platform as a Service provider.", "Cloud Foundry");
    ContainerInstance liveWebApplication = pivotalWebServices.addDeploymentNode("www.structurizr.com", "An open source Java EE web server.", "Apache Tomcat")
            .add(webApplication);
    ContainerInstance liveDatabaseInstance = amazonWebServices.addDeploymentNode("Amazon RDS", "Database as a Service provider.", "MySQL")
            .add(database);

    // add health checks to the container instances, which return a simple HTTP 200 to say everything is okay
    liveWebApplication.addHealthCheck("Web Application is running", "https://www.structurizr.com/health");
    liveDatabaseInstance.addHealthCheck("Database is accessible from Web Application", "https://www.structurizr.com/health/database");

    // the pass/fail status from the health checks is used to supplement any deployment views that include the container instances that have health checks defined
    DeploymentView deploymentView = views.createDeploymentView(structurizr, "Deployment", "A deployment diagram showing the live environment.");
    deploymentView.setEnvironment("Live");
    deploymentView.addAllDeploymentNodes();

    views.getConfiguration().getStyles().addElementStyle(Tags.ELEMENT).color("#ffffff");
    views.getConfiguration().getStyles().addElementStyle(DATABASE_TAG).shape(Shape.Cylinder);

    StructurizrClient structurizrClient = new StructurizrClient(API_KEY, API_SECRET);
    structurizrClient.putWorkspace(WORKSPACE_ID, workspace);
}
 
Example 8
Source File: ViewCreator.java    From architecture-guild with Apache License 2.0 5 votes vote down vote up
static Workspace setupView(Workspace workspace, Function<ViewSet, StaticView> viewGenerator, PaperSize paperSize) {
    ViewSet views = workspace.getViews();
    StaticView contextView = viewGenerator.apply(views);
    contextView.setPaperSize(paperSize);
    contextView.addAllElements();
    setupStyles(views);
    return workspace;
}
 
Example 9
Source File: StylingElements.java    From java with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
        Workspace workspace = new Workspace("Styling Elements", "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.addElementStyle(Tags.ELEMENT).background("#438dd5").color("#ffffff");

        // example 2
//        styles.addElementStyle(Tags.ELEMENT).color("#ffffff");
//        styles.addElementStyle(Tags.PERSON).background("#08427b");
//        styles.addElementStyle(Tags.CONTAINER).background("#438dd5");

        // example 3
//        styles.addElementStyle(Tags.ELEMENT).color("#ffffff");
//        styles.addElementStyle(Tags.PERSON).background("#08427b").shape(Shape.Person);
//        styles.addElementStyle(Tags.CONTAINER).background("#438dd5");
//        database.addTags("Database");
//        styles.addElementStyle("Database").shape(Shape.Cylinder);

        StructurizrClient structurizrClient = new StructurizrClient(API_KEY, API_SECRET);
        structurizrClient.putWorkspace(WORKSPACE_ID, workspace);
    }
 
Example 10
Source File: Structurizr.java    From java-quickstart with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    // a Structurizr workspace is the wrapper for a software architecture model, views and documentation
    Workspace workspace = new Workspace("Getting Started", "This is a model of my software system.");
    Model model = workspace.getModel();

    // add some elements to your software architecture model
    Person user = model.addPerson("User", "A user of my software system.");
    SoftwareSystem softwareSystem = model.addSoftwareSystem("Software System", "My software system.");
    user.uses(softwareSystem, "Uses");

    // define some views (the diagrams you would like to see)
    ViewSet views = workspace.getViews();
    SystemContextView contextView = views.createSystemContextView(softwareSystem, "SystemContext", "An example of a System Context diagram.");
    contextView.setPaperSize(PaperSize.A5_Landscape);
    contextView.addAllSoftwareSystems();
    contextView.addAllPeople();

    // add some documentation
    StructurizrDocumentationTemplate template = new StructurizrDocumentationTemplate(workspace);
    template.addContextSection(softwareSystem, Format.Markdown,
            "Here is some context about the software system...\n" +
                    "\n" +
                    "![](embed:SystemContext)");

    // add some styling
    Styles styles = views.getConfiguration().getStyles();
    styles.addElementStyle(Tags.SOFTWARE_SYSTEM).background("#1168bd").color("#ffffff");
    styles.addElementStyle(Tags.PERSON).background("#08427b").color("#ffffff").shape(Shape.Person);

    uploadWorkspaceToStructurizr(workspace);
}
 
Example 11
Source File: FinancialRiskSystem.java    From java with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
    Workspace workspace = new Workspace("Financial Risk System", "This is a simple (incomplete) example C4 model based upon the financial risk system architecture kata, which can be found at http://bit.ly/sa4d-risksystem");
    Model model = workspace.getModel();

    SoftwareSystem financialRiskSystem = model.addSoftwareSystem("Financial Risk System", "Calculates the bank's exposure to risk for product X.");

    Person businessUser = model.addPerson("Business User", "A regular business user.");
    businessUser.uses(financialRiskSystem, "Views reports using");

    Person configurationUser = model.addPerson("Configuration User", "A regular business user who can also configure the parameters used in the risk calculations.");
    configurationUser.uses(financialRiskSystem, "Configures parameters using");

    SoftwareSystem tradeDataSystem = model.addSoftwareSystem("Trade Data System", "The system of record for trades of type X.");
    financialRiskSystem.uses(tradeDataSystem, "Gets trade data from");

    SoftwareSystem referenceDataSystem = model.addSoftwareSystem("Reference Data System", "Manages reference data for all counterparties the bank interacts with.");
    financialRiskSystem.uses(referenceDataSystem, "Gets counterparty data from");

    SoftwareSystem referenceDataSystemV2 = model.addSoftwareSystem("Reference Data System v2.0", "Manages reference data for all counterparties the bank interacts with.");
    referenceDataSystemV2.addTags("Future State");
    financialRiskSystem.uses(referenceDataSystemV2, "Gets counterparty data from").addTags("Future State");

    SoftwareSystem emailSystem = model.addSoftwareSystem("E-mail system", "The bank's Microsoft Exchange system.");
    financialRiskSystem.uses(emailSystem, "Sends a notification that a report is ready to");
    emailSystem.delivers(businessUser, "Sends a notification that a report is ready to", "E-mail message", InteractionStyle.Asynchronous);

    SoftwareSystem centralMonitoringService = model.addSoftwareSystem("Central Monitoring Service", "The bank's central monitoring and alerting dashboard.");
    financialRiskSystem.uses(centralMonitoringService, "Sends critical failure alerts to", "SNMP", InteractionStyle.Asynchronous).addTags(TAG_ALERT);

    SoftwareSystem activeDirectory = model.addSoftwareSystem("Active Directory", "The bank's authentication and authorisation system.");
    financialRiskSystem.uses(activeDirectory, "Uses for user authentication and authorisation");

    ViewSet views = workspace.getViews();
    SystemContextView contextView = views.createSystemContextView(financialRiskSystem, "Context", "An example System Context diagram for the Financial Risk System architecture kata.");
    contextView.addAllSoftwareSystems();
    contextView.addAllPeople();

    Styles styles = views.getConfiguration().getStyles();
    financialRiskSystem.addTags("Risk System");

    styles.addElementStyle(Tags.ELEMENT).color("#ffffff").fontSize(34);
    styles.addElementStyle("Risk System").background("#550000").color("#ffffff");
    styles.addElementStyle(Tags.SOFTWARE_SYSTEM).width(650).height(400).background("#801515").shape(Shape.RoundedBox);
    styles.addElementStyle(Tags.PERSON).width(550).background("#d46a6a").shape(Shape.Person);

    styles.addRelationshipStyle(Tags.RELATIONSHIP).thickness(4).dashed(false).fontSize(32).width(400);
    styles.addRelationshipStyle(Tags.SYNCHRONOUS).dashed(false);
    styles.addRelationshipStyle(Tags.ASYNCHRONOUS).dashed(true);
    styles.addRelationshipStyle(TAG_ALERT).color("#ff0000");

    styles.addElementStyle("Future State").opacity(30).border(Border.Dashed);
    styles.addRelationshipStyle("Future State").opacity(30).dashed(true);

    StructurizrDocumentationTemplate template = new StructurizrDocumentationTemplate(workspace);
    File documentationRoot = new File("./structurizr-examples/src/com/structurizr/example/financialrisksystem");
    template.addContextSection(financialRiskSystem, new File(documentationRoot, "context.adoc"));
    template.addFunctionalOverviewSection(financialRiskSystem, new File(documentationRoot, "functional-overview.md"));
    template.addQualityAttributesSection(financialRiskSystem, new File(documentationRoot, "quality-attributes.md"));
    template.addImages(documentationRoot);

    StructurizrClient structurizrClient = new StructurizrClient(API_KEY, API_SECRET);
    structurizrClient.putWorkspace(WORKSPACE_ID, workspace);
}
 
Example 12
Source File: AmazonWebServicesExample.java    From java with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
    Workspace workspace = new Workspace("Amazon Web Services Example", "An example AWS deployment architecture.");
    Model model = workspace.getModel();

    SoftwareSystem softwareSystem = model.addSoftwareSystem("Spring PetClinic", "Allows employees to view and manage information regarding the veterinarians, the clients, and their pets.");
    Container webApplication = softwareSystem.addContainer("Web Application", "Allows employees to view and manage information regarding the veterinarians, the clients, and their pets.", "Java and Spring Boot");
    webApplication.addTags(SPRING_BOOT_TAG);
    Container database = softwareSystem.addContainer("Database", "Stores information regarding the veterinarians, the clients, and their pets.", "Relational database schema");
    database.addTags(DATABASE_TAG);

    webApplication.uses(database, "Reads from and writes to", "JDBC/SSL");

    DeploymentNode amazonWebServices = model.addDeploymentNode("Amazon Web Services");
    amazonWebServices.addTags("Amazon Web Services - Cloud");
    DeploymentNode amazonRegion = amazonWebServices.addDeploymentNode("US-East-1");
    amazonRegion.addTags("Amazon Web Services - Region");
    DeploymentNode autoscalingGroup = amazonRegion.addDeploymentNode("Autoscaling group");
    autoscalingGroup.addTags("Amazon Web Services - Auto Scaling");
    DeploymentNode ec2 = autoscalingGroup.addDeploymentNode("Amazon EC2");
    ec2.addTags("Amazon Web Services - EC2");
    ContainerInstance webApplicationInstance = ec2.add(webApplication);

    InfrastructureNode route53 = amazonRegion.addInfrastructureNode("Route 53");
    route53.addTags("Amazon Web Services - Route 53");

    InfrastructureNode elb = amazonRegion.addInfrastructureNode("Elastic Load Balancer");
    elb.addTags("Amazon Web Services - Elastic Load Balancing");

    route53.uses(elb, "Forwards requests to", "HTTPS");
    elb.uses(webApplicationInstance, "Forwards requests to", "HTTPS");

    DeploymentNode rds = amazonRegion.addDeploymentNode("Amazon RDS");
    rds.addTags("Amazon Web Services - RDS");
    DeploymentNode mySql = rds.addDeploymentNode("MySQL");
    mySql.addTags("Amazon Web Services - RDS_MySQL_instance");
    ContainerInstance databaseInstance = mySql.add(database);

    ViewSet views = workspace.getViews();
    DeploymentView deploymentView = views.createDeploymentView(softwareSystem, "AmazonWebServicesDeployment", "An example deployment diagram.");
    deploymentView.addAllDeploymentNodes();

    deploymentView.addAnimation(route53);
    deploymentView.addAnimation(elb);
    deploymentView.addAnimation(webApplicationInstance);
    deploymentView.addAnimation(databaseInstance);

    Styles styles = views.getConfiguration().getStyles();
    styles.addElementStyle(SPRING_BOOT_TAG).shape(Shape.RoundedBox).background("#ffffff");
    styles.addElementStyle(DATABASE_TAG).shape(Shape.Cylinder).background("#ffffff");
    styles.addElementStyle(Tags.INFRASTRUCTURE_NODE).shape(Shape.RoundedBox).background("#ffffff");

    views.getConfiguration().setThemes("https://raw.githubusercontent.com/structurizr/themes/master/amazon-web-services/theme.json");

    StructurizrClient structurizrClient = new StructurizrClient(API_KEY, API_SECRET);
    structurizrClient.putWorkspace(WORKSPACE_ID, workspace);
}
 
Example 13
Source File: MessageDigestIdGeneratorTests.java    From java with Apache License 2.0 4 votes vote down vote up
private Workspace createWorkspace(IdGenerator ids) {
    Workspace workspace = new Workspace("My workspace", "Description");
    Model model = workspace.getModel();
    model.setIdGenerator(ids);

    SoftwareSystem mySoftwareSystem = model.addSoftwareSystem(Location.Internal, "My Software System", "Description");
    mySoftwareSystem.addTags("Internal");

    Person person = model.addPerson(Location.External, "A User", "Description");
    person.addTags("External");
    person.uses(mySoftwareSystem, "Uses");

    Container webApplication = mySoftwareSystem.addContainer("Web Application", "Description", "Apache Tomcat");
    Container database = mySoftwareSystem.addContainer("Database", "Description", "MySQL");
    person.uses(webApplication, "Uses");
    Relationship webApplicationToDatabase = webApplication.uses(database, "Reads from and writes to");
    webApplicationToDatabase.addTags("JDBC");

    Component componentA = webApplication.addComponent("ComponentA", "Description", "Technology A");
    Component componentB = webApplication.addComponent("com.somecompany.system.ComponentB", "com.somecompany.system.ComponentBImpl", "Description", "Technology B");
    person.uses(componentA, "Uses");
    componentA.uses(componentB, "Uses");
    componentB.uses(database, "Reads from and writes to");

    ViewSet views = workspace.getViews();
    SystemContextView systemContextView = views.createSystemContextView(mySoftwareSystem, "context", "Description");
    systemContextView.addAllSoftwareSystems();
    systemContextView.addAllPeople();

    ContainerView containerView = views.createContainerView(mySoftwareSystem, "containers", "Description");
    containerView.addAllSoftwareSystems();
    containerView.addAllPeople();
    containerView.addAllContainers();

    ComponentView componentView = views.createComponentView(webApplication, "components", "Description");
    componentView.addAllSoftwareSystems();
    componentView.addAllPeople();
    componentView.addAllContainers();
    componentView.addAllComponents();

    views.getConfiguration().getStyles().add(new ElementStyle(Tags.ELEMENT, 600, 450, "#dddddd", "#000000", 30));
    views.getConfiguration().getStyles().add(new ElementStyle("Internal", null, null, "#041F37", "#ffffff", null));
    views.getConfiguration().getStyles().add(new RelationshipStyle(Tags.RELATIONSHIP, 4, "#dddddd", true, Routing.Direct, 25, 300, null));
    views.getConfiguration().getStyles().add(new RelationshipStyle("JDBC", 4, "#ff0000", true, Routing.Direct, 25, 300, null));

    return workspace;
}
 
Example 14
Source File: Arc42DocumentationExample.java    From java with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
        Workspace workspace = new Workspace("Documentation - arc42", "An empty software architecture document using the arc42 template.");
        Model model = workspace.getModel();
        ViewSet views = workspace.getViews();

        Person user = model.addPerson("User", "A user of my software system.");
        SoftwareSystem softwareSystem = model.addSoftwareSystem("Software System", "My software system.");
        user.uses(softwareSystem, "Uses");

        SystemContextView contextView = views.createSystemContextView(softwareSystem, "SystemContext", "An example of a System Context diagram.");
        contextView.addAllSoftwareSystems();
        contextView.addAllPeople();

        Styles styles = views.getConfiguration().getStyles();
        styles.addElementStyle(Tags.PERSON).shape(Shape.Person);

        Arc42DocumentationTemplate template = new Arc42DocumentationTemplate(workspace);

        // this is the Markdown version
        File documentationRoot = new File("./structurizr-examples/src/com/structurizr/example/documentation/arc42/markdown");
        template.addIntroductionAndGoalsSection(softwareSystem, new File(documentationRoot, "01-introduction-and-goals.md"));
        template.addConstraintsSection(softwareSystem, new File(documentationRoot, "02-architecture-constraints.md"));
        template.addContextAndScopeSection(softwareSystem, new File(documentationRoot, "03-system-scope-and-context.md"));
        template.addSolutionStrategySection(softwareSystem, new File(documentationRoot, "04-solution-strategy.md"));
        template.addBuildingBlockViewSection(softwareSystem, new File(documentationRoot, "05-building-block-view.md"));
        template.addRuntimeViewSection(softwareSystem, new File(documentationRoot, "06-runtime-view.md"));
        template.addDeploymentViewSection(softwareSystem, new File(documentationRoot, "07-deployment-view.md"));
        template.addCrosscuttingConceptsSection(softwareSystem, new File(documentationRoot, "08-crosscutting-concepts.md"));
        template.addArchitecturalDecisionsSection(softwareSystem, new File(documentationRoot, "09-architecture-decisions.md"));
        template.addRisksAndTechnicalDebtSection(softwareSystem, new File(documentationRoot, "10-quality-requirements.md"));
        template.addQualityRequirementsSection(softwareSystem, new File(documentationRoot, "11-risks-and-technical-debt.md"));
        template.addGlossarySection(softwareSystem, new File(documentationRoot, "12-glossary.md"));

        // this is the AsciiDoc version
//        File documentationRoot = new File("./structurizr-examples/src/com/structurizr/example/documentation/arc42/asciidoc");
//        template.addIntroductionAndGoalsSection(softwareSystem, new File(documentationRoot, "01-introduction-and-goals.adoc"));
//        template.addConstraintsSection(softwareSystem, new File(documentationRoot, "02-architecture-constraints.adoc"));
//        template.addContextAndScopeSection(softwareSystem, new File(documentationRoot, "03-system-scope-and-context.adoc"));
//        template.addSolutionStrategySection(softwareSystem, new File(documentationRoot, "04-solution-strategy.adoc"));
//        template.addBuildingBlockViewSection(softwareSystem, new File(documentationRoot, "05-building-block-view.adoc"));
//        template.addRuntimeViewSection(softwareSystem, new File(documentationRoot, "06-runtime-view.adoc"));
//        template.addDeploymentViewSection(softwareSystem, new File(documentationRoot, "07-deployment-view.adoc"));
//        template.addCrosscuttingConceptsSection(softwareSystem, new File(documentationRoot, "08-crosscutting-concepts.adoc"));
//        template.addArchitecturalDecisionsSection(softwareSystem, new File(documentationRoot, "09-architecture-decisions.adoc"));
//        template.addRisksAndTechnicalDebtSection(softwareSystem, new File(documentationRoot, "10-quality-requirements.adoc"));
//        template.addQualityRequirementsSection(softwareSystem, new File(documentationRoot, "11-risks-and-technical-debt.adoc"));
//        template.addGlossarySection(softwareSystem, new File(documentationRoot, "12-glossary.adoc"));

        StructurizrClient structurizrClient = new StructurizrClient(API_KEY, API_SECRET);
        structurizrClient.putWorkspace(WORKSPACE_ID, workspace);
    }
 
Example 15
Source File: ViewpointsAndPerspectivesDocumentationExample.java    From java with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
        Workspace workspace = new Workspace("Documentation - Viewpoints and Perspectives", "An empty software architecture document using the Viewpoints and Perspectives template.");
        Model model = workspace.getModel();
        ViewSet views = workspace.getViews();

        Person user = model.addPerson("User", "A user of my software system.");
        SoftwareSystem softwareSystem = model.addSoftwareSystem("Software System", "My software system.");
        user.uses(softwareSystem, "Uses");

        SystemContextView contextView = views.createSystemContextView(softwareSystem, "SystemContext", "An example of a System Context diagram.");
        contextView.addAllSoftwareSystems();
        contextView.addAllPeople();

        Styles styles = views.getConfiguration().getStyles();
        styles.addElementStyle(Tags.PERSON).shape(Shape.Person);

        ViewpointsAndPerspectivesDocumentationTemplate template = new ViewpointsAndPerspectivesDocumentationTemplate(workspace);

        // this is the Markdown version
        File documentationRoot = new File("./structurizr-examples/src/com/structurizr/example/documentation/viewpointsandperspectives/markdown");
        template.addIntroductionSection(softwareSystem, new File(documentationRoot, "01-introduction.md"));
        template.addGlossarySection(softwareSystem, new File(documentationRoot, "02-glossary.md"));
        template.addSystemStakeholdersAndRequirementsSection(softwareSystem, new File(documentationRoot, "03-system-stakeholders-and-requirements.md"));
        template.addArchitecturalForcesSection(softwareSystem, new File(documentationRoot, "04-architectural-forces.md"));
        template.addArchitecturalViewsSection(softwareSystem, new File(documentationRoot, "05-architectural-views"));
        template.addSystemQualitiesSection(softwareSystem, new File(documentationRoot, "06-system-qualities.md"));
        template.addAppendicesSection(softwareSystem, new File(documentationRoot, "07-appendices.md"));

        // this is the AsciiDoc version
//        File documentationRoot = new File("./structurizr-examples/src/com/structurizr/example/documentation/viewpointsandperspectives/asciidoc");
//        template.addIntroductionSection(softwareSystem, new File(documentationRoot, "01-introduction.adoc"));
//        template.addGlossarySection(softwareSystem, new File(documentationRoot, "02-glossary.adoc"));
//        template.addSystemStakeholdersAndRequirementsSection(softwareSystem, new File(documentationRoot, "03-system-stakeholders-and-requirements.adoc"));
//        template.addArchitecturalForcesSection(softwareSystem, new File(documentationRoot, "04-architectural-forces.adoc"));
//        template.addArchitecturalViewsSection(softwareSystem, new File(documentationRoot, "05-architectural-views"));
//        template.addSystemQualitiesSection(softwareSystem, new File(documentationRoot, "06-system-qualities.adoc"));
//        template.addAppendicesSection(softwareSystem, new File(documentationRoot, "07-appendices.adoc"));

        StructurizrClient structurizrClient = new StructurizrClient(API_KEY, API_SECRET);
        structurizrClient.putWorkspace(WORKSPACE_ID, workspace);
    }
 
Example 16
Source File: StructurizrDocumentationExample.java    From java with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
        Workspace workspace = new Workspace("Documentation - Structurizr", "An empty software architecture document using the Structurizr template.");
        Model model = workspace.getModel();
        ViewSet views = workspace.getViews();

        Person user = model.addPerson("User", "A user of my software system.");
        SoftwareSystem softwareSystem = model.addSoftwareSystem("Software System", "My software system.");
        user.uses(softwareSystem, "Uses");

        SystemContextView contextView = views.createSystemContextView(softwareSystem, "SystemContext", "An example of a System Context diagram.");
        contextView.addAllSoftwareSystems();
        contextView.addAllPeople();

        Styles styles = views.getConfiguration().getStyles();
        styles.addElementStyle(Tags.PERSON).shape(Shape.Person);

        StructurizrDocumentationTemplate template = new StructurizrDocumentationTemplate(workspace);

        // this is the Markdown version
        File documentationRoot = new File("./structurizr-examples/src/com/structurizr/example/documentation/structurizr/markdown");
        template.addContextSection(softwareSystem, new File(documentationRoot, "01-context.md"));
        template.addFunctionalOverviewSection(softwareSystem, new File(documentationRoot, "02-functional-overview.md"));
        template.addQualityAttributesSection(softwareSystem, new File(documentationRoot, "03-quality-attributes.md"));
        template.addConstraintsSection(softwareSystem, new File(documentationRoot, "04-constraints.md"));
        template.addPrinciplesSection(softwareSystem, new File(documentationRoot, "05-principles.md"));
        template.addSoftwareArchitectureSection(softwareSystem, new File(documentationRoot, "06-software-architecture.md"));
        template.addDataSection(softwareSystem, new File(documentationRoot, "07-data.md"));
        template.addInfrastructureArchitectureSection(softwareSystem, new File(documentationRoot, "08-infrastructure-architecture.md"));
        template.addDeploymentSection(softwareSystem, new File(documentationRoot, "09-deployment.md"));
        template.addDevelopmentEnvironmentSection(softwareSystem, new File(documentationRoot, "10-development-environment.md"));
        template.addOperationAndSupportSection(softwareSystem, new File(documentationRoot, "11-operation-and-support.md"));
        template.addDecisionLogSection(softwareSystem, new File(documentationRoot, "12-decision-log.md"));

        // this is the AsciiDoc version
//        File documentationRoot = new File("./structurizr-examples/src/com/structurizr/example/documentation/structurizr/asciidoc");
//        template.addContextSection(softwareSystem, new File(documentationRoot, "01-context.adoc"));
//        template.addFunctionalOverviewSection(softwareSystem, new File(documentationRoot, "02-functional-overview.adoc"));
//        template.addQualityAttributesSection(softwareSystem, new File(documentationRoot, "03-quality-attributes.adoc"));
//        template.addConstraintsSection(softwareSystem, new File(documentationRoot, "04-constraints.adoc"));
//        template.addPrinciplesSection(softwareSystem, new File(documentationRoot, "05-principles.adoc"));
//        template.addSoftwareArchitectureSection(softwareSystem, new File(documentationRoot, "06-software-architecture.adoc"));
//        template.addDataSection(softwareSystem, new File(documentationRoot, "07-data.adoc"));
//        template.addInfrastructureArchitectureSection(softwareSystem, new File(documentationRoot, "08-infrastructure-architecture.adoc"));
//        template.addDeploymentSection(softwareSystem, new File(documentationRoot, "09-deployment.adoc"));
//        template.addDevelopmentEnvironmentSection(softwareSystem, new File(documentationRoot, "10-development-environment.adoc"));
//        template.addOperationAndSupportSection(softwareSystem, new File(documentationRoot, "11-operation-and-support.adoc"));
//        template.addDecisionLogSection(softwareSystem, new File(documentationRoot, "12-decision-log.adoc"));

        StructurizrClient structurizrClient = new StructurizrClient(API_KEY, API_SECRET);
        structurizrClient.putWorkspace(WORKSPACE_ID, workspace);
    }
 
Example 17
Source File: MicroservicesExample.java    From java with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
    Workspace workspace = new Workspace("Microservices example", "An example of a microservices architecture, which includes asynchronous and parallel behaviour.");
    Model model = workspace.getModel();

    SoftwareSystem mySoftwareSystem = model.addSoftwareSystem("Customer Information System", "Stores information ");
    Person customer = model.addPerson("Customer", "A customer");
    Container customerApplication = mySoftwareSystem.addContainer("Customer Application", "Allows customers to manage their profile.", "Angular");

    Container customerService = mySoftwareSystem.addContainer("Customer Service", "The point of access for customer information.", "Java and Spring Boot");
    customerService.addTags(MICROSERVICE_TAG);
    Container customerDatabase = mySoftwareSystem.addContainer("Customer Database", "Stores customer information.", "Oracle 12c");
    customerDatabase.addTags(DATASTORE_TAG);

    Container reportingService = mySoftwareSystem.addContainer("Reporting Service", "Creates normalised data for reporting purposes.", "Ruby");
    reportingService.addTags(MICROSERVICE_TAG);
    Container reportingDatabase = mySoftwareSystem.addContainer("Reporting Database", "Stores a normalised version of all business data for ad hoc reporting purposes.", "MySQL");
    reportingDatabase.addTags(DATASTORE_TAG);

    Container auditService = mySoftwareSystem.addContainer("Audit Service", "Provides organisation-wide auditing facilities.", "C# .NET");
    auditService.addTags(MICROSERVICE_TAG);
    Container auditStore = mySoftwareSystem.addContainer("Audit Store", "Stores information about events that have happened.", "Event Store");
    auditStore.addTags(DATASTORE_TAG);

    Container messageBus = mySoftwareSystem.addContainer("Message Bus", "Transport for business events.", "RabbitMQ");
    messageBus.addTags(MESSAGE_BUS_TAG);

    customer.uses(customerApplication, "Uses");
    customerApplication.uses(customerService, "Updates customer information using", "JSON/HTTPS", InteractionStyle.Synchronous);
    customerService.uses(messageBus, "Sends customer update events to", "", InteractionStyle.Asynchronous);
    customerService.uses(customerDatabase, "Stores data in", "JDBC", InteractionStyle.Synchronous);
    customerService.uses(customerApplication, "Sends events to", "WebSocket", InteractionStyle.Asynchronous);
    messageBus.uses(reportingService, "Sends customer update events to", "", InteractionStyle.Asynchronous);
    messageBus.uses(auditService, "Sends customer update events to", "", InteractionStyle.Asynchronous);
    reportingService.uses(reportingDatabase, "Stores data in", "", InteractionStyle.Synchronous);
    auditService.uses(auditStore, "Stores events in", "", InteractionStyle.Synchronous);

    ViewSet views = workspace.getViews();

    ContainerView containerView = views.createContainerView(mySoftwareSystem, "Containers", null);
    containerView.addAllElements();

    DynamicView dynamicView = views.createDynamicView(mySoftwareSystem, "CustomerUpdateEvent", "This diagram shows what happens when a customer updates their details.");
    dynamicView.add(customer, customerApplication);
    dynamicView.add(customerApplication, customerService);

    dynamicView.add(customerService, customerDatabase);
    dynamicView.add(customerService, messageBus);

    dynamicView.startParallelSequence();
    dynamicView.add(messageBus, reportingService);
    dynamicView.add(reportingService, reportingDatabase);
    dynamicView.endParallelSequence();

    dynamicView.startParallelSequence();
    dynamicView.add(messageBus, auditService);
    dynamicView.add(auditService, auditStore);
    dynamicView.endParallelSequence();

    dynamicView.startParallelSequence();
    dynamicView.add(customerService, "Confirms update to", customerApplication);
    dynamicView.endParallelSequence();

    Styles styles = views.getConfiguration().getStyles();
    styles.addElementStyle(Tags.ELEMENT).color("#000000");
    styles.addElementStyle(Tags.PERSON).background("#ffbf00").shape(Shape.Person);
    styles.addElementStyle(Tags.CONTAINER).background("#facc2E");
    styles.addElementStyle(MESSAGE_BUS_TAG).width(1600).shape(Shape.Pipe);
    styles.addElementStyle(MICROSERVICE_TAG).shape(Shape.Hexagon);
    styles.addElementStyle(DATASTORE_TAG).background("#f5da81").shape(Shape.Cylinder);
    styles.addRelationshipStyle(Tags.RELATIONSHIP).routing(Routing.Orthogonal);

    styles.addRelationshipStyle(Tags.ASYNCHRONOUS).dashed(true);
    styles.addRelationshipStyle(Tags.SYNCHRONOUS).dashed(false);

    StructurizrClient client = new StructurizrClient("key", "secret");
    client.putWorkspace(4241, workspace);
}
 
Example 18
Source File: Shapes.java    From java with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
    Workspace workspace = new Workspace("Shapes", "An example of all shapes available in Structurizr.");
    Model model = workspace.getModel();

    model.addSoftwareSystem("Box", "Description").addTags("Box");
    model.addSoftwareSystem("RoundedBox", "Description").addTags("RoundedBox");
    model.addSoftwareSystem("Ellipse", "Description").addTags("Ellipse");
    model.addSoftwareSystem("Circle", "Description").addTags("Circle");
    model.addSoftwareSystem("Hexagon", "Description").addTags("Hexagon");
    model.addSoftwareSystem("Cylinder", "Description").addTags("Cylinder");
    model.addSoftwareSystem("WebBrowser", "Description").addTags("Web Browser");
    model.addSoftwareSystem("Mobile Device Portrait", "Description").addTags("Mobile Device Portrait");
    model.addSoftwareSystem("Mobile Device Landscape", "Description").addTags("Mobile Device Landscape");
    model.addSoftwareSystem("Pipe", "Description").addTags("Pipe");
    model.addSoftwareSystem("Folder", "Description").addTags("Folder");
    model.addSoftwareSystem("Robot", "Description").addTags("Robot");
    model.addPerson("Person", "Description").addTags("Person");
    model.addSoftwareSystem("Component", "Description").addTags("Component");

    ViewSet views = workspace.getViews();
    SystemLandscapeView view = views.createSystemLandscapeView("shapes", "An example of all shapes available in Structurizr.");
    view.addAllElements();
    view.setPaperSize(PaperSize.A5_Landscape);

    Styles styles = views.getConfiguration().getStyles();

    styles.addElementStyle(Tags.ELEMENT).color("#ffffff").background("#438dd5").fontSize(34).width(650).height(400).description(false).metadata(false);
    styles.addElementStyle("Box").shape(Shape.Box);
    styles.addElementStyle("RoundedBox").shape(Shape.RoundedBox);
    styles.addElementStyle("Ellipse").shape(Shape.Ellipse);
    styles.addElementStyle("Circle").shape(Shape.Circle);
    styles.addElementStyle("Cylinder").shape(Shape.Cylinder);
    styles.addElementStyle("Web Browser").shape(Shape.WebBrowser);
    styles.addElementStyle("Mobile Device Portrait").shape(Shape.MobileDevicePortrait).width(400).height(650);
    styles.addElementStyle("Mobile Device Landscape").shape(Shape.MobileDeviceLandscape);
    styles.addElementStyle("Pipe").shape(Shape.Pipe);
    styles.addElementStyle("Folder").shape(Shape.Folder);
    styles.addElementStyle("Hexagon").shape(Shape.Hexagon);
    styles.addElementStyle("Robot").shape(Shape.Robot).width(550);
    styles.addElementStyle("Person").shape(Shape.Person).width(550);
    styles.addElementStyle("Component").shape(Shape.Component);

    StructurizrClient structurizrClient = new StructurizrClient(API_KEY, API_SECRET);
    structurizrClient.putWorkspace(WORKSPACE_ID, workspace);
}
 
Example 19
Source File: ViewSetTests.java    From java with Apache License 2.0 4 votes vote down vote up
@Test
public void test_createDefaultViews() {
    Workspace workspace = new Workspace("Name", "Description");
    Model model = workspace.getModel();
    ViewSet views = workspace.getViews();

    SoftwareSystem ss1 = model.addSoftwareSystem("Software System 1");
    Container c1 = ss1.addContainer("Container 1", "", "");
    Component cc1 = c1.addComponent("Component 1", "", "");

    SoftwareSystem ss2 = model.addSoftwareSystem("Software System 2");
    Container c2 = ss2.addContainer("Container 2", "", "");
    Component cc2 = c2.addComponent("Component 2", "", "");

    DeploymentNode dev = model.addDeploymentNode("Development", "Developer Laptop", "", "");
    DeploymentNode live = model.addDeploymentNode("Live", "Amazon Web Services", "", "");
    DeploymentNode liveEc2 = live.addDeploymentNode("EC2");

    views.createDefaultViews();

    assertEquals(1, views.getSystemLandscapeViews().size());
    assertEquals("SystemLandscape", views.getSystemLandscapeViews().iterator().next().getKey());

    assertEquals(2, views.getSystemContextViews().size());
    assertSame(ss1, views.getSystemContextViews().stream().filter(v -> v.getKey().equals("SoftwareSystem1-SystemContext")).findFirst().get().getSoftwareSystem());
    assertSame(ss2, views.getSystemContextViews().stream().filter(v -> v.getKey().equals("SoftwareSystem2-SystemContext")).findFirst().get().getSoftwareSystem());

    assertEquals(2, views.getContainerViews().size());
    assertSame(ss1, views.getContainerViews().stream().filter(v -> v.getKey().equals("SoftwareSystem1-Container")).findFirst().get().getSoftwareSystem());
    assertSame(ss2, views.getContainerViews().stream().filter(v -> v.getKey().equals("SoftwareSystem2-Container")).findFirst().get().getSoftwareSystem());

    assertEquals(2, views.getComponentViews().size());
    assertSame(c1, views.getComponentViews().stream().filter(v -> v.getKey().equals("SoftwareSystem1-Container1-Component")).findFirst().get().getContainer());
    assertSame(c2, views.getComponentViews().stream().filter(v -> v.getKey().equals("SoftwareSystem2-Container2-Component")).findFirst().get().getContainer());

    assertEquals(0, views.getDynamicViews().size());
    assertEquals(0, views.getDeploymentViews().size());

    live.addInfrastructureNode("Route 53");

    views.clear();
    views.createDefaultViews();

    assertEquals(1, views.getDeploymentViews().size());
    assertSame("Live", views.getDeploymentViews().stream().filter(v -> v.getKey().equals("Live-Deployment")).findFirst().get().getEnvironment());

    dev.add(c1);
    liveEc2.add(c1);
    liveEc2.add(c2);

    views.clear();
    views.createDefaultViews();

    assertEquals(3, views.getDeploymentViews().size());
    assertSame(ss1, views.getDeploymentViews().stream().filter(v -> v.getKey().equals("SoftwareSystem1-Development-Deployment")).findFirst().get().getSoftwareSystem());
    assertSame("Development", views.getDeploymentViews().stream().filter(v -> v.getKey().equals("SoftwareSystem1-Development-Deployment")).findFirst().get().getEnvironment());
    assertSame(ss1, views.getDeploymentViews().stream().filter(v -> v.getKey().equals("SoftwareSystem1-Live-Deployment")).findFirst().get().getSoftwareSystem());
    assertSame("Live", views.getDeploymentViews().stream().filter(v -> v.getKey().equals("SoftwareSystem1-Live-Deployment")).findFirst().get().getEnvironment());
    assertSame(ss2, views.getDeploymentViews().stream().filter(v -> v.getKey().equals("SoftwareSystem2-Live-Deployment")).findFirst().get().getSoftwareSystem());
    assertSame("Live", views.getDeploymentViews().stream().filter(v -> v.getKey().equals("SoftwareSystem2-Live-Deployment")).findFirst().get().getEnvironment());
}
 
Example 20
Source File: ViewSetTests.java    From java with Apache License 2.0 4 votes vote down vote up
@Test
public void test_hydrate() {
    Workspace workspace = new Workspace("Name", "Description");
    Model model = workspace.getModel();
    ViewSet views = workspace.getViews();
    Person person = model.addPerson("Person", "Description");
    SoftwareSystem softwareSystem = model.addSoftwareSystem("Software System", "Description");
    Container container = softwareSystem.addContainer("Container", "Description", "Technology");
    Component component = container.addComponent("Component", "Description", "Technology");
    Relationship personUsesSoftwareSystemRelationship = person.uses(softwareSystem, "uses");
    DeploymentNode deploymentNode = model.addDeploymentNode("Deployment Node", "Description", "Technology");
    ContainerInstance containerInstance = deploymentNode.add(container);

    SystemLandscapeView systemLandscapeView = new SystemLandscapeView();
    systemLandscapeView.setKey("systemLandscape"); // this is used for the filtered view below
    systemLandscapeView.setElements(elementViewsFor(person, softwareSystem));
    systemLandscapeView.setRelationships(relationshipViewsFor(personUsesSoftwareSystemRelationship));
    views.setSystemLandscapeViews(Collections.singleton(systemLandscapeView));

    SystemContextView systemContextView = new SystemContextView();
    systemContextView.setKey("systemContext");
    systemContextView.setSoftwareSystemId(softwareSystem.getId());
    systemContextView.setElements(elementViewsFor(softwareSystem));
    views.setSystemContextViews(Collections.singleton(systemContextView));

    ContainerView containerView = new ContainerView();
    containerView.setKey("containers");
    containerView.setSoftwareSystemId(softwareSystem.getId());
    containerView.setElements(elementViewsFor(container));
    views.setContainerViews(Collections.singleton(containerView));

    ComponentView componentView = new ComponentView();
    componentView.setKey("components");
    componentView.setSoftwareSystemId(softwareSystem.getId());
    componentView.setContainerId(container.getId());
    componentView.setElements(elementViewsFor(component));
    views.setComponentViews(Collections.singleton(componentView));

    DynamicView dynamicView = new DynamicView();
    dynamicView.setKey("dynamic");
    dynamicView.setElementId(softwareSystem.getId());
    dynamicView.setElements(elementViewsFor(component));
    views.setDynamicViews(Collections.singleton(dynamicView));

    DeploymentView deploymentView = new DeploymentView();
    deploymentView.setKey("deployment");
    deploymentView.setSoftwareSystemId(softwareSystem.getId());
    deploymentView.setElements(elementViewsFor(deploymentNode, containerInstance));
    views.setDeploymentViews(Collections.singleton(deploymentView));

    FilteredView filteredView = new FilteredView();
    filteredView.setKey("filtered");
    filteredView.setBaseViewKey(systemLandscapeView.getKey());
    views.setFilteredViews(Collections.singleton(filteredView));

    workspace.getViews().hydrate(model);

    assertSame(model, systemLandscapeView.getModel());
    assertSame(views, systemLandscapeView.getViewSet());
    assertSame(person, systemLandscapeView.getElementView(person).getElement());
    assertSame(softwareSystem, systemLandscapeView.getElementView(softwareSystem).getElement());
    assertSame(personUsesSoftwareSystemRelationship, systemLandscapeView.getRelationshipView(personUsesSoftwareSystemRelationship).getRelationship());

    assertSame(model, systemContextView.getModel());
    assertSame(views, systemContextView.getViewSet());
    assertSame(softwareSystem, systemContextView.getSoftwareSystem());
    assertSame(softwareSystem, systemContextView.getElementView(softwareSystem).getElement());

    assertSame(model, containerView.getModel());
    assertSame(views, containerView.getViewSet());
    assertSame(softwareSystem, containerView.getSoftwareSystem());
    assertSame(container, containerView.getElementView(container).getElement());

    assertSame(model, componentView.getModel());
    assertSame(views, componentView.getViewSet());
    assertSame(softwareSystem, componentView.getSoftwareSystem());
    assertSame(container, componentView.getContainer());
    assertSame(component, componentView.getElementView(component).getElement());

    assertSame(model, dynamicView.getModel());
    assertSame(views, dynamicView.getViewSet());
    assertSame(softwareSystem, dynamicView.getSoftwareSystem());
    assertSame(softwareSystem, dynamicView.getElement());
    assertSame(component, dynamicView.getElementView(component).getElement());

    assertSame(model, deploymentView.getModel());
    assertSame(views, deploymentView.getViewSet());
    assertSame(softwareSystem, deploymentView.getSoftwareSystem());
    assertSame(deploymentNode, deploymentView.getElementView(deploymentNode).getElement());
    assertSame(containerInstance, deploymentView.getElementView(containerInstance).getElement());

    assertSame(systemLandscapeView, filteredView.getView());
}