use of com.structurizr.Workspace in project java by structurizr.
the class DefaultLayoutMergeStrategyTests method test_copyLayoutInformation_WhenAnElementNameAndDescriptionAndIdHaveChangedAndDescriptionWasNull.
@Test
public void test_copyLayoutInformation_WhenAnElementNameAndDescriptionAndIdHaveChangedAndDescriptionWasNull() {
Workspace workspace1 = new Workspace("1", "");
SoftwareSystem softwareSystem1 = workspace1.getModel().addSoftwareSystem("Software System");
Container container1 = softwareSystem1.addContainer("Container");
container1.setDescription(null);
ContainerView view1 = workspace1.getViews().createContainerView(softwareSystem1, "key", "");
view1.add(container1);
view1.getElementView(container1).setX(123);
view1.getElementView(container1).setY(456);
Workspace workspace2 = new Workspace("2", "");
SoftwareSystem softwareSystem2 = workspace2.getModel().addSoftwareSystem("Software System");
// this element has ID 2
softwareSystem2.addContainer("Web Application", "Description", "");
Container container2 = softwareSystem2.addContainer("Database", "Description", "");
ContainerView view2 = workspace2.getViews().createContainerView(softwareSystem2, "key", "");
view2.add(container2);
DefaultLayoutMergeStrategy strategy = new DefaultLayoutMergeStrategy();
strategy.copyLayoutInformation(view1, view2);
assertEquals(0, view2.getElementView(container2).getX());
assertEquals(0, view2.getElementView(container2).getY());
}
use of com.structurizr.Workspace in project java by structurizr.
the class DefaultLayoutMergeStrategyTests method test_copyLayoutInformation_DoesNotThrowAnExceptionWhenAddingAnElementToAView.
@Test
public void test_copyLayoutInformation_DoesNotThrowAnExceptionWhenAddingAnElementToAView() {
Workspace workspace1 = new Workspace("1", "");
SoftwareSystem softwareSystem1A = workspace1.getModel().addSoftwareSystem("Software System A");
SoftwareSystem softwareSystem1B = workspace1.getModel().addSoftwareSystem("Software System B");
softwareSystem1A.uses(softwareSystem1B, "Uses");
SystemLandscapeView view1 = workspace1.getViews().createSystemLandscapeView("key", "description");
view1.add(softwareSystem1A);
Workspace workspace2 = new Workspace("2", "");
SoftwareSystem softwareSystem2A = workspace2.getModel().addSoftwareSystem("Software System A");
SoftwareSystem softwareSystem2B = workspace2.getModel().addSoftwareSystem("Software System B");
softwareSystem2A.uses(softwareSystem2B, "Uses");
SystemLandscapeView view2 = workspace2.getViews().createSystemLandscapeView("key", "description");
view2.add(softwareSystem2A);
view2.add(softwareSystem2B);
DefaultLayoutMergeStrategy strategy = new DefaultLayoutMergeStrategy();
strategy.copyLayoutInformation(view1, view2);
}
use of com.structurizr.Workspace in project java by structurizr.
the class StructurizrClientTests method test_putWorkspace_ThrowsAnException_WhenTheWorkspaceIdIsNotValid.
@Test
public void test_putWorkspace_ThrowsAnException_WhenTheWorkspaceIdIsNotValid() throws Exception {
try {
structurizrClient = new StructurizrClient("key", "secret");
structurizrClient.putWorkspace(0, new Workspace("Name", "Description"));
fail();
} catch (IllegalArgumentException iae) {
assertEquals("The workspace ID must be a positive integer.", iae.getMessage());
}
}
use of com.structurizr.Workspace in project java by structurizr.
the class ViewSetTests method test_createDynamicView.
@Test
public void test_createDynamicView() {
Workspace workspace = new Workspace("Name", "Description");
DynamicView dynamicView = workspace.getViews().createDynamicView("key", "Description");
assertEquals("key", dynamicView.getKey());
assertEquals("Description", dynamicView.getDescription());
assertNull(dynamicView.getSoftwareSystem());
assertNull(dynamicView.getElement());
}
use of com.structurizr.Workspace in project java by structurizr.
the class ViewSetTests method test_createSystemLandscapeView.
@Test
public void test_createSystemLandscapeView() {
Workspace workspace = new Workspace("Name", "Description");
SystemLandscapeView systemLandscapeView = workspace.getViews().createSystemLandscapeView("key", "Description");
assertEquals("key", systemLandscapeView.getKey());
assertEquals("Description", systemLandscapeView.getDescription());
}
Aggregations