Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2011-03-11 10:07:27 -0500
committerGlyn Normington2011-03-11 10:07:27 -0500
commitf40763f49ddf7b5eb73e6b70063b76b5fea9828f (patch)
treea6a29dda507fe780968e0d90ab76df319e9437e2
parentdd1885e0dee73ceea135bb978a5a957282bbc504 (diff)
parent36b7b669bedc99d1921b2d8adb7a7dad5512b1fc (diff)
downloadorg.eclipse.virgo.kernel-f40763f49ddf7b5eb73e6b70063b76b5fea9828f.tar.gz
org.eclipse.virgo.kernel-f40763f49ddf7b5eb73e6b70063b76b5fea9828f.tar.xz
org.eclipse.virgo.kernel-f40763f49ddf7b5eb73e6b70063b76b5fea9828f.zip
Merge branch 'master' into region_api
Conflicts: org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionResolverHook.java org.eclipse.virgo.kernel.userregionfactory/src/main/java/org/eclipse/virgo/kernel/userregionfactory/Activator.java
-rw-r--r--build-kernel/config/org.eclipse.virgo.kernel.userregion.properties13
-rw-r--r--build-kernel/lib-ivy.xml1
-rw-r--r--build.versions2
-rw-r--r--org.eclipse.virgo.kernel.artifact/.classpath4
-rw-r--r--org.eclipse.virgo.kernel.artifact/ivy.xml3
-rw-r--r--org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/par/ParBridge.java2
-rw-r--r--org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/properties/PropertiesBridge.java62
-rw-r--r--org.eclipse.virgo.kernel.artifact/src/test/java/org/eclipse/virgo/kernel/artifact/properties/PropertiesBridgeTests.java77
-rw-r--r--org.eclipse.virgo.kernel.artifact/src/test/resources/properties/factoryPid.properties6
-rw-r--r--org.eclipse.virgo.kernel.artifact/src/test/resources/properties/with-service-pid.properties6
-rw-r--r--org.eclipse.virgo.kernel.artifact/template.mf1
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/.classpath2
-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.java372
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/test/resources/config/org.eclipse.virgo.kernel.userregion.properties8
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/test/resources/configuration.deployment/factory-config-a.properties6
-rw-r--r--org.eclipse.virgo.kernel.deployer/.classpath2
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/ServerApplicationInfo.java64
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/ServerModuleInfo.java47
-rw-r--r--org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/KernelRegionBundle.java101
-rw-r--r--org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/NotifyingRuntimeArtifactRepository.java8
-rw-r--r--org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/BundleArtifact.java2
-rw-r--r--org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/BundleDependencyDeterminer.java12
-rw-r--r--org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/QuasiBundleArtifact.java211
-rw-r--r--org.eclipse.virgo.kernel.model/src/main/resources/META-INF/spring/module-context.xml2
-rw-r--r--org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/KernelRegionBundleTests.java35
-rw-r--r--org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/NotifyingArtifactRepositoryTests.java14
-rw-r--r--org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/bundle/BundleDependencyDeterminerTests.java14
-rw-r--r--org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/bundle/QuasiBundleArtifactTests.java170
-rw-r--r--org.eclipse.virgo.kernel.osgi/.classpath2
-rw-r--r--org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/eventlog/RegionAwareEventLoggerServiceFactory.java56
-rw-r--r--org.eclipse.virgo.kernel.osgi/src/main/resources/EventLogMessages.properties8
-rw-r--r--org.eclipse.virgo.kernel.services/.classpath2
-rw-r--r--org.eclipse.virgo.kernel.services/src/main/java/org/eclipse/virgo/kernel/services/repository/internal/EmptyRepository.java14
-rw-r--r--org.eclipse.virgo.kernel.services/src/main/resources/META-INF/spring/repository-context.xml3
-rw-r--r--org.eclipse.virgo.kernel.services/template.mf1
-rw-r--r--org.eclipse.virgo.kernel.shell/.classpath2
-rw-r--r--org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/model/helper/StandardRamAccessorHelper.java25
-rw-r--r--org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/state/internal/KernelRegionFauxQuasiLiveBundle.java194
-rw-r--r--org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/state/internal/StandardQuasiLiveBundle.java6
-rw-r--r--org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/state/internal/StandardQuasiLiveFramework.java8
-rw-r--r--org.eclipse.virgo.kernel.shell/src/test/java/org/eclipse/virgo/kernel/shell/model/helper/StandardRamAccessorHelperTests.java6
-rw-r--r--org.eclipse.virgo.kernel.shell/src/test/java/org/eclipse/virgo/kernel/shell/state/internal/StandardStateServiceTests.java6
-rw-r--r--org.eclipse.virgo.kernel.test/.project5
-rw-r--r--org.eclipse.virgo.kernel.test/src/test/resources/config/org.eclipse.virgo.kernel.userregion.properties5
-rw-r--r--org.eclipse.virgo.kernel.userregion/.classpath2
-rw-r--r--org.eclipse.virgo.kernel.userregionfactory/src/main/java/org/eclipse/virgo/kernel/userregionfactory/Activator.java23
-rw-r--r--org.eclipse.virgo.kernel.userregionfactory/src/main/java/org/eclipse/virgo/kernel/userregionfactory/PackageImportWildcardExpander.java18
-rw-r--r--org.eclipse.virgo.kernel.userregionfactory/src/main/java/org/eclipse/virgo/kernel/userregionfactory/UserRegionFactoryLogEvents.java54
-rw-r--r--org.eclipse.virgo.kernel.userregionfactory/src/main/java/org/eclipse/virgo/kernel/userregionfactory/UserRegionFactoryParserLogger.java3
-rw-r--r--org.eclipse.virgo.kernel.userregionfactory/src/main/resources/EventLogMessages.properties16
-rw-r--r--org.eclipse.virgo.kernel.userregionfactory/src/test/java/org/eclipse/virgo/kernel/userregionfactory/PackageImportWildcardExpanderTests.java5
54 files changed, 1204 insertions, 693 deletions
diff --git a/build-kernel/config/org.eclipse.virgo.kernel.userregion.properties b/build-kernel/config/org.eclipse.virgo.kernel.userregion.properties
index 5180787b..26007bea 100644
--- a/build-kernel/config/org.eclipse.virgo.kernel.userregion.properties
+++ b/build-kernel/config/org.eclipse.virgo.kernel.userregion.properties
@@ -27,21 +27,10 @@ packageImports =\
org.apache.commons.logging;version="[1.0.0,2.0.0)",\
org.apache.commons.logging.impl;version="[1.0.0,2.0.0)",\
org.aspectj.*;version="[1.6.5.RELEASE,2.0.0)",\
- org.osgi.*;version="0",\
- org.ietf.jgss;version="0",\
- org.omg.*;version="0",\
- org.w3c.*;version="0",\
- org.xml.*;version="0",\
- org.eclipse.osgi.*;version="0",\
- javax.*;version="0",\
org.osgi.service.cm;version="0",\
- org.osgi.service.log;version="0",\
org.osgi.service.event;version="0",\
org.slf4j;version="[1.6.1,2)",\
- org.slf4j.spi;version="[1.6.1,2)",\
- org.eclipse.core.runtime.*;version="0",\
- org.eclipse.equinox.log;version="0",\
- org.eclipse.equinox.log.*;version="0"
+ org.slf4j.spi;version="[1.6.1,2)"
serviceImports =\
org.eclipse.virgo.kernel.osgi.region.Region,\
diff --git a/build-kernel/lib-ivy.xml b/build-kernel/lib-ivy.xml
index b7629329..896e0c3e 100644
--- a/build-kernel/lib-ivy.xml
+++ b/build-kernel/lib-ivy.xml
@@ -16,6 +16,7 @@
<dependency org="org.eclipse.virgo.osgi" name="org.eclipse.virgo.osgi.launcher" rev="${org.eclipse.virgo.osgi}" conf="lib->runtime"/>
<dependency org="org.eclipse.virgo.osgi" name="org.eclipse.virgo.osgi.extensions.equinox" rev="${org.eclipse.virgo.osgi}" conf="lib->runtime"/>
<dependency org="org.eclipse.virgo.osgi" name="org.eclipse.virgo.osgi.console" rev="${org.eclipse.virgo.osgi}" conf="lib->runtime"/>
+ <dependency org="javax.transaction" name="com.springsource.javax.transaction" rev="${javax.transaction}" conf="lib->runtime"/>
</dependencies>
</ivy-module>
diff --git a/build.versions b/build.versions
index 94636c07..d582a22c 100644
--- a/build.versions
+++ b/build.versions
@@ -8,7 +8,7 @@ org.aspectj=1.6.6.RELEASE
org.eclipse.osgi=3.7.0.v20110224
org.eclipse.virgo.medic=3.0.0.M02
org.eclipse.virgo.osgi=3.0.0.M02
-org.eclipse.virgo.repository=3.0.0.M02
+org.eclipse.virgo.repository=3.0.0.D-20110309170144
org.eclipse.virgo.util=3.0.0.M02
org.slf4j=1.6.1
org.slf4j.spi=1.6.1
diff --git a/org.eclipse.virgo.kernel.artifact/.classpath b/org.eclipse.virgo.kernel.artifact/.classpath
index a75419e7..84a7dce8 100644
--- a/org.eclipse.virgo.kernel.artifact/.classpath
+++ b/org.eclipse.virgo.kernel.artifact/.classpath
@@ -22,7 +22,7 @@
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.junit/com.springsource.org.junit/4.7.0/com.springsource.org.junit-4.7.0.jar" sourcepath="/KERNEL_IVY_CACHE/org.junit/com.springsource.org.junit/4.7.0/com.springsource.org.junit-sources-4.7.0.jar"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/3.0.0.M02/org.eclipse.virgo.repository-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/3.0.0.M02/org.eclipse.virgo.repository-sources-3.0.0.M02.jar"/>
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/3.0.0.D-20110309170144/org.eclipse.virgo.repository-3.0.0.D-20110309170144.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/3.0.0.D-20110309170144/org.eclipse.virgo.repository-sources-3.0.0.D-20110309170144.jar"/>
<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/3.0.0.M02/org.eclipse.virgo.util.io-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/3.0.0.M02/org.eclipse.virgo.util.io-sources-3.0.0.M02.jar"/>
<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/3.0.0.M02/org.eclipse.virgo.util.osgi-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/3.0.0.M02/org.eclipse.virgo.util.osgi-sources-3.0.0.M02.jar"/>
<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.parser.manifest/3.0.0.M02/org.eclipse.virgo.util.parser.manifest-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.parser.manifest/3.0.0.M02/org.eclipse.virgo.util.parser.manifest-sources-3.0.0.M02.jar"/>
@@ -33,5 +33,7 @@
<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.aspectj/com.springsource.org.aspectj.runtime/1.6.6.RELEASE/com.springsource.org.aspectj.runtime-1.6.6.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.aspectj/com.springsource.org.aspectj.runtime/1.6.6.RELEASE/com.springsource.org.aspectj.runtime-1.6.6.RELEASE.jar"/>
<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/3.0.0.M02/org.eclipse.virgo.medic-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/1.0.0.CI-B20/org.eclipse.virgo.medic-sources-1.0.0.CI-B20.jar"/>
<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.core/3.0.0.M02/org.eclipse.virgo.medic.core-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.core/3.0.0.M02/org.eclipse.virgo.medic.core-sources-3.0.0.M02.jar"/>
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi.services/3.3.0.v20110110/org.eclipse.osgi.services-3.3.0.v20110110.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi.services/3.3.0.v20110110/org.eclipse.osgi.services-sources-3.3.0.v20110110.jar"/>
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.easymock/com.springsource.org.easymock/2.3.0/com.springsource.org.easymock-2.3.0.jar" sourcepath="/KERNEL_IVY_CACHE/org.easymock/com.springsource.org.easymock/2.3.0/com.springsource.org.easymock-sources-2.3.0.jar"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
diff --git a/org.eclipse.virgo.kernel.artifact/ivy.xml b/org.eclipse.virgo.kernel.artifact/ivy.xml
index 4b96c7e7..4090f3f5 100644
--- a/org.eclipse.virgo.kernel.artifact/ivy.xml
+++ b/org.eclipse.virgo.kernel.artifact/ivy.xml
@@ -17,11 +17,14 @@
<dependency org="org.eclipse.virgo.repository" name="org.eclipse.virgo.repository" rev="${org.eclipse.virgo.repository}" conf="compile->compile" />
<dependency org="org.junit" name="com.springsource.org.junit" rev="${org.junit}" conf="test->runtime"/>
+ <dependency org="org.easymock" name="com.springsource.org.easymock" rev="${org.easymock}" conf="test->runtime"/>
<dependency org="org.slf4j" name="com.springsource.slf4j.nop" rev="${org.slf4j}" conf="test->runtime"/>
<dependency org="javax.servlet" name="com.springsource.javax.servlet" rev="${javax.servlet}" conf="test->runtime"/>
<dependency org="org.apache.commons" name="com.springsource.org.apache.commons.dbcp" rev="${commons.dbcp}" conf="test->runtime" />
<dependency org="org.aopalliance" name="com.springsource.org.aopalliance" rev="${org.aopalliance}" conf="test->runtime" />
+
+ <dependency org="org.eclipse.osgi" name="org.eclipse.osgi.services" rev="${org.eclipse.osgi.services}" conf="compile->runtime"/>
<override org="org.eclipse.virgo.util" rev="${org.eclipse.virgo.util}"/>
</dependencies>
diff --git a/org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/par/ParBridge.java b/org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/par/ParBridge.java
index 35791e57..d3f145a0 100644
--- a/org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/par/ParBridge.java
+++ b/org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/par/ParBridge.java
@@ -14,8 +14,6 @@ package org.eclipse.virgo.kernel.artifact.par;
import java.io.File;
import java.io.IOException;
-import org.osgi.framework.Version;
-
import org.eclipse.virgo.kernel.artifact.internal.BundleManifestUtils;
import org.eclipse.virgo.repository.ArtifactBridge;
import org.eclipse.virgo.repository.ArtifactDescriptor;
diff --git a/org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/properties/PropertiesBridge.java b/org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/properties/PropertiesBridge.java
index a1963ff6..cd62c9ba 100644
--- a/org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/properties/PropertiesBridge.java
+++ b/org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/properties/PropertiesBridge.java
@@ -16,14 +16,17 @@ import java.io.FileReader;
import java.io.IOException;
import java.util.Properties;
-import org.osgi.framework.Version;
-
import org.eclipse.virgo.repository.ArtifactBridge;
import org.eclipse.virgo.repository.ArtifactDescriptor;
import org.eclipse.virgo.repository.ArtifactGenerationException;
import org.eclipse.virgo.repository.HashGenerator;
import org.eclipse.virgo.repository.builder.ArtifactDescriptorBuilder;
+import org.eclipse.virgo.repository.builder.AttributeBuilder;
+import org.eclipse.virgo.util.common.StringUtils;
import org.eclipse.virgo.util.io.IOUtils;
+import org.osgi.framework.Constants;
+import org.osgi.framework.Version;
+import org.osgi.service.cm.ConfigurationAdmin;
/**
* An {@link ArtifactBridge} that creates {@link ArtifactDescriptor ArtifactDescriptors} for .properties files.
@@ -42,8 +45,11 @@ public final class PropertiesBridge implements ArtifactBridge {
private final HashGenerator hashGenerator;
- public PropertiesBridge(HashGenerator hashGenerator) {
+ private final ConfigurationAdmin configAdmin;
+
+ public PropertiesBridge(HashGenerator hashGenerator, ConfigurationAdmin configAdmin) {
this.hashGenerator = hashGenerator;
+ this.configAdmin = configAdmin;
}
public ArtifactDescriptor generateArtifactDescriptor(File artifactFile) throws ArtifactGenerationException {
@@ -51,10 +57,11 @@ public final class PropertiesBridge implements ArtifactBridge {
FileReader reader = null;
try {
reader = new FileReader(artifactFile);
- new Properties().load(reader);
- return createArtifactDescriptor(artifactFile);
+ Properties properties = new Properties();
+ properties.load(reader);
+ return createArtifactDescriptor(artifactFile, properties);
} catch (IOException e) {
- throw new ArtifactGenerationException("Failed to read properties file", ARTIFACT_TYPE, e);
+ throw new ArtifactGenerationException("Failed processing properties file", ARTIFACT_TYPE, e);
} finally {
IOUtils.closeQuietly(reader);
}
@@ -62,10 +69,43 @@ public final class PropertiesBridge implements ArtifactBridge {
return null;
}
- private ArtifactDescriptor createArtifactDescriptor(File propertiesFile) {
- String fileName = propertiesFile.getName();
- String name = fileName.substring(0, fileName.length() - PROPERTIES_SUFFIX.length());
+ private ArtifactDescriptor createArtifactDescriptor(File propertiesFile, Properties properties) throws IOException {
+
+ String name = properties.getProperty(ConfigurationAdmin.SERVICE_FACTORYPID);
+ if (StringUtils.hasText(name)) {
+ // this is a factory configuration - need to generate actual PID for a new configuration
+ return buildForManagedServiceFactoryConfiguration(propertiesFile, name, properties);
+ }
+
+ name = properties.getProperty(Constants.SERVICE_PID);
+ if (!StringUtils.hasText(name)) {
+ String fileName = propertiesFile.getName();
+ name = fileName.substring(0, fileName.length() - PROPERTIES_SUFFIX.length());
+ }
+
+ return buildAtrifactDescriptor(propertiesFile, name).build();
+ }
+
+ /**
+ * @param propertiesFile
+ * @param name
+ * @param properties
+ * @return
+ * @throws IOException
+ */
+ private ArtifactDescriptor buildForManagedServiceFactoryConfiguration(File propertiesFile, String factoryPid, Properties properties)
+ throws IOException {
+
+ // generated service.pid - will use as a name for artifactId
+ String pid = configAdmin.createFactoryConfiguration(factoryPid, null).getPid();
+ ArtifactDescriptorBuilder builder = buildAtrifactDescriptor(propertiesFile, pid);
+ builder.addAttribute(new AttributeBuilder().setName(ConfigurationAdmin.SERVICE_FACTORYPID).setValue(factoryPid).build());
+
+ return builder.build();
+ }
+
+ private ArtifactDescriptorBuilder buildAtrifactDescriptor(File propertiesFile, String name) {
ArtifactDescriptorBuilder artifactDescriptorBuilder = new ArtifactDescriptorBuilder();
artifactDescriptorBuilder //
@@ -73,9 +113,9 @@ public final class PropertiesBridge implements ArtifactBridge {
.setType(ARTIFACT_TYPE) //
.setName(name) //
.setVersion(Version.emptyVersion);
-
+
this.hashGenerator.generateHash(artifactDescriptorBuilder, propertiesFile);
- return artifactDescriptorBuilder.build();
+ return artifactDescriptorBuilder;
}
}
diff --git a/org.eclipse.virgo.kernel.artifact/src/test/java/org/eclipse/virgo/kernel/artifact/properties/PropertiesBridgeTests.java b/org.eclipse.virgo.kernel.artifact/src/test/java/org/eclipse/virgo/kernel/artifact/properties/PropertiesBridgeTests.java
index 4f046b2b..d0aa49f4 100644
--- a/org.eclipse.virgo.kernel.artifact/src/test/java/org/eclipse/virgo/kernel/artifact/properties/PropertiesBridgeTests.java
+++ b/org.eclipse.virgo.kernel.artifact/src/test/java/org/eclipse/virgo/kernel/artifact/properties/PropertiesBridgeTests.java
@@ -11,18 +11,23 @@
package org.eclipse.virgo.kernel.artifact.properties;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
+import static org.junit.Assert.*;
+import static org.easymock.EasyMock.*;
import java.io.File;
+import java.io.IOException;
+import java.util.Set;
import org.junit.Test;
+import org.osgi.service.cm.Configuration;
+import org.osgi.service.cm.ConfigurationAdmin;
-
+import org.easymock.EasyMock;
import org.eclipse.virgo.kernel.artifact.StubHashGenerator;
import org.eclipse.virgo.kernel.artifact.properties.PropertiesBridge;
import org.eclipse.virgo.repository.ArtifactDescriptor;
import org.eclipse.virgo.repository.ArtifactGenerationException;
+import org.eclipse.virgo.repository.Attribute;
/**
*/
@@ -30,14 +35,14 @@ public class PropertiesBridgeTests {
@Test
public void testGeneratePropertiesFile() throws ArtifactGenerationException {
- PropertiesBridge bridge = new PropertiesBridge(new StubHashGenerator());
+ PropertiesBridge bridge = new PropertiesBridge(new StubHashGenerator(), EasyMock.createMock(ConfigurationAdmin.class));
ArtifactDescriptor result = bridge.generateArtifactDescriptor(new File("src/test/resources/properties/foo.properties"));
assertNotNull(result);
}
@Test(expected = ArtifactGenerationException.class)
public void testFileDoesNotExist() throws ArtifactGenerationException {
- PropertiesBridge bridge = new PropertiesBridge(new StubHashGenerator());
+ PropertiesBridge bridge = new PropertiesBridge(new StubHashGenerator(), EasyMock.createMock(ConfigurationAdmin.class));
File file = new File("src/test/resources/properties/not.exist.properties");
bridge.generateArtifactDescriptor(file);
@@ -45,8 +50,68 @@ public class PropertiesBridgeTests {
@Test
public void testGenerateNotPropertiesFile() throws ArtifactGenerationException {
- PropertiesBridge bridge = new PropertiesBridge(new StubHashGenerator());
+ PropertiesBridge bridge = new PropertiesBridge(new StubHashGenerator(), createMock(ConfigurationAdmin.class));
ArtifactDescriptor descriptor = bridge.generateArtifactDescriptor(new File("src/test/resources/bar.noterties"));
assertNull(descriptor);
}
+
+ @Test
+ public void testGenerateWithFactoryPid() throws ArtifactGenerationException {
+ final String factoryPid = "test.factory.pid";
+ final String propertiesFile = "src/test/resources/properties/factoryPid.properties";
+
+ ConfigurationAdmin mockConfigAdmin = createMock(ConfigurationAdmin.class);
+ Configuration mockConfiguration = createMock(Configuration.class);
+
+ try {
+ expect(mockConfigAdmin.createFactoryConfiguration(factoryPid, null)).andReturn(mockConfiguration);
+ } catch (IOException e) {
+ fail(e.getMessage());
+ }
+ expect(mockConfiguration.getPid()).andReturn("1");
+
+ replay(mockConfigAdmin, mockConfiguration);
+
+ PropertiesBridge bridge = new PropertiesBridge(new StubHashGenerator(), mockConfigAdmin);
+ ArtifactDescriptor descriptor = bridge.generateArtifactDescriptor(new File(propertiesFile));
+
+ verify(mockConfigAdmin, mockConfiguration);
+
+ // asserts
+ assertNotNull(descriptor);
+ assertEquals("1", descriptor.getName());
+ // only expect one attribute
+ Set<Attribute> attrSet = descriptor.getAttribute(ConfigurationAdmin.SERVICE_FACTORYPID);
+ assertEquals(1, attrSet.size());
+ Attribute attr = attrSet.iterator().next();
+ assertNotNull(factoryPid, attr.getValue());
+ }
+
+ @Test(expected = ArtifactGenerationException.class)
+ public void testGenerateWithFactoryPidAndIoExceptionFromConfigAdmin() throws ArtifactGenerationException {
+ final String factoryPid = "test.factory.pid";
+ final String propertiesFile = "src/test/resources/properties/factoryPid.properties";
+
+ ConfigurationAdmin mockConfigAdmin = createMock(ConfigurationAdmin.class);
+
+ try {
+ expect(mockConfigAdmin.createFactoryConfiguration(factoryPid, null)).andThrow(new IOException("exception from configadmin"));
+ } catch (IOException e) {
+ // I really hate checked exceptions.
+ }
+
+ replay(mockConfigAdmin);
+ PropertiesBridge bridge = new PropertiesBridge(new StubHashGenerator(), mockConfigAdmin);
+ bridge.generateArtifactDescriptor(new File(propertiesFile));
+ verify(mockConfigAdmin);
+ }
+
+ @Test
+ public void makeSureThatServicePidIsTakenFromTheFileProvidedProperties() throws ArtifactGenerationException {
+ final String name = "service.pid.in.the.file";
+ PropertiesBridge bridge = new PropertiesBridge(new StubHashGenerator(), EasyMock.createMock(ConfigurationAdmin.class));
+ ArtifactDescriptor result = bridge.generateArtifactDescriptor(new File("src/test/resources/properties/with-service-pid.properties"));
+ assertNotNull(result);
+ assertEquals(name, result.getName());
+ }
}
diff --git a/org.eclipse.virgo.kernel.artifact/src/test/resources/properties/factoryPid.properties b/org.eclipse.virgo.kernel.artifact/src/test/resources/properties/factoryPid.properties
new file mode 100644
index 00000000..f8d8d915
--- /dev/null
+++ b/org.eclipse.virgo.kernel.artifact/src/test/resources/properties/factoryPid.properties
@@ -0,0 +1,6 @@
+# factory pid for config admin service
+service.factoryPid = test.factory.pid
+
+# properties for the managed service
+prop1 = prop1
+prop2 = 2 \ No newline at end of file
diff --git a/org.eclipse.virgo.kernel.artifact/src/test/resources/properties/with-service-pid.properties b/org.eclipse.virgo.kernel.artifact/src/test/resources/properties/with-service-pid.properties
new file mode 100644
index 00000000..e008c6c3
--- /dev/null
+++ b/org.eclipse.virgo.kernel.artifact/src/test/resources/properties/with-service-pid.properties
@@ -0,0 +1,6 @@
+#config admin properties config with service.pid specified in the file vs. filename
+service.pid = service.pid.in.the.file
+
+# properties
+prop1 = prop1
+prop2 = 2 \ No newline at end of file
diff --git a/org.eclipse.virgo.kernel.artifact/template.mf b/org.eclipse.virgo.kernel.artifact/template.mf
index bba83828..14c55078 100644
--- a/org.eclipse.virgo.kernel.artifact/template.mf
+++ b/org.eclipse.virgo.kernel.artifact/template.mf
@@ -9,6 +9,7 @@ Import-Template:
org.slf4j.*;version="${org.slf4j:[=.=.=, +1)}",
org.eclipse.virgo.medic.*;version="${org.eclipse.virgo.medic:[=.=.=, =.+1)}",
org.osgi.framework.*;version="0",
+ org.osgi.service.cm.*;version="0",
org.springframework.*;version="${org.springframework:[2.5.6, =.+1)}",
javax.xml.*;version="0",
org.xml.*;version="0",
diff --git a/org.eclipse.virgo.kernel.deployer.test/.classpath b/org.eclipse.virgo.kernel.deployer.test/.classpath
index 2b459354..638548c6 100644
--- a/org.eclipse.virgo.kernel.deployer.test/.classpath
+++ b/org.eclipse.virgo.kernel.deployer.test/.classpath
@@ -32,7 +32,7 @@
<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.math/3.0.0.M02/org.eclipse.virgo.util.math-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.math/3.0.0.M02/org.eclipse.virgo.util.math-sources-3.0.0.M02.jar"/>
<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-3.7.0.v20110224.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-sources-3.7.0.v20110224.jar"/>
<classpathentry kind="var" path="KERNEL_IVY_CACHE/javax.transaction/com.springsource.javax.transaction/1.1.0/com.springsource.javax.transaction-1.1.0.jar"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/3.0.0.M02/org.eclipse.virgo.repository-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/3.0.0.M02/org.eclipse.virgo.repository-sources-3.0.0.M02.jar"/>
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/3.0.0.D-20110309170144/org.eclipse.virgo.repository-3.0.0.D-20110309170144.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/3.0.0.D-20110309170144/org.eclipse.virgo.repository-sources-3.0.0.D-20110309170144.jar"/>
<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/3.0.0.M02/org.eclipse.virgo.util.common-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/3.0.0.M02/org.eclipse.virgo.util.common-sources-3.0.0.M02.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.osgi"/>
<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.core"/>
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..935a70d1
--- /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 Chariot Solutions LLC
+ * 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..59379102
--- /dev/null
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/FactoryConfigurationDeploymentTests.java
@@ -0,0 +1,372 @@
+/*
+ * This file is part of the Eclipse Virgo project.
+ *
+ * Copyright (c) 2011 Chariot Solutions, LLC
+ * 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.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;
+
+/**
+ * Tests for Configuration artifacts that support 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(this.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(this.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(this.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(this.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(this.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(this.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/config/org.eclipse.virgo.kernel.userregion.properties b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/config/org.eclipse.virgo.kernel.userregion.properties
index 25ec548d..127b5625 100644
--- a/org.eclipse.virgo.kernel.deployer.test/src/test/resources/config/org.eclipse.virgo.kernel.userregion.properties
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/config/org.eclipse.virgo.kernel.userregion.properties
@@ -47,16 +47,8 @@ packageImports =\
org.aspectj.*;version="[1.6.5.RELEASE,2.0.0)",\
org.junit;version="[4.7.0,5.0.0)",\
org.junit.runner;version="[4.7.0,5.0.0)",\
- org.osgi.*;version="0",\
- org.ietf.jgss;version="0",\
- org.omg.*;version="0",\
- org.w3c.*;version="0",\
- org.xml.*;version="0",\
- org.eclipse.osgi.*;version="0",\
- javax.*;version="0",\
org.osgi.service.cm;version="0",\
org.osgi.service.event;version="0",\
- org.osgi.service.log;version="0",\
org.slf4j;version="[1.6.1,2)"
serviceImports =\
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
diff --git a/org.eclipse.virgo.kernel.deployer/.classpath b/org.eclipse.virgo.kernel.deployer/.classpath
index 00f9579d..b66d1af6 100644
--- a/org.eclipse.virgo.kernel.deployer/.classpath
+++ b/org.eclipse.virgo.kernel.deployer/.classpath
@@ -36,7 +36,7 @@
<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.context/3.0.0.RELEASE/org.springframework.context-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.context/3.0.0.RELEASE/org.springframework.context-sources-3.0.0.RELEASE.jar"/>
<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework.osgi/org.springframework.osgi.extender/1.2.1/org.springframework.osgi.extender-1.2.1.jar" sourcepath="/DEV_DIR/external-artifacts/non-spring-build/org.springframework.osgi/org.springframework.osgi.extender/1.2.1.RC1-SFW3/org.springframework.osgi.extender-sources.jar"/>
<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework.osgi/org.springframework.osgi.core/1.2.1/org.springframework.osgi.core-1.2.1.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework.osgi/org.springframework.osgi.core/1.2.1/org.springframework.osgi.core-sources-1.2.1.jar"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/3.0.0.M02/org.eclipse.virgo.repository-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/3.0.0.M02/org.eclipse.virgo.repository-sources-3.0.0.M02.jar"/>
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/3.0.0.D-20110309170144/org.eclipse.virgo.repository-3.0.0.D-20110309170144.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/3.0.0.D-20110309170144/org.eclipse.virgo.repository-sources-3.0.0.D-20110309170144.jar"/>
<classpathentry kind="con" path="org.eclipse.ajdt.core.ASPECTJRT_CONTAINER"/>
<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/3.0.0.M02/org.eclipse.virgo.medic-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/3.0.0.M02/org.eclipse.virgo.medic-sources-3.0.0.M02.jar">
<attributes>
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/ServerApplicationInfo.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/ServerApplicationInfo.java
deleted file mode 100644
index 6ad893d3..00000000
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/ServerApplicationInfo.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.deployer.core;
-
-import java.util.Date;
-import java.util.List;
-
-/**
- * <p>
- * Used to expose management information about a deployed application, and it's
- * constituent modules/deployed bundles. See {@link ServerModuleInfo ServerModuleInfo}
- * </p>
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * Implementations of this interface must be Thread Safe
- *
- */
-public interface ServerApplicationInfo {
-
- /**
- * @return The name of the application as specified in the manifest, otherwise something sensible
- */
- String getName();
-
- /**
- * @return The specified version of the application or '0' if unknown
- */
- String getVersion();
-
- /**
- * @return The number of milliseconds since midnight, January 1, 1970 UTC, when this application was deployed
- */
- Date getDeployTime();
-
- /**
- * @return The type of the application, OSGi/non-OSGi etc...
- */
- String getType();
-
- /**
- * Get the {@link ServerModuleInfo ServerModuleInfos} of all the modules of this application.
- *
- * @return this application's {@link ServerModuleInfo ServerModuleInfos}
- */
- List<ServerModuleInfo> getServerModuleInfo();
-
- /**
- * Get the URI used to deploy this application.
- *
- * @return the string form of the URI
- */
- String getURI();
-
-}
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/ServerModuleInfo.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/ServerModuleInfo.java
deleted file mode 100644
index d9859f73..00000000
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/ServerModuleInfo.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.deployer.core;
-
-/**
- * {@link ServerModuleInfo} provides management information for a deployed module of an application.
- * <p />
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * Implementations of this interface must be thread safe.
- *
- */
-public interface ServerModuleInfo extends Comparable<ServerModuleInfo>{
-
- /**
- * Get the personality of this module.
- *
- * @return the personality of this module or <code>null</code> if this module is devoid of personality
- */
- String getPersonality();
-
- /**
- * Get an identifier of this module which uniquely identifies the module among all modules of the same personality.
- *
- * @return the personality identifier of this module or <code>null</code> if this module is devoid of personality
- */
- String getPersonalityIdentifier();
-
- /**
- * Get the symbolic name that this bundle is based on.
- * @return the symbolic bundle name as specified in the manifest header
- */
- String getBundleSymbolicName();
-
-}
-
-
diff --git a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/KernelRegionBundle.java b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/KernelRegionBundle.java
deleted file mode 100644
index 42bb5245..00000000
--- a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/KernelRegionBundle.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.model.internal;
-
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.virgo.kernel.model.Artifact;
-import org.eclipse.virgo.kernel.model.ArtifactState;
-import org.osgi.framework.Version;
-
-
-/**
- * TODO Delete this class when the RAM is upgraded (Bug
- *
- * KernelRegionBundle is a placeholder for dependencies that cross the Region boundary in to the Kernel Region.
- * <p />
- *
- * <strong>Concurrent Semantics</strong><br />
- * KernelRegionBundle is ThreadSafe
- */
-public class KernelRegionBundle implements Artifact{
-
- private static final String TYPE = "bundle";
-
- private static final String NAME = "org.eclipse.virgo.kernel";
-
- private final Version version;
-
- public KernelRegionBundle(Version version) {
- this.version = version;
- }
-
- @Override
- public void start() {
- // no-op
- }
-
- @Override
- public void stop() {
- // no-op
- }
-
- @Override
- public boolean refresh() {
- // no-op
- return false;
- }
-
- @Override
- public void uninstall() {
- // no-op
- }
-
- @Override
- public String getType() {
- return TYPE;
- }
-
- @Override
- public String getName() {
- return NAME;
- }
-
- @Override
- public Version getVersion() {
- return this.version;
- }
-
- @Override
- public ArtifactState getState() {
- return ArtifactState.ACTIVE;
- }
-
- @Override
- public Set<Artifact> getDependents() {
- return new HashSet<Artifact>();
- }
-
- @Override
- public Map<String, String> getProperties() {
- return Collections.emptyMap();
- }
-
- @Override
- public String toString() {
- return String.format("type: %s, name: %s, version: %s", TYPE, NAME, this.version.toString());
- }
-
-}
diff --git a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/NotifyingRuntimeArtifactRepository.java b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/NotifyingRuntimeArtifactRepository.java
index f9b917ab..eacd17b8 100644
--- a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/NotifyingRuntimeArtifactRepository.java
+++ b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/NotifyingRuntimeArtifactRepository.java
@@ -18,7 +18,6 @@ import java.util.Set;
import org.eclipse.virgo.kernel.model.Artifact;
import org.eclipse.virgo.kernel.model.RuntimeArtifactRepository;
-import org.osgi.framework.BundleContext;
import org.osgi.framework.Version;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -45,11 +44,8 @@ public final class NotifyingRuntimeArtifactRepository implements RuntimeArtifact
private final List<ArtifactRepositoryListener> listeners;
- private final KernelRegionBundle kernelRegionBundle;
-
- public NotifyingRuntimeArtifactRepository(BundleContext bundleContext, ArtifactRepositoryListener... listeners) {
+ public NotifyingRuntimeArtifactRepository(ArtifactRepositoryListener... listeners) {
this.listeners = Arrays.asList(listeners);
- this.kernelRegionBundle = new KernelRegionBundle(bundleContext.getBundle().getVersion());
}
/**
@@ -110,7 +106,7 @@ public final class NotifyingRuntimeArtifactRepository implements RuntimeArtifact
return artifact;
}
}
- return this.kernelRegionBundle;
+ return null;
}
}
diff --git a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/BundleArtifact.java b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/BundleArtifact.java
index 82951797..a3cff3cf 100644
--- a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/BundleArtifact.java
+++ b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/BundleArtifact.java
@@ -109,7 +109,7 @@ final class BundleArtifact extends AbstractArtifact {
}
}
- private ArtifactState mapBundleState(int state) {
+ static ArtifactState mapBundleState(int state) {
if (Bundle.UNINSTALLED == state) {
return ArtifactState.UNINSTALLED;
} else if (Bundle.INSTALLED == state) {
diff --git a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/BundleDependencyDeterminer.java b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/BundleDependencyDeterminer.java
index 74bc65e1..c64c8647 100644
--- a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/BundleDependencyDeterminer.java
+++ b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/BundleDependencyDeterminer.java
@@ -20,6 +20,7 @@ import org.eclipse.virgo.kernel.model.RuntimeArtifactRepository;
import org.eclipse.virgo.kernel.model.internal.DependencyDeterminer;
import org.eclipse.virgo.kernel.serviceability.NonNull;
+import org.eclipse.virgo.kernel.osgi.framework.PackageAdminUtil;
import org.eclipse.virgo.kernel.osgi.quasi.QuasiBundle;
import org.eclipse.virgo.kernel.osgi.quasi.QuasiExportPackage;
import org.eclipse.virgo.kernel.osgi.quasi.QuasiFramework;
@@ -42,9 +43,12 @@ public final class BundleDependencyDeterminer implements DependencyDeterminer {
private final RuntimeArtifactRepository artifactRepository;
- public BundleDependencyDeterminer(@NonNull QuasiFrameworkFactory quasiFrameworkFactory, @NonNull RuntimeArtifactRepository artifactRepository) {
+ private final PackageAdminUtil packageAdminUtil;
+
+ public BundleDependencyDeterminer(@NonNull QuasiFrameworkFactory quasiFrameworkFactory, @NonNull RuntimeArtifactRepository artifactRepository, @NonNull PackageAdminUtil packageAdminUtil) {
this.quasiFrameworkFactory = quasiFrameworkFactory;
this.artifactRepository = artifactRepository;
+ this.packageAdminUtil = packageAdminUtil;
}
/**
@@ -62,7 +66,11 @@ public final class BundleDependencyDeterminer implements DependencyDeterminer {
QuasiExportPackage provider = importPackage.getProvider();
if (provider != null) {
QuasiBundle bundle = provider.getExportingBundle();
- artifacts.add(artifactRepository.getArtifact(BundleArtifact.TYPE, bundle.getSymbolicName(), bundle.getVersion()));
+ Artifact artifact = artifactRepository.getArtifact(BundleArtifact.TYPE, bundle.getSymbolicName(), bundle.getVersion());
+ if (artifact == null) {
+ artifact = new QuasiBundleArtifact(bundle, this.packageAdminUtil);
+ }
+ artifacts.add(artifact);
}
}
diff --git a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/QuasiBundleArtifact.java b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/QuasiBundleArtifact.java
new file mode 100644
index 00000000..a32e9c3c
--- /dev/null
+++ b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/QuasiBundleArtifact.java
@@ -0,0 +1,211 @@
+/*******************************************************************************
+ * Copyright (c) 2011 VMware Inc.
+ * 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:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.kernel.model.internal.bundle;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.virgo.kernel.model.Artifact;
+import org.eclipse.virgo.kernel.model.ArtifactState;
+import org.eclipse.virgo.kernel.osgi.framework.PackageAdminUtil;
+import org.eclipse.virgo.kernel.osgi.quasi.QuasiBundle;
+import org.eclipse.virgo.kernel.serviceability.NonNull;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Version;
+
+/**
+ * {@link QuasiBundleArtifact} is an {@link Artifact} that wraps a {@link QuasiBundle}.
+ * <p />
+ *
+ * <strong>Concurrent Semantics</strong><br />
+ * Thread safe.
+ */
+final class QuasiBundleArtifact implements Artifact {
+
+ private final QuasiBundle quasiBundle;
+
+ private final PackageAdminUtil packageAdminUtil;
+
+ QuasiBundleArtifact(@NonNull QuasiBundle quasiBundle, @NonNull PackageAdminUtil packageAdminUtil) {
+ this.quasiBundle = quasiBundle;
+ this.packageAdminUtil = packageAdminUtil;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void start() {
+ Bundle bundle = getBundle();
+ try {
+ bundle.start();
+ } catch (BundleException e) {
+ throw new RuntimeException("Failed to start", e);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void stop() {
+ Bundle bundle = getBundle();
+ if (bundle != null) {
+ BundleContext bundleContext = bundle.getBundleContext();
+ if (bundleContext != null) {
+ new BundleArtifact(bundleContext, this.packageAdminUtil, bundle).stop();
+ }
+ }
+ }
+
+ private Bundle getBundle() {
+ return quasiBundle.getBundle();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean refresh() {
+ Bundle bundle = getBundle();
+ if (bundle != null) {
+ BundleContext bundleContext = bundle.getBundleContext();
+ if (bundleContext != null) {
+ return new BundleArtifact(bundleContext, this.packageAdminUtil, bundle).refresh();
+ } else {
+ try {
+ bundle.update();
+ return true;
+ } catch (BundleException _) {
+ return false;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void uninstall() {
+ Bundle bundle = getBundle();
+ if (bundle != null) {
+ try {
+ bundle.uninstall();
+ } catch (BundleException e) {
+ throw new RuntimeException("Failed to uninstall", e);
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getType() {
+ return BundleArtifact.TYPE;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getName() {
+ return this.quasiBundle.getSymbolicName();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Version getVersion() {
+ return this.quasiBundle.getVersion();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ArtifactState getState() {
+ Bundle bundle = getBundle();
+ if (bundle != null) {
+ return BundleArtifact.mapBundleState(bundle.getState());
+ }
+ return ArtifactState.UNINSTALLED;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Set<Artifact> getDependents() {
+ Set<Artifact> dependents = new HashSet<Artifact>();
+ for (QuasiBundle quasiBundle : this.quasiBundle.getDependents()) {
+ /*
+ * Since QuasiBundleArtifact is used to represent dependencies in the kernel, the dependents should also be in
+ * the kernel and so can be represented by further QuasiBundleArtifacts.
+ */
+ dependents.add(new QuasiBundleArtifact(quasiBundle, this.packageAdminUtil));
+ }
+ return dependents;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Map<String, String> getProperties() {
+ return Collections.<String, String> emptyMap();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((quasiBundle == null) ? 0 : quasiBundle.hashCode());
+ return result;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (!(obj instanceof QuasiBundleArtifact)) {
+ return false;
+ }
+ QuasiBundleArtifact other = (QuasiBundleArtifact) obj;
+ if (quasiBundle == null) {
+ if (other.quasiBundle != null) {
+ return false;
+ }
+ } else if (!quasiBundle.equals(other.quasiBundle)) {
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/org.eclipse.virgo.kernel.model/src/main/resources/META-INF/spring/module-context.xml b/org.eclipse.virgo.kernel.model/src/main/resources/META-INF/spring/module-context.xml
index 7ca61dc8..274663d9 100644
--- a/org.eclipse.virgo.kernel.model/src/main/resources/META-INF/spring/module-context.xml
+++ b/org.eclipse.virgo.kernel.model/src/main/resources/META-INF/spring/module-context.xml
@@ -27,6 +27,7 @@
<bean id="bundleDependencyDeterminer" class="org.eclipse.virgo.kernel.model.internal.bundle.BundleDependencyDeterminer">
<constructor-arg ref="quasiFrameworkFactory"/>
<constructor-arg ref="artifactRepository"/>
+ <constructor-arg ref="packageAdminUtil"/>
</bean>
<bean id="deployerCompositeArtifactDependencyDeterminer"
@@ -35,7 +36,6 @@
</bean>
<bean id="artifactRepository" class="org.eclipse.virgo.kernel.model.internal.NotifyingRuntimeArtifactRepository">
- <constructor-arg ref="bundleContext"/>
<constructor-arg ref="artifactRepositoryListener"/>
</bean>
diff --git a/org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/KernelRegionBundleTests.java b/org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/KernelRegionBundleTests.java
deleted file mode 100644
index 0d5e8fdf..00000000
--- a/org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/KernelRegionBundleTests.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.model.internal;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.osgi.framework.Version;
-
-
-public class KernelRegionBundleTests {
-
- private KernelRegionBundle kernelRegionBundle;
-
- @Before
- public void setUp(){
- this.kernelRegionBundle = new KernelRegionBundle(new Version("3.0.0"));
- }
-
- @Test
- public void kernelVersion() {
- assertEquals("3.0.0", this.kernelRegionBundle.getVersion().toString());
- }
-
-} \ No newline at end of file
diff --git a/org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/NotifyingArtifactRepositoryTests.java b/org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/NotifyingArtifactRepositoryTests.java
index 818578cf..fd2e0208 100644
--- a/org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/NotifyingArtifactRepositoryTests.java
+++ b/org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/NotifyingArtifactRepositoryTests.java
@@ -18,24 +18,14 @@ import static org.junit.Assert.assertTrue;
import java.util.Set;
-import org.osgi.framework.Version;
-
import org.eclipse.virgo.kernel.model.Artifact;
import org.eclipse.virgo.kernel.model.StubCompositeArtifact;
-import org.eclipse.virgo.kernel.model.internal.ArtifactRepositoryListener;
-import org.eclipse.virgo.kernel.model.internal.NotifyingRuntimeArtifactRepository;
-import org.eclipse.virgo.teststubs.osgi.framework.StubBundle;
-import org.eclipse.virgo.teststubs.osgi.framework.StubBundleContext;
import org.junit.Test;
public class NotifyingArtifactRepositoryTests {
- private StubBundle stubBundle = new StubBundle("org.eclipse.virgo.kernel", new Version("3.0.0"));
-
- private StubBundleContext stubBundleContext = new StubBundleContext(stubBundle);
-
- private final NotifyingRuntimeArtifactRepository artifactRepository = new NotifyingRuntimeArtifactRepository(stubBundleContext);
+ private final NotifyingRuntimeArtifactRepository artifactRepository = new NotifyingRuntimeArtifactRepository();
@Test
public void add() {
@@ -56,7 +46,7 @@ public class NotifyingArtifactRepositoryTests {
public void listeners() {
StubArtifactRepositoryListener listener1 = new StubArtifactRepositoryListener(true);
StubArtifactRepositoryListener listener2 = new StubArtifactRepositoryListener(false);
- NotifyingRuntimeArtifactRepository artifactRepository = new NotifyingRuntimeArtifactRepository(stubBundleContext, listener1, listener2);
+ NotifyingRuntimeArtifactRepository artifactRepository = new NotifyingRuntimeArtifactRepository(listener1, listener2);
StubCompositeArtifact artifact = new StubCompositeArtifact();
artifactRepository.add(artifact);
artifactRepository.remove(artifact.getType(), artifact.getName(), artifact.getVersion());
diff --git a/org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/bundle/BundleDependencyDeterminerTests.java b/org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/bundle/BundleDependencyDeterminerTests.java
index 457ec64d..8d4c10fe 100644
--- a/org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/bundle/BundleDependencyDeterminerTests.java
+++ b/org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/bundle/BundleDependencyDeterminerTests.java
@@ -28,6 +28,7 @@ import org.eclipse.virgo.kernel.model.internal.bundle.BundleDependencyDeterminer
import org.eclipse.virgo.kernel.serviceability.Assert.FatalAssertionException;
import org.junit.Test;
+import org.eclipse.virgo.kernel.osgi.framework.PackageAdminUtil;
import org.eclipse.virgo.kernel.osgi.quasi.QuasiBundle;
import org.eclipse.virgo.kernel.osgi.quasi.QuasiFramework;
import org.eclipse.virgo.kernel.osgi.quasi.QuasiFrameworkFactory;
@@ -37,17 +38,24 @@ public class BundleDependencyDeterminerTests {
private final QuasiFrameworkFactory quasiFrameworkFactory = createMock(QuasiFrameworkFactory.class);
private final RuntimeArtifactRepository artifactRepository = new StubArtifactRepository();
+
+ private final PackageAdminUtil packageAdminUtil = createMock(PackageAdminUtil.class);
- private final BundleDependencyDeterminer determiner = new BundleDependencyDeterminer(quasiFrameworkFactory, artifactRepository);
+ private final BundleDependencyDeterminer determiner = new BundleDependencyDeterminer(quasiFrameworkFactory, artifactRepository, packageAdminUtil);
@Test(expected = FatalAssertionException.class)
public void nullFactory() {
- new BundleDependencyDeterminer(null, artifactRepository);
+ new BundleDependencyDeterminer(null, artifactRepository, packageAdminUtil);
}
@Test(expected = FatalAssertionException.class)
public void nullRepository() {
- new BundleDependencyDeterminer(quasiFrameworkFactory, null);
+ new BundleDependencyDeterminer(quasiFrameworkFactory, null, packageAdminUtil);
+ }
+
+ @Test(expected = FatalAssertionException.class)
+ public void nullPackageAdminUtil() {
+ new BundleDependencyDeterminer(quasiFrameworkFactory, artifactRepository, null);
}
@Test
diff --git a/org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/bundle/QuasiBundleArtifactTests.java b/org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/bundle/QuasiBundleArtifactTests.java
new file mode 100644
index 00000000..4f063308
--- /dev/null
+++ b/org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/bundle/QuasiBundleArtifactTests.java
@@ -0,0 +1,170 @@
+/*******************************************************************************
+ * Copyright (c) 2011 VMware Inc.
+ * 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:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.kernel.model.internal.bundle;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import junit.framework.Assert;
+
+import org.easymock.EasyMock;
+import org.eclipse.virgo.kernel.model.Artifact;
+import org.eclipse.virgo.kernel.model.ArtifactState;
+import org.eclipse.virgo.kernel.osgi.framework.PackageAdminUtil;
+import org.eclipse.virgo.kernel.osgi.quasi.QuasiBundle;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Filter;
+import org.osgi.framework.ServiceListener;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.Version;
+
+public class QuasiBundleArtifactTests {
+
+ private static final Version TEST_BUNDLE_VERSION = new Version("4345.234.56.sfghz");
+
+ private static final String TEST_BUNDLE_SYMBOLIC_NAME = "test.bundle";
+
+ private QuasiBundle mockQuasiBundle;
+
+ private Bundle mockBundle;
+
+ private PackageAdminUtil mockPackageAdminUtil;
+
+ private Artifact quasiBundleArtifact;
+
+ private BundleContext mockBundleContext;
+
+ private Filter mockFilter;
+
+ @Before
+ public void setUp() throws Exception {
+ this.mockQuasiBundle = EasyMock.createMock(QuasiBundle.class);
+ EasyMock.expect(this.mockQuasiBundle.getSymbolicName()).andReturn(TEST_BUNDLE_SYMBOLIC_NAME).anyTimes();
+ EasyMock.expect(this.mockQuasiBundle.getVersion()).andReturn(TEST_BUNDLE_VERSION).anyTimes();
+
+ this.mockBundle = EasyMock.createMock(Bundle.class);
+ this.mockBundleContext = EasyMock.createMock(BundleContext.class);
+ this.mockFilter = EasyMock.createMock(Filter.class);
+ EasyMock.expect(this.mockBundle.getSymbolicName()).andReturn(TEST_BUNDLE_SYMBOLIC_NAME).anyTimes();
+ EasyMock.expect(this.mockBundle.getVersion()).andReturn(TEST_BUNDLE_VERSION).anyTimes();
+ EasyMock.expect(this.mockBundle.getBundleContext()).andReturn(this.mockBundleContext).anyTimes();
+ EasyMock.expect(this.mockBundle.getState()).andReturn(Bundle.ACTIVE).anyTimes();
+ EasyMock.expect(this.mockBundleContext.createFilter(EasyMock.isA(String.class))).andReturn(this.mockFilter).anyTimes();
+ this.mockBundleContext.addServiceListener(EasyMock.isA(ServiceListener.class), EasyMock.isA(String.class));
+ EasyMock.expectLastCall().anyTimes();
+ ServiceReference<?>[] refs = {};
+ EasyMock.expect(this.mockBundleContext.getServiceReferences((String) EasyMock.eq(null), EasyMock.isA(String.class))).andReturn(refs).anyTimes();
+
+ EasyMock.expect(this.mockQuasiBundle.getBundle()).andReturn(this.mockBundle).anyTimes();
+
+ this.mockPackageAdminUtil = EasyMock.createMock(PackageAdminUtil.class);
+ this.quasiBundleArtifact = new QuasiBundleArtifact(this.mockQuasiBundle, this.mockPackageAdminUtil);
+ }
+
+ private void replay() {
+ EasyMock.replay(this.mockQuasiBundle, this.mockPackageAdminUtil, this.mockBundle, this.mockBundleContext, this.mockFilter);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ EasyMock.verify(this.mockQuasiBundle, this.mockPackageAdminUtil, this.mockBundle, this.mockBundleContext, this.mockFilter);
+ }
+
+ @Test
+ public void testStart() throws BundleException {
+ this.mockBundle.start();
+ EasyMock.expectLastCall();
+ replay();
+ this.quasiBundleArtifact.start();
+ }
+
+ @Test
+ public void testStop() throws BundleException {
+ this.mockBundle.stop();
+ EasyMock.expectLastCall();
+ replay();
+ this.quasiBundleArtifact.stop();
+ }
+
+ @Test
+ public void testRefresh() throws BundleException {
+ this.mockBundle.update();
+ Bundle[] bundles = { this.mockBundle };
+ this.mockPackageAdminUtil.synchronouslyRefreshPackages(EasyMock.aryEq(bundles));
+ EasyMock.expectLastCall().anyTimes();
+ EasyMock.expectLastCall();
+ replay();
+ this.quasiBundleArtifact.refresh();
+ }
+
+ @Test
+ public void testUninstall() throws BundleException {
+ this.mockBundle.uninstall();
+ EasyMock.expectLastCall();
+ replay();
+ this.quasiBundleArtifact.uninstall();
+ }
+
+ @Test
+ public void testGetType() {
+ replay();
+ Assert.assertEquals("bundle", this.quasiBundleArtifact.getType());
+ }
+
+ @Test
+ public void testGetName() {
+ replay();
+ Assert.assertEquals(TEST_BUNDLE_SYMBOLIC_NAME, this.quasiBundleArtifact.getName());
+ }
+
+ @Test
+ public void testGetVersion() {
+ replay();
+ Assert.assertEquals(TEST_BUNDLE_VERSION, this.quasiBundleArtifact.getVersion());
+ }
+
+ @Test
+ public void testGetState() {
+ replay();
+ Assert.assertEquals(ArtifactState.ACTIVE, this.quasiBundleArtifact.getState());
+ }
+
+ @Test
+ public void testGetDependents() {
+ QuasiBundle qb1 = EasyMock.createMock(QuasiBundle.class);
+ QuasiBundle qb2 = EasyMock.createMock(QuasiBundle.class);
+ List<QuasiBundle> dependents = new ArrayList<QuasiBundle>();
+ dependents.add(qb1);
+ dependents.add(qb2);
+ EasyMock.expect(this.mockQuasiBundle.getDependents()).andReturn(dependents);
+ replay();
+ Set<Artifact> expected = new HashSet<Artifact>();
+ expected.add(new QuasiBundleArtifact(qb1, this.mockPackageAdminUtil));
+ expected.add(new QuasiBundleArtifact(qb2, this.mockPackageAdminUtil));
+ Assert.assertEquals(expected, this.quasiBundleArtifact.getDependents());
+ }
+
+ @Test
+ public void testGetProperties() {
+ replay();
+ Assert.assertEquals(new HashMap<String, String>(), this.quasiBundleArtifact.getProperties());
+ }
+
+} \ No newline at end of file
diff --git a/org.eclipse.virgo.kernel.osgi/.classpath b/org.eclipse.virgo.kernel.osgi/.classpath
index 7ef2cf23..47331690 100644
--- a/org.eclipse.virgo.kernel.osgi/.classpath
+++ b/org.eclipse.virgo.kernel.osgi/.classpath
@@ -28,7 +28,7 @@
<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.slf4j/com.springsource.slf4j.nop/1.6.1/com.springsource.slf4j.nop-1.6.1.jar" sourcepath="/KERNEL_IVY_CACHE/org.slf4j/com.springsource.slf4j.nop/1.6.1/com.springsource.slf4j.nop-sources-1.6.1.jar"/>
<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.aspectj/com.springsource.org.aspectj.runtime/1.6.6.RELEASE/com.springsource.org.aspectj.runtime-1.6.6.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.aspectj/com.springsource.org.aspectj.runtime/1.6.6.RELEASE/com.springsource.org.aspectj.runtime-1.6.6.RELEASE.jar"/>
<classpathentry kind="con" path="org.eclipse.ajdt.core.ASPECTJRT_CONTAINER"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/3.0.0.M02/org.eclipse.virgo.repository-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/3.0.0.M02/org.eclipse.virgo.repository-sources-3.0.0.M02.jar"/>
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/3.0.0.D-20110309170144/org.eclipse.virgo.repository-3.0.0.D-20110309170144.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/3.0.0.D-20110309170144/org.eclipse.virgo.repository-sources-3.0.0.D-20110309170144.jar"/>
<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/3.0.0.M02/org.eclipse.virgo.util.osgi-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/3.0.0.M02/org.eclipse.virgo.util.osgi-sources-3.0.0.M02.jar"/>
<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/3.0.0.M02/org.eclipse.virgo.util.common-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/3.0.0.M02/org.eclipse.virgo.util.common-sources-3.0.0.M02.jar"/>
<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.math/3.0.0.M02/org.eclipse.virgo.util.math-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.math/3.0.0.M02/org.eclipse.virgo.util.math-sources-3.0.0.M02.jar"/>
diff --git a/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/eventlog/RegionAwareEventLoggerServiceFactory.java b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/eventlog/RegionAwareEventLoggerServiceFactory.java
deleted file mode 100644
index 6ba08745..00000000
--- a/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/eventlog/RegionAwareEventLoggerServiceFactory.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.osgi.region.eventlog;
-
-import org.osgi.framework.Bundle;
-import org.osgi.framework.ServiceFactory;
-import org.osgi.framework.ServiceRegistration;
-
-import org.eclipse.virgo.medic.eventlog.EventLogger;
-import org.eclipse.virgo.medic.eventlog.EventLoggerFactory;
-
-/**
- * RegionAwareEventLoggerServiceFactory is a {@link ServiceFactory} for
- * {@link EventLogger} instances in the user region. Medic's default ServiceFactory
- * cannot be used due to the nested framework service-sharing mechnism which
- * causes the wrong {@link Bundle} to be passed to {@link #getService(Bundle, ServiceRegistration)}
- * <p />
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * Thread-safe.
- *
- */
-final class RegionAwareEventLoggerServiceFactory implements ServiceFactory<EventLogger> {
-
- private final EventLoggerFactory eventLoggerFactory;
-
- /**
- * @param eventLoggerFactory
- */
- public RegionAwareEventLoggerServiceFactory(EventLoggerFactory eventLoggerFactory) {
- this.eventLoggerFactory = eventLoggerFactory;
- }
-
- /**
- * {@inheritDoc}
- */
- public EventLogger getService(Bundle bundle, ServiceRegistration<EventLogger> registration) {
- return this.eventLoggerFactory.createEventLogger(bundle);
- }
-
- /**
- * {@inheritDoc}
- */
- public void ungetService(Bundle bundle, ServiceRegistration<EventLogger> registration, EventLogger service) {
- }
-}
diff --git a/org.eclipse.virgo.kernel.osgi/src/main/resources/EventLogMessages.properties b/org.eclipse.virgo.kernel.osgi/src/main/resources/EventLogMessages.properties
deleted file mode 100644
index d4ff49af..00000000
--- a/org.eclipse.virgo.kernel.osgi/src/main/resources/EventLogMessages.properties
+++ /dev/null
@@ -1,8 +0,0 @@
-#OSGI
-OF0001E=Region imports parsing failed: {}.
-OF0002W=No match found for region import: {}.
-#OF0003W Moved to the userregion bundle
-#OF0004W Moved to the userregion bundle
-OF0010E=User region configuration unavailable.
-OF0100I=OSGi telnet console available on port {}.
-OF0101E=Unable to start OSGi telnet console. Port {} is in use.
diff --git a/org.eclipse.virgo.kernel.services/.classpath b/org.eclipse.virgo.kernel.services/.classpath
index 3d8fa03d..fefe6aa9 100644
--- a/org.eclipse.virgo.kernel.services/.classpath
+++ b/org.eclipse.virgo.kernel.services/.classpath
@@ -30,7 +30,7 @@
<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.beans/3.0.0.RELEASE/org.springframework.beans-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.beans/3.0.0.RELEASE/org.springframework.beans-sources-3.0.0.RELEASE.jar"/>
<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.core/3.0.0.RELEASE/org.springframework.core-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.core/3.0.0.RELEASE/org.springframework.core-sources-3.0.0.RELEASE.jar"/>
<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.context/3.0.0.RELEASE/org.springframework.context-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.context/3.0.0.RELEASE/org.springframework.context-sources-3.0.0.RELEASE.jar"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/3.0.0.M02/org.eclipse.virgo.repository-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/3.0.0.M02/org.eclipse.virgo.repository-sources-3.0.0.M02.jar"/>
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/3.0.0.D-20110309170144/org.eclipse.virgo.repository-3.0.0.D-20110309170144.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/3.0.0.D-20110309170144/org.eclipse.virgo.repository-sources-3.0.0.D-20110309170144.jar"/>
<classpathentry kind="con" path="org.eclipse.ajdt.core.ASPECTJRT_CONTAINER"/>
<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/3.0.0.M02/org.eclipse.virgo.medic-3.0.0.M02.jar">
<attributes>
diff --git a/org.eclipse.virgo.kernel.services/src/main/java/org/eclipse/virgo/kernel/services/repository/internal/EmptyRepository.java b/org.eclipse.virgo.kernel.services/src/main/java/org/eclipse/virgo/kernel/services/repository/internal/EmptyRepository.java
index c0c966cb..ad902136 100644
--- a/org.eclipse.virgo.kernel.services/src/main/java/org/eclipse/virgo/kernel/services/repository/internal/EmptyRepository.java
+++ b/org.eclipse.virgo.kernel.services/src/main/java/org/eclipse/virgo/kernel/services/repository/internal/EmptyRepository.java
@@ -86,6 +86,20 @@ public class EmptyRepository implements Repository {
/**
* {@inheritDoc}
*/
+ public Query setVersionRangeFilter(VersionRange versionRange) {
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Query setVersionRangeFilter(VersionRange versionRange, VersionRangeMatchingStrategy strategy) {
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public Set<RepositoryAwareArtifactDescriptor> run() {
return Collections.<RepositoryAwareArtifactDescriptor> emptySet();
}
diff --git a/org.eclipse.virgo.kernel.services/src/main/resources/META-INF/spring/repository-context.xml b/org.eclipse.virgo.kernel.services/src/main/resources/META-INF/spring/repository-context.xml
index c8a3de66..2335409b 100644
--- a/org.eclipse.virgo.kernel.services/src/main/resources/META-INF/spring/repository-context.xml
+++ b/org.eclipse.virgo.kernel.services/src/main/resources/META-INF/spring/repository-context.xml
@@ -48,6 +48,9 @@
<bean id="propertiesBridge" class="org.eclipse.virgo.kernel.artifact.properties.PropertiesBridge">
<constructor-arg ref="hashGenerator"/>
+ <constructor-arg>
+ <osgi:reference interface="org.osgi.service.cm.ConfigurationAdmin"/>
+ </constructor-arg>
</bean>
<osgi:service ref="propertiesBridge" interface="org.eclipse.virgo.repository.ArtifactBridge"/>
diff --git a/org.eclipse.virgo.kernel.services/template.mf b/org.eclipse.virgo.kernel.services/template.mf
index 97f8e042..6e06cb1d 100644
--- a/org.eclipse.virgo.kernel.services/template.mf
+++ b/org.eclipse.virgo.kernel.services/template.mf
@@ -13,6 +13,7 @@ Import-Template:
org.aspectj.*;version="${org.aspectj:[=.=.=.=, +1)}",
org.slf4j.*;version="${org.slf4j:[=.=.=, +1)}",
org.osgi.framework.*;version="0",
+ org.osgi.service.cm.*;version="0",
org.springframework.*;version="${org.springframework:[2.5.6, =.+1)}",
javax.management.*;version="0",
javax.xml.*;version="0",
diff --git a/org.eclipse.virgo.kernel.shell/.classpath b/org.eclipse.virgo.kernel.shell/.classpath
index 78b91825..d67fb596 100644
--- a/org.eclipse.virgo.kernel.shell/.classpath
+++ b/org.eclipse.virgo.kernel.shell/.classpath
@@ -44,7 +44,7 @@
<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/3.0.0.M02/org.eclipse.virgo.util.io-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/3.0.0.M02/org.eclipse.virgo.util.io-sources-3.0.0.M02.jar"/>
<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.test/3.0.0.M02/org.eclipse.virgo.medic.test-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.test/3.0.0.M02/org.eclipse.virgo.medic.test-sources-3.0.0.M02.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.deployer"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/3.0.0.M02/org.eclipse.virgo.repository-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/3.0.0.M02/org.eclipse.virgo.repository-sources-3.0.0.M02.jar"/>
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/3.0.0.D-20110309170144/org.eclipse.virgo.repository-3.0.0.D-20110309170144.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/3.0.0.D-20110309170144/org.eclipse.virgo.repository-sources-3.0.0.D-20110309170144.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.model"/>
<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.equinox.event/1.2.100.v20110110/org.eclipse.equinox.event-1.2.100.v20110110.jar"/>
<classpathentry kind="output" path="target/classes"/>
diff --git a/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/model/helper/StandardRamAccessorHelper.java b/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/model/helper/StandardRamAccessorHelper.java
index 827d3cda..b85a819f 100644
--- a/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/model/helper/StandardRamAccessorHelper.java
+++ b/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/model/helper/StandardRamAccessorHelper.java
@@ -176,23 +176,23 @@ final public class StandardRamAccessorHelper implements RamAccessorHelper {
*/
public ArtifactAccessor getArtifact(String type, String name, String version) {
- //TODO work around until 337211 is done
- if("org.eclipse.virgo.kernel".equals(name)){
- Map<String, Object> attributes = new TreeMap<String, Object>();
- attributes.put(TYPE_ATTRIBUTE, "Region");
- attributes.put(NAME_ATTRIBUTE, name);
- attributes.put(VERSION_ATTRIBUTE, version);
- attributes.put(STATE_ATTRIBUTE, "-");
- attributes.put("atomic", false);
- attributes.put("scoped", false);
- return new StandardArtifactAccessor(attributes, new HashMap<String, String>(), new HashSet<ArtifactAccessorPointer>());
- }
-
MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
try {
ObjectName objectName = new ObjectName(String.format(ARTIFACT_MBEAN_QUERY, type, name, version));
ArtifactAccessorPointer pointer = buildArtifactAccessorPointer(objectName);
+ //TODO work around until 337211 is done
+ if ("-".equals(pointer.getState())) {
+ Map<String, Object> attributes = new TreeMap<String, Object>();
+ attributes.put(TYPE_ATTRIBUTE, "Region");
+ attributes.put(NAME_ATTRIBUTE, name);
+ attributes.put(VERSION_ATTRIBUTE, version);
+ attributes.put(STATE_ATTRIBUTE, "-");
+ attributes.put("atomic", false);
+ attributes.put("scoped", false);
+ return new StandardArtifactAccessor(attributes, new HashMap<String, String>(), new HashSet<ArtifactAccessorPointer>());
+ }
+
if(pointer != null) {
Map<String, Object> attributes = new TreeMap<String, Object>();
attributes.put(TYPE_ATTRIBUTE, pointer.getType());
@@ -250,6 +250,7 @@ final public class StandardRamAccessorHelper implements RamAccessorHelper {
try {
state = dependantArtifact.getState();
} catch (Exception e) {
+ e.printStackTrace();
state = "-";
}
} else {
diff --git a/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/state/internal/KernelRegionFauxQuasiLiveBundle.java b/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/state/internal/KernelRegionFauxQuasiLiveBundle.java
deleted file mode 100644
index b753cbae..00000000
--- a/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/state/internal/KernelRegionFauxQuasiLiveBundle.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.shell.state.internal;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.security.cert.X509Certificate;
-import java.util.Dictionary;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Map;
-
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.Version;
-
-/**
- * <p>
- * KernelRegionFauxQuasiLiveBundle is a fake bundle that represents bundles not in the user region.
- * </p>
- *
- */
-public class KernelRegionFauxQuasiLiveBundle implements Bundle{
-
- private final long bundleId;
- private final Version version;
- private final String symbolicName;
-
- public KernelRegionFauxQuasiLiveBundle(long bundleId, Version version, String symbolicName) {
- this.bundleId = bundleId;
- this.version = version;
- this.symbolicName = symbolicName;
- }
-
- @Override
- public int compareTo(Bundle o) {
- return 0;
- }
-
- @Override
- public int getState() {
- return 0x00000020;
- }
-
- @Override
- public void start(int options) throws BundleException {
- // no-op
- }
-
- @Override
- public void start() throws BundleException {
- // no-op
- }
-
- @Override
- public void stop(int options) throws BundleException {
- // no-op
- }
-
- @Override
- public void stop() throws BundleException {
- // no-op
- }
-
- @Override
- public void update(InputStream input) throws BundleException {
- // no-op
- }
-
- @Override
- public void update() throws BundleException {
- // no-op
- }
-
- @Override
- public void uninstall() throws BundleException {
- // no-op
- }
-
- @Override
- public Dictionary<String, String> getHeaders() {
- return new Hashtable<String, String>();
- }
-
- @Override
- public long getBundleId() {
- return this.bundleId;
- }
-
- @Override
- public String getLocation() {
- return "Kernel Region";
- }
-
- @Override
- public ServiceReference<?>[] getRegisteredServices() {
- return new ServiceReference[0];
- }
-
- @Override
- public ServiceReference<?>[] getServicesInUse() {
- return new ServiceReference[0];
- }
-
- @Override
- public boolean hasPermission(Object permission) {
- return false;
- }
-
- @Override
- public URL getResource(String name) {
- return null;
- }
-
- @Override
- public Dictionary<String, String> getHeaders(String locale) {
- return new Hashtable<String, String>();
- }
-
- @Override
- public String getSymbolicName() {
- return this.symbolicName;
- }
-
- @Override
- public Class<?> loadClass(String name) throws ClassNotFoundException {
- throw new ClassNotFoundException("Kernel Region Bundle");
- }
-
- @Override
- public Enumeration<URL> getResources(String name) throws IOException {
- return null;
- }
-
- @Override
- public Enumeration<String> getEntryPaths(String path) {
- return null;
- }
-
- @Override
- public URL getEntry(String path) {
- return null;
- }
-
- @Override
- public long getLastModified() {
- return 0;
- }
-
- @Override
- public Enumeration<URL> findEntries(String path, String filePattern, boolean recurse) {
- return null;
- }
-
- @Override
- public BundleContext getBundleContext() {
- return null;
- }
-
- @Override
- public Map<X509Certificate, List<X509Certificate>> getSignerCertificates(int signersType) {
- return null;
- }
-
- @Override
- public Version getVersion() {
- return this.version;
- }
-
- @Override
- public <A> A adapt(Class<A> type) {
- return null;
- }
-
- @Override
- public File getDataFile(String filename) {
- return null;
- }
-
-}
diff --git a/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/state/internal/StandardQuasiLiveBundle.java b/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/state/internal/StandardQuasiLiveBundle.java
index 9a8b038a..c7bf5916 100644
--- a/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/state/internal/StandardQuasiLiveBundle.java
+++ b/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/state/internal/StandardQuasiLiveBundle.java
@@ -51,11 +51,7 @@ final class StandardQuasiLiveBundle implements QuasiLiveBundle {
public StandardQuasiLiveBundle(QuasiFramework quasiFramework, QuasiBundle quasiBundle, Bundle osgiBundle) {
this.quasiFramework = quasiFramework;
this.quasiBundle = quasiBundle;
- if(osgiBundle != null){
- this.osgiBundle = osgiBundle;
- } else {
- this.osgiBundle = new KernelRegionFauxQuasiLiveBundle(quasiBundle.getBundleId(), quasiBundle.getVersion(), quasiBundle.getSymbolicName());
- }
+ this.osgiBundle = osgiBundle;
}
/**
diff --git a/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/state/internal/StandardQuasiLiveFramework.java b/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/state/internal/StandardQuasiLiveFramework.java
index f03b466d..61a31897 100644
--- a/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/state/internal/StandardQuasiLiveFramework.java
+++ b/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/state/internal/StandardQuasiLiveFramework.java
@@ -43,7 +43,7 @@ final class StandardQuasiLiveFramework implements QuasiFramework {
private final QuasiFramework quasiFramework;
- private final BundleContext bundleContext;
+ private final BundleContext systemBundleContext;
/**
* Takes in the {@link QuasiFramework} to be decorated with the extra functionality
@@ -54,7 +54,7 @@ final class StandardQuasiLiveFramework implements QuasiFramework {
*/
public StandardQuasiLiveFramework(QuasiFramework quasiFramework, BundleContext bundleContext) {
this.quasiFramework = quasiFramework;
- this.bundleContext = bundleContext;
+ this.systemBundleContext = bundleContext.getBundle(0L).getBundleContext();
}
/**
@@ -65,7 +65,7 @@ final class StandardQuasiLiveFramework implements QuasiFramework {
if(quasiBundle == null){
return null;
}
- Bundle rawBundle = this.bundleContext.getBundle(bundleId);
+ Bundle rawBundle = this.systemBundleContext.getBundle(bundleId);
return new StandardQuasiLiveBundle(this, quasiBundle, rawBundle);
}
@@ -78,7 +78,7 @@ final class StandardQuasiLiveFramework implements QuasiFramework {
Bundle rawBundle;
for(QuasiBundle quasiBundle : quasiBundles){
- rawBundle = this.bundleContext.getBundle(quasiBundle.getBundleId());
+ rawBundle = this.systemBundleContext.getBundle(quasiBundle.getBundleId());
quasiLiveBundles.add(new StandardQuasiLiveBundle(this, quasiBundle, rawBundle));
}
diff --git a/org.eclipse.virgo.kernel.shell/src/test/java/org/eclipse/virgo/kernel/shell/model/helper/StandardRamAccessorHelperTests.java b/org.eclipse.virgo.kernel.shell/src/test/java/org/eclipse/virgo/kernel/shell/model/helper/StandardRamAccessorHelperTests.java
index c9a19a21..8d76e533 100644
--- a/org.eclipse.virgo.kernel.shell/src/test/java/org/eclipse/virgo/kernel/shell/model/helper/StandardRamAccessorHelperTests.java
+++ b/org.eclipse.virgo.kernel.shell/src/test/java/org/eclipse/virgo/kernel/shell/model/helper/StandardRamAccessorHelperTests.java
@@ -194,7 +194,11 @@ public class StandardRamAccessorHelperTests {
@Test
public void testGetArtifactNotExist() {
ArtifactAccessor artifact = this.ramAccessorHelper.getArtifact(TYPE, NAME, VERSION);
- assertNull(artifact);
+ assertNotNull(artifact);
+ // This accommodates the workaround to bug 337211.
+ assertEquals("Region", artifact.getType());
+ assertEquals(NAME, artifact.getName());
+ assertEquals(VERSION, artifact.getVersion());
}
}
diff --git a/org.eclipse.virgo.kernel.shell/src/test/java/org/eclipse/virgo/kernel/shell/state/internal/StandardStateServiceTests.java b/org.eclipse.virgo.kernel.shell/src/test/java/org/eclipse/virgo/kernel/shell/state/internal/StandardStateServiceTests.java
index 0745cacb..f06f161b 100644
--- a/org.eclipse.virgo.kernel.shell/src/test/java/org/eclipse/virgo/kernel/shell/state/internal/StandardStateServiceTests.java
+++ b/org.eclipse.virgo.kernel.shell/src/test/java/org/eclipse/virgo/kernel/shell/state/internal/StandardStateServiceTests.java
@@ -25,9 +25,11 @@ import org.eclipse.virgo.kernel.osgi.region.Region;
import org.eclipse.virgo.kernel.osgi.region.RegionDigraph;
import org.eclipse.virgo.kernel.shell.state.QuasiLiveService;
import org.eclipse.virgo.kernel.shell.stubs.StubQuasiFrameworkFactory;
+import org.eclipse.virgo.teststubs.osgi.framework.StubBundle;
import org.eclipse.virgo.teststubs.osgi.framework.StubBundleContext;
import org.junit.Before;
import org.junit.Test;
+import org.osgi.framework.Version;
/**
* <p>
@@ -61,6 +63,10 @@ public class StandardStateServiceTests {
@Before
public void setUp() throws Exception {
this.stubBundleContext = new StubBundleContext();
+
+ StubBundle stubSystemBundle = new StubBundle(0L, "stub.system.bundle", Version.emptyVersion, "stubLocation");
+ this.stubBundleContext.addInstalledBundle(stubSystemBundle);
+
this.stubQuasiFrameworkFactory = new StubQuasiFrameworkFactory();
this.mockUserRegion = EasyMock.createMock(Region.class);
this.mockKernelRegion = EasyMock.createMock(Region.class);
diff --git a/org.eclipse.virgo.kernel.test/.project b/org.eclipse.virgo.kernel.test/.project
index 5781bd1d..ac8c0052 100644
--- a/org.eclipse.virgo.kernel.test/.project
+++ b/org.eclipse.virgo.kernel.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.test/src/test/resources/config/org.eclipse.virgo.kernel.userregion.properties b/org.eclipse.virgo.kernel.test/src/test/resources/config/org.eclipse.virgo.kernel.userregion.properties
index bebaccc1..67849102 100644
--- a/org.eclipse.virgo.kernel.test/src/test/resources/config/org.eclipse.virgo.kernel.userregion.properties
+++ b/org.eclipse.virgo.kernel.test/src/test/resources/config/org.eclipse.virgo.kernel.userregion.properties
@@ -42,12 +42,7 @@ packageImports =\
org.aspectj.*;version="[1.6.5.RELEASE,2.0.0)",\
org.junit;version="[4.7.0,5.0.0)",\
org.junit.runner;version="[4.7.0,5.0.0)",\
- org.osgi.*;version="0",\
- org.eclipse.osgi.*;version="0",\
- javax.management;version="0",\
- javax.management.*;version="0",\
org.osgi.service.cm;version="0",\
- org.osgi.service.log;version="0",\
org.osgi.service.event;version="0",\
org.slf4j;version="[1.6.1,2)",\
org.slf4j.spi;version="[1.6.1,2)"
diff --git a/org.eclipse.virgo.kernel.userregion/.classpath b/org.eclipse.virgo.kernel.userregion/.classpath
index 94b96ffc..3d671b2d 100644
--- a/org.eclipse.virgo.kernel.userregion/.classpath
+++ b/org.eclipse.virgo.kernel.userregion/.classpath
@@ -27,7 +27,7 @@
<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.slf4j/com.springsource.slf4j.api/1.6.1/com.springsource.slf4j.api-1.6.1.jar" sourcepath="/KERNEL_IVY_CACHE/org.slf4j/com.springsource.slf4j.api/1.6.1/com.springsource.slf4j.api-sources-1.6.1.jar"/>
<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.slf4j/com.springsource.slf4j.nop/1.6.1/com.springsource.slf4j.nop-1.6.1.jar" sourcepath="/KERNEL_IVY_CACHE/org.slf4j/com.springsource.slf4j.nop/1.6.1/com.springsource.slf4j.nop-sources-1.6.1.jar"/>
<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.aspectj/com.springsource.org.aspectj.runtime/1.6.6.RELEASE/com.springsource.org.aspectj.runtime-1.6.6.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.aspectj/com.springsource.org.aspectj.runtime/1.6.6.RELEASE/com.springsource.org.aspectj.runtime-1.6.6.RELEASE.jar"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/3.0.0.M02/org.eclipse.virgo.repository-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/3.0.0.M02/org.eclipse.virgo.repository-sources-3.0.0.M02.jar"/>
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/3.0.0.D-20110309170144/org.eclipse.virgo.repository-3.0.0.D-20110309170144.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/3.0.0.D-20110309170144/org.eclipse.virgo.repository-sources-3.0.0.D-20110309170144.jar"/>
<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/3.0.0.M02/org.eclipse.virgo.util.osgi-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/3.0.0.M02/org.eclipse.virgo.util.osgi-sources-3.0.0.M02.jar"/>
<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/3.0.0.M02/org.eclipse.virgo.util.common-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/3.0.0.M02/org.eclipse.virgo.util.common-sources-3.0.0.M02.jar"/>
<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.math/3.0.0.M02/org.eclipse.virgo.util.math-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.math/3.0.0.M02/org.eclipse.virgo.util.math-sources-3.0.0.M02.jar"/>
diff --git a/org.eclipse.virgo.kernel.userregionfactory/src/main/java/org/eclipse/virgo/kernel/userregionfactory/Activator.java b/org.eclipse.virgo.kernel.userregionfactory/src/main/java/org/eclipse/virgo/kernel/userregionfactory/Activator.java
index 26efcb90..46d56cfd 100644
--- a/org.eclipse.virgo.kernel.userregionfactory/src/main/java/org/eclipse/virgo/kernel/userregionfactory/Activator.java
+++ b/org.eclipse.virgo.kernel.userregionfactory/src/main/java/org/eclipse/virgo/kernel/userregionfactory/Activator.java
@@ -26,7 +26,6 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import org.eclipse.virgo.kernel.core.Shutdown;
-import org.eclipse.virgo.kernel.osgi.framework.OsgiFrameworkLogEvents;
import org.eclipse.virgo.kernel.osgi.framework.OsgiFrameworkUtils;
import org.eclipse.virgo.kernel.osgi.framework.OsgiServiceHolder;
import org.eclipse.virgo.kernel.osgi.region.Region;
@@ -125,7 +124,7 @@ public final class Activator implements BundleActivator {
Shutdown shutdown = getPotentiallyDelayedService(bundleContext, Shutdown.class);
getRegionConfiguration(configAdmin, eventLogger, shutdown);
- createUserRegion(bundleContext, regionDigraph, eventLogger);
+ createUserRegion(regionDigraph, eventLogger);
}
private void getRegionConfiguration(ConfigurationAdmin configAdmin, EventLogger eventLogger, Shutdown shutdown) {
@@ -142,20 +141,19 @@ public final class Activator implements BundleActivator {
this.regionBundleImports = properties.get(USER_REGION_BUNDLE_IMPORTS_PROPERTY);
this.regionServiceExports = properties.get(USER_REGION_SERVICE_EXPORTS_PROPERTY);
} else {
- eventLogger.log(OsgiFrameworkLogEvents.USER_REGION_CONFIGURATION_UNAVAILABLE);
+ eventLogger.log(UserRegionFactoryLogEvents.USER_REGION_CONFIGURATION_UNAVAILABLE);
shutdown.immediateShutdown();
}
} catch (Exception e) {
- eventLogger.log(OsgiFrameworkLogEvents.USER_REGION_CONFIGURATION_UNAVAILABLE, e);
+ eventLogger.log(UserRegionFactoryLogEvents.USER_REGION_CONFIGURATION_UNAVAILABLE, e);
shutdown.immediateShutdown();
}
}
- private void createUserRegion(BundleContext userRegionBundleContext, RegionDigraph regionDigraph, EventLogger eventLogger)
- throws BundleException, InvalidSyntaxException {
+ private void createUserRegion(RegionDigraph regionDigraph, EventLogger eventLogger) throws BundleException, InvalidSyntaxException {
BundleContext systemBundleContext = getSystemBundleContext();
- Bundle userRegionFactoryBundle = userRegionBundleContext.getBundle();
+ Bundle userRegionFactoryBundle = this.bundleContext.getBundle();
Region kernelRegion = getKernelRegion(regionDigraph);
kernelRegion.removeBundle(userRegionFactoryBundle);
@@ -169,12 +167,12 @@ public final class Activator implements BundleActivator {
RegionFilter userRegionFilter = createUserRegionFilter(regionDigraph);
kernelRegion.connectRegion(userRegion, userRegionFilter);
- notifyUserRegionStarting(userRegionBundleContext);
+ notifyUserRegionStarting(this.bundleContext);
initialiseUserRegionBundles(userRegion);
registerRegionService(userRegion);
- publishUserRegionBundleContext(userRegionBundleContext);
+ publishUserRegionBundleContext(this.bundleContext);
}
private RegionFilter createUserRegionFilter(RegionDigraph digraph) throws InvalidSyntaxException {
@@ -197,7 +195,7 @@ public final class Activator implements BundleActivator {
for (String filter : allowedBundles) {
builder.allow(RegionFilter.VISIBLE_BUNDLE_NAMESPACE, filter);
}
- Collection<String> allowedPackages = createUserRegionPackageImportPolicy(systemBundleContext);
+ Collection<String> allowedPackages = createUserRegionPackageImportPolicy(systemBundleContext, eventLogger);
for (String filter : allowedPackages) {
builder.allow(RegionFilter.VISIBLE_PACKAGE_NAMESPACE, filter);
}
@@ -298,15 +296,14 @@ public final class Activator implements BundleActivator {
return result;
}
- private Collection<String> createUserRegionPackageImportPolicy(BundleContext systemBundleContext) {
+ private Collection<String> createUserRegionPackageImportPolicy(BundleContext systemBundleContext, EventLogger eventLogger) {
String userRegionImportsProperty = this.regionPackageImports != null ? this.regionPackageImports
: this.bundleContext.getProperty(USER_REGION_PACKAGE_IMPORTS_PROPERTY);
String expandedUserRegionImportsProperty = null;
if (userRegionImportsProperty != null) {
expandedUserRegionImportsProperty = PackageImportWildcardExpander.expandPackageImportsWildcards(userRegionImportsProperty,
- systemBundleContext);
+ systemBundleContext, eventLogger);
}
-
return importPackageToFilter(expandedUserRegionImportsProperty);
}
diff --git a/org.eclipse.virgo.kernel.userregionfactory/src/main/java/org/eclipse/virgo/kernel/userregionfactory/PackageImportWildcardExpander.java b/org.eclipse.virgo.kernel.userregionfactory/src/main/java/org/eclipse/virgo/kernel/userregionfactory/PackageImportWildcardExpander.java
index 92cbbf27..eff809c0 100644
--- a/org.eclipse.virgo.kernel.userregionfactory/src/main/java/org/eclipse/virgo/kernel/userregionfactory/PackageImportWildcardExpander.java
+++ b/org.eclipse.virgo.kernel.userregionfactory/src/main/java/org/eclipse/virgo/kernel/userregionfactory/PackageImportWildcardExpander.java
@@ -18,7 +18,6 @@ import java.util.Hashtable;
import java.util.List;
import java.util.Set;
-import org.eclipse.virgo.kernel.osgi.framework.OsgiFrameworkLogEvents;
import org.eclipse.virgo.kernel.serviceability.Assert;
import org.eclipse.virgo.medic.eventlog.EventLogger;
import org.eclipse.virgo.util.osgi.manifest.BundleManifest;
@@ -46,17 +45,10 @@ final class PackageImportWildcardExpander {
private static final String wildcard = "*";
- static String expandPackageImportsWildcards(String userRegionImportsProperty, BundleContext bundleContext) {
- ServiceReference<EventLogger> eventLoggerServiceReference = bundleContext.getServiceReference(EventLogger.class);
- EventLogger eventLogger = bundleContext.getService(eventLoggerServiceReference);
+ static String expandPackageImportsWildcards(String userRegionImportsProperty, BundleContext systemBundleContext, EventLogger eventLogger) {
+ String[] exportedPackageNames = getExportedPackageNames(systemBundleContext);
- String[] exportedPackageNames = getExportedPackageNames(bundleContext);
-
- String expandedUserRegionImportsProperty = expandWildcards(userRegionImportsProperty, exportedPackageNames, eventLogger);
-
- bundleContext.ungetService(eventLoggerServiceReference);
-
- return expandedUserRegionImportsProperty;
+ return expandWildcards(userRegionImportsProperty, exportedPackageNames, eventLogger);
}
private static String[] getExportedPackageNames(BundleContext bundleContext) {
@@ -64,7 +56,7 @@ final class PackageImportWildcardExpander {
for (ExportedPackage exportedPackage : getExportedPackages(bundleContext)) {
exportedPackageNames.add(exportedPackage.getName());
}
- return exportedPackageNames.toArray(new String[] {});
+ return exportedPackageNames.toArray(new String[exportedPackageNames.size()]);
}
private static ExportedPackage[] getExportedPackages(BundleContext bundleContext) {
@@ -132,7 +124,7 @@ final class PackageImportWildcardExpander {
}
}
if (expansions.isEmpty()) {
- eventLogger.log(OsgiFrameworkLogEvents.REGION_IMPORT_NO_MATCH, wildcardedPackageName);
+ eventLogger.log(UserRegionFactoryLogEvents.REGION_IMPORT_NO_MATCH, wildcardedPackageName);
}
return expansions;
}
diff --git a/org.eclipse.virgo.kernel.userregionfactory/src/main/java/org/eclipse/virgo/kernel/userregionfactory/UserRegionFactoryLogEvents.java b/org.eclipse.virgo.kernel.userregionfactory/src/main/java/org/eclipse/virgo/kernel/userregionfactory/UserRegionFactoryLogEvents.java
new file mode 100644
index 00000000..7d1ba060
--- /dev/null
+++ b/org.eclipse.virgo.kernel.userregionfactory/src/main/java/org/eclipse/virgo/kernel/userregionfactory/UserRegionFactoryLogEvents.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * 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:
+ * VMware Inc. - initial contribution
+ ******************************************************************************/
+
+package org.eclipse.virgo.kernel.userregionfactory;
+
+import org.eclipse.virgo.kernel.serviceability.LogEventDelegate;
+import org.eclipse.virgo.medic.eventlog.Level;
+import org.eclipse.virgo.medic.eventlog.LogEvent;
+
+/**
+ * {@link org.eclipse.virgo.medic.eventlog.LogEvent} for the OSGi provisioning bundle.
+ * <p/>
+ *
+ * <strong>Concurrent Semantics</strong><br />
+ *
+ * Threadsafe.
+ *
+ */
+public enum UserRegionFactoryLogEvents implements LogEvent {
+
+ REGION_IMPORTS_PARSE_FAILED(1, Level.ERROR), //
+ REGION_IMPORT_NO_MATCH(2, Level.WARNING), //
+ USER_REGION_CONFIGURATION_UNAVAILABLE(10, Level.ERROR);
+
+ private static final String PREFIX = "UF";
+
+ private final LogEventDelegate delegate;
+
+ private UserRegionFactoryLogEvents(int code, Level level) {
+ this.delegate = new LogEventDelegate(PREFIX, code, level);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getEventCode() {
+ return this.delegate.getEventCode();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Level getLevel() {
+ return this.delegate.getLevel();
+ }
+}
diff --git a/org.eclipse.virgo.kernel.userregionfactory/src/main/java/org/eclipse/virgo/kernel/userregionfactory/UserRegionFactoryParserLogger.java b/org.eclipse.virgo.kernel.userregionfactory/src/main/java/org/eclipse/virgo/kernel/userregionfactory/UserRegionFactoryParserLogger.java
index a69be1ca..d36ca6c4 100644
--- a/org.eclipse.virgo.kernel.userregionfactory/src/main/java/org/eclipse/virgo/kernel/userregionfactory/UserRegionFactoryParserLogger.java
+++ b/org.eclipse.virgo.kernel.userregionfactory/src/main/java/org/eclipse/virgo/kernel/userregionfactory/UserRegionFactoryParserLogger.java
@@ -11,7 +11,6 @@
package org.eclipse.virgo.kernel.userregionfactory;
-import org.eclipse.virgo.kernel.osgi.framework.OsgiFrameworkLogEvents;
import org.eclipse.virgo.medic.eventlog.EventLogger;
import org.eclipse.virgo.util.osgi.manifest.parse.ParserLogger;
@@ -37,6 +36,6 @@ final class UserRegionFactoryParserLogger implements ParserLogger {
}
public void outputErrorMsg(Exception re, String item) {
- this.eventLogger.log(OsgiFrameworkLogEvents.REGION_IMPORTS_PARSE_FAILED, re, item);
+ this.eventLogger.log(UserRegionFactoryLogEvents.REGION_IMPORTS_PARSE_FAILED, re, item);
}
}
diff --git a/org.eclipse.virgo.kernel.userregionfactory/src/main/resources/EventLogMessages.properties b/org.eclipse.virgo.kernel.userregionfactory/src/main/resources/EventLogMessages.properties
new file mode 100644
index 00000000..340bb1fb
--- /dev/null
+++ b/org.eclipse.virgo.kernel.userregionfactory/src/main/resources/EventLogMessages.properties
@@ -0,0 +1,16 @@
+################################################################################
+# Copyright (c) 2011 SAP AG
+# 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:
+# Hristo Iliev, SAP AG - initial contribution
+################################################################################
+
+# User region factory
+UF0001E=Region imports parsing failed: {}.
+UF0002W=No match found for region import: {}.
+
+UF0010E=User region configuration unavailable.
diff --git a/org.eclipse.virgo.kernel.userregionfactory/src/test/java/org/eclipse/virgo/kernel/userregionfactory/PackageImportWildcardExpanderTests.java b/org.eclipse.virgo.kernel.userregionfactory/src/test/java/org/eclipse/virgo/kernel/userregionfactory/PackageImportWildcardExpanderTests.java
index 62050d61..c3896e69 100644
--- a/org.eclipse.virgo.kernel.userregionfactory/src/test/java/org/eclipse/virgo/kernel/userregionfactory/PackageImportWildcardExpanderTests.java
+++ b/org.eclipse.virgo.kernel.userregionfactory/src/test/java/org/eclipse/virgo/kernel/userregionfactory/PackageImportWildcardExpanderTests.java
@@ -44,7 +44,6 @@ public class PackageImportWildcardExpanderTests {
this.mockEventLogger = createMock(EventLogger.class);
replay(this.mockEventLogger);
- this.stubBundleContext.registerService(EventLogger.class.getName(), this.mockEventLogger, null);
this.mockPackageAdmin = createMock(PackageAdmin.class);
this.exportedPackages = new ExportedPackage[] { createdMockExportedPackage("q"), createdMockExportedPackage("r.a"),
@@ -63,13 +62,13 @@ public class PackageImportWildcardExpanderTests {
@Test
public void testNoWildcards() {
- String expansion = PackageImportWildcardExpander.expandPackageImportsWildcards("p,r", this.stubBundleContext);
+ String expansion = PackageImportWildcardExpander.expandPackageImportsWildcards("p,r", this.stubBundleContext, mockEventLogger);
assertEquals("Incorrect expansion", "p,r", expansion);
}
@Test
public void testWildcards() {
- String expansion = PackageImportWildcardExpander.expandPackageImportsWildcards("r.*", this.stubBundleContext);
+ String expansion = PackageImportWildcardExpander.expandPackageImportsWildcards("r.*", this.stubBundleContext, mockEventLogger);
assertEquals("Incorrect expansion", "r.a,r.b.c", expansion);
}

Back to the top