From 429de62f6768b68e8de34a35353369af6041351b Mon Sep 17 00:00:00 2001 From: Hannes Wellmann Date: Mon, 14 Oct 2024 20:12:38 +0200 Subject: [PATCH] Use @ServiceRanking component property type annotation in e4.core.tests --- .../.settings/org.eclipse.pde.ds.annotations.prefs | 2 +- .../org.eclipse.e4.core.javax.tests/META-INF/MANIFEST.MF | 1 + .../e4/core/internal/tests/contexts/AddContextFunction.java | 2 +- .../e4/core/internal/tests/contexts/inject/TestServiceB.java | 4 +++- .../core/internal/tests/di/extensions/DisabledServiceB.java | 4 +++- .../e4/core/internal/tests/di/extensions/FilterServiceA.java | 4 +++- .../e4/core/internal/tests/di/extensions/SampleServiceA.java | 4 +++- .../e4/core/internal/tests/di/extensions/SampleServiceB.java | 4 +++- .../.settings/org.eclipse.pde.ds.annotations.prefs | 2 +- runtime/tests/org.eclipse.e4.core.tests/META-INF/MANIFEST.MF | 1 + .../e4/core/internal/tests/contexts/AddContextFunction.java | 2 +- .../e4/core/internal/tests/contexts/inject/TestServiceB.java | 4 +++- .../core/internal/tests/di/extensions/DisabledServiceB.java | 4 +++- .../e4/core/internal/tests/di/extensions/FilterServiceA.java | 4 +++- .../e4/core/internal/tests/di/extensions/SampleServiceB.java | 4 +++- 15 files changed, 33 insertions(+), 13 deletions(-) diff --git a/runtime/tests/org.eclipse.e4.core.javax.tests/.settings/org.eclipse.pde.ds.annotations.prefs b/runtime/tests/org.eclipse.e4.core.javax.tests/.settings/org.eclipse.pde.ds.annotations.prefs index 38f9eecff8e..5faf08b7d5c 100644 --- a/runtime/tests/org.eclipse.e4.core.javax.tests/.settings/org.eclipse.pde.ds.annotations.prefs +++ b/runtime/tests/org.eclipse.e4.core.javax.tests/.settings/org.eclipse.pde.ds.annotations.prefs @@ -1,4 +1,4 @@ -dsVersion=V1_3 +dsVersion=V1_4 eclipse.preferences.version=1 enabled=true generateBundleActivationPolicyLazy=true diff --git a/runtime/tests/org.eclipse.e4.core.javax.tests/META-INF/MANIFEST.MF b/runtime/tests/org.eclipse.e4.core.javax.tests/META-INF/MANIFEST.MF index b2d11dc688b..8666f95d8b2 100644 --- a/runtime/tests/org.eclipse.e4.core.javax.tests/META-INF/MANIFEST.MF +++ b/runtime/tests/org.eclipse.e4.core.javax.tests/META-INF/MANIFEST.MF @@ -26,6 +26,7 @@ Import-Package: javax.annotation;version="[1.3.0,2.0.0)", org.junit.runners;version="[4.13.0,5.0.0)", org.osgi.framework;version="[1.10.0,2.0.0)", org.osgi.service.component;version="1.3.0", + org.osgi.service.component.propertytypes;version="[1.4.0,2.0.0)", org.osgi.service.event;version="1.3.0", org.osgi.util.tracker;version="[1.5.0,2.0.0)" Export-Package: org.eclipse.e4.core.internal.tests;x-internal:=true, diff --git a/runtime/tests/org.eclipse.e4.core.javax.tests/src/org/eclipse/e4/core/internal/tests/contexts/AddContextFunction.java b/runtime/tests/org.eclipse.e4.core.javax.tests/src/org/eclipse/e4/core/internal/tests/contexts/AddContextFunction.java index 5e260552012..1e10cf4003d 100644 --- a/runtime/tests/org.eclipse.e4.core.javax.tests/src/org/eclipse/e4/core/internal/tests/contexts/AddContextFunction.java +++ b/runtime/tests/org.eclipse.e4.core.javax.tests/src/org/eclipse/e4/core/internal/tests/contexts/AddContextFunction.java @@ -23,7 +23,7 @@ /** * A function provided as a declarative service. See OSGI-INF/adder.xml. */ -@Component(service = IContextFunction.class, property = "service.context.key:String=sum") +@Component(service = IContextFunction.class, property = IContextFunction.SERVICE_CONTEXT_KEY + "=sum") public class AddContextFunction extends ContextFunction { @Override diff --git a/runtime/tests/org.eclipse.e4.core.javax.tests/src/org/eclipse/e4/core/internal/tests/contexts/inject/TestServiceB.java b/runtime/tests/org.eclipse.e4.core.javax.tests/src/org/eclipse/e4/core/internal/tests/contexts/inject/TestServiceB.java index 32df30315d7..0334513bd92 100644 --- a/runtime/tests/org.eclipse.e4.core.javax.tests/src/org/eclipse/e4/core/internal/tests/contexts/inject/TestServiceB.java +++ b/runtime/tests/org.eclipse.e4.core.javax.tests/src/org/eclipse/e4/core/internal/tests/contexts/inject/TestServiceB.java @@ -1,8 +1,10 @@ package org.eclipse.e4.core.internal.tests.contexts.inject; import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.propertytypes.ServiceRanking; -@Component(enabled = false, property = "service.ranking:Integer=5") +@Component(enabled = false) +@ServiceRanking(5) public class TestServiceB implements TestService, TestOtherService { } diff --git a/runtime/tests/org.eclipse.e4.core.javax.tests/src/org/eclipse/e4/core/internal/tests/di/extensions/DisabledServiceB.java b/runtime/tests/org.eclipse.e4.core.javax.tests/src/org/eclipse/e4/core/internal/tests/di/extensions/DisabledServiceB.java index 7f2f8640178..784f559ee16 100644 --- a/runtime/tests/org.eclipse.e4.core.javax.tests/src/org/eclipse/e4/core/internal/tests/di/extensions/DisabledServiceB.java +++ b/runtime/tests/org.eclipse.e4.core.javax.tests/src/org/eclipse/e4/core/internal/tests/di/extensions/DisabledServiceB.java @@ -1,8 +1,10 @@ package org.eclipse.e4.core.internal.tests.di.extensions; import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.propertytypes.ServiceRanking; -@Component(name = "DisabledServiceB", enabled = false, property = { "component=disabled", "service.ranking:Integer=5" }) +@Component(name = "DisabledServiceB", enabled = false, property = "component=disabled") +@ServiceRanking(5) public class DisabledServiceB implements TestService { } diff --git a/runtime/tests/org.eclipse.e4.core.javax.tests/src/org/eclipse/e4/core/internal/tests/di/extensions/FilterServiceA.java b/runtime/tests/org.eclipse.e4.core.javax.tests/src/org/eclipse/e4/core/internal/tests/di/extensions/FilterServiceA.java index 46bea2ecf66..c480cdbc9b4 100644 --- a/runtime/tests/org.eclipse.e4.core.javax.tests/src/org/eclipse/e4/core/internal/tests/di/extensions/FilterServiceA.java +++ b/runtime/tests/org.eclipse.e4.core.javax.tests/src/org/eclipse/e4/core/internal/tests/di/extensions/FilterServiceA.java @@ -1,8 +1,10 @@ package org.eclipse.e4.core.internal.tests.di.extensions; import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.propertytypes.ServiceRanking; -@Component(property = { "filtervalue=Test", "service.ranking:Integer=1" }) +@Component(property = "filtervalue=Test") +@ServiceRanking(1) public class FilterServiceA implements TestService { } diff --git a/runtime/tests/org.eclipse.e4.core.javax.tests/src/org/eclipse/e4/core/internal/tests/di/extensions/SampleServiceA.java b/runtime/tests/org.eclipse.e4.core.javax.tests/src/org/eclipse/e4/core/internal/tests/di/extensions/SampleServiceA.java index 390acb24a69..0f1ff94abdb 100644 --- a/runtime/tests/org.eclipse.e4.core.javax.tests/src/org/eclipse/e4/core/internal/tests/di/extensions/SampleServiceA.java +++ b/runtime/tests/org.eclipse.e4.core.javax.tests/src/org/eclipse/e4/core/internal/tests/di/extensions/SampleServiceA.java @@ -1,8 +1,10 @@ package org.eclipse.e4.core.internal.tests.di.extensions; import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.propertytypes.ServiceRanking; -@Component(property = "service.ranking:Integer=50") +@Component +@ServiceRanking(50) public class SampleServiceA implements TestService { } diff --git a/runtime/tests/org.eclipse.e4.core.javax.tests/src/org/eclipse/e4/core/internal/tests/di/extensions/SampleServiceB.java b/runtime/tests/org.eclipse.e4.core.javax.tests/src/org/eclipse/e4/core/internal/tests/di/extensions/SampleServiceB.java index 68dc57ba514..c0dc83f2b41 100644 --- a/runtime/tests/org.eclipse.e4.core.javax.tests/src/org/eclipse/e4/core/internal/tests/di/extensions/SampleServiceB.java +++ b/runtime/tests/org.eclipse.e4.core.javax.tests/src/org/eclipse/e4/core/internal/tests/di/extensions/SampleServiceB.java @@ -1,8 +1,10 @@ package org.eclipse.e4.core.internal.tests.di.extensions; import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.propertytypes.ServiceRanking; -@Component(property = "service.ranking:Integer=40") +@Component +@ServiceRanking(40) public class SampleServiceB implements TestService { } diff --git a/runtime/tests/org.eclipse.e4.core.tests/.settings/org.eclipse.pde.ds.annotations.prefs b/runtime/tests/org.eclipse.e4.core.tests/.settings/org.eclipse.pde.ds.annotations.prefs index 38f9eecff8e..5faf08b7d5c 100644 --- a/runtime/tests/org.eclipse.e4.core.tests/.settings/org.eclipse.pde.ds.annotations.prefs +++ b/runtime/tests/org.eclipse.e4.core.tests/.settings/org.eclipse.pde.ds.annotations.prefs @@ -1,4 +1,4 @@ -dsVersion=V1_3 +dsVersion=V1_4 eclipse.preferences.version=1 enabled=true generateBundleActivationPolicyLazy=true diff --git a/runtime/tests/org.eclipse.e4.core.tests/META-INF/MANIFEST.MF b/runtime/tests/org.eclipse.e4.core.tests/META-INF/MANIFEST.MF index d5df6608689..7dae01450a8 100644 --- a/runtime/tests/org.eclipse.e4.core.tests/META-INF/MANIFEST.MF +++ b/runtime/tests/org.eclipse.e4.core.tests/META-INF/MANIFEST.MF @@ -27,6 +27,7 @@ Import-Package: jakarta.annotation;version="[2.1.0,3.0.0)", org.junit.runners;version="[4.13.0,5.0.0)", org.osgi.framework;version="[1.10.0,2.0.0)", org.osgi.service.component;version="1.3.0", + org.osgi.service.component.propertytypes;version="[1.4.0,2.0.0)", org.osgi.service.event;version="1.3.0", org.osgi.util.tracker;version="[1.5.0,2.0.0)" DynamicImport-Package: javax.annotation, javax.inject diff --git a/runtime/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/AddContextFunction.java b/runtime/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/AddContextFunction.java index 5e260552012..1e10cf4003d 100644 --- a/runtime/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/AddContextFunction.java +++ b/runtime/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/AddContextFunction.java @@ -23,7 +23,7 @@ /** * A function provided as a declarative service. See OSGI-INF/adder.xml. */ -@Component(service = IContextFunction.class, property = "service.context.key:String=sum") +@Component(service = IContextFunction.class, property = IContextFunction.SERVICE_CONTEXT_KEY + "=sum") public class AddContextFunction extends ContextFunction { @Override diff --git a/runtime/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/inject/TestServiceB.java b/runtime/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/inject/TestServiceB.java index 32df30315d7..0334513bd92 100644 --- a/runtime/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/inject/TestServiceB.java +++ b/runtime/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/inject/TestServiceB.java @@ -1,8 +1,10 @@ package org.eclipse.e4.core.internal.tests.contexts.inject; import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.propertytypes.ServiceRanking; -@Component(enabled = false, property = "service.ranking:Integer=5") +@Component(enabled = false) +@ServiceRanking(5) public class TestServiceB implements TestService, TestOtherService { } diff --git a/runtime/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/di/extensions/DisabledServiceB.java b/runtime/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/di/extensions/DisabledServiceB.java index 7f2f8640178..784f559ee16 100644 --- a/runtime/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/di/extensions/DisabledServiceB.java +++ b/runtime/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/di/extensions/DisabledServiceB.java @@ -1,8 +1,10 @@ package org.eclipse.e4.core.internal.tests.di.extensions; import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.propertytypes.ServiceRanking; -@Component(name = "DisabledServiceB", enabled = false, property = { "component=disabled", "service.ranking:Integer=5" }) +@Component(name = "DisabledServiceB", enabled = false, property = "component=disabled") +@ServiceRanking(5) public class DisabledServiceB implements TestService { } diff --git a/runtime/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/di/extensions/FilterServiceA.java b/runtime/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/di/extensions/FilterServiceA.java index 46bea2ecf66..c3d07334723 100644 --- a/runtime/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/di/extensions/FilterServiceA.java +++ b/runtime/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/di/extensions/FilterServiceA.java @@ -1,8 +1,10 @@ package org.eclipse.e4.core.internal.tests.di.extensions; import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.propertytypes.ServiceRanking; -@Component(property = { "filtervalue=Test", "service.ranking:Integer=1" }) +@Component(property = { "filtervalue=Test" }) +@ServiceRanking(1) public class FilterServiceA implements TestService { } diff --git a/runtime/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/di/extensions/SampleServiceB.java b/runtime/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/di/extensions/SampleServiceB.java index 68dc57ba514..c0dc83f2b41 100644 --- a/runtime/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/di/extensions/SampleServiceB.java +++ b/runtime/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/di/extensions/SampleServiceB.java @@ -1,8 +1,10 @@ package org.eclipse.e4.core.internal.tests.di.extensions; import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.propertytypes.ServiceRanking; -@Component(property = "service.ranking:Integer=40") +@Component +@ServiceRanking(40) public class SampleServiceB implements TestService { }