use of com.structurizr.model.SoftwareSystem in project java by structurizr.
the class WorkspaceTests method test_countAndLogWarnings.
@Test
public void test_countAndLogWarnings() {
Workspace workspace = new Workspace("Name", "Description");
SoftwareSystem softwareSystem1 = workspace.getModel().addSoftwareSystem("Software System 1", null);
SoftwareSystem softwareSystem2 = workspace.getModel().addSoftwareSystem("Software System 2", " ");
Container container1 = softwareSystem1.addContainer("Name", "Description", null);
Container container2 = softwareSystem2.addContainer("Name", "Description", " ");
container1.uses(container2, null, null);
container2.uses(container1, " ", " ");
Component component1A = container1.addComponent("A", null, null);
Component component1B = container1.addComponent("B", "", "");
component1A.uses(component1B, null);
component1B.uses(component1A, "");
assertEquals(10, workspace.countAndLogWarnings());
}
use of com.structurizr.model.SoftwareSystem in project java by structurizr.
the class StructurizrClientIntegrationTests method test_putAndGetWorkspace_WithoutEncryption.
@Test
public void test_putAndGetWorkspace_WithoutEncryption() throws Exception {
Workspace workspace = new Workspace("Structurizr client library tests - without encryption", "A test workspace for the Structurizr client library");
SoftwareSystem softwareSystem = workspace.getModel().addSoftwareSystem("Software System", "Description");
Person person = workspace.getModel().addPerson("Person", "Description");
person.uses(softwareSystem, "Uses");
SystemContextView systemContextView = workspace.getViews().createSystemContextView(softwareSystem, "SystemContext", "Description");
systemContextView.addAllElements();
structurizrClient.putWorkspace(20081, workspace);
workspace = structurizrClient.getWorkspace(20081);
assertNotNull(workspace.getModel().getSoftwareSystemWithName("Software System"));
assertNotNull(workspace.getModel().getPersonWithName("Person"));
assertEquals(1, workspace.getModel().getRelationships().size());
assertEquals(1, workspace.getViews().getSystemContextViews().size());
// and check the archive version is readable
Workspace archivedWorkspace = new JsonReader().read(new FileReader(getArchivedWorkspace()));
assertEquals(20081, archivedWorkspace.getId());
assertEquals("Structurizr client library tests - without encryption", archivedWorkspace.getName());
assertEquals(1, archivedWorkspace.getModel().getSoftwareSystems().size());
assertEquals(1, workspaceArchiveLocation.listFiles().length);
}
use of com.structurizr.model.SoftwareSystem in project java by structurizr.
the class StructurizrClientIntegrationTests method test_putAndGetWorkspace_WithEncryption.
@Test
public void test_putAndGetWorkspace_WithEncryption() throws Exception {
structurizrClient.setEncryptionStrategy(new AesEncryptionStrategy("password"));
Workspace workspace = new Workspace("Structurizr client library tests - with encryption", "A test workspace for the Structurizr client library");
SoftwareSystem softwareSystem = workspace.getModel().addSoftwareSystem("Software System", "Description");
Person person = workspace.getModel().addPerson("Person", "Description");
person.uses(softwareSystem, "Uses");
SystemContextView systemContextView = workspace.getViews().createSystemContextView(softwareSystem, "SystemContext", "Description");
systemContextView.addAllElements();
structurizrClient.putWorkspace(20081, workspace);
workspace = structurizrClient.getWorkspace(20081);
assertNotNull(workspace.getModel().getSoftwareSystemWithName("Software System"));
assertNotNull(workspace.getModel().getPersonWithName("Person"));
assertEquals(1, workspace.getModel().getRelationships().size());
assertEquals(1, workspace.getViews().getSystemContextViews().size());
// and check the archive version is readable
EncryptedWorkspace archivedWorkspace = new EncryptedJsonReader().read(new FileReader(getArchivedWorkspace()));
assertEquals(20081, archivedWorkspace.getId());
assertEquals("Structurizr client library tests - with encryption", archivedWorkspace.getName());
assertTrue(archivedWorkspace.getEncryptionStrategy() instanceof AesEncryptionStrategy);
assertEquals(1, workspaceArchiveLocation.listFiles().length);
}
use of com.structurizr.model.SoftwareSystem in project java by structurizr.
the class StaticViewTests method test_addAnimationStep_ThrowsAnException_WhenElementsAreSpecifiedButNoneOfThemExistInTheView.
@Test
public void test_addAnimationStep_ThrowsAnException_WhenElementsAreSpecifiedButNoneOfThemExistInTheView() {
try {
SoftwareSystem element1 = model.addSoftwareSystem("Software System 1", "");
SystemLandscapeView view = workspace.getViews().createSystemLandscapeView("key", "Description");
view.addAnimation(element1);
fail();
} catch (IllegalArgumentException iae) {
assertEquals("None of the specified elements exist in this view.", iae.getMessage());
}
}
Aggregations