# IGNITE-32: Tests for POJO generation.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/63038c9d Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/63038c9d Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/63038c9d Branch: refs/heads/ignite-32 Commit: 63038c9d1fda1800324402f65e9fdf9e7bb120ee Parents: 32d310c Author: AKuznetsov <akuznet...@gridgain.com> Authored: Wed Jan 28 10:08:27 2015 +0700 Committer: AKuznetsov <akuznet...@gridgain.com> Committed: Wed Jan 28 10:08:27 2015 +0700 ---------------------------------------------------------------------- .../apache/ignite/schema/ui/SchemaLoadApp.java | 6 +- .../load/generator/PojoGeneratorSelfTest.java | 123 ++++- .../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 ++++ 6 files changed, 1325 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/63038c9d/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/SchemaLoadApp.java ---------------------------------------------------------------------- diff --git a/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/SchemaLoadApp.java b/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/SchemaLoadApp.java index de3c91d..7fbe6b3 100644 --- a/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/SchemaLoadApp.java +++ b/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/SchemaLoadApp.java @@ -139,7 +139,7 @@ public class SchemaLoadApp extends Application { /** */ private final ExecutorService exec = Executors.newSingleThreadExecutor(new ThreadFactory() { @Override public Thread newThread(Runnable r) { - Thread t = new Thread(r, "schema-load-worker"); + Thread t = new Thread(r, "ignite-schema-load-worker"); t.setDaemon(true); @@ -909,11 +909,11 @@ public class SchemaLoadApp extends Application { // Restore connection pane settings. jdbcDrvJarTf.setText(userPrefs.get("jdbc.driver.jar", "h2.jar")); jdbcDrvClsTf.setText(userPrefs.get("jdbc.driver.class", "org.h2.Driver")); - jdbcUrlTf.setText(userPrefs.get("jdbc.url", "jdbc:h2:" + userHome + "/schema-load/db")); + jdbcUrlTf.setText(userPrefs.get("jdbc.url", "jdbc:h2:" + userHome + "/ignite-schema-load/db")); userTf.setText(userPrefs.get("jdbc.user", "sa")); // Restore generation pane settings. - outFolderTf.setText(userPrefs.get("out.folder", userHome + "/schema-load/out")); + outFolderTf.setText(userPrefs.get("out.folder", userHome + "/ignite-schema-load/out")); openFolderCh.setSelected(userPrefs.getBoolean("out.folder.open", true)); pkgTf.setText(userPrefs.get("pojo.package", "org.apache.ignite")); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/63038c9d/modules/schema-load/src/test/java/org/apache/ignite/schema/load/generator/PojoGeneratorSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/schema-load/src/test/java/org/apache/ignite/schema/load/generator/PojoGeneratorSelfTest.java b/modules/schema-load/src/test/java/org/apache/ignite/schema/load/generator/PojoGeneratorSelfTest.java index 10bce3b..ee1da42 100644 --- a/modules/schema-load/src/test/java/org/apache/ignite/schema/load/generator/PojoGeneratorSelfTest.java +++ b/modules/schema-load/src/test/java/org/apache/ignite/schema/load/generator/PojoGeneratorSelfTest.java @@ -17,9 +17,130 @@ package org.apache.ignite.schema.load.generator; +import junit.framework.TestCase; +import org.apache.ignite.internal.util.typedef.internal.U; +import org.apache.ignite.schema.generator.PojoGenerator; +import org.apache.ignite.schema.model.PojoDescriptor; +import org.apache.ignite.schema.parser.DatabaseMetadataParser; +import org.apache.ignite.schema.ui.ConfirmCallable; +import org.apache.ignite.schema.ui.MessageBox; + +import java.io.*; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.Statement; +import java.util.List; + +import static org.apache.ignite.schema.ui.MessageBox.Result.YES_TO_ALL; + /** * Tests for POJO generator. */ -public class PojoGeneratorSelfTest { +public class PojoGeneratorSelfTest extends TestCase { + /** Default connection URL (value is <tt>jdbc:h2:mem:jdbcCacheStore;DB_CLOSE_DELAY=-1</tt>). */ + protected static final String DFLT_CONN_URL = "jdbc:h2:mem:autoCacheStore;DB_CLOSE_DELAY=-1"; + + /** File separator. */ + private static final String PS = File.separator; + + /** Path to temp folder where generated POJOs will be saved. */ + private static final String OUT_DIR_PATH = System.getProperty("java.io.tmpdir") + PS + + "ignite-schema-loader" + PS + "out"; + + /** Marker string to skip date generation while comparing.*/ + private static final String GEN_PTRN = "Code generated by Apache Ignite Schema Load utility"; + + /** Connection to in-memory H2 database. */ + private Connection conn; + + /** {@inheritDoc} */ + @Override public void setUp() throws Exception { + Class.forName("org.h2.Driver"); + + conn = DriverManager.getConnection(DFLT_CONN_URL, "sa", ""); + + Statement stmt = conn.createStatement(); + + stmt.executeUpdate("CREATE TABLE 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 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); + } + + /** {@inheritDoc} */ + @Override public void tearDown() throws Exception { + U.closeQuiet(conn); + } + + /** + * Test that POJOs generated correctly. + */ + public void testPojoGeneration() throws Exception { + List<PojoDescriptor> pojos = DatabaseMetadataParser.parse(conn); + + ConfirmCallable askOverwrite = new ConfirmCallable(null, "") { + @Override public MessageBox.Result confirm(String msg) { + return YES_TO_ALL; + } + }; + + String pkg = "org.apache.ignite.schema.load.model"; + String intPath = "org" + PS + "apache" + PS + "ignite" + PS + "schema" + PS + "load" + PS + "model"; + + for (PojoDescriptor pojo : pojos) { + if (!pojo.valueClassName().isEmpty()) { + PojoGenerator.generate(pojo, OUT_DIR_PATH, pkg, true, true, askOverwrite); + + assertTrue("Generated POJO files does not accordance to predefined for type " + pojo.keyClassName(), + compareFiles(pojo.keyClassName(), intPath)); + + assertTrue("Generated POJO files does not accordance to predefined for type " + pojo.valueClassName(), + compareFiles(pojo.valueClassName(), intPath)); + } + } + } + + /** + * @param typeName Type name. + * @param intPath Int path. + * @return {@code true} if generated POJO as expected. + */ + private boolean compareFiles(String typeName, String intPath) { + String relPath = intPath + PS + typeName; + + try (BufferedReader baseReader = new BufferedReader(new InputStreamReader( + getClass().getResourceAsStream("/" + relPath + ".txt")))) { + try (BufferedReader generatedReader = new BufferedReader(new FileReader(OUT_DIR_PATH + PS + relPath + ".java"))) { + String baseLine; + + while ((baseLine = baseReader.readLine()) != null) { + String generatedLine = generatedReader.readLine(); + + if (!baseLine.equals(generatedLine) && !baseLine.contains(GEN_PTRN) + && !generatedLine.contains(GEN_PTRN)) { + 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/63038c9d/modules/schema-load/src/test/java/org/apache/ignite/schema/load/model/Objects.txt ---------------------------------------------------------------------- diff --git a/modules/schema-load/src/test/java/org/apache/ignite/schema/load/model/Objects.txt b/modules/schema-load/src/test/java/org/apache/ignite/schema/load/model/Objects.txt new file mode 100644 index 0000000..212980b --- /dev/null +++ b/modules/schema-load/src/test/java/org/apache/ignite/schema/load/model/Objects.txt @@ -0,0 +1,502 @@ +/* + * 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/63038c9d/modules/schema-load/src/test/java/org/apache/ignite/schema/load/model/ObjectsKey.txt ---------------------------------------------------------------------- diff --git a/modules/schema-load/src/test/java/org/apache/ignite/schema/load/model/ObjectsKey.txt b/modules/schema-load/src/test/java/org/apache/ignite/schema/load/model/ObjectsKey.txt new file mode 100644 index 0000000..039dbbd --- /dev/null +++ b/modules/schema-load/src/test/java/org/apache/ignite/schema/load/model/ObjectsKey.txt @@ -0,0 +1,96 @@ +/* + * 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/63038c9d/modules/schema-load/src/test/java/org/apache/ignite/schema/load/model/Primitives.txt ---------------------------------------------------------------------- diff --git a/modules/schema-load/src/test/java/org/apache/ignite/schema/load/model/Primitives.txt b/modules/schema-load/src/test/java/org/apache/ignite/schema/load/model/Primitives.txt new file mode 100644 index 0000000..3a2a5d2 --- /dev/null +++ b/modules/schema-load/src/test/java/org/apache/ignite/schema/load/model/Primitives.txt @@ -0,0 +1,506 @@ +/* + * 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 int 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, + int 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 int getLongcol() { + return longcol; + } + + /** + * Sets longcol. + * + * @param longcol New value for longcol. + */ + public void setLongcol(int 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 + longcol; + + 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/63038c9d/modules/schema-load/src/test/java/org/apache/ignite/schema/load/model/PrimitivesKey.txt ---------------------------------------------------------------------- diff --git a/modules/schema-load/src/test/java/org/apache/ignite/schema/load/model/PrimitivesKey.txt b/modules/schema-load/src/test/java/org/apache/ignite/schema/load/model/PrimitivesKey.txt new file mode 100644 index 0000000..bf5a493 --- /dev/null +++ b/modules/schema-load/src/test/java/org/apache/ignite/schema/load/model/PrimitivesKey.txt @@ -0,0 +1,96 @@ +/* + * 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 + + "]"; + } +}