Permalink
Browse files

more javadoc

  • Loading branch information...
Albert Zuendorf
Albert Zuendorf committed Apr 12, 2018
1 parent 480b0f6 commit f9bda196143ea864d605fc4c0ce6c4a05e30cae3
@@ -22,3 +22,4 @@ out/
coverage/
aStore/
*.lck
structurizr-38847-20180411215136.json
@@ -85,8 +85,9 @@ dependencies {
testImplementation "io.moquette:moquette-broker:0.10"
testImplementation 'org.slf4j:slf4j-simple:1.7.10'

testImplementation "com.structurizr:structurizr-client:1.0.0-RC5"
testImplementation "guru.nidi:graphviz-java:+"
implementation "com.structurizr:structurizr-client:1.0.0-RC5"
implementation "com.structurizr:structurizr-dot:1.0.0-RC5"
implementation "guru.nidi:graphviz-java:+"

if ( ! project.hasProperty('useLocalDependencies'))
{
@@ -0,0 +1,28 @@
<!DOCTYPE html>
<html>
<head><meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="style.css">
<link href="includes/diagramstyle.css" rel="stylesheet" type="text/css">

<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.2.1/Chart.bundle.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="includes/dagre.min.js"></script>
<script src="includes/drawer.js"></script>
<script src="includes/graph.js"></script>
<script src="includes/Chart.bundle.js"></script>
<style>
canvas{
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
}
</style>
</head>
<body>
<p>Storyboard <a href='.././src/test/java/org/sdmlib/test/doc/TestStructurizr.java' type='text/x-java'>StructurizrDiagrams</a></p>
<p>Capture some architecture information with structurizr</p>

</body>
</html>
@@ -30,5 +30,6 @@
<a href="GroupAccountYamlWithUserEncoding.html" target="Main">GroupAccountYamlWithUserEncoding</a><br>
<a href="JavaDocStoriesMikadoPlan.html" target="Main">JavaDocStoriesMikadoPlan</a><br>
<a href="GenJavaDocStory.html" target="Main">GenJavaDocStory</a><br>
<a href="StructurizrDiagrams.html" target="Main">StructurizrDiagrams</a><br>
</body>
</html>
BIN +15.7 KB example/ex4-1.png
Binary file not shown.
@@ -0,0 +1,84 @@
package org.sdmlib.test.doc;

import com.structurizr.Workspace;
import com.structurizr.api.StructurizrClient;
import com.structurizr.api.StructurizrClientException;
import com.structurizr.io.dot.DotWriter;
import com.structurizr.model.Model;
import com.structurizr.model.Person;
import com.structurizr.model.SoftwareSystem;
import com.structurizr.view.SystemContextView;
import com.structurizr.view.ViewSet;
import com.structurizr.io.WorkspaceReader;
import guru.nidi.graphviz.attribute.Color;
import guru.nidi.graphviz.attribute.Style;
import guru.nidi.graphviz.engine.Format;
import guru.nidi.graphviz.engine.Graphviz;
import guru.nidi.graphviz.model.MutableGraph;
import guru.nidi.graphviz.parse.Parser;
import org.junit.Test;
import org.sdmlib.storyboards.Storyboard;

import java.io.File;
import java.io.IOException;
import java.io.StringWriter;

public class TestStructurizr
{
/**
*
* <p>Storyboard <a href='.././src/test/java/org/sdmlib/test/doc/TestStructurizr.java' type='text/x-java'>StructurizrDiagrams</a></p>
* <p>Capture some architecture information with structurizr</p>
*/
@Test
public void testStructurizrDiagrams()
{
Storyboard story = new Storyboard().withDocDirName("doc/internal");

story.add("Capture some architecture information with structurizr");

Workspace workspace = new Workspace("Getting Started", "This is a model of my software system.");
Model model = workspace.getModel();

Person alice = model.addPerson("Alice", "Alice uses GroupAccount.");
Person bob = model.addPerson("Bob", "Alice uses GroupAccount.");
SoftwareSystem softwareSystem = model.addSoftwareSystem("GroupAccount", "Doing accounting for groups.");
alice.uses(softwareSystem, "uses");
bob.uses(softwareSystem, "uses");

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

// StructurizrClient structurizrClient = new StructurizrClient("11066b8b-930b-4de8-a5b8-164a6da0d2c9 ", "aeb9d278-a826-43b9-96f5-2c71d414b758");
// try
// {
// structurizrClient.putWorkspace( 38847, workspace);
// } catch (StructurizrClientException e)
// {
// e.printStackTrace();
// }

StringWriter stringWriter = new StringWriter();
DotWriter dotWriter = new DotWriter();
dotWriter.write(workspace, stringWriter);
System.out.println(stringWriter);

String dotText = stringWriter.toString();
int pos = dotText.indexOf("digraph");
dotText = dotText.substring(pos);

try
{
MutableGraph g = Parser.read(dotText);
Graphviz.fromGraph(g).width(600).render(Format.PNG).toFile(new File("doc/ex4-1.png"));
}
catch (IOException e)
{
e.printStackTrace();
}

story.dumpHTML();
}
}

0 comments on commit f9bda19

Please sign in to comment.