use of com.structurizr.Workspace in project java by structurizr.
the class ViewSetTests method test_copyLayoutInformationFrom_WhenAViewKeyHasBeenIntroduced.
@Test
public void test_copyLayoutInformationFrom_WhenAViewKeyHasBeenIntroduced() {
Workspace workspace1 = createWorkspace();
SoftwareSystem softwareSystem1 = workspace1.getModel().getSoftwareSystemWithName("Software System");
SystemContextView view1 = workspace1.getViews().createSystemContextView(softwareSystem1, "context", "Description");
// this simulates views created by previous versions of the client library
view1.setKey(null);
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_copyLayoutInformationFrom_CopiesThePaperSize_WhenThePaperSizeIsNotSet.
@Test
public void test_copyLayoutInformationFrom_CopiesThePaperSize_WhenThePaperSizeIsNotSet() {
Workspace workspace1 = createWorkspace();
SoftwareSystem softwareSystem1 = workspace1.getModel().getSoftwareSystemWithName("Software System");
SystemContextView view1 = workspace1.getViews().createSystemContextView(softwareSystem1, "context", "Description");
view1.setPaperSize(PaperSize.A3_Landscape);
Workspace workspace2 = createWorkspace();
SoftwareSystem softwareSystem2 = workspace2.getModel().getSoftwareSystemWithName("Software System");
SystemContextView view2 = workspace2.getViews().createSystemContextView(softwareSystem2, "context", "Description");
workspace2.getViews().copyLayoutInformationFrom(workspace1.getViews());
assertEquals(PaperSize.A3_Landscape, view2.getPaperSize());
}
use of com.structurizr.Workspace in project java by structurizr.
the class ViewSetTests method test_copyLayoutInformationFrom_DoesNothing_WhenMergeFromRemoteIsSetToFalse.
@Test
public void test_copyLayoutInformationFrom_DoesNothing_WhenMergeFromRemoteIsSetToFalse() {
Workspace workspace1 = createWorkspace();
SoftwareSystem softwareSystem1 = workspace1.getModel().getSoftwareSystemWithName("Software System");
SystemLandscapeView view1 = workspace1.getViews().createSystemLandscapeView("landscape", "Description");
view1.addAllElements();
view1.getElements().iterator().next().setX(100);
view1.setPaperSize(PaperSize.A3_Landscape);
Workspace workspace2 = createWorkspace();
SoftwareSystem softwareSystem2 = workspace2.getModel().getSoftwareSystemWithName("Software System");
SystemLandscapeView view2 = workspace2.getViews().createSystemLandscapeView("context", "Description");
view2.addAllElements();
view2.setMergeFromRemote(false);
workspace2.getViews().copyLayoutInformationFrom(workspace1.getViews());
assertEquals(0, view2.getElements().iterator().next().getX());
assertNull(view2.getPaperSize());
}
use of com.structurizr.Workspace in project java by structurizr.
the class ViewSetTests method test_copyLayoutInformationFrom_WhenTheComponentViewKeysMatch.
@Test
public void test_copyLayoutInformationFrom_WhenTheComponentViewKeysMatch() {
Workspace workspace1 = createWorkspace();
Container container1 = workspace1.getModel().getSoftwareSystemWithName("Software System").getContainerWithName("Container");
ComponentView view1 = workspace1.getViews().createComponentView(container1, "containers", "Description");
view1.addAllElements();
view1.getElements().iterator().next().setX(100);
view1.setPaperSize(PaperSize.A3_Landscape);
Workspace workspace2 = createWorkspace();
Container container2 = workspace2.getModel().getSoftwareSystemWithName("Software System").getContainerWithName("Container");
ComponentView view2 = workspace2.getViews().createComponentView(container2, "containers", "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_createComponentView_ThrowsAnException_WhenAnEmptyKeyIsSpecified.
@Test
public void test_createComponentView_ThrowsAnException_WhenAnEmptyKeyIsSpecified() {
try {
Workspace workspace = new Workspace("Name", "Description");
SoftwareSystem softwareSystem = workspace.getModel().addSoftwareSystem("Software System", "Description");
Container container = softwareSystem.addContainer("Container", "Description", "Technology");
workspace.getViews().createComponentView(container, " ", "Description");
fail();
} catch (IllegalArgumentException iae) {
assertEquals("A key must be specified.", iae.getMessage());
}
}
Aggregations