use of org.opencastproject.mediapackage.identifier.HandleException in project opencast by opencast.
the class HandleBuilderTest method testUpdate.
/**
* Test method for
* {@link org.opencastproject.mediapackage.identifier.HandleBuilderImpl#update(org.opencastproject.mediapackage.identifier.Id, java.net.URL)}
*/
@Test
public void testUpdate() {
try {
Handle newHandle = handleBuilder.createNew(url);
newHandles.add(newHandle);
// Create new target and update
URL newTarget = new URL("http://www.apple.com");
boolean updated = handleBuilder.update(newHandle, newTarget);
assertTrue(updated);
// TODO: Our handle server at the moment does caching in the
// webservice, so this test always fails, although resolving
// is working properly
// URL resolvedUrl = handleBuilder.resolve(newHandle);
// assertEquals(newTarget, resolvedUrl);
} catch (HandleException e) {
fail("Error updating handle: " + e.getMessage());
} catch (MalformedURLException e) {
fail("Error creating new handle url: " + e.getMessage());
}
}
use of org.opencastproject.mediapackage.identifier.HandleException in project opencast by opencast.
the class HandleBuilderTest method testCreateNewURL.
/**
* Test method for {@link org.opencastproject.mediapackage.identifier.HandleBuilderImpl#createNew(java.net.URL)} .
*/
@Test
public void testCreateNewURL() {
Handle handle = null;
try {
handle = handleBuilder.createNew(url);
newHandles.add(handle);
assertNotNull(handle);
assertNotNull(handle.getNamingAuthority());
assertNotNull(handle.getLocalName());
assertNotNull(handle.resolve());
assertEquals(url, handle.resolve());
} catch (HandleException e) {
fail("Error creating handle: " + e.getMessage());
}
}
use of org.opencastproject.mediapackage.identifier.HandleException in project opencast by opencast.
the class HandleTest method testUpdate.
/**
* Test method for {@link org.opencastproject.mediapackage.identifier.HandleImpl#update(java.net.URL)} .
*/
@Test
public void testUpdate() {
try {
URL newTarget = new URL("http://www.apple.com");
Handle newHandle = handleBuilder.createNew(url);
newHandles.add(newHandle);
newHandle.update(newTarget);
URL resolvedUrl = newHandle.resolve();
assertEquals(newTarget, resolvedUrl);
} catch (HandleException e) {
fail("Error updating handle: " + e.getMessage());
} catch (MalformedURLException e) {
fail("Error creating new handle url: " + e.getMessage());
}
}
use of org.opencastproject.mediapackage.identifier.HandleException in project opencast by opencast.
the class HandleTest method testGetValue.
/**
* Test method for {@link org.opencastproject.mediapackage.identifier.HandleImpl#resolve()}.
*/
@Test
public void testGetValue() {
try {
Handle newHandle = handleBuilder.createNew(url);
newHandles.add(newHandle);
URL resolvedUrl = newHandle.resolve();
assertEquals(url, resolvedUrl);
} catch (HandleException e) {
fail("Error resolving handle: " + e.getMessage());
}
}
use of org.opencastproject.mediapackage.identifier.HandleException in project opencast by opencast.
the class HandleBuilderTest method testCreateNew.
/**
* Test method for {@link org.opencastproject.mediapackage.identifier.HandleBuilderImpl#createNew()} .
*/
@Test
public void testCreateNew() {
Handle handle = null;
try {
handle = handleBuilder.createNew();
newHandles.add(handle);
assertNotNull(handle);
assertNotNull(handle.getNamingAuthority());
assertNotNull(handle.getLocalName());
assertNotNull(handle.resolve());
} catch (HandleException e) {
fail("Error creating handle: " + e.getMessage());
}
}
Aggregations