Search in sources :

Example 1 with WebResourceType

use of eu.europeana.metis.schema.jibx.WebResourceType in project metis-framework by europeana.

the class WebResourceTest method testSetChannels.

@Test
void testSetChannels() {
    final WebResourceType resourceType = new WebResourceType();
    new WebResource(resourceType).setChannels(789);
    assertNotNull(resourceType.getAudioChannelNumber());
    assertNotNull(resourceType.getAudioChannelNumber().getInteger());
    assertEquals(789, resourceType.getAudioChannelNumber().getInteger().intValue());
    new WebResource(resourceType).setChannels(null);
    assertNull(resourceType.getAudioChannelNumber());
}
Also used : WebResourceType(eu.europeana.metis.schema.jibx.WebResourceType) Test(org.junit.jupiter.api.Test)

Example 2 with WebResourceType

use of eu.europeana.metis.schema.jibx.WebResourceType in project metis-framework by europeana.

the class WebResourceTest method testSetMimeType.

@Test
void testSetMimeType() {
    final WebResourceType resourceType = new WebResourceType();
    new WebResource(resourceType).setMimeType("unknown type");
    assertNotNull(resourceType.getHasMimeType());
    assertEquals("unknown type", resourceType.getHasMimeType().getHasMimeType());
}
Also used : WebResourceType(eu.europeana.metis.schema.jibx.WebResourceType) Test(org.junit.jupiter.api.Test)

Example 3 with WebResourceType

use of eu.europeana.metis.schema.jibx.WebResourceType in project metis-framework by europeana.

the class WebResourceTest method testSetFileSize.

@Test
void testSetFileSize() {
    final WebResourceType resourceType = new WebResourceType();
    new WebResource(resourceType).setFileSize(456L);
    assertNotNull(resourceType.getFileByteSize());
    assertEquals(456L, resourceType.getFileByteSize().getLong());
}
Also used : WebResourceType(eu.europeana.metis.schema.jibx.WebResourceType) Test(org.junit.jupiter.api.Test)

Example 4 with WebResourceType

use of eu.europeana.metis.schema.jibx.WebResourceType in project metis-framework by europeana.

the class WebResourceTest method testSetWidth.

@Test
void testSetWidth() {
    final WebResourceType resourceType = new WebResourceType();
    new WebResource(resourceType).setWidth(123);
    assertNotNull(resourceType.getWidth());
    assertEquals(123L, resourceType.getWidth().getLong());
    new WebResource(resourceType).setWidth(null);
    assertNull(resourceType.getWidth());
}
Also used : WebResourceType(eu.europeana.metis.schema.jibx.WebResourceType) Test(org.junit.jupiter.api.Test)

Example 5 with WebResourceType

use of eu.europeana.metis.schema.jibx.WebResourceType in project metis-framework by europeana.

the class RdfWrapperTest method testGetWebResourcesWithProcessing.

@Test
void testGetWebResourcesWithProcessing() {
    // Create entities
    final WebResourceType entity0 = mock(WebResourceType.class);
    doReturn(" ").when(entity0).getAbout();
    final WebResourceType entity1 = mock(WebResourceType.class);
    doReturn("nonemptyabout").when(entity1).getAbout();
    final WebResourceType entity2 = mock(WebResourceType.class);
    doReturn(null).when(entity2).getAbout();
    // Test rdf that returns a real list
    final RDF rdf = mock(RDF.class);
    when(rdf.getWebResourceList()).thenReturn(Arrays.asList(entity0, entity1, entity2, null));
    assertEquals(Collections.singletonList(entity1.getAbout()), new RdfWrapper(rdf).getWebResources().stream().map(WebResourceType::getAbout).collect(Collectors.toList()));
    // Test rdf that returns null
    when(rdf.getWebResourceList()).thenReturn(null);
    assertTrue(new RdfWrapper(rdf).getWebResources().isEmpty());
}
Also used : WebResourceType(eu.europeana.metis.schema.jibx.WebResourceType) RDF(eu.europeana.metis.schema.jibx.RDF) Test(org.junit.jupiter.api.Test)

Aggregations

WebResourceType (eu.europeana.metis.schema.jibx.WebResourceType)24 Test (org.junit.jupiter.api.Test)21 RDF (eu.europeana.metis.schema.jibx.RDF)3 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)2 WebResourceMetaInfoImpl (eu.europeana.corelib.edm.model.metainfo.WebResourceMetaInfoImpl)1 BitRate (eu.europeana.metis.schema.jibx.BitRate)1 Created (eu.europeana.metis.schema.jibx.Created)1 Extent (eu.europeana.metis.schema.jibx.Extent)1 Format (eu.europeana.metis.schema.jibx.Format)1 HasFormat (eu.europeana.metis.schema.jibx.HasFormat)1 HasMimeType (eu.europeana.metis.schema.jibx.HasMimeType)1 HasPart (eu.europeana.metis.schema.jibx.HasPart)1 IsFormatOf (eu.europeana.metis.schema.jibx.IsFormatOf)1 Issued (eu.europeana.metis.schema.jibx.Issued)1 ProxyType (eu.europeana.metis.schema.jibx.ProxyType)1 ResourceOrLiteralType (eu.europeana.metis.schema.jibx.ResourceOrLiteralType)1 Resource (eu.europeana.metis.schema.jibx.ResourceOrLiteralType.Resource)1 SpatialResolution (eu.europeana.metis.schema.jibx.SpatialResolution)1 MediaType (eu.europeana.metis.schema.model.MediaType)1 BigInteger (java.math.BigInteger)1