modules/core/domain/src/test/java/org/rhq/core/domain/test/AbstractEJB3Test.java | 5
modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/content/test/RepoManagerBeanTest.java | 714 +++++-----
modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3Test.java | 226 +--
3 files changed, 469 insertions(+), 476 deletions(-)
New commits:
commit 79c592d4c907d2d499ced9b0270e266169d6c5e2
Author: Jay Shaughnessy <jshaughn(a)jshaughn.csb>
Date: Wed Oct 31 15:04:44 2012 -0400
First test class passing (RepoManagerBeanTest)
- Clean up and add comments to AbstractEJB3Test
- Convert tests to use executeInTransaction (although this isn't required
but it's cleaner).
- Tweak domain version of AbstractEJB3Test to avoid Class.forName, which
is susceptible to NoClassDefFound issues
diff --git a/modules/core/domain/src/test/java/org/rhq/core/domain/test/AbstractEJB3Test.java b/modules/core/domain/src/test/java/org/rhq/core/domain/test/AbstractEJB3Test.java
index a83b0ef..d0942b1 100644
--- a/modules/core/domain/src/test/java/org/rhq/core/domain/test/AbstractEJB3Test.java
+++ b/modules/core/domain/src/test/java/org/rhq/core/domain/test/AbstractEJB3Test.java
@@ -194,8 +194,7 @@ public abstract class AbstractEJB3Test extends Arquillian {
} else if (fileName.endsWith(".class")) {
int dot = fileName.indexOf('.');
try {
- Class<?> clazz = Class.forName(packageName + "." + fileName.substring(0, dot));
- archive.addClasses(clazz);
+ archive.addClass(packageName + "." + fileName.substring(0, dot));
} catch (Exception e) {
System.out.println("WARN: Could not add class:" + e);
}
@@ -267,7 +266,7 @@ public abstract class AbstractEJB3Test extends Arquillian {
}
protected InitialContext getInitialContext() {
- // may be null if not yet injected (as of 1.0.1.Final, only injected inside @Test)
+ // may be null if not yet injected
if (null != initialContext) {
return initialContext;
}
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/content/test/RepoManagerBeanTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/content/test/RepoManagerBeanTest.java
index 76c6686..361007c 100644
--- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/content/test/RepoManagerBeanTest.java
+++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/content/test/RepoManagerBeanTest.java
@@ -52,59 +52,36 @@ import org.rhq.enterprise.server.util.LookupUtil;
public class RepoManagerBeanTest extends AbstractEJB3Test {
- private final static boolean ENABLED = false;
+ private final static boolean ENABLED = true;
- //@Inject
- protected RepoManagerLocal repoManager;
- //@Inject
+ protected RepoManagerLocal repoManager;
protected ContentSourceManagerLocal contentSourceManager;
-
- //@Inject
protected ContentSourceMetadataManagerLocal contentSourceMetadataManager;
+ protected SubjectManagerLocal subjectManager;
private Subject overlord;
- //@Inject
- protected SubjectManagerLocal subjectManager;
-
@Override
public void beforeMethod() throws Exception {
- System.out.println("*** 0");
-
overlord = LookupUtil.getSubjectManager().getOverlord();
- System.out.println("*** 1");
prepareScheduler();
- System.out.println("*** 2");
repoManager = LookupUtil.getRepoManagerLocal();
- System.out.println("*** 3");
contentSourceManager = LookupUtil.getContentSourceManager();
- System.out.println("*** 4");
contentSourceMetadataManager = LookupUtil.getContentSourceMetadataManager();
- System.out.println("*** 5");
// start mock plugin container
@SuppressWarnings("unused")
TestContentServerPluginService pluginService = new TestContentServerPluginService(this);
- //getTransactionManager().begin();
- //System.out.println("*** 6");
}
@Override
public void afterMethod() throws Exception {
- System.out.println("*** 7");
unprepareServerPluginService();
-
- System.out.println("*** 8");
unprepareScheduler();
-
- System.out.println("*** 9");
- //getTransactionManager().rollback();
- //System.out.println("*** 10");
}
- @Test
- // (enabled = ENABLED)
+ @Test(enabled = ENABLED)
public void createABunchOfRepos() throws Exception {
executeInTransaction(new TransactionCallback() {
@@ -128,395 +105,464 @@ public class RepoManagerBeanTest extends AbstractEJB3Test {
@Test(enabled = ENABLED)
public void createDeleteRepo() throws Exception {
- Repo repo = new Repo("testCreateDeleteRepo");
- int id = repoManager.createRepo(overlord, repo).getId();
- Repo lookedUp = repoManager.getRepo(overlord, id);
- assert lookedUp != null;
- Repo lookedUp2 = repoManager.getRepoByName(lookedUp.getName()).get(0);
- assert lookedUp2 != null;
- assert id == lookedUp.getId();
- assert id == lookedUp2.getId();
-
- repoManager.deleteRepo(overlord, id);
- lookedUp = repoManager.getRepo(overlord, id);
- assert lookedUp == null;
+ executeInTransaction(new TransactionCallback() {
+
+ public void execute() throws Exception {
+
+ Repo repo = new Repo("testCreateDeleteRepo");
+ int id = repoManager.createRepo(overlord, repo).getId();
+ Repo lookedUp = repoManager.getRepo(overlord, id);
+ assert lookedUp != null;
+ Repo lookedUp2 = repoManager.getRepoByName(lookedUp.getName()).get(0);
+ assert lookedUp2 != null;
+ assert id == lookedUp.getId();
+ assert id == lookedUp2.getId();
+
+ repoManager.deleteRepo(overlord, id);
+ lookedUp = repoManager.getRepo(overlord, id);
+ assert lookedUp == null;
+ }
+ });
}
@Test(enabled = ENABLED)
public void createDeleteRepoGroup() throws Exception {
- // Setup
- EntityManager entityManager = getEntityManager();
-
- RepoGroupType groupType = new RepoGroupType("testCreateDeleteRepoGroupType");
- entityManager.persist(groupType);
- entityManager.flush();
-
- String groupName = "testCreateDeleteRepoGroup";
- RepoGroup group = repoManager.getRepoGroupByName(groupName);
- assert group == null;
-
- // Test
- group = new RepoGroup(groupName);
- group.setRepoGroupType(groupType);
- group = repoManager.createRepoGroup(overlord, group);
-
- // Verify
- int id = group.getId();
- group = repoManager.getRepoGroup(overlord, id);
- assert group != null;
- assert group.getName().equals(groupName);
-
- // Cleanup
- repoManager.deleteRepoGroup(overlord, id);
- group = repoManager.getRepoGroup(overlord, id);
- assert group == null;
-
- entityManager.remove(groupType);
+ executeInTransaction(new TransactionCallback() {
+
+ public void execute() throws Exception {
+
+ EntityManager entityManager = getEntityManager();
+
+ RepoGroupType groupType = new RepoGroupType("testCreateDeleteRepoGroupType");
+ entityManager.persist(groupType);
+ entityManager.flush();
+
+ String groupName = "testCreateDeleteRepoGroup";
+ RepoGroup group = repoManager.getRepoGroupByName(groupName);
+ assert group == null;
+
+ // Test
+ group = new RepoGroup(groupName);
+ group.setRepoGroupType(groupType);
+ group = repoManager.createRepoGroup(overlord, group);
+
+ // Verify
+ int id = group.getId();
+ group = repoManager.getRepoGroup(overlord, id);
+ assert group != null;
+ assert group.getName().equals(groupName);
+
+ // Cleanup
+ repoManager.deleteRepoGroup(overlord, id);
+ group = repoManager.getRepoGroup(overlord, id);
+ assert group == null;
+
+ entityManager.remove(groupType);
+
+ }
+ });
}
@Test(enabled = ENABLED)
public void createFindDeleteCandidateRepo() throws Exception {
- // Setup
- Repo repo = new Repo("test create candidate repo");
-
- PageList<Repo> importedRepos = repoManager.findRepos(overlord, new PageControl());
- int origSize = 0;
- if (importedRepos != null) {
- origSize = importedRepos.size();
- }
-
- // Test
- repo.setCandidate(true);
- repo = repoManager.createRepo(overlord, repo);
-
- // Verify
- try {
- assert repo.isCandidate();
-
- // Should not be returned from this call since it's a candidate repo
- importedRepos = repoManager.findRepos(overlord, new PageControl());
- assert importedRepos.size() == origSize;
- assert repoManager.getRepo(overlord, repo.getId()) != null;
- } finally {
- repoManager.deleteRepo(overlord, repo.getId());
- }
+ executeInTransaction(new TransactionCallback() {
+
+ public void execute() throws Exception {
+
+ Repo repo = new Repo("test create candidate repo");
+
+ PageList<Repo> importedRepos = repoManager.findRepos(overlord, new PageControl());
+ int origSize = 0;
+ if (importedRepos != null) {
+ origSize = importedRepos.size();
+ }
+
+ // Test
+ repo.setCandidate(true);
+ repo = repoManager.createRepo(overlord, repo);
+
+ // Verify
+ try {
+ assert repo.isCandidate();
+
+ // Should not be returned from this call since it's a candidate repo
+ importedRepos = repoManager.findRepos(overlord, new PageControl());
+ assert importedRepos.size() == origSize;
+ assert repoManager.getRepo(overlord, repo.getId()) != null;
+ } finally {
+ repoManager.deleteRepo(overlord, repo.getId());
+ }
+ }
+ });
}
@Test(enabled = ENABLED)
public void createDuplicateRepoGroup() throws Exception {
- // Setup
- EntityManager entityManager = getEntityManager();
+ executeInTransaction(new TransactionCallback() {
+
+ public void execute() throws Exception {
- RepoGroupType groupType = new RepoGroupType("testCreateDuplicateRepoGroup");
- entityManager.persist(groupType);
- entityManager.flush();
+ EntityManager entityManager = getEntityManager();
- String groupName = "testCreateDuplicateRepoGroup";
+ RepoGroupType groupType = new RepoGroupType("testCreateDuplicateRepoGroup");
+ entityManager.persist(groupType);
+ entityManager.flush();
- RepoGroup existing = new RepoGroup(groupName);
- existing.setRepoGroupType(groupType);
- repoManager.createRepoGroup(overlord, existing);
+ String groupName = "testCreateDuplicateRepoGroup";
- existing = repoManager.getRepoGroupByName(groupName);
- assert existing != null;
+ RepoGroup existing = new RepoGroup(groupName);
+ existing.setRepoGroupType(groupType);
+ repoManager.createRepoGroup(overlord, existing);
- // Test
- RepoGroup duplicate = new RepoGroup(groupName);
- duplicate.setRepoGroupType(groupType);
+ existing = repoManager.getRepoGroupByName(groupName);
+ assert existing != null;
- try {
- repoManager.createRepoGroup(overlord, existing);
- assert false;
- } catch (RepoException e) {
- // Expected
- }
+ // Test
+ RepoGroup duplicate = new RepoGroup(groupName);
+ duplicate.setRepoGroupType(groupType);
- // Cleanup
- repoManager.deleteRepoGroup(overlord, existing.getId());
- existing = repoManager.getRepoGroup(overlord, existing.getId());
- assert existing == null;
+ try {
+ repoManager.createRepoGroup(overlord, existing);
+ assert false;
+ } catch (RepoException e) {
+ // Expected
+ }
+
+ // Cleanup
+ repoManager.deleteRepoGroup(overlord, existing.getId());
+ existing = repoManager.getRepoGroup(overlord, existing.getId());
+ assert existing == null;
- entityManager.remove(groupType);
+ entityManager.remove(groupType);
+
+ }
+ });
}
@Test(enabled = ENABLED)
public void getRepoGroupByNameNoGroup() throws Exception {
- // Test
- RepoGroup group = repoManager.getRepoGroupByName("foo");
+ executeInTransaction(new TransactionCallback() {
+
+ public void execute() throws Exception {
- assert group == null;
+ RepoGroup group = repoManager.getRepoGroupByName("foo");
+
+ assert group == null;
+ }
+ });
}
@Test(enabled = ENABLED)
public void getRepoGroupTypeByName() throws Exception {
- // Setup
- EntityManager entityManager = getEntityManager();
- String name = "test-repo-type";
-
- RepoGroupType groupType = new RepoGroupType(name);
- entityManager.persist(groupType);
- entityManager.flush();
-
- // Test
- RepoGroupType type = repoManager.getRepoGroupTypeByName(overlord, name);
- assert type != null;
- assert type.getName().equals(name);
-
- // Cleanup
- type = entityManager.find(RepoGroupType.class, type.getId());
- entityManager.remove(type);
- entityManager.flush();
+ executeInTransaction(new TransactionCallback() {
+
+ public void execute() throws Exception {
+
+ EntityManager entityManager = getEntityManager();
+ String name = "test-repo-type";
+
+ RepoGroupType groupType = new RepoGroupType(name);
+ entityManager.persist(groupType);
+ entityManager.flush();
+
+ // Test
+ RepoGroupType type = repoManager.getRepoGroupTypeByName(overlord, name);
+ assert type != null;
+ assert type.getName().equals(name);
+
+ // Cleanup
+ type = entityManager.find(RepoGroupType.class, type.getId());
+ entityManager.remove(type);
+ entityManager.flush();
+ }
+ });
}
@Test(enabled = ENABLED)
public void addRepoRelationship() throws Exception {
- // Setup
- EntityManager entityManager = getEntityManager();
+ executeInTransaction(new TransactionCallback() {
+
+ public void execute() throws Exception {
- Repo repo = new Repo("repo1");
- Repo relatedRepo = new Repo("repo2");
+ EntityManager entityManager = getEntityManager();
- repo = repoManager.createRepo(overlord, repo);
- relatedRepo = repoManager.createRepo(overlord, relatedRepo);
+ Repo repo = new Repo("repo1");
+ Repo relatedRepo = new Repo("repo2");
- String relationshipTypeName = "testRelationshipType";
- RepoRelationshipType relationshipType = new RepoRelationshipType(relationshipTypeName);
- entityManager.persist(relationshipType);
- entityManager.flush();
+ repo = repoManager.createRepo(overlord, repo);
+ relatedRepo = repoManager.createRepo(overlord, relatedRepo);
- // Test
- repoManager.addRepoRelationship(overlord, repo.getId(), relatedRepo.getId(), relationshipTypeName);
+ String relationshipTypeName = "testRelationshipType";
+ RepoRelationshipType relationshipType = new RepoRelationshipType(relationshipTypeName);
+ entityManager.persist(relationshipType);
+ entityManager.flush();
- // Verify
- RepoCriteria repoCriteria = new RepoCriteria();
- repoCriteria.fetchRepoRepoGroups(true);
- repoCriteria.addFilterId(repo.getId());
+ // Test
+ repoManager.addRepoRelationship(overlord, repo.getId(), relatedRepo.getId(), relationshipTypeName);
- PageList<Repo> repoPageList = repoManager.findReposByCriteria(overlord, repoCriteria);
- assert repoPageList.size() == 1;
+ // Verify
+ RepoCriteria repoCriteria = new RepoCriteria();
+ repoCriteria.fetchRepoRepoGroups(true);
+ repoCriteria.addFilterId(repo.getId());
- Repo persistedRepo = repoPageList.get(0);
- Set<RepoRepoRelationship> relationships = persistedRepo.getRepoRepoRelationships();
- assert relationships.size() == 1;
+ PageList<Repo> repoPageList = repoManager.findReposByCriteria(overlord, repoCriteria);
+ assert repoPageList.size() == 1;
- RepoRepoRelationship relationship = relationships.iterator().next();
- assert relationship.getRepoRepoRelationshipPK().getRepo().getName().equals("repo1");
- assert relationship.getRepoRepoRelationshipPK().getRepoRelationship().getRelatedRepo().getName()
- .equals("repo2");
- assert relationship.getRepoRepoRelationshipPK().getRepoRelationship().getRepoRelationshipType().getName()
- .equals(relationshipTypeName);
+ Repo persistedRepo = repoPageList.get(0);
+ Set<RepoRepoRelationship> relationships = persistedRepo.getRepoRepoRelationships();
+ assert relationships.size() == 1;
- // Cleanup handled by rollback in tear down method
+ RepoRepoRelationship relationship = relationships.iterator().next();
+ assert relationship.getRepoRepoRelationshipPK().getRepo().getName().equals("repo1");
+ assert relationship.getRepoRepoRelationshipPK().getRepoRelationship().getRelatedRepo().getName()
+ .equals("repo2");
+ assert relationship.getRepoRepoRelationshipPK().getRepoRelationship().getRepoRelationshipType()
+ .getName().equals(relationshipTypeName);
+ }
+ });
}
@Test(enabled = ENABLED)
public void findCandidatesByContentProvider() throws Exception {
- // Setup
- String candidateRepoName = "candidate with source";
-
- // Create a content source type and a content source
- ContentSourceType type = new ContentSourceType("testGetSyncResultsListCST");
- Set<ContentSourceType> types = new HashSet<ContentSourceType>();
- types.add(type);
- contentSourceMetadataManager.registerTypes(types); // this blows away any previous existing types
- ContentSource contentSource = new ContentSource("testGetSyncResultsListCS", type);
- contentSource = contentSourceManager.simpleCreateContentSource(overlord, contentSource);
-
- // Create an imported (non-candidate) repo associated with the source
- Repo importedRepo = new Repo("imported repo");
- importedRepo.addContentSource(contentSource);
- importedRepo = repoManager.createRepo(overlord, importedRepo);
-
- // Create a candidate repo associated with that source
- Repo candidateRepo = new Repo(candidateRepoName);
- candidateRepo.setCandidate(true);
- candidateRepo.addContentSource(contentSource);
- candidateRepo = repoManager.createRepo(overlord, candidateRepo);
-
- // Test
- RepoCriteria criteria = new RepoCriteria();
- criteria.addFilterCandidate(true);
- criteria.addFilterContentSourceIds(contentSource.getId());
- criteria.fetchRepoContentSources(true);
-
- PageList<Repo> foundRepos = repoManager.findReposByCriteria(overlord, criteria);
-
- // Verify
-
- // Make sure only one of the two repos from above came back
- assert foundRepos.size() == 1;
-
- Repo foundRepo = foundRepos.get(0);
- assert foundRepo.getName().equals(candidateRepoName);
- assert foundRepo.isCandidate();
-
- // Cleanup handled by rollback in tear down method
+ executeInTransaction(new TransactionCallback() {
+
+ public void execute() throws Exception {
+
+ String candidateRepoName = "candidate with source";
+
+ // Create a content source type and a content source
+ ContentSourceType type = new ContentSourceType("testGetSyncResultsListCST");
+ Set<ContentSourceType> types = new HashSet<ContentSourceType>();
+ types.add(type);
+ contentSourceMetadataManager.registerTypes(types); // this blows away any previous existing types
+ ContentSource contentSource = new ContentSource("testGetSyncResultsListCS", type);
+ contentSource = contentSourceManager.simpleCreateContentSource(overlord, contentSource);
+
+ // Create an imported (non-candidate) repo associated with the source
+ Repo importedRepo = new Repo("imported repo");
+ importedRepo.addContentSource(contentSource);
+ importedRepo = repoManager.createRepo(overlord, importedRepo);
+
+ // Create a candidate repo associated with that source
+ Repo candidateRepo = new Repo(candidateRepoName);
+ candidateRepo.setCandidate(true);
+ candidateRepo.addContentSource(contentSource);
+ candidateRepo = repoManager.createRepo(overlord, candidateRepo);
+
+ // Test
+ RepoCriteria criteria = new RepoCriteria();
+ criteria.addFilterCandidate(true);
+ criteria.addFilterContentSourceIds(contentSource.getId());
+ criteria.fetchRepoContentSources(true);
+
+ PageList<Repo> foundRepos = repoManager.findReposByCriteria(overlord, criteria);
+
+ // Verify
+
+ // Make sure only one of the two repos from above came back
+ assert foundRepos.size() == 1;
+
+ Repo foundRepo = foundRepos.get(0);
+ assert foundRepo.getName().equals(candidateRepoName);
+ assert foundRepo.isCandidate();
+
+ }
+ });
}
@Test(enabled = ENABLED)
public void importCandidateRepo() throws Exception {
- // Setup
- Repo candidate = new Repo("create me");
- candidate.setCandidate(true);
- Repo created = repoManager.createRepo(overlord, candidate);
-
- // Test
- List<Integer> repoIds = new ArrayList<Integer>(1);
- repoIds.add(created.getId());
- repoManager.importCandidateRepo(overlord, repoIds);
-
- // Verify
- RepoCriteria repoCriteria = new RepoCriteria();
- repoCriteria.addFilterId(created.getId());
-
- PageList<Repo> repoList = repoManager.findReposByCriteria(overlord, repoCriteria);
- assert repoList.size() == 1;
-
- Repo verify = repoList.get(0);
- assert verify != null;
- assert !verify.isCandidate();
+ executeInTransaction(new TransactionCallback() {
+
+ public void execute() throws Exception {
+
+ Repo candidate = new Repo("create me");
+ candidate.setCandidate(true);
+ Repo created = repoManager.createRepo(overlord, candidate);
+
+ // Test
+ List<Integer> repoIds = new ArrayList<Integer>(1);
+ repoIds.add(created.getId());
+ repoManager.importCandidateRepo(overlord, repoIds);
+
+ // Verify
+ RepoCriteria repoCriteria = new RepoCriteria();
+ repoCriteria.addFilterId(created.getId());
+
+ PageList<Repo> repoList = repoManager.findReposByCriteria(overlord, repoCriteria);
+ assert repoList.size() == 1;
+
+ Repo verify = repoList.get(0);
+ assert verify != null;
+ assert !verify.isCandidate();
+ }
+ });
}
@Test(enabled = ENABLED)
public void importCandidateRepoBadId() throws Exception {
- // Test
- try {
- List<Integer> repoIds = new ArrayList<Integer>(1);
- repoIds.add(12345);
- repoManager.importCandidateRepo(overlord, repoIds);
- assert false;
- } catch (RepoException e) {
- // Expected
- }
+ executeInTransaction(new TransactionCallback() {
+
+ public void execute() throws Exception {
+
+ try {
+ List<Integer> repoIds = new ArrayList<Integer>(1);
+ repoIds.add(12345);
+ repoManager.importCandidateRepo(overlord, repoIds);
+ assert false;
+ } catch (RepoException e) {
+ // Expected
+ }
+ }
+ });
}
@Test(enabled = ENABLED)
public void importNonCandidateRepo() throws Exception {
- // Setup
- Repo nonCandidate = new Repo("create me");
- Repo created = repoManager.createRepo(overlord, nonCandidate);
-
- // Test
- try {
- List<Integer> repoIds = new ArrayList<Integer>(1);
- repoIds.add(created.getId());
- repoManager.importCandidateRepo(overlord, repoIds);
- assert false;
- } catch (RepoException e) {
- // Expected
- }
+ executeInTransaction(new TransactionCallback() {
+
+ public void execute() throws Exception {
+ Repo nonCandidate = new Repo("create me");
+ Repo created = repoManager.createRepo(overlord, nonCandidate);
+
+ // Test
+ try {
+ List<Integer> repoIds = new ArrayList<Integer>(1);
+ repoIds.add(created.getId());
+ repoManager.importCandidateRepo(overlord, repoIds);
+ assert false;
+ } catch (RepoException e) {
+ // Expected
+ }
+ }
+ });
}
@Test(enabled = ENABLED)
public void deleteCandidatesForContentSource() throws Exception {
- // Setup
- ContentSourceType contentSourceType = new ContentSourceType("testSourceType");
- Set<ContentSourceType> types = new HashSet<ContentSourceType>(1);
- types.add(contentSourceType);
- contentSourceMetadataManager.registerTypes(types);
-
- ContentSource source1 = new ContentSource("testSource1", contentSourceType);
- source1 = contentSourceManager.simpleCreateContentSource(overlord, source1);
-
- ContentSource source2 = new ContentSource("testSource2", contentSourceType);
- source2 = contentSourceManager.simpleCreateContentSource(overlord, source2);
-
- // -> Only has source to delete, should be deleted
- Repo repo1 = new Repo("repo1");
- repo1.setCandidate(true);
- repo1.addContentSource(source1);
-
- // -> Has different source, should not be deleted
- Repo repo2 = new Repo("repo2");
- repo2.setCandidate(true);
- repo2.addContentSource(source2);
-
- // -> Has source to delete and another source, should not be deleted
- Repo repo3 = new Repo("repo3");
- repo3.setCandidate(true);
- repo3.addContentSource(source1);
- repo3.addContentSource(source2);
-
- // -> No sources, should not be deleted
- Repo repo4 = new Repo("repo4");
- repo4.setCandidate(true);
-
- repo1 = repoManager.createRepo(overlord, repo1);
- repo2 = repoManager.createRepo(overlord, repo2);
- repo3 = repoManager.createRepo(overlord, repo3);
- repo4 = repoManager.createRepo(overlord, repo4);
-
- // Test
- repoManager.deleteCandidatesWithOnlyContentSource(overlord, source1.getId());
-
- // Verify
- assert repoManager.getRepo(overlord, repo1.getId()) == null;
- assert repoManager.getRepo(overlord, repo2.getId()) != null;
- assert repoManager.getRepo(overlord, repo3.getId()) != null;
- assert repoManager.getRepo(overlord, repo4.getId()) != null;
+ executeInTransaction(new TransactionCallback() {
+
+ public void execute() throws Exception {
+
+ ContentSourceType contentSourceType = new ContentSourceType("testSourceType");
+ Set<ContentSourceType> types = new HashSet<ContentSourceType>(1);
+ types.add(contentSourceType);
+ contentSourceMetadataManager.registerTypes(types);
+
+ ContentSource source1 = new ContentSource("testSource1", contentSourceType);
+ source1 = contentSourceManager.simpleCreateContentSource(overlord, source1);
+
+ ContentSource source2 = new ContentSource("testSource2", contentSourceType);
+ source2 = contentSourceManager.simpleCreateContentSource(overlord, source2);
+
+ // -> Only has source to delete, should be deleted
+ Repo repo1 = new Repo("repo1");
+ repo1.setCandidate(true);
+ repo1.addContentSource(source1);
+
+ // -> Has different source, should not be deleted
+ Repo repo2 = new Repo("repo2");
+ repo2.setCandidate(true);
+ repo2.addContentSource(source2);
+
+ // -> Has source to delete and another source, should not be deleted
+ Repo repo3 = new Repo("repo3");
+ repo3.setCandidate(true);
+ repo3.addContentSource(source1);
+ repo3.addContentSource(source2);
+
+ // -> No sources, should not be deleted
+ Repo repo4 = new Repo("repo4");
+ repo4.setCandidate(true);
+
+ repo1 = repoManager.createRepo(overlord, repo1);
+ repo2 = repoManager.createRepo(overlord, repo2);
+ repo3 = repoManager.createRepo(overlord, repo3);
+ repo4 = repoManager.createRepo(overlord, repo4);
+
+ // Test
+ repoManager.deleteCandidatesWithOnlyContentSource(overlord, source1.getId());
+
+ // Verify
+ assert repoManager.getRepo(overlord, repo1.getId()) == null;
+ assert repoManager.getRepo(overlord, repo2.getId()) != null;
+ assert repoManager.getRepo(overlord, repo3.getId()) != null;
+ assert repoManager.getRepo(overlord, repo4.getId()) != null;
+ }
+ });
}
@Test(enabled = ENABLED)
public void updateRepoWithProvider() throws Exception {
// See BZ 537216 for more details
- // Setup
- String newName = "newRepo-" + RandomStringUtils.randomAlphanumeric(6);
- String oldName = "testRepo-" + RandomStringUtils.randomAlphanumeric(6);
+ executeInTransaction(new TransactionCallback() {
+
+ public void execute() throws Exception {
+
+ String newName = "newRepo-" + RandomStringUtils.randomAlphanumeric(6);
+ String oldName = "testRepo-" + RandomStringUtils.randomAlphanumeric(6);
- ContentSourceType contentSourceType = new ContentSourceType("testSourceType");
+ ContentSourceType contentSourceType = new ContentSourceType("testSourceType");
- Set<ContentSourceType> types = new HashSet<ContentSourceType>(1);
- types.add(contentSourceType);
- contentSourceMetadataManager.registerTypes(types);
+ Set<ContentSourceType> types = new HashSet<ContentSourceType>(1);
+ types.add(contentSourceType);
+ contentSourceMetadataManager.registerTypes(types);
- ContentSource source = new ContentSource("testSource1", contentSourceType);
- source = contentSourceManager.simpleCreateContentSource(overlord, source);
+ ContentSource source = new ContentSource("testSource1", contentSourceType);
+ source = contentSourceManager.simpleCreateContentSource(overlord, source);
- Repo repo = new Repo(oldName);
- repo = repoManager.createRepo(overlord, repo);
+ Repo repo = new Repo(oldName);
+ repo = repoManager.createRepo(overlord, repo);
- repoManager.simpleAddContentSourcesToRepo(overlord, repo.getId(), new int[] { source.getId() });
+ repoManager.simpleAddContentSourcesToRepo(overlord, repo.getId(), new int[] { source.getId() });
- // Test
- repo.setName(newName);
- repoManager.updateRepo(overlord, repo);
+ // Test
+ repo.setName(newName);
+ repoManager.updateRepo(overlord, repo);
- // Verify
- RepoCriteria byName = new RepoCriteria();
- byName.addFilterName(newName);
- PageList<Repo> reposWithNewName = repoManager.findReposByCriteria(overlord, byName);
+ // Verify
+ RepoCriteria byName = new RepoCriteria();
+ byName.addFilterName(newName);
+ PageList<Repo> reposWithNewName = repoManager.findReposByCriteria(overlord, byName);
- assert reposWithNewName.size() == 1;
+ assert reposWithNewName.size() == 1;
- byName = new RepoCriteria();
- byName.addFilterName(oldName);
- PageList<Repo> reposWithOldName = repoManager.findReposByCriteria(overlord, byName);
+ byName = new RepoCriteria();
+ byName.addFilterName(oldName);
+ PageList<Repo> reposWithOldName = repoManager.findReposByCriteria(overlord, byName);
- assert reposWithOldName.size() == 0;
+ assert reposWithOldName.size() == 0;
+ }
+ });
}
@Test(enabled = ENABLED)
public void updateSyncSchedule() {
- Repo repo = new Repo("updateSyncSchedule");
- repo.setSyncSchedule("NOT A VALID CRON");
- boolean failed = false;
- try {
- repo = repoManager.createRepo(overlord, repo);
- } catch (RepoException e) {
- failed = true;
- }
- assert failed;
-
- failed = false;
- repo.setSyncSchedule("0 0 3 * * ?");
- try {
- repo = repoManager.createRepo(overlord, repo);
- } catch (RepoException e) {
- failed = true;
- }
- assert !failed;
- }
+ executeInTransaction(new TransactionCallback() {
+
+ public void execute() throws Exception {
+ Repo repo = new Repo("updateSyncSchedule");
+ repo.setSyncSchedule("NOT A VALID CRON");
+ boolean failed = false;
+ try {
+ repo = repoManager.createRepo(overlord, repo);
+ } catch (RepoException e) {
+ failed = true;
+ }
+ assert failed;
+
+ failed = false;
+ repo.setSyncSchedule("0 0 3 * * ?");
+ try {
+ repo = repoManager.createRepo(overlord, repo);
+ } catch (RepoException e) {
+ failed = true;
+ }
+ assert !failed;
+ }
+ });
+ }
}
\ No newline at end of file
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3Test.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3Test.java
index c62b521..8064bdc 100644
--- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3Test.java
+++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3Test.java
@@ -5,7 +5,6 @@ import java.lang.management.ManagementFactory;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Collection;
-import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Properties;
@@ -30,13 +29,12 @@ import org.jboss.shrinkwrap.api.ArchivePaths;
import org.jboss.shrinkwrap.api.Filters;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
-import org.jboss.shrinkwrap.api.exporter.ZipExporter;
import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
-import org.jboss.shrinkwrap.impl.base.exporter.zip.ZipExporterImpl;
import org.jboss.shrinkwrap.resolver.api.DependencyResolvers;
import org.jboss.shrinkwrap.resolver.api.maven.MavenDependencyResolver;
+import org.rhq.core.db.DatabaseTypeFactory;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.util.MessageDigestGenerator;
import org.rhq.core.util.exception.ThrowableUtil;
@@ -69,58 +67,40 @@ public abstract class AbstractEJB3Test extends Arquillian {
@ArquillianResource
protected InitialContext initialContext;
- // We originally deployed the jar as a JavaArchive (JAR file). But this ran into problems because
- // of the dependent 3rd party jars. There isn't an obvious way to deploy the dependent jars of a jar.
- // Also, AS7 makes it hard to put them in a globally accessibly /lib directory due to
- // its classloader isolation and module approach. So, we now deploy an EnterpriseArchive (ear)
- // where the ejb jar is deployed as a module and the 3rd party libraries are put in the ear's /lib.
+ // We originally (in 4.2.3 days) ran these tests as "unit" tests in the server/jar module using
+ // the embedded conatiner. With Arquillian it makes sense to actually deploy an EAR because
+ // we need a way to deploy dependent ears needed to support the server/jar classes. But
+ // building this jar up (as is done in core/domain) was too difficult due to the huge number
+ // of dependencies. It was easier, and probably more sensical, to use the already built rhq.ear
+ // and run as true integration tests. We do thin rhq.ear by removing all of the WAR files, and
+ // deploy only the EJB jars, and the services, which are really the objects under test.
@Deployment
protected static EnterpriseArchive getBaseDeployment() {
- // depending on the db in use, set up the necessary datasource
- String dialect = System.getProperty("hibernate.dialect");
- if (dialect == null) {
- System.out.println("!!! hibernate.dialect is not set! Assuming you want to test on postgres");
- dialect = "postgres";
- }
-
- @SuppressWarnings("unused")
- String dataSourceXml;
- if (dialect.toLowerCase().contains("postgres")) {
- dataSourceXml = "jbossas-postgres-ds.xml";
- } else {
- dataSourceXml = "jbossas-oracle-ds.xml";
- }
-
- MavenDependencyResolver jarResolver = DependencyResolvers.use(MavenDependencyResolver.class);
- //resolver.loadMetadataFromPom("pom.xml");
-
- // Create the ejb jar which will subsequently be packaged in the ear deployment
- // JavaArchive serverJar = ShrinkWrap.create(JavaArchive.class, "rhq-enterprise-server-ejb3.jar") //
- // .addAsManifestResource(dataSourceXml) // the datasource
- // .addAsManifestResource("ejb-jar.xml") // the empty ejb jar descriptor
- // .addAsManifestResource("test-persistence.xml", "persistence.xml") // the test persistence context
- // .addAsManifestResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml") // add CDI injection (needed by arquillian injection)
- // );
-
- // server jar classes
- // serverJar = addClasses(serverJar, new File("../jar/target/classes/org"), null);
- // JavaArchive serverJar = ShrinkWrap.create(JavaArchive.class, "rhq-enterprise-server-ejb3.jar");
- // JavaArchive artifact = jarResolver.artifact("org.rhq:rhq-enterprise-server:4.6.0-SNAPSHOT")
- // .resolveAs(JavaArchive.class).iterator().next();
- // serverJar.merge(artifact, Filters.exclude(".*META-INF.*"));
- // serverJar.addAsManifestResource(dataSourceXml) // the datasource
- // .addAsManifestResource("ejb-jar.xml") // the empty ejb jar descriptor
- // .addAsManifestResource("test-persistence.xml", "persistence.xml") // the test persistence context
- // .addAsManifestResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml")); // add CDI injection (needed by arquillian injection)
-
- // System.out.println("** The Deployment EJB JAR: " + serverJar.toString(true) + "\n");
-
+ //TODO: Get to work with Oracle or Postgres, currently the standalone.xml is canned and
+ // using Postgres only. This is likely to be done in pom.xml as opposed to here, so commenting
+ // out.
+ // // depending on the db in use, set up the necessary datasource
+ // String dialect = System.getProperty("hibernate.dialect");
+ // if (dialect == null) {
+ // System.out.println("!!! hibernate.dialect is not set! Assuming you want to test on postgres");
+ // dialect = "postgres";
+ // }
+ //
+ // @SuppressWarnings("unused")
+ // String dataSourceXml;
+ // if (dialect.toLowerCase().contains("postgres")) {
+ // dataSourceXml = "jbossas-postgres-ds.xml";
+ // } else {
+ // dataSourceXml = "jbossas-oracle-ds.xml";
+ // }
+
+ // deploy the test classes in their own jar, under /lib
JavaArchive testClassesJar = ShrinkWrap.create(JavaArchive.class, "test-classes.jar");
testClassesJar = addClasses(testClassesJar, new File("target/test-classes/org"), null);
- // non itests-2 RHQ classes in use by test classes
+ // add non itests-2 RHQ classes used by the test classes, as well as needed resources
testClassesJar.addClass(ThrowableUtil.class);
testClassesJar.addClass(MessageDigestGenerator.class);
testClassesJar.addClass(StreamUtil.class);
@@ -129,58 +109,36 @@ public abstract class AbstractEJB3Test extends Arquillian {
testClassesJar.addAsManifestResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml")); // add CDI injection (needed by arquillian injection);
testClassesJar.addAsResource("test-scheduler.properties");
- // create test ear
+ // create test ear by starting with rhq.ear and thinning it
MavenDependencyResolver earResolver = DependencyResolvers.use(MavenDependencyResolver.class);
// this must be named rhq.ear because the "rhq" portion is used in the jndi names
- EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, "rhq.ear");
- EnterpriseArchive ear2 = earResolver.artifact("org.rhq:rhq-enterprise-server-ear:ear:4.6.0-SNAPSHOT")
+ EnterpriseArchive testEar = ShrinkWrap.create(EnterpriseArchive.class, "rhq.ear");
+ EnterpriseArchive rhqEar = earResolver.artifact("org.rhq:rhq-enterprise-server-ear:ear:4.6.0-SNAPSHOT")
.resolveAs(EnterpriseArchive.class).iterator().next();
- //ear = ear.merge(ear2, Filters.exclude(".*\\.war.*|.*application.xml.*|.*rhq-enterprise-server-ejb3.*"));
- ear = ear.merge(ear2, Filters.include("/lib.*|/rhq.*ejb3\\.jar.*|/rhq-enterprise-server-services-sar.*"));
-
- // ear.addAsModule((resolver.artifact("org.rhq:rhq-enterprise-server:4.6.0-SNAPSHOT").resolveAsFiles())[0],
- // "rhq-core-enterprise-server-ejb3.jar");
- // ear.addAsModule((resolver.artifact("org.rhq:rhq-core-domain:4.6.0-SNAPSHOT").resolveAsFiles())[0],
- // "rhq-core-domain-ejb3.jar");
- //ear.getAsType(JavaArchive.class, "rhq-enterprise-server-ejb3.jar")
- //ear = ear.addAsModule(serverJar); // the jar under test
- ear = ear.addAsLibrary(testClassesJar); // the actual test classes
- ear = ear.addAsManifestResource("jboss-deployment-structure.xml");
- ear = ear.setApplicationXML("application.xml"); // the application xml declaring the ejb jar
- //ear = ear.addAsLibrary("persistence.jar");
-
- //System.out.println("** The Deployment EAR: " + ear.toString(true) + "\n");
-
- //ear.delete("rhq-portal.war");
- //ear.delete("coregui.war");
-
- // ear.merge(resolver.artifact("org.rhq:rhq-enterprise-server-ear:4.6.0-SNAPSHOT")
- // .resolveAs(EnterpriseArchive.class).iterator().next());
- // .addAsModule(ejbJar) // the jar under test
- // .addAsLibrary(testClassesJar) // the actual test classes
- // .setApplicationXML("application.xml"); // the application xml declaring the ejb jar
-
- // Adding the 3rd party jars is not easy. There were basically two approaches I could think of:
- //
- // 1) Use the MavenDependencyResolver to figure out and add all of the test deps and put them in lib
- //
- // This immediately ran into trouble as there were way more jars sucked in than were actually necessary.
- // Furthermore, it included arquillian, shrinkwrap, jboss, etc.. lots of jars that actually caused
- // issues like locking and other horrible things due, I suppose, to just stepping all over the test env
- // set up by Arquillian. So, the next step was to try and start excluding the unwanted jars. This was
- // tedious and difficult and I didn't really get it close to working before giving up and going with
- // option 2.
- //
- // 2) Use the MavenDependencyResolver to locate and pull just the artifacts we need.
- //
- // This is annoying because it's basically duplicating the same sort of effort that we already
- // use maven to do for us. It involves running, failing on NoClassDefFound, fixing it, repeat. It
- // does pull in necessary transitive deps but sometimes it pulls in unwanted transitive deps. So,
- // we still end up having to do some exclusion filtering. Since Shrinkwrap has weak and buggy
- // filtering, we have some homegrown filtering methods below.
- // TODO: Is there any way to not have to specify the versions for the transitive deps? This is brittle as is.
-
- //load 3rd party deps explicitly
+ // merge rhq.ear into testEar but include only the EJB jars, the SAR, and the supporting libraries
+ testEar = testEar.merge(rhqEar,
+ Filters.include("/lib.*|/rhq.*ejb3\\.jar.*|/rhq-enterprise-server-services-sar.*"));
+ // remove startup beans and shutdown listeners, we don't want this to be a full server deployment. The tests
+ // start/stop what they need, typically with test services or mocks.
+ testEar.delete(ArchivePaths
+ .create("/rhq-enterprise-server-ejb3.jar/org/rhq/enterprise/server/core/StartupBean.class"));
+ testEar.delete(ArchivePaths
+ .create("/rhq-enterprise-server-ejb3.jar/org/rhq/enterprise/server/core/StartupBean$1.class"));
+ testEar.delete(ArchivePaths
+ .create("/rhq-enterprise-server-ejb3.jar/org/rhq/enterprise/server/core/StartupBeanPreparation.class"));
+ testEar.delete(ArchivePaths
+ .create("/rhq-enterprise-server-ejb3.jar/org/rhq/enterprise/server/core/ShutdownListener.class"));
+
+ // add the test classes to the deployment
+ testEar.addAsLibrary(testClassesJar);
+
+ // add the necessary AS7 dependency modules
+ testEar.addAsManifestResource("jboss-deployment-structure.xml");
+
+ // add the application xml declaring the ejb jars
+ testEar.setApplicationXML("application.xml");
+
+ // add additional 3rd party dependent jars needed to support test classes
MavenDependencyResolver resolver = DependencyResolvers.use(MavenDependencyResolver.class);
resolver.loadMetadataFromPom("pom.xml");
Collection<JavaArchive> dependencies = new HashSet<JavaArchive>();
@@ -188,26 +146,25 @@ public abstract class AbstractEJB3Test extends Arquillian {
dependencies.addAll(resolver.artifact("org.liquibase:liquibase-core").resolveAs(JavaArchive.class));
dependencies.addAll(resolver.artifact("org.rhq:test-utils").resolveAs(JavaArchive.class));
dependencies.addAll(resolver.artifact("org.rhq.helpers:perftest-support").resolveAs(JavaArchive.class));
- //dependencies.addAll(resolver.artifact("commons-io:commons-io").resolveAs(JavaArchive.class));
- //dependencies.addAll(resolver.artifact("org.unitils:unitils-testng:3.1").resolveAs(JavaArchive.class));
- //dependencies.addAll(resolver.artifact("org.rhq:rhq-core-domain").resolveAs(JavaArchive.class));
+ // exclude any transitive deps we don't want
String[] excludeFilters = { "testng.*jdk", "rhq-core-domain.*jar" };
- //
dependencies = exclude(dependencies, excludeFilters);
- ear = ear.addAsLibraries(dependencies);
- // ear.addAsModule((resolver.artifact("org.rhq:rhq-core-domain").resolveAsFiles())[0], "rhq-core-domain-ejb3.jar");
- //System.out.println("** The Deployment EAR: " + ear.toString(true) + "\n");
+ testEar.addAsLibraries(dependencies);
- try {
- ZipExporter exporter = new ZipExporterImpl(ear);
- exporter.exportTo(new File("/home/jshaughn/temp/test-ear.ear"), true);
- } catch (Exception e) {
- e.printStackTrace();
- }
+ // Print out the test EAR structure
+ // System.out.println("** The Deployment EAR: " + ear.toString(true) + "\n");
+
+ // Save the test EAR to a zip file for inspection (set file explicitly)
+ // try {
+ // ZipExporter exporter = new ZipExporterImpl(ear);
+ // exporter.exportTo(new File("/home/jshaughn/temp/test-ear.ear"), true);
+ // } catch (Exception e) {
+ // e.printStackTrace();
+ // }
- return ear;
+ return testEar;
}
/**
@@ -265,7 +222,6 @@ public abstract class AbstractEJB3Test extends Arquillian {
} else if (fileName.endsWith(".class")) {
int dot = fileName.indexOf('.');
try {
- //Class<?> clazz = Class.forName(packageName + "." + fileName.substring(0, dot));
archive.addClass(packageName + "." + fileName.substring(0, dot));
} catch (Exception e) {
System.out.println("WARN: Could not add class:" + e);
@@ -291,7 +247,24 @@ public abstract class AbstractEJB3Test extends Arquillian {
// one time, and doing it in container allows for the expected injections and context.
if (inContainer()) {
try {
+ // Make sure we set the db type for tests that may need it (normally done in StartupBean)
+ if (null == DatabaseTypeFactory.getDefaultDatabaseType()) {
+ Connection conn = null;
+ try {
+ conn = getConnection();
+ DatabaseTypeFactory.setDefaultDatabaseType(DatabaseTypeFactory.getDatabaseType(conn));
+ } catch (Exception e) {
+ System.err.println("!!! WARNING !!! cannot set default database type, some tests may fail");
+ e.printStackTrace();
+ } finally {
+ if (null != conn) {
+ conn.close();
+ }
+ }
+ }
+
beforeMethod();
+
} catch (Throwable t) {
// Arquillian is eating these, make sure they show up in some way
System.out.println("BEFORE METHOD FAILURE, TEST DID NOT RUN!!! " + t.getMessage());
@@ -345,7 +318,7 @@ public abstract class AbstractEJB3Test extends Arquillian {
}
protected InitialContext getInitialContext() {
- // may be null if not yet injected (as of 1.0.1.Final, only injected inside @Test)
+ // may be null if not yet injected
if (null != initialContext) {
return initialContext;
}
@@ -530,18 +503,6 @@ public abstract class AbstractEJB3Test extends Arquillian {
AssertJUnit.fail(message);
}
- private final long DEFAULT_OFFSET = 50;
- private long referenceTime = new Date().getTime();
-
- public Date getAnotherDate() {
- return getAnotherDate(DEFAULT_OFFSET);
- }
-
- public Date getAnotherDate(long offset) {
- referenceTime += offset;
- return new Date(referenceTime);
- }
-
/**
* If you need to test server plugins, you must first prepare the server plugin service.
* After this returns, the caller must explicitly start the PC by using the appropriate API
@@ -616,19 +577,6 @@ public abstract class AbstractEJB3Test extends Arquillian {
mbs.registerMBean(schedulerService, SchedulerServiceMBean.SCHEDULER_MBEAN_NAME);
schedulerService.startQuartzScheduler();
- // MBeanServer mbs = getPlatformMBeanServer();
- // schedulerService = MBeanServerInvocationHandler.newProxyInstance(mbs,
- // SchedulerServiceMBean.SCHEDULER_MBEAN_NAME, SchedulerServiceMBean.class, false);
- //
- // Properties quartzProps = new Properties();
- // quartzProps.load(this.getClass().getClassLoader().getResourceAsStream("test-scheduler.properties"));
- // //schedulerService = LookupUtil.getSchedulerBean();
- // //schedulerService = new SchedulerService();
- // schedulerService.setQuartzProperties(quartzProps);
- // //schedulerService.start();
- // //getJBossMBeanServer().registerMBean(schedulerService, SchedulerServiceMBean.SCHEDULER_MBEAN_NAME);
- // schedulerService.startQuartzScheduler();
- // return;
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e);
@@ -641,7 +589,7 @@ public abstract class AbstractEJB3Test extends Arquillian {
public void unprepareScheduler(boolean beanOnly) throws Exception {
if (schedulerService != null) {
- //schedulerService.stop();
+ schedulerService.stop();
schedulerService = null;
MBeanServer mbs = getPlatformMBeanServer();