[jboss-cvs] JBossAS SVN: r96282 - in projects/jboss-osgi/trunk/reactor/framework/src: main/java/org/jboss/osgi/framework/vfs and 5 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Nov 11 17:30:32 EST 2009
Author: alesj
Date: 2009-11-11 17:30:31 -0500 (Wed, 11 Nov 2009)
New Revision: 96282
Added:
projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/FrameworkTest.java
projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/bundle/BundleVFSUnitTestCase.java
Removed:
projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/FrameworkTestCase.java
Modified:
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/vfs/BundleHandler.java
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/vfs/BundleVFSContext.java
projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/bundle/BundleContextUnitTestCase.java
projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/bundle/BundleEntriesUnitTestCase.java
projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/bundle/BundleUnitTestCase.java
projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/bundle/SystemBundleUnitTestCase.java
projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/classloader/ExportImportPackageUnitTestCase.java
projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/classloader/RequireBundleUnitTestCase.java
projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/service/GetServiceReferencesUnitTestCase.java
projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/service/GetUnGetServiceUnitTestCase.java
projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/service/RegisterServiceUnitTestCase.java
projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/service/ServiceFactoryUnitTestCase.java
projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/service/ServiceReferenceUnitTestCase.java
projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/service/ServiceRegistrationUnitTestCase.java
projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/smoke/OSGiSmokeTestCase.java
Log:
Add bundle vfs tests.
Rename FrameworkTestCase to just Test, to be consistent.
Modified: projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java 2009-11-11 22:09:32 UTC (rev 96281)
+++ projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java 2009-11-11 22:30:31 UTC (rev 96282)
@@ -216,7 +216,7 @@
return lastModified;
}
- public void modified()
+ void modified()
{
lastModified = System.currentTimeMillis();
}
Modified: projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java 2009-11-11 22:09:32 UTC (rev 96281)
+++ projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java 2009-11-11 22:30:31 UTC (rev 96282)
@@ -552,7 +552,7 @@
/**
* Uninstall a bundle
*
- * @param bundle the bundle
+ * @param bundleState the bundle
* @throws BundleException for any error
*/
public void uninstallBundle(OSGiBundleState bundleState) throws BundleException
Modified: projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/vfs/BundleHandler.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/vfs/BundleHandler.java 2009-11-11 22:09:32 UTC (rev 96281)
+++ projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/vfs/BundleHandler.java 2009-11-11 22:30:31 UTC (rev 96282)
@@ -26,6 +26,7 @@
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
+import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -35,6 +36,7 @@
import org.jboss.virtual.plugins.context.AbstractVirtualFileHandler;
import org.jboss.virtual.spi.VFSContext;
import org.jboss.virtual.spi.VirtualFileHandler;
+import org.jboss.deployers.vfs.spi.structure.helpers.AbstractStructureDeployer;
import org.osgi.framework.Bundle;
/**
@@ -46,19 +48,24 @@
{
/** The serialVersionUID */
private static final long serialVersionUID = 6650185906199900589L;
-
+
+ private VirtualFile root; // bundle's root
private VirtualFile file;
private Bundle bundle;
- private VirtualFileHandler handler;
+ private volatile String relativePath;
- public BundleHandler(VFSContext context, VirtualFile file, Bundle bundle) throws IOException
+ private volatile URI uri;
+ private volatile VirtualFileHandler handler;
+
+ public BundleHandler(VFSContext context, VirtualFile root, VirtualFile file, Bundle bundle) throws IOException
{
- this(context, LazyVirtualFileHandler.create(file.getParent()), file, bundle);
+ this(context, LazyVirtualFileHandler.create(file.getParent()), root, file, bundle);
}
- public BundleHandler(VFSContext context, VirtualFileHandler parent, VirtualFile file, Bundle bundle) throws IOException
+ private BundleHandler(VFSContext context, VirtualFileHandler parent, VirtualFile root, VirtualFile file, Bundle bundle) throws IOException
{
super(context, parent, file.getName());
+ this.root = root;
this.file = file;
this.bundle = bundle;
}
@@ -71,25 +78,31 @@
return handler;
}
- protected String getRelativePath(boolean checkEnd)
+ protected String getRelativePath(boolean checkStart, boolean checkEnd)
{
- String path = handler.getLocalPathName();
+ if (relativePath == null)
+ relativePath = AbstractStructureDeployer.getRelativePath(root, file);
+
+ String path = relativePath;
+ if (checkStart && path.startsWith("/") == false)
+ path = "/" + path;
if (checkEnd && path.endsWith("/") == false)
path += "/";
+
return path;
}
protected VirtualFileHandler createChildHandler(VirtualFile child) throws IOException
{
- if (handler == null)
- return new BundleHandler(getVFSContext(), child, bundle);
- else
- return new BundleHandler(getVFSContext(), handler, child, bundle);
+ return new BundleHandler(getVFSContext(), this, root, child, bundle);
}
public URI toURI() throws URISyntaxException
{
- return new URI("bundle", Long.toString(bundle.getBundleId()), getRelativePath(false), null);
+ if (uri == null)
+ uri = new URI("bundle", Long.toString(bundle.getBundleId()), getRelativePath(true, false), null);
+
+ return uri;
}
public long getLastModified() throws IOException
@@ -99,14 +112,14 @@
public InputStream openStream() throws IOException
{
- bundle.getResource(getRelativePath(false)); // permission check
+ bundle.getResource(getRelativePath(false, false)); // permission check
return file.openStream();
}
public List<VirtualFileHandler> getChildren(boolean ignoreErrors) throws IOException
{
- bundle.findEntries(getRelativePath(false), null, false); // permission check
+ bundle.findEntries(getRelativePath(false, false), null, false); // permission check
List<VirtualFile> children = file.getChildren();
if (children != null && children.isEmpty() == false)
@@ -123,7 +136,7 @@
public VirtualFileHandler getChild(String path) throws IOException
{
- String fullPath = getRelativePath(true) + path;
+ String fullPath = getRelativePath(false, true) + path;
URL entry = bundle.getEntry(fullPath); // permission check
if (entry == null)
return null;
@@ -134,6 +147,12 @@
//---------------------------------------------------------
+ @Override
+ protected URL toInternalVfsUrl() throws MalformedURLException, URISyntaxException
+ {
+ return toURI().toURL();
+ }
+
public long getSize() throws IOException
{
return file.getSize();
Modified: projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/vfs/BundleVFSContext.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/vfs/BundleVFSContext.java 2009-11-11 22:09:32 UTC (rev 96281)
+++ projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/vfs/BundleVFSContext.java 2009-11-11 22:30:31 UTC (rev 96282)
@@ -71,8 +71,9 @@
throw new IllegalArgumentException("Cannot handle non VFS deployments: " + unit);
VFSDeploymentUnit vdu = VFSDeploymentUnit.class.cast(unit);
- VirtualFile file = vdu.getFile(path); // should exist, resource != null
- root = new BundleHandler(this, file, bundleState);
+ VirtualFile duRoot = vdu.getRoot();
+ VirtualFile duFile = vdu.getFile(path); // should exist, resource != null
+ root = new BundleHandler(this, duRoot, duFile, bundleState);
}
public String getName()
Copied: projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/FrameworkTest.java (from rev 96278, projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/FrameworkTestCase.java)
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/FrameworkTest.java (rev 0)
+++ projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/FrameworkTest.java 2009-11-11 22:30:31 UTC (rev 96282)
@@ -0,0 +1,616 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.osgi;
+
+import java.net.URL;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import org.jboss.classloader.plugins.ClassLoaderUtils;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.osgi.framework.bundle.AbstractBundleState;
+import org.jboss.osgi.framework.bundle.OSGiBundleManager;
+import org.jboss.osgi.framework.metadata.OSGiMetaData;
+import org.jboss.osgi.spi.util.ConstantsHelper;
+import org.jboss.test.kernel.junit.MicrocontainerTest;
+import org.jboss.virtual.AssembledDirectory;
+import org.jboss.virtual.VirtualFile;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleEvent;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Constants;
+import org.osgi.framework.FrameworkEvent;
+import org.osgi.framework.FrameworkListener;
+import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceListener;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.SynchronousBundleListener;
+
+/**
+ * OSGiTestCase - Parent Test Case for OSGi tests.
+ *
+ * @author <a href="baileyje at gmail.com">John Bailey</a>
+ * @version $Revision: 87848 $
+ */
+public abstract class FrameworkTest extends MicrocontainerTest implements FrameworkListener, SynchronousBundleListener, ServiceListener
+{
+ private final List<FrameworkEvent> frameworkEvents = new CopyOnWriteArrayList<FrameworkEvent>();
+ private final List<BundleEvent> bundleEvents = new CopyOnWriteArrayList<BundleEvent>();
+ private final List<ServiceEvent> serviceEvents = new CopyOnWriteArrayList<ServiceEvent>();
+
+ /**
+ * Create a new OSGiTestCase.
+ *
+ * @param name the test name
+ */
+ public FrameworkTest(String name)
+ {
+ super(name);
+ }
+
+ public static FrameworkTestDelegate getDelegate(Class<?> clazz) throws Exception
+ {
+ return new FrameworkTestDelegate(clazz);
+ }
+
+ /**
+ * Get OSGiTestDelegate
+ */
+ protected FrameworkTestDelegate getDelegate()
+ {
+ return (FrameworkTestDelegate)super.getDelegate();
+ }
+
+ /**
+ * Get BundleManager from Delegate
+ *
+ * @return The BundleManager
+ */
+ protected OSGiBundleManager getBundleManager()
+ {
+ return getDelegate().getBundleManager();
+ }
+
+ /**
+ * Get the system bundle
+ *
+ * @return the system bundle
+ */
+ protected Bundle getSystemBundle()
+ {
+ return getBundleManager().getBundleById(0).getBundleInternal();
+ }
+
+ /**
+ * Add the base bundles
+ *
+ * @param expected the collection to add to
+ */
+ protected void addBaseBundles(Collection<Bundle> expected)
+ {
+ expected.add(getSystemBundle());
+ }
+
+ /**
+ * Create a bundle
+ *
+ * @param root the location of the location to deploy
+ * @param child the child to deploy
+ * @return Bundle for the deployment
+ * @throws Exception for any error
+ */
+ protected Bundle addBundle(String root, String child) throws Exception
+ {
+ return getDelegate().addBundle(root, child);
+ }
+
+ /**
+ * Create a bundle
+ *
+ * @param file the virtual file
+ * @return Bundle for the deployment
+ * @throws Exception for any error
+ */
+ protected Bundle addBundle(VirtualFile file) throws Exception
+ {
+ return getDelegate().addBundle(file);
+ }
+
+ /**
+ * Create a bundle
+ *
+ * @param root the location of the location to deploy
+ * @param child the child to deploy
+ * @return Bundle for the deployment
+ * @throws Exception for any error
+ */
+ protected Bundle deployBundle(String root, String child) throws Exception
+ {
+ return getDelegate().deployBundle(root, child);
+ }
+
+ /**
+ * Create a bundle
+ *
+ * @param file the virtual file
+ * @return Bundle for the deployment
+ * @throws Exception for any error
+ */
+ protected Bundle deployBundle(VirtualFile file) throws Exception
+ {
+ return getDelegate().deployBundle(file);
+ }
+
+ /**
+ * Remove a bundle
+ *
+ * @param bundle the bundle to remove
+ * @throws Exception for any error
+ */
+ protected void uninstall(Bundle bundle) throws Exception
+ {
+ getDelegate().uninstall(bundle);
+ }
+
+ protected DeploymentUnit getDeploymentUnit(Bundle bundle)
+ {
+ return getDelegate().getDeploymentUnit(bundle);
+ }
+
+ protected Bundle assembleBundle(String name, String resources, Class<?>... packages) throws Exception
+ {
+ return getDelegate().assembleBundle(name, new String[] { resources }, packages);
+ }
+
+ protected Bundle assembleBundle(String name, String[] resourcePaths, Class<?>... packages) throws Exception
+ {
+ return getDelegate().assembleBundle(name, resourcePaths, packages);
+ }
+
+ protected Bundle deployBundle(String name, Class<?>... packages) throws Exception
+ {
+ return getDelegate().deployBundle(name, null, (String[]) null, packages);
+ }
+
+ protected Bundle deployBundle(String name, String resourcePath, Class<?>... packages) throws Exception
+ {
+ return getDelegate().deployBundle(name, null, resourcePath, packages);
+ }
+
+ protected Bundle deployBundle(String name, String[] resourcePaths, Class<?>... packages) throws Exception
+ {
+ return getDelegate().deployBundle(name, null, resourcePaths, packages);
+ }
+
+ protected Bundle deployBundle(String name, OSGiMetaData metaData, Class<?>... packages) throws Exception
+ {
+ return getDelegate().deployBundle(name, metaData, (String[]) null, packages);
+ }
+
+ protected Bundle deployBundle(String name, OSGiMetaData metaData, String resourcePath, Class<?>... packages) throws Exception
+ {
+ return getDelegate().deployBundle(name, metaData, resourcePath, packages);
+ }
+
+ protected Bundle deployBundle(String name, OSGiMetaData metaData, String[] resourcePaths, Class<?>... packages) throws Exception
+ {
+ return getDelegate().deployBundle(name, metaData, resourcePaths, packages);
+ }
+
+ protected AssembledDirectory createAssembledDirectory(String name) throws Exception
+ {
+ return getDelegate().createAssembledDirectory(name, "");
+ }
+
+ protected AssembledDirectory createAssembledDirectory(String name, String rootName) throws Exception
+ {
+ return getDelegate().createAssembledDirectory(name, rootName);
+ }
+
+ protected void addPackage(AssembledDirectory dir, Class<?> reference) throws Exception
+ {
+ getDelegate().addPackage(dir, reference);
+ }
+
+ protected void addPath(final AssembledDirectory dir, String path, String name) throws Exception
+ {
+ getDelegate().addPath(dir, path, name);
+ }
+
+ protected void assertClassEquality(Class<?> expected, Class<?> actual)
+ {
+ assertTrue("Should be the same " + ClassLoaderUtils.classToString(expected) + " and " + ClassLoaderUtils.classToString(actual), expected == actual);
+ }
+
+ protected void assertNoClassEquality(Class<?> expected, Class<?> actual)
+ {
+ assertTrue("Should NOT be the same " + ClassLoaderUtils.classToString(expected) + " and " + ClassLoaderUtils.classToString(actual), expected != actual);
+ }
+
+ protected void assertClassLoader(Class<?> clazz, Bundle expected)
+ {
+ if (expected == null)
+ return;
+ ClassLoader cl = clazz.getClassLoader();
+ ClassLoader bundleClassLoader = getBundleClassLoader(expected);
+ boolean result = bundleClassLoader.equals(cl);
+ assertTrue(ClassLoaderUtils.classToString(clazz) + " should have expected classloader=" + expected, result);
+ }
+
+ protected ClassLoader getBundleClassLoader(Bundle expected)
+ {
+ return getDeploymentUnit(expected).getClassLoader();
+ }
+
+ protected Class<?> assertLoadClass(Bundle start, Class<?> reference) throws Exception
+ {
+ return assertLoadClass(start, reference, start);
+ }
+
+ protected Class<?> assertLoadClass(Bundle start, Class<?> reference, Bundle expected) throws Exception
+ {
+ return assertLoadClass(start, reference, expected, false);
+ }
+
+ protected Class<?> assertLoadClass(Bundle start, Class<?> reference, Bundle expected, boolean isReference) throws Exception
+ {
+ Class<?> result = assertLoadClass(reference.getName(), start, expected);
+ if (isReference)
+ assertClassEquality(reference, result);
+ else
+ assertNoClassEquality(reference, result);
+ return result;
+ }
+
+ protected Class<?> assertLoadClass(String name, Bundle bundle, Bundle expected)
+ {
+ Class<?> result = null;
+ try
+ {
+ result = bundle.loadClass(name);
+ getLog().debug("Got class: " + ClassLoaderUtils.classToString(result) + " for " + name + " from " + bundle);
+ }
+ catch (ClassNotFoundException e)
+ {
+ failure("Did not expect CNFE for " + name + " from " + bundle, e);
+ }
+ assertClassLoader(result, expected);
+ return result;
+ }
+
+ protected void assertLoadClassFail(Bundle start, Class<?> reference)
+ {
+ assertLoadClassFail(start, reference.getName());
+ }
+
+ protected void assertLoadClassFail(Bundle start, String name)
+ {
+ try
+ {
+ start.loadClass(name);
+ fail("Should not be here!");
+ }
+ catch (Exception expected)
+ {
+ checkThrowable(ClassNotFoundException.class, expected);
+ }
+ }
+
+ protected URL getBundleResource(Bundle bundle, String path)
+ {
+ return getDelegate().getBundleResource(bundle, path);
+ }
+
+ protected Enumeration<URL> getBundleResources(Bundle bundle, String path) throws Exception
+ {
+ return getDelegate().getBundleResources(bundle, path);
+ }
+
+ protected void assertNoAllReferences(BundleContext bundleContext, String clazz) throws Exception
+ {
+ assertNoAllReferences(bundleContext, clazz, null);
+ }
+
+ protected void assertNoAllReferences(BundleContext bundleContext, String clazz, String filter) throws Exception
+ {
+ ServiceReference[] actual = bundleContext.getAllServiceReferences(clazz, filter);
+ if (actual != null)
+ getLog().debug(bundleContext + " got " + Arrays.asList(actual) + " for clazz=" + clazz + " filter=" + filter);
+ else
+ getLog().debug(bundleContext + " got nothing for clazz=" + clazz + " filter=" + filter);
+ assertNull("Expected no references for clazz=" + clazz + " filter=" + filter, actual);
+ }
+
+ protected void assertAllReferences(BundleContext bundleContext, String clazz, ServiceReference... expected) throws Exception
+ {
+ assertAllReferences(bundleContext, clazz, null, expected);
+ }
+
+ protected void assertAllReferences(BundleContext bundleContext, String clazz, String filter, ServiceReference... expected) throws Exception
+ {
+ ServiceReference[] actual = bundleContext.getAllServiceReferences(clazz, filter);
+ if (actual != null)
+ getLog().debug(bundleContext + " got " + Arrays.asList(actual) + " for clazz=" + clazz + " filter=" + filter);
+ else
+ getLog().debug(bundleContext + " got nothing for clazz=" + clazz + " filter=" + filter);
+ assertEquals(bundleContext + " with clazz=" + clazz + " filter=" + filter, expected, actual);
+ }
+
+ protected void assertNoReferences(BundleContext bundleContext, String clazz) throws Exception
+ {
+ assertNoReferences(bundleContext, clazz, null);
+ }
+
+ protected void assertNoReferences(BundleContext bundleContext, String clazz, String filter) throws Exception
+ {
+ ServiceReference[] actual = bundleContext.getServiceReferences(clazz, filter);
+ if (actual != null)
+ getLog().debug(bundleContext + " got " + Arrays.asList(actual) + " for clazz=" + clazz + " filter=" + filter);
+ else
+ getLog().debug(bundleContext + " got nothing for clazz=" + clazz + " filter=" + filter);
+ assertNull("Expected no references for clazz=" + clazz + " filter=" + filter, actual);
+ }
+
+ protected void assertReferences(BundleContext bundleContext, String clazz, ServiceReference... expected) throws Exception
+ {
+ assertReferences(bundleContext, clazz, null, expected);
+ }
+
+ protected void assertReferences(BundleContext bundleContext, String clazz, String filter, ServiceReference... expected) throws Exception
+ {
+ ServiceReference[] actual = bundleContext.getServiceReferences(clazz, filter);
+ if (actual != null)
+ getLog().debug(bundleContext + " got " + Arrays.asList(actual) + " for clazz=" + clazz + " filter=" + filter);
+ else
+ getLog().debug(bundleContext + " got nothing for clazz=" + clazz + " filter=" + filter);
+ assertEquals(bundleContext + " with clazz=" + clazz + " filter=" + filter, expected, actual);
+ }
+
+ protected void assertNoGetReference(BundleContext bundleContext, String clazz) throws Exception
+ {
+ ServiceReference actual = bundleContext.getServiceReference(clazz);
+ if (actual != null)
+ getLog().debug(bundleContext + " got " + actual + " for clazz=" + clazz);
+ else
+ getLog().debug(bundleContext + " got nothing for clazz=" + clazz);
+ assertNull("Expected no references for clazz=" + clazz, actual);
+ }
+
+ protected void assertGetReference(BundleContext bundleContext, String clazz, ServiceReference expected) throws Exception
+ {
+ ServiceReference actual = bundleContext.getServiceReference(clazz);
+ if (actual != null)
+ getLog().debug(bundleContext + " got " + Arrays.asList(actual) + " for clazz=" + clazz);
+ else
+ getLog().debug(bundleContext + " got nothing for clazz=" + clazz);
+ assertEquals(bundleContext + " with clazz=" + clazz, expected, actual);
+ }
+
+ protected void assertUsingBundles(ServiceReference reference, Bundle... bundles)
+ {
+ Set<Bundle> expected = new HashSet<Bundle>();
+ expected.addAll(Arrays.asList(bundles));
+
+ Set<Bundle> actual = new HashSet<Bundle>();
+ Bundle[] users = reference.getUsingBundles();
+ if (users != null)
+ actual.addAll(Arrays.asList(users));
+
+ getLog().debug(reference + " users=" + actual);
+
+ assertEquals(expected, actual);
+ }
+
+ protected void assertObjectClass(String expected, ServiceReference reference)
+ {
+ assertObjectClass(new String[] { expected }, reference);
+ }
+
+ protected void assertObjectClass(String[] expected, ServiceReference reference)
+ {
+ Object actual = reference.getProperty(Constants.OBJECTCLASS);
+ if (actual == null)
+ fail("no object class???");
+ if (actual instanceof String[] == false)
+ fail(actual + " is not a string array??? " + actual.getClass().getName());
+ assertEquals(expected, (String[])actual);
+ }
+
+ public void frameworkEvent(FrameworkEvent event)
+ {
+ synchronized (frameworkEvents)
+ {
+ getLog().debug("FrameworkEvent type=" + ConstantsHelper.frameworkEvent(event.getType()) + " for " + event);
+ frameworkEvents.add(event);
+ frameworkEvents.notifyAll();
+ }
+ }
+
+ protected void assertNoFrameworkEvent() throws Exception
+ {
+ getLog().debug("frameworkEvents=" + frameworkEvents);
+ assertEquals(0, frameworkEvents.size());
+ }
+
+ protected void assertFrameworkEvent(int type) throws Exception
+ {
+ assertFrameworkEvent(type, getSystemBundle(), null);
+ }
+
+ protected void assertFrameworkEvent(int type, Class<? extends Throwable> expectedThrowable) throws Exception
+ {
+ assertFrameworkEvent(type, getSystemBundle(), expectedThrowable);
+ }
+
+ protected void assertFrameworkEvent(int type, Bundle bundle, Class<? extends Throwable> expectedThrowable) throws Exception
+ {
+ waitForEvent(frameworkEvents, type);
+ getLog().debug("frameworkEvents=" + frameworkEvents);
+ int size = frameworkEvents.size();
+ assertTrue("" + size, size > 0);
+ FrameworkEvent event = frameworkEvents.remove(0);
+ assertEquals(ConstantsHelper.frameworkEvent(type), ConstantsHelper.frameworkEvent(event.getType()));
+ Throwable t = event.getThrowable();
+ if (expectedThrowable == null)
+ {
+ if (t != null)
+ {
+ getLog().error("Unexpected error in Framework event: ", t);
+ fail("Unexpected throwable: " + t);
+ }
+ }
+ else
+ {
+ checkThrowable(BundleException.class, t);
+ checkDeepThrowable(expectedThrowable, t);
+ }
+ assertEquals(bundle, event.getSource());
+ assertEquals(bundle, event.getBundle());
+ }
+
+ public void bundleChanged(BundleEvent event)
+ {
+ synchronized (bundleEvents)
+ {
+ getLog().debug("BundleChanged type=" + ConstantsHelper.bundleEvent(event.getType()) + " for " + event);
+ bundleEvents.add(event);
+ bundleEvents.notifyAll();
+ }
+ }
+
+ protected void assertNoBundleEvent() throws Exception
+ {
+ getLog().debug("bundleEvents=" + bundleEvents);
+ assertEquals(0, bundleEvents.size());
+ }
+
+ protected void assertBundleEvent(int type, Bundle bundle) throws Exception
+ {
+ waitForEvent(bundleEvents, type);
+
+ getLog().debug("bundleEvents=" + bundleEvents);
+ int size = bundleEvents.size();
+ assertTrue("" + size, size > 0);
+
+ if (bundle instanceof AbstractBundleState)
+ bundle = ((AbstractBundleState)bundle).getBundle();
+
+ BundleEvent foundEvent = null;
+ for(int i=0; i < bundleEvents.size(); i++)
+ {
+ BundleEvent aux = bundleEvents.get(i);
+ if (type == aux.getType())
+ {
+ if (bundle.equals(aux.getSource()) && bundle.equals(aux.getBundle()))
+ {
+ bundleEvents.remove(aux);
+ foundEvent = aux;
+ break;
+ }
+ }
+ }
+
+ if (foundEvent == null)
+ fail("Cannot find event " + ConstantsHelper.bundleEvent(type) + " from " + bundle);
+ }
+
+ public void serviceChanged(ServiceEvent event)
+ {
+ synchronized (serviceEvents)
+ {
+ getLog().debug("ServiceChanged type=" + ConstantsHelper.serviceEvent(event.getType()) + " for " + event);
+ serviceEvents.add(event);
+ serviceEvents.notifyAll();
+ }
+ }
+
+ protected void assertNoServiceEvent() throws Exception
+ {
+ getLog().debug("serviceEvents=" + serviceEvents);
+ assertEquals(0, serviceEvents.size());
+ }
+
+ protected void assertServiceEvent(int type, ServiceReference reference) throws Exception
+ {
+ waitForEvent(serviceEvents, type);
+ getLog().debug("serviceEvents=" + serviceEvents);
+ int size = serviceEvents.size();
+ assertTrue("" + size, size > 0);
+ ServiceEvent event = serviceEvents.remove(0);
+ assertEquals(ConstantsHelper.serviceEvent(type), ConstantsHelper.serviceEvent(event.getType()));
+ assertEquals(reference, event.getSource());
+ assertEquals(reference, event.getServiceReference());
+ }
+
+ @SuppressWarnings({"unchecked", "SynchronizationOnLocalVariableOrMethodParameter"})
+ private void waitForEvent(List events, int type) throws InterruptedException
+ {
+ // Timeout for event delivery: 3 sec
+ int timeout = 30;
+
+ boolean eventFound = false;
+ while (eventFound == false && 0 < timeout)
+ {
+ synchronized (events)
+ {
+ events.wait(100);
+ for (Object aux : events)
+ {
+ if (aux instanceof BundleEvent)
+ {
+ BundleEvent event = (BundleEvent)aux;
+ if (type == event.getType())
+ {
+ eventFound = true;
+ break;
+ }
+ }
+ else if (aux instanceof ServiceEvent)
+ {
+ ServiceEvent event = (ServiceEvent)aux;
+ if (type == event.getType())
+ {
+ eventFound = true;
+ break;
+ }
+ }
+ else if (aux instanceof FrameworkEvent)
+ {
+ FrameworkEvent event = (FrameworkEvent)aux;
+ if (type == event.getType())
+ {
+ eventFound = true;
+ break;
+ }
+ }
+ }
+ }
+ timeout--;
+ }
+ }
+}
Deleted: projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/FrameworkTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/FrameworkTestCase.java 2009-11-11 22:09:32 UTC (rev 96281)
+++ projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/FrameworkTestCase.java 2009-11-11 22:30:31 UTC (rev 96282)
@@ -1,619 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.test.osgi;
-
-import java.net.URL;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import org.jboss.classloader.plugins.ClassLoaderUtils;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.osgi.framework.bundle.AbstractBundleState;
-import org.jboss.osgi.framework.bundle.OSGiBundleManager;
-import org.jboss.osgi.framework.metadata.OSGiMetaData;
-import org.jboss.osgi.spi.util.ConstantsHelper;
-import org.jboss.test.kernel.junit.MicrocontainerTest;
-import org.jboss.virtual.AssembledDirectory;
-import org.jboss.virtual.VirtualFile;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleEvent;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.Constants;
-import org.osgi.framework.FrameworkEvent;
-import org.osgi.framework.FrameworkListener;
-import org.osgi.framework.ServiceEvent;
-import org.osgi.framework.ServiceListener;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.SynchronousBundleListener;
-
-/**
- * OSGiTestCase - Parent Test Case for OSGi tests.
- *
- * @author <a href="baileyje at gmail.com">John Bailey</a>
- * @version $Revision: 87848 $
- */
-public abstract class FrameworkTestCase extends MicrocontainerTest implements FrameworkListener, SynchronousBundleListener, ServiceListener
-{
- private List<FrameworkEvent> frameworkEvents = new CopyOnWriteArrayList<FrameworkEvent>();
- private List<BundleEvent> bundleEvents = new CopyOnWriteArrayList<BundleEvent>();
- private List<ServiceEvent> serviceEvents = new CopyOnWriteArrayList<ServiceEvent>();
-
- /**
- * Create a new OSGiTestCase.
- *
- * @param name the test name
- */
- public FrameworkTestCase(String name)
- {
- super(name);
- }
-
- public static FrameworkTestDelegate getDelegate(Class<?> clazz) throws Exception
- {
- FrameworkTestDelegate delegate = new FrameworkTestDelegate(clazz);
- return delegate;
- }
-
- /**
- * Get OSGiTestDelegate
- */
- protected FrameworkTestDelegate getDelegate()
- {
- return (FrameworkTestDelegate)super.getDelegate();
- }
-
- /**
- * Get BundleManager from Delegate
- *
- * @return The BundleManager
- */
- protected OSGiBundleManager getBundleManager()
- {
- return getDelegate().getBundleManager();
- }
-
- /**
- * Get the system bundle
- *
- * @return the system bundle
- */
- protected Bundle getSystemBundle()
- {
- return getBundleManager().getBundleById(0).getBundleInternal();
- }
-
- /**
- * Add the base bundles
- *
- * @param expected the collection to add to
- */
- protected void addBaseBundles(Collection<Bundle> expected)
- {
- expected.add(getSystemBundle());
- }
-
- /**
- * Create a bundle
- *
- * @param root the location of the location to deploy
- * @param child the child to deploy
- * @return Bundle for the deployment
- * @throws Exception for any error
- */
- protected Bundle addBundle(String root, String child) throws Exception
- {
- return getDelegate().addBundle(root, child);
- }
-
- /**
- * Create a bundle
- *
- * @param file the virtual file
- * @return Bundle for the deployment
- * @throws Exception for any error
- */
- protected Bundle addBundle(VirtualFile file) throws Exception
- {
- return getDelegate().addBundle(file);
- }
-
- /**
- * Create a bundle
- *
- * @param root the location of the location to deploy
- * @param child the child to deploy
- * @return Bundle for the deployment
- * @throws Exception for any error
- */
- protected Bundle deployBundle(String root, String child) throws Exception
- {
- return getDelegate().deployBundle(root, child);
- }
-
- /**
- * Create a bundle
- *
- * @param file the virtual file
- * @return Bundle for the deployment
- * @throws Exception for any error
- */
- protected Bundle deployBundle(VirtualFile file) throws Exception
- {
- return getDelegate().deployBundle(file);
- }
-
- /**
- * Remove a bundle
- *
- * @param bundle the bundle to remove
- * @throws Exception for any error
- */
- protected void uninstall(Bundle bundle) throws Exception
- {
- getDelegate().uninstall(bundle);
- }
-
- protected DeploymentUnit getDeploymentUnit(Bundle bundle)
- {
- return getDelegate().getDeploymentUnit(bundle);
- }
-
- protected Bundle assembleBundle(String name, String resources, Class<?>... packages) throws Exception
- {
- return getDelegate().assembleBundle(name, new String[] { resources }, packages);
- }
-
- protected Bundle assembleBundle(String name, String[] resourcePaths, Class<?>... packages) throws Exception
- {
- return getDelegate().assembleBundle(name, resourcePaths, packages);
- }
-
- protected Bundle deployBundle(String name, Class<?>... packages) throws Exception
- {
- return getDelegate().deployBundle(name, null, (String[]) null, packages);
- }
-
- protected Bundle deployBundle(String name, String resourcePath, Class<?>... packages) throws Exception
- {
- return getDelegate().deployBundle(name, null, resourcePath, packages);
- }
-
- protected Bundle deployBundle(String name, String[] resourcePaths, Class<?>... packages) throws Exception
- {
- return getDelegate().deployBundle(name, null, resourcePaths, packages);
- }
-
- protected Bundle deployBundle(String name, OSGiMetaData metaData, Class<?>... packages) throws Exception
- {
- return getDelegate().deployBundle(name, metaData, (String[]) null, packages);
- }
-
- protected Bundle deployBundle(String name, OSGiMetaData metaData, String resourcePath, Class<?>... packages) throws Exception
- {
- return getDelegate().deployBundle(name, metaData, resourcePath, packages);
- }
-
- protected Bundle deployBundle(String name, OSGiMetaData metaData, String[] resourcePaths, Class<?>... packages) throws Exception
- {
- return getDelegate().deployBundle(name, metaData, resourcePaths, packages);
- }
-
- protected AssembledDirectory createAssembledDirectory(String name) throws Exception
- {
- return getDelegate().createAssembledDirectory(name, "");
- }
-
- protected AssembledDirectory createAssembledDirectory(String name, String rootName) throws Exception
- {
- return getDelegate().createAssembledDirectory(name, rootName);
- }
-
- protected void addPackage(AssembledDirectory dir, Class<?> reference) throws Exception
- {
- getDelegate().addPackage(dir, reference);
- }
-
- protected void addPath(final AssembledDirectory dir, String path, String name) throws Exception
- {
- getDelegate().addPath(dir, path, name);
- }
-
- protected void assertClassEquality(Class<?> expected, Class<?> actual)
- {
- assertTrue("Should be the same " + ClassLoaderUtils.classToString(expected) + " and " + ClassLoaderUtils.classToString(actual), expected == actual);
- }
-
- protected void assertNoClassEquality(Class<?> expected, Class<?> actual)
- {
- assertTrue("Should NOT be the same " + ClassLoaderUtils.classToString(expected) + " and " + ClassLoaderUtils.classToString(actual), expected != actual);
- }
-
- protected void assertClassLoader(Class<?> clazz, Bundle expected)
- {
- if (expected == null)
- return;
- ClassLoader cl = clazz.getClassLoader();
- ClassLoader bundleClassLoader = getBundleClassLoader(expected);
- boolean result = bundleClassLoader.equals(cl);
- assertTrue(ClassLoaderUtils.classToString(clazz) + " should have expected classloader=" + expected, result);
- }
-
- protected ClassLoader getBundleClassLoader(Bundle expected)
- {
- return getDeploymentUnit(expected).getClassLoader();
- }
-
- protected Class<?> assertLoadClass(Bundle start, Class<?> reference) throws Exception
- {
- return assertLoadClass(start, reference, start);
- }
-
- protected Class<?> assertLoadClass(Bundle start, Class<?> reference, Bundle expected) throws Exception
- {
- return assertLoadClass(start, reference, expected, false);
- }
-
- protected Class<?> assertLoadClass(Bundle start, Class<?> reference, Bundle expected, boolean isReference) throws Exception
- {
- Class<?> result = assertLoadClass(reference.getName(), start, expected);
- if (isReference)
- assertClassEquality(reference, result);
- else
- assertNoClassEquality(reference, result);
- return result;
- }
-
- protected Class<?> assertLoadClass(String name, Bundle bundle, Bundle expected)
- {
- Class<?> result = null;
- try
- {
- result = bundle.loadClass(name);
- getLog().debug("Got class: " + ClassLoaderUtils.classToString(result) + " for " + name + " from " + bundle);
- }
- catch (ClassNotFoundException e)
- {
- failure("Did not expect CNFE for " + name + " from " + bundle, e);
- }
- assertClassLoader(result, expected);
- return result;
- }
-
- protected void assertLoadClassFail(Bundle start, Class<?> reference)
- {
- assertLoadClassFail(start, reference.getName());
- }
-
- protected void assertLoadClassFail(Bundle start, String name)
- {
- try
- {
- start.loadClass(name);
- fail("Should not be here!");
- }
- catch (Exception expected)
- {
- checkThrowable(ClassNotFoundException.class, expected);
- }
- }
-
- protected URL getBundleResource(Bundle bundle, String path)
- {
- return getDelegate().getBundleResource(bundle, path);
- }
-
- protected Enumeration<URL> getBundleResources(Bundle bundle, String path) throws Exception
- {
- return getDelegate().getBundleResources(bundle, path);
- }
-
- protected void assertNoAllReferences(BundleContext bundleContext, String clazz) throws Exception
- {
- assertNoAllReferences(bundleContext, clazz, null);
- }
-
- protected void assertNoAllReferences(BundleContext bundleContext, String clazz, String filter) throws Exception
- {
- ServiceReference[] actual = bundleContext.getAllServiceReferences(clazz, filter);
- if (actual != null)
- getLog().debug(bundleContext + " got " + Arrays.asList(actual) + " for clazz=" + clazz + " filter=" + filter);
- else
- getLog().debug(bundleContext + " got nothing for clazz=" + clazz + " filter=" + filter);
- assertNull("Expected no references for clazz=" + clazz + " filter=" + filter, actual);
- }
-
- protected void assertAllReferences(BundleContext bundleContext, String clazz, ServiceReference... expected) throws Exception
- {
- assertAllReferences(bundleContext, clazz, null, expected);
- }
-
- protected void assertAllReferences(BundleContext bundleContext, String clazz, String filter, ServiceReference... expected) throws Exception
- {
- ServiceReference[] actual = bundleContext.getAllServiceReferences(clazz, filter);
- if (actual != null)
- getLog().debug(bundleContext + " got " + Arrays.asList(actual) + " for clazz=" + clazz + " filter=" + filter);
- else
- getLog().debug(bundleContext + " got nothing for clazz=" + clazz + " filter=" + filter);
- assertEquals(bundleContext + " with clazz=" + clazz + " filter=" + filter, expected, actual);
- }
-
- protected void assertNoReferences(BundleContext bundleContext, String clazz) throws Exception
- {
- assertNoReferences(bundleContext, clazz, null);
- }
-
- protected void assertNoReferences(BundleContext bundleContext, String clazz, String filter) throws Exception
- {
- ServiceReference[] actual = bundleContext.getServiceReferences(clazz, filter);
- if (actual != null)
- getLog().debug(bundleContext + " got " + Arrays.asList(actual) + " for clazz=" + clazz + " filter=" + filter);
- else
- getLog().debug(bundleContext + " got nothing for clazz=" + clazz + " filter=" + filter);
- assertNull("Expected no references for clazz=" + clazz + " filter=" + filter, actual);
- }
-
- protected void assertReferences(BundleContext bundleContext, String clazz, ServiceReference... expected) throws Exception
- {
- assertReferences(bundleContext, clazz, null, expected);
- }
-
- protected void assertReferences(BundleContext bundleContext, String clazz, String filter, ServiceReference... expected) throws Exception
- {
- ServiceReference[] actual = bundleContext.getServiceReferences(clazz, filter);
- if (actual != null)
- getLog().debug(bundleContext + " got " + Arrays.asList(actual) + " for clazz=" + clazz + " filter=" + filter);
- else
- getLog().debug(bundleContext + " got nothing for clazz=" + clazz + " filter=" + filter);
- assertEquals(bundleContext + " with clazz=" + clazz + " filter=" + filter, expected, actual);
- }
-
- protected void assertNoGetReference(BundleContext bundleContext, String clazz) throws Exception
- {
- ServiceReference actual = bundleContext.getServiceReference(clazz);
- if (actual != null)
- getLog().debug(bundleContext + " got " + actual + " for clazz=" + clazz);
- else
- getLog().debug(bundleContext + " got nothing for clazz=" + clazz);
- assertNull("Expected no references for clazz=" + clazz, actual);
- }
-
- protected void assertGetReference(BundleContext bundleContext, String clazz, ServiceReference expected) throws Exception
- {
- ServiceReference actual = bundleContext.getServiceReference(clazz);
- if (actual != null)
- getLog().debug(bundleContext + " got " + Arrays.asList(actual) + " for clazz=" + clazz);
- else
- getLog().debug(bundleContext + " got nothing for clazz=" + clazz);
- assertEquals(bundleContext + " with clazz=" + clazz, expected, actual);
- }
-
- protected void assertUsingBundles(ServiceReference reference, Bundle... bundles)
- {
- Set<Bundle> expected = new HashSet<Bundle>();
- for (Bundle bundle : bundles)
- expected.add(bundle);
-
- Set<Bundle> actual = new HashSet<Bundle>();
- Bundle[] users = reference.getUsingBundles();
- if (users != null)
- for (Bundle bundle : users)
- actual.add(bundle);
-
- getLog().debug(reference + " users=" + actual);
-
- assertEquals(expected, actual);
- }
-
- protected void assertObjectClass(String expected, ServiceReference reference)
- {
- assertObjectClass(new String[] { expected }, reference);
- }
-
- protected void assertObjectClass(String[] expected, ServiceReference reference)
- {
- Object actual = reference.getProperty(Constants.OBJECTCLASS);
- if (actual == null)
- fail("no object class???");
- if (actual instanceof String[] == false)
- fail(actual + " is not a string array??? " + actual.getClass().getName());
- assertEquals(expected, (String[])actual);
- }
-
- public void frameworkEvent(FrameworkEvent event)
- {
- synchronized (frameworkEvents)
- {
- getLog().debug("FrameworkEvent type=" + ConstantsHelper.frameworkEvent(event.getType()) + " for " + event);
- frameworkEvents.add(event);
- frameworkEvents.notifyAll();
- }
- }
-
- protected void assertNoFrameworkEvent() throws Exception
- {
- getLog().debug("frameworkEvents=" + frameworkEvents);
- assertEquals(0, frameworkEvents.size());
- }
-
- protected void assertFrameworkEvent(int type) throws Exception
- {
- assertFrameworkEvent(type, getSystemBundle(), null);
- }
-
- protected void assertFrameworkEvent(int type, Class<? extends Throwable> expectedThrowable) throws Exception
- {
- assertFrameworkEvent(type, getSystemBundle(), expectedThrowable);
- }
-
- protected void assertFrameworkEvent(int type, Bundle bundle, Class<? extends Throwable> expectedThrowable) throws Exception
- {
- waitForEvent(frameworkEvents, type);
- getLog().debug("frameworkEvents=" + frameworkEvents);
- int size = frameworkEvents.size();
- assertTrue("" + size, size > 0);
- FrameworkEvent event = frameworkEvents.remove(0);
- assertEquals(ConstantsHelper.frameworkEvent(type), ConstantsHelper.frameworkEvent(event.getType()));
- Throwable t = event.getThrowable();
- if (expectedThrowable == null)
- {
- if (t != null)
- {
- getLog().error("Unexpected error in Framework event: ", t);
- fail("Unexpected throwable: " + t);
- }
- }
- else
- {
- checkThrowable(BundleException.class, t);
- checkDeepThrowable(expectedThrowable, t);
- }
- assertEquals(bundle, event.getSource());
- assertEquals(bundle, event.getBundle());
- }
-
- public void bundleChanged(BundleEvent event)
- {
- synchronized (bundleEvents)
- {
- getLog().debug("BundleChanged type=" + ConstantsHelper.bundleEvent(event.getType()) + " for " + event);
- bundleEvents.add(event);
- bundleEvents.notifyAll();
- }
- }
-
- protected void assertNoBundleEvent() throws Exception
- {
- getLog().debug("bundleEvents=" + bundleEvents);
- assertEquals(0, bundleEvents.size());
- }
-
- protected void assertBundleEvent(int type, Bundle bundle) throws Exception
- {
- waitForEvent(bundleEvents, type);
-
- getLog().debug("bundleEvents=" + bundleEvents);
- int size = bundleEvents.size();
- assertTrue("" + size, size > 0);
-
- if (bundle instanceof AbstractBundleState)
- bundle = ((AbstractBundleState)bundle).getBundle();
-
- BundleEvent foundEvent = null;
- for(int i=0; i < bundleEvents.size(); i++)
- {
- BundleEvent aux = bundleEvents.get(i);
- if (type == aux.getType())
- {
- if (bundle.equals(aux.getSource()) && bundle.equals(aux.getBundle()))
- {
- bundleEvents.remove(aux);
- foundEvent = aux;
- break;
- }
- }
- }
-
- if (foundEvent == null)
- fail("Cannot find event " + ConstantsHelper.bundleEvent(type) + " from " + bundle);
- }
-
- public void serviceChanged(ServiceEvent event)
- {
- synchronized (serviceEvents)
- {
- getLog().debug("ServiceChanged type=" + ConstantsHelper.serviceEvent(event.getType()) + " for " + event);
- serviceEvents.add(event);
- serviceEvents.notifyAll();
- }
- }
-
- protected void assertNoServiceEvent() throws Exception
- {
- getLog().debug("serviceEvents=" + serviceEvents);
- assertEquals(0, serviceEvents.size());
- }
-
- protected void assertServiceEvent(int type, ServiceReference reference) throws Exception
- {
- waitForEvent(serviceEvents, type);
- getLog().debug("serviceEvents=" + serviceEvents);
- int size = serviceEvents.size();
- assertTrue("" + size, size > 0);
- ServiceEvent event = serviceEvents.remove(0);
- assertEquals(ConstantsHelper.serviceEvent(type), ConstantsHelper.serviceEvent(event.getType()));
- assertEquals(reference, event.getSource());
- assertEquals(reference, event.getServiceReference());
- }
-
- @SuppressWarnings("unchecked")
- private void waitForEvent(List events, int type) throws InterruptedException
- {
- // Timeout for event delivery: 3 sec
- int timeout = 30;
-
- boolean eventFound = false;
- while (eventFound == false && 0 < timeout)
- {
- synchronized (events)
- {
- events.wait(100);
- for (Object aux : events)
- {
- if (aux instanceof BundleEvent)
- {
- BundleEvent event = (BundleEvent)aux;
- if (type == event.getType())
- {
- eventFound = true;
- break;
- }
- }
- else if (aux instanceof ServiceEvent)
- {
- ServiceEvent event = (ServiceEvent)aux;
- if (type == event.getType())
- {
- eventFound = true;
- break;
- }
- }
- else if (aux instanceof FrameworkEvent)
- {
- FrameworkEvent event = (FrameworkEvent)aux;
- if (type == event.getType())
- {
- eventFound = true;
- break;
- }
- }
- }
- }
- timeout--;
- }
- }
-}
Modified: projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/bundle/BundleContextUnitTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/bundle/BundleContextUnitTestCase.java 2009-11-11 22:09:32 UTC (rev 96281)
+++ projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/bundle/BundleContextUnitTestCase.java 2009-11-11 22:30:31 UTC (rev 96282)
@@ -31,7 +31,7 @@
import junit.framework.Test;
-import org.jboss.test.osgi.FrameworkTestCase;
+import org.jboss.test.osgi.FrameworkTest;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleEvent;
@@ -48,7 +48,7 @@
* @author Thomas.Diesler at jboss.com
* @version $Revision: 1.1 $
*/
-public class BundleContextUnitTestCase extends FrameworkTestCase
+public class BundleContextUnitTestCase extends FrameworkTest
{
public static Test suite()
{
Modified: projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/bundle/BundleEntriesUnitTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/bundle/BundleEntriesUnitTestCase.java 2009-11-11 22:09:32 UTC (rev 96281)
+++ projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/bundle/BundleEntriesUnitTestCase.java 2009-11-11 22:30:31 UTC (rev 96282)
@@ -30,7 +30,7 @@
import junit.framework.Test;
-import org.jboss.test.osgi.FrameworkTestCase;
+import org.jboss.test.osgi.FrameworkTest;
import org.osgi.framework.Bundle;
/**
@@ -41,7 +41,7 @@
* @author <a href="adrian at jboss.com">Adrian Brock</a>
* @version $Revision: 1.1 $
*/
-public class BundleEntriesUnitTestCase extends FrameworkTestCase
+public class BundleEntriesUnitTestCase extends FrameworkTest
{
public static Test suite()
{
Modified: projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/bundle/BundleUnitTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/bundle/BundleUnitTestCase.java 2009-11-11 22:09:32 UTC (rev 96281)
+++ projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/bundle/BundleUnitTestCase.java 2009-11-11 22:30:31 UTC (rev 96282)
@@ -27,7 +27,7 @@
import junit.framework.Test;
-import org.jboss.test.osgi.FrameworkTestCase;
+import org.jboss.test.osgi.FrameworkTest;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
@@ -40,7 +40,7 @@
* @author <a href="adrian at jboss.com">Adrian Brock</a>
* @version $Revision: 1.1 $
*/
-public class BundleUnitTestCase extends FrameworkTestCase
+public class BundleUnitTestCase extends FrameworkTest
{
public static Test suite()
{
Copied: projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/bundle/BundleVFSUnitTestCase.java (from rev 96278, projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/bundle/BundleEntriesUnitTestCase.java)
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/bundle/BundleVFSUnitTestCase.java (rev 0)
+++ projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/bundle/BundleVFSUnitTestCase.java 2009-11-11 22:30:31 UTC (rev 96282)
@@ -0,0 +1,233 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.osgi.bundle;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import junit.framework.Test;
+
+import org.jboss.osgi.framework.vfs.BundleVFSContextFactory;
+import org.jboss.test.osgi.FrameworkTest;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VirtualFileFilter;
+import org.jboss.virtual.VirtualFileVisitor;
+import org.jboss.virtual.VisitorAttributes;
+import org.osgi.framework.Bundle;
+
+/**
+ * BundleVFSUnitTestCase.
+ *
+ * TODO test security
+ * TODO test fragments
+ * @author <a href="ales.justin at jboss.org">Ales Justin</a>
+ */
+public class BundleVFSUnitTestCase extends FrameworkTest
+{
+ private BundleVFSContextFactory factory;
+
+ public static Test suite()
+ {
+ return suite(BundleVFSUnitTestCase.class);
+ }
+
+ public BundleVFSUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ factory = new BundleVFSContextFactory(getBundleManager());
+ factory.start();
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ factory.stop();
+ factory = null;
+
+ super.tearDown();
+ }
+
+ public void testBasicOps() throws Exception
+ {
+ Bundle bundle = addBundle("/bundles/entries/", "entries-simple");
+ try
+ {
+ URI uri = createURI(bundle, null);
+ assertBundleByURI(uri, 0, true, "root.xml");
+
+ uri = createURI(bundle, "root.xml");
+ assertBundleByURI(uri, 0, false, null);
+
+ uri = createURI(bundle, "META-INF");
+ assertBundleByURI(uri, -1, true, "MANIFEST.MF");
+
+ uri = createURI(bundle, "META-INF/MANIFEST.MF");
+ assertBundleByURI(uri, 0, false, null);
+ }
+ finally
+ {
+ uninstall(bundle);
+ }
+ }
+
+ public void testBasicNavigation() throws Exception
+ {
+ Bundle bundle = addBundle("/bundles/entries/", "entries-simple");
+ try
+ {
+ URI uri = createURI(bundle, null);
+ VirtualFile root = VFS.getRoot(uri);
+ assertNotNull(root);
+
+ VirtualFile metainf = root.getChild("META-INF");
+ assertBundleByFile(metainf, -1, true, "MANIFEST.MF");
+ List<VirtualFile> children = metainf.getChildren();
+ assertTrue(children != null && children.size() == 1);
+ assertEquals(root, metainf.getParent());
+
+ VirtualFile manifest = metainf.getChild("MANIFEST.MF");
+ assertBundleByFile(manifest, 0, false, null);
+ }
+ finally
+ {
+ uninstall(bundle);
+ }
+ }
+
+ public void testVisitor() throws Exception
+ {
+ Bundle bundle = addBundle("/bundles/entries/", "entries-simple");
+ try
+ {
+ URI uri = createURI(bundle, null);
+ VirtualFile root = VFS.getRoot(uri);
+ assertNotNull(root);
+
+ List<VirtualFile> children = root.getChildren(new VirtualFileFilter()
+ {
+ public boolean accepts(VirtualFile file)
+ {
+ return file.getPathName().contains("META-INF");
+ }
+ });
+ assertTrue(children != null && children.size() == 1);
+
+ children = root.getChildrenRecursively(new VirtualFileFilter()
+ {
+ public boolean accepts(VirtualFile file)
+ {
+ return file.getPathName().contains("META-INF");
+ }
+ });
+ assertTrue(children != null && children.size() == 2);
+
+ final AtomicInteger counter = new AtomicInteger(0);
+ root.visit(new VirtualFileVisitor()
+ {
+ public VisitorAttributes getAttributes()
+ {
+ return VisitorAttributes.RECURSE_LEAVES_ONLY;
+ }
+
+ public void visit(VirtualFile file)
+ {
+ if (file.getName().equals("entry2.xml")) counter.incrementAndGet();
+ }
+ });
+ assertEquals(2, counter.get());
+ }
+ finally
+ {
+ uninstall(bundle);
+ }
+ }
+
+ protected URI createURI(Bundle bundle, String path) throws Exception
+ {
+ if (path == null)
+ path = "";
+ if (path != null && path.startsWith("/") == false)
+ path = "/" + path;
+
+ return new URI("bundle", Long.toString(bundle.getBundleId()), path, null);
+ }
+
+ protected void assertBundleByURI(URI uri, int available, boolean hasChildren, String path) throws Exception
+ {
+ VFS vfs = VFS.getVFS(uri);
+ assertNotNull(vfs);
+ VirtualFile file = vfs.getRoot();
+ assertNotNull(file);
+
+ URI bURI = file.toURI();
+ assertEquals(uri, bURI);
+ URL url = uri.toURL();
+ assertEquals(url, file.toURL());
+
+ assertBundleByFile(file, available, hasChildren, path);
+
+ // check url
+ file = VFS.getRoot(url);
+ assertBundleByFile(file, available, hasChildren, path);
+ }
+
+ protected void assertBundleByFile(VirtualFile file, int available, boolean hasChildren, String path) throws IOException
+ {
+ long lastModified = file.getLastModified();
+ assertTrue(lastModified >= 0);
+
+ InputStream is = file.openStream();
+ try
+ {
+ assertTrue(is.available() > available);
+ }
+ finally
+ {
+ is.close();
+ }
+
+ List<VirtualFile> children = file.getChildren();
+ assertEquals(hasChildren, children != null && children.isEmpty() == false);
+
+ String cp = path;
+ if (cp == null)
+ cp = "rubbish"; // :-)
+
+ VirtualFile child = file.getChild(cp);
+ assertEquals(path != null, child != null);
+
+ if (child != null)
+ assertEquals(file, child.getParent());
+ }
+}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/bundle/SystemBundleUnitTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/bundle/SystemBundleUnitTestCase.java 2009-11-11 22:09:32 UTC (rev 96281)
+++ projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/bundle/SystemBundleUnitTestCase.java 2009-11-11 22:30:31 UTC (rev 96282)
@@ -26,7 +26,7 @@
import junit.framework.Test;
-import org.jboss.test.osgi.FrameworkTestCase;
+import org.jboss.test.osgi.FrameworkTest;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleException;
import org.osgi.framework.Constants;
@@ -38,7 +38,7 @@
* @author <a href="adrian at jboss.com">Adrian Brock</a>
* @version $Revision: 1.1 $
*/
-public class SystemBundleUnitTestCase extends FrameworkTestCase
+public class SystemBundleUnitTestCase extends FrameworkTest
{
public SystemBundleUnitTestCase(String name)
{
Modified: projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/classloader/ExportImportPackageUnitTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/classloader/ExportImportPackageUnitTestCase.java 2009-11-11 22:09:32 UTC (rev 96281)
+++ projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/classloader/ExportImportPackageUnitTestCase.java 2009-11-11 22:30:31 UTC (rev 96282)
@@ -23,7 +23,7 @@
import junit.framework.Test;
-import org.jboss.test.osgi.FrameworkTestCase;
+import org.jboss.test.osgi.FrameworkTest;
import org.jboss.test.osgi.classloader.support.a.A;
import org.jboss.test.osgi.classloader.support.b.B;
import org.osgi.framework.Bundle;
@@ -41,7 +41,7 @@
* @author Thomas.Diesler at jboss.com
* @version $Revision: 1.1 $
*/
-public class ExportImportPackageUnitTestCase extends FrameworkTestCase
+public class ExportImportPackageUnitTestCase extends FrameworkTest
{
public static Test suite()
{
Modified: projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/classloader/RequireBundleUnitTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/classloader/RequireBundleUnitTestCase.java 2009-11-11 22:09:32 UTC (rev 96281)
+++ projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/classloader/RequireBundleUnitTestCase.java 2009-11-11 22:30:31 UTC (rev 96282)
@@ -23,7 +23,7 @@
import junit.framework.Test;
-import org.jboss.test.osgi.FrameworkTestCase;
+import org.jboss.test.osgi.FrameworkTest;
import org.jboss.test.osgi.classloader.support.a.A;
import org.jboss.test.osgi.classloader.support.b.B;
import org.osgi.framework.Bundle;
@@ -36,7 +36,7 @@
* @author <a href="adrian at jboss.com">Adrian Brock</a>
* @version $Revision: 1.1 $
*/
-public class RequireBundleUnitTestCase extends FrameworkTestCase
+public class RequireBundleUnitTestCase extends FrameworkTest
{
public RequireBundleUnitTestCase(String name)
{
Modified: projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/service/GetServiceReferencesUnitTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/service/GetServiceReferencesUnitTestCase.java 2009-11-11 22:09:32 UTC (rev 96281)
+++ projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/service/GetServiceReferencesUnitTestCase.java 2009-11-11 22:30:31 UTC (rev 96282)
@@ -26,7 +26,7 @@
import junit.framework.Test;
-import org.jboss.test.osgi.FrameworkTestCase;
+import org.jboss.test.osgi.FrameworkTest;
import org.jboss.test.osgi.service.support.a.A;
import org.jboss.test.osgi.service.support.b.B;
import org.osgi.framework.Bundle;
@@ -43,7 +43,7 @@
* @author <a href="adrian at jboss.com">Adrian Brock</a>
* @version $Revision: 1.1 $
*/
-public class GetServiceReferencesUnitTestCase extends FrameworkTestCase
+public class GetServiceReferencesUnitTestCase extends FrameworkTest
{
public static Test suite()
{
Modified: projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/service/GetUnGetServiceUnitTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/service/GetUnGetServiceUnitTestCase.java 2009-11-11 22:09:32 UTC (rev 96281)
+++ projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/service/GetUnGetServiceUnitTestCase.java 2009-11-11 22:30:31 UTC (rev 96282)
@@ -23,7 +23,7 @@
import junit.framework.Test;
-import org.jboss.test.osgi.FrameworkTestCase;
+import org.jboss.test.osgi.FrameworkTest;
import org.jboss.test.osgi.service.support.BrokenServiceFactory;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
@@ -37,7 +37,7 @@
* @author <a href="adrian at jboss.com">Adrian Brock</a>
* @version $Revision: 1.1 $
*/
-public class GetUnGetServiceUnitTestCase extends FrameworkTestCase
+public class GetUnGetServiceUnitTestCase extends FrameworkTest
{
static String OBJCLASS = BundleContext.class.getName();
Modified: projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/service/RegisterServiceUnitTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/service/RegisterServiceUnitTestCase.java 2009-11-11 22:09:32 UTC (rev 96281)
+++ projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/service/RegisterServiceUnitTestCase.java 2009-11-11 22:30:31 UTC (rev 96282)
@@ -26,7 +26,7 @@
import junit.framework.Test;
-import org.jboss.test.osgi.FrameworkTestCase;
+import org.jboss.test.osgi.FrameworkTest;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
@@ -40,7 +40,7 @@
* @author <a href="adrian at jboss.com">Adrian Brock</a>
* @version $Revision: 1.1 $
*/
-public class RegisterServiceUnitTestCase extends FrameworkTestCase
+public class RegisterServiceUnitTestCase extends FrameworkTest
{
static String OBJCLASS = BundleContext.class.getName();
static String[] OBJCLASSES = new String[] { OBJCLASS };
Modified: projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/service/ServiceFactoryUnitTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/service/ServiceFactoryUnitTestCase.java 2009-11-11 22:09:32 UTC (rev 96281)
+++ projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/service/ServiceFactoryUnitTestCase.java 2009-11-11 22:30:31 UTC (rev 96282)
@@ -24,7 +24,7 @@
import junit.framework.Test;
import org.jboss.osgi.framework.bundle.OSGiBundleWrapper;
-import org.jboss.test.osgi.FrameworkTestCase;
+import org.jboss.test.osgi.FrameworkTest;
import org.jboss.test.osgi.service.support.SimpleServiceFactory;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
@@ -39,7 +39,7 @@
* @author Thomas.Diesler at jboss.com
* @version $Revision$
*/
-public class ServiceFactoryUnitTestCase extends FrameworkTestCase
+public class ServiceFactoryUnitTestCase extends FrameworkTest
{
static String OBJCLASS = BundleContext.class.getName();
static String[] OBJCLASSES = new String[] { OBJCLASS };
Modified: projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/service/ServiceReferenceUnitTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/service/ServiceReferenceUnitTestCase.java 2009-11-11 22:09:32 UTC (rev 96281)
+++ projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/service/ServiceReferenceUnitTestCase.java 2009-11-11 22:30:31 UTC (rev 96282)
@@ -30,7 +30,7 @@
import junit.framework.Test;
-import org.jboss.test.osgi.FrameworkTestCase;
+import org.jboss.test.osgi.FrameworkTest;
import org.jboss.test.osgi.service.support.a.A;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
@@ -45,7 +45,7 @@
* @author <a href="adrian at jboss.com">Adrian Brock</a>
* @version $Revision: 1.1 $
*/
-public class ServiceReferenceUnitTestCase extends FrameworkTestCase
+public class ServiceReferenceUnitTestCase extends FrameworkTest
{
public ServiceReferenceUnitTestCase(String name)
{
Modified: projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/service/ServiceRegistrationUnitTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/service/ServiceRegistrationUnitTestCase.java 2009-11-11 22:09:32 UTC (rev 96281)
+++ projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/service/ServiceRegistrationUnitTestCase.java 2009-11-11 22:30:31 UTC (rev 96282)
@@ -25,7 +25,7 @@
import junit.framework.Test;
-import org.jboss.test.osgi.FrameworkTestCase;
+import org.jboss.test.osgi.FrameworkTest;
import org.jboss.test.osgi.service.support.SimpleServiceFactory;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
@@ -40,7 +40,7 @@
* @author <a href="adrian at jboss.com">Adrian Brock</a>
* @version $Revision: 1.1 $
*/
-public class ServiceRegistrationUnitTestCase extends FrameworkTestCase
+public class ServiceRegistrationUnitTestCase extends FrameworkTest
{
public ServiceRegistrationUnitTestCase(String name)
{
Modified: projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/smoke/OSGiSmokeTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/smoke/OSGiSmokeTestCase.java 2009-11-11 22:09:32 UTC (rev 96281)
+++ projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/smoke/OSGiSmokeTestCase.java 2009-11-11 22:30:31 UTC (rev 96282)
@@ -30,7 +30,7 @@
import org.jboss.osgi.framework.metadata.OSGiMetaData;
import org.jboss.osgi.framework.metadata.internal.AbstractOSGiMetaData;
-import org.jboss.test.osgi.FrameworkTestCase;
+import org.jboss.test.osgi.FrameworkTest;
import org.jboss.test.osgi.smoke.support.a.A;
import org.jboss.test.osgi.smoke.support.a.b.B;
import org.jboss.test.osgi.smoke.support.c.C;
@@ -42,7 +42,7 @@
* @author <a href="adrian at jboss.com">Adrian Brock</a>
* @version $Revision: 1.1 $
*/
-public class OSGiSmokeTestCase extends FrameworkTestCase
+public class OSGiSmokeTestCase extends FrameworkTest
{
public static Test suite()
{
More information about the jboss-cvs-commits
mailing list