diff --git a/core.netigso/test/unit/src/org/netbeans/core/netigso/NetigsoReloadTest.java b/core.netigso/test/unit/src/org/netbeans/core/netigso/NetigsoReloadTest.java --- a/core.netigso/test/unit/src/org/netbeans/core/netigso/NetigsoReloadTest.java +++ b/core.netigso/test/unit/src/org/netbeans/core/netigso/NetigsoReloadTest.java @@ -44,18 +44,22 @@ package org.netbeans.core.netigso; +import java.util.logging.Level; import org.netbeans.core.startup.*; import java.io.File; import java.io.IOException; import java.util.Locale; +import java.util.logging.Logger; import org.netbeans.Module; import org.netbeans.ModuleManager; +import org.osgi.framework.Bundle; public class NetigsoReloadTest extends NetigsoHid { private static Module m1; private static ModuleManager mgr; private File withActivator; private File withoutA; + private Logger LOG; public NetigsoReloadTest(String name) { super(name); @@ -64,6 +68,8 @@ protected @Override void setUp() throws Exception { Locale.setDefault(Locale.US); clearWorkDir(); + + LOG = Logger.getLogger("TEST." + getName()); File ud = new File(getWorkDir(), "ud"); ud.mkdirs(); @@ -76,7 +82,7 @@ withoutA = changeManifest(withActivator, "Manifest-Version: 1.0\n" + "Bundle-SymbolicName: org.activate\n" + "Import-Package: org.osgi.framework\n" + - "Bundle-Version: 1.2\n"); + "Bundle-Version: 1.1\n"); } public void testCanReloadAModule() throws Exception { @@ -90,11 +96,20 @@ } finally { mgr.mutexPrivileged().exitWriteAccess(); } + + Bundle b = NetigsoServicesTest.findBundle("org.activate"); + assertEquals("version 1.1", "1.1.0", b.getVersion().toString()); + LOG.info("deleting old version and replacing the JAR"); assertTrue("Delete is OK", withoutA.delete()); assertTrue("Rename is OK", withActivator.renameTo(withoutA)); - + LOG.log(Level.INFO, "jar {0} replaced, redeploying", withoutA); TestModuleDeployer.deployTestModule(withoutA); + LOG.info("Deployed new module"); + + Bundle newB = NetigsoServicesTest.findBundle("org.activate"); +// assertEquals("new version 1.2.1", "1.2.1", newB.getVersion()); + Class main = m1.getClassLoader().loadClass("org.activate.Main"); Object s = main.getField("start").get(null); assertNotNull("Bundle started, its context provided", s); diff --git a/core.netigso/test/unit/src/org/netbeans/core/netigso/NetigsoSelfQueryTest.java b/core.netigso/test/unit/src/org/netbeans/core/netigso/NetigsoSelfQueryTest.java --- a/core.netigso/test/unit/src/org/netbeans/core/netigso/NetigsoSelfQueryTest.java +++ b/core.netigso/test/unit/src/org/netbeans/core/netigso/NetigsoSelfQueryTest.java @@ -47,6 +47,7 @@ import java.io.File; import java.io.InputStream; import java.net.URL; +import java.util.Collection; import java.util.Dictionary; import java.util.Enumeration; import java.util.List; @@ -447,6 +448,36 @@ throw new UnsupportedOperationException("Not supported yet."); } + @Override + public A adapt(Class type) { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int compareTo(Bundle o) { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public ServiceRegistration registerService(Class type, S s, Dictionary dctnr) { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public ServiceReference getServiceReference(Class type) { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Collection> getServiceReferences(Class type, String string) throws InvalidSyntaxException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Bundle getBundle(String string) { + throw new UnsupportedOperationException("Not supported yet."); + } + } private static final class MockBundle implements Bundle, BundleContent { @@ -616,5 +647,20 @@ throw new UnsupportedOperationException("Not supported yet."); } + @Override + public A adapt(Class type) { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public File getDataFile(String string) { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int compareTo(Bundle o) { + throw new UnsupportedOperationException("Not supported yet."); + } + } } diff --git a/core.netigso/test/unit/src/org/netbeans/core/netigso/NetigsoServicesTest.java b/core.netigso/test/unit/src/org/netbeans/core/netigso/NetigsoServicesTest.java --- a/core.netigso/test/unit/src/org/netbeans/core/netigso/NetigsoServicesTest.java +++ b/core.netigso/test/unit/src/org/netbeans/core/netigso/NetigsoServicesTest.java @@ -179,12 +179,16 @@ static Bundle findBundle(String bsn) throws Exception { Bundle[] arr = findFramework().getBundleContext().getBundles(); + Bundle candidate = null; for (Bundle b : arr) { if (bsn.equals(b.getSymbolicName())) { - return b; + candidate = b; + if ((b.getState() & Bundle.ACTIVE) != 0) { + return b; + } } } - return null; + return candidate; } private File changeManifest(File orig, String manifest) throws IOException { diff --git a/libs.felix/external/binaries-list b/libs.felix/external/binaries-list --- a/libs.felix/external/binaries-list +++ b/libs.felix/external/binaries-list @@ -1,2 +1,2 @@ -F1C19117B73A6819FA91EB646ECBA7F41073DC2A felix-3.2.2.jar +14F630EDF137F54188636B5139432986D5FB19B7 felix-4.0.2.jar diff --git a/libs.felix/external/felix-3.2.2-license.txt b/libs.felix/external/felix-4.0.2-license.txt rename from libs.felix/external/felix-3.2.2-license.txt rename to libs.felix/external/felix-4.0.2-license.txt --- a/libs.felix/external/felix-3.2.2-license.txt +++ b/libs.felix/external/felix-4.0.2-license.txt @@ -1,9 +1,9 @@ Name: Felix -Version: 3.2.2 -Description: Apache Felix OSGi container (minus org.osgi.** packages). +Version: 4.0.2 +Description: Apache Felix OSGi container. License: Apache-2.0 OSR: 13360 -Files: felix-3.2.2.jar +Files: felix-4.0.2.jar Origin: http://archive.apache.org/dist/felix/ Apache License diff --git a/libs.felix/manifest.mf b/libs.felix/manifest.mf --- a/libs.felix/manifest.mf +++ b/libs.felix/manifest.mf @@ -10,5 +10,5 @@ org.apache.felix.framework.cache,org.apache.felix.framework.capabilityset, org.apache.felix.framework.ext,org.apache.felix.framework.resolver, org.apache.felix.framework.util,org.apache.felix.framework.util.manifestparser, - org.apache.felix.main + org.apache.felix.main,org.apache.felix.framework.wiring diff --git a/libs.felix/nbproject/project.properties b/libs.felix/nbproject/project.properties --- a/libs.felix/nbproject/project.properties +++ b/libs.felix/nbproject/project.properties @@ -40,6 +40,6 @@ # Version 2 license, then the option applies only if the new code is # made subject to such option by the copyright holder. -release.external/felix-3.2.2.jar=modules/ext/felix-3.2.2.jar +release.external/felix-4.0.2.jar=modules/ext/felix-4.0.2.jar javac.source=1.6 javac.compilerargs=-Xlint -Xlint:-serial diff --git a/libs.felix/nbproject/project.xml b/libs.felix/nbproject/project.xml --- a/libs.felix/nbproject/project.xml +++ b/libs.felix/nbproject/project.xml @@ -16,8 +16,8 @@ - ext/felix-3.2.2.jar - external/felix-3.2.2.jar + ext/felix-4.0.2.jar + external/felix-4.0.2.jar diff --git a/libs.osgi/external/binaries-list b/libs.osgi/external/binaries-list --- a/libs.osgi/external/binaries-list +++ b/libs.osgi/external/binaries-list @@ -1,2 +1,2 @@ -986195A7E31034EE73F7A896A36B24169692F142 osgi.core-4.2.jar +30B192ADACF0EBA1096F18B3AC445123E212CFC9 osgi.core-4.3.jar 972E6455724DC6ADB1C1912F53B5E3D7DF20C5FD osgi.cmpn-4.2.jar diff --git a/libs.osgi/external/osgi-4.2-license.txt b/libs.osgi/external/osgi-4.2-license.txt --- a/libs.osgi/external/osgi-4.2-license.txt +++ b/libs.osgi/external/osgi-4.2-license.txt @@ -1,6 +1,6 @@ Name: OSGi -Version: 4.2 -Files: osgi.core-4.2.jar osgi.cmpn-4.2.jar +Version: 4.3 +Files: osgi.core-4.3.jar osgi.cmpn-4.2.jar Description: OSGi specification (core & compendium). License: Apache-2.0 Origin: http://www.osgi.org/Download/Release4V42 diff --git a/libs.osgi/nbproject/project.properties b/libs.osgi/nbproject/project.properties --- a/libs.osgi/nbproject/project.properties +++ b/libs.osgi/nbproject/project.properties @@ -2,5 +2,5 @@ javac.source=1.6 javac.compilerargs=-Xlint -Xlint:-serial -release.external/osgi.core-4.2.jar=modules/ext/osgi.core-4.2.jar +release.external/osgi.core-4.3.jar=modules/ext/osgi.core-4.3.jar release.external/osgi.cmpn-4.2.jar=modules/ext/osgi.cmpn-4.2.jar diff --git a/libs.osgi/nbproject/project.xml b/libs.osgi/nbproject/project.xml --- a/libs.osgi/nbproject/project.xml +++ b/libs.osgi/nbproject/project.xml @@ -10,8 +10,8 @@ org.osgi - ext/osgi.core-4.2.jar - external/osgi.core-4.2.jar + ext/osgi.core-4.3.jar + external/osgi.core-4.3.jar ext/osgi.cmpn-4.2.jar diff --git a/netbinox/external/binaries-list b/netbinox/external/binaries-list --- a/netbinox/external/binaries-list +++ b/netbinox/external/binaries-list @@ -1,1 +1,1 @@ -1D63B972926D053DFA427CA03841F67D4EAC6DB2 org.eclipse.osgi_3.6.0.v20100517.jar +2D80F93B8803250F232902C46EBA850BF1F3E67F org.eclipse.osgi_3.7.1.R37x_v20110808-1106.jar diff --git a/netbinox/external/org.eclipse.osgi_3.6.0.v20100517-license.txt b/netbinox/external/org.eclipse.osgi_3.7.1.R37x_v20110808-1106.license.txt rename from netbinox/external/org.eclipse.osgi_3.6.0.v20100517-license.txt rename to netbinox/external/org.eclipse.osgi_3.7.1.R37x_v20110808-1106.license.txt --- a/netbinox/external/org.eclipse.osgi_3.6.0.v20100517-license.txt +++ b/netbinox/external/org.eclipse.osgi_3.7.1.R37x_v20110808-1106.license.txt @@ -1,9 +1,9 @@ Name: Equinox -Version: 3.6.0 +Version: 3.7.1 Description: Eclipse OSGi container License: EPL-v10 OSR: XXX -Files: org.eclipse.osgi_3.6.0.v20100517.jar +Files: org.eclipse.osgi_3.7.1.R37x_v20110808-1106.jar Origin: http://www.eclipse.org/equinox/ Eclipse Public License - v 1.0 diff --git a/netbinox/nbproject/project.properties b/netbinox/nbproject/project.properties --- a/netbinox/nbproject/project.properties +++ b/netbinox/nbproject/project.properties @@ -41,6 +41,6 @@ # made subject to such option by the copyright holder. is.autoload=true -release.external/org.eclipse.osgi_3.6.0.v20100517.jar=modules/ext/org.eclipse.osgi_3.6.0.v20100517.jar +release.external/org.eclipse.osgi_3.7.1.R37x_v20110808-1106.jar=modules/ext/org.eclipse.osgi_3.7.1.R37x_v20110808-1106.jar javac.source=1.6 javac.compilerargs=-Xlint -Xlint:-serial diff --git a/netbinox/nbproject/project.xml b/netbinox/nbproject/project.xml --- a/netbinox/nbproject/project.xml +++ b/netbinox/nbproject/project.xml @@ -85,8 +85,8 @@ org.eclipse.osgi.util - ext/org.eclipse.osgi_3.6.0.v20100517.jar - external/org.eclipse.osgi_3.6.0.v20100517.jar + ext/org.eclipse.osgi_3.7.1.R37x_v20110808-1106.jar + external/org.eclipse.osgi_3.7.1.R37x_v20110808-1106.jar diff --git a/netbinox/src/org/netbeans/modules/netbinox/JarBundleFile.java b/netbinox/src/org/netbeans/modules/netbinox/JarBundleFile.java --- a/netbinox/src/org/netbeans/modules/netbinox/JarBundleFile.java +++ b/netbinox/src/org/netbeans/modules/netbinox/JarBundleFile.java @@ -281,10 +281,10 @@ } @Override - public Enumeration getEntryPaths(String prefix) { + public Enumeration getEntryPaths(String prefix) { BundleFile d = delegate("getEntryPaths", prefix); if (d == null) { - return Collections.enumeration(Collections.emptyList()); + return Collections.enumeration(Collections.emptyList()); } return d.getEntryPaths(prefix); } diff --git a/netbinox/src/org/netbeans/modules/netbinox/Netbinox.java b/netbinox/src/org/netbeans/modules/netbinox/Netbinox.java --- a/netbinox/src/org/netbeans/modules/netbinox/Netbinox.java +++ b/netbinox/src/org/netbeans/modules/netbinox/Netbinox.java @@ -44,6 +44,7 @@ import java.io.File; import java.io.InputStream; import java.lang.reflect.Field; +import java.util.Collection; import java.util.Dictionary; import java.util.Map; import java.util.Properties; @@ -104,7 +105,7 @@ public Context(BundleContext delegate) { this.delegate = delegate; } - + public boolean ungetService(ServiceReference sr) { return delegate.ungetService(sr); } @@ -140,6 +141,18 @@ } return delegate.installBundle(url, in); } + + public Collection> getServiceReferences(Class type, String string) throws InvalidSyntaxException { + return delegate.getServiceReferences(type, string); + } + + public ServiceReference getServiceReference(Class type) { + return delegate.getServiceReference(type); + } + + public ServiceRegistration registerService(Class type, S s, Dictionary dctnr) { + return delegate.registerService(type, s, dctnr); + } public ServiceReference[] getServiceReferences(String string, String string1) throws InvalidSyntaxException { return delegate.getServiceReferences(string, string1); @@ -172,6 +185,10 @@ public Bundle getBundle() { return delegate.getBundle(); } + + public Bundle getBundle(String s) { + return delegate.getBundle(s); + } public ServiceReference[] getAllServiceReferences(String string, String string1) throws InvalidSyntaxException { return delegate.getAllServiceReferences(string, string1); diff --git a/netbinox/src/org/netbeans/modules/netbinox/NetbinoxHooks.java b/netbinox/src/org/netbeans/modules/netbinox/NetbinoxHooks.java --- a/netbinox/src/org/netbeans/modules/netbinox/NetbinoxHooks.java +++ b/netbinox/src/org/netbeans/modules/netbinox/NetbinoxHooks.java @@ -47,14 +47,7 @@ import java.net.URL; import java.net.URLConnection; import java.security.ProtectionDomain; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Enumeration; -import java.util.HashSet; -import java.util.Map; -import java.util.Properties; -import java.util.Set; +import java.util.*; import java.util.logging.Level; import java.util.logging.LogRecord; import org.eclipse.osgi.baseadaptor.BaseAdaptor; @@ -204,6 +197,21 @@ } @Override + public List findEntries(String string, String string1, int i) { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Collection listResources(String string, String string1, int i) { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Collection listLocalResources(String string, String string1, int i) { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override protected URL findResource(String name) { return findLocalResource(name); } diff --git a/netbinox/test/unit/src/org/netbeans/modules/netbinox/CountingSecurityManager.java b/netbinox/test/unit/src/org/netbeans/modules/netbinox/CountingSecurityManager.java --- a/netbinox/test/unit/src/org/netbeans/modules/netbinox/CountingSecurityManager.java +++ b/netbinox/test/unit/src/org/netbeans/modules/netbinox/CountingSecurityManager.java @@ -442,6 +442,10 @@ // Just finite number of files in a cache return false; } + if (file.contains("/var/cache/netigso/org.eclipse.core.runtime/.")) { + // Just finite number of files in a cache + return false; + } if ( file.equals(System.getProperty("netbeans.user")) || file.equals(System.getProperty("netbeans.home")) ||