You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by ju...@apache.org on 2009/05/14 10:17:36 UTC
svn commit: r774677 - in /jackrabbit/trunk/jackrabbit-spi-commons/src/test:
java/org/apache/jackrabbit/spi/commons/query/sql2/ParserTest.java
resources/org/apache/jackrabbit/spi/commons/query/sql2/test.sql2.txt
Author: jukka
Date: Thu May 14 08:17:36 2009
New Revision: 774677
URL: http://svn.apache.org/viewvc?rev=774677&view=rev
Log:
JCR-2110: o.a.j.spi.commons.query.sql2.ParserTest uses platform encoding with non-ASCII characters
Change the encoding to UTF-8.
Modified:
jackrabbit/trunk/jackrabbit-spi-commons/src/test/java/org/apache/jackrabbit/spi/commons/query/sql2/ParserTest.java
jackrabbit/trunk/jackrabbit-spi-commons/src/test/resources/org/apache/jackrabbit/spi/commons/query/sql2/test.sql2.txt
Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/test/java/org/apache/jackrabbit/spi/commons/query/sql2/ParserTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/test/java/org/apache/jackrabbit/spi/commons/query/sql2/ParserTest.java?rev=774677&r1=774676&r2=774677&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/test/java/org/apache/jackrabbit/spi/commons/query/sql2/ParserTest.java (original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/test/java/org/apache/jackrabbit/spi/commons/query/sql2/ParserTest.java Thu May 14 08:17:36 2009
@@ -18,6 +18,7 @@
import java.io.InputStreamReader;
import java.io.LineNumberReader;
+import java.io.UnsupportedEncodingException;
import java.util.Random;
import javax.jcr.NamespaceException;
import javax.jcr.RepositoryException;
@@ -64,8 +65,12 @@
}
private LineNumberReader openScript(String name) {
- return new LineNumberReader(new InputStreamReader(getClass()
- .getResourceAsStream(name)));
+ try {
+ return new LineNumberReader(new InputStreamReader(
+ getClass().getResourceAsStream(name), "UTF-8"));
+ } catch (UnsupportedEncodingException e) {
+ throw new IllegalStateException("UTF-8 not supported", e);
+ }
}
public void testParseScript() throws Exception {
Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/test/resources/org/apache/jackrabbit/spi/commons/query/sql2/test.sql2.txt
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/test/resources/org/apache/jackrabbit/spi/commons/query/sql2/test.sql2.txt?rev=774677&r1=774676&r2=774677&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/test/resources/org/apache/jackrabbit/spi/commons/query/sql2/test.sql2.txt (original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/test/resources/org/apache/jackrabbit/spi/commons/query/sql2/test.sql2.txt Thu May 14 08:17:36 2009
@@ -13,6 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+# File encoding: UTF-8
+
# See also jcr-spec.pdf
# 6.7.1 Query (p 99)
@@ -21,9 +23,9 @@
select * from test where id=1 order by id
select * from test order by id
-# 6.7.2 Source (p 99)
+# 6.7.2 Source (p 99)
# 6.7.3 Selector (p 100)
-# 6.7.4 Name (p 100)
+# 6.7.4 Name (p 100)
select * from test as t
select * from ["Test"]
select * from [test]
@@ -32,9 +34,9 @@
select * from ["test"] as ["t"]
# 6.7.5 Join (p 102)
-# 6.7.6 JoinType (p 102)
-# 6.7.7 JoinCondition (p 103)
-# 6.7.8 EquiJoinCondition (p 103)
+# 6.7.6 JoinType (p 102)
+# 6.7.7 JoinCondition (p 103)
+# 6.7.8 EquiJoinCondition (p 103)
select * from parent inner join child on parent.id=child.parentid
select * from parent as p inner join child as c on p.id=c.parentid
select * from parent as p inner join child as c on p.id=c.parentid
@@ -47,31 +49,31 @@
select * from parent as p inner join child as c on issamenode(p, c, [/a/b/c])
select * from parent as p inner join child as c on issamenode(p, c, ['/a/b/c'])
-# 6.7.10 ChildNodeJoinCondition (p 106)
+# 6.7.10 ChildNodeJoinCondition (p 106)
select * from parent as p inner join child as c on ischildnode(p, c)
# 6.7.11 DescendantNodeJoinCondition (p 107)
select * from parent as p inner join child as c on isdescendantnode(p, c)
select * from parent as p right outer join child as c on p.id=c.parentid inner join other as x on p.id = x.id
-# 6.7.12 Constraint (p 108)
-# 6.7.13 And (p 108)
-# 6.7.14 Or (p 109)
+# 6.7.12 Constraint (p 108)
+# 6.7.13 And (p 108)
+# 6.7.14 Or (p 109)
select * from test where id<1 and id>1
select * from test where id=2 or name='Hello'
-# 6.7.15 Not (p 110)
+# 6.7.15 Not (p 110)
select * from test where not id=2
select * from test where not (id=2 and name='Hello')
select * from test where id=2 or not (name='Hello' and id=3)
-# 6.7.16 Comparison (p 110)
+# 6.7.16 Comparison (p 110)
# 6.7.17 Operator (p 112)
select * from test where id<=2 or id>=3 and name<'a' or name>'c'
select * from test where id<>2
select * from test where name like 'H%'
-# 6.7.18 PropertyExistence (p 113)
+# 6.7.18 PropertyExistence (p 113)
select * from test where name is not null
select * from test as t where t.name is not null and t.id<>0
select * from test as t where not t.name is not null
@@ -83,58 +85,58 @@
select * from test as t where contains(t.*, 'hello -world')
select * from test as t where contains([t].name, 'hello -world')
-# 6.7.20 SameNode (p 115)
+# 6.7.20 SameNode (p 115)
select * from test where issamenode([/a/b/c])
select * from test as a where issamenode(['/a'])
select * from test as x where issamenode(x, ['/a[2]/b/c'])
-# 6.7.21 ChildNode (p 116)
+# 6.7.21 ChildNode (p 116)
select * from test where ischildnode([/a[1]/b])
select * from test as a where ischildnode(['/a'])
select * from test as x where ischildnode(x, [/])
select * from test as x where ischildnode(x, ['/a[1]'])
-# 6.7.22 DescendantNode (p 117)
+# 6.7.22 DescendantNode (p 117)
# 6.7.23 Path (p 118)
select * from test where ISDESCENDANTNODE([/a[1]])
select * from test as a where ISDESCENDANTNODE([/a])
select * from test as x where ISDESCENDANTNODE(x, [/a/b/c])
-# 6.7.24 Operand (p 118)
-# 6.7.25 StaticOperand (p 119)
-# 6.7.26 DynamicOperand (p 119)
-# 6.7.27 PropertyValue (p 119)
-# 6.7.28 Length (p 120)
+# 6.7.24 Operand (p 118)
+# 6.7.25 StaticOperand (p 119)
+# 6.7.26 DynamicOperand (p 119)
+# 6.7.27 PropertyValue (p 119)
+# 6.7.28 Length (p 120)
select * from test where length(name)=5
select * from test as t where length(t.name)=5
-# 6.7.29 NodeName (p 121)
+# 6.7.29 NodeName (p 121)
select * from test where name()='test'
select * from test as x where name(x)='test'
-# 6.7.30 NodeLocalName (p 121)
+# 6.7.30 NodeLocalName (p 121)
select * from test where localname()='test'
select * from test as x where localname(x)='test'
-# 6.7.31 FullTextSearchScore (p 122)
+# 6.7.31 FullTextSearchScore (p 122)
select * from test where score()>4
select * from test as x where score(x)<1
-# 6.7.32 LowerCase (p 122)
+# 6.7.32 LowerCase (p 122)
select * from test where lower(name)='test'
select * from test where lower(upper(name))='test'
select * from test where lower(localname(test))='test'
select * from test where lower(name(test))='test'
select * from test as x where lower(x.name)='test'
-# 6.7.33 UpperCase (p 123)
+# 6.7.33 UpperCase (p 123)
select * from test where upper(name)='test'
select * from test where upper(lower(name))='test'
select * from test where upper(localname(test))='test'
select * from test where upper(name(test))='test'
select * from test as x where upper(x.name)='test'
-# 6.7.34 Literal (p 123)
+# 6.7.34 Literal (p 123)
select * from test where amount=0.01
select * from test where amount=10.
select * from test where amount=.01
@@ -169,10 +171,10 @@
select * from test where name=$x and id=$y
select * from test where name=$x14
select * from test where name=$_
-select * from test where name=$äöü
-select * from test where name=$äöü
+select * from test where name=$äöü
+select * from test where name=$äöü
-# 6.7.36 Prefix (p 124)
+# 6.7.36 Prefix (p 124)
select * from test where name=$nt:name
select * from test where name=$_:name
select * from test where name=$_1:name