Skip to content

Commit

Permalink
#106 moving codegen logic
Browse files Browse the repository at this point in the history
  • Loading branch information
timowest committed Apr 5, 2012
1 parent 0a87f1d commit c68789f
Show file tree
Hide file tree
Showing 33 changed files with 81 additions and 259 deletions.
7 changes: 6 additions & 1 deletion querydsl-jpa-codegen/pom.xml
Expand Up @@ -68,7 +68,12 @@
<artifactId>querydsl-codegen</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<dependency>
<groupId>com.mysema.querydsl</groupId>
<artifactId>querydsl-jpa</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>com.mysema.querydsl</groupId>
<artifactId>querydsl-jpa</artifactId>
<version>${project.parent.version}</version>
Expand Down
Expand Up @@ -23,6 +23,8 @@
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.project.MavenProject;

import com.mysema.query.codegen.*;
import com.mysema.query.sql.codegen.*;
import com.mysema.query.sql.Configuration;
import com.mysema.query.sql.SQLTemplates;
import com.mysema.query.sql.types.Type;
Expand Down
Expand Up @@ -20,6 +20,7 @@ import com.mysema.codegen.model._
import com.mysema.query.codegen._
import com.mysema.query.scala.ScalaEntitySerializer
import com.mysema.query.sql._
import com.mysema.query.sql.codegen._
import com.mysema.query.sql.support._
import java.util._
import scala.collection.JavaConversions._
Expand Down
Expand Up @@ -20,6 +20,7 @@ import com.mysema.query.scala.CompileTestUtils
import com.mysema.query.scala.ScalaBeanSerializer
import com.mysema.query.scala.ScalaTypeMappings

import com.mysema.query.sql.codegen._
import com.mysema.query.sql.dml._
import com.mysema.query.scala.Helpers._

Expand Down
@@ -1,11 +1,12 @@
package com.mysema.query.scala.sql

import org.apache.commons.lang3.StringUtils
import com.mysema.codegen._;
import com.mysema.codegen.model._;
import com.mysema.codegen._
import com.mysema.codegen.model._

import com.mysema.query.codegen._;
import com.mysema.query.codegen._
import com.mysema.query.sql._
import com.mysema.query.sql.codegen._

import java.io.StringWriter;

Expand Down
Expand Up @@ -6,6 +6,7 @@ import com.mysema.codegen.model._;

import com.mysema.query.codegen._;
import com.mysema.query.sql._
import com.mysema.query.sql.codegen._

import java.io.StringWriter;

Expand Down
Expand Up @@ -22,9 +22,9 @@
import org.apache.tools.ant.Task;

import com.mysema.query.codegen.BeanSerializer;
import com.mysema.query.sql.DefaultNamingStrategy;
import com.mysema.query.sql.MetaDataExporter;
import com.mysema.query.sql.NamingStrategy;
import com.mysema.query.sql.codegen.DefaultNamingStrategy;
import com.mysema.query.sql.codegen.MetaDataExporter;
import com.mysema.query.sql.codegen.NamingStrategy;

/**
* AntMetaDataExporter exports JDBC metadata to Querydsl query types
Expand Down
Expand Up @@ -11,7 +11,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.mysema.query.sql;
package com.mysema.query.sql.codegen;

import com.mysema.query.codegen.EntityType;
import com.mysema.util.JavaSyntaxUtils;
Expand Down
Expand Up @@ -11,7 +11,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.mysema.query.sql;
package com.mysema.query.sql.codegen;

import java.util.Locale;

Expand Down
Expand Up @@ -11,7 +11,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.mysema.query.sql;
package com.mysema.query.sql.codegen;

import java.io.IOException;
import java.util.ArrayList;
Expand Down
Expand Up @@ -11,7 +11,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.mysema.query.sql;
package com.mysema.query.sql.codegen;

import java.util.regex.Pattern;

Expand Down
Expand Up @@ -11,7 +11,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.mysema.query.sql;
package com.mysema.query.sql.codegen;

import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
Expand Down
Expand Up @@ -11,7 +11,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.mysema.query.sql;
package com.mysema.query.sql.codegen;

import java.io.File;
import java.io.IOException;
Expand Down
Expand Up @@ -11,7 +11,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.mysema.query.sql;
package com.mysema.query.sql.codegen;

import static com.mysema.codegen.Symbols.NEW;

Expand Down
Expand Up @@ -11,7 +11,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.mysema.query.sql;
package com.mysema.query.sql.codegen;

import com.mysema.query.codegen.EntityType;

Expand Down
Expand Up @@ -11,7 +11,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.mysema.query.sql;
package com.mysema.query.sql.codegen;

import org.apache.commons.lang3.StringUtils;

Expand Down
Expand Up @@ -11,7 +11,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.mysema.query.sql;
package com.mysema.query.sql.codegen;

import com.mysema.query.codegen.CodegenModule;
import com.mysema.query.codegen.QueryTypeFactory;
Expand Down
Expand Up @@ -11,7 +11,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.mysema.query.sql;
package com.mysema.query.sql.codegen;

import javax.inject.Inject;
import javax.inject.Named;
Expand Down
Expand Up @@ -20,9 +20,9 @@
import org.junit.Test;
import org.junit.runner.RunWith;

import com.mysema.query.sql.DefaultNamingStrategy;
import com.mysema.query.sql.MetaDataExporter;
import com.mysema.query.sql.NamingStrategy;
import com.mysema.query.sql.codegen.DefaultNamingStrategy;
import com.mysema.query.sql.codegen.MetaDataExporter;
import com.mysema.query.sql.codegen.NamingStrategy;
import com.mysema.testutil.FilteringTestRunner;

@RunWith(FilteringTestRunner.class)
Expand Down
Expand Up @@ -11,7 +11,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.mysema.query.sql;
package com.mysema.query.sql.codegen;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
Expand All @@ -26,6 +26,15 @@

import com.mysema.query.AbstractJDBCTest;
import com.mysema.query.alias.Gender;
import com.mysema.query.sql.Configuration;
import com.mysema.query.sql.EncryptedString;
import com.mysema.query.sql.HSQLDBTemplates;
import com.mysema.query.sql.QPerson;
import com.mysema.query.sql.SQLQuery;
import com.mysema.query.sql.SQLQueryImpl;
import com.mysema.query.sql.codegen.DefaultNamingStrategy;
import com.mysema.query.sql.codegen.MetaDataExporter;
import com.mysema.query.sql.codegen.NamingStrategy;
import com.mysema.query.sql.dml.SQLInsertClause;
import com.mysema.query.sql.dml.SQLUpdateClause;
import com.mysema.query.sql.types.EnumByNameType;
Expand Down
Expand Up @@ -11,7 +11,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.mysema.query.sql;
package com.mysema.query.sql.codegen;

import static org.junit.Assert.assertEquals;

Expand All @@ -20,6 +20,8 @@

import com.mysema.codegen.model.Types;
import com.mysema.query.codegen.EntityType;
import com.mysema.query.sql.codegen.DefaultNamingStrategy;
import com.mysema.query.sql.codegen.NamingStrategy;

public class DefaultNamingStrategyTest {

Expand Down
Expand Up @@ -11,7 +11,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.mysema.query.sql;
package com.mysema.query.sql.codegen;

import static org.junit.Assert.assertEquals;

Expand All @@ -20,6 +20,8 @@

import com.mysema.codegen.model.Types;
import com.mysema.query.codegen.EntityType;
import com.mysema.query.sql.codegen.ExtendedNamingStrategy;
import com.mysema.query.sql.codegen.NamingStrategy;

public class ExtendedNamingStrategyTest {

Expand Down
Expand Up @@ -11,7 +11,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.mysema.query.sql;
package com.mysema.query.sql.codegen;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
Expand All @@ -23,6 +23,8 @@
import org.junit.Test;

import com.mysema.query.AbstractJDBCTest;
import com.mysema.query.sql.codegen.DefaultNamingStrategy;
import com.mysema.query.sql.codegen.KeyDataFactory;
import com.mysema.query.sql.support.ForeignKeyData;
import com.mysema.query.sql.support.InverseForeignKeyData;
import com.mysema.query.sql.support.PrimaryKeyData;
Expand Down
Expand Up @@ -11,7 +11,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.mysema.query.sql;
package com.mysema.query.sql.codegen;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
Expand Down Expand Up @@ -40,6 +40,10 @@
import com.mysema.codegen.SimpleCompiler;
import com.mysema.query.codegen.BeanSerializer;
import com.mysema.query.codegen.Serializer;
import com.mysema.query.sql.codegen.DefaultNamingStrategy;
import com.mysema.query.sql.codegen.MetaDataExporter;
import com.mysema.query.sql.codegen.NamingStrategy;
import com.mysema.query.sql.codegen.OriginalNamingStrategy;

public class MetaDataExporterTest {

Expand Down
Expand Up @@ -11,7 +11,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.mysema.query.sql;
package com.mysema.query.sql.codegen;

import java.io.File;
import java.sql.SQLException;
Expand All @@ -26,6 +26,9 @@

import com.mysema.codegen.SimpleCompiler;
import com.mysema.query.AbstractJDBCTest;
import com.mysema.query.sql.codegen.DefaultNamingStrategy;
import com.mysema.query.sql.codegen.MetaDataExporter;
import com.mysema.query.sql.codegen.NamingStrategy;

public class MetaDataSerializerTest extends AbstractJDBCTest{

Expand Down
Expand Up @@ -11,7 +11,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.mysema.query.sql;
package com.mysema.query.sql.codegen;

import static org.junit.Assert.assertEquals;

Expand All @@ -22,6 +22,8 @@
import com.mysema.codegen.model.Type;
import com.mysema.codegen.model.TypeCategory;
import com.mysema.query.codegen.EntityType;
import com.mysema.query.sql.codegen.DefaultNamingStrategy;
import com.mysema.query.sql.codegen.NamingStrategy;

public class MetaDataTest {

Expand Down
Expand Up @@ -11,14 +11,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.mysema.query.sql;
package com.mysema.query.sql.codegen;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

import com.mysema.codegen.model.Types;
import com.mysema.query.codegen.EntityType;
import com.mysema.query.sql.codegen.NamingStrategy;
import com.mysema.query.sql.codegen.OriginalNamingStrategy;

public class OriginalNamingStrategyTest {

Expand Down
30 changes: 15 additions & 15 deletions querydsl-sql/src/test/java/com/mysema/query/Connections.java
Expand Up @@ -120,30 +120,30 @@ private static Connection getSQLServer() throws ClassNotFoundException, SQLExcep
return DriverManager.getConnection(url, "querydsl","querydsl");
}

private static CreateTableClause createTable(SQLTemplates templates, String table){
return new CreateTableClause(connHolder.get(), templates, table);
}
// private static CreateTableClause createTable(SQLTemplates templates, String table){
// return new CreateTableClause(connHolder.get(), templates, table);
// }

private static void dropTable(SQLTemplates templates, String table){
new DropTableClause(connHolder.get(), templates, table).execute();
// new DropTableClause(connHolder.get(), templates, table).execute();
}

public static Statement getStatement(){
return stmtHolder.get();
}

private static void createEmployeeTable(SQLTemplates templates) {
createTable(templates, "EMPLOYEE")
.column("ID", Integer.class)
.column("FIRSTNAME", String.class).size(50)
.column("LASTNAME", String.class).size(50)
.column("SALARY",Double.class)
.column("DATEFIELD",Date.class)
.column("TIMEFIELD",Time.class)
.column("SUPERIOR_ID",Integer.class)
.primaryKey("PK_EMPLOYEE", "ID")
.foreignKey("FK_SUPERIOR","SUPERIOR_ID").references("EMPLOYEE","ID")
.execute();
// createTable(templates, "EMPLOYEE")
// .column("ID", Integer.class)
// .column("FIRSTNAME", String.class).size(50)
// .column("LASTNAME", String.class).size(50)
// .column("SALARY",Double.class)
// .column("DATEFIELD",Date.class)
// .column("TIMEFIELD",Time.class)
// .column("SUPERIOR_ID",Integer.class)
// .primaryKey("PK_EMPLOYEE", "ID")
// .foreignKey("FK_SUPERIOR","SUPERIOR_ID").references("EMPLOYEE","ID")
// .execute();
}

public static void initDerby() throws SQLException, ClassNotFoundException{
Expand Down

0 comments on commit c68789f

Please sign in to comment.