Query query;
ContentSourceManagerLocal contentSourceManagerLocal = LookupUtil.getContentSourceManager();
RepoManagerLocal repoManager = LookupUtil.getRepoManagerLocal();
DistributionManagerLocal distroManager = LookupUtil.getDistributionManagerLocal();
SubjectManagerLocal subjectManager = LookupUtil.getSubjectManager();
Subject overlord = subjectManager.getOverlord();
// Delete all distributions
distroManager.deleteDistributionMappingsForRepo(overlord, repoToSync.getId());
for (String distroLabel : TestContentProvider.DISTRIBUTIONS.keySet()) {
Distribution distro = distroManager.getDistributionByLabel(distroLabel);
if (distro != null) {
// Delete the files
query = entityManager.createNamedQuery(DistributionFile.DELETE_BY_DIST_ID);
query.setParameter("distId", distro.getId());
query.executeUpdate();
// Delete the actual distro
distroManager.deleteDistributionByDistId(overlord, distro.getId());
}
}
// Delete all package version <-> content source mappings
for (ContentSource source : repoContentSources) {