Merge branches 'ignite-329' and 'sprint-2' of 
https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-329


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/3dc95cb2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/3dc95cb2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/3dc95cb2

Branch: refs/heads/ignite-443
Commit: 3dc95cb28774e5e884797437aaebbd65a8577229
Parents: e962ed6 6b7dcb8
Author: AKuznetsov <akuznet...@gridgain.com>
Authored: Tue Mar 10 19:53:23 2015 +0700
Committer: AKuznetsov <akuznet...@gridgain.com>
Committed: Tue Mar 10 19:53:23 2015 +0700

----------------------------------------------------------------------
 license/header-customisation.xml                |  51 -------
 license/header.txt                              |  14 --
 modules/clients/src/test/keystore/generate.sh   |  26 ++--
 .../schema/load/AbstractSchemaImportTest.java   | 134 +++++++++++++++++++
 .../schema/load/AbstractSchemaLoaderTest.java   | 134 -------------------
 .../testsuites/IgniteSchemaImportTestSuite.java |  41 ++++++
 .../testsuites/IgniteSchemaLoadTestSuite.java   |  41 ------
 pom.xml                                         |  34 ++++-
 8 files changed, 222 insertions(+), 253 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dc95cb2/modules/schema-import/src/test/java/org/apache/ignite/schema/load/AbstractSchemaImportTest.java
----------------------------------------------------------------------
diff --cc 
modules/schema-import/src/test/java/org/apache/ignite/schema/load/AbstractSchemaImportTest.java
index 0000000,0000000..a8eb12f
new file mode 100644
--- /dev/null
+++ 
b/modules/schema-import/src/test/java/org/apache/ignite/schema/load/AbstractSchemaImportTest.java
@@@ -1,0 -1,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.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/3dc95cb2/modules/schema-import/src/test/java/org/apache/ignite/schema/load/testsuites/IgniteSchemaImportTestSuite.java
----------------------------------------------------------------------
diff --cc 
modules/schema-import/src/test/java/org/apache/ignite/schema/load/testsuites/IgniteSchemaImportTestSuite.java
index 0000000,0000000..17ded8a
new file mode 100644
--- /dev/null
+++ 
b/modules/schema-import/src/test/java/org/apache/ignite/schema/load/testsuites/IgniteSchemaImportTestSuite.java
@@@ -1,0 -1,0 +1,41 @@@
++/*
++ * 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/3dc95cb2/pom.xml
----------------------------------------------------------------------

Reply via email to