fixes wrong import in e4 application manifest

This commit is contained in:
eyck committed 2026-11-21 19:39:36 +01:00
1 parent a43bf18fc9
commit ca4bc6da7f
3 files changed
+38 -2

No files matched your search

@@ -39,7 +39,8 @@ Require-Bundle: jakarta.inject.jakarta.inject-api;bundle-version="2.0.1",
org.eclipse.help.base;bundle-version="4.2.900", org.eclipse.help.base;bundle-version="4.2.900",
com.minres.scviewer.e4.application.help;bundle-version="1.0.0" com.minres.scviewer.e4.application.help;bundle-version="1.0.0"
Bundle-RequiredExecutionEnvironment: JavaSE-21 Bundle-RequiredExecutionEnvironment: JavaSE-21
Import-Package: org.osgi.service.prefs;version="1.1.0", Import-Package: org.osgi.service.event;version="1.4.0",
org.osgi.service.prefs;version="1.1.0",
com.minres.scviewer.database, com.minres.scviewer.database,
jakarta.annotation;version="3.0.0", jakarta.annotation;version="3.0.0",
jakarta.inject;version="2.0.0" jakarta.inject;version="2.0.0"
@@ -4,7 +4,6 @@ Bundle-Name: SCViewer application tests
Bundle-Vendor: MINRES Technologies GmbH Bundle-Vendor: MINRES Technologies GmbH
Bundle-SymbolicName: com.minres.scviewer.e4.application.test Bundle-SymbolicName: com.minres.scviewer.e4.application.test
Bundle-Version: 2.20.0 Bundle-Version: 2.20.0
Import-Package: org.osgi.service.event;version="1.4.0"
Fragment-Host: com.minres.scviewer.e4.application Fragment-Host: com.minres.scviewer.e4.application
Bundle-RequiredExecutionEnvironment: JavaSE-21 Bundle-RequiredExecutionEnvironment: JavaSE-21
Require-Bundle: org.eclipse.e4.ui.bindings, Require-Bundle: org.eclipse.e4.ui.bindings,
@@ -0,0 +1,36 @@
/*******************************************************************************
* Copyright (c) 2026 MINRES Technologies GmbH and others.
*
* SPDX-License-Identifier: EPL-1.0
*
* Contributors:
* MINRES Technologies GmbH - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.e4.application.handlers;
import static org.junit.Assert.*;
import java.util.Arrays;
import org.eclipse.osgi.util.ManifestElement;
import org.junit.Test;
import org.osgi.framework.Constants;
import org.osgi.framework.FrameworkUtil;
import com.minres.scviewer.e4.application.E4LifeCycle;
public class ApplicationDependenciesTest {
@Test
public void lifecycleEventTypesAreDeclaredByTheProductionBundle() throws Exception {
var application = FrameworkUtil.getBundle(E4LifeCycle.class);
var imports = ManifestElement.parseHeader(Constants.IMPORT_PACKAGE,
application.getHeaders().get(Constants.IMPORT_PACKAGE));
// A fragment import also makes these classes visible during tests, but
// the product does not contain the test fragment.
assertTrue("The application must import Event Admin without the test fragment",
Arrays.stream(imports).anyMatch(element -> element.getValue().equals("org.osgi.service.event")));
assertNotNull(application.loadClass("org.osgi.service.event.Event"));
assertNotNull(application.loadClass("org.osgi.service.event.EventHandler"));
assertTrue(E4LifeCycle.class.getDeclaredMethods().length > 0);
}
}