Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Sklyut2011-03-04 12:48:01 -0500
committerDmitry Sklyut2011-03-04 12:48:01 -0500
commitebeb2f75923102e95b3d304054ab66d670f241c6 (patch)
tree29e0c0220b3a5a282471410386b4c9bc287ab020 /org.eclipse.virgo.kernel.deployer.test
parent6d28bd05f7fff4b56d2373176db3078ff5d4199f (diff)
downloadorg.eclipse.virgo.kernel-ebeb2f75923102e95b3d304054ab66d670f241c6.tar.gz
org.eclipse.virgo.kernel-ebeb2f75923102e95b3d304054ab66d670f241c6.tar.xz
org.eclipse.virgo.kernel-ebeb2f75923102e95b3d304054ab66d670f241c6.zip
bug325735 - support deployment of config for managed service factory
Diffstat (limited to 'org.eclipse.virgo.kernel.deployer.test')
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/.project5
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/ConfigurationDeploymentTests.java58
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/ConfigurationTestUtils.java123
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/FactoryConfigurationDeploymentTests.java356
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/test/resources/configuration.deployment/factory-config-a.properties6
5 files changed, 495 insertions, 53 deletions
diff --git a/org.eclipse.virgo.kernel.deployer.test/.project b/org.eclipse.virgo.kernel.deployer.test/.project
index f79f9158..11a008c8 100644
--- a/org.eclipse.virgo.kernel.deployer.test/.project
+++ b/org.eclipse.virgo.kernel.deployer.test/.project
@@ -20,11 +20,6 @@
<arguments>
</arguments>
</buildCommand>
- <buildCommand>
- <name>com.springsource.server.ide.bundlor.core.builder</name>
- <arguments>
- </arguments>
- </buildCommand>
</buildSpec>
<natures>
<nature>com.springsource.server.ide.facet.core.bundlenature</nature>
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/ConfigurationDeploymentTests.java b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/ConfigurationDeploymentTests.java
index effd2b9b..3f49789e 100644
--- a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/ConfigurationDeploymentTests.java
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/ConfigurationDeploymentTests.java
@@ -160,27 +160,11 @@ public class ConfigurationDeploymentTests extends AbstractDeployerIntegrationTes
}
private void pollUntilInDeploymentIdentities(String type, String name, String version) throws InterruptedException {
- long start = System.currentTimeMillis();
-
- while (!isInDeploymentIdentities(type, name, version)) {
- long delta = System.currentTimeMillis() - start;
- if (delta > 60000) {
- fail("Deployment identity was not available within 60 seconds");
- }
- Thread.sleep(100);
- }
+ ConfigurationTestUtils.pollUntilInDeploymentIdentities(appDeployer, type, name, version);
}
private void pollUntilNotInDeploymentIdentities(String type, String name, String version) throws InterruptedException {
- long start = System.currentTimeMillis();
-
- while (isInDeploymentIdentities(type, name, version)) {
- long delta = System.currentTimeMillis() - start;
- if (delta > 60000) {
- fail("Deployment identity was still available after 60 seconds");
- }
- Thread.sleep(100);
- }
+ ConfigurationTestUtils.pollUntilNotInDeploymentIdentities(appDeployer, type, name, version);
}
@SuppressWarnings("unchecked")
@@ -206,40 +190,18 @@ public class ConfigurationDeploymentTests extends AbstractDeployerIntegrationTes
}
private boolean isInDeploymentIdentities(DeploymentIdentity deploymentIdentity) {
- boolean found = false;
- for (DeploymentIdentity id : this.appDeployer.getDeploymentIdentities()) {
- if (deploymentIdentity.equals(id)) {
- found = true;
- }
- }
- return found;
- }
-
- private boolean isInDeploymentIdentities(String type, String name, String version) {
- for (DeploymentIdentity id : this.appDeployer.getDeploymentIdentities()) {
- if (id.getType().equals(type) && id.getSymbolicName().equals(name) && id.getVersion().equals(version)) {
- return true;
- }
- }
- return false;
+ return ConfigurationTestUtils.isInDeploymentIdentities(appDeployer, deploymentIdentity);
}
private boolean isInConfigurationAdmin() throws IOException, InvalidSyntaxException {
- Configuration[] configurations = this.configAdmin.listConfigurations(null);
- for (Configuration configuration : configurations) {
- if ("t".equals(configuration.getPid())) {
- return true;
- }
- }
-
- return false;
+ return ConfigurationTestUtils.isInConfigurationAdmin(configAdmin, "t");
}
@SuppressWarnings("unchecked")
private void checkConfigAvailable() throws IOException, InvalidSyntaxException, InterruptedException {
- // Allow asynchronous delivery of configuration events to complete
- Thread.sleep(100);
-
+ // Allow asynchronous delivery of configuration events to complete
+ Thread.sleep(100);
+
long start = System.currentTimeMillis();
while (!isInConfigurationAdmin()) {
@@ -257,9 +219,9 @@ public class ConfigurationDeploymentTests extends AbstractDeployerIntegrationTes
}
private void checkConfigUnavailable() throws IOException, InvalidSyntaxException, InterruptedException {
- // Allow asynchronous delivery of configuration events to complete
- Thread.sleep(100);
-
+ // Allow asynchronous delivery of configuration events to complete
+ Thread.sleep(100);
+
assertFalse(isInConfigurationAdmin());
}
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/ConfigurationTestUtils.java b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/ConfigurationTestUtils.java
new file mode 100644
index 00000000..7daef1d7
--- /dev/null
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/ConfigurationTestUtils.java
@@ -0,0 +1,123 @@
+/*
+ * This file is part of the Eclipse Virgo project.
+ *
+ * Copyright (c) 2011 copyright_holder
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * dsklyut - initial contribution
+ */
+
+package org.eclipse.virgo.kernel.deployer.test;
+
+import static org.junit.Assert.fail;
+
+import java.io.IOException;
+
+import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer;
+import org.eclipse.virgo.kernel.deployer.core.DeploymentIdentity;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.service.cm.Configuration;
+import org.osgi.service.cm.ConfigurationAdmin;
+
+/**
+ * Utilities to share between configuration and factory configuration tests.
+ * <p />
+ *
+ */
+final class ConfigurationTestUtils {
+
+ static void pollUntilInDeploymentIdentities(ApplicationDeployer appDeployer, String type, String name, String version)
+ throws InterruptedException {
+ long start = System.currentTimeMillis();
+
+ while (!isInDeploymentIdentities(appDeployer, type, name, version)) {
+ long delta = System.currentTimeMillis() - start;
+ if (delta > 60000) {
+ fail("Deployment identity was not available within 60 seconds");
+ }
+ Thread.sleep(100);
+ }
+ }
+
+ static void pollUntilNotInDeploymentIdentities(ApplicationDeployer appDeployer, String type, String name, String version)
+ throws InterruptedException {
+ long start = System.currentTimeMillis();
+
+ while (isInDeploymentIdentities(appDeployer, type, name, version)) {
+ long delta = System.currentTimeMillis() - start;
+ if (delta > 60000) {
+ fail("Deployment identity was still available after 60 seconds");
+ }
+ Thread.sleep(100);
+ }
+ }
+
+ static boolean isInDeploymentIdentities(ApplicationDeployer appDeployer, DeploymentIdentity deploymentIdentity) {
+ for (DeploymentIdentity id : appDeployer.getDeploymentIdentities()) {
+ if (deploymentIdentity.equals(id)) {
+ return true;
+ }
+ }
+ return false;
+
+ }
+
+ static boolean isInDeploymentIdentities(ApplicationDeployer appDeployer, String type, String name, String version) {
+ for (DeploymentIdentity id : appDeployer.getDeploymentIdentities()) {
+ if (id.getType().equals(type) && id.getSymbolicName().equals(name) && id.getVersion().equals(version)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ static boolean isInConfigurationAdmin(ConfigurationAdmin configAdmin, String pid) throws IOException, InvalidSyntaxException {
+ Configuration[] configurations = configAdmin.listConfigurations(null);
+ for (Configuration configuration : configurations) {
+ if (pid.equals(configuration.getPid())) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ static boolean isFactoryInConfigurationAdmin(ConfigurationAdmin configAdmin, String factoryPid) throws IOException, InvalidSyntaxException {
+ Configuration[] configurations = configAdmin.listConfigurations(null);
+ for (Configuration configuration : configurations) {
+ if (factoryPid.equals(configuration.getFactoryPid())) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ static void pollUntilFactoryInConfigurationAdmin(ConfigurationAdmin configAdmin, String factoryPid) throws Exception {
+ long start = System.currentTimeMillis();
+
+ while (!isFactoryInConfigurationAdmin(configAdmin, factoryPid)) {
+ long delta = System.currentTimeMillis() - start;
+ if (delta > 60000) {
+ fail("Deployment identity was not available within 60 seconds");
+ }
+ Thread.sleep(100);
+ }
+ }
+
+ static void pollUntilFactoryNotInConfigurationAdmin(ConfigurationAdmin configAdmin, String factoryPid) throws Exception {
+ long start = System.currentTimeMillis();
+
+ while (isFactoryInConfigurationAdmin(configAdmin, factoryPid)) {
+ long delta = System.currentTimeMillis() - start;
+ if (delta > 60000) {
+ fail("Deployment identity was still available after 60 seconds");
+ }
+ Thread.sleep(100);
+ }
+ }
+}
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/FactoryConfigurationDeploymentTests.java b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/FactoryConfigurationDeploymentTests.java
new file mode 100644
index 00000000..9da2048c
--- /dev/null
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/FactoryConfigurationDeploymentTests.java
@@ -0,0 +1,356 @@
+
+package org.eclipse.virgo.kernel.deployer.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.Properties;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer;
+import org.eclipse.virgo.kernel.deployer.core.DeploymentIdentity;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.cm.Configuration;
+import org.osgi.service.cm.ConfigurationAdmin;
+import org.osgi.service.cm.ConfigurationException;
+import org.osgi.service.cm.ManagedServiceFactory;
+
+public class FactoryConfigurationDeploymentTests extends AbstractDeployerIntegrationTest {
+
+ private ServiceReference<ApplicationDeployer> appDeployerServiceReference;
+
+ private ApplicationDeployer appDeployer;
+
+ private ServiceReference<ConfigurationAdmin> configAdminServiceReference;
+
+ private ConfigurationAdmin configAdmin;
+
+ @Before
+ public void setUp() throws Exception {
+ this.appDeployerServiceReference = this.context.getServiceReference(ApplicationDeployer.class);
+ this.appDeployer = this.context.getService(this.appDeployerServiceReference);
+ this.configAdminServiceReference = this.context.getServiceReference(ConfigurationAdmin.class);
+ this.configAdmin = this.context.getService(this.configAdminServiceReference);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ if (this.appDeployerServiceReference != null) {
+ this.context.ungetService(this.appDeployerServiceReference);
+ }
+ if (this.configAdminServiceReference != null) {
+ this.context.ungetService(this.configAdminServiceReference);
+ }
+ }
+
+ @SuppressWarnings("rawtypes")
+ private static class TestManagedServiceFactory implements ManagedServiceFactory {
+
+ private volatile Dictionary properties;
+
+ private final AtomicInteger updateCallCount = new AtomicInteger(0);
+
+ private final AtomicInteger deleteCallCount = new AtomicInteger(0);
+
+ @Override
+ public String getName() {
+ return "Test Managed Service Factory";
+ }
+
+ @Override
+ public void updated(String pid, Dictionary properties) throws ConfigurationException {
+ this.updateCallCount.incrementAndGet();
+ this.properties = properties;
+ }
+
+ @Override
+ public void deleted(String pid) {
+ this.deleteCallCount.incrementAndGet();
+ }
+
+ Dictionary getProperties() {
+ return this.properties;
+ }
+
+ int updateCount() {
+ return this.updateCallCount.get();
+ }
+
+ int deleteCount() {
+ return this.deleteCallCount.get();
+ }
+ }
+
+ @Test
+ @SuppressWarnings("rawtypes")
+ public void testSimpleDeployUndeployOfFactoryConfig() throws Exception {
+
+ Hashtable<String, String> properties = new Hashtable<String, String>();
+ properties.put(Constants.SERVICE_PID, "test.factory.pid.a");
+ TestManagedServiceFactory service = new TestManagedServiceFactory();
+ this.context.registerService(ManagedServiceFactory.class, service, properties);
+
+ // make sure that we are starting off with a clean slate
+ assertEquals(0, countFactoryConfigurations("test.factory.pid.a"));
+
+ File configurationFile = new File("src/test/resources/configuration.deployment/factory-config-a.properties");
+
+ DeploymentIdentity deploymentIdentity = this.appDeployer.deploy(configurationFile.toURI());
+ assertNotNull(deploymentIdentity);
+
+ // let it deploy
+ Thread.sleep(1000);
+
+ assertEquals(1, countFactoryConfigurations("test.factory.pid.a"));
+ assertEquals(1, service.updateCount());
+ assertEquals(0, service.deleteCount());
+ Dictionary propertiesFromService = service.getProperties();
+ assertNotNull(propertiesFromService);
+ assertEquals("prop1", propertiesFromService.get("prop1"));
+ assertEquals("2", propertiesFromService.get("prop2"));
+
+ this.appDeployer.undeploy(deploymentIdentity);
+
+ // give time for events to percolate
+ Thread.sleep(1000);
+
+ assertEquals(0, countFactoryConfigurations("test.factory.pid.a"));
+ assertEquals(1, service.updateCount());
+ assertEquals(1, service.deleteCount());
+
+ // now lets make sure that we can deploy it again
+ deploymentIdentity = this.appDeployer.deploy(configurationFile.toURI());
+ Thread.sleep(1000);
+ assertEquals(1, countFactoryConfigurations("test.factory.pid.a"));
+ assertEquals(2, service.updateCount());
+ assertEquals(1, service.deleteCount());
+
+ this.appDeployer.undeploy(deploymentIdentity);
+ }
+
+ @Test
+ @SuppressWarnings("rawtypes")
+ public void testHotDeployFactoryConfiguration() throws Exception {
+
+ final String factoryPid = "test.factory.pid.hot";
+ final Properties hotDeployConfiguration = new Properties();
+ hotDeployConfiguration.setProperty(ConfigurationAdmin.SERVICE_FACTORYPID, factoryPid);
+ hotDeployConfiguration.setProperty("prop1", "prop1");
+ hotDeployConfiguration.setProperty("prop2", "2");
+
+ File target = new File("target/pickup/factory-config-a-hot.properties");
+
+ if (target.exists()) {
+ assertTrue(target.delete());
+ }
+
+ try {
+ Hashtable<String, String> properties = new Hashtable<String, String>();
+ properties.put(Constants.SERVICE_PID, factoryPid);
+ TestManagedServiceFactory service = new TestManagedServiceFactory();
+ this.context.registerService(ManagedServiceFactory.class, service, properties);
+
+ // make sure that we are starting off with a clean slate
+ assertEquals(0, countFactoryConfigurations(factoryPid));
+
+ // copy file to hot deploy location
+ hotDeployConfiguration.store(new FileOutputStream(target), "no comment");
+
+ ConfigurationTestUtils.pollUntilFactoryInConfigurationAdmin(configAdmin, factoryPid);
+ assertEquals(1, countFactoryConfigurations(factoryPid));
+ assertEquals(1, service.updateCount());
+ assertEquals(0, service.deleteCount());
+
+ Dictionary propertiesFromService = service.getProperties();
+ assertNotNull(propertiesFromService);
+ assertEquals("prop1", propertiesFromService.get("prop1"));
+ assertEquals("2", propertiesFromService.get("prop2"));
+
+ // remove the file and let it be removed
+ target.delete();
+ ConfigurationTestUtils.pollUntilFactoryNotInConfigurationAdmin(configAdmin, factoryPid);
+
+ assertEquals(0, countFactoryConfigurations(factoryPid));
+ assertEquals(1, service.updateCount());
+ assertEquals(1, service.deleteCount());
+ } finally {
+ if (target.exists()) {
+ target.delete();
+ }
+ }
+
+ }
+
+ @Test
+ @SuppressWarnings("rawtypes")
+ public void testHotDeployWithUpdateFactoryConfiguration() throws Exception {
+
+ final String factoryPid = "test.factory.pid.hot.update";
+ final Properties hotDeployConfiguration = new Properties();
+ hotDeployConfiguration.setProperty(ConfigurationAdmin.SERVICE_FACTORYPID, factoryPid);
+ hotDeployConfiguration.setProperty("prop1", "prop1");
+ hotDeployConfiguration.setProperty("prop2", "2");
+
+ File target = new File("target/pickup/factory-config-a-hot-update.properties");
+
+ if (target.exists()) {
+ assertTrue(target.delete());
+ }
+
+ try {
+
+ Hashtable<String, String> properties = new Hashtable<String, String>();
+ properties.put(Constants.SERVICE_PID, factoryPid);
+ TestManagedServiceFactory service = new TestManagedServiceFactory();
+ this.context.registerService(ManagedServiceFactory.class, service, properties);
+
+ // make sure that we are starting off with a clean slate
+ assertEquals(0, countFactoryConfigurations(factoryPid));
+
+ // copy file to hot deploy location
+ hotDeployConfiguration.store(new FileOutputStream(target), "initial");
+
+ ConfigurationTestUtils.pollUntilFactoryInConfigurationAdmin(configAdmin, factoryPid);
+ // let events propagate
+ Thread.sleep(100);
+ assertEquals(1, countFactoryConfigurations(factoryPid));
+ assertEquals(1, service.updateCount());
+ assertEquals(0, service.deleteCount());
+
+ Dictionary propertiesFromService = service.getProperties();
+ assertNotNull(propertiesFromService);
+ assertEquals("prop1", propertiesFromService.get("prop1"));
+ assertEquals("2", propertiesFromService.get("prop2"));
+
+ // update configuration
+ hotDeployConfiguration.setProperty("prop2", "22");
+ // save updated configuration
+ hotDeployConfiguration.store(new FileOutputStream(target), "updated");
+
+ // let events propagate and update happen
+ Thread.sleep(3000);
+ assertEquals(1, countFactoryConfigurations(factoryPid));
+ assertEquals(2, service.updateCount());
+ assertEquals(0, service.deleteCount());
+
+ propertiesFromService = service.getProperties();
+ assertNotNull(propertiesFromService);
+ assertEquals("prop1", propertiesFromService.get("prop1"));
+ assertEquals("22", propertiesFromService.get("prop2"));
+
+ // remove the file and let it be removed
+ target.delete();
+ ConfigurationTestUtils.pollUntilFactoryNotInConfigurationAdmin(configAdmin, factoryPid);
+
+ assertEquals(0, countFactoryConfigurations(factoryPid));
+ assertEquals(2, service.updateCount());
+ assertEquals(1, service.deleteCount());
+ } finally {
+ if (target.exists()) {
+ target.delete();
+ }
+ }
+ }
+
+ @Test
+ @SuppressWarnings("rawtypes")
+ public void testHotDeployMultipleFactoryConfiguration() throws Exception {
+
+ final String factoryPid = "test.factory.pid.hot.multiple";
+
+ final Properties configOne = new Properties();
+ configOne.setProperty(ConfigurationAdmin.SERVICE_FACTORYPID, factoryPid);
+ configOne.setProperty("prop1", "prop1");
+ configOne.setProperty("prop2", "1");
+
+ final Properties configTwo = new Properties();
+ configTwo.setProperty(ConfigurationAdmin.SERVICE_FACTORYPID, factoryPid);
+ configTwo.setProperty("prop1", "prop2");
+ configTwo.setProperty("prop2", "2");
+
+ final File targetOne = new File("target/pickup/factory-config-a-hot-update-1.properties");
+ final File targetTwo = new File("target/pickup/factory-config-a-hot-update-2.properties");
+
+ if (targetOne.exists()) {
+ assertTrue(targetOne.delete());
+ }
+ if (targetTwo.exists()) {
+ assertTrue(targetTwo.delete());
+ }
+
+ try {
+
+ Hashtable<String, String> properties = new Hashtable<String, String>();
+ properties.put(Constants.SERVICE_PID, factoryPid);
+ TestManagedServiceFactory service = new TestManagedServiceFactory();
+ this.context.registerService(ManagedServiceFactory.class, service, properties);
+
+ // make sure that we are starting off with a clean slate
+ assertEquals(0, countFactoryConfigurations(factoryPid));
+
+ // copy file to hot deploy location
+ configOne.store(new FileOutputStream(targetOne), "initial");
+
+ ConfigurationTestUtils.pollUntilFactoryInConfigurationAdmin(configAdmin, factoryPid);
+ // let events propagate
+ Thread.sleep(100);
+ assertEquals(1, countFactoryConfigurations(factoryPid));
+ assertEquals(1, service.updateCount());
+ assertEquals(0, service.deleteCount());
+
+ // validate first configuration
+ Dictionary propertiesFromService = service.getProperties();
+ assertNotNull(propertiesFromService);
+ assertEquals("prop1", propertiesFromService.get("prop1"));
+ assertEquals("1", propertiesFromService.get("prop2"));
+
+ configTwo.store(new FileOutputStream(targetTwo), "initial");
+ Thread.sleep(3000);
+ assertEquals(2, countFactoryConfigurations(factoryPid));
+ assertEquals(2, service.updateCount());
+ assertEquals(0, service.deleteCount());
+
+ propertiesFromService = service.getProperties();
+ assertNotNull(propertiesFromService);
+ assertEquals("prop2", propertiesFromService.get("prop1"));
+ assertEquals("2", propertiesFromService.get("prop2"));
+
+ assertTrue(targetOne.delete());
+ assertTrue(targetTwo.delete());
+
+ // let events propagate and update happen
+ ConfigurationTestUtils.pollUntilFactoryNotInConfigurationAdmin(configAdmin, factoryPid);
+ assertEquals(0, countFactoryConfigurations(factoryPid));
+ assertEquals(2, service.updateCount());
+ assertEquals(2, service.deleteCount());
+
+ } finally {
+ if (targetOne.exists()) {
+ targetOne.delete();
+ }
+ if (targetTwo.exists()) {
+ targetTwo.delete();
+ }
+ }
+ }
+
+ private int countFactoryConfigurations(String factoryPid) throws Exception {
+ Configuration[] configurations = this.configAdmin.listConfigurations(null);
+ int counter = 0;
+ for (Configuration c : configurations) {
+ if (factoryPid.equals(c.getFactoryPid())) {
+ counter++;
+ }
+ }
+ return counter;
+ }
+}
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/resources/configuration.deployment/factory-config-a.properties b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/configuration.deployment/factory-config-a.properties
new file mode 100644
index 00000000..6313f1a1
--- /dev/null
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/configuration.deployment/factory-config-a.properties
@@ -0,0 +1,6 @@
+# factory pid for config admin service
+service.factoryPid = test.factory.pid.a
+
+# properties for the managed service
+prop1 = prop1
+prop2 = 2 \ No newline at end of file

Back to the top