modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/AvailabilityManagerTest.java
| 13 -
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/DriftServerPluginService.java
| 113 ----------
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/DriftServerPluginServiceMBean.java
| 25 --
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/group/test/LdapGroupManagerBeanTest.java
| 13 -
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/scheduler/jobs/DataPurgeJobTest.java
| 12 -
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/sync/test/SynchronizationManagerBeanTest.java
| 12 -
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/system/SystemManagerBeanTest.java
| 12 -
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/TestPluginServiceMBean.java
| 25 ++
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/TestServerPluginService.java
| 113 ++++++++++
9 files changed, 169 insertions(+), 169 deletions(-)
New commits:
commit 14c1938417da451cdcb799c998922022b50833e6
Author: John Sanda <jsanda(a)redhat.com>
Date: Tue Nov 1 14:45:39 2011 -0400
fixing compilation errors that resulted from itests refactoring
diff --git
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/AvailabilityManagerTest.java
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/AvailabilityManagerTest.java
index 3fbc4f7..739b8d3 100644
---
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/AvailabilityManagerTest.java
+++
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/AvailabilityManagerTest.java
@@ -46,6 +46,7 @@ import org.rhq.enterprise.server.measurement.AvailabilityPoint;
import org.rhq.enterprise.server.resource.ResourceAvailabilityManagerLocal;
import org.rhq.enterprise.server.resource.ResourceManagerLocal;
import org.rhq.enterprise.server.test.AbstractEJB3Test;
+import org.rhq.enterprise.server.test.TestServerPluginService;
import org.rhq.enterprise.server.util.LookupUtil;
/**
@@ -73,7 +74,7 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
private Availability availability2;
private Availability availability3;
- private DriftServerPluginService driftServerPluginService;
+ private TestServerPluginService testServerPluginService;
@BeforeMethod
public void beforeMethod() {
@@ -86,10 +87,10 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
this.overlord = LookupUtil.getSubjectManager().getOverlord();
additionalResources = new ArrayList<Resource>();
- driftServerPluginService = new DriftServerPluginService();
- prepareCustomServerPluginService(driftServerPluginService);
- driftServerPluginService.masterConfig.getPluginDirectory().mkdirs();
- driftServerPluginService.startMasterPluginContainer();
+ testServerPluginService = new TestServerPluginService();
+ prepareCustomServerPluginService(testServerPluginService);
+ testServerPluginService.masterConfig.getPluginDirectory().mkdirs();
+ testServerPluginService.startMasterPluginContainer();
} catch (Throwable t) {
// Catch RuntimeExceptions and Errors and dump their stack trace, because
Surefire will completely swallow them
// and throw a cryptic NPE (see
http://jira.codehaus.org/browse/SUREFIRE-157)!
@@ -139,7 +140,7 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
finally {
unprepareScheduler();
unprepareServerPluginService();
- driftServerPluginService.stopMasterPluginContainer();
+ testServerPluginService.stopMasterPluginContainer();
}
}
diff --git
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/DriftServerPluginService.java
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/DriftServerPluginService.java
deleted file mode 100644
index b20155a..0000000
---
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/DriftServerPluginService.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2011 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-package org.rhq.enterprise.server.measurement.test;
-
-import java.io.File;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-import org.rhq.core.domain.plugin.PluginKey;
-import org.rhq.core.domain.plugin.ServerPlugin;
-import org.rhq.enterprise.server.plugin.pc.AbstractTypeServerPluginContainer;
-import org.rhq.enterprise.server.plugin.pc.MasterServerPluginContainer;
-import org.rhq.enterprise.server.plugin.pc.MasterServerPluginContainerConfiguration;
-import org.rhq.enterprise.server.plugin.pc.ServerPluginEnvironment;
-import org.rhq.enterprise.server.plugin.pc.ServerPluginManager;
-import org.rhq.enterprise.server.plugin.pc.ServerPluginService;
-import org.rhq.enterprise.server.plugin.pc.drift.DriftServerPluginContainer;
-import org.rhq.enterprise.server.plugin.pc.drift.DriftServerPluginManager;
-import
org.rhq.enterprise.server.xmlschema.generated.serverplugin.ServerPluginDescriptorType;
-
-public class DriftServerPluginService extends ServerPluginService implements
DriftServerPluginServiceMBean {
-
- public TestMasterServerPluginContainer master;
- public MasterServerPluginContainerConfiguration masterConfig;
-
- public DriftServerPluginService() {
- // build the config at constructor time so tests have it even before the PC is
initialized
- File dir = new File(System.getProperty("java.io.tmpdir"),
"test-server-plugins");
- this.masterConfig = new MasterServerPluginContainerConfiguration(dir, dir, dir,
null);
- }
-
- @Override
- public MasterServerPluginContainer createMasterPluginContainer() {
- this.master = new TestMasterServerPluginContainer();
- this.master.initialize(this.masterConfig);
- return this.master;
- }
-
- class TestMasterServerPluginContainer extends MasterServerPluginContainer {
- @Override
- protected ClassLoader createRootServerPluginClassLoader() {
- return getClass().getClassLoader();
- }
-
- @Override
- protected Map<URL, ? extends ServerPluginDescriptorType>
preloadAllPlugins() throws Exception {
- return Collections.emptyMap();
- }
-
- @Override
- protected List<PluginKey> getDisabledPluginKeys() {
- // in the real world, the db is checked for enable flag, here we say all
plugins are enabled
- return new ArrayList<PluginKey>();
- }
-
- @Override
- protected List<AbstractTypeServerPluginContainer> createPluginContainers()
{
- ArrayList<AbstractTypeServerPluginContainer> pcs = new
ArrayList<AbstractTypeServerPluginContainer>(1);
- DriftServerPluginContainer driftPC = new
TestDriftServerPluginContainer(this);
- pcs.add(driftPC);
-
- return pcs;
- }
- }
-
- class TestDriftServerPluginContainer extends DriftServerPluginContainer {
- public TestDriftServerPluginContainer(MasterServerPluginContainer master) {
- super(master);
- }
-
- @Override
- protected ServerPluginManager createPluginManager() {
- return new TestDriftServerPluginManager(this);
- }
- }
-
- class TestDriftServerPluginManager extends DriftServerPluginManager {
- public TestDriftServerPluginManager(DriftServerPluginContainer pc) {
- super(pc);
- }
-
- @Override
- public Collection<ServerPluginEnvironment> getPluginEnvironments() {
- return Collections.emptyList();
- }
-
- @Override
- protected ServerPlugin getPlugin(ServerPluginEnvironment env) {
- return null;
- }
- }
-}
diff --git
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/DriftServerPluginServiceMBean.java
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/DriftServerPluginServiceMBean.java
deleted file mode 100644
index 8473cf0..0000000
---
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/DriftServerPluginServiceMBean.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2011 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-package org.rhq.enterprise.server.measurement.test;
-
-import org.rhq.enterprise.server.plugin.pc.ServerPluginServiceManagement;
-
-public interface DriftServerPluginServiceMBean extends ServerPluginServiceManagement {
-}
diff --git
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/group/test/LdapGroupManagerBeanTest.java
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/group/test/LdapGroupManagerBeanTest.java
index 1b8974d..c4cfca5 100644
---
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/group/test/LdapGroupManagerBeanTest.java
+++
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/group/test/LdapGroupManagerBeanTest.java
@@ -27,17 +27,16 @@ import javax.persistence.Query;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
-import org.testng.annotations.BeforeSuite;
import org.testng.annotations.Test;
import org.rhq.core.domain.common.SystemConfiguration;
import org.rhq.core.domain.common.composite.SystemSetting;
import org.rhq.enterprise.server.RHQConstants;
-import org.rhq.enterprise.server.drift.DriftServerPluginService;
import org.rhq.enterprise.server.resource.group.LdapGroupManagerBean;
import org.rhq.enterprise.server.resource.group.LdapGroupManagerLocal;
import org.rhq.enterprise.server.system.SystemManagerLocal;
import org.rhq.enterprise.server.test.AbstractEJB3Test;
+import org.rhq.enterprise.server.test.TestServerPluginService;
import org.rhq.enterprise.server.test.ldap.FakeLdapCtxFactory;
import org.rhq.enterprise.server.util.LookupUtil;
import org.rhq.test.TransactionCallback;
@@ -95,7 +94,7 @@ public class LdapGroupManagerBeanTest extends AbstractEJB3Test {
private LdapGroupManagerLocal ldapGroupManager = null;
private SystemManagerLocal systemManager = null;
- private DriftServerPluginService driftServerPluginService = null;
+ private TestServerPluginService testServerPluginService = null;
// private Subject overlord = null;
@@ -107,9 +106,9 @@ public class LdapGroupManagerBeanTest extends AbstractEJB3Test {
ldapGroupManager = LookupUtil.getLdapGroupManager();
//we need this because the drift plugins are referenced from the system settings
that we use in our tests
- driftServerPluginService = new DriftServerPluginService();
- prepareCustomServerPluginService(driftServerPluginService);
- driftServerPluginService.startMasterPluginContainer();
+ testServerPluginService = new TestServerPluginService();
+ prepareCustomServerPluginService(testServerPluginService);
+ testServerPluginService.startMasterPluginContainer();
// get our Maven properties for LDAP testing
java.net.URL url =
LdapGroupManagerBeanTest.class.getClassLoader().getResource("test-ldap.properties");
@@ -150,7 +149,7 @@ public class LdapGroupManagerBeanTest extends AbstractEJB3Test {
@AfterClass
public void tearDown() throws Exception {
unprepareServerPluginService();
- driftServerPluginService.stopMasterPluginContainer();
+ testServerPluginService.stopMasterPluginContainer();
}
/**
diff --git
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/scheduler/jobs/DataPurgeJobTest.java
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/scheduler/jobs/DataPurgeJobTest.java
index 5aeed8e..e3f52f5 100644
---
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/scheduler/jobs/DataPurgeJobTest.java
+++
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/scheduler/jobs/DataPurgeJobTest.java
@@ -77,7 +77,6 @@ import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.core.util.exception.ThrowableUtil;
-import org.rhq.enterprise.server.drift.DriftServerPluginService;
import org.rhq.enterprise.server.event.EventManagerLocal;
import org.rhq.enterprise.server.measurement.CallTimeDataManagerLocal;
import org.rhq.enterprise.server.measurement.MeasurementDataManagerLocal;
@@ -85,6 +84,7 @@ import org.rhq.enterprise.server.resource.ResourceManagerLocal;
import org.rhq.enterprise.server.scheduler.SchedulerLocal;
import org.rhq.enterprise.server.test.AbstractEJB3Test;
import org.rhq.enterprise.server.test.TestServerCommunicationsService;
+import org.rhq.enterprise.server.test.TestServerPluginService;
import org.rhq.enterprise.server.util.LookupUtil;
/**
@@ -96,20 +96,20 @@ public class DataPurgeJobTest extends AbstractEJB3Test {
private int agentId;
private int resourceTypeId;
- private DriftServerPluginService driftServerPluginService;
+ private TestServerPluginService testServerPluginService;
@BeforeClass
public void setup() {
//we need this because the drift plugins are referenced from the system settings
that we use in our tests
- driftServerPluginService = new DriftServerPluginService();
- prepareCustomServerPluginService(driftServerPluginService);
- driftServerPluginService.startMasterPluginContainer();
+ testServerPluginService = new TestServerPluginService();
+ prepareCustomServerPluginService(testServerPluginService);
+ testServerPluginService.startMasterPluginContainer();
}
@AfterClass
public void tearDown() throws Exception {
unprepareServerPluginService();
- driftServerPluginService.stopMasterPluginContainer();
+ testServerPluginService.stopMasterPluginContainer();
}
@BeforeMethod
diff --git
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/sync/test/SynchronizationManagerBeanTest.java
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/sync/test/SynchronizationManagerBeanTest.java
index 6349bf6..c5a0b2e 100644
---
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/sync/test/SynchronizationManagerBeanTest.java
+++
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/sync/test/SynchronizationManagerBeanTest.java
@@ -73,7 +73,6 @@ import org.rhq.core.domain.sync.ImportConfiguration;
import org.rhq.core.domain.util.PageControl;
import org.rhq.enterprise.server.auth.SubjectManagerLocal;
import org.rhq.enterprise.server.authz.PermissionException;
-import org.rhq.enterprise.server.drift.DriftServerPluginService;
import org.rhq.enterprise.server.measurement.MeasurementDefinitionManagerLocal;
import org.rhq.enterprise.server.measurement.MeasurementScheduleManagerLocal;
import org.rhq.enterprise.server.resource.ResourceManagerLocal;
@@ -83,6 +82,7 @@ import org.rhq.enterprise.server.sync.SynchronizationManagerLocal;
import org.rhq.enterprise.server.sync.SystemSettingsSynchronizer;
import org.rhq.enterprise.server.system.SystemManagerLocal;
import org.rhq.enterprise.server.test.AbstractEJB3Test;
+import org.rhq.enterprise.server.test.TestServerPluginService;
import org.rhq.enterprise.server.util.LookupUtil;
/**
@@ -105,7 +105,7 @@ public class SynchronizationManagerBeanTest extends AbstractEJB3Test
{
public Properties systemSettings;
public ResourceType fakeType;
public Resource fakePlatform;
- public DriftServerPluginService driftServerPluginService;
+ public TestServerPluginService testServerPluginService;
}
private TestData testData;
@@ -151,9 +151,9 @@ public class SynchronizationManagerBeanTest extends AbstractEJB3Test
{
}
//we need this because the drift plugins are referenced from the system settings
that we use in our tests
- testData.driftServerPluginService = new DriftServerPluginService();
- prepareCustomServerPluginService(testData.driftServerPluginService);
- testData.driftServerPluginService.startMasterPluginContainer();
+ testData.testServerPluginService = new TestServerPluginService();
+ prepareCustomServerPluginService(testData.testServerPluginService);
+ testData.testServerPluginService.startMasterPluginContainer();
synchronizationManager = LookupUtil.getSynchronizationManager();
@@ -191,7 +191,7 @@ public class SynchronizationManagerBeanTest extends AbstractEJB3Test
{
}
unprepareServerPluginService();
- testData.driftServerPluginService.stopMasterPluginContainer();
+ testData.testServerPluginService.stopMasterPluginContainer();
export = null;
testData = null;
diff --git
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/system/SystemManagerBeanTest.java
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/system/SystemManagerBeanTest.java
index 012dde7..8d27267 100644
---
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/system/SystemManagerBeanTest.java
+++
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/system/SystemManagerBeanTest.java
@@ -30,30 +30,30 @@ import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.common.composite.SystemSetting;
import org.rhq.core.domain.common.composite.SystemSettings;
import org.rhq.enterprise.server.RHQConstants;
-import org.rhq.enterprise.server.drift.DriftServerPluginService;
import org.rhq.enterprise.server.test.AbstractEJB3Test;
+import org.rhq.enterprise.server.test.TestServerPluginService;
import org.rhq.enterprise.server.util.LookupUtil;
@Test
public class SystemManagerBeanTest extends AbstractEJB3Test {
private Subject overlord;
private SystemManagerLocal systemManager;
- private DriftServerPluginService driftServerPluginService;
+ private TestServerPluginService testServerPluginService;
@BeforeClass
public void setupServer() {
systemManager = LookupUtil.getSystemManager();
//we need this because the drift plugins are referenced from the system settings
that we use in our tests
- driftServerPluginService = new DriftServerPluginService();
- prepareCustomServerPluginService(driftServerPluginService);
- driftServerPluginService.startMasterPluginContainer();
+ testServerPluginService = new TestServerPluginService();
+ prepareCustomServerPluginService(testServerPluginService);
+ testServerPluginService.startMasterPluginContainer();
}
@AfterClass
public void tearDownServer() throws Exception {
unprepareServerPluginService();
- driftServerPluginService.stopMasterPluginContainer();
+ testServerPluginService.stopMasterPluginContainer();
}
@BeforeMethod
diff --git
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/TestPluginServiceMBean.java
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/TestPluginServiceMBean.java
new file mode 100644
index 0000000..c669b63
--- /dev/null
+++
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/TestPluginServiceMBean.java
@@ -0,0 +1,25 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2011 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.rhq.enterprise.server.test;
+
+import org.rhq.enterprise.server.plugin.pc.ServerPluginServiceManagement;
+
+public interface TestPluginServiceMBean extends ServerPluginServiceManagement {
+}
diff --git
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/TestServerPluginService.java
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/TestServerPluginService.java
new file mode 100644
index 0000000..87a7655
--- /dev/null
+++
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/TestServerPluginService.java
@@ -0,0 +1,113 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2011 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.rhq.enterprise.server.test;
+
+import java.io.File;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import org.rhq.core.domain.plugin.PluginKey;
+import org.rhq.core.domain.plugin.ServerPlugin;
+import org.rhq.enterprise.server.plugin.pc.AbstractTypeServerPluginContainer;
+import org.rhq.enterprise.server.plugin.pc.MasterServerPluginContainer;
+import org.rhq.enterprise.server.plugin.pc.MasterServerPluginContainerConfiguration;
+import org.rhq.enterprise.server.plugin.pc.ServerPluginEnvironment;
+import org.rhq.enterprise.server.plugin.pc.ServerPluginManager;
+import org.rhq.enterprise.server.plugin.pc.ServerPluginService;
+import org.rhq.enterprise.server.plugin.pc.drift.DriftServerPluginContainer;
+import org.rhq.enterprise.server.plugin.pc.drift.DriftServerPluginManager;
+import
org.rhq.enterprise.server.xmlschema.generated.serverplugin.ServerPluginDescriptorType;
+
+public class TestServerPluginService extends ServerPluginService implements
TestPluginServiceMBean {
+
+ public TestMasterServerPluginContainer master;
+ public MasterServerPluginContainerConfiguration masterConfig;
+
+ public TestServerPluginService() {
+ // build the config at constructor time so tests have it even before the PC is
initialized
+ File dir = new File(System.getProperty("java.io.tmpdir"),
"test-server-plugins");
+ this.masterConfig = new MasterServerPluginContainerConfiguration(dir, dir, dir,
null);
+ }
+
+ @Override
+ public MasterServerPluginContainer createMasterPluginContainer() {
+ this.master = new TestMasterServerPluginContainer();
+ this.master.initialize(this.masterConfig);
+ return this.master;
+ }
+
+ class TestMasterServerPluginContainer extends MasterServerPluginContainer {
+ @Override
+ protected ClassLoader createRootServerPluginClassLoader() {
+ return getClass().getClassLoader();
+ }
+
+ @Override
+ protected Map<URL, ? extends ServerPluginDescriptorType>
preloadAllPlugins() throws Exception {
+ return Collections.emptyMap();
+ }
+
+ @Override
+ protected List<PluginKey> getDisabledPluginKeys() {
+ // in the real world, the db is checked for enable flag, here we say all
plugins are enabled
+ return new ArrayList<PluginKey>();
+ }
+
+ @Override
+ protected List<AbstractTypeServerPluginContainer> createPluginContainers()
{
+ ArrayList<AbstractTypeServerPluginContainer> pcs = new
ArrayList<AbstractTypeServerPluginContainer>(1);
+ DriftServerPluginContainer driftPC = new
TestDriftServerPluginContainer(this);
+ pcs.add(driftPC);
+
+ return pcs;
+ }
+ }
+
+ class TestDriftServerPluginContainer extends DriftServerPluginContainer {
+ public TestDriftServerPluginContainer(MasterServerPluginContainer master) {
+ super(master);
+ }
+
+ @Override
+ protected ServerPluginManager createPluginManager() {
+ return new TestDriftServerPluginManager(this);
+ }
+ }
+
+ class TestDriftServerPluginManager extends DriftServerPluginManager {
+ public TestDriftServerPluginManager(DriftServerPluginContainer pc) {
+ super(pc);
+ }
+
+ @Override
+ public Collection<ServerPluginEnvironment> getPluginEnvironments() {
+ return Collections.emptyList();
+ }
+
+ @Override
+ protected ServerPlugin getPlugin(ServerPluginEnvironment env) {
+ return null;
+ }
+ }
+}