use of org.opencastproject.metadata.dublincore.DublinCoreCatalog in project opencast by opencast.
the class SeriesServiceImplTest method testAddingSeriesWithoutID.
@Test
public void testAddingSeriesWithoutID() throws Exception {
testCatalog.remove(DublinCore.PROPERTY_IDENTIFIER);
DublinCoreCatalog newSeries = seriesService.updateSeries(testCatalog);
Assert.assertNotNull("New series DC should be returned", newSeries);
String id = newSeries.getFirst(DublinCore.PROPERTY_IDENTIFIER);
Assert.assertNotNull("New series should have id set", id);
}
use of org.opencastproject.metadata.dublincore.DublinCoreCatalog in project opencast by opencast.
the class SeriesServiceImplTest method testSeriesQuery.
@Test
public void testSeriesQuery() throws Exception {
testCatalog.set(DublinCore.PROPERTY_TITLE, "Some title");
seriesService.updateSeries(testCatalog);
SeriesQuery q = new SeriesQuery().setSeriesTitle("other");
List<DublinCoreCatalog> result = seriesService.getSeries(q).getCatalogList();
Assert.assertEquals(0, result.size());
testCatalog.set(DublinCore.PROPERTY_TITLE, "Some other title");
seriesService.updateSeries(testCatalog);
result = seriesService.getSeries(q).getCatalogList();
Assert.assertEquals(1, result.size());
}
use of org.opencastproject.metadata.dublincore.DublinCoreCatalog in project opencast by opencast.
the class SeriesServiceImplTest method testDublinCoreCatalogEquality1.
@Test
public void testDublinCoreCatalogEquality1() {
DublinCoreCatalog a = DublinCores.mkOpencast().getCatalog();
DublinCoreCatalog b = DublinCores.mkOpencast().getCatalog();
a.set(DublinCore.PROPERTY_IDENTIFIER, "123");
assertFalse(DublinCoreUtil.equals(a, b));
b.set(DublinCore.PROPERTY_IDENTIFIER, "123");
assertTrue(DublinCoreUtil.equals(a, b));
a.set(DublinCore.PROPERTY_CONTRIBUTOR, list(DublinCoreValue.mk("Peter"), DublinCoreValue.mk("Paul")));
b.set(DublinCore.PROPERTY_CONTRIBUTOR, list(DublinCoreValue.mk("Paul"), DublinCoreValue.mk("Peter")));
assertFalse(DublinCoreUtil.equals(a, b));
//
b.set(DublinCore.PROPERTY_CONTRIBUTOR, list(DublinCoreValue.mk("Peter"), DublinCoreValue.mk("Paul")));
assertTrue(DublinCoreUtil.equals(a, b));
//
a.set(DublinCore.PROPERTY_SPATIAL, "room1");
a.set(DublinCore.PROPERTY_DESCRIPTION, "this is a test lecture");
b.set(DublinCore.PROPERTY_DESCRIPTION, "this is a test lecture");
b.set(DublinCore.PROPERTY_SPATIAL, "room1");
assertTrue(DublinCoreUtil.equals(a, b));
}
use of org.opencastproject.metadata.dublincore.DublinCoreCatalog in project opencast by opencast.
the class SeriesServiceImplTest method testDublinCoreCatalogPreservation.
@Test
public void testDublinCoreCatalogPreservation() throws Exception {
seriesService.updateSeries(testCatalog2);
DublinCoreCatalog dc = seriesService.getSeries("10.0000/5820");
assertTrue(DublinCoreUtil.equals(testCatalog2, testCatalog2));
assertTrue(DublinCoreUtil.equals(dc, dc));
assertTrue(DublinCoreUtil.equals(testCatalog2, dc));
}
use of org.opencastproject.metadata.dublincore.DublinCoreCatalog 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);
}
Aggregations