use of com.structurizr.Workspace in project java by structurizr.
the class ViewSetTests method test_copyLayoutInformationFrom_DoesNotDoAnythingIfThereIsNoDynamicViewToCopyInformationFrom.
@Test
public void test_copyLayoutInformationFrom_DoesNotDoAnythingIfThereIsNoDynamicViewToCopyInformationFrom() {
Workspace workspace1 = createWorkspace();
Workspace workspace2 = createWorkspace();
Person person2 = workspace2.getModel().getPersonWithName("Person");
SoftwareSystem softwareSystem2 = workspace2.getModel().getSoftwareSystemWithName("Software System");
DynamicView view2 = workspace2.getViews().createDynamicView("context", "Description");
view2.add(person2, softwareSystem2);
workspace2.getViews().copyLayoutInformationFrom(workspace1.getViews());
// default
assertEquals(0, view2.getElements().iterator().next().getX());
// default
assertNull(view2.getPaperSize());
}
use of com.structurizr.Workspace in project java by structurizr.
the class ViewSetTests method test_createCustomView.
@Test
public void test_createCustomView() {
Workspace workspace = new Workspace("Name", "Description");
CustomView customView = workspace.getViews().createCustomView("key", "Title", "Description");
assertEquals("key", customView.getKey());
assertEquals("Title", customView.getTitle());
assertEquals("Description", customView.getDescription());
assertEquals(1, workspace.getViews().getCustomViews().size());
}
use of com.structurizr.Workspace in project java by structurizr.
the class ViewSetTests method test_createDeploymentView.
@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());
}
use of com.structurizr.Workspace in project java by structurizr.
the class ViewSetTests method test_copyLayoutInformationFrom_WhenTheSystemContextViewKeysMatch.
@Test
public void test_copyLayoutInformationFrom_WhenTheSystemContextViewKeysMatch() {
Workspace workspace1 = createWorkspace();
SoftwareSystem softwareSystem1 = workspace1.getModel().getSoftwareSystemWithName("Software System");
SystemContextView view1 = workspace1.getViews().createSystemContextView(softwareSystem1, "context", "Description");
view1.addAllElements();
view1.getElements().iterator().next().setX(100);
view1.setPaperSize(PaperSize.A3_Landscape);
Workspace workspace2 = createWorkspace();
SoftwareSystem softwareSystem2 = workspace2.getModel().getSoftwareSystemWithName("Software System");
SystemContextView view2 = workspace2.getViews().createSystemContextView(softwareSystem2, "context", "Description");
view2.addAllElements();
workspace2.getViews().copyLayoutInformationFrom(workspace1.getViews());
assertEquals(100, view2.getElements().iterator().next().getX());
assertEquals(PaperSize.A3_Landscape, view2.getPaperSize());
}
use of com.structurizr.Workspace in project java by structurizr.
the class ViewSetTests method test_createSystemContextView_ThrowsAnException_WhenANullKeyIsSpecified.
@Test
public void test_createSystemContextView_ThrowsAnException_WhenANullKeyIsSpecified() {
try {
Workspace workspace = new Workspace("Name", "Description");
SoftwareSystem softwareSystem = workspace.getModel().addSoftwareSystem("Software System", "Description");
workspace.getViews().createSystemContextView(softwareSystem, null, "Description");
fail();
} catch (IllegalArgumentException iae) {
assertEquals("A key must be specified.", iae.getMessage());
}
}
Aggregations