summaryrefslogtreecommitdiffstats
path: root/java/sca
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-10-09 20:09:45 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-10-09 20:09:45 +0000
commit5a46dfa5a53f7d421b04e7d7329bdcf77fa1e9a7 (patch)
tree7619a9d2464027ef67e22b6d15d157443d99651b /java/sca
parentd1ed18bd530351862a1ee828237840fac1269a70 (diff)
Add a test case to validate the LDAP filter
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@823674 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca')
-rw-r--r--java/sca/modules/extensibility/src/test/java/org/apache/tuscany/sca/extensibility/ServiceDiscoveryTestCase.java19
-rw-r--r--java/sca/modules/extensibility/src/test/resources/META-INF/services/org.apache.tuscany.sca.extensibility.test.TestInterface4
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