Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add OSGi metadata to asciidoctorj-core jar #328

Merged
merged 2 commits into from
Jun 18, 2015

Conversation

lefou
Copy link
Member

@lefou lefou commented Jun 3, 2015

This just added some OSGi Metadata to the asciidoctorj-core.jar and makes it a OSGi bundle. That way, it can be loaded and used in OSGi environments as-is.

It does not add any special OSGi support, e.g. a BundleActivator or some service registrations. See also #297.

@lordofthejars
Copy link
Member

I have no experience in OSGi so I cannot say anything, but it seems good to me for what I know about OSGi.

"org.asciidoctor.extension;version=\"${version}\"",
"org.asciidoctor.extension.spi;version=\"${version}\""
instruction 'Import-Package',
'com.beust.jcommander;resolution:=optional',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think this line is necessary? Would the CLI ever be used from an OSGi environment. It's not really intended to be an API atm. But perhaps I'm missing a use case.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely. It means that this import isn't required, so that the bundle will resolve even if the package com.beust.jcommander isn't available. All other packages are required though.

The gradle osgi plugin uses the bnd tool (https://github.com/bndtools/bnd) which processes these lines to produce the actual JAR and the final MANIFEST.MF.

You can also see that org.asciidoctor.cli is not part of the exported packages. It is still in the JAR but not exported, thus in an OSGi environment, other bundles can not use/see it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the clarification! Now I get it.

@mojavelinux
Copy link
Member

👍

@lefou
Copy link
Member Author

lefou commented Jun 17, 2015

Are there any more objections or questions?

@mojavelinux
Copy link
Member

Not from me. My vote is to merge. @robertpanzer or @lordofthejars?

robertpanzer added a commit that referenced this pull request Jun 18, 2015
Add OSGi metadata to asciidoctorj-core jar
@robertpanzer robertpanzer merged commit 775fc1d into asciidoctor:master Jun 18, 2015
@robertpanzer
Copy link
Member

I wonder if we want to add integration tests in an osgi environment, i.e. Arquillian-osgi?

@lefou
Copy link
Member Author

lefou commented Jun 18, 2015

Unfortunately, I'm not familiar with Arquillian-osgi. Also, there is not much to test, currently; only that the bundle resolves properly after all required dependencies are resolved.

@robertpanzer
Copy link
Member

Unfortunately, I'm not familiar with Arquillian-osgi.

No problem, I can have a try once I find some time. I haven't done much yet wrt osgi;-) except for some eclipse plugin development.

Also, there is not much to test, currently

I was just thinking about some smoke test so that we would be warned before releasing when sth changed.

Best regards
Robert

Am 18.06.2015 um 07:54 schrieb Tobias Roeser [email protected]:

Unfortunately, I'm not familiar with Arquillian-osgi. Also, there is not much to test, currently; only that the bundle resolves properly after all required dependencies are resolved.


Reply to this email directly or view it on GitHub.

@lefou
Copy link
Member Author

lefou commented Jun 18, 2015

Yeah, you are right. We should test if using the Asciidoctor API in OSGi actually works. So, we need to write and test a consumer bundle. Later, when we introduce a proper µService via the OSGi registry, we would need to refactor that test though.

If somebody comes up with a skeleton for the test, I can help to fill in the gaps.

@robertpanzer
Copy link
Member

Cherry-picked in asciidoctorj-1.6.0 87ff773
Started playing with an Arquillian test but on first try current arquillian-osgi container seems to be incompatible with arquillian-core 1.1.8.Final.

@robertpanzer
Copy link
Member

Just to keep the info somewhere:
I am seeing this error when trying to start an arquillian-container-felix-embedded:

Caused by: javax.management.ReflectionException: Signature mismatch for operation runTestMethod: (java.lang.String, java.lang.String, java.util.Map) should be (java.lang.String, java.lang.String)
    at com.sun.jmx.mbeanserver.PerInterface.noSuchMethod(PerInterface.java:170)
    at com.sun.jmx.mbeanserver.PerInterface.invoke(PerInterface.java:135)
    at com.sun.jmx.mbeanserver.MBeanSupport.invoke(MBeanSupport.java:252)
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
    at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
    at javax.management.MBeanServerInvocationHandler.invoke(MBeanServerInvocationHandler.java:292)
    ... 97 more
Caused by: java.lang.NoSuchMethodException: runTestMethod(java.lang.String, java.lang.String, java.util.Map)
    at com.sun.jmx.mbeanserver.PerInterface.noSuchMethod(PerInterface.java:169)
    ... 102 more

The arquillian-jmx-protocol invokes runTestMethod(String, String, Map) via JMX.
The target of this call is part of the arquillian-osgi-bundle to be retrieved from Maven central separately.
This contains the arquillian libs in version 1.1.2.Final. (Strange that it has an own versioning that aligns with the OSGI adapter instead of aligning with arquillian-core)
And this method does not exist in 1.1.2.Final. There the method had only 2 params.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants