05-20-2025 09:33 PM - edited 05-23-2025 05:56 AM
hello, i need to test operations and listeners using vocabularies, they are present in my studio package but, from what i understand are not included when the package is deployed locally upon testing
%ERROR 1,should_Pass(my.package.operations.SomeOperationTest)
%TRACES
org.nuxeo.ecm.directory.DirectoryException: Failed to invoke operation SomeOperation, No directory registered with name: Some_Directory
main
|- java
| |- my.package.operations
| | |- SomeOperation.java
test
|- java
| |- my.package.operations
| | |- SomeOperationTest.java
|- resources
| |- directories
| | |- Some_Directory.csv
| |- OSGI-INF
| | |- test-directories-contrib.xml
@RunWith(FeaturesRunner.class)
@Features(AutomationFeature.class)
@RepositoryConfig(cleanup = Granularity.METHOD)
@Deploy({
"studio.extensions.my-studio",
"my-bundle-symbolic-name",
"my-bundle-symbolic-name:OSGI-INF/test-directories-contrib.xml"})
public class SomeOperationTest {
@Inject
OperationContext context;
@Inject
AutomationService automation;
public void should_Pass() throws OperationException {
automation.run(context, "SomeOperation"); // raises exception
// ... some assertion
}
}
@Operation(
id = "SomeOperation",
category = "Some",
label = "Operation",
description = "Openning a directory")
public class SomeOperation {
@OperationMethod()
public void run() {
Framework.getService(DirectoryService.class).open("Some_Directory"); // raises exception
// ... some more code
}
}
<?xml version="1.0"?>
<component name="my.package.test.directories">
<extension target="org.nuxeo.ecm.directory.GenericDirectory" point="directories">
<directory name="Some_Directory" extends="template-directory">
<schema>vocabulary</schema>
<idField>id</idField>
<autoincrementIdField>false</autoincrementIdField>
<dataFile>directories/Some_Directory.csv</dataFile>
<createTablePolicy>on_missing_columns</createTablePolicy>
</directory>
</extension>
</component>
id,label,obsolete
"some","entry","0"
what am i missing, i have been running in circle for quite some time now i can't seem to find a solution anywhere
05-27-2025 08:11 AM
As you can see, your studio contribution is not loaded due to missing references, which should explain why your vocabulary is not defined during the context of your unit test:
* service:studio.extensions.autodistribution references missing [target=org.nuxeo.elasticsearch.ElasticSearchComponent;point=elasticSearchIndex, target=org.nuxeo.ecm.platform.ui.web.auth.service.PluggableAuthenticationService;point=loginScreen, target=org.nuxeo.ecm.platform.WebResources;point=resources, target=org.nuxeo.ecm.platform.WebResources;point=bundles, target=org.nuxeo.ecm.platform.types.TypeService;point=types, target=org.nuxeo.ecm.platform.ec.notification.service.NotificationService;point=templates]
For each missing reference, you need to find which bundle brings it, and you should deploy it within your unit test.
For example with point=elasticSearchIndex, we can see the extension point is defined there: https://github.com/nuxeo/nuxeo/blob/1b35dcdbce963594a6d891e7ccdf0c9279ad4fce/modules/platform/nuxeo-...
Which is part of bundle "org.nuxeo.elasticsearch.core" (see here https://github.com/nuxeo/nuxeo/blob/1b35dcdbce963594a6d891e7ccdf0c9279ad4fce/modules/platform/nuxeo-...
So either you deploy "org.nuxeo.elasticsearch.core", or you can directly use feature "RepositoryElasticSearchFeature" already loading that bundle: https://github.com/nuxeo/nuxeo/blob/1b35dcdbce963594a6d891e7ccdf0c9279ad4fce/modules/platform/nuxeo-...
Repeat that logic for each missing references until your service:studio.extensions.autodistribution is loaded when you execute your test! 🙂
05-26-2025 02:50 AM
Can you try to add the DirectoryFeature in your test class?
Instead of:
@Features(AutomationFeature.class)
Try:
import org.nuxeo.directory.test.DirectoryFeature;
...
@Features({ AutomationFeature.class, DirectoryFeature.class })
And when running the tests, have a look in the console for the "Component loading" part, if for some reason something cannot be loaded, it will show up there (and tell you what dependencies is missing)
05-26-2025 11:00 AM
i unfortunately get the same error.
05-26-2025 11:07 AM
Do you have any components unable to be loaded during the test? In the console, have a look for the "Component Loading Status" part, you should have something like below that could maybe explain why your vocabulary is not loaded:
======================================================================
= Component Loading Status: Pending: 0 / Missing: 3 / Unstarted: 1 / Total: 206
* service:org.nuxeo.elasticsearch.managment.contrib references missing [target=org.nuxeo.ecm.core.management.CoreManagementComponent;point=probes, target=org.nuxeo.ecm.core.management.CoreManagementComponent;point=healthCheck]
* service:org.nuxeo.ecm.core.automation.features.bindings references missing [target=org.nuxeo.ecm.automation.server.AutomationServer;point=bindings]
* service:org.nuxeo.runtime.stream.service.managment.contrib references missing [target=org.nuxeo.ecm.core.management.CoreManagementComponent;point=probes, target=org.nuxeo.ecm.core.management.CoreManagementComponent;point=healthCheck]
- service:org.nuxeo.ecm.platform.ec.notification.service.NotificationService
======================================================================
05-27-2025 06:38 AM - edited 05-27-2025 10:58 AM
i do
======================================================================
= Component Loading Status: Pending: 6 / Missing: 3 / Unstarted: 0 / Total: 197
* service:org.nuxeo.core.elasticsearch.custom requires [service:org.nuxeo.elasticsearch.ElasticSearchComponent.contrib]
* service:org.nuxeo.ecm.platform.suggestbox.core.defaultSuggesters.override requires [service:org.nuxeo.ecm.platform.suggestbox.core.defaultSuggesters]
* service:my.package.services.AuthService requires [service:org.nuxeo.ecm.jwt.auth, service:org.nuxeo.ecm.restapi.server.auth.config]
* service:org.nuxeo.ecm.platform.thumbnail.listener.disable requires [service:org.nuxeo.ecm.platform.thumbnail.listener]
* service:my.package.core.marshaller requires [service:org.nuxeo.ecm.platform.types.marshallers]
* service:org.nuxeo.ecm.document.pageproviders.override requires [service:org.nuxeo.ecm.document.pageproviders]
* service:studio.extensions.autodistribution references missing [target=org.nuxeo.elasticsearch.ElasticSearchComponent;point=elasticSearchIndex, target=org.nuxeo.ecm.platform.ui.web.auth.service.PluggableAuthenticationService;point=loginScreen, target=org.nuxeo.ecm.platform.WebResources;point=resources, target=org.nuxeo.ecm.platform.WebResources;point=bundles, target=org.nuxeo.ecm.platform.types.TypeService;point=types, target=org.nuxeo.ecm.platform.ec.notification.service.NotificationService;point=templates]
* service:org.nuxeo.ecm.core.automation.features.bindings references missing [target=org.nuxeo.ecm.automation.server.AutomationServer;point=bindings]
* service:org.nuxeo.runtime.stream.service.managment.contrib references missing [target=org.nuxeo.ecm.core.management.CoreManagementComponent;point=probes, target=org.nuxeo.ecm.core.management.CoreManagementComponent;point=healthCheck]
======================================================================
is there something i can do to load them, i tried @Deploy but end up with deployment errors
05-27-2025 08:11 AM
As you can see, your studio contribution is not loaded due to missing references, which should explain why your vocabulary is not defined during the context of your unit test:
* service:studio.extensions.autodistribution references missing [target=org.nuxeo.elasticsearch.ElasticSearchComponent;point=elasticSearchIndex, target=org.nuxeo.ecm.platform.ui.web.auth.service.PluggableAuthenticationService;point=loginScreen, target=org.nuxeo.ecm.platform.WebResources;point=resources, target=org.nuxeo.ecm.platform.WebResources;point=bundles, target=org.nuxeo.ecm.platform.types.TypeService;point=types, target=org.nuxeo.ecm.platform.ec.notification.service.NotificationService;point=templates]
For each missing reference, you need to find which bundle brings it, and you should deploy it within your unit test.
For example with point=elasticSearchIndex, we can see the extension point is defined there: https://github.com/nuxeo/nuxeo/blob/1b35dcdbce963594a6d891e7ccdf0c9279ad4fce/modules/platform/nuxeo-...
Which is part of bundle "org.nuxeo.elasticsearch.core" (see here https://github.com/nuxeo/nuxeo/blob/1b35dcdbce963594a6d891e7ccdf0c9279ad4fce/modules/platform/nuxeo-...
So either you deploy "org.nuxeo.elasticsearch.core", or you can directly use feature "RepositoryElasticSearchFeature" already loading that bundle: https://github.com/nuxeo/nuxeo/blob/1b35dcdbce963594a6d891e7ccdf0c9279ad4fce/modules/platform/nuxeo-...
Repeat that logic for each missing references until your service:studio.extensions.autodistribution is loaded when you execute your test! 🙂
a week ago
@Jordann_Rousse1 i will say that i needed to copy some contributions from Github because test jars where missing
Offline / Missing artifact org.nuxeo.ecm.platform:nuxeo-platform-notification:jar:tests:2023.24.1Java(0)
if you happen to have a solution for this as well, that would be amazing, since what i did work based one what you told me, you are still the GOAT, i no longer require directories contributions for tests so kudos indeed
Monday
Hey can you share your pom.xml so I could try to reproduce please? Maybe you're missing a Maven repository, you should have most JARs there (+ nuxeo-studio repo for your Studio project):
<repository>
<id>maven-public</id>
<url>https://packages.nuxeo.com/repository/maven-public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<updatePolicy>always</updatePolicy>
<enabled>true</enabled>
</snapshots>
</repository>
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.