[2/6] phoenix git commit: PHOENIX-3290 Move and/or combine as many NeedsOwnCluster tests to bring down test run time
http://git-wip-us.apache.org/repos/asf/phoenix/blob/29c61bb8/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDMLIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDMLIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDMLIT.java index dbe767b..f26e6dd 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDMLIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDMLIT.java @@ -28,13 +28,11 @@ import static org.junit.Assert.fail; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; -import java.sql.SQLException; import java.util.List; import java.util.Properties; import org.apache.phoenix.query.KeyRange; import org.apache.phoenix.schema.TableNotFoundException; -import org.apache.phoenix.util.PhoenixRuntime; import org.apache.phoenix.util.PropertiesUtil; import org.junit.Test; @@ -43,23 +41,20 @@ public class TenantSpecificTablesDMLIT extends BaseTenantSpecificTablesIT { @Test public void testSelectWithLimit() throws Exception { - Connection conn = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL); + Connection conn = DriverManager.getConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL, PropertiesUtil.deepCopy(TEST_PROPERTIES)); ResultSet rs = conn.createStatement().executeQuery("SELECT * FROM " + TENANT_TABLE_NAME + " LIMIT 100"); while(rs.next()) {} } @Test public void testBasicUpsertSelect() throws Exception { -Connection conn = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL); +Connection conn = DriverManager.getConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL, PropertiesUtil.deepCopy(TEST_PROPERTIES)); try { conn.setAutoCommit(false); conn.createStatement().executeUpdate("upsert into " + TENANT_TABLE_NAME + " (id, tenant_col) values (1, 'Cheap Sunglasses')"); conn.createStatement().executeUpdate("upsert into " + TENANT_TABLE_NAME + " (id, tenant_col) values (2, 'Viva Las Vegas')"); conn.commit(); -conn.close(); -conn = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL); analyzeTable(conn, TENANT_TABLE_NAME); -conn = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL); ResultSet rs = conn.createStatement().executeQuery("select tenant_col from " + TENANT_TABLE_NAME + " where id = 1"); assertTrue("Expected 1 row in result set", rs.next()); assertEquals("Cheap Sunglasses", rs.getString(1)); @@ -72,49 +67,37 @@ public class TenantSpecificTablesDMLIT extends BaseTenantSpecificTablesIT { @Test public void testBasicUpsertSelect2() throws Exception { -Connection conn1 = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL); -createTestTable(PHOENIX_JDBC_TENANT_SPECIFIC_URL2, TENANT_TABLE_DDL, null, nextTimestamp()); -Connection conn2 = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL2); +Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); +Connection conn1 = DriverManager.getConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL, props); +createTestTable(PHOENIX_JDBC_TENANT_SPECIFIC_URL2, TENANT_TABLE_DDL); +Connection conn2 = DriverManager.getConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL2, props); try { conn1.setAutoCommit(false); conn1.createStatement().executeUpdate("upsert into " + TENANT_TABLE_NAME + " values ('me','" + TENANT_TYPE_ID + "',1,'Cheap Sunglasses')"); conn1.createStatement().executeUpdate("upsert into " + TENANT_TABLE_NAME + " values ('you','" + TENANT_TYPE_ID +"',2,'Viva Las Vegas')"); conn1.commit(); -conn1 = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL); analyzeTable(conn1, TENANT_TABLE_NAME); -conn1 = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL); conn2.setAutoCommit(true); conn2.createStatement().executeUpdate("upsert into " + TENANT_TABLE_NAME + " values ('them','" + TENANT_TYPE_ID + "',1,'Long Hair')"); conn2.createStatement().executeUpdate("upsert into " + TENANT_TABLE_NAME + " values ('us','" + TENANT_TYPE_ID + "',2,'Black Hat')"); -conn2.close(); -conn1.close(); -conn1 = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL); ResultSet rs = conn1.createStatement().executeQuery("select * from " + TENANT_TABLE_NAME + " where id = 1"); assertTrue("Expected 1 row in result set", rs.next()); assertEquals(1, rs.getInt(3)); assertEquals("Cheap Sunglasses", rs.getString(4)); assertFalse("Expected 1 row in result set", rs.next()); -c
[2/6] phoenix git commit: PHOENIX-3290 Move and/or combine as many NeedsOwnCluster tests to bring down test run time
http://git-wip-us.apache.org/repos/asf/phoenix/blob/a92f304b/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDMLIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDMLIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDMLIT.java index dbe767b..f26e6dd 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDMLIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDMLIT.java @@ -28,13 +28,11 @@ import static org.junit.Assert.fail; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; -import java.sql.SQLException; import java.util.List; import java.util.Properties; import org.apache.phoenix.query.KeyRange; import org.apache.phoenix.schema.TableNotFoundException; -import org.apache.phoenix.util.PhoenixRuntime; import org.apache.phoenix.util.PropertiesUtil; import org.junit.Test; @@ -43,23 +41,20 @@ public class TenantSpecificTablesDMLIT extends BaseTenantSpecificTablesIT { @Test public void testSelectWithLimit() throws Exception { - Connection conn = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL); + Connection conn = DriverManager.getConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL, PropertiesUtil.deepCopy(TEST_PROPERTIES)); ResultSet rs = conn.createStatement().executeQuery("SELECT * FROM " + TENANT_TABLE_NAME + " LIMIT 100"); while(rs.next()) {} } @Test public void testBasicUpsertSelect() throws Exception { -Connection conn = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL); +Connection conn = DriverManager.getConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL, PropertiesUtil.deepCopy(TEST_PROPERTIES)); try { conn.setAutoCommit(false); conn.createStatement().executeUpdate("upsert into " + TENANT_TABLE_NAME + " (id, tenant_col) values (1, 'Cheap Sunglasses')"); conn.createStatement().executeUpdate("upsert into " + TENANT_TABLE_NAME + " (id, tenant_col) values (2, 'Viva Las Vegas')"); conn.commit(); -conn.close(); -conn = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL); analyzeTable(conn, TENANT_TABLE_NAME); -conn = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL); ResultSet rs = conn.createStatement().executeQuery("select tenant_col from " + TENANT_TABLE_NAME + " where id = 1"); assertTrue("Expected 1 row in result set", rs.next()); assertEquals("Cheap Sunglasses", rs.getString(1)); @@ -72,49 +67,37 @@ public class TenantSpecificTablesDMLIT extends BaseTenantSpecificTablesIT { @Test public void testBasicUpsertSelect2() throws Exception { -Connection conn1 = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL); -createTestTable(PHOENIX_JDBC_TENANT_SPECIFIC_URL2, TENANT_TABLE_DDL, null, nextTimestamp()); -Connection conn2 = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL2); +Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); +Connection conn1 = DriverManager.getConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL, props); +createTestTable(PHOENIX_JDBC_TENANT_SPECIFIC_URL2, TENANT_TABLE_DDL); +Connection conn2 = DriverManager.getConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL2, props); try { conn1.setAutoCommit(false); conn1.createStatement().executeUpdate("upsert into " + TENANT_TABLE_NAME + " values ('me','" + TENANT_TYPE_ID + "',1,'Cheap Sunglasses')"); conn1.createStatement().executeUpdate("upsert into " + TENANT_TABLE_NAME + " values ('you','" + TENANT_TYPE_ID +"',2,'Viva Las Vegas')"); conn1.commit(); -conn1 = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL); analyzeTable(conn1, TENANT_TABLE_NAME); -conn1 = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL); conn2.setAutoCommit(true); conn2.createStatement().executeUpdate("upsert into " + TENANT_TABLE_NAME + " values ('them','" + TENANT_TYPE_ID + "',1,'Long Hair')"); conn2.createStatement().executeUpdate("upsert into " + TENANT_TABLE_NAME + " values ('us','" + TENANT_TYPE_ID + "',2,'Black Hat')"); -conn2.close(); -conn1.close(); -conn1 = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL); ResultSet rs = conn1.createStatement().executeQuery("select * from " + TENANT_TABLE_NAME + " where id = 1"); assertTrue("Expected 1 row in result set", rs.next()); assertEquals(1, rs.getInt(3)); assertEquals("Cheap Sunglasses", rs.getString(4)); assertFalse("Expected 1 row in result set", rs.next()); -c
[2/6] phoenix git commit: PHOENIX-3290 Move and/or combine as many NeedsOwnCluster tests to bring down test run time
http://git-wip-us.apache.org/repos/asf/phoenix/blob/faad4ad3/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexOnOwnClusterIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexOnOwnClusterIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexOnOwnClusterIT.java deleted file mode 100644 index 0c3b168..000 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexOnOwnClusterIT.java +++ /dev/null @@ -1,337 +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.phoenix.end2end.index; - -import static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.Properties; - -import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.hbase.HRegionInfo; -import org.apache.hadoop.hbase.TableName; -import org.apache.hadoop.hbase.catalog.CatalogTracker; -import org.apache.hadoop.hbase.catalog.MetaReader; -import org.apache.hadoop.hbase.client.HBaseAdmin; -import org.apache.hadoop.hbase.util.Bytes; -import org.apache.phoenix.end2end.BaseOwnClusterHBaseManagedTimeIT; -import org.apache.phoenix.end2end.IndexToolIT; -import org.apache.phoenix.jdbc.PhoenixConnection; -import org.apache.phoenix.mapreduce.index.IndexTool; -import org.apache.phoenix.query.QueryServices; -import org.apache.phoenix.query.QueryServicesOptions; -import org.apache.phoenix.util.ByteUtil; -import org.apache.phoenix.util.PropertiesUtil; -import org.apache.phoenix.util.QueryUtil; -import org.apache.phoenix.util.ReadOnlyProps; -import org.apache.phoenix.util.SchemaUtil; -import org.apache.phoenix.util.TestUtil; -import org.junit.BeforeClass; -import org.junit.Test; - -import com.google.common.collect.Maps; - -public class IndexOnOwnClusterIT extends BaseOwnClusterHBaseManagedTimeIT { - -@BeforeClass -public static void doSetup() throws Exception { -Map serverProps = Maps.newHashMapWithExpectedSize(1); -serverProps.put(QueryServices.EXTRA_JDBC_ARGUMENTS_ATTRIB, -QueryServicesOptions.DEFAULT_EXTRA_JDBC_ARGUMENTS); -setUpRealDriver(new ReadOnlyProps(serverProps.entrySet().iterator()), -ReadOnlyProps.EMPTY_PROPS); -} - -@Test -public void testDeleteFromImmutable() throws Exception { -Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); -try (Connection conn = DriverManager.getConnection(getUrl(), props)) { -conn.createStatement().execute("CREATE TABLE TEST_TABLE (\n" + -"pk1 VARCHAR NOT NULL,\n" + -"pk2 VARCHAR NOT NULL,\n" + -"pk3 VARCHAR\n" + -"CONSTRAINT PK PRIMARY KEY \n" + -"(\n" + -"pk1,\n" + -"pk2,\n" + -"pk3\n" + -")\n" + -") IMMUTABLE_ROWS=true"); -conn.createStatement().execute("upsert into TEST_TABLE (pk1, pk2, pk3) values ('a', '1', '1')"); -conn.createStatement().execute("upsert into TEST_TABLE (pk1, pk2, pk3) values ('b', '2', '2')"); -conn.commit(); -conn.createStatement().execute("CREATE INDEX TEST_INDEX ON TEST_TABLE (pk3, pk2) ASYNC"); - -// this delete will be issued at a timestamp later than the above timestamp of the index table -conn.createStatement().execute("delete from TEST_TABLE where pk1 = 'a'"); -conn.commit(); - -// run the index MR job -final IndexTool indexingTool = new IndexTool(); -indexingTool.setConf(new Configuration(getUtility().getConfiguration())); -final String[] cmdArgs = -I
[2/6] phoenix git commit: PHOENIX-3290 Move and/or combine as many NeedsOwnCluster tests to bring down test run time
http://git-wip-us.apache.org/repos/asf/phoenix/blob/925252cb/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexOnOwnClusterIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexOnOwnClusterIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexOnOwnClusterIT.java deleted file mode 100644 index 4f0da4d..000 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexOnOwnClusterIT.java +++ /dev/null @@ -1,324 +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.phoenix.end2end.index; - -import static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.Properties; - -import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.hbase.HRegionInfo; -import org.apache.hadoop.hbase.MetaTableAccessor; -import org.apache.hadoop.hbase.TableName; -import org.apache.hadoop.hbase.client.HBaseAdmin; -import org.apache.hadoop.hbase.util.Bytes; -import org.apache.phoenix.end2end.BaseOwnClusterHBaseManagedTimeIT; -import org.apache.phoenix.end2end.IndexToolIT; -import org.apache.phoenix.jdbc.PhoenixConnection; -import org.apache.phoenix.mapreduce.index.IndexTool; -import org.apache.phoenix.query.QueryServices; -import org.apache.phoenix.query.QueryServicesOptions; -import org.apache.phoenix.util.ByteUtil; -import org.apache.phoenix.util.PropertiesUtil; -import org.apache.phoenix.util.QueryUtil; -import org.apache.phoenix.util.ReadOnlyProps; -import org.apache.phoenix.util.SchemaUtil; -import org.apache.phoenix.util.TestUtil; -import org.junit.BeforeClass; -import org.junit.Test; - -import com.google.common.collect.Maps; - -public class IndexOnOwnClusterIT extends BaseOwnClusterHBaseManagedTimeIT { - -@BeforeClass -public static void doSetup() throws Exception { -Map serverProps = Maps.newHashMapWithExpectedSize(1); -serverProps.put(QueryServices.EXTRA_JDBC_ARGUMENTS_ATTRIB, -QueryServicesOptions.DEFAULT_EXTRA_JDBC_ARGUMENTS); -setUpRealDriver(new ReadOnlyProps(serverProps.entrySet().iterator()), -ReadOnlyProps.EMPTY_PROPS); -} - -@Test -public void testDeleteFromImmutable() throws Exception { -Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); -try (Connection conn = DriverManager.getConnection(getUrl(), props)) { -conn.createStatement().execute("CREATE TABLE TEST_TABLE (\n" + -"pk1 VARCHAR NOT NULL,\n" + -"pk2 VARCHAR NOT NULL,\n" + -"pk3 VARCHAR\n" + -"CONSTRAINT PK PRIMARY KEY \n" + -"(\n" + -"pk1,\n" + -"pk2,\n" + -"pk3\n" + -")\n" + -") IMMUTABLE_ROWS=true"); -conn.createStatement().execute("upsert into TEST_TABLE (pk1, pk2, pk3) values ('a', '1', '1')"); -conn.createStatement().execute("upsert into TEST_TABLE (pk1, pk2, pk3) values ('b', '2', '2')"); -conn.commit(); -conn.createStatement().execute("CREATE INDEX TEST_INDEX ON TEST_TABLE (pk3, pk2) ASYNC"); - -// this delete will be issued at a timestamp later than the above timestamp of the index table -conn.createStatement().execute("delete from TEST_TABLE where pk1 = 'a'"); -conn.commit(); - -// run the index MR job -final IndexTool indexingTool = new IndexTool(); -indexingTool.setConf(new Configuration(getUtility().getConfiguration())); -final String[] cmdArgs = -IndexToolIT.getArgValues(null, "TEST_TABLE", "TEST_INDEX",
[2/6] phoenix git commit: PHOENIX-3290 Move and/or combine as many NeedsOwnCluster tests to bring down test run time
http://git-wip-us.apache.org/repos/asf/phoenix/blob/14d16c85/phoenix-core/src/it/java/org/apache/phoenix/end2end/RoundFloorCeilFunctionsEnd2EndIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/RoundFloorCeilFunctionsEnd2EndIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/RoundFloorCeilFunctionsEnd2EndIT.java deleted file mode 100644 index c365934..000 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/RoundFloorCeilFunctionsEnd2EndIT.java +++ /dev/null @@ -1,686 +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.phoenix.end2end; - -import static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES; -import static org.apache.phoenix.util.TestUtil.closeStmtAndConn; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import java.math.BigDecimal; -import java.sql.Connection; -import java.sql.Date; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Properties; - -import org.apache.phoenix.expression.function.CeilFunction; -import org.apache.phoenix.expression.function.FloorFunction; -import org.apache.phoenix.expression.function.RoundFunction; -import org.apache.phoenix.query.QueryServices; -import org.apache.phoenix.util.DateUtil; -import org.apache.phoenix.util.PhoenixRuntime; -import org.apache.phoenix.util.PropertiesUtil; -import org.junit.Before; -import org.junit.Test; - -import com.google.common.primitives.Doubles; -import com.google.common.primitives.Floats; - -/** - * - * End to end tests for {@link RoundFunction}, {@link FloorFunction}, {@link CeilFunction} - * - * - * @since 3.0.0 - */ - - -public class RoundFloorCeilFunctionsEnd2EndIT extends BaseHBaseManagedTimeTableReuseIT { - - private static final String TABLE_NAME = generateRandomString(); - private static long millisPart = 660; -private static int nanosPart = 500100; -private static BigDecimal decimalUpserted = BigDecimal.valueOf(1.264); -private static double doubleUpserted = 1.264d; -private static double unsignedDoubleUpserted = 1.264d; -private static float floatUpserted = 1.264f; -private static float unsignedFloatUpserted = 1.264f; - -@Before -public void initTable() throws Exception { -String testString = "abc"; -Connection conn = null; -PreparedStatement stmt = null; -try { -conn = DriverManager.getConnection(getUrl()); -String ddl = "CREATE TABLE IF NOT EXISTS " + TABLE_NAME -+ " (s VARCHAR NOT NULL PRIMARY KEY, dt DATE, t TIME, ts TIMESTAMP, dec DECIMAL, doub DOUBLE, undoub UNSIGNED_DOUBLE, fl FLOAT, unfl UNSIGNED_FLOAT)"; -conn.createStatement().execute(ddl); - -Date dateUpserted = DateUtil.parseDate("2012-01-01 14:25:28"); -dateUpserted = new Date(dateUpserted.getTime() + millisPart); // this makes the dateUpserted equivalent to 2012-01-01 14:25:28.660 -long millis = dateUpserted.getTime(); - -Time timeUpserted = new Time(millis); -Timestamp tsUpserted = DateUtil.getTimestamp(millis, nanosPart); - -stmt = conn.prepareStatement( -"UPSERT INTO " + TABLE_NAME + " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)"); -stmt.setString(1, testString); -stmt.setDate(2, dateUpserted); -stmt.setTime(3, timeUpserted); -stmt.setTimestamp(4, tsUpserted); -stmt.setBigDecimal(5, decimalUpserted); -stmt.setDouble(6, doubleUpserted); -stmt.setDouble(7, unsignedDoubleUpserted); -stmt.setFloat(8, floatUpserted); -stmt.setFloat(9, unsignedFloatUpserted); -stmt.executeUpdate(); -conn.commit(); -} finally { -closeStmtAndConn(stmt, conn); -} -} - -@Test -public void testRoundingUpDate() throws Exception { -Connection conn = DriverManager.getConnection(getUrl()); -Res