@Test public void testPublish() throws MediaPackageException, PublicationException, ServiceRegistryException { ServiceRegistry serviceRegistry = EasyMock.createNiceMock(ServiceRegistry.class); Job dummyJob = EasyMock.createMock(Job.class); Capture<List<String>> jobArgsCapture = EasyMock.newCapture(); EasyMock.expect(serviceRegistry.createJob( eq(OaiPmhPublicationService.JOB_TYPE), eq(OaiPmhPublicationServiceImpl.Operation.Publish.toString()), capture(jobArgsCapture))).andReturn(dummyJob).once(); EasyMock.replay(serviceRegistry); service.setServiceRegistry(serviceRegistry); Job j = service.publish(mp, "default", Collections.set("catalog-1", "catalog-2", "track-1"), Collections.set("track-1"),true); Assert.assertSame(dummyJob, j); List<String> jobArgs = jobArgsCapture.getValue(); Assert.assertEquals(5, jobArgs.size()); Assert.assertTrue(jobArgs.get(0).contains("<mediapackage ")); Assert.assertEquals("default", jobArgs.get(1)); String downloadDistributionIdsArg = jobArgs.get(2); Assert.assertNotNull(downloadDistributionIdsArg); Assert.assertTrue(downloadDistributionIdsArg.contains("catalog-1")); Assert.assertTrue(downloadDistributionIdsArg.contains("catalog-2")); Assert.assertTrue(downloadDistributionIdsArg.contains("track-1")); String streamingDistributionIdsArg = jobArgs.get(3); Assert.assertNotNull(streamingDistributionIdsArg); Assert.assertTrue(!streamingDistributionIdsArg.contains("catalog-1")); Assert.assertTrue(!streamingDistributionIdsArg.contains("catalog-2")); Assert.assertTrue(streamingDistributionIdsArg.contains("track-1")); Assert.assertTrue(BooleanUtils.toBoolean(jobArgs.get(4))); }
@Override public Job publish(MediaPackage mediaPackage, String repository, Set<String> downloadElementIds, Set<String> streamingElementIds, boolean checkAvailability) throws PublicationException, MediaPackageException { checkInputArguments(mediaPackage, repository); try { return serviceRegistry.createJob(JOB_TYPE, Operation.Publish.toString(), Arrays.asList(MediaPackageParser.getAsXml(mediaPackage), repository, StringUtils.join(downloadElementIds, SEPARATOR), StringUtils.join(streamingElementIds, SEPARATOR), Boolean.toString(checkAvailability))); } catch (ServiceRegistryException e) { throw new PublicationException("Unable to create job", e); } }
OaiPmhPublicationServiceImpl extends AbstractJobProducer implements OaiPmhPublicationService { @Override public Job publish(MediaPackage mediaPackage, String repository, Set<String> downloadElementIds, Set<String> streamingElementIds, boolean checkAvailability) throws PublicationException, MediaPackageException { checkInputArguments(mediaPackage, repository); try { return serviceRegistry.createJob(JOB_TYPE, Operation.Publish.toString(), Arrays.asList(MediaPackageParser.getAsXml(mediaPackage), repository, StringUtils.join(downloadElementIds, SEPARATOR), StringUtils.join(streamingElementIds, SEPARATOR), Boolean.toString(checkAvailability))); } catch (ServiceRegistryException e) { throw new PublicationException("Unable to create job", e); } } }
OaiPmhPublicationServiceImpl extends AbstractJobProducer implements OaiPmhPublicationService { @Override public Job publish(MediaPackage mediaPackage, String repository, Set<String> downloadElementIds, Set<String> streamingElementIds, boolean checkAvailability) throws PublicationException, MediaPackageException { checkInputArguments(mediaPackage, repository); try { return serviceRegistry.createJob(JOB_TYPE, Operation.Publish.toString(), Arrays.asList(MediaPackageParser.getAsXml(mediaPackage), repository, StringUtils.join(downloadElementIds, SEPARATOR), StringUtils.join(streamingElementIds, SEPARATOR), Boolean.toString(checkAvailability))); } catch (ServiceRegistryException e) { throw new PublicationException("Unable to create job", e); } } OaiPmhPublicationServiceImpl(); }
OaiPmhPublicationServiceImpl extends AbstractJobProducer implements OaiPmhPublicationService { @Override public Job publish(MediaPackage mediaPackage, String repository, Set<String> downloadElementIds, Set<String> streamingElementIds, boolean checkAvailability) throws PublicationException, MediaPackageException { checkInputArguments(mediaPackage, repository); try { return serviceRegistry.createJob(JOB_TYPE, Operation.Publish.toString(), Arrays.asList(MediaPackageParser.getAsXml(mediaPackage), repository, StringUtils.join(downloadElementIds, SEPARATOR), StringUtils.join(streamingElementIds, SEPARATOR), Boolean.toString(checkAvailability))); } catch (ServiceRegistryException e) { throw new PublicationException("Unable to create job", e); } } OaiPmhPublicationServiceImpl(); @Override Job replace(MediaPackage mediaPackage, String repository, Set<? extends MediaPackageElement> downloadElements,
         Set<? extends MediaPackageElement> streamingElements, Set<MediaPackageElementFlavor> retractDownloadFlavors,
         Set<MediaPackageElementFlavor> retractStreamingFlavors, Set<? extends Publication> publications,
         boolean checkAvailability); @Override Publication replaceSync(
      MediaPackage mediaPackage, String repository, Set<? extends MediaPackageElement> downloadElements,
      Set<? extends MediaPackageElement> streamingElements, Set<MediaPackageElementFlavor> retractDownloadFlavors,
      Set<MediaPackageElementFlavor> retractStreamingFlavors, Set<? extends Publication> publications,
      boolean checkAvailability); @Override Job publish(MediaPackage mediaPackage, String repository, Set<String> downloadElementIds,
          Set<String> streamingElementIds, boolean checkAvailability); @Override Job retract(MediaPackage mediaPackage, String repository); @Override Job updateMetadata(MediaPackage mediaPackage, String repository, Set<String> flavors, Set<String> tags,
          boolean checkAvailability); static MediaPackage removeMatchingNonExistantElements(MediaPackage updatedMp, MediaPackage publishedMp,
          Set<MediaPackageElementFlavor> flavors, Set<String> tags); static MediaPackage merge(MediaPackage updatedMp, MediaPackage publishedMp); void setServiceRegistry(ServiceRegistry serviceRegistry); void setSecurityService(SecurityService securityService); void setUserDirectoryService(UserDirectoryService userDirectoryService); void setOrganizationDirectoryService(OrganizationDirectoryService organizationDirectoryService); void setDownloadDistributionService(DownloadDistributionService downloadDistributionService); void setStreamingDistributionService(StreamingDistributionService streamingDistributionService); void setOaiPmhServerInfo(OaiPmhServerInfo oaiPmhServerInfo); void setOaiPmhDatabase(OaiPmhDatabase oaiPmhDatabase); }
OaiPmhPublicationServiceImpl extends AbstractJobProducer implements OaiPmhPublicationService { @Override public Job publish(MediaPackage mediaPackage, String repository, Set<String> downloadElementIds, Set<String> streamingElementIds, boolean checkAvailability) throws PublicationException, MediaPackageException { checkInputArguments(mediaPackage, repository); try { return serviceRegistry.createJob(JOB_TYPE, Operation.Publish.toString(), Arrays.asList(MediaPackageParser.getAsXml(mediaPackage), repository, StringUtils.join(downloadElementIds, SEPARATOR), StringUtils.join(streamingElementIds, SEPARATOR), Boolean.toString(checkAvailability))); } catch (ServiceRegistryException e) { throw new PublicationException("Unable to create job", e); } } OaiPmhPublicationServiceImpl(); @Override Job replace(MediaPackage mediaPackage, String repository, Set<? extends MediaPackageElement> downloadElements,
         Set<? extends MediaPackageElement> streamingElements, Set<MediaPackageElementFlavor> retractDownloadFlavors,
         Set<MediaPackageElementFlavor> retractStreamingFlavors, Set<? extends Publication> publications,
         boolean checkAvailability); @Override Publication replaceSync(
      MediaPackage mediaPackage, String repository, Set<? extends MediaPackageElement> downloadElements,
      Set<? extends MediaPackageElement> streamingElements, Set<MediaPackageElementFlavor> retractDownloadFlavors,
      Set<MediaPackageElementFlavor> retractStreamingFlavors, Set<? extends Publication> publications,
      boolean checkAvailability); @Override Job publish(MediaPackage mediaPackage, String repository, Set<String> downloadElementIds,
          Set<String> streamingElementIds, boolean checkAvailability); @Override Job retract(MediaPackage mediaPackage, String repository); @Override Job updateMetadata(MediaPackage mediaPackage, String repository, Set<String> flavors, Set<String> tags,
          boolean checkAvailability); static MediaPackage removeMatchingNonExistantElements(MediaPackage updatedMp, MediaPackage publishedMp,
          Set<MediaPackageElementFlavor> flavors, Set<String> tags); static MediaPackage merge(MediaPackage updatedMp, MediaPackage publishedMp); void setServiceRegistry(ServiceRegistry serviceRegistry); void setSecurityService(SecurityService securityService); void setUserDirectoryService(UserDirectoryService userDirectoryService); void setOrganizationDirectoryService(OrganizationDirectoryService organizationDirectoryService); void setDownloadDistributionService(DownloadDistributionService downloadDistributionService); void setStreamingDistributionService(StreamingDistributionService streamingDistributionService); void setOaiPmhServerInfo(OaiPmhServerInfo oaiPmhServerInfo); void setOaiPmhDatabase(OaiPmhDatabase oaiPmhDatabase);  }