[JBoss OSGi Dev] - Bundle.start() does not transition to ACTIVE
by thomas.diesler@jboss.com
It seems that bundle.start() does not transition the bundle's state.
| [tdiesler@tdvaio osgi-int]$ mvn -Dtest=SimpleBundleTestCase install
|
| Running org.jboss.test.osgi.simple.SimpleBundleTestCase
| Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 2.793 sec <<< FAILURE!
|
| java.lang.AssertionError: Bundle state expected:<32> but was:<2>
| at org.junit.Assert.fail(Assert.java:92)
| at org.junit.Assert.failNotEquals(Assert.java:689)
| at org.junit.Assert.assertEquals(Assert.java:127)
| at org.junit.Assert.assertEquals(Assert.java:514)
| at org.jboss.test.osgi.simple.SimpleBundleTestCase.testBundleInstall(SimpleBundleTestCase.java:78)
|
I see
| /**
| * Start a bundle
| *
| * @param bundleState the bundle state
| * @throws BundleException the bundle exception
| */
| public void start(OSGiBundleState bundleState) throws BundleException
| {
| try
| {
| // todo check actually changed state
| deployerClient.change(bundleState.getDeploymentUnit().getName(), DeploymentStages.INSTALLED);
| }
| catch (DeploymentException e)
| {
| Throwable t = e.getCause();
| if (t instanceof BundleException)
| throw (BundleException) t;
| throw new BundleException("Error starting " + bundleState, e);
| }
| }
|
Could you please explain how this is supposed to work?
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4250889#4250889
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4250889
16 years, 7 months
[JBoss AOP Dev] - ClassPool Refactoring
by flavia.rainone@jboss.com
As part of my work with the ClassPools (see https://jira.jboss.org/jira/browse/JBREFLECT-3), I refactored the ClassPools at JBoss AOP. One of the purposes is to see if JBoss AOP works with the new classpools as a way of validating the new classpools:
https://jira.jboss.org/jira/browse/JBAOP-742
So, for this refactoring, I took the following steps:
- extracted the code from the class pools that was related to JBoss AOP (so, code that manipulates lists for AspectManager and the like was saved)
- removed the class pools that have been moved to the jboss classpool project (the main difference between the two groups is that, in the jboss classpool project, those classpools have no dependency on JBoss AOP stuff and, hence, they lack the code I extracted above)
- finally, I came up with a way of integrating the extracted code in a new structure.
The last step is the main thing about JBAOP-742. Most of the code was located at AOPClassPool. What I would have liked to have done:
public class AOPClassPool implements ClassPool
| {
| private ClasPool delegate;
|
| // every single method of ClassPool interface will be forwarded to delegate
| public get(String name) { delegate.get(name);}
| // etc
| }
|
The AOPClassPool above would basically forward all ClassPool calls to a delegate. This delegate could be of any ClassPool type of jboss-classpool project, thus making possible for AOP to use any class pool type provided by JBoss ClassPool. When some AOP-related stuf would have to be done as part of one of those calls, this AOPClassPool would perform the job before or after calling the delegate.
However, ClassPool is not an interface. It is a class instead. For that reason, I tried to stick with the idea above but extending a class to make all the superclass contents useless is bad. Another problem I had to face:
| AOPClassPool aopClassPool = ....;
| CtClass clazz = aopClassPool.get("MyClass");
| Sytem.out.println("Clazz's class pool: " + clazz.getClassPool());
|
The last line would show the delegate classpool, and not the original aopClassPool. However, I dunno that this would be important for anything other than the tests. Temporarily, I added an equals to AOPClassPool, so it can consider itself equal to its delegate (the relationship is 1 to 1, if there is a delegate, it is not being used elsewhere apart from the AOPClassPool that contains it). However, I'm not sure about this.
I also needed to add two more things to the project:
- JBoss AOP used the ClassPoolRepository to remove advisors when a classloader is unregistered. For that reason I created a callback at jboss-classpool: ClassPoolRepositoryCallback. The class that implements this interface at JBoss AOP is ClassLoaderRepository and basically it contains this code for removing the advisors after a classloader is unregistered.
- the old DomainRegistry at JBoss AOP kept track of ClasLoaderDomains, Modules, and AOP Domains. When this registry was moved to classpool, I had to get rid of the AOP Domains part. For that reason, I created an AOPDomainRegistry at JBoss AOP:
| public interface AOPDomainRegistry extends DomainRegistry
| {
| boolean initMapsForLoader(ClassLoader loader, Module module, ScopedVFSClassLoaderDomain domain, ClassLoader parentUnitLoader);
|
| Domain getRegisteredDomain(ClassLoader cl);
|
| List<ScopedVFSClassLoaderDomain> getAOPDomainsForClassLoaderDomain(ClassLoaderDomain domain);
|
| ReadWriteLock getAOPDomainsLockForClassLoaderDomain(ClassLoaderDomain domain);
| }
|
Kabir, I need you to take a look at the changes I've done so you can give me feedback on what you think :)
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4250868#4250868
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4250868
16 years, 7 months
[Design of OSGi Integration] - Re: OSGI/MC General
by thomas.diesler@jboss.com
Adrian, thanks for this work.
I updated the osgi version to r4v42 and will now try to add an implementation of the Framework launch API
https://www.osgi.org/members/build/r4v42-core-spec-final/osgi.companion/g...
This will then allow me to plugin this OSGi framework implementation with our hudson QA environment and run the existing tests not only against felix & equinox, but also this framework impl.
When this is done I can setup the osgi TCK.
Please note, that Filters now behave differently. When running the test, you should see
| Running org.jboss.test.osgi.filter.test.FrameworkUtilFilterUnitTestCase
| FIXME: verify: Invalid (*=b)
| FIXME: verify: NoMatch (a=)
| FIXME: verify: NoMatch (a<= 2)
| FIXME: verify: NoMatch (a<=2 )
| FIXME: verify: NumberFormatException (a<= )
| FIXME: verify: NoMatch (a>= 0)
| FIXME: verify: NoMatch (a>=0 )
| FIXME: verify: NumberFormatException (a>= )
| Tests run: 11, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.325 sec
| Running org.jboss.test.osgi.filter.test.BundleContextFilterUnitTestCase
| FIXME: verify: Invalid (*=b)
| FIXME: verify: NoMatch (a=)
| FIXME: verify: NoMatch (a<= 2)
| FIXME: verify: NoMatch (a<=2 )
| FIXME: verify: NumberFormatException (a<= )
| FIXME: verify: NoMatch (a>= 0)
| FIXME: verify: NoMatch (a>=0 )
| FIXME: verify: NumberFormatException (a>= )
| Tests run: 11, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.808 sec
|
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4250847#4250847
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4250847
16 years, 7 months