Search in sources :

Example 91 with DublinCoreCatalog

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);
}
Also used : DublinCoreCatalog(org.opencastproject.metadata.dublincore.DublinCoreCatalog) Test(org.junit.Test)

Example 92 with DublinCoreCatalog

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());
}
Also used : SeriesQuery(org.opencastproject.series.api.SeriesQuery) DublinCoreCatalog(org.opencastproject.metadata.dublincore.DublinCoreCatalog) Test(org.junit.Test)

Example 93 with DublinCoreCatalog

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));
}
Also used : DublinCoreCatalog(org.opencastproject.metadata.dublincore.DublinCoreCatalog) Test(org.junit.Test)

Example 94 with DublinCoreCatalog

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));
}
Also used : DublinCoreCatalog(org.opencastproject.metadata.dublincore.DublinCoreCatalog) Test(org.junit.Test)

Example 95 with DublinCoreCatalog

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

Aggregations

DublinCoreCatalog (org.opencastproject.metadata.dublincore.DublinCoreCatalog)117 MediaPackage (org.opencastproject.mediapackage.MediaPackage)51 NotFoundException (org.opencastproject.util.NotFoundException)46 Test (org.junit.Test)44 Date (java.util.Date)40 IOException (java.io.IOException)30 UnauthorizedException (org.opencastproject.security.api.UnauthorizedException)29 URI (java.net.URI)23 AccessControlList (org.opencastproject.security.api.AccessControlList)22 SeriesException (org.opencastproject.series.api.SeriesException)20 ArrayList (java.util.ArrayList)18 Catalog (org.opencastproject.mediapackage.Catalog)18 SchedulerException (org.opencastproject.scheduler.api.SchedulerException)18 EName (org.opencastproject.mediapackage.EName)17 MediaPackageException (org.opencastproject.mediapackage.MediaPackageException)17 HashMap (java.util.HashMap)16 HashSet (java.util.HashSet)15 SchedulerConflictException (org.opencastproject.scheduler.api.SchedulerConflictException)15 InputStream (java.io.InputStream)14 AQueryBuilder (org.opencastproject.assetmanager.api.query.AQueryBuilder)14