@Test public void testUpdateMetadata() throws PublicationException, ServiceRegistryException, MediaPackageException { 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.UpdateMetadata.toString()), capture(jobArgsCapture))).andReturn(dummyJob).once(); EasyMock.replay(serviceRegistry); service.setServiceRegistry(serviceRegistry); Set<String> flavorsSet = Collections.set("dublincore/*", "security/*"); Set<String> tagsSet = Collections.set("archive", "other"); Job j = service.updateMetadata(mp, "default", flavorsSet, tagsSet, 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)); Assert.assertEquals(StringUtils.join(flavorsSet, OaiPmhPublicationServiceImpl.SEPARATOR), jobArgs.get(2)); Assert.assertEquals(StringUtils.join(tagsSet, OaiPmhPublicationServiceImpl.SEPARATOR), jobArgs.get(3)); Assert.assertTrue(Boolean.valueOf(jobArgs.get(4))); }
@Override public Job updateMetadata(MediaPackage mediaPackage, String repository, Set<String> flavors, Set<String> tags, boolean checkAvailability) throws PublicationException, MediaPackageException { checkInputArguments(mediaPackage, repository); if ((flavors == null || flavors.isEmpty()) && (tags == null || tags.isEmpty())) throw new IllegalArgumentException("Flavors or tags must be set"); try { return serviceRegistry.createJob(JOB_TYPE, Operation.UpdateMetadata.toString(), Arrays.asList(MediaPackageParser.getAsXml(mediaPackage), repository, StringUtils.join(flavors, SEPARATOR), StringUtils.join(tags, SEPARATOR), Boolean.toString(checkAvailability))); } catch (ServiceRegistryException e) { throw new PublicationException("Unable to create job", e); } }
OaiPmhPublicationServiceImpl extends AbstractJobProducer implements OaiPmhPublicationService { @Override public Job updateMetadata(MediaPackage mediaPackage, String repository, Set<String> flavors, Set<String> tags, boolean checkAvailability) throws PublicationException, MediaPackageException { checkInputArguments(mediaPackage, repository); if ((flavors == null || flavors.isEmpty()) && (tags == null || tags.isEmpty())) throw new IllegalArgumentException("Flavors or tags must be set"); try { return serviceRegistry.createJob(JOB_TYPE, Operation.UpdateMetadata.toString(), Arrays.asList(MediaPackageParser.getAsXml(mediaPackage), repository, StringUtils.join(flavors, SEPARATOR), StringUtils.join(tags, SEPARATOR), Boolean.toString(checkAvailability))); } catch (ServiceRegistryException e) { throw new PublicationException("Unable to create job", e); } } }
OaiPmhPublicationServiceImpl extends AbstractJobProducer implements OaiPmhPublicationService { @Override public Job updateMetadata(MediaPackage mediaPackage, String repository, Set<String> flavors, Set<String> tags, boolean checkAvailability) throws PublicationException, MediaPackageException { checkInputArguments(mediaPackage, repository); if ((flavors == null || flavors.isEmpty()) && (tags == null || tags.isEmpty())) throw new IllegalArgumentException("Flavors or tags must be set"); try { return serviceRegistry.createJob(JOB_TYPE, Operation.UpdateMetadata.toString(), Arrays.asList(MediaPackageParser.getAsXml(mediaPackage), repository, StringUtils.join(flavors, SEPARATOR), StringUtils.join(tags, SEPARATOR), Boolean.toString(checkAvailability))); } catch (ServiceRegistryException e) { throw new PublicationException("Unable to create job", e); } } OaiPmhPublicationServiceImpl(); }
OaiPmhPublicationServiceImpl extends AbstractJobProducer implements OaiPmhPublicationService { @Override public Job updateMetadata(MediaPackage mediaPackage, String repository, Set<String> flavors, Set<String> tags, boolean checkAvailability) throws PublicationException, MediaPackageException { checkInputArguments(mediaPackage, repository); if ((flavors == null || flavors.isEmpty()) && (tags == null || tags.isEmpty())) throw new IllegalArgumentException("Flavors or tags must be set"); try { return serviceRegistry.createJob(JOB_TYPE, Operation.UpdateMetadata.toString(), Arrays.asList(MediaPackageParser.getAsXml(mediaPackage), repository, StringUtils.join(flavors, SEPARATOR), StringUtils.join(tags, 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 updateMetadata(MediaPackage mediaPackage, String repository, Set<String> flavors, Set<String> tags, boolean checkAvailability) throws PublicationException, MediaPackageException { checkInputArguments(mediaPackage, repository); if ((flavors == null || flavors.isEmpty()) && (tags == null || tags.isEmpty())) throw new IllegalArgumentException("Flavors or tags must be set"); try { return serviceRegistry.createJob(JOB_TYPE, Operation.UpdateMetadata.toString(), Arrays.asList(MediaPackageParser.getAsXml(mediaPackage), repository, StringUtils.join(flavors, SEPARATOR), StringUtils.join(tags, 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);  }