// transaction at the end.
TransactionManager tx = getTransactionManager();
tx.begin();
EntityManager entityManager = getEntityManager();
ContentSourceManagerLocal contentManager = LookupUtil.getContentSourceManager();
RepoManagerLocal repoManager = LookupUtil.getRepoManagerLocal();
SubjectManagerLocal subjectManager = LookupUtil.getSubjectManager();
Subject overlord = subjectManager.getOverlord();
// Create a sample content source type that will be used in this test
testSourceType = new ContentSourceType("testType");
entityManager.persist(testSourceType);
entityManager.flush();
//need to actually commit the tx so that the subsequent code can see the new entry in
//the database
tx.commit();
tx.begin();
//new entity manager associated with the new tx
entityManager = getEntityManager();
// Add a content source to sync in this test
syncSource = new ContentSource("testSource1", testSourceType);
contentManager.simpleCreateContentSource(overlord, syncSource);
entityManager.flush();
// Add an extra content source that isn't being syncced
nonSyncSource = new ContentSource("testSource2", testSourceType);
contentManager.simpleCreateContentSource(overlord, nonSyncSource);
entityManager.flush();
// Add existing repo against other source (this shouldn't show up in the request for packages)
nonCandidateOnOtherSource = new Repo("nonCandidateOnOtherSource");
nonCandidateOnOtherSource.setCandidate(false);