[Osgi-messages] SF.net SVN: osgi:[266] papoose-core/trunk
Status: Beta
Brought to you by:
maguro
|
From: <osg...@li...> - 2010-04-13 03:13:39
|
Revision: 266
http://osgi.svn.sourceforge.net/osgi/?rev=266&view=rev
Author: maguro
Date: 2010-04-13 03:13:32 +0000 (Tue, 13 Apr 2010)
Log Message:
-----------
Intermediate checkin
Modified Paths:
--------------
papoose-core/trunk/cnd-perm-admin/pom.xml
papoose-core/trunk/core/pom.xml
papoose-core/trunk/core/src/main/java/org/papoose/core/AbstractArchiveStore.java
papoose-core/trunk/core/src/main/java/org/papoose/core/BundleContextProxy.java
papoose-core/trunk/core/src/main/java/org/papoose/core/BundleController.java
papoose-core/trunk/core/src/main/java/org/papoose/core/BundleGeneration.java
papoose-core/trunk/core/src/main/java/org/papoose/core/BundleManager.java
papoose-core/trunk/core/src/main/java/org/papoose/core/Papoose.java
papoose-core/trunk/core/src/main/java/org/papoose/core/descriptions/LazyActivationDescription.java
papoose-core/trunk/core/src/main/java/org/papoose/core/util/Util.java
papoose-core/trunk/pom.xml
papoose-core/trunk/store/file-store/src/main/java/org/papoose/store/file/ArchiveFileStore.java
papoose-core/trunk/store/file-store/src/main/java/org/papoose/store/file/BundleFileStore.java
papoose-core/trunk/tck/bundles/pom.xml
papoose-core/trunk/tck/tests/pom.xml
papoose-core/trunk/test-support/test-bundle/src/main/java/com/acme/impl/Activator.java
Added Paths:
-----------
papoose-core/trunk/tck/bundles/simple/
papoose-core/trunk/tck/bundles/simple/pom.xml
papoose-core/trunk/tck/bundles/simple/src/
papoose-core/trunk/tck/bundles/simple/src/main/
papoose-core/trunk/tck/bundles/simple/src/main/java/
papoose-core/trunk/tck/bundles/simple/src/main/java/com/
papoose-core/trunk/tck/bundles/simple/src/main/java/com/acme/
papoose-core/trunk/tck/bundles/simple/src/main/java/com/acme/api/
papoose-core/trunk/tck/bundles/simple/src/main/java/com/acme/api/AnvilApi.java
papoose-core/trunk/tck/bundles/simple/src/main/java/com/acme/impl/
papoose-core/trunk/tck/bundles/simple/src/main/java/com/acme/impl/Activator.java
papoose-core/trunk/tck/bundles/simple/src/main/java/com/acme/impl/AnvilImpl.java
papoose-core/trunk/tck/bundles/simple/src/main/java/com/acme/pub/
papoose-core/trunk/tck/bundles/simple/src/main/java/com/acme/pub/Primary.java
papoose-core/trunk/tck/bundles/simple/src/main/java/com/acme/pvt/
papoose-core/trunk/tck/bundles/simple/src/main/java/com/acme/pvt/Hidden.java
papoose-core/trunk/tck/bundles/simple/src/main/java/com/acme/pvt/Private.java
papoose-core/trunk/tck/bundles/simple/src/main/resources/
papoose-core/trunk/tck/bundles/simple/src/main/resources/OSGI-INF/
papoose-core/trunk/tck/bundles/simple/src/main/resources/OSGI-INF/l10n/
papoose-core/trunk/tck/bundles/simple/src/main/resources/OSGI-INF/l10n/bundle.properties
papoose-core/trunk/tck/bundles/simple/src/main/resources/OSGI-INF/l10n/bundle_en.properties
papoose-core/trunk/tck/bundles/simple/src/main/resources/OSGI-INF/l10n/bundle_en_GB.properties
papoose-core/trunk/tck/bundles/simple/src/main/resources/OSGI-INF/l10n/bundle_en_GB_welsh.properties
papoose-core/trunk/tck/bundles/simple/src/main/resources/OSGI-INF/l10n/bundle_fr.properties
papoose-core/trunk/tck/bundles/simple/src/main/resources/OSGI-INF/l10n/bundle_fr_FR.properties
papoose-core/trunk/tck/bundles/simple/src/main/resources/com/
papoose-core/trunk/tck/bundles/simple/src/main/resources/com/acme/
papoose-core/trunk/tck/bundles/simple/src/main/resources/com/acme/anvil.xml
papoose-core/trunk/tck/bundles/simple/src/main/resources/com/acme/resource/
papoose-core/trunk/tck/bundles/simple/src/main/resources/com/acme/resource/camera.xml
papoose-core/trunk/tck/tests/src/
papoose-core/trunk/tck/tests/src/test/
papoose-core/trunk/tck/tests/src/test/java/
papoose-core/trunk/tck/tests/src/test/java/org/
papoose-core/trunk/tck/tests/src/test/java/org/papoose/
papoose-core/trunk/tck/tests/src/test/java/org/papoose/tck/
papoose-core/trunk/tck/tests/src/test/java/org/papoose/tck/core/
papoose-core/trunk/tck/tests/src/test/java/org/papoose/tck/core/PapooseFrameworkFactoryTest.java
Removed Paths:
-------------
papoose-core/trunk/test-support/test-bundle/src/test/
Modified: papoose-core/trunk/cnd-perm-admin/pom.xml
===================================================================
--- papoose-core/trunk/cnd-perm-admin/pom.xml 2010-03-06 18:50:37 UTC (rev 265)
+++ papoose-core/trunk/cnd-perm-admin/pom.xml 2010-04-13 03:13:32 UTC (rev 266)
@@ -10,7 +10,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>cnd-perm-admin</artifactId>
<packaging>jar</packaging>
- <name>Papoose :: OSGi R4 Conditional Permission Admin Service</name>
+ <name>Papoose :: OSGi R4 Conditional Perm Admin Service</name>
<description>OSGi R4 Conditional Permission Admin Service</description>
<build/>
Modified: papoose-core/trunk/core/pom.xml
===================================================================
--- papoose-core/trunk/core/pom.xml 2010-03-06 18:50:37 UTC (rev 265)
+++ papoose-core/trunk/core/pom.xml 2010-04-13 03:13:32 UTC (rev 266)
@@ -58,16 +58,16 @@
</dependency>
<dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>org.papoose.test-support</groupId>
<artifactId>test-support-bundle</artifactId>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- </dependency>
-
</dependencies>
</project>
Modified: papoose-core/trunk/core/src/main/java/org/papoose/core/AbstractArchiveStore.java
===================================================================
--- papoose-core/trunk/core/src/main/java/org/papoose/core/AbstractArchiveStore.java 2010-03-06 18:50:37 UTC (rev 265)
+++ papoose-core/trunk/core/src/main/java/org/papoose/core/AbstractArchiveStore.java 2010-04-13 03:13:32 UTC (rev 266)
@@ -87,7 +87,7 @@
this.bundleSymbolicName = tokens[0];
- String singletonString = Boolean.FALSE.toString();
+ String singletonString = "false";
String fragmentAttachmentString = Constants.FRAGMENT_ATTACHMENT_ALWAYS;
for (int i = 1; i < tokens.length; i++)
{
Modified: papoose-core/trunk/core/src/main/java/org/papoose/core/BundleContextProxy.java
===================================================================
--- papoose-core/trunk/core/src/main/java/org/papoose/core/BundleContextProxy.java 2010-03-06 18:50:37 UTC (rev 265)
+++ papoose-core/trunk/core/src/main/java/org/papoose/core/BundleContextProxy.java 2010-04-13 03:13:32 UTC (rev 266)
@@ -21,8 +21,6 @@
import java.lang.ref.WeakReference;
import java.util.Dictionary;
-import org.papoose.core.spi.LocationMapper;
-
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
@@ -34,7 +32,10 @@
import org.osgi.framework.ServiceReference;
import org.osgi.framework.ServiceRegistration;
+import org.papoose.core.spi.LocationMapper;
+import org.papoose.core.util.Util;
+
/**
* @version $Revision$ $Date$
*/
@@ -183,7 +184,7 @@
}
else
{
- return "[" + pinned.getBundleId() + "] " + pinned.getSymbolicName() + " - " + pinned.getVersion();
+ return "[" + pinned.getBundleId() + "]:" + Util.bundleStateToString(pinned.getState()) + " " + pinned.getSymbolicName() + " - " + pinned.getVersion();
}
}
Modified: papoose-core/trunk/core/src/main/java/org/papoose/core/BundleController.java
===================================================================
--- papoose-core/trunk/core/src/main/java/org/papoose/core/BundleController.java 2010-03-06 18:50:37 UTC (rev 265)
+++ papoose-core/trunk/core/src/main/java/org/papoose/core/BundleController.java 2010-04-13 03:13:32 UTC (rev 266)
@@ -33,13 +33,6 @@
import java.util.logging.Level;
import java.util.logging.Logger;
-import org.papoose.core.spi.ArchiveStore;
-import org.papoose.core.spi.BundleStore;
-import org.papoose.core.util.AttributeUtils;
-import org.papoose.core.util.I18nUtils;
-import org.papoose.core.util.SecurityUtils;
-import org.papoose.core.util.SerialExecutor;
-
import org.osgi.framework.AdminPermission;
import org.osgi.framework.AllServiceListener;
import org.osgi.framework.Bundle;
@@ -57,6 +50,13 @@
import org.osgi.framework.ServiceRegistration;
import org.osgi.framework.SynchronousBundleListener;
import org.osgi.framework.Version;
+import org.papoose.core.spi.ArchiveStore;
+import org.papoose.core.spi.BundleStore;
+import org.papoose.core.util.AttributeUtils;
+import org.papoose.core.util.I18nUtils;
+import org.papoose.core.util.SecurityUtils;
+import org.papoose.core.util.SerialExecutor;
+import org.papoose.core.util.Util;
/**
@@ -203,7 +203,7 @@
if (getState() == UNINSTALLED) throw new IllegalStateException("This bundle is uninstalled");
Papoose framework = getFramework();
- BundleGeneration bundleGeneration = (BundleGeneration) getCurrentGeneration();
+ BundleGeneration bundleGeneration = (BundleGeneration)getCurrentGeneration();
framework.requestStart(bundleGeneration, options);
}
@@ -218,7 +218,7 @@
if (getState() == UNINSTALLED) throw new IllegalStateException("This bundle is uninstalled");
Papoose framework = getFramework();
- BundleGeneration bundleGeneration = (BundleGeneration) getCurrentGeneration();
+ BundleGeneration bundleGeneration = (BundleGeneration)getCurrentGeneration();
framework.requestStop(bundleGeneration, options);
}
@@ -309,7 +309,7 @@
{
if (getState() == UNINSTALLED) throw new IllegalStateException("This bundle is uninstalled");
- return new ServiceReference[0]; //To change body of implemented methods use File | Settings | File Templates.
+ return new ServiceReference[0]; //Todo change body of implemented methods use File | Settings | File Templates.
}
/**
@@ -327,7 +327,6 @@
*/
public URL getResource(String name)
{
- SecurityManager sm = System.getSecurityManager();
try
{
SecurityUtils.checkAdminPermission(this, AdminPermission.RESOURCE);
@@ -357,11 +356,11 @@
if (currentGeneration instanceof BundleGeneration)
{
- bundleGeneration = (BundleGeneration) currentGeneration;
+ bundleGeneration = (BundleGeneration)currentGeneration;
}
else
{
- bundleGeneration = (BundleGeneration) getFramework().getBundleManager().getBundle(0).getCurrentGeneration();
+ bundleGeneration = (BundleGeneration)getFramework().getBundleManager().getBundle(0).getCurrentGeneration();
}
return bundleGeneration.getClassLoader().getResource(name);
@@ -461,16 +460,16 @@
if (currentGeneration instanceof BundleGeneration)
{
- bundleGeneration = (BundleGeneration) currentGeneration;
+ bundleGeneration = (BundleGeneration)currentGeneration;
}
else if (currentGeneration instanceof FragmentGeneration)
{
- FragmentGeneration fragmentGeneration = (FragmentGeneration) currentGeneration;
+ FragmentGeneration fragmentGeneration = (FragmentGeneration)currentGeneration;
bundleGeneration = fragmentGeneration.getHost();
}
else
{
- bundleGeneration = (BundleGeneration) getFramework().getBundleManager().getBundle(0).getCurrentGeneration();
+ bundleGeneration = (BundleGeneration)getFramework().getBundleManager().getBundle(0).getCurrentGeneration();
}
return bundleGeneration.getClassLoader().loadClass(name);
@@ -528,11 +527,11 @@
if (currentGeneration instanceof BundleGeneration)
{
- bundleGeneration = (BundleGeneration) currentGeneration;
+ bundleGeneration = (BundleGeneration)currentGeneration;
}
else
{
- bundleGeneration = (BundleGeneration) getFramework().getBundleManager().getBundle(0).getCurrentGeneration();
+ bundleGeneration = (BundleGeneration)getFramework().getBundleManager().getBundle(0).getCurrentGeneration();
}
return bundleGeneration.getClassLoader().findResources(name);
@@ -666,7 +665,7 @@
if (currentGeneration instanceof BundleGeneration)
{
- BundleGeneration bundleGeneration = (BundleGeneration) currentGeneration;
+ BundleGeneration bundleGeneration = (BundleGeneration)currentGeneration;
for (FragmentGeneration fragment : bundleGeneration.getFragments())
{
@@ -773,7 +772,7 @@
@Override
public String toString()
{
- return "[" + getBundleId() + "] " + getSymbolicName() + " - " + getCurrentGeneration().getVersion() + "/" + getGenerations().size();
+ return "[" + getBundleId() + "]:" + Util.bundleStateToString(getState()) + " " + getSymbolicName() + " - " + getCurrentGeneration().getVersion() + "/" + getGenerations().size();
}
void addBundleListener(BundleListener bundleListener)
@@ -784,7 +783,7 @@
{
if (syncBundleListeners == null) syncBundleListeners = new CopyOnWriteArraySet<SynchronousBundleListener>();
- syncBundleListeners.add((SynchronousBundleListener) bundleListener);
+ syncBundleListeners.add((SynchronousBundleListener)bundleListener);
}
else
{
@@ -908,11 +907,6 @@
this.filter = filter;
}
- public Filter getFilter()
- {
- return filter;
- }
-
public void serviceChanged(ServiceEvent event)
{
if (filter.match(event.getServiceReference())) delegate.serviceChanged(event);
@@ -924,7 +918,7 @@
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
- ServiceListenerWithFilter that = (ServiceListenerWithFilter) o;
+ ServiceListenerWithFilter that = (ServiceListenerWithFilter)o;
return delegate == that.delegate;
}
Modified: papoose-core/trunk/core/src/main/java/org/papoose/core/BundleGeneration.java
===================================================================
--- papoose-core/trunk/core/src/main/java/org/papoose/core/BundleGeneration.java 2010-03-06 18:50:37 UTC (rev 265)
+++ papoose-core/trunk/core/src/main/java/org/papoose/core/BundleGeneration.java 2010-04-13 03:13:32 UTC (rev 266)
@@ -29,6 +29,7 @@
import org.papoose.core.descriptions.NativeCodeDescription;
import org.papoose.core.spi.ArchiveStore;
import org.papoose.core.util.ToStringCreator;
+import org.papoose.core.util.Util;
/**
@@ -104,13 +105,6 @@
@Override
public String toString()
{
- ToStringCreator creator = new ToStringCreator(this);
-
- creator.append("bundleId", getBundleId());
- creator.append("generation", getGeneration());
- creator.append("symbolicName", getSymbolicName());
- creator.append("version", getVersion());
-
- return creator.toString();
+ return "[" + getBundleId() + "]:" + Util.bundleStateToString(getState()) + " " + getSymbolicName() + " - " + getVersion();
}
}
Modified: papoose-core/trunk/core/src/main/java/org/papoose/core/BundleManager.java
===================================================================
--- papoose-core/trunk/core/src/main/java/org/papoose/core/BundleManager.java 2010-03-06 18:50:37 UTC (rev 265)
+++ papoose-core/trunk/core/src/main/java/org/papoose/core/BundleManager.java 2010-04-13 03:13:32 UTC (rev 266)
@@ -52,6 +52,7 @@
import org.osgi.framework.ServiceReference;
import org.osgi.framework.SynchronousBundleListener;
import org.osgi.framework.Version;
+
import org.papoose.core.descriptions.ExportDescription;
import org.papoose.core.descriptions.Extension;
import org.papoose.core.descriptions.FragmentDescription;
@@ -65,7 +66,6 @@
import org.papoose.core.spi.Solution;
import org.papoose.core.spi.Store;
import org.papoose.core.util.SecurityUtils;
-import org.papoose.core.util.ToStringCreator;
/**
@@ -176,7 +176,7 @@
framework.getResolver().added(systemBundle.getCurrentGeneration());
- insertSystemClassLoader((BundleGeneration)systemBundle.getCurrentGeneration());
+ insertSystemClassLoader((BundleGeneration) systemBundle.getCurrentGeneration());
bundleStore.markModified();
@@ -279,8 +279,8 @@
public Bundle installBundle(String location, InputStream inputStream) throws BundleException
{
- LOGGER.entering(CLASS_NAME, "installBundle", new Object[]{location, inputStream});
-
+ LOGGER.entering(CLASS_NAME, "installBundle", new Object[]{ location, inputStream });
+
if (locations.containsKey(location)) return locations.get(location);
long bundleId = bundleCounter.incrementAndGet();
@@ -377,7 +377,7 @@
if (!bundleNativeCodeList.isEmpty())
{
- VersionRange osVersionRange = VersionRange.parseVersionRange((String)framework.getProperty(Constants.FRAMEWORK_OS_VERSION));
+ VersionRange osVersionRange = VersionRange.parseVersionRange((String) framework.getProperty(Constants.FRAMEWORK_OS_VERSION));
nextDescription:
for (NativeCodeDescription description : bundleNativeCodeList)
@@ -405,7 +405,7 @@
{
try
{
- Filter selectionFilter = new DefaultFilter(framework.getParser().parse((String)parameters.get(key)));
+ Filter selectionFilter = new DefaultFilter(framework.getParser().parse((String) parameters.get(key)));
if (!selectionFilter.match(framework.getProperties())) continue nextDescription;
}
catch (InvalidSyntaxException ise)
@@ -426,7 +426,7 @@
{
if (!bundleExecutionEnvironment.isEmpty())
{
- String string = (String)framework.getProperty(Constants.FRAMEWORK_EXECUTIONENVIRONMENT);
+ String string = (String) framework.getProperty(Constants.FRAMEWORK_EXECUTIONENVIRONMENT);
if (string == null) throw new BundleException(Constants.FRAMEWORK_EXECUTIONENVIRONMENT + " not set");
String[] environments = string.split(",");
@@ -448,7 +448,7 @@
try
{
- BundleController bundleController = (BundleController)target;
+ BundleController bundleController = (BundleController) target;
Set<Solution> solutions = framework.getResolver().resolve(bundleController.getCurrentGeneration());
if (solutions.isEmpty()) return false;
@@ -475,8 +475,8 @@
try
{
- BundleController targetController = (BundleController)target;
- BundleGeneration targetGeneration = (BundleGeneration)targetController.getCurrentGeneration();
+ BundleController targetController = (BundleController) target;
+ BundleGeneration targetGeneration = (BundleGeneration) targetController.getCurrentGeneration();
Set<Solution> solutions = framework.getResolver().resolve(targetGeneration, importDescription);
if (solutions.isEmpty()) return null;
@@ -676,7 +676,7 @@
{
if (generation.getArchiveStore().getBundleActivatorClass() != null)
{
- framework.getStartManager().start((BundleGeneration)generation, 0); // todo: this is probably wrong
+ framework.getStartManager().start((BundleGeneration) generation, 0); // todo: this is probably wrong
}
}
}
@@ -765,7 +765,7 @@
if (bundleActivatorClass == null) throw new BundleException("Bundle activator class " + bundleActivatorClassName + " not found");
- final BundleActivator bundleActivator = (BundleActivator)bundleActivatorClass.newInstance();
+ final BundleActivator bundleActivator = (BundleActivator) bundleActivatorClass.newInstance();
bundleController.setBundleActivator(bundleActivator);
@@ -897,8 +897,8 @@
public void uninstall(Bundle bundle) throws BundleException
{
- BundleController bundleController = (BundleController)bundle;
- BundleGeneration bundleGeneration = (BundleGeneration)bundleController.getCurrentGeneration();
+ BundleController bundleController = (BundleController) bundle;
+ BundleGeneration bundleGeneration = (BundleGeneration) bundleController.getCurrentGeneration();
try
{
@@ -916,21 +916,21 @@
}
}
- Set<Generation> unused = new HashSet<Generation>();
+ Set<Generation> unused = new HashSet<Generation>(bundleController.getGenerations().values());
boolean remove = true;
for (Generation generation : bundleController.getGenerations().values())
{
- boolean removed = false;
+ boolean inUse = false;
for (ExportDescription description : generation.getArchiveStore().getExportDescriptions())
{
if (description.getReferenceCount() > 0)
{
- removed = true;
- unused.add(generation);
+ inUse = true;
+ unused.remove(generation);
break;
}
}
- if (removed) remove = false;
+ if (inUse) remove = false;
}
for (Generation generation : unused)
@@ -1000,6 +1000,8 @@
{
assert false;
}
+
+ store.removeBundleStore(bundleId);
}
bundleGeneration.setState(Bundle.UNINSTALLED);
@@ -1103,7 +1105,7 @@
public void fireServiceEvent(ServiceEvent event)
{
ServiceReference reference = event.getServiceReference();
- String[] classes = (String[])reference.getProperty(Constants.OBJECTCLASS);
+ String[] classes = (String[]) reference.getProperty(Constants.OBJECTCLASS);
for (BundleController bundle : installedbundles.values())
{
@@ -1178,7 +1180,7 @@
}
else
{
- BootClasspathManager manager = (BootClasspathManager)framework.getProperty(BootClasspathManager.BOOT_CLASSPATH_MANAGER);
+ BootClasspathManager manager = (BootClasspathManager) framework.getProperty(BootClasspathManager.BOOT_CLASSPATH_MANAGER);
if (manager == null || !manager.isSupported()) throw new BundleException("Boot classpath extensions not supported in this framework configuration");
return new BootClassExtensionGeneration(bundle, archiveStore);
@@ -1225,7 +1227,7 @@
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
- NameVersionKey that = (NameVersionKey)o;
+ NameVersionKey that = (NameVersionKey) o;
//noinspection SimplifiableIfStatement
if (!symbolicName.equals(that.symbolicName)) return false;
@@ -1244,12 +1246,7 @@
@Override
public String toString()
{
- ToStringCreator creator = new ToStringCreator(this);
-
- creator.append("symbolicName", symbolicName);
- creator.append("version", version);
-
- return creator.toString();
+ return "[" + symbolicName + ", " + version + "]";
}
}
}
Modified: papoose-core/trunk/core/src/main/java/org/papoose/core/Papoose.java
===================================================================
--- papoose-core/trunk/core/src/main/java/org/papoose/core/Papoose.java 2010-03-06 18:50:37 UTC (rev 265)
+++ papoose-core/trunk/core/src/main/java/org/papoose/core/Papoose.java 2010-04-13 03:13:32 UTC (rev 266)
@@ -562,20 +562,19 @@
private void doStart() throws PapooseException
{
-
+ this.startManager.setStartLevel(startLevel);
}
private void doStop() throws PapooseException
{
- BundleManager manager = getBundleManager();
-
+ this.startManager.setStartLevel(0);
serviceRegistry.stop();
}
@Override
public String toString()
{
- return "[" + frameworkId + "] " + frameworkName + " - " + state;
+ return "[" + frameworkId + "]:" + state + " " + frameworkName;
}
static Papoose getFramework(Integer frameworkId)
@@ -718,7 +717,7 @@
Util.callStart(pojo, this);
- if (LOGGER.isLoggable(Level.FINEST)) LOGGER.finest("Starting " + pojo);
+ if (LOGGER.isLoggable(Level.FINEST)) LOGGER.finest("Started " + pojo);
bootServices.add(pojo);
}
@@ -870,8 +869,6 @@
public void init() throws PapooseException
{
- doInitialize();
-
state = new Starting();
}
Modified: papoose-core/trunk/core/src/main/java/org/papoose/core/descriptions/LazyActivationDescription.java
===================================================================
--- papoose-core/trunk/core/src/main/java/org/papoose/core/descriptions/LazyActivationDescription.java 2010-03-06 18:50:37 UTC (rev 265)
+++ papoose-core/trunk/core/src/main/java/org/papoose/core/descriptions/LazyActivationDescription.java 2010-04-13 03:13:32 UTC (rev 266)
@@ -19,6 +19,7 @@
import java.util.Collections;
import java.util.Set;
+
/**
* @version $Revision$ $Date$
*/
@@ -57,4 +58,10 @@
{
this.exclude = exclude;
}
+
+ @Override
+ public String toString()
+ {
+ return (lazyActivation ? "LAZY" : "EAGER");
+ }
}
Modified: papoose-core/trunk/core/src/main/java/org/papoose/core/util/Util.java
===================================================================
--- papoose-core/trunk/core/src/main/java/org/papoose/core/util/Util.java 2010-03-06 18:50:37 UTC (rev 265)
+++ papoose-core/trunk/core/src/main/java/org/papoose/core/util/Util.java 2010-04-13 03:13:32 UTC (rev 266)
@@ -37,6 +37,7 @@
import java.util.logging.Level;
import java.util.logging.Logger;
+import org.osgi.framework.Bundle;
import org.osgi.framework.BundleException;
import org.papoose.core.FatalError;
@@ -54,6 +55,26 @@
private final static String CLASS_NAME = Util.class.getName();
private final static Logger LOGGER = Logger.getLogger(CLASS_NAME);
+ public static String bundleStateToString(int state)
+ {
+ switch (state)
+ {
+ case Bundle.INSTALLED:
+ return "INSTALLED";
+ case Bundle.STARTING:
+ return "STARTING";
+ case Bundle.ACTIVE:
+ return "ACTIVE";
+ case Bundle.STOPPING:
+ return "STOPPING";
+ case Bundle.RESOLVED:
+ return "RESOLVED";
+ case Bundle.UNINSTALLED:
+ return "UNINSTALLED";
+ }
+ return "UNKNOWN";
+ }
+
public static void copy(InputStream input, OutputStream output) throws IOException
{
LOGGER.entering(CLASS_NAME, "copy", new Object[]{ input, output });
Modified: papoose-core/trunk/pom.xml
===================================================================
--- papoose-core/trunk/pom.xml 2010-03-06 18:50:37 UTC (rev 265)
+++ papoose-core/trunk/pom.xml 2010-04-13 03:13:32 UTC (rev 266)
@@ -71,6 +71,13 @@
</dependency>
<dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-all</artifactId>
+ <version>1.8.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<version>4.2.0</version>
@@ -91,6 +98,12 @@
<dependency>
<groupId>org.papoose.core</groupId>
+ <artifactId>framework</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.papoose.core</groupId>
<artifactId>perm-admin</artifactId>
<version>${pom.version}</version>
</dependency>
@@ -140,8 +153,15 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
+ <scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-all</artifactId>
+ <scope>test</scope>
+ </dependency>
+
</dependencies>
Modified: papoose-core/trunk/store/file-store/src/main/java/org/papoose/store/file/ArchiveFileStore.java
===================================================================
--- papoose-core/trunk/store/file-store/src/main/java/org/papoose/store/file/ArchiveFileStore.java 2010-03-06 18:50:37 UTC (rev 265)
+++ papoose-core/trunk/store/file-store/src/main/java/org/papoose/store/file/ArchiveFileStore.java 2010-04-13 03:13:32 UTC (rev 266)
@@ -45,6 +45,7 @@
import org.apache.xbean.classloader.ResourceLocation;
import org.osgi.framework.BundleException;
import org.osgi.framework.InvalidSyntaxException;
+import static org.papoose.core.util.Assert.assertTrue;
import org.papoose.core.AbstractArchiveStore;
import org.papoose.core.L18nResourceBundle;
@@ -54,7 +55,6 @@
import org.papoose.core.util.FileUtils;
import org.papoose.core.util.SecurityUtils;
import org.papoose.core.util.Util;
-import static org.papoose.core.util.Assert.assertTrue;
/**
@@ -510,18 +510,29 @@
}
}
- private static Attributes loadAndProvideAttributes(File bundleRoot, InputStream inputStream) throws BundleException
+ // todo: what and why are we copying anything here?
+ private static Attributes loadAndProvideAttributes(File generationRoot, InputStream inputStream) throws BundleException
{
try
{
- File archiveFile = new File(bundleRoot, ARCHIVE_JAR_NAME);
- OutputStream outputStream = new FileOutputStream(archiveFile);
+ File archiveFile = new File(generationRoot, ARCHIVE_JAR_NAME);
- Util.copy(inputStream, outputStream);
+ if (!archiveFile.exists())
+ {
+ OutputStream outputStream = null;
+ try
+ {
+ outputStream = new FileOutputStream(archiveFile);
- outputStream.close();
+ Util.copy(inputStream, outputStream);
+ }
+ finally
+ {
+ Util.close(outputStream);
+ }
+ }
- File archiveDir = new File(bundleRoot, ARCHIVE_NAME);
+ File archiveDir = new File(generationRoot, ARCHIVE_NAME);
assertTrue(archiveDir.mkdirs());
JarInputStream jarInputStream = new JarInputStream(new FileInputStream(archiveFile));
Modified: papoose-core/trunk/store/file-store/src/main/java/org/papoose/store/file/BundleFileStore.java
===================================================================
--- papoose-core/trunk/store/file-store/src/main/java/org/papoose/store/file/BundleFileStore.java 2010-03-06 18:50:37 UTC (rev 265)
+++ papoose-core/trunk/store/file-store/src/main/java/org/papoose/store/file/BundleFileStore.java 2010-04-13 03:13:32 UTC (rev 266)
@@ -97,8 +97,7 @@
try
{
- Properties properties = new Properties();
- properties.load(new FileInputStream(bundleRoot));
+ Properties properties = load();
this.location = properties.getProperty(LOCATION_KEY);
this.lastModified = System.currentTimeMillis();
this.setting = AutostartSetting.valueOf(properties.getProperty(AUTOSTART_KEY));
@@ -172,4 +171,11 @@
properties.setProperty(AUTOSTART_KEY, setting.toString());
properties.store(new FileOutputStream(new File(bundleRoot, "bundle.properties")), " bundle id: " + bundleId + " location: " + location);
}
+
+ private Properties load() throws IOException
+ {
+ Properties properties = new Properties();
+ properties.load(new FileInputStream(new File(bundleRoot, "bundle.properties")));
+ return properties;
+ }
}
Modified: papoose-core/trunk/tck/bundles/pom.xml
===================================================================
--- papoose-core/trunk/tck/bundles/pom.xml 2010-03-06 18:50:37 UTC (rev 265)
+++ papoose-core/trunk/tck/bundles/pom.xml 2010-04-13 03:13:32 UTC (rev 266)
@@ -12,6 +12,7 @@
<name>Papoose :: OSGi Compatibility Tests :: Bundles</name>
<modules>
+ <module>simple</module>
</modules>
</project>
Added: papoose-core/trunk/tck/bundles/simple/pom.xml
===================================================================
--- papoose-core/trunk/tck/bundles/simple/pom.xml (rev 0)
+++ papoose-core/trunk/tck/bundles/simple/pom.xml 2010-04-13 03:13:32 UTC (rev 266)
@@ -0,0 +1,56 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <parent>
+ <groupId>org.papoose.core.tck</groupId>
+ <artifactId>tck-bundles</artifactId>
+ <version>1.0.0.SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tck-simple-bundle</artifactId>
+ <packaging>bundle</packaging>
+ <name>Papoose :: OSGi Compatibility Tests :: Bundles :: Simple</name>
+ <description>OSGi R4 Test Bundle</description>
+
+ <build>
+ <plugins>
+
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Embed-Dependency>test-support-jar;inline=false</Embed-Dependency>
+ <Export-Package>com.acme.api</Export-Package>
+ <Private-Package>com.acme.pub;com.acme.pvt;com.acme.impl;-split-package:=first</Private-Package>
+ <Bundle-Activator>com.acme.impl.Activator</Bundle-Activator>
+ <L10N-Bundle>%bundle</L10N-Bundle>
+ <L10N-Test>%test</L10N-Test>
+ <L10N-NoTranslation>%no translation for this entry</L10N-NoTranslation>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.papoose.test-support</groupId>
+ <artifactId>test-support-jar</artifactId>
+ <version>${pom.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
Property changes on: papoose-core/trunk/tck/bundles/simple/pom.xml
___________________________________________________________________
Added: svn:mime-type
+ text/xml
Added: svn:keywords
+ Date Revision
Added: svn:eol-style
+ native
Added: papoose-core/trunk/tck/bundles/simple/src/main/java/com/acme/api/AnvilApi.java
===================================================================
--- papoose-core/trunk/tck/bundles/simple/src/main/java/com/acme/api/AnvilApi.java (rev 0)
+++ papoose-core/trunk/tck/bundles/simple/src/main/java/com/acme/api/AnvilApi.java 2010-04-13 03:13:32 UTC (rev 266)
@@ -0,0 +1,24 @@
+/**
+ *
+ * Copyright 2007 (C) The original author or authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.acme.api;
+
+/**
+ * @version $Revision$ $Date$
+ */
+public interface AnvilApi
+{
+}
Property changes on: papoose-core/trunk/tck/bundles/simple/src/main/java/com/acme/api/AnvilApi.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Date Revision Id Author
Added: svn:eol-style
+ native
Added: papoose-core/trunk/tck/bundles/simple/src/main/java/com/acme/impl/Activator.java
===================================================================
--- papoose-core/trunk/tck/bundles/simple/src/main/java/com/acme/impl/Activator.java (rev 0)
+++ papoose-core/trunk/tck/bundles/simple/src/main/java/com/acme/impl/Activator.java 2010-04-13 03:13:32 UTC (rev 266)
@@ -0,0 +1,34 @@
+/**
+ *
+ * Copyright 2007 (C) The original author or authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.acme.impl;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+/**
+ * @version $Revision$ $Date$
+ */
+public class Activator implements BundleActivator
+{
+ public void start(BundleContext bundleContext) throws Exception
+ {
+ }
+
+ public void stop(BundleContext bundleContext) throws Exception
+ {
+ }
+}
Property changes on: papoose-core/trunk/tck/bundles/simple/src/main/java/com/acme/impl/Activator.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Date Revision Id Author
Added: svn:eol-style
+ native
Added: papoose-core/trunk/tck/bundles/simple/src/main/java/com/acme/impl/AnvilImpl.java
===================================================================
--- papoose-core/trunk/tck/bundles/simple/src/main/java/com/acme/impl/AnvilImpl.java (rev 0)
+++ papoose-core/trunk/tck/bundles/simple/src/main/java/com/acme/impl/AnvilImpl.java 2010-04-13 03:13:32 UTC (rev 266)
@@ -0,0 +1,26 @@
+/**
+ *
+ * Copyright 2007 (C) The original author or authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.acme.impl;
+
+import com.acme.api.AnvilApi;
+
+/**
+ * @version $Revision$ $Date$
+ */
+public class AnvilImpl implements AnvilApi
+{
+}
Property changes on: papoose-core/trunk/tck/bundles/simple/src/main/java/com/acme/impl/AnvilImpl.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Date Revision Id Author
Added: svn:eol-style
+ native
Added: papoose-core/trunk/tck/bundles/simple/src/main/java/com/acme/pub/Primary.java
===================================================================
--- papoose-core/trunk/tck/bundles/simple/src/main/java/com/acme/pub/Primary.java (rev 0)
+++ papoose-core/trunk/tck/bundles/simple/src/main/java/com/acme/pub/Primary.java 2010-04-13 03:13:32 UTC (rev 266)
@@ -0,0 +1,24 @@
+/**
+ *
+ * Copyright 2007 (C) The original author or authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.acme.pub;
+
+/**
+ * @version $Revision$ $Date$
+ */
+public class Primary
+{
+}
Property changes on: papoose-core/trunk/tck/bundles/simple/src/main/java/com/acme/pub/Primary.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Date Revision Id Author
Added: svn:eol-style
+ native
Added: papoose-core/trunk/tck/bundles/simple/src/main/java/com/acme/pvt/Hidden.java
===================================================================
--- papoose-core/trunk/tck/bundles/simple/src/main/java/com/acme/pvt/Hidden.java (rev 0)
+++ papoose-core/trunk/tck/bundles/simple/src/main/java/com/acme/pvt/Hidden.java 2010-04-13 03:13:32 UTC (rev 266)
@@ -0,0 +1,24 @@
+/**
+ *
+ * Copyright 2007 (C) The original author or authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.acme.pvt;
+
+/**
+ * @version $Revision$ $Date$
+ */
+public class Hidden
+{
+}
Property changes on: papoose-core/trunk/tck/bundles/simple/src/main/java/com/acme/pvt/Hidden.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Date Revision Id Author
Added: svn:eol-style
+ native
Added: papoose-core/trunk/tck/bundles/simple/src/main/java/com/acme/pvt/Private.java
===================================================================
--- papoose-core/trunk/tck/bundles/simple/src/main/java/com/acme/pvt/Private.java (rev 0)
+++ papoose-core/trunk/tck/bundles/simple/src/main/java/com/acme/pvt/Private.java 2010-04-13 03:13:32 UTC (rev 266)
@@ -0,0 +1,24 @@
+/**
+ *
+ * Copyright 2009 (C) The original author or authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.acme.pvt;
+
+/**
+ * @version $Revision$ $Date$
+ */
+public class Private
+{
+}
Property changes on: papoose-core/trunk/tck/bundles/simple/src/main/java/com/acme/pvt/Private.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Date Revision Id Author
Added: svn:eol-style
+ native
Added: papoose-core/trunk/tck/bundles/simple/src/main/resources/OSGI-INF/l10n/bundle.properties
===================================================================
--- papoose-core/trunk/tck/bundles/simple/src/main/resources/OSGI-INF/l10n/bundle.properties (rev 0)
+++ papoose-core/trunk/tck/bundles/simple/src/main/resources/OSGI-INF/l10n/bundle.properties 2010-04-13 03:13:32 UTC (rev 266)
@@ -0,0 +1 @@
+bundle=bundle
Property changes on: papoose-core/trunk/tck/bundles/simple/src/main/resources/OSGI-INF/l10n/bundle.properties
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Date Revision
Added: svn:eol-style
+ native
Added: papoose-core/trunk/tck/bundles/simple/src/main/resources/OSGI-INF/l10n/bundle_en.properties
===================================================================
--- papoose-core/trunk/tck/bundles/simple/src/main/resources/OSGI-INF/l10n/bundle_en.properties (rev 0)
+++ papoose-core/trunk/tck/bundles/simple/src/main/resources/OSGI-INF/l10n/bundle_en.properties 2010-04-13 03:13:32 UTC (rev 266)
@@ -0,0 +1,2 @@
+bundle=bundle_en
+test=In the year 1815 Monseigneur Charles-Francois-Bienvenu Myriel was Bishop of Digne.
\ No newline at end of file
Property changes on: papoose-core/trunk/tck/bundles/simple/src/main/resources/OSGI-INF/l10n/bundle_en.properties
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Date Revision
Added: svn:eol-style
+ native
Added: papoose-core/trunk/tck/bundles/simple/src/main/resources/OSGI-INF/l10n/bundle_en_GB.properties
===================================================================
--- papoose-core/trunk/tck/bundles/simple/src/main/resources/OSGI-INF/l10n/bundle_en_GB.properties (rev 0)
+++ papoose-core/trunk/tck/bundles/simple/src/main/resources/OSGI-INF/l10n/bundle_en_GB.properties 2010-04-13 03:13:32 UTC (rev 266)
@@ -0,0 +1 @@
+bundle=bundle_en_GB
Property changes on: papoose-core/trunk/tck/bundles/simple/src/main/resources/OSGI-INF/l10n/bundle_en_GB.properties
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Date Revision
Added: svn:eol-style
+ native
Added: papoose-core/trunk/tck/bundles/simple/src/main/resources/OSGI-INF/l10n/bundle_en_GB_welsh.properties
===================================================================
--- papoose-core/trunk/tck/bundles/simple/src/main/resources/OSGI-INF/l10n/bundle_en_GB_welsh.properties (rev 0)
+++ papoose-core/trunk/tck/bundles/simple/src/main/resources/OSGI-INF/l10n/bundle_en_GB_welsh.properties 2010-04-13 03:13:32 UTC (rev 266)
@@ -0,0 +1 @@
+bundle=bundle_en_GB_welsh
Property changes on: papoose-core/trunk/tck/bundles/simple/src/main/resources/OSGI-INF/l10n/bundle_en_GB_welsh.properties
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Date Revision
Added: svn:eol-style
+ native
Added: papoose-core/trunk/tck/bundles/simple/src/main/resources/OSGI-INF/l10n/bundle_fr.properties
===================================================================
--- papoose-core/trunk/tck/bundles/simple/src/main/resources/OSGI-INF/l10n/bundle_fr.properties (rev 0)
+++ papoose-core/trunk/tck/bundles/simple/src/main/resources/OSGI-INF/l10n/bundle_fr.properties 2010-04-13 03:13:32 UTC (rev 266)
@@ -0,0 +1,2 @@
+bundle=bundle_fr
+test=En 1815, M. Charles-Fran\x8Dois-Bienvenu Myriel \x8Etait \x8Ev\x90que de Digne.
Property changes on: papoose-core/trunk/tck/bundles/simple/src/main/resources/OSGI-INF/l10n/bundle_fr.properties
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Date Revision
Added: svn:eol-style
+ native
Added: papoose-core/trunk/tck/bundles/simple/src/main/resources/OSGI-INF/l10n/bundle_fr_FR.properties
===================================================================
--- papoose-core/trunk/tck/bundles/simple/src/main/resources/OSGI-INF/l10n/bundle_fr_FR.properties (rev 0)
+++ papoose-core/trunk/tck/bundles/simple/src/main/resources/OSGI-INF/l10n/bundle_fr_FR.properties 2010-04-13 03:13:32 UTC (rev 266)
@@ -0,0 +1 @@
+bundle=bundle_fr_FR
Property changes on: papoose-core/trunk/tck/bundles/simple/src/main/resources/OSGI-INF/l10n/bundle_fr_FR.properties
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Date Revision
Added: svn:eol-style
+ native
Added: papoose-core/trunk/tck/bundles/simple/src/main/resources/com/acme/anvil.xml
===================================================================
--- papoose-core/trunk/tck/bundles/simple/src/main/resources/com/acme/anvil.xml (rev 0)
+++ papoose-core/trunk/tck/bundles/simple/src/main/resources/com/acme/anvil.xml 2010-04-13 03:13:32 UTC (rev 266)
@@ -0,0 +1 @@
+<anvil>How now brown cow.</anvil>
\ No newline at end of file
Property changes on: papoose-core/trunk/tck/bundles/simple/src/main/resources/com/acme/anvil.xml
___________________________________________________________________
Added: svn:mime-type
+ text/xml
Added: svn:keywords
+ Date Revision
Added: svn:eol-style
+ native
Added: papoose-core/trunk/tck/bundles/simple/src/main/resources/com/acme/resource/camera.xml
===================================================================
--- papoose-core/trunk/tck/bundles/simple/src/main/resources/com/acme/resource/camera.xml (rev 0)
+++ papoose-core/trunk/tck/bundles/simple/src/main/resources/com/acme/resource/camera.xml 2010-04-13 03:13:32 UTC (rev 266)
@@ -0,0 +1 @@
+<status>Canon</status>
\ No newline at end of file
Property changes on: papoose-core/trunk/tck/bundles/simple/src/main/resources/com/acme/resource/camera.xml
___________________________________________________________________
Added: svn:mime-type
+ text/xml
Added: svn:keywords
+ Date Revision
Added: svn:eol-style
+ native
Modified: papoose-core/trunk/tck/tests/pom.xml
===================================================================
--- papoose-core/trunk/tck/tests/pom.xml 2010-03-06 18:50:37 UTC (rev 265)
+++ papoose-core/trunk/tck/tests/pom.xml 2010-04-13 03:13:32 UTC (rev 266)
@@ -11,8 +11,89 @@
<packaging>pom</packaging>
<name>Papoose :: OSGi Compatibility Tests :: Tests</name>
- <modules>
- </modules>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy</id>
+ <phase>compile</phase>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.papoose.test-support</groupId>
+ <artifactId>test-support-bundle</artifactId>
+ <version>${papooseVersion}</version>
+ <type>jar</type>
+ <overWrite>true</overWrite>
+ <outputDirectory>target</outputDirectory>
+ <destFileName>bundle.jar</destFileName>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.papoose.core</groupId>
+ <artifactId>core</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.papoose.core</groupId>
+ <artifactId>cnd-perm-admin</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.papoose.core</groupId>
+ <artifactId>framework</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.papoose.core</groupId>
+ <artifactId>perm-admin</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.papoose.core</groupId>
+ <artifactId>pkg-admin</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.papoose.core</groupId>
+ <artifactId>start-level</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.papoose.core</groupId>
+ <artifactId>store-file</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.papoose.core</groupId>
+ <artifactId>store-memory</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.papoose.core</groupId>
+ <artifactId>url-handlers</artifactId>
+ </dependency>
+
+ </dependencies>
</project>
Added: papoose-core/trunk/tck/tests/src/test/java/org/papoose/tck/core/PapooseFrameworkFactoryTest.java
===================================================================
--- papoose-core/trunk/tck/tests/src/test/java/org/papoose/tck/core/PapooseFrameworkFactoryTest.java (rev 0)
+++ papoose-core/trunk/tck/tests/src/test/java/org/papoose/tck/core/PapooseFrameworkFactoryTest.java 2010-04-13 03:13:32 UTC (rev 266)
@@ -0,0 +1,147 @@
+/**
+ *
+ * Copyright 2010 (C) The original author or authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.papoose.tck.core;
+
+import java.io.File;
+import java.util.Dictionary;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Assert;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Constants;
+import org.osgi.framework.launch.Framework;
+import org.osgi.framework.launch.FrameworkFactory;
+
+import org.papoose.core.PapooseFrameworkFactory;
+
+
+/**
+ * @version $Revision$ $Date$
+ */
+public class PapooseFrameworkFactoryTest
+{
+ @Test
+ public void test() throws Exception
+ {
+ File f = new File("./target/bundle.jar");
+ String location = f.toURI().normalize().toString();
+
+ Map<String, String> configuration = new HashMap<String, String>();
+ configuration.put(Constants.FRAMEWORK_STORAGE, "target/papoose");
+
+ FrameworkFactory factory = new PapooseFrameworkFactory();
+ final Framework framework = factory.newFramework(configuration);
+
+ framework.init();
+
+ Bundle systemBundle = framework.getBundleContext().getBundle(0);
+ BundleContext context = systemBundle.getBundleContext();
+
+ Bundle testBundle = context.installBundle(location);
+
+ long testBundleId = testBundle.getBundleId();
+
+ assertTrue(testBundleId > 0);
+
+ try
+ {
+ framework.uninstall();
+ fail("Should have thrown an exception");
+ }
+ catch (BundleException e)
+ {
+ }
+
+ framework.stop();
+
+ framework.init();
+
+ systemBundle = framework.getBundleContext().getBundle(0);
+ context = systemBundle.getBundleContext();
+
+ testBundle = context.getBundle(testBundleId);
+ assertNotNull(testBundleId);
+
+ framework.start();
+ testBundle.start();
+
+ assertEquals(Bundle.ACTIVE, framework.getState());
+ assertEquals(Bundle.ACTIVE, testBundle.getState());
+
+ testBundle.uninstall();
+
+ Dictionary headers = testBundle.getHeaders("en");
+ Assert.assertEquals("org.papoose.test-support.bundle", headers.get("Bundle-SymbOLicName"));
+
+ headers = testBundle.getHeaders("en");
+ Assert.assertEquals("bundle_en", headers.get("L10N-Bundle"));
+
+ headers = testBundle.getHeaders();
+ Assert.assertEquals("bundle_en", headers.get("L10N-Bundle"));
+
+ headers = testBundle.getHeaders(null);
+ Assert.assertEquals("bundle_en", headers.get("L10N-Bundle"));
+
+ headers = testBundle.getHeaders("en_US");
+ Assert.assertEquals("bundle_en", headers.get("L10N-Bundle"));
+
+ headers = testBundle.getHeaders("fr");
+ Assert.assertEquals("bundle_fr", headers.get("L10N-Bundle"));
+
+ headers = testBundle.getHeaders("fr_FR");
+ Assert.assertEquals("bundle_fr_FR", headers.get("L10N-Bundle"));
+
+ headers = testBundle.getHeaders("");
+ Assert.assertEquals("%bundle", headers.get("L10N-Bundle"));
+
+ headers = testBundle.getHeaders("en");
+ Assert.assertEquals("no translation for this entry", headers.get("L10N-NoTranslation"));
+
+ try
+ {
+ testBundle.start();
+ fail("Cannot start an uninstalled bundle");
+ }
+ catch (IllegalStateException e)
+ {
+ }
+
+ testBundle = context.getBundle(testBundleId);
+ assertNull(testBundle);
+
+ framework.stop();
+
+ framework.init();
+
+ systemBundle = framework.getBundleContext().getBundle(0);
+ context = systemBundle.getBundleContext();
+
+ testBundle = context.getBundle(testBundleId);
+ assertNull(testBundle);
+
+ framework.stop();
+ }
+}
Property changes on: papoose-core/trunk/tck/tests/src/test/java/org/papoose/tck/core/PapooseFrameworkFactoryTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Date Revision Id Author
Added: svn:eol-style
+ native
Modified: papoose-core/trunk/test-support/test-bundle/src/main/java/com/acme/impl/Activator.java
==================...
[truncated message content] |