use of com.structurizr.model.Person in project dsl by structurizr.
the class PersonParserTests method test_parse_CreatesAPersonWithADescription.
@Test
void test_parse_CreatesAPersonWithADescription() {
parser.parse(context(), tokens("person", "User", "Description"));
assertEquals(1, model.getElements().size());
Person user = model.getPersonWithName("User");
assertNotNull(user);
assertEquals("Description", user.getDescription());
assertEquals(Location.Unspecified, user.getLocation());
assertEquals("Element,Person", user.getTags());
}
use of com.structurizr.model.Person in project dsl by structurizr.
the class RefParserTests method test_parse_FindsAnElementByIdentifier.
@Test
void test_parse_FindsAnElementByIdentifier() {
Person user = workspace.getModel().addPerson("User");
ModelDslContext context = context();
IdentifiersRegister register = new IdentifiersRegister();
register.register("user", user);
context.setIdentifierRegister(register);
ModelItem modelItem = parser.parse(context, tokens("ref", "user"));
assertSame(modelItem, user);
}
use of com.structurizr.model.Person 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.Person 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);
}
Aggregations