use of org.opencastproject.assetmanager.api.query.RichAResult in project opencast by opencast.
the class AbstractAssetManagerSelectTest method testSelectAllPropertiesOfNamespace.
@Test
public void testSelectAllPropertiesOfNamespace() throws Exception {
final MediaPackage mp = mkMediaPackage(mkCatalog());
am.takeSnapshot(OWNER, mp);
am.setProperty(Property.mk(PropertyId.mk(mp.getIdentifier().toString(), "namespace-1", "prop-1"), Value.mk(true)));
am.setProperty(Property.mk(PropertyId.mk(mp.getIdentifier().toString(), "namespace-2", "prop-2"), Value.mk("value-2")));
{
final RichAResult r = enrich(q.select(q.propertiesOf("namespace-1")).run());
assertEquals("One record should be returned", 1, r.getSize());
assertEquals("No snapshots should be returned", 0, r.countSnapshots());
assertEquals("One property should be returned", 1, r.countProperties());
assertEquals("Property of namespace-1 should be returned", PropertyId.mk(mp.getIdentifier().toString(), "namespace-1", "prop-1"), r.getProperties().head2().getId());
}
{
final RichAResult r = enrich(q.select(q.propertiesOf("namespace-1")).where(q.hasPropertiesOf("namespace-2")).run());
assertEquals("One record should be returned", 1, r.getSize());
assertEquals("No snapshots should be returned", 0, r.countSnapshots());
assertEquals("One property should be returned", 1, r.countProperties());
assertEquals("Property of namespace-1 should be returned", PropertyId.mk(mp.getIdentifier().toString(), "namespace-1", "prop-1"), r.getProperties().head2().getId());
}
}
Aggregations