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);
}
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);
}
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);
}
Aggregations