Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make tool work with Solr removal #623

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frontend/js/integrations/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ define([
data: "id=" + mediaPackageId + "&limit=1",
dataType: "json"
}).then(function (data) {
return data["search-results"].result;
return data.result[0];
});
var mediaPackage = searchResult.then(function (result) {
return result.mediapackage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@
import org.opencastproject.db.DBSession;
import org.opencastproject.db.DBSessionFactory;
import org.opencastproject.mediapackage.MediaPackage;
import org.opencastproject.search.api.SearchQuery;
import org.opencastproject.search.api.SearchResultItem;
import org.opencastproject.search.api.SearchService;
import org.opencastproject.security.api.AuthorizationService;
import org.opencastproject.security.api.SecurityConstants;
import org.opencastproject.security.api.SecurityService;
import org.opencastproject.security.api.UnauthorizedException;
import org.opencastproject.util.NotFoundException;
import org.opencastproject.util.data.Effect;
import org.opencastproject.util.data.Function;
import org.opencastproject.util.data.Function0;
Expand Down Expand Up @@ -1271,14 +1271,11 @@ public Boolean none() {

@Override
public Option<MediaPackage> findMediaPackage(String id) {
return head(searchService.getByQuery(new SearchQuery().withId(id)).getItems()).map(
new Function<>() {
@Override
public MediaPackage apply(SearchResultItem searchResultItem) {
return searchResultItem.getMediaPackage();
}
}
);
try {
return Option.some(searchService.get(id));
} catch (NotFoundException | UnauthorizedException e) {
return Option.none();
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,14 @@
import org.opencast.annotation.impl.persistence.ExtendedAnnotationServiceJpaImpl;

import org.opencastproject.mediapackage.MediaPackage;
import org.opencastproject.search.api.SearchQuery;
import org.opencastproject.search.api.SearchResult;
import org.opencastproject.search.api.SearchResultItem;
import org.opencastproject.search.api.SearchService;
import org.opencastproject.security.api.AuthorizationService;
import org.opencastproject.security.api.DefaultOrganization;
import org.opencastproject.security.api.SecurityService;
import org.opencastproject.security.api.UnauthorizedException;
import org.opencastproject.security.api.User;
import org.opencastproject.security.util.SecurityUtil;
import org.opencastproject.util.NotFoundException;

import org.easymock.EasyMock;
import org.junit.Ignore;
Expand Down Expand Up @@ -90,17 +89,12 @@ private static AuthorizationService getAuthorizationService() {
private static SearchService getSearchService() {
MediaPackage mediaPackage = EasyMock.createNiceMock(MediaPackage.class);

SearchResultItem searchResultItem = EasyMock.createNiceMock(SearchResultItem.class);
EasyMock.expect(searchResultItem.getMediaPackage()).andReturn(mediaPackage).anyTimes();
EasyMock.replay(searchResultItem);

SearchResult searchResult = EasyMock.createNiceMock(SearchResult.class);
EasyMock.expect(searchResult.getItems()).andReturn(new SearchResultItem[]{searchResultItem}).anyTimes();
EasyMock.replay(searchResult);

SearchService searchService = EasyMock.createNiceMock(SearchService.class);
EasyMock.expect(searchService.getByQuery(EasyMock.anyObject(SearchQuery.class)))
.andReturn(searchResult).anyTimes();
try {
EasyMock.expect(searchService.get(EasyMock.anyObject(String.class))).andReturn(mediaPackage).anyTimes();
} catch (UnauthorizedException | NotFoundException e) {
// Do nothing. We just have to pretend to handle checked exceptions somehow to appease the compiler.
}
EasyMock.replay(searchService);
return searchService;
}
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@

<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<opencast.build.version>14.0</opencast.build.version>
<opencast.deploy.version>;version="${opencast.build.version}"</opencast.deploy.version>
<opencast.build.version>16.0</opencast.build.version>
<opencast.deploy.version>;version=16.0</opencast.deploy.version>
</properties>

<build>
Expand Down