Author: ivol37 at gmail.com
Date: Fri Jan 21 17:05:27 2011
New Revision: 685
Log:
[AMDATU-262] Fixed configuration setup which should prevent integration builds
from hanging
Modified:
trunk/integration-tests/src/test/java/org/amdatu/test/integration/base/RESTTestBase.java
trunk/integration-tests/src/test/java/org/amdatu/test/integration/tests/CassandraDaemonIntegrationTest.java
trunk/integration-tests/src/test/java/org/amdatu/test/integration/tests/CassandraPersistenceManagerTest.java
trunk/integration-tests/src/test/java/org/amdatu/test/integration/tests/FSTenantStorageProviderServiceTest.java
trunk/integration-tests/src/test/java/org/amdatu/test/integration/tests/GadgetManagementServiceTest.java
trunk/integration-tests/src/test/java/org/amdatu/test/integration/tests/HttpServiceTest.java
trunk/integration-tests/src/test/java/org/amdatu/test/integration/tests/RDF2GOTest.java
trunk/integration-tests/src/test/java/org/amdatu/test/integration/tests/TenantManagementServiceTest.java
trunk/integration-tests/src/test/java/org/amdatu/test/integration/tests/UserAdminStoreTest.java
Modified:
trunk/integration-tests/src/test/java/org/amdatu/test/integration/base/RESTTestBase.java
==============================================================================
---
trunk/integration-tests/src/test/java/org/amdatu/test/integration/base/RESTTestBase.java
(original)
+++
trunk/integration-tests/src/test/java/org/amdatu/test/integration/base/RESTTestBase.java
Fri Jan 21 17:05:27 2011
@@ -33,11 +33,9 @@
import org.apache.commons.httpclient.methods.PutMethod;
import org.apache.felix.dm.Component;
import org.apache.felix.dm.DependencyManager;
-import org.junit.Before;
import org.ops4j.pax.exam.Inject;
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.Configuration;
-import org.osgi.framework.BundleException;
import org.osgi.service.cm.ConfigurationAdmin;
import org.osgi.service.http.HttpService;
import org.osgi.service.log.LogService;
@@ -89,8 +87,7 @@
.add(manager.createServiceDependency().setService(HttpContextServiceFactory.class).setRequired(true));
}
- @Before
- public void initConfig() throws IOException, BundleException {
+ protected void initConfiguration() throws IOException {
m_configAdmin = getService(ConfigurationAdmin.class);
m_logService = getService(LogService.class);
Modified:
trunk/integration-tests/src/test/java/org/amdatu/test/integration/tests/CassandraDaemonIntegrationTest.java
==============================================================================
---
trunk/integration-tests/src/test/java/org/amdatu/test/integration/tests/CassandraDaemonIntegrationTest.java
(original)
+++
trunk/integration-tests/src/test/java/org/amdatu/test/integration/tests/CassandraDaemonIntegrationTest.java
Fri Jan 21 17:05:27 2011
@@ -38,13 +38,11 @@
import org.apache.felix.dm.DependencyManager;
import org.apache.thrift.TException;
import org.junit.After;
-import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.Configuration;
import org.ops4j.pax.exam.junit.JUnit4TestRunner;
-import org.osgi.framework.BundleException;
import org.osgi.service.cm.ConfigurationAdmin;
import org.osgi.service.log.LogService;
@@ -112,8 +110,8 @@
}
}
- @Before
- public void initConfig() throws IOException, BundleException {
+ @Override
+ protected void initConfiguration() throws IOException {
m_configAdmin = getService(ConfigurationAdmin.class);
// Add cassandra and templates configs
Modified:
trunk/integration-tests/src/test/java/org/amdatu/test/integration/tests/CassandraPersistenceManagerTest.java
==============================================================================
---
trunk/integration-tests/src/test/java/org/amdatu/test/integration/tests/CassandraPersistenceManagerTest.java
(original)
+++
trunk/integration-tests/src/test/java/org/amdatu/test/integration/tests/CassandraPersistenceManagerTest.java
Fri Jan 21 17:05:27 2011
@@ -36,13 +36,11 @@
import org.apache.felix.dm.Component;
import org.apache.felix.dm.DependencyManager;
import org.junit.After;
-import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.Configuration;
import org.ops4j.pax.exam.junit.JUnit4TestRunner;
-import org.osgi.framework.BundleException;
import org.osgi.service.cm.ConfigurationAdmin;
/**
@@ -62,17 +60,17 @@
private volatile CassandraPersistenceManagerFactory m_pmFactory;
private volatile CassandraPersistenceManager m_pm;
private volatile ConfigurationAdmin m_configAdmin;
-
+
@Configuration
public Option[] configure() {
return super.configure();
}
-
+
protected Option provisionBundles() {
// Deploy bundles needed by cassandra daemon integration test
return provision(
- javaxServlet(), // Required if the httpservice is not deployed
- amdatuConfigTemplateManager(), // Required for placeholders in
cassandra.yaml
+ javaxServlet(), // Required if the httpservice is not deployed
+ amdatuConfigTemplateManager(), // Required for placeholders in
cassandra.yaml
amdatuCassandraApplication(),
amdatuCassandraListener(),
amdatuCassandraPersistenceManager());
@@ -84,24 +82,23 @@
// during this integration test. If we don't, it is likely that the
two schema updates conflict
// with each other (see org.apache.cassandra.db.migration.Migration)
String filter = "(" + CassandraPersistenceManager.KEYSPACE_AWARE_KEY +
"="
- + Table.SYSTEM_TABLE + ")";
+ + Table.SYSTEM_TABLE + ")";
return new Component[] { manager.createComponent()
.setImplementation(this)
.add(manager.createServiceDependency().setService(CassandraDaemonService.class).setRequired(true))
.add(manager.createServiceDependency().setService(ConfigurationAdmin.class).setRequired(true))
.add(manager.createServiceDependency().setService(CassandraPersistenceManager.class,
filter).setRequired(true)) };
}
-
- @Before
- public void initConfig() throws IOException, BundleException {
- m_configAdmin = getService(ConfigurationAdmin.class);
-
- // Add cassandra and templates configs
- ConfigProvider configProvider = new ConfigProvider();
- configProvider.addCassandraConfig(m_configAdmin);
- configProvider.addTemplateConfig(m_configAdmin);
+
+ protected void initConfiguration() throws IOException {
+ m_configAdmin = getService(ConfigurationAdmin.class);
+
+ // Add cassandra and templates configs
+ ConfigProvider configProvider = new ConfigProvider();
+ configProvider.addCassandraConfig(m_configAdmin);
+ configProvider.addTemplateConfig(m_configAdmin);
}
-
+
public void setUp() throws Exception {
m_daemonService = getService(CassandraDaemonService.class);
@@ -126,7 +123,7 @@
@Test
public void testCassandraDaemonService() throws Exception {
setUp();
-
+
// Perform intensive getValue/setValue test (see AMDATU-137)
String rowKey = "test";
String superColumn = "TestSuperColumn";
Modified:
trunk/integration-tests/src/test/java/org/amdatu/test/integration/tests/FSTenantStorageProviderServiceTest.java
==============================================================================
---
trunk/integration-tests/src/test/java/org/amdatu/test/integration/tests/FSTenantStorageProviderServiceTest.java
(original)
+++
trunk/integration-tests/src/test/java/org/amdatu/test/integration/tests/FSTenantStorageProviderServiceTest.java
Fri Jan 21 17:05:27 2011
@@ -30,13 +30,11 @@
import org.amdatu.test.integration.base.IntegrationTestBase;
import org.apache.felix.dm.Component;
import org.apache.felix.dm.DependencyManager;
-import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.Configuration;
import org.ops4j.pax.exam.junit.JUnit4TestRunner;
-import org.osgi.framework.BundleException;
import org.osgi.service.cm.ConfigurationAdmin;
/**
@@ -51,7 +49,7 @@
private volatile TenantManagementService m_tenantManagementService;
private volatile TenantStorageProvider m_tenantStorageProvider;
private volatile ConfigurationAdmin m_configAdmin;
-
+
@Configuration
public Option[] configure() {
return super.configure();
@@ -66,33 +64,32 @@
public Component[] getDependencies(DependencyManager manager) {
Component testComponent = manager.createComponent()
- .setImplementation(this)
+ .setImplementation(this)
+ .add(manager.createServiceDependency()
+ .setService(TenantManagementService.class)
+ .setRequired(true))
.add(manager.createServiceDependency()
- .setService(TenantManagementService.class)
+ .setService(ConfigurationAdmin.class)
.setRequired(true))
- .add(manager.createServiceDependency()
- .setService(ConfigurationAdmin.class)
- .setRequired(true))
- .add(manager.createServiceDependency()
- .setService(TenantStorageProvider.class)
- .setRequired(true));
+ .add(manager.createServiceDependency()
+ .setService(TenantStorageProvider.class)
+ .setRequired(true));
return new Component[] { testComponent };
}
-
- @Before
- public void initConfig() throws IOException, BundleException {
- m_configAdmin = getService(ConfigurationAdmin.class);
-
- // Add cassandra and templates configs
- ConfigProvider configProvider = new ConfigProvider();
- configProvider.addFSTenantStoreConfig(m_configAdmin);
+
+ protected void initConfiguration() throws IOException {
+ m_configAdmin = getService(ConfigurationAdmin.class);
+
+ // Add cassandra and templates configs
+ ConfigProvider configProvider = new ConfigProvider();
+ configProvider.addFSTenantStoreConfig(m_configAdmin);
}
@Test
public void testBasicCRUDIntegration() throws TenantException,
InterruptedException {
- // make sure no tenant1 exists when someone did not clean the
+ // make sure no tenant1 exists when someone did not clean the
// work dir of the integration test.
TenantEntity teDelete = m_tenantStorageProvider.getById("tenant1");
if (teDelete != null) {
Modified:
trunk/integration-tests/src/test/java/org/amdatu/test/integration/tests/GadgetManagementServiceTest.java
==============================================================================
---
trunk/integration-tests/src/test/java/org/amdatu/test/integration/tests/GadgetManagementServiceTest.java
(original)
+++
trunk/integration-tests/src/test/java/org/amdatu/test/integration/tests/GadgetManagementServiceTest.java
Fri Jan 21 17:05:27 2011
@@ -31,13 +31,11 @@
import org.apache.felix.dm.Component;
import org.apache.felix.dm.DependencyManager;
import org.junit.Assert;
-import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.Configuration;
import org.ops4j.pax.exam.junit.JUnit4TestRunner;
-import org.osgi.framework.BundleException;
import org.osgi.service.cm.ConfigurationAdmin;
import org.osgi.service.log.LogService;
@@ -94,8 +92,7 @@
);
}
- @Before
- public void initConfig() throws IOException, BundleException {
+ protected void initConfiguration() throws IOException {
m_configAdmin = getService(ConfigurationAdmin.class);
// Add cassandra and templates configs
Modified:
trunk/integration-tests/src/test/java/org/amdatu/test/integration/tests/HttpServiceTest.java
==============================================================================
---
trunk/integration-tests/src/test/java/org/amdatu/test/integration/tests/HttpServiceTest.java
(original)
+++
trunk/integration-tests/src/test/java/org/amdatu/test/integration/tests/HttpServiceTest.java
Fri Jan 21 17:05:27 2011
@@ -47,13 +47,11 @@
import org.apache.felix.dm.Component;
import org.apache.felix.dm.DependencyManager;
import org.junit.After;
-import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.Configuration;
import org.ops4j.pax.exam.junit.JUnit4TestRunner;
-import org.osgi.framework.BundleException;
import org.osgi.framework.Constants;
import org.osgi.service.cm.ConfigurationAdmin;
import org.osgi.service.http.HttpService;
@@ -135,8 +133,7 @@
return new Component[] { filterComponent, servletComponent,
testComponent };
}
- @Before
- public void initConfig() throws IOException, BundleException {
+ protected void initConfiguration() throws IOException {
m_configAdmin = getService(ConfigurationAdmin.class);
m_logService = getService(LogService.class);
Modified:
trunk/integration-tests/src/test/java/org/amdatu/test/integration/tests/RDF2GOTest.java
==============================================================================
---
trunk/integration-tests/src/test/java/org/amdatu/test/integration/tests/RDF2GOTest.java
(original)
+++
trunk/integration-tests/src/test/java/org/amdatu/test/integration/tests/RDF2GOTest.java
Fri Jan 21 17:05:27 2011
@@ -25,7 +25,6 @@
import org.amdatu.test.integration.base.IntegrationTestBase;
import org.apache.felix.dm.Component;
import org.apache.felix.dm.DependencyManager;
-import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ontoware.aifbcommons.collection.ClosableIterator;
@@ -39,7 +38,6 @@
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.Configuration;
import org.ops4j.pax.exam.junit.JUnit4TestRunner;
-import org.osgi.framework.BundleException;
import org.osgi.service.cm.ConfigurationAdmin;
import org.osgi.service.log.LogService;
@@ -73,8 +71,7 @@
return new Component[] { testComponent };
}
- @Before
- public void initConfig() throws IOException, BundleException {
+ protected void initConfiguration() throws IOException {
m_configAdmin = getService(ConfigurationAdmin.class);
// Add cassandra and templates configs
Modified:
trunk/integration-tests/src/test/java/org/amdatu/test/integration/tests/TenantManagementServiceTest.java
==============================================================================
---
trunk/integration-tests/src/test/java/org/amdatu/test/integration/tests/TenantManagementServiceTest.java
(original)
+++
trunk/integration-tests/src/test/java/org/amdatu/test/integration/tests/TenantManagementServiceTest.java
Fri Jan 21 17:05:27 2011
@@ -39,13 +39,11 @@
import org.apache.felix.dm.Component;
import org.apache.felix.dm.DependencyManager;
import org.junit.After;
-import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.Configuration;
import org.ops4j.pax.exam.junit.JUnit4TestRunner;
-import org.osgi.framework.BundleException;
import org.osgi.framework.Constants;
import org.osgi.framework.InvalidSyntaxException;
import org.osgi.framework.ServiceReference;
@@ -63,7 +61,7 @@
private volatile TenantManagementService m_tenantManagementService;
private volatile ConfigurationAdmin m_configAdmin;
-
+
@Configuration
public Option[] configure() {
return super.configure();
@@ -71,8 +69,8 @@
protected Option provisionBundles() {
return provision(
- javaxServlet(), // Required if the httpservice is not deployed
- amdatuConfigTemplateManager(), // Required for placeholders in
cassandra.yaml
+ javaxServlet(), // Required if the httpservice is not deployed
+ amdatuConfigTemplateManager(), // Required for placeholders in
cassandra.yaml
amdatuCassandraApplication(),
amdatuCassandraListener(),
amdatuCassandraPersistenceManager(),
@@ -81,26 +79,26 @@
public Component[] getDependencies(DependencyManager manager) {
Component testComponent = manager.createComponent()
- .setImplementation(this)
- .add(manager.createServiceDependency()
- .setService(TenantManagementService.class)
- .setRequired(true))
+ .setImplementation(this)
+ .add(manager.createServiceDependency()
+ .setService(TenantManagementService.class)
+ .setRequired(true))
.add(manager.createServiceDependency()
.setService(ConfigurationAdmin.class)
.setRequired(true))
- // this dependency is necessary to prevent a shutdown before all
bundles are started
- .add(manager.createServiceDependency()
- .setService(CassandraPersistenceManager.class)
- .setRequired(true))
- .add(manager.createServiceDependency()
- .setService(Tenant.class)
- .setCallbacks("tenantAdded", "tenantRemoved"));
+ // this dependency is necessary to prevent a shutdown before
all bundles are started
+ .add(manager.createServiceDependency()
+ .setService(CassandraPersistenceManager.class)
+ .setRequired(true))
+ .add(manager.createServiceDependency()
+ .setService(Tenant.class)
+ .setCallbacks("tenantAdded", "tenantRemoved"));
Properties props = new Properties();
props.put(Constants.SERVICE_RANKING, 1);
Component storageComponent = manager.createComponent()
- .setInterface(TenantStorageProvider.class.getName(), props)
- .setImplementation(InMemoryTenantStorageProvider.class);
+ .setInterface(TenantStorageProvider.class.getName(), props)
+ .setImplementation(InMemoryTenantStorageProvider.class);
return new Component[] { testComponent, storageComponent };
}
@@ -108,22 +106,21 @@
private final Semaphore m_tenant1Added = new Semaphore(0);
private final Semaphore m_tenant1Removed = new Semaphore(0);
- @Before
- public void initConfig() throws IOException, BundleException {
+ protected void initConfiguration() throws IOException {
m_configAdmin = getService(ConfigurationAdmin.class);
-
+
// Add cassandra and templates configs
ConfigProvider configProvider = new ConfigProvider();
configProvider.addCassandraConfig(m_configAdmin);
configProvider.addTemplateConfig(m_configAdmin);
}
-
+
@After
public void after() throws InterruptedException {
// Give the framework 2 seconds time to be able to finalize startup
before shutting down.
Thread.sleep(2000);
}
-
+
public void tenantAdded(ServiceReference reference) {
if (reference.getProperty(Tenant.SERVICE_PREFIX +
"id").equals("tenant1")) {
m_tenant1Added.release();
@@ -146,8 +143,8 @@
@Test
public void shouldCreateTenantService() throws TenantException,
InterruptedException {
- m_tenantManagementService.createTenant("tenant1", "Tenant1");
- Assert.assertTrue("Tenant service did not become available",
waitForTenantServiceAdded());
+ m_tenantManagementService.createTenant("tenant1", "Tenant1");
+ Assert.assertTrue("Tenant service did not become available",
waitForTenantServiceAdded());
}
@Test
Modified:
trunk/integration-tests/src/test/java/org/amdatu/test/integration/tests/UserAdminStoreTest.java
==============================================================================
---
trunk/integration-tests/src/test/java/org/amdatu/test/integration/tests/UserAdminStoreTest.java
(original)
+++
trunk/integration-tests/src/test/java/org/amdatu/test/integration/tests/UserAdminStoreTest.java
Fri Jan 21 17:05:27 2011
@@ -17,13 +17,15 @@
package org.amdatu.test.integration.tests;
import static org.ops4j.pax.exam.CoreOptions.provision;
+
+import java.io.IOException;
+
import junit.framework.Assert;
import org.amdatu.test.integration.base.ConfigProvider;
import org.amdatu.test.integration.base.IntegrationTestBase;
import org.apache.felix.dm.Component;
import org.apache.felix.dm.DependencyManager;
-import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Inject;
@@ -75,7 +77,7 @@
return new Component[] {
manager.createComponent().setImplementation(this)
.add(manager.createServiceDependency().setService(ConfigurationAdmin.class).setRequired(true))
-
.add(manager.createServiceDependency().setService(UserAdmin.class))
+ .add(manager.createServiceDependency().setService(UserAdmin.class))
};
}
@@ -84,15 +86,14 @@
Thread.sleep(WAIT);
}
- @Before
- public void setUp() throws Exception {
+ protected void initConfiguration() throws IOException {
m_configAdmin = getService(ConfigurationAdmin.class);
// Add cassandra and templates configs
ConfigProvider configProvider = new ConfigProvider();
configProvider.addCassandraConfig(m_configAdmin);
configProvider.addTemplateConfig(m_configAdmin);
-
+
m_userAdmin = getService(UserAdmin.class);
}