Search in sources :

Example 6 with DublinCoreCatalogList

use of org.opencastproject.metadata.dublincore.DublinCoreCatalogList in project opencast by opencast.

the class SeriesServiceSolrTest method testCreatedRangedTest.

@Test
public void testCreatedRangedTest() throws Exception {
    DublinCoreCatalog firstCatalog = dcService.newInstance();
    firstCatalog.add(DublinCore.PROPERTY_IDENTIFIER, "10.0000/1");
    firstCatalog.add(DublinCore.PROPERTY_TITLE, "Cats and Dogs");
    firstCatalog.add(DublinCore.PROPERTY_CREATED, "2007-05-03");
    DublinCoreCatalog secondCatalog = dcService.newInstance();
    secondCatalog.add(DublinCore.PROPERTY_IDENTIFIER, "10.0000/2");
    secondCatalog.add(DublinCore.PROPERTY_TITLE, "Nature of Dogs");
    secondCatalog.add(DublinCore.PROPERTY_CREATED, "2007-05-05");
    DublinCoreCatalog thirdCatalog = dcService.newInstance();
    thirdCatalog.add(DublinCore.PROPERTY_IDENTIFIER, "10.0000/3");
    thirdCatalog.add(DublinCore.PROPERTY_TITLE, "Nature");
    thirdCatalog.add(DublinCore.PROPERTY_CREATED, "2007-05-07");
    index.updateIndex(firstCatalog);
    index.updateIndex(secondCatalog);
    index.updateIndex(thirdCatalog);
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
    SeriesQuery q = new SeriesQuery().setCreatedFrom(sdf.parse("2007-05-02")).setCreatedTo(sdf.parse("2007-05-06"));
    DublinCoreCatalogList result = index.search(q);
    Assert.assertTrue("Two series satisfy time range", result.size() == 2);
}
Also used : SeriesQuery(org.opencastproject.series.api.SeriesQuery) DublinCoreCatalogList(org.opencastproject.metadata.dublincore.DublinCoreCatalogList) DublinCoreCatalog(org.opencastproject.metadata.dublincore.DublinCoreCatalog) SimpleDateFormat(java.text.SimpleDateFormat) Test(org.junit.Test)

Example 7 with DublinCoreCatalogList

use of org.opencastproject.metadata.dublincore.DublinCoreCatalogList in project opencast by opencast.

the class SeriesServiceSolrTest method testSearchingByTitleAndFullText.

@Test
public void testSearchingByTitleAndFullText() throws Exception {
    DublinCoreCatalog firstCatalog = dcService.newInstance();
    firstCatalog.add(DublinCore.PROPERTY_IDENTIFIER, "10.0000/1");
    firstCatalog.add(DublinCore.PROPERTY_TITLE, "Cats and Dogs");
    firstCatalog.add(DublinCore.PROPERTY_DESCRIPTION, "This lecture tries to give an explanation...");
    DublinCoreCatalog secondCatalog = dcService.newInstance();
    secondCatalog.add(DublinCore.PROPERTY_IDENTIFIER, "10.0000/2");
    secondCatalog.add(DublinCore.PROPERTY_TITLE, "Nature of Dogs");
    secondCatalog.add(DublinCore.PROPERTY_DESCRIPTION, "Why do dogs chase cats?");
    index.updateIndex(firstCatalog);
    index.updateIndex(secondCatalog);
    SeriesQuery q = new SeriesQuery().setSeriesTitle("cat");
    DublinCoreCatalogList result = index.search(q);
    Assert.assertTrue("Only one title contains 'cat'", result.size() == 1);
    q = new SeriesQuery().setSeriesTitle("dog");
    result = index.search(q);
    Assert.assertTrue("Both titles contains 'dog'", result.size() == 2);
    q = new SeriesQuery().setText("cat");
    result = index.search(q);
    Assert.assertTrue("Both Dublin Cores contains 'cat'", result.size() == 2);
}
Also used : SeriesQuery(org.opencastproject.series.api.SeriesQuery) DublinCoreCatalogList(org.opencastproject.metadata.dublincore.DublinCoreCatalogList) DublinCoreCatalog(org.opencastproject.metadata.dublincore.DublinCoreCatalog) Test(org.junit.Test)

Example 8 with DublinCoreCatalogList

use of org.opencastproject.metadata.dublincore.DublinCoreCatalogList in project opencast by opencast.

the class SchedulerServiceImplTest method setUp.

@Before
public void setUp() throws Exception {
    String seriesIdentifier = Long.toString(System.currentTimeMillis());
    DublinCoreCatalog seriesCatalog = getSampleSeriesDublinCoreCatalog(seriesIdentifier);
    List<DublinCoreCatalog> seriesCatalogs = new ArrayList<>();
    seriesCatalogs.add(seriesCatalog);
    seriesService = EasyMock.createMock(SeriesService.class);
    EasyMock.expect(seriesService.getSeries(EasyMock.anyString())).andReturn(seriesCatalog).anyTimes();
    EasyMock.expect(seriesService.getSeries(EasyMock.anyObject(SeriesQuery.class))).andReturn(new DublinCoreCatalogList(seriesCatalogs, 1)).anyTimes();
    EasyMock.expect(seriesService.isOptOut(EasyMock.anyString())).andReturn(false).anyTimes();
    EasyMock.replay(seriesService);
    schedSvc.setSeriesService(seriesService);
    assetManager = mkAssetManager();
    schedSvc.setAssetManager(assetManager);
}
Also used : DublinCoreCatalogList(org.opencastproject.metadata.dublincore.DublinCoreCatalogList) SeriesService(org.opencastproject.series.api.SeriesService) ArrayList(java.util.ArrayList) DublinCoreCatalog(org.opencastproject.metadata.dublincore.DublinCoreCatalog) Before(org.junit.Before)

Aggregations

DublinCoreCatalogList (org.opencastproject.metadata.dublincore.DublinCoreCatalogList)8 DublinCoreCatalog (org.opencastproject.metadata.dublincore.DublinCoreCatalog)5 SeriesQuery (org.opencastproject.series.api.SeriesQuery)5 Test (org.junit.Test)4 SeriesException (org.opencastproject.series.api.SeriesException)3 NotFoundException (org.opencastproject.util.NotFoundException)3 ParseException (java.text.ParseException)2 WebApplicationException (javax.ws.rs.WebApplicationException)2 UnauthorizedException (org.opencastproject.security.api.UnauthorizedException)2 IOException (java.io.IOException)1 MalformedURLException (java.net.MalformedURLException)1 SimpleDateFormat (java.text.SimpleDateFormat)1 ArrayList (java.util.ArrayList)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 HttpResponse (org.apache.http.HttpResponse)1 HttpGet (org.apache.http.client.methods.HttpGet)1 SolrQuery (org.apache.solr.client.solrj.SolrQuery)1 SolrServerException (org.apache.solr.client.solrj.SolrServerException)1