use of io.lumeer.api.model.LinkType in project engine by Lumeer.
the class MongoLinkTypeDaoTest method testUpdateLinkType.
@Test
public void testUpdateLinkType() {
LinkType linkType = prepareLinkType();
String id = linkTypeDao.createLinkType(linkType).getId();
LinkType updateLinkedType = prepareLinkType();
updateLinkedType.setName(NAME2);
updateLinkedType.setCollectionIds(Arrays.asList(COLLECTION_ID3, COLLECTION_ID4));
linkTypeDao.updateLinkType(id, updateLinkedType);
LinkType storedLinkType = linkTypeDao.getLinkType(id);
assertThat(storedLinkType).isNotNull();
assertThat(storedLinkType.getName()).isEqualTo(NAME2);
assertThat(storedLinkType.getAttributes()).isEqualTo(ATTRIBUTES);
assertThat(storedLinkType.getCollectionIds()).containsOnlyElementsOf(Arrays.asList(COLLECTION_ID3, COLLECTION_ID4));
}
use of io.lumeer.api.model.LinkType in project engine by Lumeer.
the class MongoLinkTypeDaoTest method testDeleteLinkType.
@Test
public void testDeleteLinkType() {
LinkType created = linkTypeDao.createLinkType(prepareLinkType());
assertThat(created.getId()).isNotNull();
linkTypeDao.deleteLinkType(created.getId());
assertThatThrownBy(() -> linkTypeDao.getLinkType(created.getId())).isInstanceOf(StorageException.class);
}
use of io.lumeer.api.model.LinkType in project engine by Lumeer.
the class MongoLinkTypeDaoTest method testGetLinkType.
@Test
public void testGetLinkType() {
String id = linkTypeDao.createLinkType(prepareLinkType()).getId();
LinkType linkType = linkTypeDao.getLinkType(id);
assertThat(linkType).isNotNull();
assertThat(linkType.getId()).isEqualTo(id);
}
use of io.lumeer.api.model.LinkType in project engine by Lumeer.
the class MongoLinkTypeDaoTest method testUpdateLinkTypeExistingName.
@Test
public void testUpdateLinkTypeExistingName() {
LinkType linkType = prepareLinkType();
linkTypeDao.createLinkType(linkType);
LinkType linkType2 = prepareLinkType();
linkType2.setName(NAME2);
String id = linkTypeDao.createLinkType(linkType2).getId();
linkType2.setName(NAME);
assertThat(linkTypeDao.updateLinkType(id, linkType2)).isNotNull();
}
use of io.lumeer.api.model.LinkType in project engine by Lumeer.
the class LinkInstanceFacadeIT method configureLinkInstances.
@Before
public void configureLinkInstances() {
JsonOrganization organization = new JsonOrganization();
organization.setCode(ORGANIZATION_CODE);
organization.setPermissions(new JsonPermissions());
Organization storedOrganization = organizationDao.createOrganization(organization);
projectDao.setOrganization(storedOrganization);
User user = new User(USER);
userDao.createUser(user);
JsonProject project = new JsonProject();
project.setPermissions(new JsonPermissions());
project.setCode(PROJECT_CODE);
Project storedProject = projectDao.createProject(project);
workspaceKeeper.setWorkspace(ORGANIZATION_CODE, PROJECT_CODE);
collectionDao.setProject(storedProject);
JsonPermissions collectionPermissions = new JsonPermissions();
collectionPermissions.updateUserPermissions(new JsonPermission(USER, Project.ROLES.stream().map(Role::toString).collect(Collectors.toSet())));
JsonCollection jsonCollection = new JsonCollection("col1", "col1", "icon", "color", collectionPermissions);
jsonCollection.setDocumentsCount(0);
String collection1 = collectionDao.createCollection(jsonCollection).getId();
JsonCollection jsonCollection2 = new JsonCollection("col2", "col2", "icon", "color", collectionPermissions);
jsonCollection.setDocumentsCount(0);
String collection2 = collectionDao.createCollection(jsonCollection2).getId();
LinkType linkType = new LinkType(null, NAME, Arrays.asList(collection1, collection2), ATTRIBUTES);
linkTypeId1 = linkTypeDao.createLinkType(linkType).getId();
LinkType linkType2 = new LinkType(null, NAME2, Arrays.asList(collection1, collection2), ATTRIBUTES);
linkTypeId2 = linkTypeDao.createLinkType(linkType2).getId();
documentIdsColl1.clear();
for (int i = 0; i < 3; i++) {
documentIdsColl1.add(createDocument(collection1).getId());
}
documentIdsColl2.clear();
for (int i = 0; i < 3; i++) {
documentIdsColl2.add(createDocument(collection2).getId());
}
}
Aggregations