diff options
author | adrianocrestani <adrianocrestani@13f79535-47bb-0310-9956-ffa450edef68> | 2009-06-06 09:18:42 +0000 |
---|---|---|
committer | adrianocrestani <adrianocrestani@13f79535-47bb-0310-9956-ffa450edef68> | 2009-06-06 09:18:42 +0000 |
commit | 8f34ff7c71819472d7b2f023b8ecb04da97d2655 (patch) | |
tree | efe54ad5daf1f6aa176abab2641bfdf007f167d9 /branches/sca-java-1.x/modules/domain-search/src/test/java/org/apache/tuscany/sca/domain/search/impl/DomainPathAnalyzerTestCase.java | |
parent | 6a9f8b2718697d444e4413166465cf2c5f1ef533 (diff) |
-applying patch tuscany_2552_phillipe_ramalho_06_04_2009.patch from TUSCANY-2552
-adding domain-search to modules/pom.xml
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@782215 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.x/modules/domain-search/src/test/java/org/apache/tuscany/sca/domain/search/impl/DomainPathAnalyzerTestCase.java')
-rw-r--r-- | branches/sca-java-1.x/modules/domain-search/src/test/java/org/apache/tuscany/sca/domain/search/impl/DomainPathAnalyzerTestCase.java | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/branches/sca-java-1.x/modules/domain-search/src/test/java/org/apache/tuscany/sca/domain/search/impl/DomainPathAnalyzerTestCase.java b/branches/sca-java-1.x/modules/domain-search/src/test/java/org/apache/tuscany/sca/domain/search/impl/DomainPathAnalyzerTestCase.java new file mode 100644 index 0000000000..54a84f0b49 --- /dev/null +++ b/branches/sca-java-1.x/modules/domain-search/src/test/java/org/apache/tuscany/sca/domain/search/impl/DomainPathAnalyzerTestCase.java @@ -0,0 +1,41 @@ +package org.apache.tuscany.sca.domain.search.impl; + +import java.io.IOException; +import java.io.StringReader; + +import org.apache.lucene.analysis.Token; +import org.apache.lucene.analysis.Tokenizer; + +import junit.framework.TestCase; + +public class DomainPathAnalyzerTestCase extends TestCase { + + private Token reusableToken = new Token(); + + public void test() throws IOException { + + Tokenizer tokenizer = new DomainPathAnalyzer.DomainPathTokenizer(new StringReader( + DomainPathAnalyzer.PATH_SEPARATOR + SearchFields.CONTRIBUTION_FIELD + DomainPathAnalyzer.TYPE_SEPARATOR + "123tuscany" + DomainPathAnalyzer.TYPE_SEPARATOR + "SCA" + + DomainPathAnalyzer.PATH_SEPARATOR + DomainPathAnalyzer.TYPE_SEPARATOR + "TuscanySCA" + DomainPathAnalyzer.TYPE_SEPARATOR + "123")); + + assertNextToken(Character.toString(DomainPathAnalyzer.PATH_SEPARATOR), tokenizer); + assertNextToken("123", tokenizer); + assertNextToken("tuscany", tokenizer); + assertNextToken("sca", tokenizer); + assertNextToken(Character.toString(DomainPathAnalyzer.PATH_SEPARATOR), tokenizer); + assertNextToken("tuscany", tokenizer); + assertNextToken("sca", tokenizer); + assertNextToken("123", tokenizer); + + } + + private void assertNextToken(String expected, Tokenizer tokenizer) + throws IOException { + Token token = tokenizer.next(reusableToken); + + assertNotNull(token); + assertEquals(expected, token.term()); + + } + +} |