# IGNITE-329 Renaming Load -> Import.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/91bca564 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/91bca564 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/91bca564 Branch: refs/heads/ignite-443 Commit: 91bca564635f21a139d1ba587f64cf3e9c54be0d Parents: 3dc95cb Author: AKuznetsov <akuznet...@gridgain.com> Authored: Tue Mar 10 20:57:51 2015 +0700 Committer: AKuznetsov <akuznet...@gridgain.com> Committed: Tue Mar 10 20:57:51 2015 +0700 ---------------------------------------------------------------------- modules/schema-import/readme.txt | 6 +- .../ignite/schema/generator/PojoGenerator.java | 2 +- .../ignite/schema/generator/XmlGenerator.java | 2 +- .../ignite/schema/ui/SchemaImportApp.java | 16 +- .../schema/load/AbstractSchemaImportTest.java | 134 ----- .../load/generator/PojoGeneratorTest.java | 70 --- .../schema/load/generator/XmlGeneratorTest.java | 50 -- .../apache/ignite/schema/load/model/Ignite.xml | 390 -------------- .../apache/ignite/schema/load/model/Objects.txt | 502 ------------------ .../ignite/schema/load/model/ObjectsKey.txt | 96 ---- .../ignite/schema/load/model/Primitives.txt | 506 ------------------- .../ignite/schema/load/model/PrimitivesKey.txt | 96 ---- .../load/parser/DbMetadataParserTest.java | 118 ----- .../testsuites/IgniteSchemaImportTestSuite.java | 41 -- .../schema/test/AbstractSchemaImportTest.java | 134 +++++ .../test/generator/PojoGeneratorTest.java | 70 +++ .../schema/test/generator/XmlGeneratorTest.java | 50 ++ .../apache/ignite/schema/test/model/Ignite.xml | 390 ++++++++++++++ .../apache/ignite/schema/test/model/Objects.txt | 502 ++++++++++++++++++ .../ignite/schema/test/model/ObjectsKey.txt | 96 ++++ .../ignite/schema/test/model/Primitives.txt | 506 +++++++++++++++++++ .../ignite/schema/test/model/PrimitivesKey.txt | 96 ++++ .../test/parser/DbMetadataParserTest.java | 118 +++++ .../testsuites/IgniteSchemaImportTestSuite.java | 41 ++ 24 files changed, 2016 insertions(+), 2016 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/91bca564/modules/schema-import/readme.txt ---------------------------------------------------------------------- diff --git a/modules/schema-import/readme.txt b/modules/schema-import/readme.txt index 2f19d10..7a16bd4 100644 --- a/modules/schema-import/readme.txt +++ b/modules/schema-import/readme.txt @@ -1,7 +1,7 @@ Apache Ignite Schema Import Module ------------------------------ -Apache Ignite Schema-loading module provides a simple utility that automatically reads the database schema, +Apache Ignite Schema Import module provides a simple utility that automatically reads the database schema, creates required type mapping description, and optionally generates the domain model in Java. For running utility use 'ignite-schema-import.{sh|bat}' script. For connection with RDBMS system from utility @@ -11,7 +11,7 @@ you need to provide: connection url and jdbc driver. Moving from disk-based architectures to in-memory architectures ------------------------------------------ -Use Schema-loading utility for generation of type mapping and domain model in Java. +Use Schema Import Utility for generation of type mapping and domain model in Java. For example you may use the following script for create sample type in your RDBMS system: @@ -27,7 +27,7 @@ insert into PERSONS(id, first_name, last_name) values(6, 'Isaac', 'Newton'); You need place compiled domain model classes, jdbc driver (used for connect to you RDBMS system) in Ignite node classpath, for example place in 'libs' folder. -Append type mapping description generated by Schema-loading utility to your cache configuration and setup DataSource +Append type mapping description generated by Schema Import Utility to your cache configuration and setup DataSource to your RDBMS system for cache store. Example of spring configuration: http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/91bca564/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/PojoGenerator.java ---------------------------------------------------------------------- diff --git a/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/PojoGenerator.java b/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/PojoGenerator.java index 500aa9a..6a8eef6 100644 --- a/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/PojoGenerator.java +++ b/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/PojoGenerator.java @@ -167,7 +167,7 @@ public class PojoGenerator { add0(src, "/**"); add0(src, " * " + type + " definition."); add0(src, " *"); - add0(src, " * Code generated by Apache Ignite Schema Load utility: " + new SimpleDateFormat("MM/dd/yyyy").format(new Date()) + "."); + add0(src, " * Code generated by Apache Ignite Schema Import utility: " + new SimpleDateFormat("MM/dd/yyyy").format(new Date()) + "."); add0(src, " */"); add0(src, "public class " + type + " implements Serializable {"); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/91bca564/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/XmlGenerator.java ---------------------------------------------------------------------- diff --git a/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/XmlGenerator.java b/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/XmlGenerator.java index c62a720..f062dc2 100644 --- a/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/XmlGenerator.java +++ b/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/XmlGenerator.java @@ -58,7 +58,7 @@ public class XmlGenerator { " See the License for the specific language governing permissions and\n" + " limitations under the License.\n")); - doc.appendChild(doc.createComment("\n XML generated by Apache Ignite Schema Load utility: " + + doc.appendChild(doc.createComment("\n XML generated by Apache Ignite Schema Import utility: " + new SimpleDateFormat("MM/dd/yyyy").format(new Date()) + "\n")); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/91bca564/modules/schema-import/src/main/java/org/apache/ignite/schema/ui/SchemaImportApp.java ---------------------------------------------------------------------- diff --git a/modules/schema-import/src/main/java/org/apache/ignite/schema/ui/SchemaImportApp.java b/modules/schema-import/src/main/java/org/apache/ignite/schema/ui/SchemaImportApp.java index 7976543..6d14d31 100644 --- a/modules/schema-import/src/main/java/org/apache/ignite/schema/ui/SchemaImportApp.java +++ b/modules/schema-import/src/main/java/org/apache/ignite/schema/ui/SchemaImportApp.java @@ -42,7 +42,7 @@ import static javafx.embed.swing.SwingFXUtils.*; import static org.apache.ignite.schema.ui.Controls.*; /** - * Schema load application. + * Schema Import utility application. */ @SuppressWarnings("UnnecessaryFullyQualifiedName") public class SchemaImportApp extends Application { @@ -213,7 +213,7 @@ public class SchemaImportApp extends Application { private final Properties prefs = new Properties(); /** File path for storing on local file system. */ - private final File prefsFile = new File(System.getProperty("user.home"), ".ignite-schema-load"); + private final File prefsFile = new File(System.getProperty("user.home"), ".ignite-schema-import"); /** Empty POJO fields model. */ private static final ObservableList<PojoField> NO_FIELDS = FXCollections.emptyObservableList(); @@ -221,7 +221,7 @@ public class SchemaImportApp extends Application { /** */ private final ExecutorService exec = Executors.newSingleThreadExecutor(new ThreadFactory() { @Override public Thread newThread(Runnable r) { - Thread t = new Thread(r, "ignite-schema-load-worker"); + Thread t = new Thread(r, "ignite-schema-import-worker"); t.setDaemon(true); @@ -1269,7 +1269,7 @@ public class SchemaImportApp extends Application { preset.user = getStringProp(key + "user", preset.user); } - primaryStage.setTitle("Apache Ignite Auto Schema Load Utility"); + primaryStage.setTitle("Apache Ignite Auto Schema Import Utility"); primaryStage.getIcons().addAll( image("ignite", 16), @@ -1324,11 +1324,11 @@ public class SchemaImportApp extends Application { rdbmsCb.getSelectionModel().select(getIntProp("jdbc.db.preset", 0)); jdbcDrvJarTf.setText(getStringProp("jdbc.driver.jar", "h2.jar")); jdbcDrvClsTf.setText(getStringProp("jdbc.driver.class", "org.h2.Driver")); - jdbcUrlTf.setText(getStringProp("jdbc.url", "jdbc:h2:" + userHome + "/ignite-schema-load/db")); + jdbcUrlTf.setText(getStringProp("jdbc.url", "jdbc:h2:" + userHome + "/ignite-schema-import/db")); userTf.setText(getStringProp("jdbc.user", "sa")); // Restore generation pane settings. - outFolderTf.setText(getStringProp("out.folder", userHome + "/ignite-schema-load/out")); + outFolderTf.setText(getStringProp("out.folder", userHome + "/ignite-schema-import/out")); pkgTf.setText(getStringProp("pojo.package", "org.apache.ignite")); pojoIncludeKeysCh.setSelected(getBoolProp("pojo.include", true)); @@ -1370,7 +1370,7 @@ public class SchemaImportApp extends Application { */ private void savePreferences() { try (FileOutputStream out = new FileOutputStream(prefsFile)) { - prefs.store(out, "Apache Ignite Schema Load Utility"); + prefs.store(out, "Apache Ignite Schema Import Utility"); } catch (IOException e) { MessageBox.errorDialog(owner, "Failed to save preferences!", e); @@ -1408,7 +1408,7 @@ public class SchemaImportApp extends Application { } /** - * Schema load utility launcher. + * Schema Import utility launcher. * * @param args Command line arguments passed to the application. */ http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/91bca564/modules/schema-import/src/test/java/org/apache/ignite/schema/load/AbstractSchemaImportTest.java ---------------------------------------------------------------------- diff --git a/modules/schema-import/src/test/java/org/apache/ignite/schema/load/AbstractSchemaImportTest.java b/modules/schema-import/src/test/java/org/apache/ignite/schema/load/AbstractSchemaImportTest.java deleted file mode 100644 index a8eb12f..0000000 --- a/modules/schema-import/src/test/java/org/apache/ignite/schema/load/AbstractSchemaImportTest.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 org.apache.ignite.schema.load; - -import junit.framework.*; -import org.apache.ignite.internal.util.typedef.internal.*; -import org.apache.ignite.schema.model.PojoDescriptor; -import org.apache.ignite.schema.parser.DatabaseMetadataParser; -import org.apache.ignite.schema.ui.*; - -import java.io.*; -import java.sql.*; -import java.util.List; - -import static org.apache.ignite.schema.ui.MessageBox.Result.*; - -/** - * Base functional for ignite-schema-loader tests. - */ -public abstract class AbstractSchemaImportTest extends TestCase { - /** DB connection URL. */ - private static final String CONN_URL = "jdbc:h2:mem:autoCacheStore;DB_CLOSE_DELAY=-1"; - - /** Path to temp folder where generated POJOs will be saved. */ - protected static final String OUT_DIR_PATH = System.getProperty("java.io.tmpdir") + "/ignite-schema-loader/out"; - - /** Auto confirmation of file conflicts. */ - protected ConfirmCallable askOverwrite = new ConfirmCallable(null, "") { - @Override public MessageBox.Result confirm(String msg) { - return YES_TO_ALL; - } - }; - - /** List of generated for test database POJO objects. */ - protected List<PojoDescriptor> pojos; - - /** {@inheritDoc} */ - @Override public void setUp() throws Exception { - Class.forName("org.h2.Driver"); - - Connection conn = DriverManager.getConnection(CONN_URL, "sa", ""); - - Statement stmt = conn.createStatement(); - - stmt.executeUpdate("CREATE TABLE IF NOT EXISTS PRIMITIVES (pk INTEGER PRIMARY KEY, " + - " boolCol BOOLEAN NOT NULL," + - " byteCol TINYINT NOT NULL," + - " shortCol SMALLINT NOT NULL," + - " intCol INTEGER NOT NULL, " + - " longCol BIGINT NOT NULL," + - " floatCol REAL NOT NULL," + - " doubleCol DOUBLE NOT NULL," + - " doubleCol2 DOUBLE NOT NULL, " + - " bigDecimalCol DECIMAL(10, 0)," + - " strCol VARCHAR(10)," + - " dateCol DATE," + - " timeCol TIME," + - " tsCol TIMESTAMP, " + - " arrCol BINARY(10))"); - - stmt.executeUpdate("CREATE TABLE IF NOT EXISTS OBJECTS (pk INTEGER PRIMARY KEY, " + - " boolCol BOOLEAN," + - " byteCol TINYINT," + - " shortCol SMALLINT," + - " intCol INTEGER," + - " longCol BIGINT," + - " floatCol REAL," + - " doubleCol DOUBLE," + - " doubleCol2 DOUBLE," + - " bigDecimalCol DECIMAL(10, 0)," + - " strCol VARCHAR(10), " + - " dateCol DATE," + - " timeCol TIME," + - " tsCol TIMESTAMP," + - " arrCol BINARY(10))"); - - conn.commit(); - - U.closeQuiet(stmt); - - pojos = DatabaseMetadataParser.parse(conn, false); - - U.closeQuiet(conn); - } - - /** - * Compare files by lines. - * - * @param exp Stream to read of expected file from test resources. - * @param generated Generated file instance. - * @param excludePtrn Marker string to exclude lines from comparing. - * @return true if generated file correspond to expected. - */ - protected boolean compareFilesInt(InputStream exp, File generated, String excludePtrn) { - try (BufferedReader baseReader = new BufferedReader(new InputStreamReader(exp))) { - try (BufferedReader generatedReader = new BufferedReader(new FileReader(generated))) { - String baseLine; - - while ((baseLine = baseReader.readLine()) != null) { - String generatedLine = generatedReader.readLine(); - - if (!baseLine.equals(generatedLine) && !baseLine.contains(excludePtrn) - && !generatedLine.contains(excludePtrn)) { - System.out.println("Expected: " + baseLine); - System.out.println("Generated: " + generatedLine); - - return false; - } - } - - return true; - } - } catch (IOException e) { - e.printStackTrace(); - - return false; - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/91bca564/modules/schema-import/src/test/java/org/apache/ignite/schema/load/generator/PojoGeneratorTest.java ---------------------------------------------------------------------- diff --git a/modules/schema-import/src/test/java/org/apache/ignite/schema/load/generator/PojoGeneratorTest.java b/modules/schema-import/src/test/java/org/apache/ignite/schema/load/generator/PojoGeneratorTest.java deleted file mode 100644 index 3162290..0000000 --- a/modules/schema-import/src/test/java/org/apache/ignite/schema/load/generator/PojoGeneratorTest.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 org.apache.ignite.schema.load.generator; - -import org.apache.ignite.schema.generator.PojoGenerator; -import org.apache.ignite.schema.load.AbstractSchemaLoaderTest; -import org.apache.ignite.schema.model.PojoDescriptor; - -import java.io.File; - -/** - * Tests for POJO generator. - */ -public class PojoGeneratorTest extends AbstractSchemaLoaderTest { - /** Marker string to skip date generation while comparing.*/ - private static final String GEN_PTRN = "Code generated by Apache Ignite Schema Load utility"; - - /** - * Test that POJOs generated correctly. - */ - public void testPojoGeneration() throws Exception { - String pkg = "org.apache.ignite.schema.load.model"; - String intPath = "org/apache/ignite/schema/load/model"; - - Boolean containsSchema = false; - - for (PojoDescriptor pojo : pojos) { - if (pojo.valueClassName().isEmpty()) - containsSchema = true; - else { - PojoGenerator.generate(pojo, OUT_DIR_PATH, pkg, true, true, askOverwrite); - - assertTrue("Generated key class POJO content is differ from expected for type " + pojo.keyClassName(), - compareFiles(pojo.keyClassName(), intPath, GEN_PTRN)); - - assertTrue("Generated value class POJO content is differ from expected for type " + pojo.valueClassName(), - compareFiles(pojo.valueClassName(), intPath, GEN_PTRN)); - } - } - - assertTrue("Generated POJOs does not contains schema.", containsSchema); - } - - /** - * @param typeName Type name. - * @param intPath Internal path. - * @return {@code true} if generated POJO as expected. - */ - private boolean compareFiles(String typeName, String intPath, String excludePtrn) { - String relPath = intPath + "/" + typeName; - - return compareFilesInt(getClass().getResourceAsStream("/" + relPath + ".txt"), - new File(OUT_DIR_PATH + "/" + relPath + ".java"), excludePtrn); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/91bca564/modules/schema-import/src/test/java/org/apache/ignite/schema/load/generator/XmlGeneratorTest.java ---------------------------------------------------------------------- diff --git a/modules/schema-import/src/test/java/org/apache/ignite/schema/load/generator/XmlGeneratorTest.java b/modules/schema-import/src/test/java/org/apache/ignite/schema/load/generator/XmlGeneratorTest.java deleted file mode 100644 index 027f64f..0000000 --- a/modules/schema-import/src/test/java/org/apache/ignite/schema/load/generator/XmlGeneratorTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 org.apache.ignite.schema.load.generator; - -import org.apache.ignite.schema.generator.*; -import org.apache.ignite.schema.load.*; -import org.apache.ignite.schema.model.*; - -import java.io.*; -import java.util.*; - -/** - * Tests for XML generator. - */ -public class XmlGeneratorTest extends AbstractSchemaLoaderTest { - /** - * Test that XML generated correctly. - */ - public void testXmlGeneration() throws Exception { - Collection<PojoDescriptor> all = new ArrayList<>(); - - for (PojoDescriptor pojo : pojos) - if (pojo.parent() != null) - all.add(pojo); - - String fileName = "Ignite.xml"; - - XmlGenerator.generate("org.apache.ignite.schema.load.model", all, true, new File(OUT_DIR_PATH, fileName), - askOverwrite); - - assertTrue("Generated XML file content is differ from expected one", - compareFilesInt(getClass().getResourceAsStream("/org/apache/ignite/schema/load/model/" + fileName), - new File(OUT_DIR_PATH + "/" + fileName), "XML generated by Apache Ignite Schema Load utility")); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/91bca564/modules/schema-import/src/test/java/org/apache/ignite/schema/load/model/Ignite.xml ---------------------------------------------------------------------- diff --git a/modules/schema-import/src/test/java/org/apache/ignite/schema/load/model/Ignite.xml b/modules/schema-import/src/test/java/org/apache/ignite/schema/load/model/Ignite.xml deleted file mode 100644 index f0b5696..0000000 --- a/modules/schema-import/src/test/java/org/apache/ignite/schema/load/model/Ignite.xml +++ /dev/null @@ -1,390 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<!-- - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You 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. ---> - -<!-- - XML generated by Apache Ignite Schema Load utility: 02/05/2015 ---> -<beans xmlns="http://www.springframework.org/schema/beans" - xmlns:util="http://www.springframework.org/schema/util" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.springframework.org/schema/beans - http://www.springframework.org/schema/beans/spring-beans.xsd - http://www.springframework.org/schema/util - http://www.springframework.org/schema/util/spring-util.xsd"> - <bean class="org.apache.ignite.cache.CacheTypeMetadata"> - <property name="databaseSchema" value="PUBLIC"/> - <property name="databaseTable" value="OBJECTS"/> - <property name="keyType" value="org.apache.ignite.schema.load.model.ObjectsKey"/> - <property name="valueType" value="org.apache.ignite.schema.load.model.Objects"/> - <property name="keyFields"> - <list> - <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> - <property name="databaseName" value="PK"/> - <property name="databaseType"> - <util:constant static-field="java.sql.Types.INTEGER"/> - </property> - <property name="javaName" value="pk"/> - <property name="javaType" value="int"/> - </bean> - </list> - </property> - <property name="valueFields"> - <list> - <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> - <property name="databaseName" value="PK"/> - <property name="databaseType"> - <util:constant static-field="java.sql.Types.INTEGER"/> - </property> - <property name="javaName" value="pk"/> - <property name="javaType" value="int"/> - </bean> - <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> - <property name="databaseName" value="BOOLCOL"/> - <property name="databaseType"> - <util:constant static-field="java.sql.Types.BOOLEAN"/> - </property> - <property name="javaName" value="boolcol"/> - <property name="javaType" value="java.lang.Boolean"/> - </bean> - <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> - <property name="databaseName" value="BYTECOL"/> - <property name="databaseType"> - <util:constant static-field="java.sql.Types.TINYINT"/> - </property> - <property name="javaName" value="bytecol"/> - <property name="javaType" value="java.lang.Byte"/> - </bean> - <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> - <property name="databaseName" value="SHORTCOL"/> - <property name="databaseType"> - <util:constant static-field="java.sql.Types.SMALLINT"/> - </property> - <property name="javaName" value="shortcol"/> - <property name="javaType" value="java.lang.Short"/> - </bean> - <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> - <property name="databaseName" value="INTCOL"/> - <property name="databaseType"> - <util:constant static-field="java.sql.Types.INTEGER"/> - </property> - <property name="javaName" value="intcol"/> - <property name="javaType" value="java.lang.Integer"/> - </bean> - <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> - <property name="databaseName" value="LONGCOL"/> - <property name="databaseType"> - <util:constant static-field="java.sql.Types.BIGINT"/> - </property> - <property name="javaName" value="longcol"/> - <property name="javaType" value="java.lang.Long"/> - </bean> - <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> - <property name="databaseName" value="FLOATCOL"/> - <property name="databaseType"> - <util:constant static-field="java.sql.Types.REAL"/> - </property> - <property name="javaName" value="floatcol"/> - <property name="javaType" value="java.lang.Float"/> - </bean> - <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> - <property name="databaseName" value="DOUBLECOL"/> - <property name="databaseType"> - <util:constant static-field="java.sql.Types.DOUBLE"/> - </property> - <property name="javaName" value="doublecol"/> - <property name="javaType" value="java.lang.Double"/> - </bean> - <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> - <property name="databaseName" value="DOUBLECOL2"/> - <property name="databaseType"> - <util:constant static-field="java.sql.Types.DOUBLE"/> - </property> - <property name="javaName" value="doublecol2"/> - <property name="javaType" value="java.lang.Double"/> - </bean> - <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> - <property name="databaseName" value="BIGDECIMALCOL"/> - <property name="databaseType"> - <util:constant static-field="java.sql.Types.DECIMAL"/> - </property> - <property name="javaName" value="bigdecimalcol"/> - <property name="javaType" value="java.math.BigDecimal"/> - </bean> - <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> - <property name="databaseName" value="STRCOL"/> - <property name="databaseType"> - <util:constant static-field="java.sql.Types.VARCHAR"/> - </property> - <property name="javaName" value="strcol"/> - <property name="javaType" value="java.lang.String"/> - </bean> - <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> - <property name="databaseName" value="DATECOL"/> - <property name="databaseType"> - <util:constant static-field="java.sql.Types.DATE"/> - </property> - <property name="javaName" value="datecol"/> - <property name="javaType" value="java.sql.Date"/> - </bean> - <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> - <property name="databaseName" value="TIMECOL"/> - <property name="databaseType"> - <util:constant static-field="java.sql.Types.TIME"/> - </property> - <property name="javaName" value="timecol"/> - <property name="javaType" value="java.sql.Time"/> - </bean> - <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> - <property name="databaseName" value="TSCOL"/> - <property name="databaseType"> - <util:constant static-field="java.sql.Types.TIMESTAMP"/> - </property> - <property name="javaName" value="tscol"/> - <property name="javaType" value="java.sql.Timestamp"/> - </bean> - <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> - <property name="databaseName" value="ARRCOL"/> - <property name="databaseType"> - <util:constant static-field="java.sql.Types.VARBINARY"/> - </property> - <property name="javaName" value="arrcol"/> - <property name="javaType" value="java.lang.Object"/> - </bean> - </list> - </property> - <property name="queryFields"> - <map> - <entry key="pk" value="int"/> - <entry key="boolcol" value="java.lang.Boolean"/> - <entry key="bytecol" value="java.lang.Byte"/> - <entry key="shortcol" value="java.lang.Short"/> - <entry key="intcol" value="java.lang.Integer"/> - <entry key="longcol" value="java.lang.Long"/> - <entry key="floatcol" value="java.lang.Float"/> - <entry key="doublecol" value="java.lang.Double"/> - <entry key="doublecol2" value="java.lang.Double"/> - <entry key="bigdecimalcol" value="java.math.BigDecimal"/> - <entry key="strcol" value="java.lang.String"/> - <entry key="datecol" value="java.sql.Date"/> - <entry key="timecol" value="java.sql.Time"/> - <entry key="tscol" value="java.sql.Timestamp"/> - <entry key="arrcol" value="java.lang.Object"/> - </map> - </property> - <property name="ascendingFields"> - <map> - <entry key="pk" value="int"/> - </map> - </property> - <property name="groups"> - <map> - <entry key="PRIMARY_KEY_C"> - <map> - <entry key="pk"> - <bean class="org.apache.ignite.lang.IgniteBiTuple"> - <constructor-arg value="int"/> - <constructor-arg value="false"/> - </bean> - </entry> - </map> - </entry> - </map> - </property> - </bean> - <bean class="org.apache.ignite.cache.CacheTypeMetadata"> - <property name="databaseSchema" value="PUBLIC"/> - <property name="databaseTable" value="PRIMITIVES"/> - <property name="keyType" value="org.apache.ignite.schema.load.model.PrimitivesKey"/> - <property name="valueType" value="org.apache.ignite.schema.load.model.Primitives"/> - <property name="keyFields"> - <list> - <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> - <property name="databaseName" value="PK"/> - <property name="databaseType"> - <util:constant static-field="java.sql.Types.INTEGER"/> - </property> - <property name="javaName" value="pk"/> - <property name="javaType" value="int"/> - </bean> - </list> - </property> - <property name="valueFields"> - <list> - <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> - <property name="databaseName" value="PK"/> - <property name="databaseType"> - <util:constant static-field="java.sql.Types.INTEGER"/> - </property> - <property name="javaName" value="pk"/> - <property name="javaType" value="int"/> - </bean> - <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> - <property name="databaseName" value="BOOLCOL"/> - <property name="databaseType"> - <util:constant static-field="java.sql.Types.BOOLEAN"/> - </property> - <property name="javaName" value="boolcol"/> - <property name="javaType" value="boolean"/> - </bean> - <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> - <property name="databaseName" value="BYTECOL"/> - <property name="databaseType"> - <util:constant static-field="java.sql.Types.TINYINT"/> - </property> - <property name="javaName" value="bytecol"/> - <property name="javaType" value="byte"/> - </bean> - <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> - <property name="databaseName" value="SHORTCOL"/> - <property name="databaseType"> - <util:constant static-field="java.sql.Types.SMALLINT"/> - </property> - <property name="javaName" value="shortcol"/> - <property name="javaType" value="short"/> - </bean> - <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> - <property name="databaseName" value="INTCOL"/> - <property name="databaseType"> - <util:constant static-field="java.sql.Types.INTEGER"/> - </property> - <property name="javaName" value="intcol"/> - <property name="javaType" value="int"/> - </bean> - <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> - <property name="databaseName" value="LONGCOL"/> - <property name="databaseType"> - <util:constant static-field="java.sql.Types.BIGINT"/> - </property> - <property name="javaName" value="longcol"/> - <property name="javaType" value="long"/> - </bean> - <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> - <property name="databaseName" value="FLOATCOL"/> - <property name="databaseType"> - <util:constant static-field="java.sql.Types.REAL"/> - </property> - <property name="javaName" value="floatcol"/> - <property name="javaType" value="float"/> - </bean> - <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> - <property name="databaseName" value="DOUBLECOL"/> - <property name="databaseType"> - <util:constant static-field="java.sql.Types.DOUBLE"/> - </property> - <property name="javaName" value="doublecol"/> - <property name="javaType" value="double"/> - </bean> - <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> - <property name="databaseName" value="DOUBLECOL2"/> - <property name="databaseType"> - <util:constant static-field="java.sql.Types.DOUBLE"/> - </property> - <property name="javaName" value="doublecol2"/> - <property name="javaType" value="double"/> - </bean> - <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> - <property name="databaseName" value="BIGDECIMALCOL"/> - <property name="databaseType"> - <util:constant static-field="java.sql.Types.DECIMAL"/> - </property> - <property name="javaName" value="bigdecimalcol"/> - <property name="javaType" value="java.math.BigDecimal"/> - </bean> - <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> - <property name="databaseName" value="STRCOL"/> - <property name="databaseType"> - <util:constant static-field="java.sql.Types.VARCHAR"/> - </property> - <property name="javaName" value="strcol"/> - <property name="javaType" value="java.lang.String"/> - </bean> - <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> - <property name="databaseName" value="DATECOL"/> - <property name="databaseType"> - <util:constant static-field="java.sql.Types.DATE"/> - </property> - <property name="javaName" value="datecol"/> - <property name="javaType" value="java.sql.Date"/> - </bean> - <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> - <property name="databaseName" value="TIMECOL"/> - <property name="databaseType"> - <util:constant static-field="java.sql.Types.TIME"/> - </property> - <property name="javaName" value="timecol"/> - <property name="javaType" value="java.sql.Time"/> - </bean> - <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> - <property name="databaseName" value="TSCOL"/> - <property name="databaseType"> - <util:constant static-field="java.sql.Types.TIMESTAMP"/> - </property> - <property name="javaName" value="tscol"/> - <property name="javaType" value="java.sql.Timestamp"/> - </bean> - <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> - <property name="databaseName" value="ARRCOL"/> - <property name="databaseType"> - <util:constant static-field="java.sql.Types.VARBINARY"/> - </property> - <property name="javaName" value="arrcol"/> - <property name="javaType" value="java.lang.Object"/> - </bean> - </list> - </property> - <property name="queryFields"> - <map> - <entry key="pk" value="int"/> - <entry key="boolcol" value="boolean"/> - <entry key="bytecol" value="byte"/> - <entry key="shortcol" value="short"/> - <entry key="intcol" value="int"/> - <entry key="longcol" value="long"/> - <entry key="floatcol" value="float"/> - <entry key="doublecol" value="double"/> - <entry key="doublecol2" value="double"/> - <entry key="bigdecimalcol" value="java.math.BigDecimal"/> - <entry key="strcol" value="java.lang.String"/> - <entry key="datecol" value="java.sql.Date"/> - <entry key="timecol" value="java.sql.Time"/> - <entry key="tscol" value="java.sql.Timestamp"/> - <entry key="arrcol" value="java.lang.Object"/> - </map> - </property> - <property name="ascendingFields"> - <map> - <entry key="pk" value="int"/> - </map> - </property> - <property name="groups"> - <map> - <entry key="PRIMARY_KEY_D"> - <map> - <entry key="pk"> - <bean class="org.apache.ignite.lang.IgniteBiTuple"> - <constructor-arg value="int"/> - <constructor-arg value="false"/> - </bean> - </entry> - </map> - </entry> - </map> - </property> - </bean> -</beans> http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/91bca564/modules/schema-import/src/test/java/org/apache/ignite/schema/load/model/Objects.txt ---------------------------------------------------------------------- diff --git a/modules/schema-import/src/test/java/org/apache/ignite/schema/load/model/Objects.txt b/modules/schema-import/src/test/java/org/apache/ignite/schema/load/model/Objects.txt deleted file mode 100644 index 212980b..0000000 --- a/modules/schema-import/src/test/java/org/apache/ignite/schema/load/model/Objects.txt +++ /dev/null @@ -1,502 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 org.apache.ignite.schema.load.model; - -import java.io.*; - -/** - * Objects definition. - * - * Code generated by Apache Ignite Schema Load utility: 01/27/2015. - */ -public class Objects implements Serializable { - /** */ - private static final long serialVersionUID = 0L; - - /** Value for pk. */ - private int pk; - - /** Value for boolcol. */ - private Boolean boolcol; - - /** Value for bytecol. */ - private Byte bytecol; - - /** Value for shortcol. */ - private Short shortcol; - - /** Value for intcol. */ - private Integer intcol; - - /** Value for longcol. */ - private Long longcol; - - /** Value for floatcol. */ - private Float floatcol; - - /** Value for doublecol. */ - private Double doublecol; - - /** Value for doublecol2. */ - private Double doublecol2; - - /** Value for bigdecimalcol. */ - private java.math.BigDecimal bigdecimalcol; - - /** Value for strcol. */ - private String strcol; - - /** Value for datecol. */ - private java.sql.Date datecol; - - /** Value for timecol. */ - private java.sql.Time timecol; - - /** Value for tscol. */ - private java.sql.Timestamp tscol; - - /** Value for arrcol. */ - private Object arrcol; - - /** - * Empty constructor. - */ - public Objects() { - // No-op. - } - - /** - * Full constructor. - */ - public Objects( - int pk, - Boolean boolcol, - Byte bytecol, - Short shortcol, - Integer intcol, - Long longcol, - Float floatcol, - Double doublecol, - Double doublecol2, - java.math.BigDecimal bigdecimalcol, - String strcol, - java.sql.Date datecol, - java.sql.Time timecol, - java.sql.Timestamp tscol, - Object arrcol - ) { - this.pk = pk; - this.boolcol = boolcol; - this.bytecol = bytecol; - this.shortcol = shortcol; - this.intcol = intcol; - this.longcol = longcol; - this.floatcol = floatcol; - this.doublecol = doublecol; - this.doublecol2 = doublecol2; - this.bigdecimalcol = bigdecimalcol; - this.strcol = strcol; - this.datecol = datecol; - this.timecol = timecol; - this.tscol = tscol; - this.arrcol = arrcol; - } - - /** - * Gets pk. - * - * @return Value for pk. - */ - public int getPk() { - return pk; - } - - /** - * Sets pk. - * - * @param pk New value for pk. - */ - public void setPk(int pk) { - this.pk = pk; - } - - /** - * Gets boolcol. - * - * @return Value for boolcol. - */ - public Boolean getBoolcol() { - return boolcol; - } - - /** - * Sets boolcol. - * - * @param boolcol New value for boolcol. - */ - public void setBoolcol(Boolean boolcol) { - this.boolcol = boolcol; - } - - /** - * Gets bytecol. - * - * @return Value for bytecol. - */ - public Byte getBytecol() { - return bytecol; - } - - /** - * Sets bytecol. - * - * @param bytecol New value for bytecol. - */ - public void setBytecol(Byte bytecol) { - this.bytecol = bytecol; - } - - /** - * Gets shortcol. - * - * @return Value for shortcol. - */ - public Short getShortcol() { - return shortcol; - } - - /** - * Sets shortcol. - * - * @param shortcol New value for shortcol. - */ - public void setShortcol(Short shortcol) { - this.shortcol = shortcol; - } - - /** - * Gets intcol. - * - * @return Value for intcol. - */ - public Integer getIntcol() { - return intcol; - } - - /** - * Sets intcol. - * - * @param intcol New value for intcol. - */ - public void setIntcol(Integer intcol) { - this.intcol = intcol; - } - - /** - * Gets longcol. - * - * @return Value for longcol. - */ - public Long getLongcol() { - return longcol; - } - - /** - * Sets longcol. - * - * @param longcol New value for longcol. - */ - public void setLongcol(Long longcol) { - this.longcol = longcol; - } - - /** - * Gets floatcol. - * - * @return Value for floatcol. - */ - public Float getFloatcol() { - return floatcol; - } - - /** - * Sets floatcol. - * - * @param floatcol New value for floatcol. - */ - public void setFloatcol(Float floatcol) { - this.floatcol = floatcol; - } - - /** - * Gets doublecol. - * - * @return Value for doublecol. - */ - public Double getDoublecol() { - return doublecol; - } - - /** - * Sets doublecol. - * - * @param doublecol New value for doublecol. - */ - public void setDoublecol(Double doublecol) { - this.doublecol = doublecol; - } - - /** - * Gets doublecol2. - * - * @return Value for doublecol2. - */ - public Double getDoublecol2() { - return doublecol2; - } - - /** - * Sets doublecol2. - * - * @param doublecol2 New value for doublecol2. - */ - public void setDoublecol2(Double doublecol2) { - this.doublecol2 = doublecol2; - } - - /** - * Gets bigdecimalcol. - * - * @return Value for bigdecimalcol. - */ - public java.math.BigDecimal getBigdecimalcol() { - return bigdecimalcol; - } - - /** - * Sets bigdecimalcol. - * - * @param bigdecimalcol New value for bigdecimalcol. - */ - public void setBigdecimalcol(java.math.BigDecimal bigdecimalcol) { - this.bigdecimalcol = bigdecimalcol; - } - - /** - * Gets strcol. - * - * @return Value for strcol. - */ - public String getStrcol() { - return strcol; - } - - /** - * Sets strcol. - * - * @param strcol New value for strcol. - */ - public void setStrcol(String strcol) { - this.strcol = strcol; - } - - /** - * Gets datecol. - * - * @return Value for datecol. - */ - public java.sql.Date getDatecol() { - return datecol; - } - - /** - * Sets datecol. - * - * @param datecol New value for datecol. - */ - public void setDatecol(java.sql.Date datecol) { - this.datecol = datecol; - } - - /** - * Gets timecol. - * - * @return Value for timecol. - */ - public java.sql.Time getTimecol() { - return timecol; - } - - /** - * Sets timecol. - * - * @param timecol New value for timecol. - */ - public void setTimecol(java.sql.Time timecol) { - this.timecol = timecol; - } - - /** - * Gets tscol. - * - * @return Value for tscol. - */ - public java.sql.Timestamp getTscol() { - return tscol; - } - - /** - * Sets tscol. - * - * @param tscol New value for tscol. - */ - public void setTscol(java.sql.Timestamp tscol) { - this.tscol = tscol; - } - - /** - * Gets arrcol. - * - * @return Value for arrcol. - */ - public Object getArrcol() { - return arrcol; - } - - /** - * Sets arrcol. - * - * @param arrcol New value for arrcol. - */ - public void setArrcol(Object arrcol) { - this.arrcol = arrcol; - } - - /** {@inheritDoc} */ - @Override public boolean equals(Object o) { - if (this == o) - return true; - - if (!(o instanceof Objects)) - return false; - - Objects that = (Objects)o; - - if (pk != that.pk) - return false; - - if (boolcol != null ? !boolcol.equals(that.boolcol) : that.boolcol != null) - return false; - - if (bytecol != null ? !bytecol.equals(that.bytecol) : that.bytecol != null) - return false; - - if (shortcol != null ? !shortcol.equals(that.shortcol) : that.shortcol != null) - return false; - - if (intcol != null ? !intcol.equals(that.intcol) : that.intcol != null) - return false; - - if (longcol != null ? !longcol.equals(that.longcol) : that.longcol != null) - return false; - - if (floatcol != null ? !floatcol.equals(that.floatcol) : that.floatcol != null) - return false; - - if (doublecol != null ? !doublecol.equals(that.doublecol) : that.doublecol != null) - return false; - - if (doublecol2 != null ? !doublecol2.equals(that.doublecol2) : that.doublecol2 != null) - return false; - - if (bigdecimalcol != null ? !bigdecimalcol.equals(that.bigdecimalcol) : that.bigdecimalcol != null) - return false; - - if (strcol != null ? !strcol.equals(that.strcol) : that.strcol != null) - return false; - - if (datecol != null ? !datecol.equals(that.datecol) : that.datecol != null) - return false; - - if (timecol != null ? !timecol.equals(that.timecol) : that.timecol != null) - return false; - - if (tscol != null ? !tscol.equals(that.tscol) : that.tscol != null) - return false; - - if (arrcol != null ? !arrcol.equals(that.arrcol) : that.arrcol != null) - return false; - - return true; - } - - /** {@inheritDoc} */ - @Override public int hashCode() { - int res = pk; - - res = 31 * res + (boolcol != null ? boolcol.hashCode() : 0); - - res = 31 * res + (bytecol != null ? bytecol.hashCode() : 0); - - res = 31 * res + (shortcol != null ? shortcol.hashCode() : 0); - - res = 31 * res + (intcol != null ? intcol.hashCode() : 0); - - res = 31 * res + (longcol != null ? longcol.hashCode() : 0); - - res = 31 * res + (floatcol != null ? floatcol.hashCode() : 0); - - res = 31 * res + (doublecol != null ? doublecol.hashCode() : 0); - - res = 31 * res + (doublecol2 != null ? doublecol2.hashCode() : 0); - - res = 31 * res + (bigdecimalcol != null ? bigdecimalcol.hashCode() : 0); - - res = 31 * res + (strcol != null ? strcol.hashCode() : 0); - - res = 31 * res + (datecol != null ? datecol.hashCode() : 0); - - res = 31 * res + (timecol != null ? timecol.hashCode() : 0); - - res = 31 * res + (tscol != null ? tscol.hashCode() : 0); - - res = 31 * res + (arrcol != null ? arrcol.hashCode() : 0); - - return res; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return "Objects [pk=" + pk + - ", boolcol=" + boolcol + - ", bytecol=" + bytecol + - ", shortcol=" + shortcol + - ", intcol=" + intcol + - ", longcol=" + longcol + - ", floatcol=" + floatcol + - ", doublecol=" + doublecol + - ", doublecol2=" + doublecol2 + - ", bigdecimalcol=" + bigdecimalcol + - ", strcol=" + strcol + - ", datecol=" + datecol + - ", timecol=" + timecol + - ", tscol=" + tscol + - ", arrcol=" + arrcol + - "]"; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/91bca564/modules/schema-import/src/test/java/org/apache/ignite/schema/load/model/ObjectsKey.txt ---------------------------------------------------------------------- diff --git a/modules/schema-import/src/test/java/org/apache/ignite/schema/load/model/ObjectsKey.txt b/modules/schema-import/src/test/java/org/apache/ignite/schema/load/model/ObjectsKey.txt deleted file mode 100644 index 039dbbd..0000000 --- a/modules/schema-import/src/test/java/org/apache/ignite/schema/load/model/ObjectsKey.txt +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 org.apache.ignite.schema.load.model; - -import java.io.*; - -/** - * ObjectsKey definition. - * - * Code generated by Apache Ignite Schema Load utility: 01/27/2015. - */ -public class ObjectsKey implements Serializable { - /** */ - private static final long serialVersionUID = 0L; - - /** Value for pk. */ - private int pk; - - /** - * Empty constructor. - */ - public ObjectsKey() { - // No-op. - } - - /** - * Full constructor. - */ - public ObjectsKey( - int pk - ) { - this.pk = pk; - } - - /** - * Gets pk. - * - * @return Value for pk. - */ - public int getPk() { - return pk; - } - - /** - * Sets pk. - * - * @param pk New value for pk. - */ - public void setPk(int pk) { - this.pk = pk; - } - - /** {@inheritDoc} */ - @Override public boolean equals(Object o) { - if (this == o) - return true; - - if (!(o instanceof ObjectsKey)) - return false; - - ObjectsKey that = (ObjectsKey)o; - - if (pk != that.pk) - return false; - - return true; - } - - /** {@inheritDoc} */ - @Override public int hashCode() { - int res = pk; - - return res; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return "ObjectsKey [pk=" + pk + - "]"; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/91bca564/modules/schema-import/src/test/java/org/apache/ignite/schema/load/model/Primitives.txt ---------------------------------------------------------------------- diff --git a/modules/schema-import/src/test/java/org/apache/ignite/schema/load/model/Primitives.txt b/modules/schema-import/src/test/java/org/apache/ignite/schema/load/model/Primitives.txt deleted file mode 100644 index e4f0a79..0000000 --- a/modules/schema-import/src/test/java/org/apache/ignite/schema/load/model/Primitives.txt +++ /dev/null @@ -1,506 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 org.apache.ignite.schema.load.model; - -import java.io.*; - -/** - * Primitives definition. - * - * Code generated by Apache Ignite Schema Load utility: 01/27/2015. - */ -public class Primitives implements Serializable { - /** */ - private static final long serialVersionUID = 0L; - - /** Value for pk. */ - private int pk; - - /** Value for boolcol. */ - private boolean boolcol; - - /** Value for bytecol. */ - private byte bytecol; - - /** Value for shortcol. */ - private short shortcol; - - /** Value for intcol. */ - private int intcol; - - /** Value for longcol. */ - private long longcol; - - /** Value for floatcol. */ - private float floatcol; - - /** Value for doublecol. */ - private double doublecol; - - /** Value for doublecol2. */ - private double doublecol2; - - /** Value for bigdecimalcol. */ - private java.math.BigDecimal bigdecimalcol; - - /** Value for strcol. */ - private String strcol; - - /** Value for datecol. */ - private java.sql.Date datecol; - - /** Value for timecol. */ - private java.sql.Time timecol; - - /** Value for tscol. */ - private java.sql.Timestamp tscol; - - /** Value for arrcol. */ - private Object arrcol; - - /** - * Empty constructor. - */ - public Primitives() { - // No-op. - } - - /** - * Full constructor. - */ - public Primitives( - int pk, - boolean boolcol, - byte bytecol, - short shortcol, - int intcol, - long longcol, - float floatcol, - double doublecol, - double doublecol2, - java.math.BigDecimal bigdecimalcol, - String strcol, - java.sql.Date datecol, - java.sql.Time timecol, - java.sql.Timestamp tscol, - Object arrcol - ) { - this.pk = pk; - this.boolcol = boolcol; - this.bytecol = bytecol; - this.shortcol = shortcol; - this.intcol = intcol; - this.longcol = longcol; - this.floatcol = floatcol; - this.doublecol = doublecol; - this.doublecol2 = doublecol2; - this.bigdecimalcol = bigdecimalcol; - this.strcol = strcol; - this.datecol = datecol; - this.timecol = timecol; - this.tscol = tscol; - this.arrcol = arrcol; - } - - /** - * Gets pk. - * - * @return Value for pk. - */ - public int getPk() { - return pk; - } - - /** - * Sets pk. - * - * @param pk New value for pk. - */ - public void setPk(int pk) { - this.pk = pk; - } - - /** - * Gets boolcol. - * - * @return Value for boolcol. - */ - public boolean getBoolcol() { - return boolcol; - } - - /** - * Sets boolcol. - * - * @param boolcol New value for boolcol. - */ - public void setBoolcol(boolean boolcol) { - this.boolcol = boolcol; - } - - /** - * Gets bytecol. - * - * @return Value for bytecol. - */ - public byte getBytecol() { - return bytecol; - } - - /** - * Sets bytecol. - * - * @param bytecol New value for bytecol. - */ - public void setBytecol(byte bytecol) { - this.bytecol = bytecol; - } - - /** - * Gets shortcol. - * - * @return Value for shortcol. - */ - public short getShortcol() { - return shortcol; - } - - /** - * Sets shortcol. - * - * @param shortcol New value for shortcol. - */ - public void setShortcol(short shortcol) { - this.shortcol = shortcol; - } - - /** - * Gets intcol. - * - * @return Value for intcol. - */ - public int getIntcol() { - return intcol; - } - - /** - * Sets intcol. - * - * @param intcol New value for intcol. - */ - public void setIntcol(int intcol) { - this.intcol = intcol; - } - - /** - * Gets longcol. - * - * @return Value for longcol. - */ - public long getLongcol() { - return longcol; - } - - /** - * Sets longcol. - * - * @param longcol New value for longcol. - */ - public void setLongcol(long longcol) { - this.longcol = longcol; - } - - /** - * Gets floatcol. - * - * @return Value for floatcol. - */ - public float getFloatcol() { - return floatcol; - } - - /** - * Sets floatcol. - * - * @param floatcol New value for floatcol. - */ - public void setFloatcol(float floatcol) { - this.floatcol = floatcol; - } - - /** - * Gets doublecol. - * - * @return Value for doublecol. - */ - public double getDoublecol() { - return doublecol; - } - - /** - * Sets doublecol. - * - * @param doublecol New value for doublecol. - */ - public void setDoublecol(double doublecol) { - this.doublecol = doublecol; - } - - /** - * Gets doublecol2. - * - * @return Value for doublecol2. - */ - public double getDoublecol2() { - return doublecol2; - } - - /** - * Sets doublecol2. - * - * @param doublecol2 New value for doublecol2. - */ - public void setDoublecol2(double doublecol2) { - this.doublecol2 = doublecol2; - } - - /** - * Gets bigdecimalcol. - * - * @return Value for bigdecimalcol. - */ - public java.math.BigDecimal getBigdecimalcol() { - return bigdecimalcol; - } - - /** - * Sets bigdecimalcol. - * - * @param bigdecimalcol New value for bigdecimalcol. - */ - public void setBigdecimalcol(java.math.BigDecimal bigdecimalcol) { - this.bigdecimalcol = bigdecimalcol; - } - - /** - * Gets strcol. - * - * @return Value for strcol. - */ - public String getStrcol() { - return strcol; - } - - /** - * Sets strcol. - * - * @param strcol New value for strcol. - */ - public void setStrcol(String strcol) { - this.strcol = strcol; - } - - /** - * Gets datecol. - * - * @return Value for datecol. - */ - public java.sql.Date getDatecol() { - return datecol; - } - - /** - * Sets datecol. - * - * @param datecol New value for datecol. - */ - public void setDatecol(java.sql.Date datecol) { - this.datecol = datecol; - } - - /** - * Gets timecol. - * - * @return Value for timecol. - */ - public java.sql.Time getTimecol() { - return timecol; - } - - /** - * Sets timecol. - * - * @param timecol New value for timecol. - */ - public void setTimecol(java.sql.Time timecol) { - this.timecol = timecol; - } - - /** - * Gets tscol. - * - * @return Value for tscol. - */ - public java.sql.Timestamp getTscol() { - return tscol; - } - - /** - * Sets tscol. - * - * @param tscol New value for tscol. - */ - public void setTscol(java.sql.Timestamp tscol) { - this.tscol = tscol; - } - - /** - * Gets arrcol. - * - * @return Value for arrcol. - */ - public Object getArrcol() { - return arrcol; - } - - /** - * Sets arrcol. - * - * @param arrcol New value for arrcol. - */ - public void setArrcol(Object arrcol) { - this.arrcol = arrcol; - } - - /** {@inheritDoc} */ - @Override public boolean equals(Object o) { - if (this == o) - return true; - - if (!(o instanceof Primitives)) - return false; - - Primitives that = (Primitives)o; - - if (pk != that.pk) - return false; - - if (boolcol != that.boolcol) - return false; - - if (bytecol != that.bytecol) - return false; - - if (shortcol != that.shortcol) - return false; - - if (intcol != that.intcol) - return false; - - if (longcol != that.longcol) - return false; - - if (Float.compare(floatcol, that.floatcol) != 0) - return false; - - if (Double.compare(doublecol, that.doublecol) != 0) - return false; - - if (Double.compare(doublecol2, that.doublecol2) != 0) - return false; - - if (bigdecimalcol != null ? !bigdecimalcol.equals(that.bigdecimalcol) : that.bigdecimalcol != null) - return false; - - if (strcol != null ? !strcol.equals(that.strcol) : that.strcol != null) - return false; - - if (datecol != null ? !datecol.equals(that.datecol) : that.datecol != null) - return false; - - if (timecol != null ? !timecol.equals(that.timecol) : that.timecol != null) - return false; - - if (tscol != null ? !tscol.equals(that.tscol) : that.tscol != null) - return false; - - if (arrcol != null ? !arrcol.equals(that.arrcol) : that.arrcol != null) - return false; - - return true; - } - - /** {@inheritDoc} */ - @Override public int hashCode() { - int res = pk; - - res = 31 * res + (boolcol ? 1 : 0); - - res = 31 * res + (int)bytecol; - - res = 31 * res + (int)shortcol; - - res = 31 * res + intcol; - - res = 31 * res + (int)(longcol ^ (longcol >>> 32)); - - res = 31 * res + (floatcol != +0.0f ? Float.floatToIntBits(floatcol) : 0); - - long ig_hash_temp = Double.doubleToLongBits(doublecol); - - res = 31 * res + (int)(ig_hash_temp ^ (ig_hash_temp >>> 32)); - - ig_hash_temp = Double.doubleToLongBits(doublecol2); - - res = 31 * res + (int)(ig_hash_temp ^ (ig_hash_temp >>> 32)); - - res = 31 * res + (bigdecimalcol != null ? bigdecimalcol.hashCode() : 0); - - res = 31 * res + (strcol != null ? strcol.hashCode() : 0); - - res = 31 * res + (datecol != null ? datecol.hashCode() : 0); - - res = 31 * res + (timecol != null ? timecol.hashCode() : 0); - - res = 31 * res + (tscol != null ? tscol.hashCode() : 0); - - res = 31 * res + (arrcol != null ? arrcol.hashCode() : 0); - - return res; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return "Primitives [pk=" + pk + - ", boolcol=" + boolcol + - ", bytecol=" + bytecol + - ", shortcol=" + shortcol + - ", intcol=" + intcol + - ", longcol=" + longcol + - ", floatcol=" + floatcol + - ", doublecol=" + doublecol + - ", doublecol2=" + doublecol2 + - ", bigdecimalcol=" + bigdecimalcol + - ", strcol=" + strcol + - ", datecol=" + datecol + - ", timecol=" + timecol + - ", tscol=" + tscol + - ", arrcol=" + arrcol + - "]"; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/91bca564/modules/schema-import/src/test/java/org/apache/ignite/schema/load/model/PrimitivesKey.txt ---------------------------------------------------------------------- diff --git a/modules/schema-import/src/test/java/org/apache/ignite/schema/load/model/PrimitivesKey.txt b/modules/schema-import/src/test/java/org/apache/ignite/schema/load/model/PrimitivesKey.txt deleted file mode 100644 index bf5a493..0000000 --- a/modules/schema-import/src/test/java/org/apache/ignite/schema/load/model/PrimitivesKey.txt +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 org.apache.ignite.schema.load.model; - -import java.io.*; - -/** - * PrimitivesKey definition. - * - * Code generated by Apache Ignite Schema Load utility: 01/27/2015. - */ -public class PrimitivesKey implements Serializable { - /** */ - private static final long serialVersionUID = 0L; - - /** Value for pk. */ - private int pk; - - /** - * Empty constructor. - */ - public PrimitivesKey() { - // No-op. - } - - /** - * Full constructor. - */ - public PrimitivesKey( - int pk - ) { - this.pk = pk; - } - - /** - * Gets pk. - * - * @return Value for pk. - */ - public int getPk() { - return pk; - } - - /** - * Sets pk. - * - * @param pk New value for pk. - */ - public void setPk(int pk) { - this.pk = pk; - } - - /** {@inheritDoc} */ - @Override public boolean equals(Object o) { - if (this == o) - return true; - - if (!(o instanceof PrimitivesKey)) - return false; - - PrimitivesKey that = (PrimitivesKey)o; - - if (pk != that.pk) - return false; - - return true; - } - - /** {@inheritDoc} */ - @Override public int hashCode() { - int res = pk; - - return res; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return "PrimitivesKey [pk=" + pk + - "]"; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/91bca564/modules/schema-import/src/test/java/org/apache/ignite/schema/load/parser/DbMetadataParserTest.java ---------------------------------------------------------------------- diff --git a/modules/schema-import/src/test/java/org/apache/ignite/schema/load/parser/DbMetadataParserTest.java b/modules/schema-import/src/test/java/org/apache/ignite/schema/load/parser/DbMetadataParserTest.java deleted file mode 100644 index aaec75c..0000000 --- a/modules/schema-import/src/test/java/org/apache/ignite/schema/load/parser/DbMetadataParserTest.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 org.apache.ignite.schema.load.parser; - -import org.apache.ignite.schema.load.*; -import org.apache.ignite.schema.model.*; - -import java.math.*; -import java.sql.Date; -import java.sql.*; -import java.util.*; - -/** - * Tests for metadata parsing. - */ -public class DbMetadataParserTest extends AbstractSchemaLoaderTest { - /** - * Check that field is correspond to expected. - * - * @param field Field descriptor. - * @param name Expected field name. - * @param primitive Expected field primitive type. - * @param cls Expected field type. - */ - private void checkField(PojoField field, String name, boolean primitive, Class<?> cls) { - assertEquals("Name of field should be " + name, name, field.javaName()); - - assertEquals("Type of field should be " + cls.getName(), cls.getName(), field.javaTypeName()); - - assertEquals("Field primitive should be " + primitive, primitive, field.primitive()); - } - - /** - * Check that type is correspond to expected. - * - * @param type Type descriptor. - */ - private void checkType(PojoDescriptor type) { - assertFalse("Type key class name should be defined", type.keyClassName().isEmpty()); - - assertFalse("Type value class name should be defined", type.valueClassName().isEmpty()); - - Collection<PojoField> keyFields = type.keyFields(); - - assertEquals("Key type should have 1 field", 1, keyFields.size()); - - checkField(keyFields.iterator().next(), "pk", true, int.class); - - List<PojoField> fields = type.fields(); - - assertEquals("Value type should have 15 fields", 15, fields.size()); - - Iterator<PojoField> fieldsIt = fields.iterator(); - - checkField(fieldsIt.next(), "pk", true, int.class); - - if ("Objects".equals(type.valueClassName())) { - checkField(fieldsIt.next(), "boolcol", false, Boolean.class); - checkField(fieldsIt.next(), "bytecol", false, Byte.class); - checkField(fieldsIt.next(), "shortcol", false, Short.class); - checkField(fieldsIt.next(), "intcol", false, Integer.class); - checkField(fieldsIt.next(), "longcol", false, Long.class); - checkField(fieldsIt.next(), "floatcol", false, Float.class); - checkField(fieldsIt.next(), "doublecol", false, Double.class); - checkField(fieldsIt.next(), "doublecol2", false, Double.class); - } - else { - checkField(fieldsIt.next(), "boolcol", true, boolean.class); - checkField(fieldsIt.next(), "bytecol", true, byte.class); - checkField(fieldsIt.next(), "shortcol", true, short.class); - checkField(fieldsIt.next(), "intcol", true, int.class); - checkField(fieldsIt.next(), "longcol", true, long.class); - checkField(fieldsIt.next(), "floatcol", true, float.class); - checkField(fieldsIt.next(), "doublecol", true, double.class); - checkField(fieldsIt.next(), "doublecol2", true, double.class); - } - - checkField(fieldsIt.next(), "bigdecimalcol", false, BigDecimal.class); - checkField(fieldsIt.next(), "strcol", false, String.class); - checkField(fieldsIt.next(), "datecol", false, Date.class); - checkField(fieldsIt.next(), "timecol", false, Time.class); - checkField(fieldsIt.next(), "tscol", false, Timestamp.class); - checkField(fieldsIt.next(), "arrcol", false, Object.class); - } - - /** - * Test that metadata generated correctly. - */ - public void testCheckMetadata() { - assertEquals("Metadata should contain 3 element", 3, pojos.size()); - - Iterator<PojoDescriptor> it = pojos.iterator(); - - PojoDescriptor schema = it.next(); - - assertTrue("First element is schema description. Its class name should be empty", - schema.valueClassName().isEmpty()); - - checkType(it.next()); - - checkType(it.next()); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/91bca564/modules/schema-import/src/test/java/org/apache/ignite/schema/load/testsuites/IgniteSchemaImportTestSuite.java ---------------------------------------------------------------------- diff --git a/modules/schema-import/src/test/java/org/apache/ignite/schema/load/testsuites/IgniteSchemaImportTestSuite.java b/modules/schema-import/src/test/java/org/apache/ignite/schema/load/testsuites/IgniteSchemaImportTestSuite.java deleted file mode 100644 index 17ded8a..0000000 --- a/modules/schema-import/src/test/java/org/apache/ignite/schema/load/testsuites/IgniteSchemaImportTestSuite.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 org.apache.ignite.schema.load.testsuites; - -import junit.framework.*; -import org.apache.ignite.schema.load.generator.*; -import org.apache.ignite.schema.load.parser.*; - -/** - * Ignite Schema Load Utility Tests. - */ -public class IgniteSchemaImportTestSuite { - /** - * @return Test suite. - * @throws Exception Thrown in case of the failure. - */ - public static TestSuite suite() throws Exception { - TestSuite suite = new TestSuite("Ignite Apache Schema Load Utility Test Suite"); - - suite.addTestSuite(PojoGeneratorTest.class); - suite.addTestSuite(XmlGeneratorTest.class); - suite.addTestSuite(DbMetadataParserTest.class); - - return suite; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/91bca564/modules/schema-import/src/test/java/org/apache/ignite/schema/test/AbstractSchemaImportTest.java ---------------------------------------------------------------------- diff --git a/modules/schema-import/src/test/java/org/apache/ignite/schema/test/AbstractSchemaImportTest.java b/modules/schema-import/src/test/java/org/apache/ignite/schema/test/AbstractSchemaImportTest.java new file mode 100644 index 0000000..0c3ecb1 --- /dev/null +++ b/modules/schema-import/src/test/java/org/apache/ignite/schema/test/AbstractSchemaImportTest.java @@ -0,0 +1,134 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.ignite.schema.test; + +import junit.framework.*; +import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.schema.model.PojoDescriptor; +import org.apache.ignite.schema.parser.DatabaseMetadataParser; +import org.apache.ignite.schema.ui.*; + +import java.io.*; +import java.sql.*; +import java.util.List; + +import static org.apache.ignite.schema.ui.MessageBox.Result.*; + +/** + * Base functional for Ignite Schema Import utility tests. + */ +public abstract class AbstractSchemaImportTest extends TestCase { + /** DB connection URL. */ + private static final String CONN_URL = "jdbc:h2:mem:autoCacheStore;DB_CLOSE_DELAY=-1"; + + /** Path to temp folder where generated POJOs will be saved. */ + protected static final String OUT_DIR_PATH = System.getProperty("java.io.tmpdir") + "/ignite-schema-import/out"; + + /** Auto confirmation of file conflicts. */ + protected ConfirmCallable askOverwrite = new ConfirmCallable(null, "") { + @Override public MessageBox.Result confirm(String msg) { + return YES_TO_ALL; + } + }; + + /** List of generated for test database POJO objects. */ + protected List<PojoDescriptor> pojos; + + /** {@inheritDoc} */ + @Override public void setUp() throws Exception { + Class.forName("org.h2.Driver"); + + Connection conn = DriverManager.getConnection(CONN_URL, "sa", ""); + + Statement stmt = conn.createStatement(); + + stmt.executeUpdate("CREATE TABLE IF NOT EXISTS PRIMITIVES (pk INTEGER PRIMARY KEY, " + + " boolCol BOOLEAN NOT NULL," + + " byteCol TINYINT NOT NULL," + + " shortCol SMALLINT NOT NULL," + + " intCol INTEGER NOT NULL, " + + " longCol BIGINT NOT NULL," + + " floatCol REAL NOT NULL," + + " doubleCol DOUBLE NOT NULL," + + " doubleCol2 DOUBLE NOT NULL, " + + " bigDecimalCol DECIMAL(10, 0)," + + " strCol VARCHAR(10)," + + " dateCol DATE," + + " timeCol TIME," + + " tsCol TIMESTAMP, " + + " arrCol BINARY(10))"); + + stmt.executeUpdate("CREATE TABLE IF NOT EXISTS OBJECTS (pk INTEGER PRIMARY KEY, " + + " boolCol BOOLEAN," + + " byteCol TINYINT," + + " shortCol SMALLINT," + + " intCol INTEGER," + + " longCol BIGINT," + + " floatCol REAL," + + " doubleCol DOUBLE," + + " doubleCol2 DOUBLE," + + " bigDecimalCol DECIMAL(10, 0)," + + " strCol VARCHAR(10), " + + " dateCol DATE," + + " timeCol TIME," + + " tsCol TIMESTAMP," + + " arrCol BINARY(10))"); + + conn.commit(); + + U.closeQuiet(stmt); + + pojos = DatabaseMetadataParser.parse(conn, false); + + U.closeQuiet(conn); + } + + /** + * Compare files by lines. + * + * @param exp Stream to read of expected file from test resources. + * @param generated Generated file instance. + * @param excludePtrn Marker string to exclude lines from comparing. + * @return true if generated file correspond to expected. + */ + protected boolean compareFilesInt(InputStream exp, File generated, String excludePtrn) { + try (BufferedReader baseReader = new BufferedReader(new InputStreamReader(exp))) { + try (BufferedReader generatedReader = new BufferedReader(new FileReader(generated))) { + String baseLine; + + while ((baseLine = baseReader.readLine()) != null) { + String generatedLine = generatedReader.readLine(); + + if (!baseLine.equals(generatedLine) && !baseLine.contains(excludePtrn) + && !generatedLine.contains(excludePtrn)) { + System.out.println("Expected: " + baseLine); + System.out.println("Generated: " + generatedLine); + + return false; + } + } + + return true; + } + } catch (IOException e) { + e.printStackTrace(); + + return false; + } + } +}