use of io.lumeer.api.model.Collection in project engine by Lumeer.
the class MorphiaCollectionDaoTest method testGetCollectionsByFulltextDifferentUser.
@Test
public void testGetCollectionsByFulltextDifferentUser() {
createCollection(CODE, NAME, ATTRIBUTES);
createCollection(CODE2, NAME_FULLTEXT, ATTRIBUTES);
createCollection(CODE3, NAME3, ATTRIBUTES);
SearchQuery searchQuery = SearchQuery.createBuilder(USER2).fulltext("fulltext").build();
List<Collection> collections = collectionDao.getCollections(searchQuery);
assertThat(collections).isEmpty();
}
use of io.lumeer.api.model.Collection in project engine by Lumeer.
the class CollectionFacadeIT method testUpdateCollectionAttributeAdd.
@Test
public void testUpdateCollectionAttributeAdd() {
Collection collection = createCollection(CODE);
assertThat(collection.getAttributes()).isEmpty();
JsonAttribute attribute = new JsonAttribute(ATTRIBUTE_NAME, ATTRIBUTE_FULLNAME, ATTRIBUTE_CONSTRAINTS, ATTRIBUTE_COUNT);
collectionFacade.updateCollectionAttribute(collection.getId(), ATTRIBUTE_FULLNAME, attribute);
collection = collectionDao.getCollectionByCode(CODE);
assertThat(collection).isNotNull();
assertThat(collection.getAttributes()).hasSize(1);
Attribute storedAttribute = collection.getAttributes().iterator().next();
SoftAssertions assertions = new SoftAssertions();
assertions.assertThat(storedAttribute.getName()).isEqualTo(ATTRIBUTE_NAME);
assertions.assertThat(storedAttribute.getFullName()).isEqualTo(ATTRIBUTE_FULLNAME);
assertions.assertThat(storedAttribute.getConstraints()).isEqualTo(ATTRIBUTE_CONSTRAINTS);
assertions.assertThat(storedAttribute.getUsageCount()).isEqualTo(ATTRIBUTE_COUNT);
assertions.assertAll();
}
use of io.lumeer.api.model.Collection in project engine by Lumeer.
the class ProjectServicePermissionsIT method testCreateCollectionInProjectNoRole.
@Test
public void testCreateCollectionInProjectNoRole() {
String projectCode = "testCreateCollectionInProjectNoRole_code1";
String projectName = "estCreateCollectionInProjectNoRole";
createProject(projectCode, projectName);
projectFacade.removeUserPermission(projectCode, userEmail);
String collectionName = "CollectionName";
String collectionCode = "ColCode";
Collection collection = new JsonCollection(collectionCode, collectionName, "a", "b", null);
Response response = client.target(TARGET_URI).path(PATH_PREFIX + projectCode + "/collections").request(MediaType.APPLICATION_JSON).buildPost(Entity.json(collection)).invoke();
assertThat(response.getStatusInfo()).isEqualTo(Response.Status.UNAUTHORIZED);
}
use of io.lumeer.api.model.Collection in project engine by Lumeer.
the class ProjectServicePermissionsIT method testCreateCollectionInProjectWriteRole.
@Test
public void testCreateCollectionInProjectWriteRole() {
String projectCode = "testCreateCollectionInProjectWriteRole_code1";
String projectName = "testCreateCollectionInProjectWriteRole";
createProject(projectCode, projectName);
String collectionName = "CollectionName";
String collectionCode = "ColCode2";
Collection collection = new JsonCollection(collectionCode, collectionName, "a", "b", null);
Response response = client.target(TARGET_URI).path(PATH_PREFIX + projectCode + "/collections").request(MediaType.APPLICATION_JSON).buildPost(Entity.json(collection)).invoke();
assertThat(response.getStatusInfo()).isEqualTo(Response.Status.OK);
}
use of io.lumeer.api.model.Collection in project engine by Lumeer.
the class SearchFacadeIT method testSearchCollectionsByCollectionIds.
@Test
public void testSearchCollectionsByCollectionIds() {
List<Collection> collections = searchFacade.searchCollections(new JsonQuery(new HashSet<>(Arrays.asList(collectionIds.get(0), collectionIds.get(2))), null, null));
assertThat(collections).extracting(Collection::getId).containsOnly(collectionIds.get(0), collectionIds.get(2));
collections = searchFacade.searchCollections(new JsonQuery(Collections.singleton(collectionIds.get(1)), null, null));
assertThat(collections).extracting(Collection::getId).containsOnly(collectionIds.get(1));
}
Aggregations