use of org.opencastproject.publication.oaipmh.remote.OaiPmhPublicationServiceRemoteImpl in project opencast by opencast.
the class OaiPmhPublicationRestServiceTest method testPublishUsingRemoteService.
@Test
public void testPublishUsingRemoteService() throws Exception {
final MediaPackage mp = MediaPackageBuilderFactory.newInstance().newMediaPackageBuilder().createNew();
mp.addCreator(CREATOR);
//
final ServiceRegistry registry = EasyMock.createNiceMock(ServiceRegistry.class);
final ServiceRegistration registration = EasyMock.createNiceMock(ServiceRegistration.class);
EasyMock.expect(registration.getHost()).andReturn(url.getProtocol() + "://" + url.getHost() + ":" + url.getPort()).anyTimes();
EasyMock.expect(registration.getPath()).andReturn(url.getPath()).anyTimes();
EasyMock.expect(registry.getServiceRegistrationsByLoad(EasyMock.anyString())).andReturn(ListBuilders.SIA.mk(registration)).anyTimes();
EasyMock.replay(registry, registration);
final OaiPmhPublicationServiceRemoteImpl remote = new OaiPmhPublicationServiceRemoteImpl();
remote.setTrustedHttpClient(new TestHttpClient());
remote.setRemoteServiceManager(registry);
//
final Job job = remote.publish(mp, "mmp", new HashSet<String>(), new HashSet<String>(), false);
assertEquals(job.getUri(), JOB_URI);
}
Aggregations