mirror of
https://github.com/querydsl/querydsl.git
synced 2026-06-13 21:01:01 +08:00
Merge branch 'master' of github.com:querydsl/querydsl into i921
Conflicts: querydsl-sql/src/test/java/com/mysema/query/SelectBase.java - imports
This commit is contained in:
commit
d635af6b9d
@ -13,8 +13,6 @@
|
||||
*/
|
||||
package com.mysema.query.apt;
|
||||
|
||||
import javax.annotation.processing.AbstractProcessor;
|
||||
import javax.tools.JavaCompiler;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@ -23,9 +21,13 @@ import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.processing.AbstractProcessor;
|
||||
import javax.tools.JavaCompiler;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.mysema.codegen.SimpleCompiler;
|
||||
import com.mysema.util.FileUtils;
|
||||
import junit.framework.Assert;
|
||||
|
||||
public abstract class AbstractProcessorTest {
|
||||
|
||||
|
||||
@ -13,8 +13,8 @@
|
||||
*/
|
||||
package com.mysema.query.apt;
|
||||
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static junit.framework.Assert.assertTrue;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
@ -23,9 +23,8 @@ import java.util.List;
|
||||
|
||||
import javax.tools.JavaCompiler;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.eclipse.jdt.internal.compiler.tool.EclipseCompiler;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
@ -13,8 +13,8 @@
|
||||
*/
|
||||
package com.mysema.query.apt;
|
||||
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static junit.framework.Assert.assertTrue;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
@ -13,8 +13,8 @@
|
||||
*/
|
||||
package com.mysema.query.apt;
|
||||
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static junit.framework.Assert.assertTrue;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
@ -25,6 +25,7 @@ import com.mysema.query.types.PathType;
|
||||
*/
|
||||
public class CollQueryTemplates extends JavaTemplates {
|
||||
|
||||
@SuppressWarnings("FieldNameHidesFieldInSuperclass") //intentional
|
||||
public static final CollQueryTemplates DEFAULT = new CollQueryTemplates();
|
||||
|
||||
protected CollQueryTemplates() {
|
||||
|
||||
@ -24,7 +24,8 @@ import com.mysema.query.types.Ops;
|
||||
*/
|
||||
public class JodaTimeTemplates extends CollQueryTemplates {
|
||||
|
||||
public static final CollQueryTemplates DEFAULT = new JodaTimeTemplates();
|
||||
@SuppressWarnings("FieldNameHidesFieldInSuperclass") //Intentional
|
||||
public static final JodaTimeTemplates DEFAULT = new JodaTimeTemplates();
|
||||
|
||||
protected JodaTimeTemplates() {
|
||||
add(Ops.DateTimeOps.YEAR, "{0}.getYear()");
|
||||
|
||||
@ -22,7 +22,7 @@ import static com.mysema.query.group.GroupBy.max;
|
||||
import static com.mysema.query.group.GroupBy.min;
|
||||
import static com.mysema.query.group.GroupBy.set;
|
||||
import static com.mysema.query.group.GroupBy.sum;
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
|
||||
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright 2014 Timo Westkämper.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.mysema.query.collections;
|
||||
|
||||
import com.mysema.query.TemplatesTestBase;
|
||||
|
||||
public class TemplatesTest extends TemplatesTestBase {
|
||||
|
||||
}
|
||||
@ -25,6 +25,9 @@ import java.lang.reflect.Field;
|
||||
*/
|
||||
public class JavaTemplates extends Templates {
|
||||
|
||||
@SuppressWarnings("FieldNameHidesFieldInSuperclass") //Intentional
|
||||
public static final JavaTemplates DEFAULT = new JavaTemplates();
|
||||
|
||||
public JavaTemplates() {
|
||||
add(Ops.EQ, "{0} == {1}");
|
||||
add(Ops.IS_NULL, "{0} == null");
|
||||
|
||||
@ -19,7 +19,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import junit.framework.Assert;
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.mysema.commons.lang.Pair;
|
||||
import com.mysema.query.support.QueryBase;
|
||||
|
||||
@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright 2014 Timo Westkämper.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.mysema.query;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.instanceOf;
|
||||
import static org.reflections.ReflectionUtils.*;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.ErrorCollector;
|
||||
import org.reflections.Reflections;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.mysema.query.types.Templates;
|
||||
|
||||
public class TemplatesTestBase {
|
||||
|
||||
@Rule
|
||||
public final ErrorCollector errorCollector = new ErrorCollector();
|
||||
|
||||
private final Reflections querydsl = new Reflections(
|
||||
TemplatesTestBase.class.getPackage().getName());
|
||||
|
||||
private final String modulePrefix = getClass().getPackage().getName();
|
||||
|
||||
@Test
|
||||
public void Default_Instance() {
|
||||
Set<Class<? extends Templates>> templates = querydsl.getSubTypesOf(Templates.class);
|
||||
Set<Class<? extends Templates>> moduleSpecific = getAll(templates, topLevelClass,
|
||||
withPattern("class " + modulePrefix + ".*"));
|
||||
|
||||
for (Class<? extends Templates> template : moduleSpecific) {
|
||||
try {
|
||||
Templates defaultInstance = (Templates) template.getField("DEFAULT").get(null);
|
||||
errorCollector.checkThat(defaultInstance, instanceOf(template));
|
||||
} catch (Exception ex) {
|
||||
errorCollector.addError(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
private static final Predicate<Class<?>> topLevelClass = new Predicate<Class<?>>() {
|
||||
|
||||
@Override
|
||||
public boolean apply(Class<?> input) {
|
||||
return !input.isAnonymousClass()
|
||||
&& !input.isMemberClass();
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -18,7 +18,7 @@ import static com.mysema.query.group.GroupBy.groupBy;
|
||||
import static com.mysema.query.group.GroupBy.list;
|
||||
import static com.mysema.query.group.GroupBy.map;
|
||||
import static com.mysema.query.group.GroupBy.set;
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@ import static com.mysema.query.group.GroupBy.groupBy;
|
||||
import static com.mysema.query.group.GroupBy.list;
|
||||
import static com.mysema.query.group.GroupBy.map;
|
||||
import static com.mysema.query.group.GroupBy.set;
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@ import static com.mysema.query.group.GroupBy.groupBy;
|
||||
import static com.mysema.query.group.GroupBy.list;
|
||||
import static com.mysema.query.group.GroupBy.map;
|
||||
import static com.mysema.query.group.GroupBy.set;
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
|
||||
@ -24,6 +24,7 @@ import com.mysema.query.types.Ops;
|
||||
*/
|
||||
public final class JDOQLTemplates extends JavaTemplates {
|
||||
|
||||
@SuppressWarnings("FieldNameHidesFieldInSuperclass") //Intentional
|
||||
public static final JDOQLTemplates DEFAULT = new JDOQLTemplates();
|
||||
|
||||
protected JDOQLTemplates() {
|
||||
|
||||
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright 2014 Timo Westkämper.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.mysema.query.jdo;
|
||||
|
||||
import com.mysema.query.TemplatesTestBase;
|
||||
|
||||
public class TemplatesTest extends TemplatesTestBase {
|
||||
|
||||
}
|
||||
@ -5,8 +5,9 @@ import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.mysema.codegen.SimpleCompiler;
|
||||
import junit.framework.Assert;
|
||||
|
||||
public class CompileUtils {
|
||||
|
||||
|
||||
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright 2014 Timo Westkämper.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.mysema.query.jpa;
|
||||
|
||||
import com.mysema.query.TemplatesTestBase;
|
||||
|
||||
public class TemplatesTest extends TemplatesTestBase {
|
||||
|
||||
}
|
||||
@ -1,7 +1,15 @@
|
||||
package com.mysema.query.mongodb;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.mongodb.morphia.Datastore;
|
||||
import org.mongodb.morphia.Morphia;
|
||||
|
||||
import com.mongodb.Mongo;
|
||||
import com.mongodb.MongoException;
|
||||
import com.mysema.query.mongodb.domain.Item;
|
||||
@ -10,13 +18,6 @@ import com.mysema.query.mongodb.domain.User;
|
||||
import com.mysema.query.mongodb.morphia.MorphiaQuery;
|
||||
import com.mysema.query.types.Predicate;
|
||||
import com.mysema.testutil.ExternalDB;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.mongodb.morphia.Datastore;
|
||||
import org.mongodb.morphia.Morphia;
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
@Category(ExternalDB.class)
|
||||
public class JoinTest {
|
||||
|
||||
@ -13,9 +13,19 @@
|
||||
*/
|
||||
package com.mysema.query.mongodb;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.*;
|
||||
|
||||
import org.bson.types.ObjectId;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.mongodb.morphia.Datastore;
|
||||
import org.mongodb.morphia.Morphia;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.mongodb.Mongo;
|
||||
import com.mongodb.MongoException;
|
||||
@ -30,16 +40,6 @@ import com.mysema.query.types.OrderSpecifier;
|
||||
import com.mysema.query.types.Predicate;
|
||||
import com.mysema.query.types.path.StringPath;
|
||||
import com.mysema.testutil.ExternalDB;
|
||||
import org.bson.types.ObjectId;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.mongodb.morphia.Datastore;
|
||||
import org.mongodb.morphia.Morphia;
|
||||
import static java.util.Arrays.asList;
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static junit.framework.Assert.assertNotNull;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
@Category(ExternalDB.class)
|
||||
public class MongodbQueryTest {
|
||||
|
||||
@ -13,13 +13,16 @@
|
||||
*/
|
||||
package com.mysema.query.mongodb;
|
||||
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.mongodb.BasicDBList;
|
||||
import com.mongodb.BasicDBObject;
|
||||
import com.mongodb.DBObject;
|
||||
@ -30,9 +33,6 @@ import com.mysema.query.types.Expression;
|
||||
import com.mysema.query.types.OrderSpecifier;
|
||||
import com.mysema.query.types.path.*;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class MongodbSerializerTest {
|
||||
|
||||
private PathBuilder<Object> entityPath;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@ -80,6 +80,12 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.reflections</groupId>
|
||||
<artifactId>reflections</artifactId>
|
||||
<version>0.9.9</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<dependencyManagement>
|
||||
@ -575,4 +581,4 @@
|
||||
</plugins>
|
||||
</reporting>
|
||||
|
||||
</project>
|
||||
</project>
|
||||
|
||||
@ -13,7 +13,8 @@
|
||||
*/
|
||||
package com.mysema.query.sql.codegen;
|
||||
|
||||
import javax.tools.JavaCompiler;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.sql.*;
|
||||
@ -22,13 +23,14 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.tools.JavaCompiler;
|
||||
|
||||
import org.junit.*;
|
||||
|
||||
import com.mysema.codegen.SimpleCompiler;
|
||||
import com.mysema.query.codegen.BeanSerializer;
|
||||
import com.mysema.query.codegen.Serializer;
|
||||
import com.mysema.util.FileUtils;
|
||||
import junit.framework.Assert;
|
||||
import org.junit.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class MetaDataExporterTest {
|
||||
|
||||
|
||||
@ -19,8 +19,7 @@ import java.util.Set;
|
||||
|
||||
import javax.tools.JavaCompiler;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
@ -27,6 +27,9 @@ import com.mysema.query.types.Ops;
|
||||
*/
|
||||
public class CUBRIDTemplates extends SQLTemplates {
|
||||
|
||||
@SuppressWarnings("FieldNameHidesFieldInSuperclass") //Intentional
|
||||
public static final CUBRIDTemplates DEFAULT = new CUBRIDTemplates();
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder() {
|
||||
@Override
|
||||
|
||||
@ -27,6 +27,9 @@ import com.mysema.query.types.Ops;
|
||||
*/
|
||||
public class DerbyTemplates extends SQLTemplates {
|
||||
|
||||
@SuppressWarnings("FieldNameHidesFieldInSuperclass") //Intentional
|
||||
public static final DerbyTemplates DEFAULT = new DerbyTemplates();
|
||||
|
||||
private String limitOffsetTemplate = "\noffset {1s} rows fetch next {0s} rows only";
|
||||
|
||||
private String limitTemplate = "\nfetch first {0s} rows only";
|
||||
|
||||
@ -8,6 +8,9 @@ import com.mysema.query.types.Ops;
|
||||
|
||||
public class FirebirdTemplates extends SQLTemplates {
|
||||
|
||||
@SuppressWarnings("FieldNameHidesFieldInSuperclass") //Intentional
|
||||
public static final FirebirdTemplates DEFAULT = new FirebirdTemplates();
|
||||
|
||||
private String limitOffsetTemplate = "\nrows {0} to {1}";
|
||||
|
||||
private String limitTemplate = "\nrows {0}";
|
||||
|
||||
@ -25,6 +25,9 @@ import com.mysema.query.types.Ops;
|
||||
*/
|
||||
public class H2Templates extends SQLTemplates {
|
||||
|
||||
@SuppressWarnings("FieldNameHidesFieldInSuperclass") //Intentional
|
||||
public static final H2Templates DEFAULT = new H2Templates();
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder() {
|
||||
@Override
|
||||
|
||||
@ -25,6 +25,9 @@ import com.mysema.query.types.Ops;
|
||||
*/
|
||||
public class HSQLDBTemplates extends SQLTemplates {
|
||||
|
||||
@SuppressWarnings("FieldNameHidesFieldInSuperclass") //Intentional
|
||||
public static final HSQLDBTemplates DEFAULT = new HSQLDBTemplates();
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder() {
|
||||
@Override
|
||||
|
||||
@ -74,6 +74,9 @@ public class MySQLTemplates extends SQLTemplates {
|
||||
"VARCHAR", "VARCHARACTER", "VARYING", "WHEN", "WHERE", "WHILE",
|
||||
"WITH", "WRITE", "XOR", "YEAR_MONTH", "ZEROFILL");
|
||||
|
||||
@SuppressWarnings("FieldNameHidesFieldInSuperclass") //Intentional
|
||||
public static final MySQLTemplates DEFAULT = new MySQLTemplates();
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder() {
|
||||
@Override
|
||||
|
||||
@ -33,6 +33,9 @@ import com.mysema.query.types.Path;
|
||||
*/
|
||||
public class OracleTemplates extends SQLTemplates {
|
||||
|
||||
@SuppressWarnings("FieldNameHidesFieldInSuperclass") //Intentional
|
||||
public static final OracleTemplates DEFAULT = new OracleTemplates();
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder() {
|
||||
@Override
|
||||
|
||||
@ -50,6 +50,9 @@ public class PostgresTemplates extends SQLTemplates {
|
||||
"TRAILING", "TRUE", "UNION", "UNIQUE", "USER", "USING",
|
||||
"VARIADIC", "VERBOSE", "WHEN", "WHERE", "WINDOW", "WITH");
|
||||
|
||||
@SuppressWarnings("FieldNameHidesFieldInSuperclass") //Intentional
|
||||
public static final PostgresTemplates DEFAULT = new PostgresTemplates();
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder() {
|
||||
@Override
|
||||
|
||||
@ -13,16 +13,20 @@
|
||||
*/
|
||||
package com.mysema.query.sql;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.*;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.mysema.commons.lang.Pair;
|
||||
import com.mysema.query.*;
|
||||
import com.mysema.query.JoinExpression;
|
||||
import com.mysema.query.JoinFlag;
|
||||
import com.mysema.query.QueryFlag;
|
||||
import com.mysema.query.QueryFlag.Position;
|
||||
import com.mysema.query.QueryMetadata;
|
||||
import com.mysema.query.sql.types.Null;
|
||||
import com.mysema.query.support.Expressions;
|
||||
import com.mysema.query.support.SerializerBase;
|
||||
@ -268,7 +272,7 @@ public class SQLSerializer extends SerializerBase<SQLSerializer> {
|
||||
append(templates.getFrom());
|
||||
append("(");
|
||||
append(templates.getSelect());
|
||||
append("1 ");
|
||||
append("1 as one ");
|
||||
suffix = ") internal";
|
||||
}
|
||||
|
||||
|
||||
@ -34,6 +34,9 @@ import com.mysema.query.types.Path;
|
||||
*/
|
||||
public class SQLServer2005Templates extends SQLServerTemplates {
|
||||
|
||||
@SuppressWarnings("FieldNameHidesFieldInSuperclass") //Intentional
|
||||
public static final SQLServer2005Templates DEFAULT = new SQLServer2005Templates();
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder() {
|
||||
@Override
|
||||
|
||||
@ -22,6 +22,9 @@ package com.mysema.query.sql;
|
||||
*/
|
||||
public class SQLServer2008Templates extends SQLServer2005Templates {
|
||||
|
||||
@SuppressWarnings("FieldNameHidesFieldInSuperclass") //Intentional
|
||||
public static final SQLServer2008Templates DEFAULT = new SQLServer2008Templates();
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder() {
|
||||
@Override
|
||||
|
||||
@ -27,6 +27,9 @@ import com.mysema.query.support.Expressions;
|
||||
*/
|
||||
public class SQLServer2012Templates extends SQLServerTemplates {
|
||||
|
||||
@SuppressWarnings("FieldNameHidesFieldInSuperclass") //Intentional
|
||||
public static final SQLServer2012Templates DEFAULT = new SQLServer2012Templates();
|
||||
|
||||
private String topTemplate = "top {0s} ";
|
||||
|
||||
private String limitOffsetTemplate = "\noffset {1} rows fetch next {0} rows only";
|
||||
|
||||
@ -30,6 +30,9 @@ import com.mysema.query.types.Ops;
|
||||
*/
|
||||
public class SQLServerTemplates extends SQLTemplates {
|
||||
|
||||
@SuppressWarnings("FieldNameHidesFieldInSuperclass") //Intentional
|
||||
public static final SQLServerTemplates DEFAULT = new SQLServerTemplates();
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder() {
|
||||
@Override
|
||||
|
||||
@ -112,6 +112,7 @@ public class SQLTemplates extends Templates {
|
||||
|
||||
public static final Expression<?> RECURSIVE = TemplateExpressionImpl.create(Object.class, "");
|
||||
|
||||
@SuppressWarnings("FieldNameHidesFieldInSuperclass") //Intentional
|
||||
public static final SQLTemplates DEFAULT = new SQLTemplates("\"",'\\',false);
|
||||
|
||||
private static final CharMatcher NON_UNDERSCORE_ALPHA_NUMERIC =
|
||||
|
||||
@ -34,6 +34,9 @@ public class SQLiteTemplates extends SQLTemplates {
|
||||
|
||||
private static final DateTimeFormatter timeFormatter = DateTimeFormat.forPattern("HH:mm:ss");
|
||||
|
||||
@SuppressWarnings("FieldNameHidesFieldInSuperclass") //Intentional
|
||||
public static final SQLiteTemplates DEFAULT = new SQLiteTemplates();
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder() {
|
||||
@Override
|
||||
|
||||
@ -26,6 +26,9 @@ import com.mysema.query.types.Ops;
|
||||
*/
|
||||
public class TeradataTemplates extends SQLTemplates {
|
||||
|
||||
@SuppressWarnings("FieldNameHidesFieldInSuperclass") //Intentional
|
||||
public static final TeradataTemplates DEFAULT = new TeradataTemplates();
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder() {
|
||||
@Override
|
||||
|
||||
@ -24,6 +24,9 @@ import com.mysema.query.sql.SQLTemplates;
|
||||
*/
|
||||
public class GeoDBTemplates extends H2Templates {
|
||||
|
||||
@SuppressWarnings("FieldNameHidesFieldInSuperclass") //Intentional
|
||||
public static final GeoDBTemplates DEFAULT = new GeoDBTemplates();
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder() {
|
||||
@Override
|
||||
|
||||
@ -25,6 +25,9 @@ import com.mysema.query.sql.SQLTemplates;
|
||||
*/
|
||||
public class MySQLSpatialTemplates extends MySQLTemplates {
|
||||
|
||||
@SuppressWarnings("FieldNameHidesFieldInSuperclass") //Intentional
|
||||
public static final MySQLSpatialTemplates DEFAULT = new MySQLSpatialTemplates();
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder() {
|
||||
@Override
|
||||
|
||||
@ -22,6 +22,9 @@ import com.mysema.query.sql.SQLTemplates;
|
||||
*/
|
||||
public class OracleSpatialTemplates extends OracleTemplates {
|
||||
|
||||
@SuppressWarnings("FieldNameHidesFieldInSuperclass") //Intentional
|
||||
public static final OracleSpatialTemplates DEFAULT = new OracleSpatialTemplates();
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder() {
|
||||
@Override
|
||||
|
||||
@ -25,6 +25,9 @@ import com.mysema.query.sql.SQLTemplates;
|
||||
*/
|
||||
public class PostGISTemplates extends PostgresTemplates {
|
||||
|
||||
@SuppressWarnings("FieldNameHidesFieldInSuperclass") //Intentional
|
||||
public static final PostGISTemplates DEFAULT = new PostGISTemplates();
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder() {
|
||||
@Override
|
||||
|
||||
@ -25,6 +25,9 @@ import com.mysema.query.sql.SQLTemplates;
|
||||
*/
|
||||
public class SQLServer2008SpatialTemplates extends SQLServer2008Templates {
|
||||
|
||||
@SuppressWarnings("FieldNameHidesFieldInSuperclass") //Intentional
|
||||
public static final SQLServer2008SpatialTemplates DEFAULT = new SQLServer2008SpatialTemplates();
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder() {
|
||||
@Override
|
||||
|
||||
@ -27,6 +27,9 @@ import com.mysema.query.sql.types.StringAsObjectType;
|
||||
*/
|
||||
public class TeradataSpatialTemplates extends TeradataTemplates {
|
||||
|
||||
@SuppressWarnings("FieldNameHidesFieldInSuperclass") //Intentional
|
||||
public static final TeradataSpatialTemplates DEFAULT = new TeradataSpatialTemplates();
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder() {
|
||||
@Override
|
||||
|
||||
@ -13,10 +13,22 @@
|
||||
*/
|
||||
package com.mysema.query;
|
||||
|
||||
import static com.mysema.query.Constants.survey;
|
||||
import static com.mysema.query.Constants.survey2;
|
||||
import static com.mysema.query.Target.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.mysema.query.QueryFlag.Position;
|
||||
import com.mysema.query.sql.SQLSubQuery;
|
||||
import com.mysema.query.sql.dml.DefaultMapper;
|
||||
@ -29,16 +41,6 @@ import com.mysema.query.types.PathImpl;
|
||||
import com.mysema.query.types.expr.Param;
|
||||
import com.mysema.testutil.ExcludeIn;
|
||||
import com.mysema.testutil.IncludeIn;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import static com.mysema.query.Constants.survey;
|
||||
import static com.mysema.query.Constants.survey2;
|
||||
import static com.mysema.query.Target.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class InsertBase extends AbstractBaseTest {
|
||||
|
||||
@ -435,7 +437,7 @@ public class InsertBase extends AbstractBaseTest {
|
||||
public void XML() {
|
||||
delete(QXmlTest.xmlTest).execute();
|
||||
QXmlTest xmlTest = QXmlTest.xmlTest;
|
||||
String contents = "<html><head></head><body></body></html>";
|
||||
String contents = "<html><head>a</head><body>b</body></html>";
|
||||
insert(xmlTest).set(xmlTest.col, contents).execute();
|
||||
assertEquals(contents, query().from(xmlTest).singleResult(xmlTest.col));
|
||||
}
|
||||
|
||||
@ -28,6 +28,7 @@ import org.joda.time.DateTime;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.joda.time.LocalDateTime;
|
||||
import org.joda.time.LocalTime;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
@ -51,8 +52,6 @@ import com.mysema.query.types.template.NumberTemplate;
|
||||
import com.mysema.testutil.ExcludeIn;
|
||||
import com.mysema.testutil.IncludeIn;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
public class SelectBase extends AbstractBaseTest {
|
||||
|
||||
private static final Expression<?>[] NO_EXPRESSIONS = new Expression[0];
|
||||
@ -628,7 +627,7 @@ public class SelectBase extends AbstractBaseTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@ExcludeIn({FIREBIRD})
|
||||
@ExcludeIn({FIREBIRD, SQLSERVER})
|
||||
public void GroupBy_Distinct_Count() {
|
||||
List<Integer> ids = query().from(employee).groupBy(employee.id).distinct().list(NumberTemplate.ONE);
|
||||
SearchResults<Integer> results = query().from(employee).groupBy(employee.id)
|
||||
|
||||
@ -1,18 +1,20 @@
|
||||
package com.mysema.query;
|
||||
|
||||
import static com.mysema.query.Constants.employee;
|
||||
import static com.mysema.query.Target.ORACLE;
|
||||
import static com.mysema.query.sql.oracle.OracleGrammar.level;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.mysema.query.sql.SQLExpressions;
|
||||
import com.mysema.query.sql.SQLSerializer;
|
||||
import com.mysema.query.sql.domain.QEmployee;
|
||||
import com.mysema.query.sql.oracle.OracleQuery;
|
||||
import com.mysema.testutil.IncludeIn;
|
||||
import junit.framework.Assert;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import static com.mysema.query.Constants.employee;
|
||||
import static com.mysema.query.Target.ORACLE;
|
||||
import static com.mysema.query.sql.oracle.OracleGrammar.level;
|
||||
|
||||
public class SelectOracleBase extends AbstractBaseTest {
|
||||
|
||||
|
||||
@ -15,7 +15,9 @@ package com.mysema.query.sql;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class TemplatesTest {
|
||||
import com.mysema.query.TemplatesTestBase;
|
||||
|
||||
public class TemplatesTest extends TemplatesTestBase {
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user