use of com.structurizr.view.SystemContextView 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