Skip to content

OAK-10367: update org.apache.sling.testing.osgi-mock dependency#1044

Merged
reschke merged 3 commits intoapache:trunkfrom
mbaedke:issues/oak-10367
Aug 9, 2023
Merged

OAK-10367: update org.apache.sling.testing.osgi-mock dependency#1044
reschke merged 3 commits intoapache:trunkfrom
mbaedke:issues/oak-10367

Conversation

@mbaedke
Copy link
Contributor

@mbaedke mbaedke commented Aug 1, 2023

No description provided.

@mbaedke mbaedke requested review from kwin and reschke August 1, 2023 10:40
<artifactId>org.osgi.service.component</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
Copy link
Member

Choose a reason for hiding this comment

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

which code changes requires this new compile classpath change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No code changes, these were listed as used undeclared dependencies by the dependency plugin.

<artifactId>org.apache.sling.testing.osgi-mock.junit4</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Copy link
Member

Choose a reason for hiding this comment

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

junit4 depends on core, therefore you only reference the former in the dependency usually in this case (https://sling.apache.org/documentation/development/osgi-mock.html#maven-dependency)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Again a used undeclared dependency, which I usually declare explicitly as generally recommended. In this particular case, it's admittedly unnecessary.

<artifactId>org.apache.sling.testing.osgi-mock.core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Copy link
Member

Choose a reason for hiding this comment

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

Why all the additional dependencies? Isn't the transitive dependencies from osgi-mock enough?
It is unusual to reference OSGi Spec chapter dependencies only in test classpath. In tests those are only used usually if the to-be tested code relies on those spec chapters as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The integration tests will fail without them.

Copy link
Member

@kwin kwin Aug 1, 2023

Choose a reason for hiding this comment

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

but all those are transitive ones of https://github.com/apache/sling-org-apache-sling-testing-osgi-mock/blob/45fb63cb61615663e10ed3c9e612a3a3f6161c3e/core/pom.xml#L42 and the ITs don't leverage those APIs/spec chapter directly (only the Sling Testing Mock uses them).

Copy link
Contributor Author

@mbaedke mbaedke Aug 2, 2023

Choose a reason for hiding this comment

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

Yeah. But the tests will fail anyway. Do you have a suggestion?
Maven dependency analysis does not see reflective use.

@kwin
Copy link
Member

kwin commented Aug 1, 2023

I am not convinced, that we should make all those dependencies direct ones. Please only make those direct dependencies which are really used in Oak code and also please do that dependency cleanup in a separate commit to ease to distinguish it from the actual update of the testing dependency.

@mbaedke
Copy link
Contributor Author

mbaedke commented Aug 2, 2023

I am not convinced, that we should make all those dependencies direct ones. Please only make those direct dependencies which are really used in Oak code

If the dependency plugin lists them as used and undeclared, they are (in most cases) used in the project code, no?
In particular, org.osgi.service.component.annotations is used in oak-auth-external.
I don't have strong feelings about this, I just wonder.

and also please do that dependency cleanup in a separate commit to ease to distinguish it from the actual update of the testing dependency.

Agreed.

properties.put(SegmentNodeStoreService.REPOSITORY_HOME_DIRECTORY, repoHome);
service = context.registerInjectActivateService(new SegmentNodeStoreService(), properties);
SegmentNodeStoreService service = new SegmentNodeStoreService();

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kwin Would you take a look at the following lines? I wonder if MockBundleContext introduced a bug in the new version or if I'm missing something.

Reverted changes that are not related to o.a.sling.testing.osgi-mock.
Removed redundant explicit declaration of transitive dependencies of o.a.sling.testing.osgi-mock.junit4.
@reschke
Copy link
Contributor

reschke commented Aug 2, 2023

I'm getting test failures:

[ERROR] Tests run: 6, Failures: 0, Errors: 6, Skipped: 0, Time elapsed: 0.51 s <<< FAILURE! - in org.apache.jackrabbit.oak.segment.azure.Azu
reSegmentStoreServiceTest
[ERROR] deactivate(org.apache.jackrabbit.oak.segment.azure.AzureSegmentStoreServiceTest)  Time elapsed: 0.009 s  <<< ERROR!
java.lang.NoClassDefFoundError: org/osgi/service/event/EventAdmin
        at java.base/java.lang.ClassLoader.defineClass1(Native Method)
        at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
        at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
        at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:800)
        at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:698)
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:621)
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:579)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
        at org.apache.sling.testing.mock.osgi.context.OsgiContextImpl.registerDefaultServices(OsgiContextImpl.java:68)
        at org.apache.sling.testing.mock.osgi.context.OsgiContextImpl.setUp(OsgiContextImpl.java:49)
        at org.apache.sling.testing.mock.osgi.junit.OsgiContext.access$100(OsgiContext.java:35)
        at org.apache.sling.testing.mock.osgi.junit.OsgiContext$1.before(OsgiContext.java:79)
        at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:50)
        at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
        at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
        at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
        at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
        at com.arakelian.docker.junit.DockerRule$StatementWithDockerRule.evaluate(DockerRule.java:76)
        at org.apache.jackrabbit.oak.blob.cloud.azure.blobstorage.AzuriteDockerRule$1.evaluate(AzuriteDockerRule.java:112)
        at org.junit.rules.RunRules.evaluate(RunRules.java:20)

Copy link
Contributor

@reschke reschke left a comment

Choose a reason for hiding this comment

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

see #1044

@mbaedke
Copy link
Contributor Author

mbaedke commented Aug 3, 2023

Yes, my Docker isn't working properly, which leads to test cases silently being skipped (obviously an issue of it's own). I'm working on it.

@mbaedke
Copy link
Contributor Author

mbaedke commented Aug 4, 2023

Integration test now succeed for me.

@mbaedke mbaedke requested a review from reschke August 4, 2023 08:21
@reschke reschke merged commit d6c402c into apache:trunk Aug 9, 2023
mbaedke added a commit that referenced this pull request Sep 19, 2023
* OAK-10367: update org.apache.sling.testing.osgi-mock dependency

* OAK-10367: update org.apache.sling.testing.osgi-mock dependency

Reverted changes that are not related to o.a.sling.testing.osgi-mock.
Removed redundant explicit declaration of transitive dependencies of o.a.sling.testing.osgi-mock.junit4.

* OAK-10367: update org.apache.sling.testing.osgi-mock dependency

Added missing test dependencies.

---------

Co-authored-by: Manfred Baedke <gre55877@adobe.com>
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.

3 participants