diff options
Diffstat (limited to 'java/sca')
2 files changed, 21 insertions, 2 deletions
diff --git a/java/sca/modules/extensibility/src/test/java/org/apache/tuscany/sca/extensibility/ServiceDiscoveryTestCase.java b/java/sca/modules/extensibility/src/test/java/org/apache/tuscany/sca/extensibility/ServiceDiscoveryTestCase.java index 7d0413ef17..7a2f680d16 100644 --- a/java/sca/modules/extensibility/src/test/java/org/apache/tuscany/sca/extensibility/ServiceDiscoveryTestCase.java +++ b/java/sca/modules/extensibility/src/test/java/org/apache/tuscany/sca/extensibility/ServiceDiscoveryTestCase.java @@ -65,4 +65,23 @@ public class ServiceDiscoveryTestCase { Assert.assertEquals("org.apache.tuscany.sca.extensibility.test.Test2Impl", sd1.getClassName()); Assert.assertEquals("org.apache.tuscany.sca.extensibility.test.TestImpl", sd2.getClassName()); } + + @Test + public void testFilter() throws Exception { + Collection<ServiceDeclaration> sds = + ServiceDiscovery.getInstance().getServiceDeclarations(TestInterface.class, "(attr=abc)"); + + Assert.assertEquals(1, sds.size()); + + Iterator<ServiceDeclaration> it = sds.iterator(); + ServiceDeclaration sd1 = it.next(); + Assert.assertEquals("org.apache.tuscany.sca.extensibility.test.Test2Impl", sd1.getClassName()); + + sds = ServiceDiscovery.getInstance().getServiceDeclarations(TestInterface.class, "(attr=1*)"); + Assert.assertEquals(1, sds.size()); + it = sds.iterator(); + sd1 = it.next(); + Assert.assertEquals("org.apache.tuscany.sca.extensibility.test.TestImpl", sd1.getClassName()); + } + } diff --git a/java/sca/modules/extensibility/src/test/resources/META-INF/services/org.apache.tuscany.sca.extensibility.test.TestInterface b/java/sca/modules/extensibility/src/test/resources/META-INF/services/org.apache.tuscany.sca.extensibility.test.TestInterface index 3d5f9d1857..25cd732a27 100644 --- a/java/sca/modules/extensibility/src/test/resources/META-INF/services/org.apache.tuscany.sca.extensibility.test.TestInterface +++ b/java/sca/modules/extensibility/src/test/resources/META-INF/services/org.apache.tuscany.sca.extensibility.test.TestInterface @@ -14,6 +14,6 @@ # KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-org.apache.tuscany.sca.extensibility.test.TestImpl;ranking=10
-org.apache.tuscany.sca.extensibility.test.Test2Impl;ranking=20
+org.apache.tuscany.sca.extensibility.test.TestImpl;ranking=10;attr=123
+org.apache.tuscany.sca.extensibility.test.Test2Impl;ranking=20;attr=abc
org.apache.tuscany.sca.extensibility.test.DummyImpl
\ No newline at end of file |