Author: sergeyb
Date: Thu Jan 16 14:00:05 2014
New Revision: 1558799
URL: http://svn.apache.org/r1558799
Log:
Merged revisions 1558798 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r1558798 | sergeyb | 2014-01-16 13:57:27 +0000 (Thu, 16 Jan 2014) | 1 line
More updates to get camel case supported
........
Modified:
cxf/branches/2.7.x-fixes/ (props changed)
cxf/branches/2.7.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/PrimitiveSearchCondition.java
cxf/branches/2.7.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/fiql/FiqlParser.java
cxf/branches/2.7.x-fixes/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/fiql/FiqlParserTest.java
cxf/branches/2.7.x-fixes/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/jpa/Book.java
cxf/branches/2.7.x-fixes/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/jpa/Book_.java
cxf/branches/2.7.x-fixes/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/jpa/JPATypedQueryVisitorTest.java
Propchange: cxf/branches/2.7.x-fixes/
------------------------------------------------------------------------------
Merged /cxf/trunk:r1558798
Propchange: cxf/branches/2.7.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified:
cxf/branches/2.7.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/PrimitiveSearchCondition.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/PrimitiveSearchCondition.java?rev=1558799&r1=1558798&r2=1558799&view=diff
==============================================================================
---
cxf/branches/2.7.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/PrimitiveSearchCondition.java
(original)
+++
cxf/branches/2.7.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/PrimitiveSearchCondition.java
Thu Jan 16 14:00:05 2014
@@ -110,7 +110,7 @@ public class PrimitiveSearchCondition<T>
String thePropertyName;
int index = getter.indexOf(".");
if (index != -1) {
- thePropertyName = getter.substring(0, index).toLowerCase();
+ thePropertyName = getter.substring(0, index);
} else {
thePropertyName = getter;
}
@@ -118,7 +118,7 @@ public class PrimitiveSearchCondition<T>
Object value;
try {
if (beanspector != null) {
- value = beanspector.swap(pojo).getValue(thePropertyName);
+ value =
beanspector.swap(pojo).getValue(thePropertyName.toLowerCase());
} else {
value = ((SearchBean)pojo).get(getter);
}
Modified:
cxf/branches/2.7.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/fiql/FiqlParser.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/fiql/FiqlParser.java?rev=1558799&r1=1558798&r2=1558799&view=diff
==============================================================================
---
cxf/branches/2.7.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/fiql/FiqlParser.java
(original)
+++
cxf/branches/2.7.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/fiql/FiqlParser.java
Thu Jan 16 14:00:05 2014
@@ -596,9 +596,10 @@ public class FiqlParser<T> implements Se
if (isPrimitive(cond)) {
return new SimpleSearchCondition<T>(ct, cond);
} else {
- return new
SimpleSearchCondition<T>(Collections.singletonMap(templateName.toLowerCase(),
ct),
-
Collections.singletonMap(templateName, name),
-
Collections.singletonMap(templateName, tvalue.getTypeInfo()),
+ String templateNameLCase = templateName.toLowerCase();
+ return new
SimpleSearchCondition<T>(Collections.singletonMap(templateNameLCase, ct),
+
Collections.singletonMap(templateNameLCase, name),
+
Collections.singletonMap(templateNameLCase, tvalue.getTypeInfo()),
cond);
}
}
Modified:
cxf/branches/2.7.x-fixes/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/fiql/FiqlParserTest.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/fiql/FiqlParserTest.java?rev=1558799&r1=1558798&r2=1558799&view=diff
==============================================================================
---
cxf/branches/2.7.x-fixes/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/fiql/FiqlParserTest.java
(original)
+++
cxf/branches/2.7.x-fixes/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/fiql/FiqlParserTest.java
Thu Jan 16 14:00:05 2014
@@ -133,14 +133,22 @@ public class FiqlParserTest extends Asse
@Test
public void testParseTheName() throws SearchParseException {
- doTestParseName("thename==king");
+ doTestParseName2("thename==king2");
}
@Test
public void testParseTheName2() throws SearchParseException {
- doTestParseName("theName==king");
+ doTestParseName2("theName==king2");
}
+ private void doTestParseName2(String exp) throws SearchParseException {
+ SearchCondition<Condition> filter = parser.parse(exp);
+ assertTrue(filter.isMet(new Condition("king", 10, new Date(),
"king2")));
+ assertTrue(filter.isMet(new Condition("king", 0, null, "king2")));
+ assertFalse(filter.isMet(new Condition("diamond", 10, new Date(),
"theking2")));
+ assertFalse(filter.isMet(new Condition("diamond", 0, null,
"theking2")));
+ }
+
private void doTestParseName(String exp) throws SearchParseException {
SearchCondition<Condition> filter = parser.parse(exp);
assertTrue(filter.isMet(new Condition("king", 10, new Date())));
@@ -297,6 +305,7 @@ public class FiqlParserTest extends Asse
@Ignore
public static class Condition {
private String name;
+ private String name2;
private Integer level;
private Date time;
@@ -308,6 +317,14 @@ public class FiqlParserTest extends Asse
this.level = level;
this.time = time;
}
+
+ public Condition(String name, Integer level, Date time, String name2) {
+ this.name = name;
+ this.level = level;
+ this.time = time;
+ this.name2 = name2;
+
+ }
public String getName() {
return name;
@@ -334,11 +351,11 @@ public class FiqlParserTest extends Asse
}
public void setTheName(String thename) {
- setName(thename);
+ name2 = thename;
}
public String getTheName() {
- return getName();
+ return name2;
}
}
Modified:
cxf/branches/2.7.x-fixes/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/jpa/Book.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/jpa/Book.java?rev=1558799&r1=1558798&r2=1558799&view=diff
==============================================================================
---
cxf/branches/2.7.x-fixes/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/jpa/Book.java
(original)
+++
cxf/branches/2.7.x-fixes/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/jpa/Book.java
Thu Jan 16 14:00:05 2014
@@ -31,7 +31,7 @@ import javax.persistence.OneToMany;
@Entity(name = "Book")
public class Book {
private int id;
- private String title;
+ private String bookTitle;
private OwnerAddress address;
private OwnerInfo ownerInfo;
private Library library;
@@ -47,12 +47,12 @@ public class Book {
this.id = id;
}
- public String getTitle() {
- return title;
+ public String getBookTitle() {
+ return bookTitle;
}
- public void setTitle(String name) {
- this.title = name;
+ public void setBookTitle(String name) {
+ this.bookTitle = name;
}
@Embedded
Modified:
cxf/branches/2.7.x-fixes/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/jpa/Book_.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/jpa/Book_.java?rev=1558799&r1=1558798&r2=1558799&view=diff
==============================================================================
---
cxf/branches/2.7.x-fixes/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/jpa/Book_.java
(original)
+++
cxf/branches/2.7.x-fixes/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/jpa/Book_.java
Thu Jan 16 14:00:05 2014
@@ -28,7 +28,7 @@ public final class Book_ {
}
public static volatile SingularAttribute<Book, Integer> id;
- public static volatile SingularAttribute<Book, String> title;
+ public static volatile SingularAttribute<Book, String> bookTitle;
public static volatile SingularAttribute<Book, Library> library;
public static volatile SingularAttribute<Book, OwnerInfo> ownerInfo;
public static volatile SingularAttribute<Book, OwnerAddress> address;
Modified:
cxf/branches/2.7.x-fixes/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/jpa/JPATypedQueryVisitorTest.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/jpa/JPATypedQueryVisitorTest.java?rev=1558799&r1=1558798&r2=1558799&view=diff
==============================================================================
---
cxf/branches/2.7.x-fixes/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/jpa/JPATypedQueryVisitorTest.java
(original)
+++
cxf/branches/2.7.x-fixes/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/jpa/JPATypedQueryVisitorTest.java
Thu Jan 16 14:00:05 2014
@@ -89,7 +89,7 @@ public class JPATypedQueryVisitorTest ex
b1.setId(9);
- b1.setTitle("num9");
+ b1.setBookTitle("num9");
b1.setAddress(new OwnerAddress("Street1"));
OwnerInfo info1 = new OwnerInfo();
info1.setName(new Name("Fred"));
@@ -111,7 +111,7 @@ public class JPATypedQueryVisitorTest ex
br2.setBook(b2);
b2.setId(10);
- b2.setTitle("num10");
+ b2.setBookTitle("num10");
b2.setAddress(new OwnerAddress("Street2"));
OwnerInfo info2 = new OwnerInfo();
info2.setName(new Name("Barry"));
@@ -132,7 +132,7 @@ public class JPATypedQueryVisitorTest ex
b3.getReviews().add(br3);
br3.setBook(b3);
b3.setId(11);
- b3.setTitle("num11");
+ b3.setBookTitle("num11");
b3.setAddress(new OwnerAddress("Street3"));
b3.getAuthors().add("Barry");
OwnerInfo info3 = new OwnerInfo();
@@ -186,9 +186,9 @@ public class JPATypedQueryVisitorTest ex
@Test
public void testAndQuery() throws Exception {
- List<Book> books = queryBooks("id==10;title==num10");
+ List<Book> books = queryBooks("id==10;bookTitle==num10");
assertEquals(1, books.size());
- assertTrue(10 == books.get(0).getId() &&
"num10".equals(books.get(0).getTitle()));
+ assertTrue(10 == books.get(0).getId() &&
"num10".equals(books.get(0).getBookTitle()));
}
@Test
@@ -273,12 +273,12 @@ public class JPATypedQueryVisitorTest ex
List<Book> books =
queryBooks("id==10;authors==John;reviews.review==good;reviews.authors==Ted");
assertEquals(1, books.size());
- assertTrue(10 == books.get(0).getId() &&
"num10".equals(books.get(0).getTitle()));
+ assertTrue(10 == books.get(0).getId() &&
"num10".equals(books.get(0).getBookTitle()));
}
@Test
public void testAndQueryNoMatch() throws Exception {
- List<Book> books = queryBooks("id==10;title==num9");
+ List<Book> books = queryBooks("id==10;bookTitle==num9");
assertEquals(0, books.size());
}
@@ -407,7 +407,7 @@ public class JPATypedQueryVisitorTest ex
@Test
public void testFindBookInTownLibrary() throws Exception {
- List<Book> books = queryBooks("libAddress==town;title==num10", null,
+ List<Book> books = queryBooks("libAddress==town;bookTitle==num10",
null,
Collections.singletonMap("libAddress", "library.address"));
assertEquals(1, books.size());
Book book = books.get(0);
@@ -434,7 +434,7 @@ public class JPATypedQueryVisitorTest ex
@Test
public void testEqualsWildcard() throws Exception {
- List<Book> books = queryBooks("title==num1*");
+ List<Book> books = queryBooks("bookTitle==num1*");
assertEquals(2, books.size());
assertTrue(10 == books.get(0).getId() && 11 == books.get(1).getId()
|| 11 == books.get(0).getId() && 10 == books.get(1).getId());
@@ -551,7 +551,7 @@ public class JPATypedQueryVisitorTest ex
List<SingularAttribute<Book, ?>> selections =
new ArrayList<SingularAttribute<Book, ?>>();
selections.add(Book_.id);
- selections.add(Book_.title);
+ selections.add(Book_.bookTitle);
jpa.selectConstruct(selections);
@@ -569,7 +569,7 @@ public class JPATypedQueryVisitorTest ex
List<SingularAttribute<Book, ?>> selections =
new ArrayList<SingularAttribute<Book, ?>>();
selections.add(Book_.id);
- selections.add(Book_.title);
+ selections.add(Book_.bookTitle);
return jpa.getArrayTypedQuery(selections).getResultList();
}