Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/sql/SQLModelTransformer.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/sql/SQLModelTransformer.java?rev=1839288&r1=1839287&r2=1839288&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/sql/SQLModelTransformer.java (original) +++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/sql/SQLModelTransformer.java Mon Aug 27 09:48:33 2018 @@ -62,7 +62,7 @@ public class SQLModelTransformer impleme * @see LoadExternalSchemaTransformer */ private static final LoadExternalSchemaTransformer loadExternalSchemaTransformer - = new LoadExternalSchemaTransformer(); + = new LoadExternalSchemaTransformer(); /** * The transformer which includes the included schemata. @@ -70,21 +70,22 @@ public class SQLModelTransformer impleme * @see LoadExternalSchemaTransformer */ private static final IncludeSchemaTransformer includeSchemaTransformer - = new IncludeSchemaTransformer(); + = new IncludeSchemaTransformer(); - public Database transform( + @Override + public Database transform( final Object databaseModel, final ControllerState controllerState) - throws SourceTransformerException + throws SourceTransformerException { - final Database database = (Database) databaseModel; - OMTransformer.setRootDatabaseName(database); - // include included schemata - includeSchemaTransformer.transform(database, controllerState); - // load referenced external schemata - loadExternalSchemaTransformer.transform(database, controllerState); + final Database database = (Database) databaseModel; + OMTransformer.setRootDatabaseName(database); + // include included schemata + includeSchemaTransformer.transform(database, controllerState); + // load referenced external schemata + loadExternalSchemaTransformer.transform(database, controllerState); - TemplateOptionName.checkRequiredOptions( + TemplateOptionName.checkRequiredOptions( controllerState, TemplateOptionName.DATABASE); @@ -100,13 +101,13 @@ public class SQLModelTransformer impleme final Table table, final Database database, final ControllerState controllerState) - throws SourceTransformerException + throws SourceTransformerException { table.unqualifiedName = table.name; if (StringUtils.contains(table.name, ".")) { table.unqualifiedName - = table.name.substring(table.name.indexOf(".") + 1); + = table.name.substring(table.name.indexOf(".") + 1); } if (table.idMethod == null) @@ -247,7 +248,7 @@ public class SQLModelTransformer impleme private String getDdlSql( final Column column, final ControllerState controllerState) - throws SourceTransformerException + throws SourceTransformerException { final SchemaType schemaType = SchemaTypeHelper.getSchemaType( column, @@ -264,7 +265,7 @@ public class SQLModelTransformer impleme column._default); final Platform platform = getPlatform(controllerState); - final List<String> resultList = new ArrayList<String>(); + final List<String> resultList = new ArrayList<>(); String sqlTypeName = sqlType.getSqlTypeName(); @@ -291,8 +292,8 @@ public class SQLModelTransformer impleme else { final Date defaultDate - = OMColumnTransformer.getDefaultValueAsDate( - sqlType.getDefaultValue()); + = OMColumnTransformer.getDefaultValueAsDate( + sqlType.getDefaultValue()); if (SchemaType.DATE == schemaType) { resultList.add(platform.getDateString(defaultDate)); @@ -325,7 +326,7 @@ public class SQLModelTransformer impleme final String isNotNullString = platform.getNullString(isNotNull); if (platform.createNotNullBeforeAutoincrement() - && StringUtils.isNotEmpty(isNotNullString)) + && StringUtils.isNotEmpty(isNotNullString)) { resultList.add(isNotNullString); } @@ -408,7 +409,7 @@ public class SQLModelTransformer impleme if (StringUtils.contains(table.name, '.')) { final String databaseSchema - = table.name.substring(0, table.name.indexOf('.')); + = table.name.substring(0, table.name.indexOf('.')); if (!database.schemaNameList.contains(databaseSchema)) { database.schemaNameList.add(databaseSchema); @@ -430,7 +431,7 @@ public class SQLModelTransformer impleme private void transformEnumValue( final EnumValue enumValue, final ControllerState controllerState) - throws SourceTransformerException + throws SourceTransformerException { if (enumValue.sqlValue != null) { @@ -447,7 +448,7 @@ public class SQLModelTransformer impleme || SchemaType.TIMESTAMP == schemaType)) { Date defaultDate - = OMColumnTransformer.getDefaultValueAsDate(enumValue.value); + = OMColumnTransformer.getDefaultValueAsDate(enumValue.value); if (SchemaType.DATE == schemaType) { enumValue.sqlValue = platform.getDateString(defaultDate);
Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/sql/SQLTransformer.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/sql/SQLTransformer.java?rev=1839288&r1=1839287&r2=1839288&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/sql/SQLTransformer.java (original) +++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/sql/SQLTransformer.java Mon Aug 27 09:48:33 2018 @@ -55,7 +55,7 @@ public class SQLTransformer implements S { /** A CollectAttributeSetTrueTransformer instance. */ private static final CollectAttributeSetTrueTransformer collectAttributeSetTrueTransformer - = new CollectAttributeSetTrueTransformer(); + = new CollectAttributeSetTrueTransformer(); /** * The transformer which loads the external schemata. @@ -63,7 +63,7 @@ public class SQLTransformer implements S * @see LoadExternalSchemaTransformer */ private static final SourceTransformer loadExternalSchemaTransformer - = new LoadExternalSchemaTransformer(); + = new LoadExternalSchemaTransformer(); /** * The transformer which includes the included schemata. @@ -71,27 +71,28 @@ public class SQLTransformer implements S * @see LoadExternalSchemaTransformer */ private static final SourceTransformer includeSchemaTransformer - = new IncludeSchemaTransformer(); + = new IncludeSchemaTransformer(); - public SourceElement transform( + @Override + public SourceElement transform( Object databaseModel, ControllerState controllerState) - throws SourceTransformerException + throws SourceTransformerException { - SourceElement databaseElement = (SourceElement) databaseModel; - OMTransformer.setRootDatabaseNameAttribute(databaseElement); - // include included schemata - includeSchemaTransformer.transform(databaseElement, controllerState); - // load referenced external schemata - loadExternalSchemaTransformer.transform(databaseElement, controllerState); + SourceElement databaseElement = (SourceElement) databaseModel; + OMTransformer.setRootDatabaseNameAttribute(databaseElement); + // include included schemata + includeSchemaTransformer.transform(databaseElement, controllerState); + // load referenced external schemata + loadExternalSchemaTransformer.transform(databaseElement, controllerState); - TemplateOptionName.checkRequiredOptions( + TemplateOptionName.checkRequiredOptions( controllerState, TemplateOptionName.DATABASE); - List<SourceElement> allTables - = databaseElement.getChild(DatabaseChildElementName.ALL_TABLES) - .getChildren(TorqueSchemaElementName.TABLE); + List<SourceElement> allTables + = databaseElement.getChild(DatabaseChildElementName.ALL_TABLES) + .getChildren(TorqueSchemaElementName.TABLE); for (SourceElement tableElement : allTables) { transformTable(tableElement, controllerState); @@ -103,7 +104,7 @@ public class SQLTransformer implements S public void transformTable( SourceElement tableElement, ControllerState controllerState) - throws SourceTransformerException + throws SourceTransformerException { String tableName = (String) tableElement.getAttribute( TorqueSchemaAttributeName.NAME); @@ -136,7 +137,7 @@ public class SQLTransformer implements S } if (tableElement.getAttribute( SqlAttributeName.PRIMARY_KEY_CONSTRAINT_NAME) - == null) + == null) { String primaryKeyConstraintName = unqualifiedTableName + "_PK"; tableElement.setAttribute( @@ -182,7 +183,7 @@ public class SQLTransformer implements S primaryKeyColumnNames.append(", "); } primaryKeyColumnNames.append(primaryKeyColumn.getAttribute( - TorqueSchemaAttributeName.NAME.getName())); + TorqueSchemaAttributeName.NAME.getName())); firstPk = false; } tableElement.setAttribute( @@ -195,14 +196,14 @@ public class SQLTransformer implements S TorqueSchemaElementName.UNIQUE.getName())) { if (uniqueElement.getAttribute( - TorqueSchemaAttributeName.NAME.getName()) + TorqueSchemaAttributeName.NAME.getName()) == null) { uniqueElement.setAttribute( TorqueSchemaAttributeName.NAME.getName(), uniqueElement.getParent().getAttribute( - TorqueSchemaAttributeName.NAME.getName()) - + "_UQ_" + uniqueIndex); + TorqueSchemaAttributeName.NAME.getName()) + + "_UQ_" + uniqueIndex); } String uniqueColumnNames = collectAttributes( uniqueElement, @@ -226,8 +227,8 @@ public class SQLTransformer implements S indexElement.setAttribute( TorqueSchemaAttributeName.NAME.getName(), indexElement.getParent().getAttribute( - TorqueSchemaAttributeName.NAME.getName()) - + "_IDX_" + indexIndex); + TorqueSchemaAttributeName.NAME.getName()) + + "_IDX_" + indexIndex); } String indexColumnNames = collectAttributes( indexElement, @@ -272,7 +273,7 @@ public class SQLTransformer implements S private void transformColumn( SourceElement columnElement, ControllerState controllerState) - throws SourceTransformerException + throws SourceTransformerException { String sql = (String) columnElement.getAttribute( SqlAttributeName.DDL_SQL); @@ -297,7 +298,7 @@ public class SQLTransformer implements S private String getDdlSql( SourceElement columnElement, ControllerState controllerState) - throws SourceTransformerException + throws SourceTransformerException { SchemaType schemaType = SchemaTypeHelper.getSchemaType( columnElement, @@ -320,7 +321,7 @@ public class SQLTransformer implements S ObjectUtils.toString(defaultValue, null)); Platform platform = getPlatform(controllerState); - List<String> resultList = new ArrayList<String>(); + List<String> resultList = new ArrayList<>(); String sqlTypeName = sqlType.getSqlTypeName(); @@ -347,8 +348,8 @@ public class SQLTransformer implements S else { Date defaultDate - = OMColumnTransformer.getDefaultValueAsDate( - sqlType.getDefaultValue()); + = OMColumnTransformer.getDefaultValueAsDate( + sqlType.getDefaultValue()); if (SchemaType.DATE == schemaType) { resultList.add(platform.getDateString(defaultDate)); @@ -391,7 +392,7 @@ public class SQLTransformer implements S String isNotNullString = platform.getNullString(isNotNull); if (platform.createNotNullBeforeAutoincrement() - && StringUtils.isNotEmpty(isNotNullString)) + && StringUtils.isNotEmpty(isNotNullString)) { resultList.add(isNotNullString); } @@ -439,14 +440,14 @@ public class SQLTransformer implements S int fkIndex) { if (foreignKeyElement.getAttribute( - TorqueSchemaAttributeName.NAME.getName()) + TorqueSchemaAttributeName.NAME.getName()) == null) { foreignKeyElement.setAttribute( TorqueSchemaAttributeName.NAME.getName(), foreignKeyElement.getParent().getAttribute( - TorqueSchemaAttributeName.NAME.getName()) - + "_FK_" + fkIndex); + TorqueSchemaAttributeName.NAME.getName()) + + "_FK_" + fkIndex); } String localColumnsNames = collectAttributes( foreignKeyElement, @@ -473,10 +474,10 @@ public class SQLTransformer implements S { return; } - List<String> databaseSchemaNames = new ArrayList<String>(); + List<String> databaseSchemaNames = new ArrayList<>(); List<SourceElement> allTables - = databaseElement.getChild(DatabaseChildElementName.ALL_TABLES) - .getChildren(TorqueSchemaElementName.TABLE); + = databaseElement.getChild(DatabaseChildElementName.ALL_TABLES) + .getChildren(TorqueSchemaElementName.TABLE); for (SourceElement tableElement : allTables) { String name = (String) @@ -493,7 +494,7 @@ public class SQLTransformer implements S for (String databaseSchemaName : databaseSchemaNames) { SourceElement databaseSchemaElement - = new SourceElement("databaseSchema"); + = new SourceElement("databaseSchema"); databaseSchemaElement.setAttribute("name", databaseSchemaName); databaseElement.getChildren().add(databaseSchemaElement); } Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/sql/SqlAttributeName.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/sql/SqlAttributeName.java?rev=1839288&r1=1839287&r2=1839288&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/sql/SqlAttributeName.java (original) +++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/sql/SqlAttributeName.java Mon Aug 27 09:48:33 2018 @@ -106,6 +106,7 @@ public enum SqlAttributeName implements * * @return the name of the referenced source element attribute. */ + @Override public String getName() { return name; Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/typemapping/ResultSetGetter.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/typemapping/ResultSetGetter.java?rev=1839288&r1=1839287&r2=1839288&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/typemapping/ResultSetGetter.java (original) +++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/typemapping/ResultSetGetter.java Mon Aug 27 09:48:33 2018 @@ -101,6 +101,7 @@ public enum ResultSetGetter * * @return the method name, not null. */ + @Override public String toString() { return method; Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/typemapping/TypeMap.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/typemapping/TypeMap.java?rev=1839288&r1=1839287&r2=1839288&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/typemapping/TypeMap.java (original) +++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/typemapping/TypeMap.java Mon Aug 27 09:48:33 2018 @@ -76,7 +76,7 @@ public final class TypeMap static { - Set<SchemaType> textTypes = new HashSet<SchemaType>(); + Set<SchemaType> textTypes = new HashSet<>(); textTypes.add(SchemaType.CHAR); textTypes.add(SchemaType.VARCHAR); textTypes.add(SchemaType.LONGVARCHAR); @@ -98,10 +98,10 @@ public final class TypeMap public static final String CLOB_OBJECT_TYPE = "\"\""; /** A sample java object for NUMERIC columns. */ public static final String NUMERIC_OBJECT_TYPE - = "new java.math.BigDecimal((double) 0)"; + = "new java.math.BigDecimal((double) 0)"; /** A sample java object for DECIMAL columns. */ public static final String DECIMAL_OBJECT_TYPE - = "new java.math.BigDecimal((double) 0)"; + = "new java.math.BigDecimal((double) 0)"; /** A sample java object for BIT columns. */ public static final String BIT_OBJECT_TYPE = "Boolean.TRUE"; /** A sample java object for TINYINT columns. */ @@ -142,32 +142,32 @@ public final class TypeMap * for that schema type. */ private static final Map<SchemaType, String> - SCHEMA_TYPE_TO_INIT_VALUE_MAP; + SCHEMA_TYPE_TO_INIT_VALUE_MAP; /** * The default Mapping of schema Types to Java Types. Where possible, * primitive types are used. */ private static final Map<SchemaType, JavaType> - SCHEMA_TYPE_TO_JAVA_PRIMITIVE_TYPE_MAP; + SCHEMA_TYPE_TO_JAVA_PRIMITIVE_TYPE_MAP; /** * The default Mapping of schema Types to Java Types. * No primitive types are used. */ private static final Map<SchemaType, JavaType> - SCHEMA_TYPE_TO_JAVA_OBJECT_TYPE_MAP; + SCHEMA_TYPE_TO_JAVA_OBJECT_TYPE_MAP; /** * The result set getter methods for a given schema type. */ private static final Map<SchemaType, ResultSetGetter> - SCHEMA_TYPE_TO_RESULT_SET_GETTER; + SCHEMA_TYPE_TO_RESULT_SET_GETTER; // fill SCHEMA_TYPE_TO_INIT_VALUE_MAP static { Map<SchemaType, String> schemaToInitValue - = new HashMap<SchemaType, String>(); + = new HashMap<>(); schemaToInitValue.put(SchemaType.CHAR, CHAR_OBJECT_TYPE); schemaToInitValue.put(SchemaType.VARCHAR, VARCHAR_OBJECT_TYPE); @@ -193,14 +193,14 @@ public final class TypeMap schemaToInitValue.put(SchemaType.BOOLEANCHAR, BOOLEANCHAR_OBJECT_TYPE); schemaToInitValue.put(SchemaType.BOOLEANINT, BOOLEANINT_OBJECT_TYPE); SCHEMA_TYPE_TO_INIT_VALUE_MAP - = Collections.unmodifiableMap(schemaToInitValue); + = Collections.unmodifiableMap(schemaToInitValue); } // Fill SCHEMA_TYPE_TO_JAVA_PRIMITIVE_TYPE_MAP static { Map<SchemaType, JavaType> schemaToJava - = new HashMap<SchemaType, JavaType>(); + = new HashMap<>(); schemaToJava.put(SchemaType.CHAR, JavaType.STRING); schemaToJava.put(SchemaType.VARCHAR, JavaType.STRING); schemaToJava.put(SchemaType.LONGVARCHAR, JavaType.STRING); @@ -225,7 +225,7 @@ public final class TypeMap schemaToJava.put(SchemaType.BOOLEANCHAR, JavaType.BOOLEAN_PRIMITIVE); schemaToJava.put(SchemaType.BOOLEANINT, JavaType.BOOLEAN_PRIMITIVE); SCHEMA_TYPE_TO_JAVA_PRIMITIVE_TYPE_MAP - = Collections.unmodifiableMap(schemaToJava); + = Collections.unmodifiableMap(schemaToJava); } @@ -233,7 +233,7 @@ public final class TypeMap static { Map<SchemaType, JavaType> schemaToJava - = new HashMap<SchemaType, JavaType>(); + = new HashMap<>(); schemaToJava.put(SchemaType.CHAR, JavaType.STRING); schemaToJava.put(SchemaType.VARCHAR, JavaType.STRING); schemaToJava.put(SchemaType.LONGVARCHAR, JavaType.STRING); @@ -258,13 +258,13 @@ public final class TypeMap schemaToJava.put(SchemaType.BOOLEANCHAR, JavaType.BOOLEAN_OBJECT); schemaToJava.put(SchemaType.BOOLEANINT, JavaType.BOOLEAN_OBJECT); SCHEMA_TYPE_TO_JAVA_OBJECT_TYPE_MAP - = Collections.unmodifiableMap(schemaToJava); + = Collections.unmodifiableMap(schemaToJava); } static { Map<SchemaType, ResultSetGetter> schemaToResultSetGetter - = new HashMap<SchemaType, ResultSetGetter>(); + = new HashMap<>(); schemaToResultSetGetter.put(SchemaType.CHAR, ResultSetGetter.STRING); schemaToResultSetGetter.put(SchemaType.VARCHAR, ResultSetGetter.STRING); @@ -290,7 +290,7 @@ public final class TypeMap schemaToResultSetGetter.put(SchemaType.BOOLEANCHAR, ResultSetGetter.STRING); schemaToResultSetGetter.put(SchemaType.BOOLEANINT, ResultSetGetter.INT); SCHEMA_TYPE_TO_RESULT_SET_GETTER - = Collections.unmodifiableMap(schemaToResultSetGetter); + = Collections.unmodifiableMap(schemaToResultSetGetter); } /** Modified: db/torque/torque4/trunk/torque-templates/src/test/java/org/apache/torque/templates/GenerateOmClassesFromJavaTest.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/test/java/org/apache/torque/templates/GenerateOmClassesFromJavaTest.java?rev=1839288&r1=1839287&r2=1839288&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-templates/src/test/java/org/apache/torque/templates/GenerateOmClassesFromJavaTest.java (original) +++ db/torque/torque4/trunk/torque-templates/src/test/java/org/apache/torque/templates/GenerateOmClassesFromJavaTest.java Mon Aug 27 09:48:33 2018 @@ -48,41 +48,41 @@ import org.junit.Test; */ public class GenerateOmClassesFromJavaTest { - @Test - public void generateOMClassesFromJava() throws Exception - { - Controller controller = new Controller(); - List<UnitDescriptor> unitDescriptors = new ArrayList<UnitDescriptor>(); + @Test + public void generateOMClassesFromJava() throws Exception + { + Controller controller = new Controller(); + List<UnitDescriptor> unitDescriptors = new ArrayList<>(); - Map<String, String> overrideOptions = new HashMap<String, String>(); - overrideOptions.put("torque.om.package", "org.apache.torque.templates.test"); + Map<String, String> overrideOptions = new HashMap<>(); + overrideOptions.put("torque.om.package", "org.apache.torque.templates.test"); - CustomProjectPaths projectPaths - = new CustomProjectPaths( - new Maven2DirectoryProjectPaths(new File("."))); - projectPaths.setConfigurationPackage("org.apache.torque.templates.om"); - projectPaths.setConfigurationDir(null); - projectPaths.setSourceDir(new File("src/test/simple-schema")); - projectPaths.setOutputDirectory( - null, - new File("target/generateOmClassesFromJava/default")); - projectPaths.setOutputDirectory( - Maven2ProjectPaths.MODIFIABLE_OUTPUT_DIR_KEY, - new File("target/generateOmClassesFromJava/modifiable")); - UnitDescriptor unitDescriptor = new UnitDescriptor( - UnitDescriptor.Packaging.CLASSPATH, - projectPaths, - new DefaultTorqueGeneratorPaths()); - unitDescriptor.setOverrideOptions( - new MapOptionsConfiguration(overrideOptions)); - unitDescriptors.add(unitDescriptor); + CustomProjectPaths projectPaths + = new CustomProjectPaths( + new Maven2DirectoryProjectPaths(new File("."))); + projectPaths.setConfigurationPackage("org.apache.torque.templates.om"); + projectPaths.setConfigurationDir(null); + projectPaths.setSourceDir(new File("src/test/simple-schema")); + projectPaths.setOutputDirectory( + null, + new File("target/generateOmClassesFromJava/default")); + projectPaths.setOutputDirectory( + Maven2ProjectPaths.MODIFIABLE_OUTPUT_DIR_KEY, + new File("target/generateOmClassesFromJava/modifiable")); + UnitDescriptor unitDescriptor = new UnitDescriptor( + UnitDescriptor.Packaging.CLASSPATH, + projectPaths, + new DefaultTorqueGeneratorPaths()); + unitDescriptor.setOverrideOptions( + new MapOptionsConfiguration(overrideOptions)); + unitDescriptors.add(unitDescriptor); - controller.run(unitDescriptors); - assertTrue( - new File("target/generateOmClassesFromJava/default/org/apache/torque/templates/test/BaseAPeer.java") - .exists()); - assertTrue( - new File("target/generateOmClassesFromJava/modifiable/org/apache/torque/templates/test/APeer.java") - .exists()); - } + controller.run(unitDescriptors); + assertTrue( + new File("target/generateOmClassesFromJava/default/org/apache/torque/templates/test/BaseAPeer.java") + .exists()); + assertTrue( + new File("target/generateOmClassesFromJava/modifiable/org/apache/torque/templates/test/APeer.java") + .exists()); + } } Modified: db/torque/torque4/trunk/torque-templates/src/test/java/org/apache/torque/templates/TestProcessing.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/test/java/org/apache/torque/templates/TestProcessing.java?rev=1839288&r1=1839287&r2=1839288&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-templates/src/test/java/org/apache/torque/templates/TestProcessing.java (original) +++ db/torque/torque4/trunk/torque-templates/src/test/java/org/apache/torque/templates/TestProcessing.java Mon Aug 27 09:48:33 2018 @@ -64,7 +64,7 @@ public class TestProcessing } { final File generatedSources2Dir - = new File(testRoot, "generated-sources-2"); + = new File(testRoot, "generated-sources-2"); FileUtils.deleteDirectory(generatedSources2Dir); } { @@ -81,8 +81,8 @@ public class TestProcessing public void testOmTemplates() throws Exception { final Controller controller = new Controller(); - final List<UnitDescriptor> unitDescriptors = new ArrayList<UnitDescriptor>(); - final Map<String, String> overrideOptions = new HashMap<String, String>(); + final List<UnitDescriptor> unitDescriptors = new ArrayList<>(); + final Map<String, String> overrideOptions = new HashMap<>(); overrideOptions.put("torque.om.package", "org.apache.torque.test"); overrideOptions.put("torque.om.generateMapInit", "true"); @@ -96,15 +96,15 @@ public class TestProcessing Maven2ProjectPaths.MODIFIABLE_OUTPUT_DIR_KEY, new File("target/generated-sources-2")); final Fileset sourceFileset = new Fileset(); - final Set<String> sourceIncludes = new HashSet<String>(); + final Set<String> sourceIncludes = new HashSet<>(); sourceIncludes.add("schema.xml"); sourceFileset.setIncludes(sourceIncludes); sourceFileset.setBasedir(projectPaths.getDefaultSourcePath()); final SourceProvider sourceProvider - = new FileSourceProvider( - null, - sourceFileset, - null); + = new FileSourceProvider( + null, + sourceFileset, + null); UnitDescriptor unitDescriptor = new UnitDescriptor( UnitDescriptor.Packaging.DIRECTORY, projectPaths, @@ -129,8 +129,8 @@ public class TestProcessing FileUtils.deleteDirectory(generationFolder2); final Controller controller = new Controller(); - final List<UnitDescriptor> unitDescriptors = new ArrayList<UnitDescriptor>(); - final Map<String, String> overrideOptions = new HashMap<String, String>(); + final List<UnitDescriptor> unitDescriptors = new ArrayList<>(); + final Map<String, String> overrideOptions = new HashMap<>(); overrideOptions.put("torque.database", "mysql"); overrideOptions.put("torque.om.package", "org.apache.torque.test"); overrideOptions.put("torque.om.generateMapInit", "true"); @@ -176,8 +176,8 @@ public class TestProcessing FileUtils.deleteDirectory(generationFolder2); final Controller controller = new Controller(); - final List<UnitDescriptor> unitDescriptors = new ArrayList<UnitDescriptor>(); - final Map<String, String> overrideOptions = new HashMap<String, String>(); + final List<UnitDescriptor> unitDescriptors = new ArrayList<>(); + final Map<String, String> overrideOptions = new HashMap<>(); overrideOptions.put("torque.database", "mysql"); // idbroker-init-sql templates @@ -222,8 +222,8 @@ public class TestProcessing FileUtils.deleteDirectory(generationFolder2); final Controller controller = new Controller(); - final List<UnitDescriptor> unitDescriptors = new ArrayList<UnitDescriptor>(); - final Map<String, String> overrideOptions = new HashMap<String, String>(); + final List<UnitDescriptor> unitDescriptors = new ArrayList<>(); + final Map<String, String> overrideOptions = new HashMap<>(); overrideOptions.put("torque.om.package", "org.apache.torque.test"); overrideOptions.put("torque.om.generateMapInit", "true"); @@ -272,8 +272,8 @@ public class TestProcessing FileUtils.deleteDirectory(generationFolder2); final Controller controller = new Controller(); - final List<UnitDescriptor> unitDescriptors = new ArrayList<UnitDescriptor>(); - final Map<String, String> overrideOptions = new HashMap<String, String>(); + final List<UnitDescriptor> unitDescriptors = new ArrayList<>(); + final Map<String, String> overrideOptions = new HashMap<>(); overrideOptions.put("torque.om.package", "org.apache.torque.test"); CustomProjectPaths projectPaths = new CustomProjectPaths( @@ -311,13 +311,13 @@ public class TestProcessing FileUtils.deleteDirectory(generationFolder2); final Controller controller = new Controller(); - final List<UnitDescriptor> unitDescriptors = new ArrayList<UnitDescriptor>(); - final Map<String, String> overrideOptions = new HashMap<String, String>(); + final List<UnitDescriptor> unitDescriptors = new ArrayList<>(); + final Map<String, String> overrideOptions = new HashMap<>(); overrideOptions.put("torque.database", "mysql"); final CustomProjectPaths projectPaths - = new CustomProjectPaths( - new Maven2DirectoryProjectPaths(new File("."))); + = new CustomProjectPaths( + new Maven2DirectoryProjectPaths(new File("."))); projectPaths.setConfigurationDir( new File("src/main/resources/org/apache/torque/templates/sql")); projectPaths.setSourceDir(new File(SCHEMA_DIR)); @@ -341,9 +341,9 @@ public class TestProcessing } private void assertOutput( - final String expectedFilename, - final String actualFilename) - throws IOException + final String expectedFilename, + final String actualFilename) + throws IOException { String expected = IOUtils.toString( getClass().getResourceAsStream(expectedFilename), Modified: db/torque/torque4/trunk/torque-templates/src/test/java/org/apache/torque/templates/jdbc2schema/Jdbc2SchemaTest.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/test/java/org/apache/torque/templates/jdbc2schema/Jdbc2SchemaTest.java?rev=1839288&r1=1839287&r2=1839288&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-templates/src/test/java/org/apache/torque/templates/jdbc2schema/Jdbc2SchemaTest.java (original) +++ db/torque/torque4/trunk/torque-templates/src/test/java/org/apache/torque/templates/jdbc2schema/Jdbc2SchemaTest.java Mon Aug 27 09:48:33 2018 @@ -53,7 +53,7 @@ import org.junit.Test; public class Jdbc2SchemaTest { private static Log log - = LogFactory.getLog(Jdbc2SchemaTest.class); + = LogFactory.getLog(Jdbc2SchemaTest.class); private static String SQL_FILENAME = "jdbc2schemaTest.sql"; @@ -88,20 +88,20 @@ public class Jdbc2SchemaTest queryBuffer.append(line); } StringTokenizer tokenizer - = new StringTokenizer(queryBuffer.toString(), ";", false); + = new StringTokenizer(queryBuffer.toString(), ";", false); while (tokenizer.hasMoreTokens()) { - String sqlQuery = tokenizer.nextToken(); - Statement statement = connection.createStatement(); - try - { - statement.execute(sqlQuery); - } - catch (SQLException e) - { - log.info(e.getMessage()); - } - statement.close(); + String sqlQuery = tokenizer.nextToken(); + Statement statement = connection.createStatement(); + try + { + statement.execute(sqlQuery); + } + catch (SQLException e) + { + log.info(e.getMessage()); + } + statement.close(); } connection.close(); @@ -116,14 +116,14 @@ public class Jdbc2SchemaTest public void testExecute() throws Exception { Controller controller = new Controller(); - List<UnitDescriptor> unitDescriptors = new ArrayList<UnitDescriptor>(); - Map<String, String> overrideOptions = new HashMap<String, String>(); + List<UnitDescriptor> unitDescriptors = new ArrayList<>(); + Map<String, String> overrideOptions = new HashMap<>(); overrideOptions.put("torque.jdbc2schema.url", URL); overrideOptions.put("torque.jdbc2schema.driver", DRIVER); CustomProjectPaths projectPaths - = new CustomProjectPaths( - new Maven2DirectoryProjectPaths(new File("."))); + = new CustomProjectPaths( + new Maven2DirectoryProjectPaths(new File("."))); projectPaths.setConfigurationDir( new File("src/main/resources/org/apache/torque/templates/jdbc2schema")); projectPaths.setOutputDirectory( Modified: db/torque/torque4/trunk/torque-test/src/main/java/org/apache/torque/OptimisticLockingInterface.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/main/java/org/apache/torque/OptimisticLockingInterface.java?rev=1839288&r1=1839287&r2=1839288&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-test/src/main/java/org/apache/torque/OptimisticLockingInterface.java (original) +++ db/torque/torque4/trunk/torque-test/src/main/java/org/apache/torque/OptimisticLockingInterface.java Mon Aug 27 09:48:33 2018 @@ -25,15 +25,15 @@ import org.apache.torque.om.ObjectKey; public interface OptimisticLockingInterface { - public String getName(); + String getName(); - public void setName(String name); + void setName(String name); - public Integer getVersion(); + Integer getVersion(); - public void save() throws TorqueException; + void save() throws TorqueException; - public void save(Connection connection) throws TorqueException; + void save(Connection connection) throws TorqueException; ObjectKey getPrimaryKey(); Modified: db/torque/torque4/trunk/torque-test/src/main/java/org/apache/torque/OptimisticLockingPeerInterface.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/main/java/org/apache/torque/OptimisticLockingPeerInterface.java?rev=1839288&r1=1839287&r2=1839288&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-test/src/main/java/org/apache/torque/OptimisticLockingPeerInterface.java (original) +++ db/torque/torque4/trunk/torque-test/src/main/java/org/apache/torque/OptimisticLockingPeerInterface.java Mon Aug 27 09:48:33 2018 @@ -27,17 +27,17 @@ import org.apache.torque.om.ObjectKey; public interface OptimisticLockingPeerInterface<T> { - public int doUpdate(T toUpdate) throws TorqueException; + int doUpdate(T toUpdate) throws TorqueException; - public int doUpdate(T toUpdate, Connection con) throws TorqueException; + int doUpdate(T toUpdate, Connection con) throws TorqueException; T doSelectSingleRecord(T toSelect) throws TorqueException; T retrieveByPK(ObjectKey key) throws TorqueException; - public int doDelete(T toDelete) throws TorqueException; + int doDelete(T toDelete) throws TorqueException; - public int doDelete(Criteria criteria) throws TorqueException; + int doDelete(Criteria criteria) throws TorqueException; - public List<T> doSelect(Criteria criteria) throws TorqueException; + List<T> doSelect(Criteria criteria) throws TorqueException; } Modified: db/torque/torque4/trunk/torque-test/src/main/java/org/apache/torque/TestInterface.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/main/java/org/apache/torque/TestInterface.java?rev=1839288&r1=1839287&r2=1839288&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-test/src/main/java/org/apache/torque/TestInterface.java (original) +++ db/torque/torque4/trunk/torque-test/src/main/java/org/apache/torque/TestInterface.java Mon Aug 27 09:48:33 2018 @@ -21,7 +21,7 @@ package org.apache.torque; /** * Test interface to check if the interface attribute of <table> - * does what it is supposed to do. + * does what it is supposed to do. * * @author <a href="mailto:t...@apache.org">Thomas Vandahl</a> * @version $Id$ @@ -29,15 +29,15 @@ package org.apache.torque; public interface TestInterface { - /** Get the primary key */ + /** Get the primary key */ int getID(); - /** Get the name */ + /** Get the name */ String getName(); - /** Set the primary key */ + /** Set the primary key */ void setID(int id); - /** Set the name */ + /** Set the name */ void setName(String name); } Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/BaseDatabaseTestCase.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/BaseDatabaseTestCase.java?rev=1839288&r1=1839287&r2=1839288&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/BaseDatabaseTestCase.java (original) +++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/BaseDatabaseTestCase.java Mon Aug 27 09:48:33 2018 @@ -47,7 +47,7 @@ public abstract class BaseDatabaseTestCa { /** The system property containing the path to the configuration file. */ public static final String CONFIG_FILE_SYSTEM_PROPERTY - = "torque.configuration.file"; + = "torque.configuration.file"; protected static Adapter defaultAdapter; @@ -78,12 +78,12 @@ public abstract class BaseDatabaseTestCa protected String getMysqlVersion() throws TorqueException { Adapter adapter - = Torque.getDatabase(Torque.getDefaultDB()).getAdapter(); + = Torque.getDatabase(Torque.getDefaultDB()).getAdapter(); if (!(adapter instanceof MysqlAdapter)) { throw new TorqueException( "getMysqlVersion called but database adapter is " - + adapter.getClass().getName()); + + adapter.getClass().getName()); } List<String> records = new BasePeerImpl<String>().doSelect( "show variables like \"version\"", @@ -100,11 +100,11 @@ public abstract class BaseDatabaseTestCa * converted to an int */ protected int getMysqlMajorVersion() - throws TorqueException + throws TorqueException { String completeVersion = getMysqlVersion(); String majorVersion - = completeVersion.substring(0, completeVersion.indexOf('.')); + = completeVersion.substring(0, completeVersion.indexOf('.')); return Integer.parseInt(majorVersion); } @@ -114,7 +114,7 @@ public abstract class BaseDatabaseTestCa * @throws TorqueException if the database is not mysql or the query fails. */ protected int getMysqlMinorVersion() - throws TorqueException + throws TorqueException { String completeVersion = getMysqlVersion(); if (completeVersion.indexOf('-') != -1) // handle x.y.z-ubuntuSomething @@ -124,9 +124,9 @@ public abstract class BaseDatabaseTestCa completeVersion.indexOf('-')); } String minorVersion - = completeVersion.substring( - completeVersion.indexOf('.') + 1, - completeVersion.lastIndexOf('.')); + = completeVersion.substring( + completeVersion.indexOf('.') + 1, + completeVersion.lastIndexOf('.')); return Integer.parseInt(minorVersion); } @@ -175,7 +175,7 @@ public abstract class BaseDatabaseTestCa */ protected List<Author> insertBookstoreData() throws TorqueException { - List<Author> result = new ArrayList<Author>(); + List<Author> result = new ArrayList<>(); for (int i = 1; i <= 10; i++) { Author author = new Author(); @@ -196,7 +196,7 @@ public abstract class BaseDatabaseTestCa } else { - book.setIsbn(null); + book.setIsbn(null); } book.save(); } @@ -220,26 +220,26 @@ public abstract class BaseDatabaseTestCa for (Author author : toVerify) { Criteria criteria = new Criteria() - .where(AuthorPeer.NAME, author.getName()) - .and(AuthorPeer.AUTHOR_ID, author.getAuthorId()); + .where(AuthorPeer.NAME, author.getName()) + .and(AuthorPeer.AUTHOR_ID, author.getAuthorId()); criteria.setSingleRecord(true); List<Author> selectedAuthorList = AuthorPeer.doSelect(criteria); assertEquals("Could not find author with id " + author.getAuthorId() + " and name " + author.getName(), - 1, - selectedAuthorList.size()); + 1, + selectedAuthorList.size()); numBooks += author.getBooks().size(); for (Book book : author.getBooks()) { criteria = new Criteria() - .where(BookPeer.TITLE, book.getTitle()) - .and(BookPeer.BOOK_ID, book.getBookId()) - .and(BookPeer.AUTHOR_ID, book.getAuthorId()) - .and(BookPeer.ISBN, book.getIsbn()); + .where(BookPeer.TITLE, book.getTitle()) + .and(BookPeer.BOOK_ID, book.getBookId()) + .and(BookPeer.AUTHOR_ID, book.getAuthorId()) + .and(BookPeer.ISBN, book.getIsbn()); criteria.setSingleRecord(true); List<Book> selectedBookList = BookPeer.doSelect(criteria); assertEquals("Could not find book with id " @@ -250,8 +250,8 @@ public abstract class BaseDatabaseTestCa + book.getIsbn() + " authorId " + book.getAuthorId(), - 1, - selectedBookList.size()); + 1, + selectedBookList.size()); } } Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/DataTest.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/DataTest.java?rev=1839288&r1=1839287&r2=1839288&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/DataTest.java (original) +++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/DataTest.java Mon Aug 27 09:48:33 2018 @@ -133,11 +133,11 @@ public class DataTest extends BaseDataba } private static final String[] validTitles = { - "Book 6 - Author 4", "Book 6 - Author 5", "Book 6 - Author 6", - "Book 6 - Author 7", "Book 6 - Author 8", - "Book 7 - Author 4", "Book 7 - Author 5", "Book 7 - Author 6", - "Book 7 - Author 7", "Book 7 - Author 8" - }; + "Book 6 - Author 4", "Book 6 - Author 5", "Book 6 - Author 6", + "Book 6 - Author 7", "Book 6 - Author 8", + "Book 7 - Author 4", "Book 7 - Author 5", "Book 7 - Author 6", + "Book 7 - Author 7", "Book 7 - Author 8" + }; /** * test limit/offset @@ -148,7 +148,7 @@ public class DataTest extends BaseDataba { cleanBookstore(); insertBookstoreData(); - Set<String> titleSet = new HashSet<String>(); + Set<String> titleSet = new HashSet<>(); for (int j = 0; j < validTitles.length; j++) { titleSet.add(validTitles[j]); @@ -281,14 +281,14 @@ public class DataTest extends BaseDataba // check for comparison NOT_EQUAL and value null Criteria criteria = new Criteria(); criteria.where(VarcharTypePeer.ID, null, Criteria.NOT_EQUAL) - .and(VarcharTypePeer.VARCHAR_VALUE, null, Criteria.NOT_EQUAL); + .and(VarcharTypePeer.VARCHAR_VALUE, null, Criteria.NOT_EQUAL); List<VarcharType> varcharResult = VarcharTypePeer.doSelect(criteria); assertEquals(1, varcharResult.size()); assertEquals("text2", varcharResult.get(0).getId()); criteria = new Criteria(); criteria.where(IntegerTypePeer.ID, null, Criteria.NOT_EQUAL) - .and(IntegerTypePeer.INTEGER_OBJECT_VALUE, null, Criteria.NOT_EQUAL); + .and(IntegerTypePeer.INTEGER_OBJECT_VALUE, null, Criteria.NOT_EQUAL); List<IntegerType> integerResult = IntegerTypePeer.doSelect(criteria); assertEquals(1, integerResult.size()); assertEquals(integerTypeNotNull.getId(), integerResult.get(0).getId()); @@ -396,13 +396,13 @@ public class DataTest extends BaseDataba Criteria criteria = new Criteria(); criteria.addSelectColumn( new ColumnImpl("count(distinct(" + BookPeer.BOOK_ID + "))")); - new BasePeerImpl<Object>().doSelect(criteria, new IntegerMapper()); + new BasePeerImpl<>().doSelect(criteria, new IntegerMapper()); // test qualifiers in function in select columns criteria = new Criteria(); criteria.addSelectColumn( new ColumnImpl("count(distinct " + BookPeer.BOOK_ID + ")")); - new BasePeerImpl<Object>().doSelect(criteria, new IntegerMapper()); + new BasePeerImpl<>().doSelect(criteria, new IntegerMapper()); } /** @@ -415,7 +415,7 @@ public class DataTest extends BaseDataba criteria.addSelectColumn(BookPeer.BOOK_ID); - new BasePeerImpl<Object>().doSelect(criteria, new IntegerMapper()); + new BasePeerImpl<>().doSelect(criteria, new IntegerMapper()); } /** @@ -504,23 +504,23 @@ public class DataTest extends BaseDataba if (bookList.size() != 4) { fail("Ascending Order By: " - + "incorrect numbers of books found : " - + bookList.size() - + ", should be 4"); + + "incorrect numbers of books found : " + + bookList.size() + + ", should be 4"); } if (! "Book 1".equals(bookList.get(0).getTitle())) { fail("Ascending Order By: " - + "Title of first Book is " - + bookList.get(0).getTitle() - + ", should be \"Book 1\""); + + "Title of first Book is " + + bookList.get(0).getTitle() + + ", should be \"Book 1\""); } if (! "Book 4".equals(bookList.get(3).getTitle())) { fail("Ascending Order By: " - + "Title of fourth Book is " - + bookList.get(3).getTitle() - + ", should be \"Book 4\""); + + "Title of fourth Book is " + + bookList.get(3).getTitle() + + ", should be \"Book 4\""); } // test simple descending order by @@ -530,23 +530,23 @@ public class DataTest extends BaseDataba if (bookList.size() != 4) { fail("Descending Order By: " - + "incorrect numbers of books found : " - + bookList.size() - + ", should be 4"); + + "incorrect numbers of books found : " + + bookList.size() + + ", should be 4"); } if (! "Book 1".equals(bookList.get(3).getTitle())) { fail("Descending Order By: " - + "Title of fourth Book is " - + bookList.get(3).getTitle() - + ", should be \"Book 1\""); + + "Title of fourth Book is " + + bookList.get(3).getTitle() + + ", should be \"Book 1\""); } if (! "Book 4".equals((bookList.get(0)).getTitle())) { fail("Descending Order By: " - + "Title of first Book is " - + bookList.get(0).getTitle() - + ", should be \"Book 4\""); + + "Title of first Book is " + + bookList.get(0).getTitle() + + ", should be \"Book 4\""); } criteria = new Criteria(); @@ -570,23 +570,23 @@ public class DataTest extends BaseDataba if (bookList.size() != 10) { fail("ordering by Aliases: " - + "incorrect numbers of books found : " - + bookList.size() - + ", should be 10"); + + "incorrect numbers of books found : " + + bookList.size() + + ", should be 10"); } if (!"Book 4".equals(bookList.get(1).getTitle())) { fail("ordering by Aliases: " - + "Title of second Book is " - + bookList.get(1).getTitle() - + ", should be \"Book 4\""); + + "Title of second Book is " + + bookList.get(1).getTitle() + + ", should be \"Book 4\""); } if (!"Book 3".equals(bookList.get(2).getTitle())) { fail("ordering by Aliases: " - + "Title of third Book is " - + bookList.get(2).getTitle() - + ", should be \"Book 3\""); + + "Title of third Book is " + + bookList.get(2).getTitle() + + ", should be \"Book 3\""); } criteria = new Criteria(); @@ -610,23 +610,23 @@ public class DataTest extends BaseDataba if (bookList.size() != 10) { fail("ordering by Aliases (2): " - + "incorrect numbers of books found : " - + bookList.size() - + ", should be 10"); + + "incorrect numbers of books found : " + + bookList.size() + + ", should be 10"); } if (!"Book 2".equals(bookList.get(1).getTitle())) { fail("ordering by Aliases (2, PS): " - + "Title of second Book is " - + bookList.get(1).getTitle() - + ", should be \"Book 2\""); + + "Title of second Book is " + + bookList.get(1).getTitle() + + ", should be \"Book 2\""); } if (!"Book 2".equals(bookList.get(2).getTitle())) { fail("ordering by Aliases (2, PS): " - + "Title of third Book is " - + bookList.get(2).getTitle() - + ", should be \"Book 2\""); + + "Title of third Book is " + + bookList.get(2).getTitle() + + ", should be \"Book 2\""); } // test usage of Expressions in order by @@ -714,7 +714,7 @@ public class DataTest extends BaseDataba // ignore case in "in" query { criteria = new Criteria(); - Set<String> names = new HashSet<String>(); + Set<String> names = new HashSet<>(); names.add(author.getName().toLowerCase()); criteria.where(AuthorPeer.NAME, names, Criteria.IN); criteria.setIgnoreCase(true); @@ -779,7 +779,7 @@ public class DataTest extends BaseDataba // ignore case in "in" query { criteria = new Criteria(); - Set<String> names = new HashSet<String>(); + Set<String> names = new HashSet<>(); names.add(author.getName()); criteria.where(AuthorPeer.NAME, names, Criteria.IN); @@ -839,7 +839,7 @@ public class DataTest extends BaseDataba // we need an additional column to select from, // to indicate the table we want use criteria.addSelectColumn(AuthorPeer.AUTHOR_ID); - new BasePeerImpl<Object>().doSelect(criteria, new DoNothingMapper()); + new BasePeerImpl<>().doSelect(criteria, new DoNothingMapper()); } /** @@ -877,7 +877,7 @@ public class DataTest extends BaseDataba BookPeer.numColumns); List<List<Object>> queryResult - = BookPeer.doSelect(criteria, mapper); + = BookPeer.doSelect(criteria, mapper); List<Object> mappedRow = queryResult.get(0); book = (Book) mappedRow.get(0); author = (Author) mappedRow.get(1); @@ -897,7 +897,7 @@ public class DataTest extends BaseDataba if (defaultAdapter instanceof MssqlAdapter) { log.error("testLargePk(): " + "MSSQL does not support inserting defined PK values"); - return; + return; } BigintTypePeer.doDelete(new Criteria()); @@ -974,7 +974,7 @@ public class DataTest extends BaseDataba if (count != 1) { fail("counted " + count + " datasets with name Name2," - + " should be 1 "); + + " should be 1 "); } } @@ -996,7 +996,7 @@ public class DataTest extends BaseDataba compPkContainsFk.save(); List<CompPkContainsFk> selectedList - = CompPkContainsFkPeer.doSelect(new Criteria()); + = CompPkContainsFkPeer.doSelect(new Criteria()); assertEquals(1, selectedList.size()); CompPkContainsFk selected = selectedList.get(0); assertEquals(oIntegerPk.getId(), selected.getId1()); @@ -1074,7 +1074,7 @@ public class DataTest extends BaseDataba { assertTrue("IfcTablePeer.doSelect should return" + " instances of TestInterface", - ifcTable instanceof TestInterface); + ifcTable instanceof TestInterface); } IfcTablePeerImpl peerImpl = IfcTablePeer.getIfcTablePeerImpl(); @@ -1098,8 +1098,8 @@ public class DataTest extends BaseDataba LocalIfcTablePeerImpl localPeerImpl = LocalIfcTablePeer.getLocalIfcTablePeerImpl(); assertTrue("LocalIfcTablePeerImpl should be an instance of " - + "LocalTestPeerInterface", - localPeerImpl instanceof LocalTestPeerInterface); + + "LocalTestPeerInterface", + localPeerImpl instanceof LocalTestPeerInterface); } public void testInheritanceWithKeys() throws Exception @@ -1148,7 +1148,7 @@ public class DataTest extends BaseDataba // Check that the class of the object is retained when loading List<InheritanceTest> inheritanceObjects - = InheritanceTestPeer.doSelect(criteria); + = InheritanceTestPeer.doSelect(criteria); assertEquals( InheritanceTest.class, inheritanceObjects.get(0).getClass()); @@ -1178,15 +1178,15 @@ public class DataTest extends BaseDataba // create & save test data InheritanceClassnameTest inheritanceClassnameTest - = new InheritanceClassnameTest(); + = new InheritanceClassnameTest(); inheritanceClassnameTest.setPayload("0 parent"); inheritanceClassnameTest.save(); InheritanceClassnameTestChild1 inheritanceClassnameChild1 - = new InheritanceClassnameTestChild1(); + = new InheritanceClassnameTestChild1(); inheritanceClassnameChild1.setPayload("1 child"); inheritanceClassnameChild1.save(); InheritanceClassnameTestChild2 inheritanceClassnameChild2 - = new InheritanceClassnameTestChild2(); + = new InheritanceClassnameTestChild2(); inheritanceClassnameChild2.setPayload("2 child"); inheritanceClassnameChild2.save(); @@ -1205,7 +1205,7 @@ public class DataTest extends BaseDataba // Check that the class of the object is retained when loading List<InheritanceClassnameTest> inheritanceObjects - = InheritanceClassnameTestPeer.doSelect(criteria); + = InheritanceClassnameTestPeer.doSelect(criteria); assertEquals( InheritanceClassnameTest.class, inheritanceObjects.get(0).getClass()); @@ -1242,10 +1242,10 @@ public class DataTest extends BaseDataba public void testLikeClauseEscaping() throws Exception { String[] authorNames - = {"abc", "bbc", "a_c", "a%c", "a\\c", - "a\"c", "a'c", "a?c", "a*c" }; + = {"abc", "bbc", "a_c", "a%c", "a\\c", + "a\"c", "a'c", "a?c", "a*c" }; - Map<String, String> likeResults = new LinkedHashMap<String, String>(); + Map<String, String> likeResults = new LinkedHashMap<>(); likeResults.put("a\\_c", "a_c"); likeResults.put("a\\_%", "a_c"); @@ -1292,9 +1292,9 @@ public class DataTest extends BaseDataba List<Author> authorList = AuthorPeer.doSelect(criteria); assertEquals( "AuthorList should contain one author" - + " when querying for " + authorNames[i], - 1, - authorList.size()); + + " when querying for " + authorNames[i], + 1, + authorList.size()); Author author = authorList.get(0); assertEquals("Name of author should be " + authorNames[i], authorNames[i], @@ -1318,19 +1318,19 @@ public class DataTest extends BaseDataba { throw new Exception( "error executing select using like content " - + likeResult.getKey(), - e); + + likeResult.getKey(), + e); } assertEquals( "AuthorList should contain one author" - + " when querying for " + likeResult.getKey(), - 1, - authorList.size()); + + " when querying for " + likeResult.getKey(), + 1, + authorList.size()); Author author = authorList.get(0); assertEquals("Name of author should be " - + likeResult.getValue() - + " when querying for " - + likeResult.getKey(), + + likeResult.getValue() + + " when querying for " + + likeResult.getKey(), likeResult.getValue(), author.getName()); } @@ -1408,11 +1408,12 @@ public class DataTest extends BaseDataba /** Serial version */ private static final long serialVersionUID = 1L; + @Override public Object processRow( - final ResultSet resultSet, - final int rowOffset, - final Criteria criteria) - throws TorqueException + final ResultSet resultSet, + final int rowOffset, + final Criteria criteria) + throws TorqueException { return null; } Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/DocsTest.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/DocsTest.java?rev=1839288&r1=1839287&r2=1839288&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/DocsTest.java (original) +++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/DocsTest.java Mon Aug 27 09:48:33 2018 @@ -78,8 +78,8 @@ public class DocsTest extends BaseDataba { e.printStackTrace(); fail("cleaning books : Exception caught : " - + e.getClass().getName() - + " : " + e.getMessage()); + + e.getClass().getName() + + " : " + e.getMessage()); } criteria = new Criteria(); criteria.where( @@ -93,8 +93,8 @@ public class DocsTest extends BaseDataba { e.printStackTrace(); fail("cleaning authors : Exception caught : " - + e.getClass().getName() - + " : " + e.getMessage()); + + e.getClass().getName() + + " : " + e.getMessage()); } @@ -136,8 +136,8 @@ public class DocsTest extends BaseDataba catch (Exception e) { e.printStackTrace(); fail("Exception caught : " - + e.getClass().getName() - + " : " + e.getMessage()); + + e.getClass().getName() + + " : " + e.getMessage()); } } @@ -159,26 +159,26 @@ public class DocsTest extends BaseDataba { e.printStackTrace(); fail("Exception caught : " - + e.getClass().getName() - + " : " + e.getMessage()); + + e.getClass().getName() + + " : " + e.getMessage()); } Book book = books.get(0); assertTrue( "title of first book is not" - + BOOK_1_TITLE - + " but " - + book.getTitle(), - BOOK_1_TITLE.equals(book.getTitle()) + + BOOK_1_TITLE + + " but " + + book.getTitle(), + BOOK_1_TITLE.equals(book.getTitle()) ); book = books.get(2); assertTrue( "ISBN of third book is not" - + BOOK_3_ISBN - + " but " - + book.getIsbn(), - BOOK_3_ISBN.equals(book.getIsbn())); + + BOOK_3_ISBN + + " but " + + book.getIsbn(), + BOOK_3_ISBN.equals(book.getIsbn())); } /** @@ -206,84 +206,84 @@ public class DocsTest extends BaseDataba { e.printStackTrace(); fail("inner join : Exception caught : " - + e.getClass().getName() - + " : " + e.getMessage()); + + e.getClass().getName() + + " : " + e.getMessage()); } assertTrue( "inner join : size of bookAuthors is not 3, but" - + bookAuthors.size(), - bookAuthors.size() == 3); + + bookAuthors.size(), + bookAuthors.size() == 3); // test explicit sql statements from details section List<List<Object>> result = null; try { - result = new BasePeerImpl<Object>().doSelect( + result = new BasePeerImpl<>().doSelect( "SELECT book.* FROM book " - + "INNER JOIN author " - + "ON book.AUTHOR_ID=author.AUTHOR_ID", - new ObjectListMapper(), - (String) null); + + "INNER JOIN author " + + "ON book.AUTHOR_ID=author.AUTHOR_ID", + new ObjectListMapper(), + (String) null); } catch (Exception e) { e.printStackTrace(); fail("Explicit SQL query 1 : Exception caught : " - + e.getClass().getName() - + " : " + e.getMessage()); + + e.getClass().getName() + + " : " + e.getMessage()); } assertTrue( - "Explicit SQL query 1 : size of result is not 3, but" - + result.size(), - result.size() == 3); + "Explicit SQL query 1 : size of result is not 3, but" + + result.size(), + result.size() == 3); result = null; try { - result = new BasePeerImpl<Object>().doSelect( + result = new BasePeerImpl<>().doSelect( "SELECT book.* FROM book,author " - + "WHERE book.AUTHOR_ID=author.AUTHOR_ID", - new ObjectListMapper(), - (String) null); + + "WHERE book.AUTHOR_ID=author.AUTHOR_ID", + new ObjectListMapper(), + (String) null); } catch (Exception e) { e.printStackTrace(); fail("Explicit SQL query 2 : Exception caught : " - + e.getClass().getName() - + " : " + e.getMessage()); + + e.getClass().getName() + + " : " + e.getMessage()); } assertTrue( - "Explicit SQL query 2 : size of result is not 3, but" - + result.size(), - result.size() == 3); + "Explicit SQL query 2 : size of result is not 3, but" + + result.size(), + result.size() == 3); // test left outer join bookAuthors = null; try { - Criteria criteria = new Criteria(); - criteria.addJoin( - AuthorPeer.AUTHOR_ID, - BookPeer.AUTHOR_ID, - Criteria.LEFT_JOIN); - bookAuthors = AuthorPeer.doSelect(criteria); + Criteria criteria = new Criteria(); + criteria.addJoin( + AuthorPeer.AUTHOR_ID, + BookPeer.AUTHOR_ID, + Criteria.LEFT_JOIN); + bookAuthors = AuthorPeer.doSelect(criteria); } catch (Exception e) { e.printStackTrace(); fail("left join : Exception caught : " - + e.getClass().getName() - + " : " + e.getMessage()); + + e.getClass().getName() + + " : " + e.getMessage()); } assertTrue( - "left join : size of bookAuthors is not 4, but" - + bookAuthors.size(), - bookAuthors.size() == 4); + "left join : size of bookAuthors is not 4, but" + + bookAuthors.size(), + bookAuthors.size() == 4); } @@ -308,13 +308,13 @@ public class DocsTest extends BaseDataba { e.printStackTrace(); fail("Exception caught : " - + e.getClass().getName() - + " : " + e.getMessage()); + + e.getClass().getName() + + " : " + e.getMessage()); } assertTrue( - "size of bookAuthors is not 2, but" - + bookAuthors.size(), - bookAuthors.size() == 2); + "size of bookAuthors is not 2, but" + + bookAuthors.size(), + bookAuthors.size() == 2); } /** @@ -339,29 +339,29 @@ public class DocsTest extends BaseDataba { e.printStackTrace(); fail("Exception caught : " - + e.getClass().getName() - + " : " + e.getMessage()); + + e.getClass().getName() + + " : " + e.getMessage()); } assertTrue( - "size of bookAuthors is not 2, but" - + bookAuthors.size(), - bookAuthors.size() == 2); + "size of bookAuthors is not 2, but" + + bookAuthors.size(), + bookAuthors.size() == 2); Author author = bookAuthors.get(0); assertTrue( - "Author of first book is not " - + AUTHOR_1_NAME - + " but " - + author.getName(), - AUTHOR_1_NAME.equals(author.getName())); + "Author of first book is not " + + AUTHOR_1_NAME + + " but " + + author.getName(), + AUTHOR_1_NAME.equals(author.getName())); author = bookAuthors.get(1); assertTrue( - "Author of second book is not " - + AUTHOR_2_NAME - + " but " - + author.getName(), - AUTHOR_2_NAME.equals(author.getName())); + "Author of second book is not " + + AUTHOR_2_NAME + + " but " + + author.getName(), + AUTHOR_2_NAME.equals(author.getName())); } @@ -371,7 +371,7 @@ public class DocsTest extends BaseDataba public void testSubselects() throws TorqueException { Adapter adapter - = Torque.getDatabase(Torque.getDefaultDB()).getAdapter(); + = Torque.getDatabase(Torque.getDefaultDB()).getAdapter(); if (adapter instanceof MysqlAdapter) { int majorVersion = getMysqlMajorVersion(); --------------------------------------------------------------------- To unsubscribe, e-mail: torque-dev-unsubscr...@db.apache.org For additional commands, e-mail: torque-dev-h...@db.apache.org