Author: [email protected]
Date: Thu Feb 2 14:42:15 2012
New Revision: 2051
Log:
Fixed failing Bamboo build. Not entirely sure why this suddenly popped up...
Modified:
trunk/amdatu-core/itest/tests/src/test/java/org/amdatu/core/itest/tests/tenant/MultiTenantTest.java
Modified:
trunk/amdatu-core/itest/tests/src/test/java/org/amdatu/core/itest/tests/tenant/MultiTenantTest.java
==============================================================================
---
trunk/amdatu-core/itest/tests/src/test/java/org/amdatu/core/itest/tests/tenant/MultiTenantTest.java
(original)
+++
trunk/amdatu-core/itest/tests/src/test/java/org/amdatu/core/itest/tests/tenant/MultiTenantTest.java
Thu Feb 2 14:42:15 2012
@@ -39,7 +39,6 @@
import org.amdatu.core.itest.tenant.MyDependentService;
import org.amdatu.tenant.Tenant;
import org.amdatu.tenant.TenantConstants;
-import org.apache.felix.dm.DependencyManager;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -52,9 +51,6 @@
import org.osgi.framework.InvalidSyntaxException;
import org.osgi.framework.ServiceReference;
import org.osgi.service.cm.Configuration;
-import org.osgi.service.event.Event;
-import org.osgi.service.event.EventConstants;
-import org.osgi.service.event.EventHandler;
/**
* Integration test cases for multi-tenancy.
@@ -65,43 +61,14 @@
@ExamReactorStrategy(AllConfinedStagedReactorFactory.class)
public class MultiTenantTest {
- /**
- * @author <a href="mailto:[email protected]">Amdatu Project
Team</a>
- */
- static class TestEventHandler implements EventHandler {
-
- private final List<String> m_messages = new ArrayList<String>();
-
- /**
- * @return a copy of the current messages.
- */
- public List<String> getMessages() {
- List<String> result;
- synchronized (m_messages) {
- result = new ArrayList<String>(m_messages);
- m_messages.clear();
- }
- return result;
- }
-
- /**
- * @see
org.osgi.service.event.EventHandler#handleEvent(org.osgi.service.event.Event)
- */
- public void handleEvent(Event event) {
- String msg = (String) event.getProperty("message");
- synchronized (m_messages) {
- m_messages.add(msg.substring(4));
- }
- }
- }
-
private static final String SERVICE_NAME =
org.amdatu.core.itest.tenant.MyDependentService.class.getName();
@Inject
private BundleContext m_bundleContext;
private TestContext m_testContext;
+ private TenantTestEventHandler m_eventHandler;
+
private final List<Configuration> m_configurations = new
ArrayList<Configuration>();
- private final TestEventHandler m_eventHandler = new TestEventHandler();
/**
* @param collection
@@ -157,42 +124,31 @@
cleanCaches(),
junitBundles(),
CoreBundles.provisionAll(),
-
provision(mavenBundle().groupId("org.amdatu.core").artifactId("org.amdatu.core.itest.tenant-test")
+
provision(mavenBundle().groupId("org.amdatu.core").artifactId("org.amdatu.core.itest.tenant")
.versionAsInProject()),
- systemTimeout(1000000));
+ systemTimeout(10000));
}
/**
* Sets up an individual test case.
*
- * @throws Exception not part of this test case.
+ * @throws Exception not part of this set up.
*/
@Before
public void setUp() throws Exception {
m_testContext = new TestContext(m_bundleContext);
CoreConfigs.provisionAllExcluding(m_testContext, CoreConfigs.TENANT);
-
- Properties properties = new Properties();
- properties.put(EventConstants.EVENT_TOPIC, new String[] {
"org/osgi/service/log/LogEntry/LOG_INFO" });
- properties.put(EventConstants.EVENT_FILTER, "(message=MTL:*)");
-
- // Register our own log listener to the framework...
- DependencyManager dm = m_testContext.getDependencyManager();
- dm.add(dm.createComponent()
- .setInterface(EventHandler.class.getName(), properties)
- .setImplementation(m_eventHandler)
- );
+
+ m_eventHandler =
TenantTestEventHandler.install(m_testContext.getDependencyManager());
m_testContext.waitForSystemToSettle();
}
/**
* Tears down an individual test case.
- *
- * @throws Exception not part of this test case.
*/
@After
- public void tearDown() throws Exception {
+ public void tearDown() {
for (Configuration config : m_configurations) {
try {
config.delete();
@@ -464,6 +420,7 @@
* @throws Exception
*/
private void removeTenantConfig(Configuration config) throws Exception {
+ m_configurations.remove(config);
config.delete();
m_testContext.waitForSystemToSettle();
}
_______________________________________________
Amdatu-commits mailing list
[email protected]
http://lists.amdatu.org/mailman/listinfo/amdatu-commits