use of org.opencastproject.smil.entity.api.SmilObject in project opencast by opencast.
the class SmilResponseImplTest method testGetEntity.
/**
* Test of getEntity method, of class SmilResponseImpl.
*/
@Test
public void testGetEntity() throws Exception {
Smil smil = new SmilImpl();
SmilResponse response = new SmilResponseImpl(smil);
try {
response.getEntity();
fail("getEntity should fail, if entity count is zero");
} catch (SmilException ex) {
}
response = new SmilResponseImpl(smil, smil.getBody());
try {
assertSame(smil.getBody(), response.getEntity());
assertSame(1, response.getEntities().length);
assertSame(smil.getBody(), response.getEntities()[0]);
} catch (SmilException ex) {
fail("getEntity should return the entity");
}
response = new SmilResponseImpl(smil, new SmilObject[] { smil.getHead(), smil.getBody() });
try {
response.getEntity();
fail("get entity should fail if there are more then one entities set.");
} catch (SmilException ex) {
}
}
use of org.opencastproject.smil.entity.api.SmilObject in project opencast by opencast.
the class SmilBodyImpl method putAllChilds.
/**
* {@inheritDoc}
*/
@Override
public void putAllChilds(List<SmilObject> elements) {
for (SmilObject child : getMediaElements()) {
elements.add(child);
((SmilObjectImpl) child).putAllChilds(elements);
}
}
use of org.opencastproject.smil.entity.api.SmilObject in project opencast by opencast.
the class SmilHeadImpl method addMeta.
/**
* Add given {@link SmilMeta} element.
*
* @param meta {@link SmilMeta} to add
*/
public void addMeta(SmilMeta meta) {
SmilObject m = getElementOrNull(meta.getId());
if (m != null && m instanceof SmilMeta) {
((SmilMetaImpl) m).setName(meta.getName());
((SmilMetaImpl) m).setContent(meta.getContent());
} else {
metas.add(meta);
}
}
use of org.opencastproject.smil.entity.api.SmilObject in project opencast by opencast.
the class SmilHeadImpl method putAllChilds.
/**
* {@inheritDoc}
*/
@Override
public void putAllChilds(List<SmilObject> elements) {
for (SmilObject meta : getMetas()) {
elements.add(meta);
((SmilObjectImpl) meta).putAllChilds(elements);
}
for (SmilObject paramGroup : getParamGroups()) {
elements.add(paramGroup);
((SmilObjectImpl) paramGroup).putAllChilds(elements);
}
}
Aggregations