SeriesServiceImpl extends AbstractIndexProducer implements SeriesService { public static boolean equals(DublinCoreCatalog a, DublinCoreCatalog b) { final Map<EName, List<DublinCoreValue>> av = a.getValues(); final Map<EName, List<DublinCoreValue>> bv = b.getValues(); if (av.size() == bv.size()) { for (Map.Entry<EName, List<DublinCoreValue>> ave : av.entrySet()) { if (!eqListSorted(ave.getValue(), bv.get(ave.getKey()))) return false; } return true; } else { return false; } }  @Reference(name = "series-index") void setIndex(SeriesServiceIndex index); @Reference(name = "series-persistence") void setPersistence(SeriesServiceDatabase persistence); @Reference(name = "security-service") void setSecurityService(SecurityService securityService); @Reference(name = "orgDirectory") void setOrgDirectory(OrganizationDirectoryService orgDirectory); @Reference(name = "message-broker-sender") void setMessageSender(MessageSender messageSender); @Reference(name = "message-broker-receiver") void setMessageReceiver(MessageReceiver messageReceiver); @Activate void activate(ComponentContext cc); @Deactivate void deactivate(); @Override DublinCoreCatalog updateSeries(DublinCoreCatalog dc); @Override boolean updateAccessControl(final String seriesId, final AccessControlList accessControl); @Override boolean updateAccessControl(final String seriesId, final AccessControlList accessControl,
          boolean overrideEpisodeAcl); @Override void deleteSeries(final String seriesID); @Override DublinCoreCatalogList getSeries(SeriesQuery query); @Override Map<String, String> getIdTitleMapOfAllSeries(); @Override DublinCoreCatalog getSeries(String seriesID); @Override AccessControlList getSeriesAccessControl(String seriesID); @Override int getSeriesCount(); @Override Map<String, String> getSeriesProperties(String seriesID); @Override String getSeriesProperty(String seriesID, String propertyName); @Override void updateSeriesProperty(String seriesID, String propertyName, String propertyValue); @Override void deleteSeriesProperty(String seriesID, String propertyName); static boolean equals(DublinCoreCatalog a, DublinCoreCatalog b); static boolean equals(AccessControlList a, AccessControlList b); @Override Opt<Map<String, byte[]>> getSeriesElements(String seriesId); @Override Opt<byte[]> getSeriesElementData(String seriesId, String type); @Override boolean addSeriesElement(String seriesID, String type, byte[] data); @Override boolean updateSeriesElement(String seriesID, String type, byte[] data); @Override boolean deleteSeriesElement(String seriesID, String type); @Override void repopulate(final String indexName); @Override MessageReceiver getMessageReceiver(); @Override Service getService(); @Override String getClassName(); @Override MessageSender getMessageSender(); @Override SecurityService getSecurityService(); @Override String getSystemUserName();  }
@Test public void testDublinCoreCatalogEquality1() { DublinCoreCatalog a = DublinCores.mkOpencast().getCatalog(); DublinCoreCatalog b = DublinCores.mkOpencast().getCatalog(); a.set(DublinCore.PROPERTY_IDENTIFIER, "123"); assertFalse(DublinCoreUtil.equals(a, b)); b.set(DublinCore.PROPERTY_IDENTIFIER, "123"); assertTrue(DublinCoreUtil.equals(a, b)); a.set(DublinCore.PROPERTY_CONTRIBUTOR, list(DublinCoreValue.mk("Peter"), DublinCoreValue.mk("Paul"))); b.set(DublinCore.PROPERTY_CONTRIBUTOR, list(DublinCoreValue.mk("Paul"), DublinCoreValue.mk("Peter"))); assertFalse(DublinCoreUtil.equals(a, b)); b.set(DublinCore.PROPERTY_CONTRIBUTOR, list(DublinCoreValue.mk("Peter"), DublinCoreValue.mk("Paul"))); assertTrue(DublinCoreUtil.equals(a, b)); a.set(DublinCore.PROPERTY_SPATIAL, "room1"); a.set(DublinCore.PROPERTY_DESCRIPTION, "this is a test lecture"); b.set(DublinCore.PROPERTY_DESCRIPTION, "this is a test lecture"); b.set(DublinCore.PROPERTY_SPATIAL, "room1"); assertTrue(DublinCoreUtil.equals(a, b)); }
@Test public void testDublinCoreCatalogEquality2() { DublinCoreCatalog a = DublinCores.mkOpencast().getCatalog(); DublinCoreCatalog b = DublinCores.mkOpencast().getCatalog(); a.set(DublinCore.PROPERTY_DESCRIPTION, "this is a test lecture"); a.set(DublinCore.PROPERTY_SPATIAL, "room1"); a.set(DublinCore.PROPERTY_IDENTIFIER, "123"); a.set(DublinCore.PROPERTY_CONTRIBUTOR, list(DublinCoreValue.mk("Peter"), DublinCoreValue.mk("Paul"))); b.set(DublinCore.PROPERTY_CONTRIBUTOR, list(DublinCoreValue.mk("Peter"), DublinCoreValue.mk("Paul"))); b.set(DublinCore.PROPERTY_DESCRIPTION, "this is a test lecture"); b.set(DublinCore.PROPERTY_SPATIAL, "room1"); b.set(DublinCore.PROPERTY_IDENTIFIER, "123"); assertTrue(DublinCoreUtil.equals(a, b)); }
@Test public void testACLEquality1() { AccessControlList a = new AccessControlList(new AccessControlEntry("a", Permissions.Action.READ.toString(), true), new AccessControlEntry("b", Permissions.Action.WRITE.toString(), false)); AccessControlList b = new AccessControlList(new AccessControlEntry("b", Permissions.Action.WRITE.toString(), false), new AccessControlEntry("a", Permissions.Action.READ.toString(), true)); assertTrue(AccessControlUtil.equals(a, b)); }
@Test public void testACLEquality2() { AccessControlList a = new AccessControlList(); AccessControlList b = new AccessControlList(); assertTrue(AccessControlUtil.equals(a, b)); }
@Test public void testACLEquality3() { AccessControlList a = new AccessControlList(); AccessControlList b = new AccessControlList( new AccessControlEntry("b", Permissions.Action.WRITE.toString(), false)); assertFalse(AccessControlUtil.equals(a, b)); }
@Test public void testACLEquality4() { AccessControlList a = new AccessControlList( new AccessControlEntry("b", Permissions.Action.WRITE.toString(), false)); AccessControlList b = new AccessControlList(new AccessControlEntry("b", Permissions.Action.WRITE.toString(), false), new AccessControlEntry("b", Permissions.Action.READ.toString(), false)); assertFalse(AccessControlUtil.equals(a, b)); }
@Test public void testACLEquality5() { AccessControlList a = new AccessControlList( new AccessControlEntry("a", Permissions.Action.WRITE.toString(), false), new AccessControlEntry("a", Permissions.Action.WRITE.toString(), false)); AccessControlList b = new AccessControlList( new AccessControlEntry("a", Permissions.Action.WRITE.toString(), false), new AccessControlEntry("b", Permissions.Action.READ.toString(), false)); assertFalse(AccessControlUtil.equals(a, b)); }
@Test public void testACLEquality6() { AccessControlList a = new AccessControlList( new AccessControlEntry("a", Permissions.Action.WRITE.toString(), false), new AccessControlEntry("a", Permissions.Action.WRITE.toString(), false), new AccessControlEntry("b", Permissions.Action.READ.toString(), true)); AccessControlList b = new AccessControlList( new AccessControlEntry("a", Permissions.Action.WRITE.toString(), false), new AccessControlEntry("b", Permissions.Action.READ.toString(), true)); assertTrue(AccessControlUtil.equals(a, b)); }
@Test public void testACLEquality7() { AccessControlList a = new AccessControlList( new AccessControlEntry("a", Permissions.Action.WRITE.toString(), false), new AccessControlEntry("a", Permissions.Action.WRITE.toString(), true), new AccessControlEntry("b", Permissions.Action.READ.toString(), true)); AccessControlList b = new AccessControlList( new AccessControlEntry("a", Permissions.Action.WRITE.toString(), false), new AccessControlEntry("b", Permissions.Action.READ.toString(), true)); assertFalse(AccessControlUtil.equals(a, b)); }