diff options
Diffstat (limited to 'das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data')
21 files changed, 1019 insertions, 0 deletions
diff --git a/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/BookData.java b/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/BookData.java new file mode 100644 index 0000000000..632a4d057d --- /dev/null +++ b/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/BookData.java @@ -0,0 +1,46 @@ +/* + * 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.tuscany.das.rdb.test.data; + +import java.sql.Connection; +import java.sql.Types; + +import org.apache.tuscany.das.rdb.test.framework.TestDataWithExplicitColumns; + +public class BookData extends TestDataWithExplicitColumns { + + // CREATE TABLE BOOK (ID INT PRIMARY KEY NOT NULL, NAME VARCHAR(50), AUTHOR VARCHAR(30), QUANTITY INT, OCC INTEGER) + + private static int[] bookTypes = {Types.INTEGER, Types.VARCHAR, Types.VARCHAR, Types.INTEGER, Types.INTEGER}; + + private static Object[][] bookData = {{Integer.valueOf(1), "The Brothers Karamazov", "Fyodor Dostoevsky", + Integer.valueOf(5), Integer.valueOf(17)}, + {Integer.valueOf(2), "Cat in the Hat", "Doctor Seuss", Integer.valueOf(10), Integer.valueOf(1)}}; + + private static String[] bookColumns = {"BOOK_ID", "NAME", "AUTHOR", "QUANTITY", "OCC"}; + + public BookData(Connection connection) { + super(connection, bookData, bookColumns, bookTypes); + } + + public String getTableName() { + return "BOOK"; + } + +} diff --git a/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CityData.java b/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CityData.java new file mode 100644 index 0000000000..7ce5cf757d --- /dev/null +++ b/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CityData.java @@ -0,0 +1,54 @@ +/* + * 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.tuscany.das.rdb.test.data; + +import java.sql.Connection; +import java.sql.SQLException; + +import org.apache.tuscany.das.rdb.test.framework.TestData; + +public class CityData extends TestData { + + private static Object[][] cityData = {{Integer.valueOf(1), "Lizard Lick", "1"}, + {Integer.valueOf(2), "Morrisville", "1"}, + {Integer.valueOf(3), "Breckenridge", "2"}, + {Integer.valueOf(4), "Barstow", "3"}, + {Integer.valueOf(5), "Sacramento", "3"} + + }; + + public CityData(Connection c) { + super(c, cityData); + } + + public String getTableName() { + return "CITIES"; + } + + public void doDeletes() throws SQLException { + deleteRowsFromTable(); + + } + + public void doInserts() throws SQLException { + insertRows(); + + } + +} diff --git a/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyData.java b/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyData.java new file mode 100644 index 0000000000..0c28ed2caa --- /dev/null +++ b/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyData.java @@ -0,0 +1,44 @@ +/* + * 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.tuscany.das.rdb.test.data; + +import java.sql.Connection; +import java.sql.Types; + +import org.apache.tuscany.das.rdb.test.framework.TestDataWithExplicitColumns; + +public class CompanyData extends TestDataWithExplicitColumns { + + // CREATE TABLE COMPANY (ID INT PRIMARY KEY NOT NULL GENERATED ALWAYS AS IDENTITY ,NAME VARCHAR(30)) + + private static int[] columnTypes = {Types.VARCHAR}; + + private static Object[][] companyData = {{"ACME Publishing"}, {"Do-rite plumbing"}, {"MegaCorp"}}; + + private static String[] companyColumns = {"NAME"}; + + public CompanyData(Connection connection) { + super(connection, companyData, companyColumns, columnTypes); + } + + public String getTableName() { + return "COMPANY"; + } + +} diff --git a/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyDeptData.java b/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyDeptData.java new file mode 100644 index 0000000000..686e3243cb --- /dev/null +++ b/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyDeptData.java @@ -0,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.tuscany.das.rdb.test.data; + +import java.sql.Connection; + +import org.apache.tuscany.das.rdb.test.framework.RelationshipData; + +public class CompanyDeptData extends RelationshipData { + + private static Object[][] data = {{"MegaCorp", "Advanced Technologies"}}; + + public CompanyDeptData(Connection c) { + super(c, data); + } + + protected String getParentRetrievalStatement() { + return "select id from company where name = ?"; + } + + protected String getChildUpdateStatement() { + return "update department set companyid = ? where department.name = ?"; + } + +} diff --git a/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyEmpData.java b/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyEmpData.java new file mode 100644 index 0000000000..b1d3fb12b5 --- /dev/null +++ b/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyEmpData.java @@ -0,0 +1,45 @@ +/* + * 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.tuscany.das.rdb.test.data; + +import java.sql.Connection; + +import org.apache.tuscany.das.rdb.test.framework.RelationshipData; + + +public class CompanyEmpData extends RelationshipData { + + protected static Object[][] data = { + {"Mary Smith", "ACME Publishing" }, + {"Jane Doe", "Do-rite plumbing"}, + {"Al Smith", "MegaCorp"}}; + + public CompanyEmpData(Connection c) { + super(c, data); + } + + protected String getParentRetrievalStatement() { + return "select employee.id from employee where employee.name = ?"; + } + + protected String getChildUpdateStatement() { + return "update company set company.eotmid = ? where company.name = ?"; + } + +} diff --git a/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CustomerData.java b/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CustomerData.java new file mode 100644 index 0000000000..9ec6c8003d --- /dev/null +++ b/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CustomerData.java @@ -0,0 +1,39 @@ +/* + * 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.tuscany.das.rdb.test.data; + +import java.sql.Connection; + +import org.apache.tuscany.das.rdb.test.framework.TestData; + +public class CustomerData extends TestData { + + private static Object[][] customerData = {{Integer.valueOf(1), "Williams", "1212 foobar lane"}, + {Integer.valueOf(2), "Daniel", "156 Brentfield Loop"}, {Integer.valueOf(3), "Williams", "456 penny lane"}, + {Integer.valueOf(4), "Williams", "5000 pineville"}, {Integer.valueOf(5), "Williams", "100000 firefly lane"}}; + + public CustomerData(Connection connection) { + super(connection, customerData); + } + + public String getTableName() { + return "CUSTOMER"; + } + +} diff --git a/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DepEmpData.java b/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DepEmpData.java new file mode 100644 index 0000000000..ad8ff14e86 --- /dev/null +++ b/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DepEmpData.java @@ -0,0 +1,43 @@ +/* + * 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.tuscany.das.rdb.test.data; + +import java.sql.Connection; + +import org.apache.tuscany.das.rdb.test.framework.RelationshipData; + +public class DepEmpData extends RelationshipData { + + private static Object[][] data = {{"Advanced Technologies", "John Jones"}, + {"Advanced Technologies", "Jane Doe"}, + {"Advanced Technologies", "Al Smith"}}; + + public DepEmpData(Connection c) { + super(c, data); + } + + protected String getParentRetrievalStatement() { + return "select department.id from department where department.name = ?"; + } + + protected String getChildUpdateStatement() { + return "update employee set employee.departmentid = ? where employee.name = ?"; + } + +} diff --git a/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DepartmentData.java b/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DepartmentData.java new file mode 100644 index 0000000000..2373e9aa88 --- /dev/null +++ b/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DepartmentData.java @@ -0,0 +1,44 @@ +/* + * 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.tuscany.das.rdb.test.data; + +import java.sql.Connection; +import java.sql.Types; + +import org.apache.tuscany.das.rdb.test.framework.TestDataWithExplicitColumns; + + +public class DepartmentData extends TestDataWithExplicitColumns { + + private static int[] columnTypes = {Types.VARCHAR, Types.VARCHAR, Types.VARCHAR}; + + private static Object[][] deptData = {{"Advanced Technologies", "NY", "123" }, + {"New Technologies", "CA", "125" }}; + + private static String[] deptColumns = {"NAME", "LOCATION", "DEPNUMBER"}; + + public DepartmentData(Connection connection) { + super(connection, deptData, deptColumns, columnTypes); + } + + public String getTableName() { + return "DEPARTMENT"; + } + +} diff --git a/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DogData.java b/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DogData.java new file mode 100644 index 0000000000..3c686e6fea --- /dev/null +++ b/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DogData.java @@ -0,0 +1,54 @@ +/* + * 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.tuscany.das.rdb.test.data; + +import java.sql.Connection; +import java.sql.Types; + +import org.apache.tuscany.das.rdb.test.framework.TestDataWithExplicitColumns; + +public class DogData extends TestDataWithExplicitColumns { + + /* CREATE TABLE DOG ( + ID INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, + OWNER_ID INTEGER UNSIGNED NOT NULL, + NAME VARCHAR(20) NOT NULL, + BREED VARCHAR(20) NULL, + OCC_COUNT INTEGER UNSIGNED NULL, + PRIMARY KEY(ID), + );*/ + + //id and owner_id omitted. id is auto-generated. owner_id is filled in by DogOwner data + private static int[] columnTypes = {Types.VARCHAR, Types.VARCHAR, Types.INTEGER}; + + private static Object[][] data = {{"Fido", "Mutt", Integer.valueOf(1)}, + {"Max", "German Shepherd", Integer.valueOf(1)}, + {"Saddie", "Collie", Integer.valueOf(1)}}; + + private static String[] columns = {"NAME", "BREED", "OCC_COUNT"}; + + public DogData(Connection connection) { + super(connection, data, columns, columnTypes); + } + + public String getTableName() { + return "DOG"; + } + +} diff --git a/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/EmployeeData.java b/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/EmployeeData.java new file mode 100644 index 0000000000..402d62fb67 --- /dev/null +++ b/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/EmployeeData.java @@ -0,0 +1,46 @@ +/* + * 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.tuscany.das.rdb.test.data; + +import java.sql.Connection; +import java.sql.Types; + +import org.apache.tuscany.das.rdb.test.framework.TestDataWithExplicitColumns; + +public class EmployeeData extends TestDataWithExplicitColumns { + + private static int[] columnTypes = {Types.VARCHAR, Types.VARCHAR, Types.SMALLINT}; + + private static Object[][] employeeData = {{"John Jones", "E0001", Boolean.valueOf(false)}, + {"Mary Smith", "E0002", Boolean.valueOf(true)}, + {"Jane Doe", "E0003", Boolean.valueOf(false)}, + {"Al Smith", "E0004", Boolean.valueOf(true)}, + {"John Smith", "E0005", Boolean.valueOf(false)}}; + + private static String[] employeeColumns = {"NAME", "SN", "MANAGER"}; + + public EmployeeData(Connection connection) { + super(connection, employeeData, employeeColumns, columnTypes); + } + + public String getTableName() { + return "EMPLOYEE"; + } + +} diff --git a/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/KennelData.java b/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/KennelData.java new file mode 100644 index 0000000000..01423ee40e --- /dev/null +++ b/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/KennelData.java @@ -0,0 +1,53 @@ +/* + * 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.tuscany.das.rdb.test.data; + +import java.sql.Connection; +import java.sql.Types; + +import org.apache.tuscany.das.rdb.test.framework.TestDataWithExplicitColumns; + +public class KennelData extends TestDataWithExplicitColumns { + + /* CREATE TABLE KENNEL ( + ID INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, + KNUMBER INTEGER UNSIGNED NULL, + KIND VARCHAR(20) NULL, + OCC_COUNT INTEGER UNSIGNED NULL, + PRIMARY KEY(ID) + );*/ + + //id omitted. id is auto-generated. + private static int[] columnTypes = {Types.INTEGER, Types.VARCHAR, Types.INTEGER}; + + private static Object[][] data = {{Integer.valueOf(100), "Small", Integer.valueOf(1)}, + {Integer.valueOf(101), "Small", Integer.valueOf(1)}, + {Integer.valueOf(102), "Large", Integer.valueOf(1)}}; + + private static String[] columns = {"KNUMBER", "KIND", "OCC_COUNT"}; + + public KennelData(Connection connection) { + super(connection, data, columns, columnTypes); + } + + public String getTableName() { + return "KENNEL"; + } + +} diff --git a/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/MultiSchemaData.java b/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/MultiSchemaData.java new file mode 100644 index 0000000000..bc59c09fb2 --- /dev/null +++ b/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/MultiSchemaData.java @@ -0,0 +1,99 @@ +/*
+ * 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.tuscany.das.rdb.test.data;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.sql.Statement;
+//JIRA-952
+public class MultiSchemaData {
+ Connection con;
+
+ public MultiSchemaData(Connection connection){
+ this.con = connection;
+ }
+
+ public void refresh() throws SQLException{
+ //System.out.println("Inserting data in multi schema tables");
+ Statement s = this.con.createStatement();
+
+ String[] statements = {
+ "DELETE FROM DASTEST1.CUSTOMER",
+ "DELETE FROM DASTEST1.EMPLOYEE",
+ "DELETE FROM DASTEST1.CITY",
+ "DELETE FROM DASTEST1.ORDERDETAILS",
+ "DELETE FROM DASTEST2.CUSTOMER",
+ "DELETE FROM DASTEST2.CITY",
+ "DELETE FROM DASTEST2.ACCOUNT",
+ "DELETE FROM DASTEST3.CUSTOMER",
+ "DELETE FROM DASTEST3.CUSTORDER",
+ "DELETE FROM DASTEST3.ORDERDETAILSDESC",
+
+ "INSERT INTO DASTEST1.CUSTOMER (ID, LASTNAME, ADDRESS) VALUES (1,'Williams','USA')",
+ "INSERT INTO DASTEST1.CUSTOMER (ID, LASTNAME, ADDRESS) VALUES (2,'Amita1','INDIA')",
+ "INSERT INTO DASTEST1.CUSTOMER (ID, LASTNAME, ADDRESS) VALUES (3,'Patrick1','UK')",
+
+ "INSERT INTO DASTEST1.EMPLOYEE (ID, LASTNAME, ADDRESS) VALUES (1,'Williams','USA')",
+ "INSERT INTO DASTEST1.EMPLOYEE (ID, LASTNAME, ADDRESS) VALUES (2,'Amita1','INDIA')",
+ "INSERT INTO DASTEST1.EMPLOYEE (ID, LASTNAME, ADDRESS) VALUES (3,'Patrick1','UK')",
+
+ "INSERT INTO DASTEST2.CUSTOMER (ID, LASTNAME, ADDRESS) VALUES (1,'John2','USA')",
+ "INSERT INTO DASTEST2.CUSTOMER (ID, LASTNAME, ADDRESS) VALUES (2,'Amita2','INDIA')",
+ "INSERT INTO DASTEST2.CUSTOMER (ID, LASTNAME, ADDRESS) VALUES (3,'Patrick2','UK')",
+
+ "INSERT INTO DASTEST3.CUSTOMER (ID, LASTNAME, ADDRESS) VALUES (1,'JohnAdm','USA')",
+ "INSERT INTO DASTEST3.CUSTOMER (ID, LASTNAME, ADDRESS) VALUES (2,'AmitaAdm','INDIA')",
+ "INSERT INTO DASTEST3.CUSTOMER (ID, LASTNAME, ADDRESS) VALUES (3,'PatrickAdm','UK')",
+
+ "INSERT INTO DASTEST1.CITY (INDX, NAME) VALUES (1,'Fremont')",
+ "INSERT INTO DASTEST1.CITY (INDX, NAME) VALUES (2,'Belmont')",
+
+ "INSERT INTO DASTEST2.CITY (INDX, NAME) VALUES (1,'Milipitas')",
+ "INSERT INTO DASTEST2.CITY (INDX, NAME) VALUES (2,'Newark')",
+
+ "INSERT INTO DASTEST2.ACCOUNT (ACCOUNT_ID, CUSTOMER_ID, BALANCE) VALUES (10, 1, 101)",
+ "INSERT INTO DASTEST2.ACCOUNT (ACCOUNT_ID, CUSTOMER_ID, BALANCE) VALUES (20, 1, 202)",
+ "INSERT INTO DASTEST2.ACCOUNT (ACCOUNT_ID, CUSTOMER_ID, BALANCE) VALUES (30, 2, 303)",
+ "INSERT INTO DASTEST2.ACCOUNT (ACCOUNT_ID, CUSTOMER_ID, BALANCE) VALUES (40, 2, 404)",
+
+ "INSERT INTO DASTEST3.CUSTORDER (ORDER_ID, CUSTOMER_ID, ORDER_COUNT) VALUES (100,1,150)",
+ "INSERT INTO DASTEST3.CUSTORDER (ORDER_ID, CUSTOMER_ID, ORDER_COUNT) VALUES (200,1,250)",
+ "INSERT INTO DASTEST3.CUSTORDER (ORDER_ID, CUSTOMER_ID, ORDER_COUNT) VALUES (300,2,150)",
+ "INSERT INTO DASTEST3.CUSTORDER (ORDER_ID, CUSTOMER_ID, ORDER_COUNT) VALUES (400,2,250)",
+
+ "INSERT INTO DASTEST1.ORDERDETAILS (ORDERID, PRODUCTID, PRICE) VALUES (1,1,101)",
+ "INSERT INTO DASTEST1.ORDERDETAILS (ORDERID, PRODUCTID, PRICE) VALUES (1,2,102)",
+ "INSERT INTO DASTEST1.ORDERDETAILS (ORDERID, PRODUCTID, PRICE) VALUES (2,1,201)",
+ "INSERT INTO DASTEST1.ORDERDETAILS (ORDERID, PRODUCTID, PRICE) VALUES (2,2,202)",
+ "INSERT INTO DASTEST3.ORDERDETAILSDESC (ID, ORDERID, PRODUCTID, DESCR) VALUES (10,1,1, 'DESC 10,1,1')",
+ "INSERT INTO DASTEST3.ORDERDETAILSDESC (ID, ORDERID, PRODUCTID, DESCR) VALUES (20,1,1, 'DESC 20,1,1')",
+ "INSERT INTO DASTEST3.ORDERDETAILSDESC (ID, ORDERID, PRODUCTID, DESCR) VALUES (30,1,2, 'DESC 30,1,2')",
+ "INSERT INTO DASTEST3.ORDERDETAILSDESC (ID, ORDERID, PRODUCTID, DESCR) VALUES (40,1,2, 'DESC 40,1,2')",
+ "INSERT INTO DASTEST3.ORDERDETAILSDESC (ID, ORDERID, PRODUCTID, DESCR) VALUES (50,2,1, 'DESC 50,2,1')",
+ "INSERT INTO DASTEST3.ORDERDETAILSDESC (ID, ORDERID, PRODUCTID, DESCR) VALUES (60,2,2, 'DESC 60,2,2')"
+ };
+
+ for (int i = 0; i < statements.length; i++) {
+ s.execute(statements[i]);
+ }
+ s.close();
+ //System.out.println("Multi schema database setup complete!");
+ }
+}
diff --git a/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderData.java b/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderData.java new file mode 100644 index 0000000000..2568dd1a9f --- /dev/null +++ b/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderData.java @@ -0,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.tuscany.das.rdb.test.data; + +import java.sql.Connection; + +import org.apache.tuscany.das.rdb.test.framework.TestData; + +public class OrderData extends TestData { + + protected static Object[][] orderData = { + {Integer.valueOf(1), "recombobulator", Integer.valueOf(47), Integer.valueOf(1)}, + {Integer.valueOf(2), "wrench", Integer.valueOf(17), Integer.valueOf(3)}, + {Integer.valueOf(3), "pliers", Integer.valueOf(500), Integer.valueOf(1)}, + {Integer.valueOf(4), "Tooth Paste", Integer.valueOf(12), Integer.valueOf(2)}}; + + public OrderData(Connection c) { + super(c, orderData); + } + + public String getTableName() { + return "ANORDER"; + } + +} diff --git a/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderDetailsData.java b/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderDetailsData.java new file mode 100644 index 0000000000..9f5897b373 --- /dev/null +++ b/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderDetailsData.java @@ -0,0 +1,43 @@ +/* + * 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.tuscany.das.rdb.test.data; + +import java.sql.Connection; + +import org.apache.tuscany.das.rdb.test.framework.TestData; + +public class OrderDetailsData extends TestData { + + // CREATE TABLE ORDERDETAILS (ORDERID INT NOT NULL, PRODUCTID INT NOT NULL, PRICE FLOAT, + // PRIMARY KEY (ORDERID, PRODUCTID)) + + protected static Object[][] orderDetailsData = {{Integer.valueOf(1), Integer.valueOf(1), new Float(1.1)}, + {Integer.valueOf(1), Integer.valueOf(2), new Float(1.2)}, + {Integer.valueOf(2), Integer.valueOf(1), new Float(2.1)}, + {Integer.valueOf(2), Integer.valueOf(2), new Float(2.2)}}; + + public OrderDetailsData(Connection c) { + super(c, orderDetailsData); + } + + public String getTableName() { + return "ORDERDETAILS"; + } + +} diff --git a/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderDetailsDescriptionData.java b/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderDetailsDescriptionData.java new file mode 100644 index 0000000000..068b5a1ff4 --- /dev/null +++ b/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderDetailsDescriptionData.java @@ -0,0 +1,47 @@ + /*
+ * 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.tuscany.das.rdb.test.data;
+
+import java.sql.Connection;
+
+import org.apache.tuscany.das.rdb.test.framework.TestData;
+//JIRA-841
+public class OrderDetailsDescriptionData extends TestData {
+
+ // CREATE TABLE ORDERDETAILSDESC (ID INT NOT NULL, ORDERID INT NOT NULL, PRODUCTID INT NOT NULL,
+ // DESCR VARCHAR,
+ // PRIMARY KEY ID, FOREIGN KEY (ORDERID, PRODUCTID))
+
+ protected static Object[][] orderDetailsDescriptionData =
+ { {Integer.valueOf(1), Integer.valueOf(1), Integer.valueOf(1), "Descr 1,1,1"},
+ {Integer.valueOf(2), Integer.valueOf(1), Integer.valueOf(1), "Descr 2,1,1"},
+ {Integer.valueOf(3), Integer.valueOf(1), Integer.valueOf(2), "Descr 3,1,2"},
+ {Integer.valueOf(4), Integer.valueOf(1), Integer.valueOf(2), "Descr 4,1,2"},
+ {Integer.valueOf(5), Integer.valueOf(2), Integer.valueOf(1), "Descr 6,2,1"},
+ {Integer.valueOf(6), Integer.valueOf(2), Integer.valueOf(2), "Descr 6,2,2"}};
+
+ public OrderDetailsDescriptionData(Connection c) {
+ super(c, orderDetailsDescriptionData);
+ }
+
+ public String getTableName() {
+ return "ORDERDETAILSDESC";
+ }
+}
diff --git a/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OwnerData.java b/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OwnerData.java new file mode 100644 index 0000000000..b5198bce36 --- /dev/null +++ b/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OwnerData.java @@ -0,0 +1,53 @@ +/* + * 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.tuscany.das.rdb.test.data; + +import java.sql.Connection; +import java.sql.Types; + +import org.apache.tuscany.das.rdb.test.framework.TestDataWithExplicitColumns; + +public class OwnerData extends TestDataWithExplicitColumns { + + /* CREATE TABLE OWNER ( + ID INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, + NAME VARCHAR(20) NULL, + CONTACT_PHONE VARCHAR(20) NULL, + OCC_COUNT INTEGER UNSIGNED NULL, + PRIMARY KEY(ID) + );*/ + + //id omitted. id is auto-generated. + private static int[] columnTypes = {Types.VARCHAR, Types.VARCHAR, Types.INTEGER}; + + private static Object[][] data = {{"Fanny", "222-2222", Integer.valueOf(1)}, + {"Manny", "333-3333", Integer.valueOf(1)}, + {"Sammy", "444-4444", Integer.valueOf(1)}}; + + private static String[] columns = {"NAME", "CONTACT_PHONE", "OCC_COUNT"}; + + public OwnerData(Connection connection) { + super(connection, data, columns, columnTypes); + } + + public String getTableName() { + return "OWNER"; + } + +} diff --git a/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OwnerDogData.java b/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OwnerDogData.java new file mode 100644 index 0000000000..a06a2124f3 --- /dev/null +++ b/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OwnerDogData.java @@ -0,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.tuscany.das.rdb.test.data; + +import java.sql.Connection; + +import org.apache.tuscany.das.rdb.test.framework.RelationshipData; + +public class OwnerDogData extends RelationshipData { + + private static final Object[][] DATA = {{"Fanny", "Fido"}, {"Manny", "Max"}, {"Sammy", "Saddie"}}; + + public OwnerDogData(Connection c) { + super(c, DATA); + } + + protected String getParentRetrievalStatement() { + return "select ID from OWNER where NAME = ?"; + } + + protected String getChildUpdateStatement() { + return "update DOG set OWNER_ID = ? where NAME = ?"; + } + +} diff --git a/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/PartData.java b/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/PartData.java new file mode 100644 index 0000000000..ff59b03aef --- /dev/null +++ b/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/PartData.java @@ -0,0 +1,48 @@ +/* + * 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.tuscany.das.rdb.test.data; + +import java.sql.Connection; +import java.sql.Types; + +import org.apache.tuscany.das.rdb.test.framework.TestDataWithExplicitColumns; + +public class PartData extends TestDataWithExplicitColumns { + + // CREATE TABLE PART (ID INT PRIMARY KEY NOT NULL, NAME VARCHAR(50), QUANTITY INT, PARENT_ID INT ) + + private static String[] partColumns = {"ID", "NAME", "QUANTITY", "PARENT_ID"}; + + private static int[] columnTypes = {Types.INTEGER, Types.VARCHAR, Types.INTEGER, Types.INTEGER}; + + private static Object[][] partData = {{Integer.valueOf(1), "Engine", Integer.valueOf(1), null}, + {Integer.valueOf(2), "Block", Integer.valueOf(1), Integer.valueOf(1)}, + {Integer.valueOf(3), "Cam Shaft", Integer.valueOf(2), Integer.valueOf(1)}, + {Integer.valueOf(4), "Piston", Integer.valueOf(8), Integer.valueOf(1)}, + {Integer.valueOf(5), "Piston Ring", Integer.valueOf(2), Integer.valueOf(4)}}; + + public PartData(Connection connection) { + super(connection, partData, partColumns, columnTypes); + } + + public String getTableName() { + return "PART"; + } + +} diff --git a/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/StateData.java b/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/StateData.java new file mode 100644 index 0000000000..713aecb9a3 --- /dev/null +++ b/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/StateData.java @@ -0,0 +1,48 @@ +/* + * 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.tuscany.das.rdb.test.data; + +import java.sql.Connection; +import java.sql.SQLException; + +import org.apache.tuscany.das.rdb.test.framework.TestData; + +public class StateData extends TestData { + private static Object[][] stateData = {{Integer.valueOf(1), "NC"}, {Integer.valueOf(2), "CO"}, + {Integer.valueOf(3), "CA"}}; + + public StateData(Connection c) { + super(c, stateData); + } + + public String getTableName() { + return "STATES"; + } + + + public void doDeletes() throws SQLException { + deleteRowsFromTable(); + } + + public void doInserts() throws SQLException { + insertRows(); + + } + +} diff --git a/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/TypesData.java b/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/TypesData.java new file mode 100644 index 0000000000..0aac15fb7d --- /dev/null +++ b/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/TypesData.java @@ -0,0 +1,38 @@ +/* + * 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.tuscany.das.rdb.test.data; + +import java.sql.Connection; + +import org.apache.tuscany.das.rdb.test.framework.TestData; + +public class TypesData extends TestData { + + private static Object[][] customerData = {{Integer.valueOf(1), TIMESTAMP, + new Float(1234567.89), new Float(1234567.89)}}; + + public TypesData(Connection connection) { + super(connection, customerData); + } + + public String getTableName() { + return "TYPETEST"; + } + +} diff --git a/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/VisitData.java b/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/VisitData.java new file mode 100644 index 0000000000..c9cebc7688 --- /dev/null +++ b/das-java/tags/1.0-incubating-beta1-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/VisitData.java @@ -0,0 +1,52 @@ +/* + * 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.tuscany.das.rdb.test.data; + +import java.sql.Connection; +import java.sql.Types; + +import org.apache.tuscany.das.rdb.test.framework.TestDataWithExplicitColumns; + +public class VisitData extends TestDataWithExplicitColumns { + + /* + * CREATE TABLE VISIT ( ID INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, + * CHECK_IN TIMESTAMP NULL, CHECK_OUT TIMESTAMP NULL, OCC_COUNT INTEGER UNSIGNED + * NULL, PRIMARY KEY(ID) ); + */ + + // id omitted. id is auto-generated. + private static int[] columnTypes = {Types.TIMESTAMP, Types.TIMESTAMP, Types.INTEGER}; + + private static Object[][] data = { + {getTimestamp("2006-10-20 00:00:00.0"), getTimestamp("2006-10-22 00:00:00.0"), Integer.valueOf(1)}, + {getTimestamp("2006-10-20 00:00:00.0"), getTimestamp("2006-10-22 00:00:00.0"), Integer.valueOf(1)}, + {getTimestamp("2006-10-20 00:00:00.0"), getTimestamp("2006-10-22 00:00:00.0"), Integer.valueOf(1)}}; + + private static String[] columns = {"CHECK_IN", "CHECK_OUT", "OCC_COUNT"}; + + public VisitData(Connection connection) { + super(connection, data, columns, columnTypes); + } + + public String getTableName() { + return "VISIT"; + } + +} |