diff options
Diffstat (limited to 'das-java/tags/1.0-incubating-beta2/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data')
24 files changed, 1180 insertions, 0 deletions
diff --git a/das-java/tags/1.0-incubating-beta2/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/BookData.java b/das-java/tags/1.0-incubating-beta2/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/BookData.java new file mode 100644 index 0000000000..33f7152c04 --- /dev/null +++ b/das-java/tags/1.0-incubating-beta2/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 = {{new Integer(1), "The Brothers Karamazov", "Fyodor Dostoevsky", + new Integer(5), new Integer(17)}, + {new Integer(2), "Cat in the Hat", "Doctor Seuss", new Integer(10), new Integer(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-beta2/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CityData.java b/das-java/tags/1.0-incubating-beta2/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CityData.java new file mode 100644 index 0000000000..6a99f825e7 --- /dev/null +++ b/das-java/tags/1.0-incubating-beta2/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 = {{new Integer(1), "Lizard Lick", "1"}, + {new Integer(2), "Morrisville", "1"}, + {new Integer(3), "Breckenridge", "2"}, + {new Integer(4), "Barstow", "3"}, + {new Integer(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-beta2/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyData.java b/das-java/tags/1.0-incubating-beta2/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-beta2/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-beta2/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyDeptData.java b/das-java/tags/1.0-incubating-beta2/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-beta2/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-beta2/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyEmpData.java b/das-java/tags/1.0-incubating-beta2/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-beta2/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-beta2/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CustomerData.java b/das-java/tags/1.0-incubating-beta2/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CustomerData.java new file mode 100644 index 0000000000..f64b0076b8 --- /dev/null +++ b/das-java/tags/1.0-incubating-beta2/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 = {{new Integer(1), "Williams", "1212 foobar lane"}, + {new Integer(2), "Daniel", "156 Brentfield Loop"}, {new Integer(3), "Williams", "456 penny lane"}, + {new Integer(4), "Williams", "5000 pineville"}, {new Integer(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-beta2/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DepEmpData.java b/das-java/tags/1.0-incubating-beta2/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-beta2/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-beta2/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DepartmentData.java b/das-java/tags/1.0-incubating-beta2/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DepartmentData.java new file mode 100644 index 0000000000..54e2713498 --- /dev/null +++ b/das-java/tags/1.0-incubating-beta2/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, Types.INTEGER}; + + private static Object[][] deptData = {{"Advanced Technologies", "NY", "123", new Integer(1) }, + {"New Technologies", "CA", "125", new Integer(2) }}; + + private static String[] deptColumns = {"NAME", "LOCATION", "DEPNUMBER", "COMPANYID"}; + + public DepartmentData(Connection connection) { + super(connection, deptData, deptColumns, columnTypes); + } + + public String getTableName() { + return "DEPARTMENT"; + } + +} diff --git a/das-java/tags/1.0-incubating-beta2/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DocumentsImagesData.java b/das-java/tags/1.0-incubating-beta2/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DocumentsImagesData.java new file mode 100644 index 0000000000..98954fade4 --- /dev/null +++ b/das-java/tags/1.0-incubating-beta2/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DocumentsImagesData.java @@ -0,0 +1,72 @@ +/*
+ * 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.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.sql.Types;
+
+import javax.sql.rowset.serial.SerialBlob;
+
+import org.apache.tuscany.das.rdb.test.framework.TestDataWithExplicitColumns;
+
+public class DocumentsImagesData extends TestDataWithExplicitColumns {
+
+ public DocumentsImagesData(Connection connection) {
+ super(connection, null, null, null);
+ }
+
+ public String getTableName() {
+ return "DOCUMENTS_IMAGES";
+ }
+
+ //Due to special processing, not using superclass methods.
+ protected void insertRows() throws SQLException {
+ try{
+ InputStream fileAsciiStream = this.getClass().getClassLoader().getResourceAsStream("asciifile.txt");
+ PreparedStatement ps = this.connection.prepareStatement("INSERT INTO DOCUMENTS_IMAGES VALUES (?, ?, ?)");
+ ps.setInt(1, 100);
+
+ // - set the value of the input parameter to the input stream
+ ps.setAsciiStream(2, fileAsciiStream, fileAsciiStream.available());
+
+ //Blob
+ InputStream fileImgStream = this.getClass().getClassLoader().getResourceAsStream("moin-www.png");
+ byte[] imgBytes = new byte[fileImgStream.available()];
+ int i=0;
+ while(fileImgStream.available()>0){
+ imgBytes[i] = (byte)fileImgStream.read();
+ i++;
+ }
+ SerialBlob serialBlob = new SerialBlob(imgBytes);
+ ps.setBlob(3, serialBlob);
+ ps.execute();
+ ps.close();
+ }catch(IOException ioe){
+ ioe.printStackTrace();
+ throw new RuntimeException("Could not insert data for Blob/Clob..Please check resources!"+ioe.getMessage());
+ }
+ }
+}
diff --git a/das-java/tags/1.0-incubating-beta2/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DogData.java b/das-java/tags/1.0-incubating-beta2/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DogData.java new file mode 100644 index 0000000000..96346ff21d --- /dev/null +++ b/das-java/tags/1.0-incubating-beta2/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", new Integer(1)}, + {"Max", "German Shepherd", new Integer(1)}, + {"Saddie", "Collie", new Integer(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-beta2/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/EmployeeData.java b/das-java/tags/1.0-incubating-beta2/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-beta2/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-beta2/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/KennelData.java b/das-java/tags/1.0-incubating-beta2/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/KennelData.java new file mode 100644 index 0000000000..50b1227b47 --- /dev/null +++ b/das-java/tags/1.0-incubating-beta2/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 = {{new Integer(100), "Small", new Integer(1)}, + {new Integer(101), "Small", new Integer(1)}, + {new Integer(102), "Large", new Integer(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-beta2/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/MultiSchemaData.java b/das-java/tags/1.0-incubating-beta2/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-beta2/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-beta2/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderData.java b/das-java/tags/1.0-incubating-beta2/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderData.java new file mode 100644 index 0000000000..279da7b9e3 --- /dev/null +++ b/das-java/tags/1.0-incubating-beta2/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 = { + {new Integer(1), "recombobulator", new Integer(47), new Integer(1)}, + {new Integer(2), "wrench", new Integer(17), new Integer(3)}, + {new Integer(3), "pliers", new Integer(500), new Integer(1)}, + {new Integer(4), "Tooth Paste", new Integer(12), new Integer(2)}}; + + public OrderData(Connection c) { + super(c, orderData); + } + + public String getTableName() { + return "ANORDER"; + } + +} diff --git a/das-java/tags/1.0-incubating-beta2/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderDetailsData.java b/das-java/tags/1.0-incubating-beta2/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderDetailsData.java new file mode 100644 index 0000000000..1eae4a73dd --- /dev/null +++ b/das-java/tags/1.0-incubating-beta2/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 = {{new Integer(1), new Integer(1), new Float(1.1)}, + {new Integer(1), new Integer(2), new Float(1.2)}, + {new Integer(2), new Integer(1), new Float(2.1)}, + {new Integer(2), new Integer(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-beta2/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderDetailsDescriptionData.java b/das-java/tags/1.0-incubating-beta2/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderDetailsDescriptionData.java new file mode 100644 index 0000000000..b72bc8afae --- /dev/null +++ b/das-java/tags/1.0-incubating-beta2/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 =
+ { {new Integer(1), new Integer(1), new Integer(1), "Descr 1,1,1"},
+ {new Integer(2), new Integer(1), new Integer(1), "Descr 2,1,1"},
+ {new Integer(3), new Integer(1), new Integer(2), "Descr 3,1,2"},
+ {new Integer(4), new Integer(1), new Integer(2), "Descr 4,1,2"},
+ {new Integer(5), new Integer(2), new Integer(1), "Descr 6,2,1"},
+ {new Integer(6), new Integer(2), new Integer(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-beta2/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OwnerData.java b/das-java/tags/1.0-incubating-beta2/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OwnerData.java new file mode 100644 index 0000000000..02afac5e98 --- /dev/null +++ b/das-java/tags/1.0-incubating-beta2/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", new Integer(1)}, + {"Manny", "333-3333", new Integer(1)}, + {"Sammy", "444-4444", new Integer(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-beta2/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OwnerDogData.java b/das-java/tags/1.0-incubating-beta2/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-beta2/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-beta2/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/PartData.java b/das-java/tags/1.0-incubating-beta2/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/PartData.java new file mode 100644 index 0000000000..fc8256dde1 --- /dev/null +++ b/das-java/tags/1.0-incubating-beta2/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 = {{new Integer(1), "Engine", new Integer(1), null}, + {new Integer(2), "Block", new Integer(1), new Integer(1)}, + {new Integer(3), "Cam Shaft", new Integer(2), new Integer(1)}, + {new Integer(4), "Piston", new Integer(8), new Integer(1)}, + {new Integer(5), "Piston Ring", new Integer(2), new Integer(4)}}; + + public PartData(Connection connection) { + super(connection, partData, partColumns, columnTypes); + } + + public String getTableName() { + return "PART"; + } + +} diff --git a/das-java/tags/1.0-incubating-beta2/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/SingerData.java b/das-java/tags/1.0-incubating-beta2/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/SingerData.java new file mode 100644 index 0000000000..0cfa4dadca --- /dev/null +++ b/das-java/tags/1.0-incubating-beta2/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/SingerData.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 SingerData extends TestDataWithExplicitColumns {
+ // CREATE TABLE SINGER (ID INT , NAME VARCHAR(20))
+
+ private static int[] singerTypes = {Types.INTEGER, Types.VARCHAR};
+
+ private static Object[][] singerData = {{new Integer(1), "John"},
+ {new Integer(2), "Jane"}, {new Integer(3), "Lata"}};
+
+ private static String[] singerColumns = {"ID", "NAME"};
+
+ public SingerData(Connection connection) {
+ super(connection, singerData, singerColumns, singerTypes);
+ }
+
+ public String getTableName() {
+ return "SINGER";
+ }
+}
+
diff --git a/das-java/tags/1.0-incubating-beta2/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/SongData.java b/das-java/tags/1.0-incubating-beta2/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/SongData.java new file mode 100644 index 0000000000..d74db4d7bd --- /dev/null +++ b/das-java/tags/1.0-incubating-beta2/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/SongData.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 java.sql.Types;
+
+import org.apache.tuscany.das.rdb.test.framework.TestDataWithExplicitColumns;
+
+public class SongData extends TestDataWithExplicitColumns {
+ // CREATE TABLE SONG (ID INT , TITLE VARCHAR(20), SINGERID INT)
+
+ private static int[] songTypes = {Types.INTEGER, Types.VARCHAR, Types.INTEGER};
+
+ private static Object[][] songData = {{null, "ABCD", new Integer(1)},
+ {new Integer(20), "Lamb", new Integer(1)},
+ {new Integer(30), "La ra ra", new Integer(2)}};
+
+ private static String[] songColumns = {"ID", "TITLE", "SINGERID"};
+
+ public SongData(Connection connection) {
+ super(connection, songData, songColumns, songTypes);
+ }
+
+ public String getTableName() {
+ return "SONG";
+ }
+}
+
diff --git a/das-java/tags/1.0-incubating-beta2/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/StateData.java b/das-java/tags/1.0-incubating-beta2/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/StateData.java new file mode 100644 index 0000000000..d4e2b99570 --- /dev/null +++ b/das-java/tags/1.0-incubating-beta2/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 = {{new Integer(1), "NC"}, {new Integer(2), "CO"}, + {new Integer(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-beta2/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/TypesData.java b/das-java/tags/1.0-incubating-beta2/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/TypesData.java new file mode 100644 index 0000000000..97c024109a --- /dev/null +++ b/das-java/tags/1.0-incubating-beta2/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 = {{new Integer(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-beta2/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/VisitData.java b/das-java/tags/1.0-incubating-beta2/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/VisitData.java new file mode 100644 index 0000000000..78396b4b2e --- /dev/null +++ b/das-java/tags/1.0-incubating-beta2/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"), new Integer(1)}, + {getTimestamp("2006-10-20 00:00:00.0"), getTimestamp("2006-10-22 00:00:00.0"), new Integer(1)}, + {getTimestamp("2006-10-20 00:00:00.0"), getTimestamp("2006-10-22 00:00:00.0"), new Integer(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"; + } + +} |