diff --git a/datashare-app/src/main/java/org/icij/datashare/tasks/BatchSearchRunner.java b/datashare-app/src/main/java/org/icij/datashare/tasks/BatchSearchRunner.java index 9ad290651..5c0a196af 100644 --- a/datashare-app/src/main/java/org/icij/datashare/tasks/BatchSearchRunner.java +++ b/datashare-app/src/main/java/org/icij/datashare/tasks/BatchSearchRunner.java @@ -7,12 +7,11 @@ import org.icij.datashare.Entity; import org.icij.datashare.PropertiesProvider; import org.icij.datashare.batch.BatchSearch; - import org.icij.datashare.batch.SearchException; import org.icij.datashare.function.TerFunction; import org.icij.datashare.monitoring.Monitorable; import org.icij.datashare.text.Document; -import org.icij.datashare.text.Project; +import org.icij.datashare.text.ProjectProxy; import org.icij.datashare.text.indexing.Indexer; import org.icij.datashare.time.DatashareTime; import org.icij.datashare.user.User; @@ -21,18 +20,17 @@ import org.slf4j.LoggerFactory; import java.io.IOException; -import java.util.Collections; import java.util.List; import java.util.concurrent.Callable; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeoutException; -import java.util.stream.Collectors; import static java.lang.Integer.min; import static java.lang.Integer.parseInt; import static java.util.Arrays.stream; import static java.util.stream.Collectors.toList; import static org.icij.datashare.cli.DatashareCliOptions.*; +import static org.icij.datashare.text.ProjectProxy.asCommaConcatNames; public class BatchSearchRunner implements Callable, Monitorable, UserTask { private final Logger logger = LoggerFactory.getLogger(getClass()); @@ -80,14 +78,14 @@ public Integer call() throws SearchException { callThread = Thread.currentThread(); callWaiterLatch.countDown(); // for tests logger.info("running {} queries for batch search {} on projects {} with throttle {}ms and scroll size of {}", - batchSearch.queries.size(), batchSearch.uuid, batchSearch.projects.stream().map(Project::getId).collect(Collectors.joining(", ")) + batchSearch.queries.size(), batchSearch.uuid, asCommaConcatNames(batchSearch.projects) , throttleMs, scrollSize); String query = null; try { for (String s : batchSearch.queries.keySet()) { query = s; - Indexer.Searcher searcher = indexer.search(batchSearch.projects.stream().map(Project::getId).collect(toList()), Document.class). + Indexer.Searcher searcher = indexer.search(batchSearch.projects.stream().map(ProjectProxy::getId).collect(toList()), Document.class). with(query, batchSearch.fuzziness, batchSearch.phraseMatches). withFieldValues("contentType", batchSearch.fileTypes.toArray(new String[]{})). withFieldValues("tags", batchSearch.tags.toArray(new String[]{})). diff --git a/datashare-app/src/main/java/org/icij/datashare/web/BatchSearchResource.java b/datashare-app/src/main/java/org/icij/datashare/web/BatchSearchResource.java index 130669b42..898bb9e60 100644 --- a/datashare-app/src/main/java/org/icij/datashare/web/BatchSearchResource.java +++ b/datashare-app/src/main/java/org/icij/datashare/web/BatchSearchResource.java @@ -23,10 +23,10 @@ import org.icij.datashare.db.JooqBatchSearchRepository; import org.icij.datashare.session.DatashareUser; import org.icij.datashare.text.Project; +import org.icij.datashare.text.ProjectProxy; import org.icij.datashare.user.User; import org.icij.datashare.utils.PayloadFormatter; -import java.io.File; import java.io.IOException; import java.nio.file.Path; import java.util.*; @@ -324,8 +324,8 @@ public Payload deleteSearches(Context context) { return new Payload(204); } - private String docUrl(String uri, List projects, String documentId, String rootId) { - return format("%s/#/d/%s/%s/%s", uri, projects.stream().map(Project::getId).collect(Collectors.joining(",")), documentId, rootId); + private String docUrl(String uri, List projects, String documentId, String rootId) { + return format("%s/#/d/%s/%s/%s", uri, projects.stream().map(ProjectProxy::getId).collect(Collectors.joining(",")), documentId, rootId); } private String dirname(Path path) { diff --git a/datashare-app/src/main/java/org/icij/datashare/web/ProjectResource.java b/datashare-app/src/main/java/org/icij/datashare/web/ProjectResource.java index bb95c9fe6..e71e10435 100644 --- a/datashare-app/src/main/java/org/icij/datashare/web/ProjectResource.java +++ b/datashare-app/src/main/java/org/icij/datashare/web/ProjectResource.java @@ -20,8 +20,8 @@ import org.icij.datashare.tasks.DocumentCollectionFactory; import org.icij.datashare.text.Project; import org.icij.datashare.text.indexing.Indexer; - import org.icij.datashare.utils.IndexAccessVerifier; import org.icij.datashare.utils.DataDirVerifier; + import org.icij.datashare.utils.IndexAccessVerifier; import org.icij.datashare.utils.ModeVerifier; import org.icij.datashare.utils.PayloadFormatter; import org.icij.extract.queue.DocumentQueue; @@ -30,7 +30,8 @@ import org.slf4j.LoggerFactory; import java.io.IOException; - import java.util.*; + import java.util.List; + import java.util.Objects; import static net.codestory.http.errors.NotFoundException.notFoundIfNull; import static net.codestory.http.payload.Payload.ok; @@ -58,12 +59,12 @@ public ProjectResource(Repository repository, Indexer indexer, PropertiesProvide this.documentCollectionFactory = documentCollectionFactory; } - String[] getUserProjectIds(DatashareUser user) { - return user.getProjectNames().toArray(String[]::new); + List getUserProjectIds(DatashareUser user) { + return user.getProjectNames(); } List getUserProjects(DatashareUser user) { - String[] projectIds = this.getUserProjectIds(user); + List projectIds = this.getUserProjectIds(user); return repository.getProjects(projectIds); } @@ -193,12 +194,16 @@ public Project getProject(String id, Context context) { @ApiResponse(responseCode = "403", description = "if project download is not allowed") @Get("/isDownloadAllowed/:id") public Payload isDownloadAllowed(String id, Context context) { - List projects = ((DatashareUser) context.currentUser()).getProjectNames(); - String projectId = projects.stream() + List projectIds = ((DatashareUser) context.currentUser()).getProjectNames(); + String retrievedProjectId = projectIds.stream() .filter(i -> i.equals(id)) .findAny() .orElse(null); - Project project = repository.getProject(projectId); + + if (retrievedProjectId == null){ + return ok(); // unknown is allowed + } + Project project = repository.getProject(retrievedProjectId); if (project != null && !isAllowed(project, context.request().clientAddress())) { return PayloadFormatter.error("Download not allowed", HttpStatus.FORBIDDEN); diff --git a/datashare-app/src/main/java/org/icij/datashare/web/RootResource.java b/datashare-app/src/main/java/org/icij/datashare/web/RootResource.java index 0f1353242..6e9ad6be7 100644 --- a/datashare-app/src/main/java/org/icij/datashare/web/RootResource.java +++ b/datashare-app/src/main/java/org/icij/datashare/web/RootResource.java @@ -51,11 +51,11 @@ public String getRoot(Context context) throws IOException { } else { content = new String(Files.readAllBytes(index), Charset.defaultCharset()); } - List projects = context.currentUser() == null ? new LinkedList<>() : ((DatashareUser)context.currentUser()).getProjectNames(); + List projectNames = context.currentUser() == null ? new LinkedList<>() : ((DatashareUser)context.currentUser()).getProjectNames(); if (propertiesProvider.get(PLUGINS_DIR).isPresent()) { ExtensionService extensionService = propertiesProvider.get(EXTENSIONS_DIR).isPresent() ? new ExtensionService(propertiesProvider): null; return new PluginService(propertiesProvider, extensionService) - .addPlugins(content, projects); + .addPlugins(content, projectNames); } return content; } diff --git a/datashare-app/src/main/java/org/icij/datashare/web/UserResource.java b/datashare-app/src/main/java/org/icij/datashare/web/UserResource.java index 667ed9d40..8fe099cb2 100644 --- a/datashare-app/src/main/java/org/icij/datashare/web/UserResource.java +++ b/datashare-app/src/main/java/org/icij/datashare/web/UserResource.java @@ -39,13 +39,11 @@ public class UserResource { private List getDatashareUserProjects (DatashareUser datashareUser) { List projectNames = datashareUser.getProjectNames(); List projects = datashareUser.getProjects(); - List repositoryProjects = repository.getProjects(projectNames.toArray(new String[0])); - return projects.stream().map(project -> { - return repositoryProjects.stream() - .filter(p -> p.name.equals(project.name)) - .findFirst() - .orElse(project); - }).collect(Collectors.toList()); + List repositoryProjects = repository.getProjects(projectNames); + return projects.stream().map(project -> repositoryProjects.stream() + .filter(p -> p.name.equals(project.name)) + .findFirst() + .orElse(project)).collect(Collectors.toList()); } @Inject diff --git a/datashare-app/src/test/java/org/icij/datashare/session/YesCookieAuthFilterTest.java b/datashare-app/src/test/java/org/icij/datashare/session/YesCookieAuthFilterTest.java index 832fc0572..98c51b690 100644 --- a/datashare-app/src/test/java/org/icij/datashare/session/YesCookieAuthFilterTest.java +++ b/datashare-app/src/test/java/org/icij/datashare/session/YesCookieAuthFilterTest.java @@ -13,7 +13,6 @@ import org.mockito.Mock; import java.util.ArrayList; -import java.util.Collections; import java.util.List; import java.util.Map; diff --git a/datashare-app/src/test/java/org/icij/datashare/web/BatchSearchResourceTest.java b/datashare-app/src/test/java/org/icij/datashare/web/BatchSearchResourceTest.java index 5233846e5..6f6a8be2a 100644 --- a/datashare-app/src/test/java/org/icij/datashare/web/BatchSearchResourceTest.java +++ b/datashare-app/src/test/java/org/icij/datashare/web/BatchSearchResourceTest.java @@ -29,6 +29,7 @@ import static org.fest.assertions.Assertions.assertThat; import static org.icij.datashare.CollectionUtils.asSet; import static org.icij.datashare.text.Project.project; +import static org.icij.datashare.text.ProjectProxy.proxy; import static org.mockito.Matchers.any; import static org.mockito.Matchers.eq; import static org.mockito.Mockito.verify; @@ -223,7 +224,7 @@ public void test_get_batch_searches_json() { @Test public void test_get_batch_searches_records_json_paginated() { - List batchSearches = IntStream.range(0, 10).mapToObj(i -> new BatchSearchRecord(singletonList(project("local-datashare")), "name" + i, "description" + i, 2, new Date())).collect(toList()); + List batchSearches = IntStream.range(0, 10).mapToObj(i -> new BatchSearchRecord(singletonList(proxy("local-datashare")), "name" + i, "description" + i, 2, new Date())).collect(toList()); when(batchSearchRepository.getRecords(User.local(), singletonList("local-datashare"), WebQueryBuilder.createWebQuery().queryAll().withRange(0,2).build())).thenReturn(batchSearches.subList(0, 2)); when(batchSearchRepository.getTotal(User.local(), singletonList("local-datashare"), WebQueryBuilder.createWebQuery().queryAll().withRange(0,2).build())).thenReturn(batchSearches.size()); when(batchSearchRepository.getRecords(User.local(), singletonList("local-datashare"),WebQueryBuilder.createWebQuery().queryAll().withRange(4,3).build())).thenReturn(batchSearches.subList(5, 8)); diff --git a/datashare-db/src/main/java/org/icij/datashare/db/JooqBatchSearchRepository.java b/datashare-db/src/main/java/org/icij/datashare/db/JooqBatchSearchRepository.java index 45685e6d4..ee2872fea 100644 --- a/datashare-db/src/main/java/org/icij/datashare/db/JooqBatchSearchRepository.java +++ b/datashare-db/src/main/java/org/icij/datashare/db/JooqBatchSearchRepository.java @@ -6,7 +6,7 @@ import org.icij.datashare.db.tables.records.BatchSearchQueryRecord; import org.icij.datashare.db.tables.records.BatchSearchResultRecord; import org.icij.datashare.text.Document; -import org.icij.datashare.text.Project; +import org.icij.datashare.text.ProjectProxy; import org.icij.datashare.user.User; import org.jooq.*; import org.jooq.impl.DSL; @@ -30,7 +30,8 @@ import static org.icij.datashare.db.tables.BatchSearch.BATCH_SEARCH; import static org.icij.datashare.db.tables.BatchSearchQuery.BATCH_SEARCH_QUERY; import static org.icij.datashare.db.tables.BatchSearchResult.BATCH_SEARCH_RESULT; -import static org.icij.datashare.text.Project.project; +import static org.icij.datashare.text.ProjectProxy.asNameList; +import static org.icij.datashare.text.ProjectProxy.proxy; import static org.jooq.impl.DSL.*; public class JooqBatchSearchRepository implements BatchSearchRepository { @@ -185,12 +186,12 @@ public List getRecords(User user, List projectsIds) { @Override public List getRecords(User user, List projectsIds, WebQuery webQuery) { - try(DSLContext context = DSL.using(dataSource, dialect)) { + try(DSLContext context = using(dataSource, dialect)) { cacheNbQueries(webQuery, context); SelectConditionStep> query = createBatchSearchRecordWithQueriesSelectStatement(context) .where(BATCH_SEARCH.USER_ID.eq(user.id).or(BATCH_SEARCH.PUBLISHED.greaterThan(0))); - List filteredProjects = webQuery.hasFilteredProjects() ? webQuery.project : projectsIds; + List filteredProjects = webQuery.hasFilteredProjects() ? asNameList(webQuery.project) : projectsIds; addFilterToSelectCondition(webQuery, query); if (webQuery.isSorted()) { query.orderBy(field(webQuery.sort + " " + webQuery.order)); @@ -435,7 +436,7 @@ private BatchSearch createBatchSearchFrom(final Record record) { Integer nb_queries = query_results == null ? 0: query_results; boolean phraseMatches= record.get(BATCH_SEARCH.PHRASE_MATCHES) != 0; return new BatchSearch(record.get(BATCH_SEARCH.UUID).trim(), - singletonList(project(record.get(BATCH_SEARCH_PROJECT.PRJ_ID))), + singletonList(proxy(record.get(BATCH_SEARCH_PROJECT.PRJ_ID))), record.getValue(BATCH_SEARCH.NAME), record.getValue(BATCH_SEARCH.DESCRIPTION), new LinkedHashMap<>() {{ @@ -456,14 +457,13 @@ private BatchSearch createBatchSearchFrom(final Record record) { } private BatchSearch createBatchSearchWithoutQueries(final Record record) { - Integer nb_queries = record.get("nb_queries", Integer.class); String projects = (String) record.get("projects"); boolean phraseMatches= record.get(BATCH_SEARCH.PHRASE_MATCHES) != 0; return new BatchSearch(record.get(BATCH_SEARCH.UUID).trim(), getProjects(projects), record.getValue(BATCH_SEARCH.NAME), record.getValue(BATCH_SEARCH.DESCRIPTION), - nb_queries, + record.get(BATCH_SEARCH.NB_QUERIES), Date.from(record.get(BATCH_SEARCH.BATCH_DATE).toInstant()), State.valueOf(record.get(BATCH_SEARCH.STATE)), new User(record.get(BATCH_SEARCH.USER_ID)), @@ -500,8 +500,8 @@ private BatchSearchRecord createBatchSearchRecordFrom(final Record record) { batchSearch.getErrorQuery()); } - private static List getProjects(String prj) { - return prj == null || prj.isEmpty() ? null : stream(prj.split(LIST_SEPARATOR)).sorted().map(Project::project).collect(toList()); + private static List getProjects(String prj) { + return prj == null || prj.isEmpty() ? null : stream(prj.split(LIST_SEPARATOR)).sorted().map(ProjectProxy::new).collect(toList()); } private SearchResult createSearchResult(final User actualUser, final Record record) { @@ -513,7 +513,7 @@ private SearchResult createSearchResult(final User actualUser, final Record reco } Timestamp creationDate = record.get(BATCH_SEARCH_RESULT.CREATION_DATE); return new SearchResult(record.get(BATCH_SEARCH_RESULT.QUERY), - prj == null || prj.isEmpty() ? null : project(prj), + prj == null || prj.isEmpty() ? null : proxy(prj), record.get(BATCH_SEARCH_RESULT.DOC_ID), record.getValue(BATCH_SEARCH_RESULT.ROOT_ID), Paths.get(record.getValue(BATCH_SEARCH_RESULT.DOC_PATH)), diff --git a/datashare-db/src/main/java/org/icij/datashare/db/JooqRepository.java b/datashare-db/src/main/java/org/icij/datashare/db/JooqRepository.java index 6f5cfd61a..f1dc4bd46 100644 --- a/datashare-db/src/main/java/org/icij/datashare/db/JooqRepository.java +++ b/datashare-db/src/main/java/org/icij/datashare/db/JooqRepository.java @@ -374,7 +374,7 @@ public List getProjects() { } @Override - public List getProjects(String[] projectIds) { + public List getProjects(List projectIds) { return DSL.using(connectionProvider, dialect).selectFrom(PROJECT). where(PROJECT.ID.in(projectIds)). stream().map(this::createProjectFrom).collect(toList()); @@ -402,6 +402,8 @@ public boolean save(Note note) { @Override public boolean save(Project project) { + Timestamp projectCreationDate = project.creationDate == null ? null: new Timestamp(project.creationDate.getTime()); + Timestamp projectUpdateDate = project.updateDate == null ? null: new Timestamp(project.updateDate.getTime()); return DSL.using(connectionProvider, dialect). insertInto( PROJECT, PROJECT.ID, PROJECT.LABEL, PROJECT.DESCRIPTION, PROJECT.PATH, PROJECT.SOURCE_URL, @@ -412,7 +414,7 @@ public boolean save(Project project) { project.name, project.label, project.description, project.sourcePath.toString(), project.sourceUrl, project.maintainerName, project.publisherName, project.logoUrl, project.allowFromMask, - new Timestamp(project.creationDate.getTime()), new Timestamp(project.updateDate.getTime())). + projectCreationDate, projectUpdateDate). onConflict(PROJECT.ID). doUpdate(). set(PROJECT.LABEL, project.label). @@ -422,7 +424,7 @@ public boolean save(Project project) { set(PROJECT.PUBLISHER_NAME, project.publisherName). set(PROJECT.LOGO_URL, project.logoUrl). set(PROJECT.ALLOW_FROM_MASK, project.allowFromMask). - set(PROJECT.UPDATE_DATE, new Timestamp(project.updateDate.getTime())). + set(PROJECT.UPDATE_DATE, projectUpdateDate). execute() > 0; } @@ -499,6 +501,9 @@ private Project createProjectFrom(ProjectRecord record) { if (record == null) { return null; } + Timestamp projectCreationDate = record.getCreationDate() == null ? null: new Timestamp(record.getCreationDate().getTime()); + Timestamp projectUpdateDate = record.getUpdateDate() == null ? null: new Timestamp(record.getCreationDate().getTime()); + return new Project(record.getId(), record.getLabel(), record.getDescription(), @@ -508,8 +513,8 @@ private Project createProjectFrom(ProjectRecord record) { record.getPublisherName(), record.getLogoUrl(), record.getAllowFromMask(), - new Timestamp(record.getCreationDate().getTime()), - new Timestamp(record.getUpdateDate().getTime())); + projectCreationDate, + projectUpdateDate); } private NamedEntity createFrom(NamedEntityRecord record) { diff --git a/datashare-db/src/test/java/org/icij/datashare/db/JooqBatchSearchRepositoryTest.java b/datashare-db/src/test/java/org/icij/datashare/db/JooqBatchSearchRepositoryTest.java index b60b332b3..681ee193e 100644 --- a/datashare-db/src/test/java/org/icij/datashare/db/JooqBatchSearchRepositoryTest.java +++ b/datashare-db/src/test/java/org/icij/datashare/db/JooqBatchSearchRepositoryTest.java @@ -4,7 +4,7 @@ import org.icij.datashare.batch.BatchSearchRecord.State; import org.icij.datashare.test.DatashareTimeRule; import org.icij.datashare.text.Document; -import org.icij.datashare.text.Project; +import org.icij.datashare.text.ProjectProxy; import org.icij.datashare.time.DatashareTime; import org.icij.datashare.user.User; import org.jooq.exception.DataAccessException; @@ -24,7 +24,7 @@ import static org.fest.assertions.MapAssert.entry; import static org.icij.datashare.CollectionUtils.asSet; import static org.icij.datashare.text.DocumentBuilder.createDoc; -import static org.icij.datashare.text.Project.project; +import static org.icij.datashare.text.ProjectProxy.proxy; @RunWith(Parameterized.class) public class JooqBatchSearchRepositoryTest { @@ -48,7 +48,7 @@ public JooqBatchSearchRepositoryTest(DbSetupRule rule) { @Test public void test_save_and_get_batch_search() { - BatchSearch batchSearch = new BatchSearch(asList(project("prj1"), project("prj2")), "name1", "description1", + BatchSearch batchSearch = new BatchSearch(asList(proxy("prj1"), proxy("prj2")), "name1", "description1", asSet("q1", "q2"), User.local(), true, asList("application/json", "image/jpeg"), singletonList("tag"), asList("/path/to/docs", "/path/to/pdfs"), 3,true); @@ -73,7 +73,7 @@ public void test_save_and_get_batch_search() { @Test public void test_get_batch_search_by_user_with_projects_without_queries() { - BatchSearch batchSearch = new BatchSearch(asList(project("prj1"), project("prj2")), "name1", "description1", + BatchSearch batchSearch = new BatchSearch(asList(proxy("prj1"), proxy("prj2")), "name1", "description1", asSet("q1", "q2"), User.local(), true, asList("application/json", "image/jpeg"), singletonList("tag"), asList("/path/to/docs", "/path/to/pdfs"), 3,true); @@ -85,7 +85,7 @@ public void test_get_batch_search_by_user_with_projects_without_queries() { @Test public void test_get_batch_search_by_user_with_projects_with_queries() { - BatchSearch batchSearch = new BatchSearch(asList(project("prj1"), project("prj2")), "name1", "description1", + BatchSearch batchSearch = new BatchSearch(asList(proxy("prj1"), proxy("prj2")), "name1", "description1", asSet("q1", "q2"), User.local(), true, asList("application/json", "image/jpeg"), singletonList("tag"), asList("/path/to/docs", "/path/to/pdfs"), 3,true); @@ -97,10 +97,10 @@ public void test_get_batch_search_by_user_with_projects_with_queries() { @Test public void test_get_records_filter_by_project() { - BatchSearch batchSearch1 = new BatchSearch(singletonList(project("prj1")), "name1", "description1", + BatchSearch batchSearch1 = new BatchSearch(singletonList(proxy("prj1")), "name1", "description1", asSet("q1", "q2"), User.local(), true, asList("application/json", "image/jpeg"), singletonList("tag"), asList("/path/to/docs", "/path/to/pdfs"), 3,true); - BatchSearch batchSearch2 = new BatchSearch(singletonList(project("prj2")), "name2", "description2", + BatchSearch batchSearch2 = new BatchSearch(singletonList(proxy("prj2")), "name2", "description2", asSet("q3", "q4"), new Date(new Date().getTime() + 1000000000)); repository.save(batchSearch1); @@ -112,10 +112,10 @@ public void test_get_records_filter_by_project() { @Test public void test_get_total_filter_by_project() { - BatchSearch batchSearch1 = new BatchSearch(asList(project("prj1"), project("prj2")), "name1", "description1", - asSet("q1", "q2"), User.local(), true, asList("application/json", "image/jpeg"), singletonList("tag"), + BatchSearch batchSearch1 = new BatchSearch(asList(proxy("prj1"), proxy("prj2")), "name1", "description1", + asSet("q1", "q2"), User.local(), true, asList("application/json", "image/jpeg"), singletonList("tag"), asList("/path/to/docs", "/path/to/pdfs"), 3,true); - BatchSearch batchSearch2 = new BatchSearch(singletonList(project("prj2")), "name2", "description2", + BatchSearch batchSearch2 = new BatchSearch(singletonList(proxy("prj2")), "name2", "description2", asSet("q3", "q4"), User.local(), true); repository.save(batchSearch1); @@ -130,7 +130,7 @@ public void test_get_total_filter_by_project() { @Test public void test_get_records() { - BatchSearch batchSearch = new BatchSearch(singletonList(project("prj")),"name","description",asSet("q1", "q2"), User.local(), + BatchSearch batchSearch = new BatchSearch(singletonList(proxy("prj")),"name","description",asSet("q1", "q2"), User.local(), true,asList("application/json", "image/jpeg"), singletonList("tag"), asList("/path/to/docs", "/path/to/pdfs"), 3,true); repository.save(batchSearch); @@ -151,7 +151,7 @@ public void test_get_records() { @Test public void test_get_records_with_multiple_project_intersection() { - BatchSearch batchSearch = new BatchSearch(asList(project("prj1"), project("prj2")),"name","description",asSet("q1", "q2"), User.local(), + BatchSearch batchSearch = new BatchSearch(asList(proxy("prj1"), proxy("prj2")),"name","description",asSet("q1", "q2"), User.local(), true,asList("application/json", "image/jpeg"), singletonList("tag"), asList("/path/to/docs", "/path/to/pdfs"), 3,true); repository.save(batchSearch); @@ -163,22 +163,22 @@ public void test_get_records_with_multiple_project_intersection() { @Test public void test_get_records_with_query_and_field() { - BatchSearch batchSearch1 = new BatchSearch(singletonList(project("prj")),"foo","baz",asSet("q1", "q2"), User.local(), + BatchSearch batchSearch1 = new BatchSearch(singletonList(proxy("prj")),"foo","baz",asSet("q1", "q2"), User.local(), false,asList("application/json", "image/jpeg"), singletonList("tag"), asList("/path/to/docs", "/path/to/pdfs"), 3,true); - BatchSearch batchSearch2 = new BatchSearch(singletonList(project("anotherPrj")),"bar","baz",asSet("q3", "q2"), User.local(), + BatchSearch batchSearch2 = new BatchSearch(singletonList(proxy("anotherPrj")),"bar","baz",asSet("q3", "q2"), User.local(), true,asList("application/json", "image/jpeg"), null, asList("/path/to/docs", "/path/to/pdfs"), 3,true); - BatchSearch batchSearch3 = new BatchSearch(singletonList(project("otherPrj")),"bar","baz",asSet("q4", "q1"), User.local(), + BatchSearch batchSearch3 = new BatchSearch(singletonList(proxy("otherPrj")),"bar","baz",asSet("q4", "q1"), User.local(), true,asList("application/json", "image/jpeg"), null, asList("/path/to/docs", "/path/to/pdfs"), 3,true); long currentDateTime = new Date().getTime(); - BatchSearch batchSearch4 = new BatchSearch(asList(project("prj"),project("anotherPrj")),"qux","baz",asSet("q1", "q3"), new Date(currentDateTime + 50), State.SUCCESS, true); + BatchSearch batchSearch4 = new BatchSearch(asList(proxy("prj"),proxy("anotherPrj")),"qux","baz",asSet("q1", "q3"), new Date(currentDateTime + 50), State.SUCCESS, true); repository.save(batchSearch1); repository.save(batchSearch2); repository.save(batchSearch3); repository.save(batchSearch4); - assertThat(repository.getRecords(User.local(), asList("prj", "otherPrj", "anotherPrj"), WebQueryBuilder.createWebQuery("*","all").build())).hasSize(4); assertThat(repository.getRecords(User.local(), asList("prj", "otherPrj", "anotherPrj"), WebQueryBuilder.createWebQuery("foo","all").build())).hasSize(1); assertThat(repository.getRecords(User.local(), asList("prj", "otherPrj", "anotherPrj"), WebQueryBuilder.createWebQuery("oo","all").build())).hasSize(1); + assertThat(repository.getRecords(User.local(), asList("prj", "otherPrj", "anotherPrj"), WebQueryBuilder.createWebQuery("*","all").build())).hasSize(4); assertThat(repository.getRecords(User.local(), asList("prj", "otherPrj", "anotherPrj"), WebQueryBuilder.createWebQuery("baz","description").build())).hasSize(4); assertThat(repository.getRecords(User.local(), asList("prj", "otherPrj", "anotherPrj"), WebQueryBuilder.createWebQuery("baz","name").build())).hasSize(0); assertThat(repository.getRecords(User.local(), asList("prj", "otherPrj", "anotherPrj"), WebQueryBuilder.createWebQuery("","all").build())); @@ -198,10 +198,10 @@ public void test_get_records_with_query_and_field() { @Test public void test_get_records_with_query() { - IntStream.range(0, 5).mapToObj(i -> new BatchSearch(singletonList(project("prj1")), "name" + i, "description" + i, asSet("q1/" + i, "q2/" + i), User.local(), + IntStream.range(0, 5).mapToObj(i -> new BatchSearch(singletonList(proxy("prj1")), "name" + i, "description" + i, asSet("q1/" + i, "q2/" + i), User.local(), true, asList("application/json", "image/jpeg"), singletonList("tag"), asList("/path/to/docs", "/path/to/pdfs"), 3, true)). forEach(bs -> { - repository.save(bs); + boolean saved = repository.save(bs); DatashareTime.getInstance().addMilliseconds(1000); } ); @@ -217,11 +217,11 @@ true, asList("application/json", "image/jpeg"), singletonList("tag"), asList("/p } @Test public void test_records_filtered_by_content_type(){ - BatchSearch batchSearch1 = new BatchSearch(singletonList(project("prj1")),"foo","baz",asSet("q1", "q2"), User.local(), + BatchSearch batchSearch1 = new BatchSearch(singletonList(proxy("prj1")),"foo","baz",asSet("q1", "q2"), User.local(), false,asList("application/json", "application/text"),null, asList("/path/to/docs", "/path/to/pdfs"), 3,true); - BatchSearch batchSearch2 = new BatchSearch(singletonList(project("prj1")),"bar","baz",asSet("q3", "q2"), User.local(), + BatchSearch batchSearch2 = new BatchSearch(singletonList(proxy("prj1")),"bar","baz",asSet("q3", "q2"), User.local(), true,asList("application/json"), null,asList("/path/to/docs", "/path/to/pdfs"), 3,true); - BatchSearch batchSearch3 = new BatchSearch(asList(project("prj1")),"bar","baz",asSet("q3", "q2"), User.local(), + BatchSearch batchSearch3 = new BatchSearch(asList(proxy("prj1")),"bar","baz",asSet("q3", "q2"), User.local(), true,null, null,asList("/path/to/docs", "/path/to/pdfs"), 3,true); repository.save(batchSearch1); repository.save(batchSearch2); @@ -232,8 +232,8 @@ public void test_records_filtered_by_content_type(){ @Test public void test_get_queued_searches() { - repository.save(new BatchSearch(singletonList(project("prj")), "name1", "description1", asSet("q1", "q2"), new Date())); - repository.save(new BatchSearch(singletonList(project("prj")), "name2", "description2", asSet("q3", "q4"), new Date())); + repository.save(new BatchSearch(singletonList(proxy("prj")), "name1", "description1", asSet("q1", "q2"), new Date())); + repository.save(new BatchSearch(singletonList(proxy("prj")), "name2", "description2", asSet("q3", "q4"), new Date())); assertThat(repository.getQueued()).hasSize(2); } @@ -241,7 +241,7 @@ public void test_get_queued_searches() { @Test public void test_get_queued_searches_without_running_state() { - repository.save(new BatchSearch("uuid", singletonList(project("prj")), "name1", "description1", + repository.save(new BatchSearch("uuid", singletonList(proxy("prj")), "name1", "description1", asSet("q1", "q2"), new Date(), State.RUNNING, User.local())); assertThat(repository.getQueued()).hasSize(0); @@ -249,7 +249,7 @@ public void test_get_queued_searches_without_running_state() { @Test public void test_get_search_by_id() { - BatchSearch expected = new BatchSearch("uuid", singletonList(project("prj")), "name1", "description1", + BatchSearch expected = new BatchSearch("uuid", singletonList(proxy("prj")), "name1", "description1", asSet("q1", "q2"), new Date(), State.RUNNING, User.local()); repository.save(expected); @@ -266,7 +266,7 @@ public void test_get_search_by_id_not_found() { @Test public void test_get_queued_searches_without_success_state() { - repository.save(new BatchSearch("uuid", singletonList(project("prj")), "name1", "description1", + repository.save(new BatchSearch("uuid", singletonList(proxy("prj")), "name1", "description1", asSet("q1", "q2"), new Date(), State.SUCCESS, User.local())); assertThat(repository.getQueued()).hasSize(0); @@ -274,7 +274,7 @@ public void test_get_queued_searches_without_success_state() { @Test public void test_get_queued_searches_without_failure_state() { - repository.save(new BatchSearch("uuid", singletonList(project("prj")), "name1", "description1", + repository.save(new BatchSearch("uuid", singletonList(proxy("prj")), "name1", "description1", asSet("q1", "q2"), new Date(), State.FAILURE, User.local())); assertThat(repository.getQueued()).hasSize(0); @@ -287,7 +287,7 @@ public void test_set_state_unknown_batch_search() { @Test public void test_set_state() { - BatchSearch batchSearch = new BatchSearch(singletonList(project("prj")), "name", "description", asSet("q1", "q2"), new Date()); + BatchSearch batchSearch = new BatchSearch(singletonList(proxy("prj")), "name", "description", asSet("q1", "q2"), new Date()); repository.save(batchSearch); assertThat(repository.get(batchSearch.uuid).state).isEqualTo(State.QUEUED); @@ -297,7 +297,7 @@ public void test_set_state() { @Test public void test_set_error_state() { - BatchSearch batchSearch = new BatchSearch(singletonList(project("prj")), "name", "description", asSet("q1", "q2"), new Date()); + BatchSearch batchSearch = new BatchSearch(singletonList(proxy("prj")), "name", "description", asSet("q1", "q2"), new Date()); repository.save(batchSearch); SearchException error = new SearchException("q1", new RuntimeException("root exception")); @@ -310,7 +310,7 @@ public void test_set_error_state() { @Test public void test_save_results() { - BatchSearch batchSearch = new BatchSearch(singletonList(project("prj")), "name", "description", asSet("my query", "my other query"), User.local()); + BatchSearch batchSearch = new BatchSearch(singletonList(proxy("prj")), "name", "description", asSet("my query", "my other query"), User.local()); repository.save(batchSearch); assertThat(repository.saveResults(batchSearch.uuid, "my query", asList(createDoc("doc1").build(), createDoc("doc2").build()))).isTrue(); @@ -329,7 +329,7 @@ public void test_save_results() { @Test public void test_get_results_total() { - BatchSearch batchSearch = new BatchSearch(singletonList(project("prj")), "name", "description", asSet("my query", "my other query"), User.local()); + BatchSearch batchSearch = new BatchSearch(singletonList(proxy("prj")), "name", "description", asSet("my query", "my other query"), User.local()); repository.save(batchSearch); assertThat(repository.saveResults(batchSearch.uuid, "my query", asList(createDoc("doc1").build(), createDoc("doc2").build()))).isTrue(); @@ -343,7 +343,7 @@ public void test_get_results_total() { @Test public void test_save_results_multiple_times() { - BatchSearch batchSearch = new BatchSearch(singletonList(project("prj")), "name", "description", asSet("my query", "my other query"), User.local()); + BatchSearch batchSearch = new BatchSearch(singletonList(proxy("prj")), "name", "description", asSet("my query", "my other query"), User.local()); repository.save(batchSearch); assertThat(repository.saveResults(batchSearch.uuid, "my query", asList(createDoc("doc1").build(), createDoc("doc2").build()))).isTrue(); @@ -355,8 +355,8 @@ public void test_save_results_multiple_times() { @Test public void test_results_by_query_are_isolated() { - BatchSearch batchSearch1 = new BatchSearch(singletonList(project("prj")), "name1", "description1", asSet("my query", "my other query"), User.local()); - BatchSearch batchSearch2 = new BatchSearch(singletonList(project("prj")), "name2", "description2", asSet("my query", "3rd query"), User.local()); + BatchSearch batchSearch1 = new BatchSearch(singletonList(proxy("prj")), "name1", "description1", asSet("my query", "my other query"), User.local()); + BatchSearch batchSearch2 = new BatchSearch(singletonList(proxy("prj")), "name2", "description2", asSet("my query", "3rd query"), User.local()); repository.save(batchSearch1); repository.save(batchSearch2); repository.saveResults(batchSearch1.uuid, "my query", asList(createDoc("doc1").build(), createDoc("doc2").build())); @@ -366,7 +366,7 @@ public void test_results_by_query_are_isolated() { @Test public void test_get_results_paginated() { - BatchSearch batchSearch = new BatchSearch(singletonList(project("prj")), "name", "description", asSet("query"), User.local()); + BatchSearch batchSearch = new BatchSearch(singletonList(proxy("prj")), "name", "description", asSet("query"), User.local()); repository.save(batchSearch); assertThat(repository.saveResults(batchSearch.uuid, "query", asList( @@ -382,7 +382,7 @@ public void test_get_results_paginated() { @Test public void test_get_results_filtered_by_query() { - BatchSearch batchSearch = new BatchSearch(singletonList(project("prj")), "name", "description", asSet("q1", "q2"), User.local()); + BatchSearch batchSearch = new BatchSearch(singletonList(proxy("prj")), "name", "description", asSet("q1", "q2"), User.local()); repository.save(batchSearch); repository.saveResults(batchSearch.uuid, "q1", asList(createDoc("doc1").build(), createDoc("doc2").build())); repository.saveResults(batchSearch.uuid, "q2", asList(createDoc("doc3").build(), createDoc("doc4").build())); @@ -398,7 +398,7 @@ public void test_get_results_filtered_by_query() { @Test public void test_get_results_filtered_by_excluding_queries() { - BatchSearch batchSearch = new BatchSearch(singletonList(project("prj")), "name", "description", asSet("q1", "q2"), User.local()); + BatchSearch batchSearch = new BatchSearch(singletonList(proxy("prj")), "name", "description", asSet("q1", "q2"), User.local()); repository.save(batchSearch); repository.saveResults(batchSearch.uuid, "q1", asList(createDoc("doc1").build(), createDoc("doc2").build())); repository.saveResults(batchSearch.uuid, "q2", asList(createDoc("doc3").build(), createDoc("doc4").build())); @@ -421,7 +421,7 @@ public void test_get_results_filtered_by_excluding_queries() { @Test public void test_get_results_filtered_by_content_type() { - BatchSearch batchSearch = new BatchSearch(singletonList(project("prj")), "name", "description", asSet("q1", "q2"), User.local()); + BatchSearch batchSearch = new BatchSearch(singletonList(proxy("prj")), "name", "description", asSet("q1", "q2"), User.local()); repository.save(batchSearch); repository.saveResults(batchSearch.uuid, "q1", asList(createDoc("doc1").ofMimeType("application/pdf").build(), createDoc("doc2").ofMimeType("content/type").build())); repository.saveResults(batchSearch.uuid, "q2", asList(createDoc("doc3").ofMimeType("application/pdf").build(), createDoc("doc4").build())); @@ -438,7 +438,7 @@ public void test_get_results_filtered_by_content_type() { } @Test public void test_get_results_order() { - BatchSearch batchSearch = new BatchSearch(singletonList(project("prj")), "name", "description", asSet("q1", "q2"), User.local()); + BatchSearch batchSearch = new BatchSearch(singletonList(proxy("prj")), "name", "description", asSet("q1", "q2"), User.local()); repository.save(batchSearch); repository.saveResults(batchSearch.uuid, "q1", asList(createDoc("a").build(), createDoc("c").build())); repository.saveResults(batchSearch.uuid, "q2", asList(createDoc("b").build(), createDoc("d").build())); @@ -480,7 +480,7 @@ public void test_get_batch_search_queries_order(){ add("q3"); add("q2"); }}; - BatchSearch batchSearch = new BatchSearch("uuid", singletonList(project("prj")), "name1", "description1", + BatchSearch batchSearch = new BatchSearch("uuid", singletonList(proxy("prj")), "name1", "description1", queryList, new Date(), State.RUNNING, User.local()); repository.save(batchSearch); Map queriesNaturalOrder = repository.getQueries(batchSearch.user, batchSearch.uuid, 0, 0, null, null); @@ -510,7 +510,7 @@ public void test_get_batch_search_queries_order(){ @Test public void test_get_batch_search_by_uuid_with_queries() { - BatchSearch search = new BatchSearch(singletonList(project("prj")), "name1", "description1", asSet("q1", "q2"), User.local()); + BatchSearch search = new BatchSearch(singletonList(proxy("prj")), "name1", "description1", asSet("q1", "q2"), User.local()); repository.save(search); BatchSearch batchSearch = repository.get(User.local(), search.uuid); @@ -526,7 +526,7 @@ public void test_get_batch_search_by_uuid_with_queries() { @Test public void test_get_batch_search_by_uuid_without_queries() { - BatchSearch search = new BatchSearch(singletonList(project("prj")), "name1", "description1", asSet("q1", "q2"), User.local()); + BatchSearch search = new BatchSearch(singletonList(proxy("prj")), "name1", "description1", asSet("q1", "q2"), User.local()); repository.save(search); BatchSearch batchSearch = repository.get(User.local(), search.uuid, false); assertThat(batchSearch).isNotNull(); @@ -548,9 +548,9 @@ public void test_cannot_get_unknown_batch_search_with_queries() { @Test public void test_delete_batch_searches() { - BatchSearch batchSearch1 = new BatchSearch(singletonList(project("prj")), "name", "description1", asSet("q1", "q2"), User.local()); + BatchSearch batchSearch1 = new BatchSearch(singletonList(proxy("prj")), "name", "description1", asSet("q1", "q2"), User.local()); repository.save(batchSearch1); - BatchSearch batchSearch2 = new BatchSearch(singletonList(project("prj")), "name", "description3", asSet("q3", "q4"), new User("foo")); + BatchSearch batchSearch2 = new BatchSearch(singletonList(proxy("prj")), "name", "description3", asSet("q3", "q4"), new User("foo")); repository.save(batchSearch2); repository.saveResults(batchSearch1.uuid, "q2", asList( createDoc("doc1").build(), createDoc("doc2").build(), createDoc("doc3").build(), createDoc("doc4").build())); @@ -564,7 +564,7 @@ public void test_delete_batch_searches() { @Test public void test_delete_batch_search() { - BatchSearch batchSearch1 = new BatchSearch(singletonList(project("prj")), "name", "description1", asSet("q1", "q2"), User.local()); + BatchSearch batchSearch1 = new BatchSearch(singletonList(proxy("prj")), "name", "description1", asSet("q1", "q2"), User.local()); repository.save(batchSearch1); repository.saveResults(batchSearch1.uuid, "q2", asList( createDoc("doc1").build(), createDoc("doc2").build(), createDoc("doc3").build(), createDoc("doc4").build())); @@ -577,7 +577,7 @@ public void test_delete_batch_search() { @Test public void test_delete_batch_search_by_another_user() { - BatchSearch batchSearch = new BatchSearch(singletonList(project("prj")), "foo search", "description1", asSet("q3", "q4"), new User("foo")); + BatchSearch batchSearch = new BatchSearch(singletonList(proxy("prj")), "foo search", "description1", asSet("q3", "q4"), new User("foo")); User foo = new User("foo"); repository.save(batchSearch); repository.saveResults(batchSearch.uuid, "q2", asList( @@ -592,7 +592,7 @@ public void test_delete_batch_search_by_another_user() { @Test public void test_delete_batch_search_running_do_not_remove_row() { for (State s: State.values()) { - repository.save(new BatchSearch("uuid_" + s, singletonList(project("prj")), s.name(), "description", asSet("q1", "q2"), new Date(), s, User.local())); + repository.save(new BatchSearch("uuid_" + s, singletonList(proxy("prj")), s.name(), "description", asSet("q1", "q2"), new Date(), s, User.local())); } assertThat(repository.delete(User.local(), "uuid_QUEUED")).isTrue(); @@ -603,7 +603,7 @@ public void test_delete_batch_search_running_do_not_remove_row() { @Test(expected = JooqBatchSearchRepository.UnauthorizedUserException.class) public void test_get_results_with_bad_user() { - BatchSearch batchSearch = new BatchSearch(singletonList(project("prj")), "name", "description", asSet("query"), User.local()); + BatchSearch batchSearch = new BatchSearch(singletonList(proxy("prj")), "name", "description", asSet("query"), User.local()); repository.save(batchSearch); repository.saveResults(batchSearch.uuid, "query", singletonList(createDoc("doc").build())); @@ -612,7 +612,7 @@ public void test_get_results_with_bad_user() { @Test public void test_get_results_published_from_another_user() { - BatchSearch batchSearch = new BatchSearch(singletonList(project("prj")), "name", "description", asSet("query"), User.local(), true); + BatchSearch batchSearch = new BatchSearch(singletonList(proxy("prj")), "name", "description", asSet("query"), User.local(), true); repository.save(batchSearch); repository.saveResults(batchSearch.uuid, "query", asList( createDoc("doc1").build(), createDoc("doc2").build(), createDoc("doc3").build(), createDoc("doc4").build())); @@ -622,7 +622,7 @@ public void test_get_results_published_from_another_user() { @Test public void test_publish() { - repository.save(new BatchSearch("uuid", singletonList(project("prj")), "name", "description", + repository.save(new BatchSearch("uuid", singletonList(proxy("prj")), "name", "description", asSet("q1", "q2"), new Date(), State.FAILURE, User.local())); assertThat(repository.get(User.local(), "uuid").published).isFalse(); @@ -632,7 +632,7 @@ public void test_publish() { @Test public void test_publish_unauthorized_user_does_nothing() { - repository.save(new BatchSearch("uuid", singletonList(project("prj")), "name1", "description1", + repository.save(new BatchSearch("uuid", singletonList(proxy("prj")), "name1", "description1", asSet("q1", "q2"), new Date(), State.FAILURE, User.local())); assertThat(repository.publish(new User("unauthorized"), "uuid", true)).isFalse(); @@ -640,7 +640,7 @@ public void test_publish_unauthorized_user_does_nothing() { @Test public void test_reset_batch_search() { - BatchSearch batchSearch = new BatchSearch("uuid", singletonList(project("prj")), "name1", "description1", + BatchSearch batchSearch = new BatchSearch("uuid", singletonList(proxy("prj")), "name1", "description1", asSet("q1", "q2"), new Date(), State.RUNNING, User.local()); repository.save(batchSearch); repository.saveResults(batchSearch.uuid, "query",asList(createDoc("doc1").build(),createDoc("doc2").build())); @@ -652,7 +652,7 @@ public void test_reset_batch_search() { @Test public void test_get_batch_search_queries() { - List project = singletonList(project("prj")); + List project = singletonList(proxy("prj")); LinkedHashSet bsQueries = new LinkedHashSet() {{ add("q2"); add("q1"); @@ -674,7 +674,7 @@ public void test_get_batch_search_queries() { @Test public void test_get_batch_search_queries_with_zero_results() { - List project = singletonList(project("prj")); + List project = singletonList(proxy("prj")); LinkedHashSet bsQueries = new LinkedHashSet() {{ add("q1"); add("q2"); @@ -693,7 +693,7 @@ public void test_get_batch_search_queries_with_zero_results() { @Test public void test_get_batch_search_queries_with_two_as_max_results() { - List project = singletonList(project("foo")); + List project = singletonList(proxy("foo")); LinkedHashSet bsQueries = new LinkedHashSet() {{ add("q1"); add("q2"); @@ -712,7 +712,7 @@ public void test_get_batch_search_queries_with_two_as_max_results() { @Test public void test_get_batch_search_queries_with_no_max_results() { - List project = singletonList(project("prj")); + List project = singletonList(proxy("prj")); LinkedHashSet bsQueries = new LinkedHashSet() {{ add("q1"); add("q2"); @@ -731,7 +731,7 @@ public void test_get_batch_search_queries_with_no_max_results() { @Test public void test_save_batch_search_nb_queries_is_stored_in_db() { - BatchSearch batchSearch = new BatchSearch(asList(project("prj1"), project("prj2")), "name1", "description1", + BatchSearch batchSearch = new BatchSearch(asList(proxy("prj1"), proxy("prj2")), "name1", "description1", asSet("q1", "q2"), User.local(), true, asList("application/json", "image/jpeg"), singletonList("tag"), asList("/path/to/docs", "/path/to/pdfs"), 3,true); @@ -742,7 +742,7 @@ public void test_save_batch_search_nb_queries_is_stored_in_db() { @Test public void test_use_computed_nb_queries_when_nb_queries_attribute_is_equal_to_0() { - BatchSearch batchSearch = new BatchSearch(asList(project("prj1"), project("prj2")), "name1", "description1", + BatchSearch batchSearch = new BatchSearch(asList(proxy("prj1"), proxy("prj2")), "name1", "description1", asSet("q1", "q2"), User.local(), true, asList("application/json", "image/jpeg"), singletonList("tag"), asList("/path/to/docs", "/path/to/pdfs"), 3,true); @@ -775,7 +775,7 @@ public void test_get_batch_search_queries_with_negative_size_is_illegal() { @Test public void test_get_batch_search_queries_with_search_filter() { - BatchSearch batchSearch = new BatchSearch("uuid", singletonList(project("prj")), "name1", "description1", + BatchSearch batchSearch = new BatchSearch("uuid", singletonList(proxy("prj")), "name1", "description1", new LinkedHashSet() {{add("query abc");add("def query");}}, new Date(), State.RUNNING, User.local()); repository.save(batchSearch); assertThat(repository.getQueries(User.local(), "uuid", 0, 0, "query", null)).hasSize(2); @@ -785,7 +785,7 @@ public void test_get_batch_search_queries_with_search_filter() { @Test public void test_get_batch_search_queries_with_orderBy_param() { - BatchSearch batchSearch = new BatchSearch("uuid", singletonList(project("prj")), "name1", "description1", + BatchSearch batchSearch = new BatchSearch("uuid", singletonList(proxy("prj")), "name1", "description1", new LinkedHashSet() {{add("q2"); add("q1");}}, new Date(), State.RUNNING, User.local()); repository.save(batchSearch); diff --git a/datashare-db/src/test/java/org/icij/datashare/db/JooqRepositoryTest.java b/datashare-db/src/test/java/org/icij/datashare/db/JooqRepositoryTest.java index aa615b7f3..1ab323f8d 100644 --- a/datashare-db/src/test/java/org/icij/datashare/db/JooqRepositoryTest.java +++ b/datashare-db/src/test/java/org/icij/datashare/db/JooqRepositoryTest.java @@ -142,7 +142,7 @@ public void test_get_unknown_project() { public void test_get_list_project_by_ids() { repository.save(new Project("foo")); repository.save(new Project("bar")); - String[] projectIds = {"foo", "bar"}; + List projectIds = new ArrayList<>(List.of("foo","bar")); List projects = repository.getProjects(projectIds); assertThat(projects).hasSize(2); List projectNames = projects.stream().map(Project::getName).collect(Collectors.toList()); diff --git a/pom.xml b/pom.xml index b563e64b0..0bf79243b 100644 --- a/pom.xml +++ b/pom.xml @@ -76,7 +76,7 @@ 11 11 - 12.3.0 + 12.3.1 ${project.version} ${project.version}