From b848f8f7991c569dadfc339d80977b443383c084 Mon Sep 17 00:00:00 2001 From: lresende Date: Mon, 2 Nov 2009 22:26:08 +0000 Subject: Removing temporary release candidate tag git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@832155 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/tuscany/das/rdb/test/AliasTests.java | 164 ----- .../tuscany/das/rdb/test/BestPracticeTests.java | 153 ----- .../apache/tuscany/das/rdb/test/CUDGeneration.java | 111 ---- .../das/rdb/test/CheckSupportGeneratedKeys.java | 167 ----- .../tuscany/das/rdb/test/CommandGroupTests.java | 161 ----- .../apache/tuscany/das/rdb/test/CompanyTests.java | 103 --- .../das/rdb/test/CompoundKeyRelationshipTests.java | 265 -------- .../tuscany/das/rdb/test/CompoundKeyTests.java | 109 ---- .../tuscany/das/rdb/test/ConverterTests.java | 222 ------- .../tuscany/das/rdb/test/CorrectedDefectTests.java | 304 --------- .../das/rdb/test/CrudWithChangeHistory.java | 405 ------------ .../apache/tuscany/das/rdb/test/DefectTests.java | 115 ---- .../das/rdb/test/DynamicResultDescriptorTests.java | 351 ---------- .../tuscany/das/rdb/test/ExceptionTests.java | 153 ----- .../das/rdb/test/GeneratedCommandTests.java | 94 --- .../apache/tuscany/das/rdb/test/GeneratedId.java | 313 --------- .../tuscany/das/rdb/test/GraphMergeTests.java | 191 ------ .../das/rdb/test/ImpliedRelationshipTests.java | 112 ---- .../apache/tuscany/das/rdb/test/KennelTests.java | 123 ---- .../org/apache/tuscany/das/rdb/test/LOBTests.java | 96 --- .../tuscany/das/rdb/test/MissingPKTests.java | 350 ---------- .../tuscany/das/rdb/test/MultiSchemaTests.java | 715 --------------------- .../tuscany/das/rdb/test/NamedParameterTests.java | 248 ------- .../org/apache/tuscany/das/rdb/test/OCCTests.java | 163 ----- .../das/rdb/test/OneToOneRelationshipTests.java | 174 ----- .../das/rdb/test/OperationOrderingTests.java | 116 ---- .../org/apache/tuscany/das/rdb/test/Paging.java | 134 ---- .../tuscany/das/rdb/test/PartialUpdateTests.java | 267 -------- .../das/rdb/test/PassiveConnectionTests.java | 94 --- .../das/rdb/test/ProgrammaticConfigTests.java | 387 ----------- .../tuscany/das/rdb/test/ReadDBSchemaTests.java | 55 -- .../tuscany/das/rdb/test/RecursiveTests.java | 71 -- .../tuscany/das/rdb/test/RelationshipTests.java | 241 ------- .../tuscany/das/rdb/test/ResultSetShapeTests.java | 91 --- .../tuscany/das/rdb/test/SerializationTests.java | 76 --- .../apache/tuscany/das/rdb/test/SimplestCrud.java | 228 ------- .../apache/tuscany/das/rdb/test/StoredProcs.java | 142 ---- .../org/apache/tuscany/das/rdb/test/TopDown.java | 75 --- .../tuscany/das/rdb/test/TransactionTests.java | 87 --- .../org/apache/tuscany/das/rdb/test/TypeTests.java | 90 --- .../commands/ReadCustomersByLastnameCommand.java | 56 -- .../rdb/test/commands/ReadCustomersCommand.java | 57 -- .../commands/ReadCustomersStaticTypesCommand.java | 66 -- .../commands/ReadCustomersWithShapeCommand.java | 63 -- .../SimpleReadCustomersWithShapeCommand.java | 83 --- .../apache/tuscany/das/rdb/test/data/BookData.java | 46 -- .../apache/tuscany/das/rdb/test/data/CityData.java | 54 -- .../tuscany/das/rdb/test/data/CompanyData.java | 44 -- .../tuscany/das/rdb/test/data/CompanyDeptData.java | 41 -- .../tuscany/das/rdb/test/data/CompanyEmpData.java | 45 -- .../tuscany/das/rdb/test/data/CustomerData.java | 39 -- .../tuscany/das/rdb/test/data/DepEmpData.java | 43 -- .../tuscany/das/rdb/test/data/DepartmentData.java | 44 -- .../das/rdb/test/data/DocumentsImagesData.java | 72 --- .../apache/tuscany/das/rdb/test/data/DogData.java | 54 -- .../tuscany/das/rdb/test/data/EmployeeData.java | 46 -- .../tuscany/das/rdb/test/data/KennelData.java | 53 -- .../tuscany/das/rdb/test/data/MultiSchemaData.java | 99 --- .../tuscany/das/rdb/test/data/OrderData.java | 41 -- .../das/rdb/test/data/OrderDetailsData.java | 43 -- .../rdb/test/data/OrderDetailsDescriptionData.java | 47 -- .../tuscany/das/rdb/test/data/OwnerData.java | 53 -- .../tuscany/das/rdb/test/data/OwnerDogData.java | 41 -- .../apache/tuscany/das/rdb/test/data/PartData.java | 48 -- .../tuscany/das/rdb/test/data/SingerData.java | 44 -- .../apache/tuscany/das/rdb/test/data/SongData.java | 45 -- .../tuscany/das/rdb/test/data/StateData.java | 48 -- .../tuscany/das/rdb/test/data/TypesData.java | 38 -- .../tuscany/das/rdb/test/data/VisitData.java | 52 -- .../tuscany/das/rdb/test/framework/DB2Setup.java | 37 -- .../tuscany/das/rdb/test/framework/DasTest.java | 147 ----- .../das/rdb/test/framework/DatabaseSetup.java | 558 ---------------- .../tuscany/das/rdb/test/framework/DerbySetup.java | 44 -- .../das/rdb/test/framework/JavaStoredProcs.java | 97 --- .../tuscany/das/rdb/test/framework/MySQLSetup.java | 105 --- .../das/rdb/test/framework/RelationshipData.java | 80 --- .../tuscany/das/rdb/test/framework/TestData.java | 126 ---- .../framework/TestDataWithExplicitColumns.java | 87 --- .../test/mappings/IntegerToBooleanConverter.java | 43 -- .../test/mappings/SillyDateStringConverter.java | 77 --- .../test/mappings/StringObfuscationConverter.java | 65 -- .../test/mappings/StringToIntegerConverter.java | 39 -- .../rdb/test/mappings/StringToLongConverter.java | 37 -- .../das/rdb/test/suites/AllCommonTests.java | 125 ---- .../tuscany/das/rdb/test/suites/AllTestsDB2.java | 44 -- .../tuscany/das/rdb/test/suites/AllTestsDerby.java | 35 - .../tuscany/das/rdb/test/suites/AllTestsMySQL.java | 39 -- .../das/rdb/test/typed/SimplestStaticCrud.java | 60 -- .../rdb/test/util/PrintPropertiesOfDataObject.java | 134 ---- .../rdb/src/test/resources/1xM_mapping_no_cud.xml | 36 -- .../rdb/src/test/resources/BooksConfig.xml | 30 - .../src/test/resources/BooksConfigWithAlias.xml | 36 -- .../rdb/src/test/resources/CompanyConfig.xml | 43 -- .../src/test/resources/CompanyEmployeeConfig.xml | 54 -- .../rdb/src/test/resources/CustomerConfig.xml | 24 - .../test/resources/CustomerConfigWithConverter.xml | 33 - .../resources/CustomerConfigWithConverter2.xml | 29 - .../resources/CustomerConfigWithIDConverter.xml | 32 - .../src/test/resources/CustomersOrdersConfig.xml | 51 -- .../rdb/src/test/resources/InvalidConfig1.xml | 32 - .../rdb/src/test/resources/InvalidConverter.xml | 36 -- .../rdb/src/test/resources/ManagedBooksConfig.xml | 30 - .../rdb/src/test/resources/MissingPK.xml | 59 -- .../rdb/src/test/resources/MissingPKREL.xml | 63 -- .../src/test/resources/MultiSchemaDasConfig1.xml | 36 -- .../src/test/resources/MultiSchemaDasConfig12.xml | 33 - .../src/test/resources/MultiSchemaDasConfig13.xml | 34 - .../src/test/resources/MultiSchemaDasConfig14.xml | 37 -- .../src/test/resources/MultiSchemaDasConfig2.xml | 45 -- .../src/test/resources/MultiSchemaDasConfig3.xml | 32 - .../src/test/resources/MultiSchemaDasConfig5.xml | 32 - .../src/test/resources/MultiSchemaDasConfig6.xml | 38 -- .../src/test/resources/MultiSchemaDasConfig7.xml | 26 - .../src/test/resources/MultiSchemaDasConfig8.xml | 34 - .../src/test/resources/MultiSchemaDasConfig9.xml | 30 - .../test/resources/MultiSchemaInvalidDasConfig.xml | 47 -- .../test/resources/OneToOneRestrictedConfig.xml | 54 -- .../test/resources/OrderDetailsAndDescription.xml | 35 - .../test/resources/OrdersOrderDetailsConfig.xml | 36 -- .../rdb/src/test/resources/PartsConfig.xml | 50 -- .../rdb/src/test/resources/asciifile.txt | 1 - .../resources/basicCompanyDepartmentMapping.xml | 39 -- .../rdb/src/test/resources/basicCompanyMapping.xml | 25 - .../src/test/resources/basicCustomerMapping.xml | 29 - .../test/resources/basicCustomerMappingWithCUD.xml | 44 -- .../resources/basicCustomerMappingWithCUD2.xml | 46 -- .../basicCustomerMappingWithInvalidCUD.xml | 48 -- .../test/resources/basicCustomerOrderMapping.xml | 35 - .../rdb/src/test/resources/basicStaticCustomer.xml | 28 - .../rdb/src/test/resources/cityStates.xml | 40 -- .../rdb/src/test/resources/company.xsd | 52 -- .../rdb/src/test/resources/companyMapping.xml | 42 -- .../resources/companyMappingWithConverters.xml | 44 -- .../companyMappingWithResultDescriptor.xml | 57 -- .../rdb/src/test/resources/companynoid.xsd | 49 -- .../resources/companynoidMappingWithConverters.xml | 44 -- .../rdb/src/test/resources/customer.xsd | 43 -- .../rdb/src/test/resources/customerMapping.xml | 28 - .../customerMappingWithResultDescriptor.xml | 31 - .../resources/customerOrderRelationshipMapping.xml | 34 - .../rdb/src/test/resources/moin-www.png | Bin 150 -> 0 bytes .../rdb/src/test/resources/namedParameter.xml | 73 --- .../rdb/src/test/resources/passiveConnection.xml | 26 - .../rdb/src/test/resources/staticCustomer.xml | 23 - .../rdb/src/test/resources/staticCustomerOrder.xml | 36 -- .../rdb/src/test/resources/staticInvalid.xml | 23 - .../rdb/src/test/resources/storedProcTest.xml | 27 - 147 files changed, 13154 deletions(-) delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/AliasTests.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/BestPracticeTests.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CUDGeneration.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CheckSupportGeneratedKeys.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CommandGroupTests.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompanyTests.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompoundKeyRelationshipTests.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompoundKeyTests.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ConverterTests.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CorrectedDefectTests.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CrudWithChangeHistory.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/DefectTests.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/DynamicResultDescriptorTests.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ExceptionTests.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GeneratedCommandTests.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GeneratedId.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GraphMergeTests.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ImpliedRelationshipTests.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/KennelTests.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/LOBTests.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/MissingPKTests.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/MultiSchemaTests.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/NamedParameterTests.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OCCTests.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OneToOneRelationshipTests.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OperationOrderingTests.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/Paging.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/PartialUpdateTests.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/PassiveConnectionTests.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ProgrammaticConfigTests.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ReadDBSchemaTests.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/RecursiveTests.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/RelationshipTests.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ResultSetShapeTests.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/SerializationTests.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/SimplestCrud.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/StoredProcs.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/TopDown.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/TransactionTests.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/TypeTests.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersByLastnameCommand.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersCommand.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersStaticTypesCommand.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersWithShapeCommand.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/SimpleReadCustomersWithShapeCommand.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/BookData.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CityData.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyData.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyDeptData.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyEmpData.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CustomerData.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DepEmpData.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DepartmentData.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DocumentsImagesData.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DogData.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/EmployeeData.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/KennelData.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/MultiSchemaData.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderData.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderDetailsData.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderDetailsDescriptionData.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OwnerData.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OwnerDogData.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/PartData.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/SingerData.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/SongData.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/StateData.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/TypesData.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/VisitData.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DB2Setup.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DasTest.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DatabaseSetup.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DerbySetup.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/JavaStoredProcs.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/MySQLSetup.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/RelationshipData.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/TestData.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/TestDataWithExplicitColumns.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/IntegerToBooleanConverter.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/SillyDateStringConverter.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/StringObfuscationConverter.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/StringToIntegerConverter.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/StringToLongConverter.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllCommonTests.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllTestsDB2.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllTestsDerby.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllTestsMySQL.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/typed/SimplestStaticCrud.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/util/PrintPropertiesOfDataObject.java delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/1xM_mapping_no_cud.xml delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/BooksConfig.xml delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/BooksConfigWithAlias.xml delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/CompanyConfig.xml delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/CompanyEmployeeConfig.xml delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/CustomerConfig.xml delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/CustomerConfigWithConverter.xml delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/CustomerConfigWithConverter2.xml delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/CustomerConfigWithIDConverter.xml delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/CustomersOrdersConfig.xml delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/InvalidConfig1.xml delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/InvalidConverter.xml delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/ManagedBooksConfig.xml delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MissingPK.xml delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MissingPKREL.xml delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MultiSchemaDasConfig1.xml delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MultiSchemaDasConfig12.xml delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MultiSchemaDasConfig13.xml delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MultiSchemaDasConfig14.xml delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MultiSchemaDasConfig2.xml delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MultiSchemaDasConfig3.xml delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MultiSchemaDasConfig5.xml delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MultiSchemaDasConfig6.xml delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MultiSchemaDasConfig7.xml delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MultiSchemaDasConfig8.xml delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MultiSchemaDasConfig9.xml delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MultiSchemaInvalidDasConfig.xml delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/OneToOneRestrictedConfig.xml delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/OrderDetailsAndDescription.xml delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/OrdersOrderDetailsConfig.xml delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/PartsConfig.xml delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/asciifile.txt delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/basicCompanyDepartmentMapping.xml delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/basicCompanyMapping.xml delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/basicCustomerMapping.xml delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/basicCustomerMappingWithCUD.xml delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/basicCustomerMappingWithCUD2.xml delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/basicCustomerMappingWithInvalidCUD.xml delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/basicCustomerOrderMapping.xml delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/basicStaticCustomer.xml delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/cityStates.xml delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/company.xsd delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/companyMapping.xml delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/companyMappingWithConverters.xml delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/companyMappingWithResultDescriptor.xml delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/companynoid.xsd delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/companynoidMappingWithConverters.xml delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/customer.xsd delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/customerMapping.xml delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/customerMappingWithResultDescriptor.xml delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/customerOrderRelationshipMapping.xml delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/moin-www.png delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/namedParameter.xml delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/passiveConnection.xml delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/staticCustomer.xml delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/staticCustomerOrder.xml delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/staticInvalid.xml delete mode 100644 das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/storedProcTest.xml (limited to 'das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test') diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/AliasTests.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/AliasTests.java deleted file mode 100644 index d61101858c..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/AliasTests.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test; - -import java.util.Iterator; - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.DAS; -import org.apache.tuscany.das.rdb.test.data.BookData; -import org.apache.tuscany.das.rdb.test.data.CustomerData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; - -public class AliasTests extends DasTest { - - protected void setUp() throws Exception { - - super.setUp(); - new BookData(getAutoConnection()).refresh(); - new CustomerData(getAutoConnection()).refresh(); - } - - /** - * Tests the use of column aliasing. The property name change is found in the - * BooksConfig.xml file Otherwise similar to testTableAlias - * - * @throws Exception - */ - public void testColumnAlias() throws Exception { - - DAS das = DAS.FACTORY.createDAS(getConfig("BooksConfigWithAlias.xml"), getConnection()); - - Command select = das.getCommand("get all books"); - // select.setConnection( getConnection() ); - - DataObject root = select.executeQuery(); - - DataObject book = root.getDataObject("Book[2]"); - book.set("Writer", "Dr. Seuss"); - - das.applyChanges(root); - - select = das.getCommand("get Cat in the Hat"); - - root = select.executeQuery(); - // Ensure the change actually updated - assertEquals("Dr. Seuss", root.getString("Book[1]/Writer")); - } - - /** - * Tests to ensure that columns are being properly read when using an Alias, - * just a bunch of simple creating, renaming, and deleting of entries - * while using an alias. - */ - public void testColumnData() throws Exception { - - DAS das = DAS.FACTORY.createDAS(getConfig("BooksConfigWithAlias.xml"), getConnection()); - - Command select = das.getCommand("get book by ID"); - select.setParameter(1, new Integer(1)); - - // *******Verifys a column entry is readable - DataObject root = select.executeQuery(); - assertEquals("Fyodor Dostoevsky", root.getString("Book[1]/Writer")); - - DataObject bookToChange = root.getDataObject("Book[1]"); - bookToChange.set("Writer", "Fyodor Dostoevskii"); // His last name COULD be spelt like that too! - - das.applyChanges(root); - - // *******Verifys correct information in entry after a column data is changed - select = das.getCommand("get all books"); - // select.setConnection(getConnection()); - - root = select.executeQuery(); - bookToChange = null; - Iterator i = root.getList("Book").iterator(); - while (i.hasNext()) { - DataObject d = (DataObject) i.next(); - if ("Fyodor Dostoevskii".equals(d.getString("Writer"))) { - bookToChange = d; - } - } - assertFalse(bookToChange == null); - - bookToChange.delete(); - - das.applyChanges(root); - - // *******Verifys correct in table, after entry is deleted - select = das.getCommand("get all books"); - // select.setConnection(getConnection()); - - root = select.executeQuery(); - assertEquals(1, root.getList("Book").size()); - assertEquals("Doctor Seuss", root.getString("Book[1]/Writer")); - } - - /** - * Test to check if updating a table works when using Aliasing Previously this was test_4 in ExceptionTests. - */ - public void testTableAlias() throws Exception { - - // Create Table config programmatically - // ConfigHelper helper = new ConfigHelper(); - // helper.addTable("BOOK", "Book"); - // helper.addPrimaryKey("BOOK.BOOK_ID"); - - DAS das = DAS.FACTORY.createDAS(getConfig("BooksConfigWithAlias.xml"), getConnection()); - Command select = das.getCommand("get book by ID"); - select.setParameter(1, new Integer(1)); - - DataObject root = select.executeQuery(); - - DataObject newBook = root.createDataObject("Book"); - newBook.setString("NAME", "Ant Colonies of the Old World"); - newBook.setInt("BOOK_ID", 1001); - root.getList("Book").add(newBook); - - das.applyChanges(root); - - root = select.executeQuery(); - - // Verify - select.setParameter(1, new Integer(1001)); - root = select.executeQuery(); - - assertEquals("Ant Colonies of the Old World", root.getString("Book[1]/NAME")); - } - - /** - * Test ability to assign DataObject type and propertyaliases with xml file - */ - public void testRead() throws Exception { - - DAS das = DAS.FACTORY.createDAS(getConfig("customerMapping.xml"), getConnection()); - // Read a customer - Command select = das.createCommand("SELECT * FROM CUSTOMER WHERE CUSTOMER.ID = 1"); - - DataObject root = select.executeQuery(); - DataObject customer = root.getDataObject("Customer[1]"); - assertEquals(1, customer.getInt("id")); - assertEquals("1212 foobar lane", customer.getString("address")); - assertEquals("Williams", customer.getString("lastname")); - - } -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/BestPracticeTests.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/BestPracticeTests.java deleted file mode 100644 index 3a7c4560cb..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/BestPracticeTests.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test; - -import java.util.Iterator; -import java.util.List; - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.DAS; -import org.apache.tuscany.das.rdb.test.data.CompanyData; -import org.apache.tuscany.das.rdb.test.data.CompanyDeptData; -import org.apache.tuscany.das.rdb.test.data.DepEmpData; -import org.apache.tuscany.das.rdb.test.data.DepartmentData; -import org.apache.tuscany.das.rdb.test.data.EmployeeData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; - -public class BestPracticeTests extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - - new CompanyData(getAutoConnection()).refresh(); - new DepartmentData(getAutoConnection()).refresh(); - new EmployeeData(getAutoConnection()).refresh(); - new CompanyDeptData(getAutoConnection()).refresh(); - new DepEmpData(getAutoConnection()).refresh(); - - } - - //Read list of companies - public void testReadCompanies() throws Exception { - - DAS das = DAS.FACTORY.createDAS(getConfig("CompanyConfig.xml"), getConnection()); - Command read = das.getCommand("all companies"); - DataObject root = read.executeQuery(); - assertEquals(3, root.getList("COMPANY").size()); - - } - - //Read list of companies - public void testReadCompaniesWithDepartments() throws Exception { - - DAS das = DAS.FACTORY.createDAS(getConfig("CompanyConfig.xml"), getConnection()); - Command read = das.getCommand("all companies and departments"); - DataObject root = read.executeQuery(); - - Iterator i = root.getList("COMPANY").iterator(); - while (i.hasNext()) { - DataObject d = (DataObject) i.next(); - List departments = d.getList("departments"); - if (d.getString("NAME").equals("Do-rite plumbing") || d.getString("NAME").equals("ACME Publishing")) { - assertEquals(0, departments.size()); - } else { - assertEquals(1, departments.size()); - } - } - - } - - public void testddDepartmentToFirstCompany() throws Exception { - - DAS das = DAS.FACTORY.createDAS(getConfig("CompanyConfig.xml"), getConnection()); - Command read = das.getCommand("all companies and departments"); - DataObject root = read.executeQuery(); - DataObject firstCustomer = root.getDataObject("COMPANY[1]"); - int deptCount = firstCustomer.getList("departments").size(); - - DataObject newDepartment = root.createDataObject("DEPARTMENT"); - firstCustomer.getList("departments").add(newDepartment); - - das.applyChanges(root); - - //verify - root = read.executeQuery(); - firstCustomer = root.getDataObject("COMPANY[1]"); - assertEquals(deptCount + 1, firstCustomer.getList("departments").size()); - } - - /** - * Test ability to correctly flush heirarchy of objects that have generated - * keys - */ - public void testFlushCreateHeirarchy() throws Exception { - - DAS das = DAS.FACTORY.createDAS(getConfig("CompanyConfig.xml"), getConnection()); - Command select = das.getCommand("all companies and departments"); - DataObject root = select.executeQuery(); - - // Create a new Company - DataObject company = root.createDataObject("COMPANY"); - company.setString("NAME", "Do-rite Pest Control"); - - // Create a new Department - //Do not set ID or CompanyID since these are generated - DataObject department = root.createDataObject("DEPARTMENT"); - department.setString("NAME", "Do-rite Pest Control"); - department.setString("LOCATION", "The boonies"); - department.setString("DEPNUMBER", "101"); - - // Associate the new department with the new company - company.getList("departments").add(department); - - // Get apply command - das.applyChanges(root); - - // Save the id - Integer id = (Integer) company.get("ID"); - - // Verify the change - - select = das.getCommand("company by id with departments"); - select.setParameter(1, id); - root = select.executeQuery(); - assertEquals("Do-rite Pest Control", root.getDataObject("COMPANY[1]").getString("NAME")); - - } - - /** - * Test ability to get an empty graph with the Types/Properties intact - */ - public void testGetEmptyGraph() throws Exception { - - DAS das = DAS.FACTORY.createDAS(getConfig("CompanyConfig.xml"), getConnection()); - - Command select = das.getCommand("company by id with departments"); - Integer idOfNoExistingCompany = new Integer(-1); - select.setParameter(1, idOfNoExistingCompany); - DataObject root = select.executeQuery(); - - //Will fail if there is no property named "COMPANY" - assertEquals(0, root.getList("COMPANY").size()); - - } - -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CUDGeneration.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CUDGeneration.java deleted file mode 100644 index 60b0d05ead..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CUDGeneration.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test; - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.DAS; -import org.apache.tuscany.das.rdb.test.data.CustomerData; -import org.apache.tuscany.das.rdb.test.data.OrderData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; - -public class CUDGeneration extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - - new CustomerData(getAutoConnection()).refresh(); - new OrderData(getAutoConnection()).refresh(); - } - - /** - * This tests provides invalid SQL and should fail on Apply.execute. If not - * then the engine is generating CUD and overlooking the provided - * statements. - */ - public void testCUDGeneration1() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("basicCustomerMappingWithInvalidCUD.xml"), getConnection()); - - // Read customer with particular ID - Command select = das.createCommand("Select * from CUSTOMER where ID = 1"); - DataObject root = select.executeQuery(); - - DataObject customer = (DataObject) root.get("CUSTOMER[1]"); - - // Modify customer - customer.set("LASTNAME", "Pavick"); - - // Flush changes - try { - das.applyChanges(root); - fail("Should fail with invalid SQL. Provided CUD not used!!"); - } catch (RuntimeException e) { - // Everything OK - } - - } - - public void testInsertCUDGeneration() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConnection()); - - Command select = das.createCommand("Select * from CUSTOMER where ID = 1"); - DataObject root = select.executeQuery(); - - DataObject customer = root.createDataObject("CUSTOMER"); - customer.setInt("ID", 720); - customer.set("LASTNAME", "foobar"); - customer.set("ADDRESS", "asdfasdf"); - - das.applyChanges(root); - - select = das.createCommand("select * from CUSTOMER where ID = 720"); - root = select.executeQuery(); - - assertEquals(1, root.getList("CUSTOMER").size()); - } - - public void testReadModifyApply() throws Exception { - - DAS das = DAS.FACTORY.createDAS(getConfig("1xM_mapping_no_cud.xml"), getConnection()); - - // Build the select command to read a specific customer and related - // orders - Command select = das.createCommand("SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON " - + "CUSTOMER.ID = ANORDER.CUSTOMER_ID where CUSTOMER.ID = ?"); - - // Parameterize the command - select.setParameter(1, new Integer(1)); - - // Get the graph - DataObject root = select.executeQuery(); - - // Modify a customer - DataObject customer = (DataObject) root.get("Customer[1]"); - customer.set("LASTNAME", "Pavick"); - - // Modify an order - DataObject order = (DataObject) customer.get("orders[1]"); - order.setString("PRODUCT", "Kitchen Sink 001"); - - das.applyChanges(root); - - } - -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CheckSupportGeneratedKeys.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CheckSupportGeneratedKeys.java deleted file mode 100644 index 8e3c983e63..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CheckSupportGeneratedKeys.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test; - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.ConfigHelper; -import org.apache.tuscany.das.rdb.DAS; -import org.apache.tuscany.das.rdb.config.Config; -import org.apache.tuscany.das.rdb.test.data.CompanyData; -import org.apache.tuscany.das.rdb.test.data.CustomerData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; - -public class CheckSupportGeneratedKeys extends DasTest { - protected void setUp() throws Exception { - super.setUp(); - - new CustomerData(getAutoConnection()).refresh();//no generated keys used - new CompanyData(getAutoConnection()).refresh();//generated keys used - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - // useGetGeneratedKeys set to TRUE - Company - public void testInsert() throws Exception { - ConfigHelper helper = new ConfigHelper(); - Config config = helper.getConfig(); - config.setGeneratedKeysSupported("true"); - - DAS das = DAS.FACTORY.createDAS(config, getConnection()); - Command insert = das.createCommand("insert into COMPANY (NAME) values (?)"); - insert.setParameter(1, "AAA Rental"); - insert.execute(); - Integer key = new Integer(insert.getGeneratedKey()); - // Verify insert - Command select = das.createCommand("Select ID, NAME from COMPANY where ID = ?"); - select.setParameter(1, key); - DataObject root = select.executeQuery(); - assertEquals(key, root.get("COMPANY[1]/ID")); - } - - // useGetGeneratedKeys not set - Company (should work as default TRUE) - public void testInsert1() throws Exception { - ConfigHelper helper = new ConfigHelper(); - Config config = helper.getConfig(); - - DAS das = DAS.FACTORY.createDAS(config, getConnection()); - Command insert = das.createCommand("insert into COMPANY (NAME) values (?)"); - insert.setParameter(1, "AAA Rental"); - insert.execute(); - Integer key = new Integer(insert.getGeneratedKey()); - // Verify insert - Command select = das.createCommand("Select ID, NAME from COMPANY where ID = ?"); - select.setParameter(1, key); - DataObject root = select.executeQuery(); - assertEquals(key, root.get("COMPANY[1]/ID")); - } - - // useGetGeneratedKeys set to FALSE - Company - - // exception as insert.getGen..Keys will throw RuntimeException - public void testInsert2() throws Exception { - ConfigHelper helper = new ConfigHelper(); - Config config = helper.getConfig(); - config.setGeneratedKeysSupported("false"); - - DAS das = DAS.FACTORY.createDAS(config, getConnection()); - Command insert = das.createCommand("insert into COMPANY (NAME) values (?)"); - insert.setParameter(1, "AAA Rental"); - insert.execute();//this will happen as table is created with proper clause - - try{ - Integer key = new Integer(insert.getGeneratedKey()); - fail("Should not be able to retrieve key "+key);//unexpected - }catch(RuntimeException e){ - //e.printStackTrace(); - assertTrue(true);//expected - } - } - - // useGetGeneratedKeys set to TRUE - Customer - flag should be ignored during insert - public void testInsert3() throws Exception { - ConfigHelper helper = new ConfigHelper(); - Config config = helper.getConfig(); - config.setGeneratedKeysSupported("true"); - - DAS das = DAS.FACTORY.createDAS(config, getConnection()); - Command insert = das.createCommand("insert into CUSTOMER (ID, LASTNAME, ADDRESS) values (?, ?, ?)"); - String key = "10"; - insert.setParameter(1, key); - insert.setParameter(2, "CUST10"); - insert.setParameter(3, "ADDR10"); - insert.execute(); - - // Verify insert - Command select = das.createCommand("Select ID, LASTNAME from CUSTOMER where ID = ?"); - select.setParameter(1, key); - DataObject root = select.executeQuery(); - assertEquals(key, root.get("CUSTOMER[1]/ID").toString()); - } - - // useGetGeneratedKeys set to FALSE - Customer, flag has no effect - public void testInsert4() throws Exception { - ConfigHelper helper = new ConfigHelper(); - Config config = helper.getConfig(); - config.setGeneratedKeysSupported("false"); - - DAS das = DAS.FACTORY.createDAS(config, getConnection()); - Command insert = das.createCommand("insert into CUSTOMER (ID, LASTNAME, ADDRESS) values (?, ?, ?)"); - String key = "10"; - insert.setParameter(1, key); - insert.setParameter(2, "CUST10"); - insert.setParameter(3, "ADDR10"); - insert.execute(); - try{ - Integer retkey = new Integer(insert.getGeneratedKey()); - fail("Should not be able to retrieve key "+retkey); - }catch(RuntimeException e){ - //e.printStackTrace(); - assertTrue(true);//expected - } - - // Verify insert - Command select = das.createCommand("Select ID, LASTNAME from CUSTOMER where ID = ?"); - select.setParameter(1, key); - DataObject root = select.executeQuery(); - assertEquals(key, root.get("CUSTOMER[1]/ID").toString()); - } - - // useGetGeneratedKeys not set - Customer - default TRUE is ignored - public void testInsert5() throws Exception { - ConfigHelper helper = new ConfigHelper(); - Config config = helper.getConfig(); - - DAS das = DAS.FACTORY.createDAS(config, getConnection()); - Command insert = das.createCommand("insert into CUSTOMER (ID, LASTNAME, ADDRESS) values (?, ?, ?)"); - String key = "10"; - insert.setParameter(1, key); - insert.setParameter(2, "CUST10"); - insert.setParameter(3, "ADDR10"); - insert.execute(); - - // Verify insert - Command select = das.createCommand("Select ID, LASTNAME from CUSTOMER where ID = ?"); - select.setParameter(1, key); - DataObject root = select.executeQuery(); - assertEquals(key, root.get("CUSTOMER[1]/ID").toString()); - } -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CommandGroupTests.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CommandGroupTests.java deleted file mode 100644 index 5e7bf3976f..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CommandGroupTests.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test; - -/* - * This test - * - */ - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.DAS; -import org.apache.tuscany.das.rdb.config.Config; -import org.apache.tuscany.das.rdb.test.data.CustomerData; -import org.apache.tuscany.das.rdb.test.data.OrderData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; -import org.apache.tuscany.das.rdb.util.ConfigUtil; - -import commonj.sdo.DataObject; - -/** - * - * This tests use of the XML Config file. Tests will utilize the - * customer-orders-orderdetails tables. The plan is for the config file to have a - * section that applies to all commands and another that applies to specific commands. - * - * The config file will be used to initialize a command factory that will then return named commands. - * - * There will be two read commands: - * - * 1) Return all customers 2) Return a specific customer (by ID) and related orders and order details - * - * A test will demonstrate the creation of the factory and then reuse of commands created from the same config data file - * - */ -public class CommandGroupTests extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - - new CustomerData(getAutoConnection()).refresh(); - new OrderData(getAutoConnection()).refresh(); - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - /** - * Read - */ - public void testRead() throws Exception { - - DAS das = DAS.FACTORY.createDAS(getConfig("CustomersOrdersConfig.xml"), getConnection()); - - Command read = das.getCommand("all customers"); - DataObject root = read.executeQuery(); - - assertEquals(5, root.getList("CUSTOMER").size()); - - } - - /** - * Read - */ - public void testReadUsingConfigInput() throws Exception { - Config config = ConfigUtil.loadConfig(getConfig("CustomersOrdersConfig.xml")); - DAS das = DAS.FACTORY.createDAS(config, getConnection()); - - Command read = das.getCommand("all customers"); - DataObject root = read.executeQuery(); - - assertEquals(5, root.getList("CUSTOMER").size()); - - } - - /** - * Read an order using parm marker - */ - public void testReadWithParmmarker() throws Exception { - - DAS das = DAS.FACTORY.createDAS(getConfig("CustomersOrdersConfig.xml"), getConnection()); - - Command read = das.getCommand("order by id"); - read.setParameter(1, new Integer(1)); - DataObject root = read.executeQuery(); - - assertEquals("recombobulator", root.getString("ANORDER[1]/PRODUCT")); - - } - - /** - * Specify connection properties in config. Add explicit update command - */ - public void testUpdate() throws Exception { - - DAS das = DAS.FACTORY.createDAS(getConfig("CustomersOrdersConfig.xml"), getConnection()); - - Command read = das.getCommand("all customers"); - DataObject root = read.executeQuery(); - // Verify precondition - assertFalse(root.get("CUSTOMER[1]/LASTNAME").equals("Pavick")); - int id = root.getInt("CUSTOMER[1]/ID"); - - Command update = das.getCommand("update customer"); - update.setParameter(1, new Integer(id)); - update.execute(); - - // Verify update - reuse select command - root = read.executeQuery(); - assertEquals("Pavick", root.get("CUSTOMER[1]/LASTNAME")); - - } - - /** - * Read all customers, select a specific customer. Then read that - * customer and related orders. Modify an order and flush changes back - */ - public void testRead2() throws Exception { - - // Create the group and set common connection - DAS das = DAS.FACTORY.createDAS(getConfig("CustomersOrdersConfig.xml"), getConnection()); - - // Read all customers and remember the first one - Command read = das.getCommand("all customers"); - DataObject root = read.executeQuery(); - Integer id = (Integer) root.get("CUSTOMER[1]/ID"); - - // Read the specific Customer from above and its related orders - Command custOrders = das.getCommand("customer and orders"); - custOrders.setParameter(1, id); - root = custOrders.executeQuery(); - - // Modify the first order and flush this change back to the database - root.setString("CUSTOMER[1]/orders[1]/PRODUCT", "Defibrillator"); - Integer orderId = (Integer) root.get("CUSTOMER[1]/orders[1]/ID"); - das.applyChanges(root); - - // Verify - Command orderByID = das.getCommand("order by id"); - orderByID.setParameter(1, orderId); - assertEquals("Defibrillator", root.getString("ANORDER[1]/PRODUCT")); - - } - -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompanyTests.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompanyTests.java deleted file mode 100644 index 05555970ef..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompanyTests.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test; - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.DAS; -import org.apache.tuscany.das.rdb.test.company.CompanyFactory; -import org.apache.tuscany.das.rdb.test.company.CompanyType; -import org.apache.tuscany.das.rdb.test.company.DepartmentType; -import org.apache.tuscany.das.rdb.test.company.EmployeeType; -import org.apache.tuscany.das.rdb.test.data.CompanyData; -import org.apache.tuscany.das.rdb.test.data.CompanyDeptData; -import org.apache.tuscany.das.rdb.test.data.DepEmpData; -import org.apache.tuscany.das.rdb.test.data.DepartmentData; -import org.apache.tuscany.das.rdb.test.data.EmployeeData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; -import commonj.sdo.helper.HelperContext; -import commonj.sdo.impl.HelperProvider; - -public class CompanyTests extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - - new CompanyData(getAutoConnection()).refresh(); - new DepartmentData(getAutoConnection()).refresh(); - new EmployeeData(getAutoConnection()).refresh(); - new CompanyDeptData(getAutoConnection()).refresh(); - new DepEmpData(getAutoConnection()).refresh(); - - } - - public void testSimple() throws Exception { - - DAS das = DAS.FACTORY.createDAS(getConfig("companyMapping.xml"), getConnection()); - - // Build the select command - Command selectCommand = das.createCommand("select COMPANY.ID, COMPANY.NAME, " - + "EMPLOYEE.ID, EMPLOYEE.NAME, EMPLOYEE.SN, EMPLOYEE.MANAGER, " - + "DEPARTMENT.ID, DEPARTMENT.NAME, DEPARTMENT.LOCATION, DEPARTMENT.DEPNUMBER from COMPANY, DEPARTMENT, EMPLOYEE " - + "where COMPANY.ID=DEPARTMENT.COMPANYID and DEPARTMENT.ID=EMPLOYEE.DEPARTMENTID"); - - // Get the graph - DataObject root = selectCommand.executeQuery(); - - // Get a company - DataObject company = (DataObject) root.getList("CompanyType").get(0); - assertEquals("MegaCorp", company.get("NAME")); - - // Get a department - DataObject department = (DataObject) company.getList("departments").get(0); - assertEquals("Advanced Technologies", department.get("NAME")); - - DataObject employee = (DataObject) department.getList("employees").get(0); - assertEquals("John Jones", employee.get("NAME")); - } - - public void testSimpleStatic() throws Exception { - - DAS das = DAS.FACTORY.createDAS(getConfig("companyMappingWithConverters.xml"), getConnection()); - HelperContext context = HelperProvider.getDefaultContext(); - CompanyFactory.INSTANCE.register(context); - // Build the select command - Command selectCommand = das.createCommand("select COMPANY.ID, COMPANY.NAME, " - + "EMPLOYEE.ID, EMPLOYEE.NAME, EMPLOYEE.SN, EMPLOYEE.MANAGER, " - + "DEPARTMENT.ID, DEPARTMENT.NAME, DEPARTMENT.LOCATION, DEPARTMENT.DEPNUMBER from COMPANY, DEPARTMENT, EMPLOYEE " - + "where COMPANY.ID=DEPARTMENT.COMPANYID and DEPARTMENT.ID=EMPLOYEE.DEPARTMENTID"); - - // Get the graph - DataObject root = selectCommand.executeQuery(); - - CompanyType company = (CompanyType) root.getList("CompanyType").get(0); - - assertEquals("MegaCorp", company.getName()); - - // Get a department - DepartmentType department = (DepartmentType) company.getDepartments().get(0); - assertEquals("Advanced Technologies", department.getName()); - - EmployeeType employee = (EmployeeType) department.getEmployees().get(0); - - assertEquals("John Jones", employee.getName()); - } - -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompoundKeyRelationshipTests.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompoundKeyRelationshipTests.java deleted file mode 100644 index 8bd3c2479a..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompoundKeyRelationshipTests.java +++ /dev/null @@ -1,265 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test; - -/* - * - * - */ - -import java.sql.SQLException; -import java.util.Vector; - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.ConfigHelper; -import org.apache.tuscany.das.rdb.DAS; -import org.apache.tuscany.das.rdb.config.Relationship; -import org.apache.tuscany.das.rdb.test.data.OrderDetailsData; -import org.apache.tuscany.das.rdb.test.data.OrderDetailsDescriptionData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; - -public class CompoundKeyRelationshipTests extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - - //new OrderData(getAutoConnection()).refresh(); - //new ProductData(getAutoConnection()).refresh(); - new OrderDetailsData(getAutoConnection()).refresh(); - new OrderDetailsDescriptionData(getAutoConnection()).refresh(); - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - /** - * Test ability to read a compound graph - */ - public void testRead() throws Exception { - - String statement = "SELECT * FROM ORDERDETAILS LEFT JOIN ORDERDETAILSDESC " - + "ON ORDERDETAILS.ORDERID = ORDERDETAILSDESC.ORDERID AND " + - " ORDERDETAILS.PRODUCTID = ORDERDETAILSDESC.PRODUCTID " + - " WHERE ORDERDETAILS.ORDERID = 1 AND ORDERDETAILS.PRODUCTID = 1"; - - DAS das = DAS.FACTORY.createDAS(getConfig("OrderDetailsAndDescription.xml"), getConnection()); - // Read some order details and related order details description - Command select = das.createCommand(statement); - - DataObject root = select.executeQuery(); - DataObject orderdetails = root.getDataObject("ORDERDETAILS[1]"); - - assertEquals(2, orderdetails.getList("orderDetailsDesc").size()); - } - - /** - * Same as above except uses xml file for relationhip and key information. - * Employs CUD generation. - */ - public void testRelationshipModification2() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("OrderDetailsAndDescription.xml"), getConnection()); - // Read some order details and related order details descs - Command select = das - .createCommand("SELECT * FROM ORDERDETAILS LEFT JOIN ORDERDETAILSDESC ON ORDERDETAILS.ORDERID = ORDERDETAILSDESC.ORDERID " + - " AND ORDERDETAILS.PRODUCTID = ORDERDETAILSDESC.PRODUCTID"); - - DataObject root = select.executeQuery(); - - DataObject ordDet1 = root.getDataObject("ORDERDETAILS[1]"); - DataObject ordDet2 = root.getDataObject("ORDERDETAILS[2]"); - - // Save IDs - Integer ord1ID = (Integer) ordDet1.get("ORDERID"); - Integer prod1ID = (Integer) ordDet1.get("PRODUCTID"); - - Integer ord2ID = (Integer) ordDet2.get("ORDERID"); - Integer prod2ID = (Integer) ordDet2.get("PRODUCTID"); - - // save order count - Integer order1DetDescCount = new Integer(ordDet1.getList("orderDetailsDesc").size()); - Integer order2DetDescCount = new Integer(ordDet2.getList("orderDetailsDesc").size()); - - // Move an order detail desc to ord det1 from ord det2 - DataObject orderDetailsDesc = (DataObject) ordDet2.getList("orderDetailsDesc").get(0); - ordDet1.getList("orderDetailsDesc").add(orderDetailsDesc); - - // Flush changes - das.applyChanges(root); - - // verify ord det1 relationship updates - select = das - .createCommand("SELECT * FROM ORDERDETAILS LEFT JOIN ORDERDETAILSDESC ON ORDERDETAILS.ORDERID = ORDERDETAILSDESC.ORDERID " + - " AND ORDERDETAILS.PRODUCTID = ORDERDETAILSDESC.PRODUCTID where ORDERDETAILS.ORDERID = ? AND ORDERDETAILS.PRODUCTID = ?"); - select.setParameter(1, ord1ID); - select.setParameter(2, prod1ID); - - root = select.executeQuery(); - assertEquals(order1DetDescCount.intValue() + 1, root.getList("ORDERDETAILS[1]/orderDetailsDesc").size()); - - // verify ord det2 relationship updates - select.setParameter(1, ord2ID); - select.setParameter(2, prod2ID); - - root = select.executeQuery(); - assertEquals(order2DetDescCount.intValue() - 1, root.getList("ORDERDETAILS[1]/orderDetailsDesc").size()); - } - - public void testFKBehavior() throws SQLException { - DAS das = DAS.FACTORY.createDAS(getConfig("OrderDetailsAndDescription.xml"), getConnection()); - // Read some order details and related order details descs - Command select = das - .createCommand("SELECT * FROM ORDERDETAILS LEFT JOIN ORDERDETAILSDESC ON ORDERDETAILS.ORDERID = ORDERDETAILSDESC.ORDERID " + - " AND ORDERDETAILS.PRODUCTID = ORDERDETAILSDESC.PRODUCTID"); - - DataObject root = select.executeQuery(); - - DataObject ordDet1 = root.getDataObject("ORDERDETAILS[1]"); - DataObject ordDet2 = root.getDataObject("ORDERDETAILS[2]"); - - // Save IDs - Integer ord1ID = (Integer) ordDet1.get("ORDERID"); - Integer prod1ID = (Integer) ordDet1.get("PRODUCTID"); - - // Move an order det desc to ord det1 from ord det2 - DataObject orderDetDesc = (DataObject) ordDet2.getList("orderDetailsDesc").get(0); - ordDet1.getList("orderDetailsDesc").add(orderDetDesc); - orderDetDesc.setInt("ORDERID", ord1ID.intValue()); - - try { - das.applyChanges(root); - fail("An exception should be thrown"); - } catch (RuntimeException ex) { - assertEquals("Foreign key properties should not be set when the corresponding relationship has changed", ex.getMessage()); - } - - } - - public void testFKBehavior2() throws SQLException { - DAS das = DAS.FACTORY.createDAS(getConfig("OrderDetailsAndDescription.xml"), getConnection()); - // Read some order details and related order details descs - Command select = das - .createCommand("SELECT * FROM ORDERDETAILS LEFT JOIN ORDERDETAILSDESC ON ORDERDETAILS.ORDERID = ORDERDETAILSDESC.ORDERID " + - " AND ORDERDETAILS.PRODUCTID = ORDERDETAILSDESC.PRODUCTID"); - - DataObject root = select.executeQuery(); - - DataObject ordDet1 = root.getDataObject("ORDERDETAILS[1]"); - DataObject ordDet2 = root.getDataObject("ORDERDETAILS[2]"); - - // Save IDs - Integer ord1ID = (Integer) ordDet1.get("ORDERID"); - Integer prod1ID = (Integer) ordDet1.get("PRODUCTID"); - - // Create an order det desc for ord det1 - DataObject orderDetDesc = root.createDataObject("ORDERDETAILSDESC"); - orderDetDesc.setInt("ID", 500); - orderDetDesc.setInt("ORDERID", ord1ID.intValue()); - ordDet1.getList("orderDetailsDesc").add(orderDetDesc); - - try { - das.applyChanges(root); - fail("An exception should be thrown"); - } catch (RuntimeException ex) { - assertEquals("Foreign key properties should not be set when the corresponding relationship has changed", ex.getMessage()); - } - } - - //add relationship through config helper - public void testValidFKColumn() throws SQLException { - ConfigHelper helper = new ConfigHelper(); - Vector parentColumnNames = new Vector(); - Vector childColumnNames = new Vector(); - - parentColumnNames.add(0, "ORDERDETAILS.ORDERID"); - parentColumnNames.add(1, "ORDERDETAILS.PRODUCTID"); - - childColumnNames.add(0, "ORDERDETAILSDESC.ORDERID"); - childColumnNames.add(1, "ORDERDETAILSDESC.PRODUCTID"); - - Relationship r = helper.addRelationship(parentColumnNames, childColumnNames); - - DAS das = DAS.FACTORY.createDAS(helper.getConfig(), getConnection()); - Command select = das.createCommand("SELECT * FROM ORDERDETAILS LEFT JOIN ORDERDETAILSDESC ON ORDERDETAILS.ORDERID = ORDERDETAILSDESC.ORDERID " + - " AND ORDERDETAILS.PRODUCTID = ORDERDETAILSDESC.PRODUCTID"); - - DataObject root = select.executeQuery(); - DataObject ordDet1 = root.getDataObject("ORDERDETAILS[1]"); - int order1DetDescCount = ordDet1.getList("ORDERDETAILSDESC").size(); - - DataObject orderDetDesc = root.createDataObject("ORDERDETAILSDESC"); - orderDetDesc.setInt("ID", 500); - - if(ordDet1 == null) System.out.println("order det1 is null"); - if(ordDet1.getList("ORDERDETAILSDESC") == null)System.out.println("list is null"); - - ordDet1.getList("ORDERDETAILSDESC").add(orderDetDesc); - try { - das.applyChanges(root); - - select = das.createCommand("SELECT * FROM ORDERDETAILS LEFT JOIN ORDERDETAILSDESC ON ORDERDETAILS.ORDERID = ORDERDETAILSDESC.ORDERID " + - " AND ORDERDETAILS.PRODUCTID = ORDERDETAILSDESC.PRODUCTID"); - - int modOrder1DetDescCount = select.executeQuery(). - getDataObject("ORDERDETAILS[1]").getList("ORDERDETAILSDESC").size(); - this.assertEquals(modOrder1DetDescCount, order1DetDescCount+1); - } catch (RuntimeException ex) { - fail("Exception was not expected:DETAILS:"+ ex.getMessage()); - } - } - - //add invalid relationship through config helper using invalid FK column name - public void testInvalidFKColumn() throws SQLException { - ConfigHelper helper = new ConfigHelper(); - Vector parentColumnNames = new Vector(); - Vector childColumnNames = new Vector(); - - parentColumnNames.add(0, "ORDERDETAILS.ORDERID"); - parentColumnNames.add(1, "ORDERDETAILS.PRODUCTID"); - - childColumnNames.add(0, "ORDERDETAILSDESC.ORDERID_INVALID"); - childColumnNames.add(1, "ORDERDETAILSDESC.PRODUCTID"); - - Relationship r = helper.addRelationship(parentColumnNames, childColumnNames); - - DAS das = DAS.FACTORY.createDAS(helper.getConfig(), getConnection()); - Command select = das.createCommand("SELECT * FROM ORDERDETAILS LEFT JOIN ORDERDETAILSDESC ON ORDERDETAILS.ORDERID = ORDERDETAILSDESC.ORDERID " + - " AND ORDERDETAILS.PRODUCTID = ORDERDETAILSDESC.PRODUCTID"); - - DataObject root = select.executeQuery(); - DataObject ordDet1 = root.getDataObject("ORDERDETAILS[1]"); - int order1DetDescCount = ordDet1.getList("ORDERDETAILSDESC").size(); - - DataObject orderDetDesc = root.createDataObject("ORDERDETAILSDESC"); - orderDetDesc.setInt("ID", 500); - - if(ordDet1 == null) System.out.println("order det1 is null"); - if(ordDet1.getList("ORDERDETAILSDESC") == null)System.out.println("list is null"); - - ordDet1.getList("ORDERDETAILSDESC").add(orderDetDesc); - try { - das.applyChanges(root); - fail("Exception was expected"); - } catch (RuntimeException ex) { - assertEquals("Invalid foreign key column: ORDERID_INVALID", ex.getMessage()); - } - } -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompoundKeyTests.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompoundKeyTests.java deleted file mode 100644 index db8a59e638..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompoundKeyTests.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test; - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.DAS; -import org.apache.tuscany.das.rdb.test.data.OrderData; -import org.apache.tuscany.das.rdb.test.data.OrderDetailsData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; - -/** - * Tests for Compound Keys - */ -public class CompoundKeyTests extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - - new OrderDetailsData(getAutoConnection()).refresh(); - new OrderData(getAutoConnection()).refresh(); - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - public void testRead() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConnection()); - Command getOrderDetails = das.createCommand("Select * from ORDERDETAILS where ORDERID = ? AND PRODUCTID = ?"); - - getOrderDetails.setParameter(1, new Integer(1)); - getOrderDetails.setParameter(2, new Integer(1)); - - DataObject root = getOrderDetails.executeQuery(); - - DataObject orderDetail = (DataObject) root.get("ORDERDETAILS[1]"); - assertEquals(1.1f, orderDetail.getFloat("PRICE"), 0.01); - - } - - public void testReadModifyWrite2() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("OrdersOrderDetailsConfig.xml"), getConnection()); - Command getOrderDetails = das.createCommand("Select * from ORDERDETAILS where ORDERID = 1 AND PRODUCTID = 1"); - - DataObject root = getOrderDetails.executeQuery(); - - DataObject orderDetails = (DataObject) root.get("ORDERDETAILS[1]"); - assertEquals(1.1f, orderDetails.getFloat("PRICE"), 0.01); - - // Modify - orderDetails.setFloat("PRICE", 0f); - - // Build apply changes command - - das.applyChanges(root); - - // Verify - root = getOrderDetails.executeQuery(); - orderDetails = root.getDataObject("ORDERDETAILS[1]"); - assertEquals(0f, orderDetails.getFloat("PRICE"), 0.01); - - } - - public void testReadOrdersAndDetails2() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("OrdersOrderDetailsConfig.xml"), getConnection()); - Command read = das.createCommand("SELECT * FROM ANORDER LEFT JOIN ORDERDETAILS " - + "ON ANORDER.ID = ORDERDETAILS.ORDERID ORDER BY ANORDER.ID"); - - DataObject root = read.executeQuery(); - - DataObject firstOrder = root.getDataObject("ANORDER[1]"); - assertEquals(1, firstOrder.getInt("ID")); - assertEquals(2, firstOrder.getList("ORDERDETAILS").size()); - - } - - public void testReadAndDelete() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("OrdersOrderDetailsConfig.xml"), getConnection()); - Command getOrderDetails = das.createCommand("Select * from ORDERDETAILS where ORDERID = ? AND PRODUCTID = ?"); - - getOrderDetails.setParameter(1, new Integer(1)); - getOrderDetails.setParameter(2, new Integer(1)); - - DataObject root = getOrderDetails.executeQuery(); - - DataObject orderDetail = (DataObject) root.get("ORDERDETAILS[1]"); - orderDetail.delete(); - das.applyChanges(root); - - } -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ConverterTests.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ConverterTests.java deleted file mode 100644 index b300b85192..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ConverterTests.java +++ /dev/null @@ -1,222 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test; - -import java.text.DateFormat; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.DAS; -import org.apache.tuscany.das.rdb.test.customer.Customer; -import org.apache.tuscany.das.rdb.test.customer.CustomerFactory; -import org.apache.tuscany.das.rdb.test.data.CustomerData; -import org.apache.tuscany.das.rdb.test.data.OrderData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; -import commonj.sdo.helper.HelperContext; -import commonj.sdo.impl.HelperProvider; -/** - * Tests the Converter framwork - */ -public class ConverterTests extends DasTest { - - private static DateFormat myformat = new SimpleDateFormat("yyyy.MM.dd"); - - private static Date kbday; - - private static Date tbday; - - protected void setUp() throws Exception { - super.setUp(); - new CustomerData(getAutoConnection()).refresh(); - new OrderData(getAutoConnection()).refresh(); - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - static { - try { - kbday = myformat.parse("1957.09.27"); - tbday = myformat.parse("1966.12.20"); - } catch (ParseException e) { - throw new RuntimeException(e); - } - } - - /** - * This tests the use of an arbitrary converter. The column converted is a VARCAHAR. ResultSetShape is used to specify that the property will be a - * SDODataTypes.DATE. - * - * So this example uses a converter that transforms a string column into a date property and conversely, a date property back to a string for the - * underlying column. - * - * The converter returns 1957.09.27 if the column value is "Williams" and 1966.12.20 if the value is "Pavick" - * - * On write, the converter returns "Pavick" if the property value is 1966.12.20 and "Williams" if the property value is 1957.09.27 - * - */ - public void testArbitraryConverter() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("CustomerConfigWithConverter.xml"), getConnection()); - - // Create and initialize command to read customers - Command read = das.getCommand("testArbitraryConverter"); - - // Read - DataObject root = read.executeQuery(); - - // Verify - assertEquals(kbday, root.getDate("CUSTOMER[1]/LASTNAME")); - - // Modify - root.setDate("CUSTOMER[1]/LASTNAME", tbday); - - das.applyChanges(root); - - // Read - root = read.executeQuery(); - - // Verify - assertEquals(tbday, root.getDate("CUSTOMER[1]/LASTNAME")); - - } - - public void testInvalidConverter1() throws Exception { - - DAS das = DAS.FACTORY.createDAS(getConfig("InvalidConverter.xml"), getConnection()); - - // Build the select command to read a specific customer and related - // orders - Command select = das - .createCommand("SELECT * FROM CUSTOMER LEFT JOIN ANORDER " + "ON CUSTOMER.ID = ANORDER.CUSTOMER_ID where CUSTOMER.ID = ?"); - - // Parameterize the command - select.setParameter(1, new Integer(1)); - - // Get the graph - try { - select.executeQuery(); - } catch (Exception ex) { - assertEquals("java.lang.ClassNotFoundException: not.a.valid.class", ex.getMessage()); - } - - } - - public void testInvalidConverter2() throws Exception { - - HelperContext context = HelperProvider.getDefaultContext(); - CustomerFactory.INSTANCE.register(context); - DAS das = DAS.FACTORY.createDAS(getConfig("InvalidConverter.xml"), getConnection()); - - // Build the select command to read a specific customer and related - // orders - Command select = das.createCommand("SELECT * FROM ANORDER"); - - // Get the graph - - DataObject root = select.executeQuery(); - DataObject order = root.getDataObject("AnOrder[1]"); - - Customer customer = (Customer) root.createDataObject("Customer"); - customer.setID(700); - customer.setLastName("Daniel"); - customer.setAddress("an address"); - - customer.getOrders().add(order); - - try { - das.applyChanges(root); - } catch (Exception ex) { - assertEquals("java.lang.ClassNotFoundException: not.a.valid.class", ex.getMessage()); - } - - } - - /** - * This tests the use of a converter that does not produce a new "type". Instead it - * modifies the original value before storing to the database. In this exampe, the - * converter restores the original value on read. - * - * This is illustrated by obfuscating the lastname value before it is stored to the database and - * deobfuscating on read. - * - */ - public void testConverter3() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("CustomerConfigWithConverter2.xml"), getConnection()); - - // Create and initialize command to read customers - Command read = das.getCommand("getFirstCustomer"); - - // Read - DataObject root = read.executeQuery(); - - //Modify - root.setString("CUSTOMER[1]/LASTNAME", "Some new name"); - - das.applyChanges(root); - - // Read - root = read.executeQuery(); - - // Verify that I can read back the deobfuscated value - assertEquals("Some new name", root.getString("CUSTOMER[1]/LASTNAME")); - - //Now read directly without applying the converter to ensure that the value was obfuscated - //in the database. - DAS das2 = DAS.FACTORY.createDAS(getConnection()); - Command directRead = das2.createCommand("select * from CUSTOMER where ID = 1"); - root = directRead.executeQuery(); - - assertEquals("Fbzr arj anzr", root.getString("CUSTOMER[1]/LASTNAME")); - assertEquals(obfuscate("Some new name"), root.getString("CUSTOMER[1]/LASTNAME")); - - } - - // Utilities - - private String obfuscate (String original) throws Exception { - return toRot13(original); - } - - private String deobfuscate (String obfuscated) throws Exception { - return toRot13(obfuscated); - } - - //A simple, reversible, obfuscation algorithm using a ROT13 implementation - private String toRot13(String original) throws Exception { - - int abyte = 0; - byte[] buffer = original.getBytes("ISO-8859-1"); - - for (int i = 0; i < buffer.length; i++) { - abyte = buffer[i]; - int cap = abyte & 32; - abyte &= ~cap; - abyte = ((abyte >= 'A') && (abyte <= 'Z') ? ((abyte - 'A' + 13) % 26 + 'A') : abyte) | cap; - buffer[i] = (byte) abyte; - } - - return new String(buffer, "ISO-8859-1"); - } - -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CorrectedDefectTests.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CorrectedDefectTests.java deleted file mode 100644 index 028861ed77..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CorrectedDefectTests.java +++ /dev/null @@ -1,304 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test; - -/* - * These tests attempt to duplicate customer reported errors and then to verify - * any necessary fix. - * - */ - -import java.util.Iterator; -import java.util.Random; - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.ConfigHelper; -import org.apache.tuscany.das.rdb.DAS; -import org.apache.tuscany.das.rdb.config.Table; -import org.apache.tuscany.das.rdb.test.data.CompanyData; -import org.apache.tuscany.das.rdb.test.data.CompanyDeptData; -import org.apache.tuscany.das.rdb.test.data.CustomerData; -import org.apache.tuscany.das.rdb.test.data.DepartmentData; -import org.apache.tuscany.das.rdb.test.data.OrderData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; - -public class CorrectedDefectTests extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - new CustomerData(getAutoConnection()).refresh(); - new OrderData(getAutoConnection()).refresh(); - - new CompanyData(getAutoConnection()).refresh(); - new DepartmentData(getAutoConnection()).refresh(); - new CompanyDeptData(getAutoConnection()).refresh(); - - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - /** - * Dilton's bug for adding new child data object - */ - public void testAddNewOrder() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("CustomersOrdersConfig.xml"), getConnection()); - // Read some customers and related orders - Command select = das.createCommand("SELECT * FROM CUSTOMER LEFT JOIN ANORDER " - + "ON CUSTOMER.ID = ANORDER.CUSTOMER_ID"); - - DataObject root = select.executeQuery(); - - DataObject cust = root.getDataObject("CUSTOMER[1]"); - - // Save ID and Order Count - int custID = cust.getInt("ID"); - int custOrderCount = cust.getList("orders").size(); - - // Create a new Order and add to customer1 - DataObject order = root.createDataObject("ANORDER"); - - order.set("ID", new Integer(99)); - order.set("PRODUCT", "The 99th product"); - order.set("QUANTITY", new Integer(99)); - cust.getList("orders").add(order); - - assertEquals(custOrderCount + 1, cust.getList("orders").size()); - - // Build apply changes command - das.applyChanges(root); - - // verify cust1 relationship updates - select = das.createCommand("SELECT * FROM CUSTOMER LEFT JOIN ANORDER " - + "ON CUSTOMER.ID = ANORDER.CUSTOMER_ID where CUSTOMER.ID = ?"); - - select.setParameter(1, new Integer(custID)); - root = select.executeQuery(); - - assertEquals(custOrderCount + 1, root.getList("CUSTOMER[1]/orders").size()); - - } - - public void testDiltonsInsertWorkaround() throws Exception { - - // String sql = "insert into conmgt.serverstatus (statusid, - // managedserverid, timestamp) values (316405209, 316405209, '2005-11-23 - // 19:29:52.636')"; - // String sql = "insert into conmgt.serverstatus (managedserverid, - // timestamp) values (316405209, '2005-11-23 19:29:52.636')"; - String sql = "insert into conmgt.serverstatus (managedserverid, timestamp) values (?, ?)"; - - DAS das = DAS.FACTORY.createDAS(getConnection()); - Command insert = das.createCommand(sql); - insert.setParameter(1, new Integer(316405209)); - insert.setParameter(2, "2005-11-23 19:29:52.636"); - insert.execute(); - - // Verify - Command select = das.createCommand("Select * from conmgt.SERVERSTATUS"); - DataObject root = select.executeQuery(); - assertEquals(1, root.getList("SERVERSTATUS").size()); - - } - - public void testWASDefect330118() throws Exception { - - // Create the group and set common connection - DAS das = DAS.FACTORY.createDAS(getConfig("CustomersOrdersConfig.xml"), getConnection()); - - // Read all customers and add one - Command read = das.getCommand("all customers"); - DataObject root = read.executeQuery(); - int numCustomers = root.getList("CUSTOMER").size(); - - DataObject newCust = root.createDataObject("CUSTOMER"); - newCust.set("ID", new Integer(100)); - newCust.set("ADDRESS", "5528 Wells Fargo Drive"); - newCust.set("LASTNAME", "Gerkin"); - - // Now delete this new customer - newCust.delete(); - - das.applyChanges(root); - - // Verify - root = read.executeQuery(); - assertEquals(numCustomers, root.getList("CUSTOMER").size()); - - } - - /** - * Should be able to explicitly set a parameter to null. But, should require - * that the parameter type is set. - */ - public void testDiltonsNullParameterBug1() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConnection()); - Command insert = das.createCommand("insert into CUSTOMER values (?, ?, ?)"); - insert.setParameter(1, new Integer(10)); - insert.setParameter(2, null); - insert.setParameter(3, "5528 Wells Fargo Dr"); - insert.execute(); - - // Verify - Command select = das.createCommand("Select * from CUSTOMER where ID = 10"); - DataObject root = select.executeQuery(); - assertEquals(1, root.getList("CUSTOMER").size()); - assertEquals("5528 Wells Fargo Dr", root.get("CUSTOMER[1]/ADDRESS")); - - } - - /** - * Error by not setting a parameter - */ - public void testDiltonsNullParameterBug2() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConnection()); - Command insert = das.createCommand("insert into CUSTOMER values (?, ?, ?)"); - insert.setParameter(1, new Integer(10)); - // insert.setParameterValue("LASTNAME", null); - insert.setParameter(3, "5528 Wells Fargo Dr"); - - try { - insert.execute(); - fail(); - } catch (RuntimeException e) { - // Expected since "LASTNAME" parameter not set - } - } - - /** - * Set parameter to empty string - */ - public void testDiltonsNullParameterBug3() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConnection()); - Command insert = das.createCommand("insert into CUSTOMER values (?, ?, ?)"); - insert.setParameter(1, new Integer(10)); - insert.setParameter(2, ""); - insert.setParameter(3, "5528 Wells Fargo Dr"); - insert.execute(); - - // Verify - Command select = das.createCommand("Select * from CUSTOMER where ID = 10"); - DataObject root = select.executeQuery(); - assertEquals(1, root.getList("CUSTOMER").size()); - assertEquals("5528 Wells Fargo Dr", root.get("CUSTOMER[1]/ADDRESS")); - - } - - public void testUpdateChildThatHasGeneratedKey() throws Exception { - - DAS das = DAS.FACTORY.createDAS(getConfig("CompanyConfig.xml"), getConnection()); - - // Read a specific company based on the known ID - Command readCust = das.getCommand("all companies and departments"); - DataObject root = readCust.executeQuery(); - DataObject lastCustomer = root.getDataObject("COMPANY[3]"); - Iterator i = lastCustomer.getList("departments").iterator(); - Random generator = new Random(); - int random = generator.nextInt(1000) + 1; - DataObject department; - while (i.hasNext()) { - department = (DataObject) i.next(); - // System.out.println("Modifying department: " + - // department.getString("NAME")); - department.setString("NAME", "Dept-" + random); - random = random + 1; - } - - das.applyChanges(root); - } - - /** - * Yin Chen reports ... "In the class Statement, method: public int - * executeUpdate(Parameters parameters) - its tossing out RuntimeException - * when the value of the parameter is null. " - * - * His example build a update statement and sets one parameter value to be - * null. I will try to duplicate with an insert since that is simpler - * - */ - public void testYingChen12162005() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConnection()); - Command insert = das.createCommand("insert into CUSTOMER values (?, ?, ?)"); - insert.setParameter(1, new Integer(10)); - insert.setParameter(2, "Williams"); - insert.setParameter(3, null); - insert.execute(); - - // Verify - Command select = das.createCommand("Select * from CUSTOMER where ID = 10"); - DataObject root = select.executeQuery(); - assertEquals(1, root.getList("CUSTOMER").size()); - assertNull(root.get("CUSTOMER[1]/ADDRESS")); - - } - - /** - * Formely tests concerning Tuscany-433. The error causing these tests was cleared up when - * the method for handling parameters was changed. - */ - public void testReadModifyApply() throws Exception { - - // Provide updatecommand programmatically via config - ConfigHelper helper = new ConfigHelper(); - Table customerTable = helper.addTable("CUSTOMER", "CUSTOMER"); - helper.addUpdateStatement(customerTable, "update CUSTOMER set LASTNAME = ? where ID = ?", "LASTNAME ID"); - - DAS das = DAS.FACTORY.createDAS(helper.getConfig(), getConnection()); - - //Read customer 1 - Command select = das.createCommand("Select * from CUSTOMER where ID = 1"); - DataObject root = select.executeQuery(); - - DataObject customer = (DataObject) root.get("CUSTOMER[1]"); - - //Modify customer - customer.set("LASTNAME", "Pavick"); - - das.applyChanges(root); - - //Verify changes - root = select.executeQuery(); - assertEquals("Pavick", root.getString("CUSTOMER[1]/LASTNAME")); - - } - - public void testReadModifyApply1() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("basicCustomerMappingWithCUD2.xml"), getConnection()); - //Read customer 1 - Command select = das.createCommand("Select * from CUSTOMER where ID = 1"); - DataObject root = select.executeQuery(); - - DataObject customer = (DataObject) root.get("CUSTOMER[1]"); - - //Modify customer - customer.set("LASTNAME", "Pavick"); - - //Build apply changes command - das.applyChanges(root); - - //Verify changes - root = select.executeQuery(); - assertEquals("Pavick", root.getString("CUSTOMER[1]/LASTNAME")); - - } - -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CrudWithChangeHistory.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CrudWithChangeHistory.java deleted file mode 100644 index 3067d5ace7..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CrudWithChangeHistory.java +++ /dev/null @@ -1,405 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test; - -/* - * This provdes the simplest examples that make use of the change history. The assumptions are: - * - * Single type Change history utilized Dynamic DataObjects - * - * - */ - -import java.util.Iterator; - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.ConfigHelper; -import org.apache.tuscany.das.rdb.DAS; -import org.apache.tuscany.das.rdb.config.Table; -import org.apache.tuscany.das.rdb.test.data.CustomerData; -import org.apache.tuscany.das.rdb.test.data.OrderDetailsData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; - -public class CrudWithChangeHistory extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - new CustomerData(getAutoConnection()).refresh(); - new OrderDetailsData(getAutoConnection()).refresh(); - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - public void testDeleteAndCreate() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("basicCustomerMappingWithCUD2.xml"), getConnection()); - // Read customer 1 - Command select = das.createCommand("Select * from CUSTOMER"); - DataObject root = select.executeQuery(); - - DataObject customer = (DataObject) root.get("CUSTOMER[1]"); - - int customerId = customer.getInt("ID"); - // Modify customer - customer.delete(); - - DataObject newCustomer = root.createDataObject("CUSTOMER"); - newCustomer.setInt("ID", 9999); - newCustomer.setString("LASTNAME", "Jones"); - - // Build apply changes command - das.applyChanges(root); - - // Verify changes - root = select.executeQuery(); - boolean found = false; - Iterator i = root.getList("CUSTOMER").iterator(); - while (i.hasNext()) { - customer = (DataObject) i.next(); - assertFalse(customerId == customer.getInt("ID")); - if (customer.getInt("ID") == 9999) { - found = true; - } - } - - assertTrue(found); - - } - - /** - * Read and modify a customer. Provide needed Create/Update/Delete statements programatically - */ - public void testReadModifyApply() throws Exception { - - // Provide updatecommand programmatically via config - ConfigHelper helper = new ConfigHelper(); - Table customerTable = helper.addTable("CUSTOMER", "CUSTOMER"); - helper.addUpdateStatement(customerTable, "update CUSTOMER set LASTNAME = ?, ADDRESS = ? " - + "where ID = ?", "LASTNAME ADDRESS ID"); - - DAS das = DAS.FACTORY.createDAS(helper.getConfig(), getConnection()); - // Read customer 1 - Command select = das.createCommand("Select * from CUSTOMER where ID = 1"); - DataObject root = select.executeQuery(); - assertFalse(root.get("CUSTOMER[1]/LASTNAME").equals("Pavick")); - - DataObject customer = (DataObject) root.get("CUSTOMER[1]"); - - // Modify customer - customer.set("LASTNAME", "Pavick"); - - // Build apply changes command - das.applyChanges(root); - - // Verify changes - root = select.executeQuery(); - assertEquals("Pavick", root.getString("CUSTOMER[1]/LASTNAME")); - - } - - /** - * Read and modify a customer. Provide needed Create/Update/Delete statements via xml file - */ - public void testReadModifyApply1() throws Exception { - - DAS das = DAS.FACTORY.createDAS(getConfig("basicCustomerMappingWithCUD.xml"), getConnection()); - // Read customer 1 - Command select = das.createCommand("Select * from CUSTOMER where ID = 1"); - DataObject root = select.executeQuery(); - assertFalse(root.get("CUSTOMER[1]/LASTNAME").equals("Pavick")); - - DataObject customer = (DataObject) root.get("CUSTOMER[1]"); - - // Modify customer - customer.set("LASTNAME", "Pavick"); - - // Build apply changes command - das.applyChanges(root); - - // Verify changes - root = select.executeQuery(); - assertEquals("Pavick", root.getString("CUSTOMER[1]/LASTNAME")); - - } - - /** - * Same as previous but: Utilizes generated CUD statements Key info provided programatically - */ - public void testReadModifyApply2() throws Exception { - - DAS das = DAS.FACTORY.createDAS(getConnection()); - // Read customer with particular ID - Command select = das.createCommand("Select * from CUSTOMER where ID = 1"); - DataObject root = select.executeQuery(); - assertFalse(root.get("CUSTOMER[1]/LASTNAME").equals("Pavick")); - - DataObject customer = root.getDataObject("CUSTOMER[1]"); - - // Modify customer - customer.set("LASTNAME", "Pavick"); - - // Build apply changes command - das.applyChanges(root); - - // Verify the change - root = select.executeQuery(); - assertEquals("Pavick", root.getDataObject("CUSTOMER[1]").getString("LASTNAME")); - - } - - /** - * Builds on previous but: 1. Key info provided via XML file - */ - public void testReadModifyApply3() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("basicCustomerMapping.xml"), getConnection()); - // Read customer with particular ID - Command select = das.createCommand("Select * from CUSTOMER where ID = 1"); - DataObject root = select.executeQuery(); - assertFalse(root.get("CUSTOMER[1]/LASTNAME").equals("Pavick")); - - DataObject customer = (DataObject) root.get("CUSTOMER[1]"); - - // Modify customer - customer.set("LASTNAME", "Pavick"); - - // Build apply changes command - das.applyChanges(root); - - // Verify the change - root = select.executeQuery(); - assertEquals("Pavick", root.getDataObject("CUSTOMER[1]").getString("LASTNAME")); - - } - - /** - * Builds on previous but: 1. Uses a named command - */ - public void testReadModifyApply4() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("CustomerConfig.xml"), getConnection()); - // Read customer with particular ID - Command select = das.getCommand("getCustomer"); - select.setParameter(1, new Integer(1)); - DataObject root = select.executeQuery(); - assertFalse(root.get("CUSTOMER[1]/LASTNAME").equals("Pavick")); - - DataObject customer = (DataObject) root.get("CUSTOMER[1]"); - - // Modify customer - customer.set("LASTNAME", "Pavick"); - - // Build apply changes command - das.applyChanges(root); - - // Verify the change - root = select.executeQuery(); - assertEquals("Pavick", root.getDataObject("CUSTOMER[1]").getString("LASTNAME")); - - } - - public void testReadModifyApplyMultipleRows() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConnection()); - // Verify pre-condition - Command select = das.createCommand("Select * from CUSTOMER"); - DataObject root = select.executeQuery(); - assertFalse(root.get("CUSTOMER[1]/LASTNAME").equals("Pavick")); - assertFalse(root.get("CUSTOMER[2]/LASTNAME").equals("Silva")); - - - // Read and modify customer 1 - DataObject customer1 = (DataObject) root.get("CUSTOMER[1]"); - customer1.set("LASTNAME", "Pavick"); - - // Read and modify customer 2 - DataObject customer2 = (DataObject) root.get("CUSTOMER[2]"); - customer2.set("LASTNAME", "Silva"); - - // Build apply changes command - das.applyChanges(root); - - // Verify changes - root = select.executeQuery(); - assertEquals("Pavick", root.getString("CUSTOMER[1]/LASTNAME")); - assertEquals("Silva", root.getString("CUSTOMER[2]/LASTNAME")); - } - - /** - * Test ability to handle multiple changes to the graph including Creates/Updates/Deletes Employs generated CUD - */ - public void testReadModifyDeleteInsertApply() throws Exception { - - DAS das = DAS.FACTORY.createDAS(getConfig("basicCustomerMapping.xml"), getConnection()); - // Read some customers - Command select = das.createCommand("Select * from CUSTOMER where LASTNAME = 'Williams'"); - DataObject root = select.executeQuery(); - - DataObject cust1 = (DataObject) root.getList("CUSTOMER").get(0); - DataObject cust2 = (DataObject) root.getList("CUSTOMER").get(1); - DataObject cust3 = (DataObject) root.getList("CUSTOMER").get(2); - - // Modify a customer - cust1.set("LASTNAME", "Pavick"); - int cust1ID = cust1.getInt("ID"); - - // Save IDs before delete - int cust2ID = cust2.getInt("ID"); - int cust3ID = cust3.getInt("ID"); - // Delete a couple - cust2.delete(); - cust3.delete(); - - // Create a new customer - DataObject cust4 = root.createDataObject("CUSTOMER"); - cust4.set("ID", new Integer(100)); - cust4.set("ADDRESS", "5528 Wells Fargo Drive"); - cust4.set("LASTNAME", "Gerkin"); - - // Build apply changes command - das.applyChanges(root); - - // Verify deletes - select = das.createCommand("Select * from CUSTOMER where ID = ?"); - select.setParameter(1, new Integer(cust2ID)); - root = select.executeQuery(); - assertTrue(root.getList("CUSTOMER").isEmpty()); - // reparameterize same command - select.setParameter(1, new Integer(cust3ID)); - root = select.executeQuery(); - assertTrue(root.getList("CUSTOMER").isEmpty()); - - // verify insert - select.setParameter(1, new Integer(100)); - root = select.executeQuery(); - assertEquals(1, root.getList("CUSTOMER").size()); - assertEquals("5528 Wells Fargo Drive", root.getString("CUSTOMER[1]/ADDRESS")); - assertEquals("Gerkin", root.getString("CUSTOMER[1]/LASTNAME")); - - // verify update - select.setParameter(1, new Integer(cust1ID)); - root = select.executeQuery(); - assertEquals("Pavick", root.getString("CUSTOMER[1]/LASTNAME")); - - } - - public void testReadModifyApplyWithAssumedID() throws Exception { - - DAS das = DAS.FACTORY.createDAS(getConnection()); - // Read customer with particular ID - Command select = das.createCommand("Select * from CUSTOMER"); - DataObject root = select.executeQuery(); - - DataObject customer = root.getDataObject("CUSTOMER[1]"); - - // Modify customer - customer.set("LASTNAME", "Pavick"); - - DataObject customerForDelete = getCustomerByLastName(root, "Daniel"); - customerForDelete.delete(); - - DataObject newCustomer = root.createDataObject("CUSTOMER"); - newCustomer.set("LASTNAME", "NewCustomer"); - newCustomer.setInt("ID", 9000); - - // Build apply changes command - das.applyChanges(root); - - // Verify the change - root = select.executeQuery(); - assertEquals("Pavick", getCustomerByLastName(root, "Pavick").getString("LASTNAME")); - assertEquals("NewCustomer", getCustomerByLastName(root, "NewCustomer").getString("LASTNAME")); - assertNull(getCustomerByLastName(root, "Daniel")); - - } - - public void testReadModifyApplyWithAssumedIDFailure() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConnection()); - Command select = das.createCommand("Select * from ORDERDETAILS"); - - DataObject root = select.executeQuery(); - - DataObject od = root.getDataObject("ORDERDETAILS[1]"); - - // Modify customer - od.setInt("PRODUCTID", 72); - - // Flush changes -- This should fail because Order Details does not have - // a column that - // we can assume to be an ID - try { - das.applyChanges(root); - } catch (RuntimeException ex) { - assertTrue(ex.getMessage().indexOf("changed in the DataGraph but is not present in the Config") >= 0); - } - - } - - public void testReadModifyApplyWithAssumedIDFailure2() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConnection()); - Command select = das.createCommand("Select * from ORDERDETAILS"); - DataObject root = select.executeQuery(); - - DataObject od = root.getDataObject("ORDERDETAILS[1]"); - od.delete(); - - // Flush changes -- This should fail because Order Details does not have - // a column that - // we can assume to be an ID - try { - das.applyChanges(root); - } catch (RuntimeException ex) { - assertTrue(ex.getMessage().indexOf("changed in the DataGraph but is not present in the Config") >= 0); - } - - } - - public void testReadModifyApplyWithAssumedIDFailure3() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConnection()); - Command select = das.createCommand("Select * from ORDERDETAILS"); - DataObject root = select.executeQuery(); - - DataObject od = root.createDataObject("ORDERDETAILS"); - - // Modify customer - od.setInt("PRODUCTID", 72); - od.setInt("ORDERID", 500); - - // Flush changes -- This should fail because Order Details does not have - // a column that - // we can assume to be an ID - try { - das.applyChanges(root); - } catch (RuntimeException ex) { - assertTrue(ex.getMessage().indexOf("changed in the DataGraph but is not present in the Config") >= 0); - } - - } - - private DataObject getCustomerByLastName(DataObject root, String name) { - Iterator i = root.getList("CUSTOMER").iterator(); - while (i.hasNext()) { - DataObject obj = (DataObject) i.next(); - if (name.equals(obj.getString("LASTNAME"))) { - return obj; - } - } - return null; - } -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/DefectTests.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/DefectTests.java deleted file mode 100644 index 4eb68c1404..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/DefectTests.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test; - -/* - * These tests attempt to duplicate customer reported errors and then to verify - * any necessary fix. - * - */ - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.DAS; -import org.apache.tuscany.das.rdb.test.data.BookData; -import org.apache.tuscany.das.rdb.test.data.CompanyData; -import org.apache.tuscany.das.rdb.test.data.CompanyDeptData; -import org.apache.tuscany.das.rdb.test.data.CustomerData; -import org.apache.tuscany.das.rdb.test.data.DepEmpData; -import org.apache.tuscany.das.rdb.test.data.DepartmentData; -import org.apache.tuscany.das.rdb.test.data.EmployeeData; -import org.apache.tuscany.das.rdb.test.data.OrderData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; - -/** - * - * - */ -public class DefectTests extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - new CustomerData(getAutoConnection()).refresh(); - new OrderData(getAutoConnection()).refresh(); - - new CompanyData(getAutoConnection()).refresh(); - new DepartmentData(getAutoConnection()).refresh(); - new EmployeeData(getAutoConnection()).refresh(); - new CompanyDeptData(getAutoConnection()).refresh(); - new DepEmpData(getAutoConnection()).refresh(); - new BookData(getAutoConnection()).refresh(); - - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - /** - * Read a specific customer - */ - public void testDiltonsInsert() throws Exception { - - // String sql = "insert into conmgt.serverstatus (statusid, - // managedserverid, timestamp) values (316405209, 316405209, '2005-11-23 - // 19:29:52.636')"; - String sql = "insert into conmgt.serverstatus (managedserverid, timestamp) " - + "values (316405209, '2005-11-23 19:29:52.636')"; - DAS das = DAS.FACTORY.createDAS(getConnection()); - Command insert = das.createCommand(sql); - insert.execute(); - - // Verify - Command select = das.createCommand("Select * from conmgt.serverstatus where statusid = 1"); - DataObject root = select.executeQuery(); - - assertEquals(1, root.getList("SERVERSTATUS").size()); - - } - - - /** - * Test expected failure when applyChanges processes DO with no PK columns. We - * should throw a better error than NPE - */ - - //now with JIRA-1464 , we will get exception in select itself , so can not reach upto - //applyChanges - /*public void testReadUpdateWithNoPKColumns() throws Exception { - - DAS das = DAS.FACTORY.createDAS(getConfig("BooksConfig.xml"),getConnection()); - // Read a book instance - Command select = das.createCommand("SELECT NAME, AUTHOR, QUANTITY, OCC FROM BOOK WHERE BOOK_ID = 1"); - DataObject root = select.executeQuery(); - - DataObject book = root.getDataObject("BOOK[1]"); - // Change a field to mark the instance 'dirty' - book.setInt("QUANTITY", 2); - - try { - das.applyChanges(root); - fail("An exception should be thrown since the DO has no PK defined"); - } catch (NullPointerException ex) { - fail("We should do better than an NPE"); - } - }*/ - - -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/DynamicResultDescriptorTests.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/DynamicResultDescriptorTests.java deleted file mode 100644 index d2535a2223..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/DynamicResultDescriptorTests.java +++ /dev/null @@ -1,351 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.DAS; -import org.apache.tuscany.das.rdb.config.ConfigFactory; -import org.apache.tuscany.das.rdb.config.ResultDescriptor; -import org.apache.tuscany.das.rdb.test.data.CustomerData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; - -public class DynamicResultDescriptorTests extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - new CustomerData(getAutoConnection()).refresh(); - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - /** - * Set result descriptor on Command dynamically - */ - public void testSetResultDescriptors() throws Exception { - ConfigFactory factory = ConfigFactory.INSTANCE; - DAS das = DAS.FACTORY.createDAS(getConnection()); - // Read a customer - Command select = das.createCommand("SELECT ID, LASTNAME, ADDRESS FROM CUSTOMER WHERE CUSTOMER.ID = 1"); - - List resultDescriptorList = new ArrayList(); - //as long as columnIndex is correct, order in ArrayList does not matter - ResultDescriptor desc3 = factory.createResultDescriptor(); - desc3.setColumnIndex(3); - desc3.setColumnName("ADDRESS"); - desc3.setColumnType("commonj.sdo.String"); - desc3.setTableName("CUSTOMER"); - - ResultDescriptor desc1 = factory.createResultDescriptor(); - desc1.setColumnIndex(1); - desc1.setColumnName("ID"); - desc1.setColumnType("commonj.sdo.Int"); - desc1.setTableName("CUSTOMER"); - - ResultDescriptor desc2 = factory.createResultDescriptor(); - desc2.setColumnIndex(2); - desc2.setColumnName("LASTNAME"); - desc2.setColumnType("commonj.sdo.String"); - desc2.setTableName("CUSTOMER"); - - resultDescriptorList.add(desc3); - resultDescriptorList.add(desc1); - resultDescriptorList.add(desc2); - - select.setResultDescriptors(resultDescriptorList); - DataObject root = select.executeQuery(); - assertEquals(1, root.getList("CUSTOMER").size()); - } - - /** - * Set a result descriptor on Command dynamically - * and later replace it with another invalid one, and check failure - */ - public void testReplaceResultDescriptors() throws Exception { - ConfigFactory factory = ConfigFactory.INSTANCE; - DAS das = DAS.FACTORY.createDAS(getConnection()); - // Read a customer - Command select = das.createCommand("SELECT ID, LASTNAME, ADDRESS FROM CUSTOMER WHERE CUSTOMER.ID = 1"); - - List resultDescriptorList = new ArrayList(); - //as long as columnIndex is correct, order in ArrayList does not matter - ResultDescriptor desc3 = factory.createResultDescriptor(); - desc3.setColumnIndex(3); - desc3.setColumnName("ADDRESS"); - desc3.setColumnType("commonj.sdo.String"); - desc3.setTableName("CUSTOMER"); - - ResultDescriptor desc1 = factory.createResultDescriptor(); - desc1.setColumnIndex(1); - desc1.setColumnName("ID"); - desc1.setColumnType("commonj.sdo.Int"); - desc1.setTableName("CUSTOMER"); - - ResultDescriptor desc2 = factory.createResultDescriptor(); - desc2.setColumnIndex(2); - desc2.setColumnName("LASTNAME"); - desc2.setColumnType("commonj.sdo.String"); - desc2.setTableName("CUSTOMER"); - - resultDescriptorList.add(desc3); - resultDescriptorList.add(desc1); - resultDescriptorList.add(desc2); - - select.setResultDescriptors(resultDescriptorList); - DataObject root = select.executeQuery(); - assertEquals(1, root.getList("CUSTOMER").size()); - - //Now use invalid one - resultDescriptorList.clear(); - - desc3.setColumnIndex(3); - desc3.setColumnName("ADDRESS"); - desc3.setColumnType("commonj.sdo.Int");//incompatible type - desc3.setTableName("CUSTOMER"); - - desc1.setColumnIndex(1); - desc1.setColumnName("ID"); - desc1.setColumnType("commonj.sdo.Int"); - desc1.setTableName("CUSTOMER"); - - desc2 = factory.createResultDescriptor(); - desc2.setColumnIndex(2); - desc2.setColumnName("LASTNAME"); - desc2.setColumnType("commonj.sdo.String"); - desc2.setTableName("CUSTOMER"); - - resultDescriptorList.add(desc3); - resultDescriptorList.add(desc2); - resultDescriptorList.add(desc1); - - select.setResultDescriptors(resultDescriptorList); - try{ - root = select.executeQuery(); - fail("Expected exception"); - }catch(Exception e){ - assertTrue(e instanceof ClassCastException); - } - } - - /** - * Set result descriptor on Command dynamically - * , overriding the one set from static config. - */ - public void testOverrideResultDescriptorsFromConfig() throws Exception { - ConfigFactory factory = ConfigFactory.INSTANCE; - DAS das = DAS.FACTORY.createDAS(getConfig("customerMappingWithResultDescriptor.xml"), getConnection()); - Command select = das.getCommand("testSelectCustomer"); - DataObject root = select.executeQuery(); - List custList = root.getList("CUSTOMER"); - assertEquals("Williams", ((DataObject)custList.get(0)).getString("LASTNAME")); - - List resultDescriptorList = new ArrayList(); - - ResultDescriptor desc3 = factory.createResultDescriptor(); - desc3.setColumnIndex(3); - desc3.setColumnName("ADDRESS"); - desc3.setColumnType("commonj.sdo.Int");//incompatible type - desc3.setTableName("CUSTOMER"); - - ResultDescriptor desc1 = factory.createResultDescriptor(); - desc1.setColumnIndex(1); - desc1.setColumnName("ID"); - desc1.setColumnType("commonj.sdo.Int"); - desc1.setTableName("CUSTOMER"); - - ResultDescriptor desc2 = factory.createResultDescriptor(); - desc2.setColumnIndex(2); - desc2.setColumnName("LASTNAME"); - desc2.setColumnType("commonj.sdo.String"); - desc2.setTableName("CUSTOMER"); - - resultDescriptorList.add(desc3); - resultDescriptorList.add(desc1); - resultDescriptorList.add(desc2); - - select.setResultDescriptors(resultDescriptorList); - try{ - select.executeQuery(); - fail("Expected exception"); - }catch(Exception e){ - assertTrue(e instanceof ClassCastException); - } - } - - /** - * Set null result descriptor on Command dynamically - */ - public void testNullResultDescriptors() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConnection()); - // Read a customer - Command select = das.createCommand("SELECT ID, LASTNAME, ADDRESS FROM CUSTOMER WHERE CUSTOMER.ID = 1"); - - List resultDescriptorList = null; - - try{ - select.setResultDescriptors(resultDescriptorList); - - select.executeQuery(); - this.assertTrue("Derby has DBMS metadata, so it will be used", true); - }catch(RuntimeException e){ - fail("Expected to succeed with no exception"); - } - } - - /** - * Set -ve columnIndex in result descriptor on Command dynamically - * Set will not be sorted and Type mismatch wi (Int and String for ID) - * will throw exception - */ - public void testNegativeIndexResultDescriptors() throws Exception { - ConfigFactory factory = ConfigFactory.INSTANCE; - DAS das = DAS.FACTORY.createDAS(getConnection()); - // Read a customer - Command select = das.createCommand("SELECT ID, LASTNAME, ADDRESS FROM CUSTOMER WHERE CUSTOMER.ID = 1"); - - List resultDescriptorList = new ArrayList(); - - ResultDescriptor desc3 = factory.createResultDescriptor(); - desc3.setColumnIndex(-3);//invalid - desc3.setColumnName("ADDRESS"); - desc3.setColumnType("commonj.sdo.String"); - desc3.setTableName("CUSTOMER"); - - ResultDescriptor desc1 = factory.createResultDescriptor(); - desc1.setColumnIndex(1); - desc1.setColumnName("ID"); - desc1.setColumnType("commonj.sdo.Int"); - desc1.setTableName("CUSTOMER"); - - ResultDescriptor desc2 = factory.createResultDescriptor(); - desc2.setColumnIndex(2); - desc2.setColumnName("LASTNAME"); - desc2.setColumnType("commonj.sdo.String"); - desc2.setTableName("CUSTOMER"); - - resultDescriptorList.add(desc3); - resultDescriptorList.add(desc1); - resultDescriptorList.add(desc2); - - try{ - select.setResultDescriptors(resultDescriptorList); - - select.executeQuery(); - fail("Expected exception"); - }catch(RuntimeException e){ - assertTrue("Exception as sorting wil not happen due to -ve columnIndex", true); - } - } - - /** - * Set matching columnIndices in result descriptor on Command dynamically - */ - public void testMatchingIndexResultDescriptor() throws Exception { - ConfigFactory factory = ConfigFactory.INSTANCE; - DAS das = DAS.FACTORY.createDAS(getConnection()); - // Read a customer - Command select = das.createCommand("SELECT ID, LASTNAME, ADDRESS FROM CUSTOMER WHERE CUSTOMER.ID = 1"); - - List resultDescriptorList = new ArrayList(); - - ResultDescriptor desc3 = factory.createResultDescriptor(); - desc3.setColumnIndex(1);//two times index is 1 - desc3.setColumnName("ADDRESS"); - desc3.setColumnType("commonj.sdo.String"); - desc3.setTableName("CUSTOMER"); - - ResultDescriptor desc1 = factory.createResultDescriptor(); - desc1.setColumnIndex(1); - desc1.setColumnName("ID"); - desc1.setColumnType("commonj.sdo.Int"); - desc1.setTableName("CUSTOMER"); - - ResultDescriptor desc2 = factory.createResultDescriptor(); - desc2.setColumnIndex(2); - desc2.setColumnName("LASTNAME"); - desc2.setColumnType("commonj.sdo.String"); - desc2.setTableName("CUSTOMER"); - - resultDescriptorList.add(desc3); - resultDescriptorList.add(desc1); - resultDescriptorList.add(desc2); - - try{ - select.setResultDescriptors(resultDescriptorList); - - select.executeQuery(); - fail("Expected exception"); - }catch(RuntimeException e){ - assertTrue(e.getMessage().indexOf("Two columns in Result Descriptor can not have same index")!= -1); - } - } - - public void testAddRemoveResultDescriptor() throws Exception { - ConfigFactory factory = ConfigFactory.INSTANCE; - - ResultDescriptor desc3 = factory.createResultDescriptor(); - desc3.setColumnIndex(3);//two times index is 1 - desc3.setColumnName("ADDRESS"); - desc3.setColumnType("commonj.sdo.String"); - desc3.setTableName("CUSTOMER"); - - ResultDescriptor desc1 = factory.createResultDescriptor(); - desc1.setColumnIndex(1); - desc1.setColumnName("ID"); - desc1.setColumnType("commonj.sdo.Int"); - desc1.setTableName("CUSTOMER"); - - ResultDescriptor desc2 = factory.createResultDescriptor(); - desc2.setColumnIndex(2); - desc2.setColumnName("LASTNAME"); - desc2.setColumnType("commonj.sdo.String"); - desc2.setTableName("CUSTOMER"); - - DAS das = DAS.FACTORY.createDAS(getConnection()); - // Read a customer - Command select = das.createCommand("SELECT ID, LASTNAME, ADDRESS FROM CUSTOMER WHERE CUSTOMER.ID = 1"); - select.addResultDescriptor(desc3); - select.addResultDescriptor(desc1); - select.addResultDescriptor(desc2); - //select.printResultDescriptors(System.out); - assertEquals(1, ((ResultDescriptor)select.getResultDescriptors().get(0)).getColumnIndex()); - assertEquals(2, ((ResultDescriptor)select.getResultDescriptors().get(1)).getColumnIndex()); - assertEquals(3, ((ResultDescriptor)select.getResultDescriptors().get(2)).getColumnIndex()); - - select.removeResultDescriptor(2); - //select.printResultDescriptors(System.out); - assertEquals(1, ((ResultDescriptor)select.getResultDescriptors().get(0)).getColumnIndex()); - assertEquals(3, ((ResultDescriptor)select.getResultDescriptors().get(1)).getColumnIndex()); - - select.removeResultDescriptor(desc3); - //select.printResultDescriptors(System.out); - assertEquals(1, ((ResultDescriptor)select.getResultDescriptors().get(0)).getColumnIndex()); - - select.addResultDescriptor(null); - select.removeResultDescriptor(null); - //select.printResultDescriptors(System.out); - assertEquals(1, ((ResultDescriptor)select.getResultDescriptors().get(0)).getColumnIndex()); - } -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ExceptionTests.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ExceptionTests.java deleted file mode 100644 index 4da0df87ae..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ExceptionTests.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test; - -import java.sql.Connection; -import java.sql.SQLException; - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.DAS; -import org.apache.tuscany.das.rdb.test.companynoid.CompanynoidFactory; -import org.apache.tuscany.das.rdb.test.customer.CustomerFactory; -import org.apache.tuscany.das.rdb.test.data.BookData; -import org.apache.tuscany.das.rdb.test.data.CompanyData; -import org.apache.tuscany.das.rdb.test.data.CustomerData; -import org.apache.tuscany.das.rdb.test.data.OrderData; -import org.apache.tuscany.das.rdb.test.data.OrderDetailsData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.helper.HelperContext; -import commonj.sdo.impl.HelperProvider; - -public class ExceptionTests extends DasTest { - - public ExceptionTests() { - super(); - } - - protected void setUp() throws Exception { - super.setUp(); - - new CustomerData(getAutoConnection()).refresh(); - new OrderData(getAutoConnection()).refresh(); - new BookData(getAutoConnection()).refresh(); - new OrderDetailsData(getAutoConnection()).refresh(); - new CompanyData(getAutoConnection()).refresh(); - - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - public void testMissingConnection() throws Exception { - DAS das = DAS.FACTORY.createDAS((Connection) null); - - try { - Command readCustomers = das.createCommand("select * from CUSTOMER where ID = 1"); - readCustomers.executeQuery(); - fail("RuntimeException should be thrown"); - } catch (RuntimeException ex) { - assertEquals("No connection has been provided and no data source has been specified", ex.getMessage()); - } - - } - - public void testUnregisteredTypes() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("staticInvalid.xml"), getConnection()); - Command readCustomers = das.createCommand("select * from CUSTOMER where ID = 1"); - - try { - readCustomers.executeQuery(); - - fail("Exception should be thrown"); - } catch (RuntimeException ex) { - assertEquals("SDO Types have not been registered for URI invalidURI", ex.getMessage()); - } - } - - public void testMissingMapping() throws Exception { - HelperContext context = HelperProvider.getDefaultContext(); - CustomerFactory.INSTANCE.register(context); - DAS das = DAS.FACTORY.createDAS(getConfig("staticCustomer.xml"), getConnection()); - Command readCustomers = das.createCommand("select * from CUSTOMER where ID = 1"); - - try { - readCustomers.executeQuery(); - - fail("Exception should be thrown"); - } catch (RuntimeException ex) { - assertEquals("An SDO Type with name CUSTOMER was not found", ex.getMessage()); - } - - } - - /** - * Test ability to describe problem when a user passes an empty stream - */ - public void testEmptyStream() throws Exception { - try { - DAS.FACTORY.createDAS(getConfig("NonExistingFile.xml")); - fail("Error should be thrown"); - } catch (RuntimeException e) { - assertEquals("Cannot load configuration from a null InputStream. Possibly caused " - + "by an incorrect config xml file name", e.getMessage()); - } - } - - /** - * Test ability to describe problem when a user passes an empty stream - */ - public void testEmptyStream2() throws Exception { - try { - DAS.FACTORY.createDAS(getConfig("NonExistingFile.xml")); - fail("Error should be thrown"); - } catch (RuntimeException e) { - assertEquals("Cannot load configuration from a null InputStream. Possibly caused " - + "by an incorrect config xml file name", e.getMessage()); - } - } - - public void testReadOrdersAndDetails2() throws Exception { - - DAS das = DAS.FACTORY.createDAS(getConfig("InvalidConfig1.xml"), getConnection()); - Command read = das.createCommand("SELECT * FROM ANORDER LEFT JOIN ORDERDETAILS " - + "ON ANORDER.ID = ORDERDETAILS.ORDERID ORDER BY ANORDER.ID"); - - try { - read.executeQuery(); - } catch (Exception ex) { - assertEquals("The parent table (xxx) in relationship ORDERDETAILS was not found.", ex.getMessage()); - } - - } - - public void testMismatchedDataObjectModel() throws SQLException { - HelperContext context = HelperProvider.getDefaultContext(); - CompanynoidFactory.INSTANCE.register(context); - DAS das = DAS.FACTORY.createDAS(getConfig("companynoidMappingWithConverters.xml"), getConnection()); - Command read = das.createCommand("select * from company"); - try { - read.executeQuery(); - } catch (RuntimeException ex) { - assertEquals("Type CompanynoidType does not contain a property named ID", ex.getMessage()); - } - } - -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GeneratedCommandTests.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GeneratedCommandTests.java deleted file mode 100644 index 45c83e6167..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GeneratedCommandTests.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test; - -import java.util.List; - -import org.apache.tuscany.das.rdb.test.commands.ReadCustomersByLastnameCommand; -import org.apache.tuscany.das.rdb.test.commands.ReadCustomersCommand; -import org.apache.tuscany.das.rdb.test.commands.ReadCustomersStaticTypesCommand; -import org.apache.tuscany.das.rdb.test.commands.ReadCustomersWithShapeCommand; -import org.apache.tuscany.das.rdb.test.commands.SimpleReadCustomersWithShapeCommand; -import org.apache.tuscany.das.rdb.test.customer.Customer; -import org.apache.tuscany.das.rdb.test.data.CustomerData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; - -public class GeneratedCommandTests extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - - new CustomerData(getAutoConnection()).refresh(); - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - public void testReadCustomers() throws Exception { - ReadCustomersCommand cmd = new ReadCustomersCommand(); - cmd.setConnection(getConnection()); - - DataObject root = cmd.executeQuery(); - assertEquals(5, root.getList("CUSTOMER").size()); - } - - public void testReadSomeCustomers() throws Exception { - ReadCustomersByLastnameCommand cmd = new ReadCustomersByLastnameCommand(); - cmd.setConnection(getConnection()); - cmd.setParameter(1, "Williams"); - - DataObject root = cmd.executeQuery(); - assertEquals(4, root.getList("CUSTOMER").size()); - - } - - public void testReadCustomersStaticTypes() throws Exception { - ReadCustomersStaticTypesCommand cmd = new ReadCustomersStaticTypesCommand(); - cmd.setConnection(getConnection()); - cmd.setParameter(1, "Williams"); - - DataObject root = cmd.executeQuery(); - - List customers = root.getList("Customer"); - assertEquals(4, customers.size()); - - Customer cust1 = (Customer) customers.get(0); - assertEquals("Williams", cust1.getLastName()); - - } - - public void testSimpleReadCustomersWithShape() throws Exception { - SimpleReadCustomersWithShapeCommand cmd = new SimpleReadCustomersWithShapeCommand(); - cmd.setConnection(getConnection()); - DataObject root = cmd.executeQuery(); - assertEquals(5, root.getList("CUSTOMER").size()); - } - - public void testReadCustomersOrdersWithShape() throws Exception { - ReadCustomersWithShapeCommand cmd = new ReadCustomersWithShapeCommand(); - cmd.setConnection(getConnection()); - - DataObject root = cmd.executeQuery(); - assertEquals(5, root.getList("CUSTOMER").size()); - } - -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GeneratedId.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GeneratedId.java deleted file mode 100644 index ca8bd19868..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GeneratedId.java +++ /dev/null @@ -1,313 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test; - -/* - * Generated IDs - * - * - */ - -import java.util.Iterator; - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.DAS; -import org.apache.tuscany.das.rdb.test.data.CompanyData; -import org.apache.tuscany.das.rdb.test.data.DepartmentData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; - -public class GeneratedId extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - - new CompanyData(getAutoConnection()).refresh(); - new DepartmentData(getAutoConnection()).refresh(); - - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - // Test insert into row with generated ID - public void testInsert() throws Exception { - - DAS das = DAS.FACTORY.createDAS(getConnection()); - Command insert = das.createCommand("insert into COMPANY (NAME) values (?)"); - insert.setParameter(1, "AAA Rental"); - insert.execute(); - - // Verify insert - // Verify - Command select = das.createCommand("Select ID, NAME from COMPANY"); - DataObject root = select.executeQuery(); - - assertEquals(4, root.getList("COMPANY").size()); - assertTrue(root.getInt("COMPANY[1]/ID") > 0); - - } - - // Test back to back insertions with the same command - public void testInsert2() throws Exception { - - DAS das = DAS.FACTORY.createDAS(getConnection()); - Command insert = das.createCommand("insert into COMPANY (NAME) values (?)"); - insert.setParameter(1, "AAA Rental"); - insert.execute(); - - // insert another using same command - insert.setParameter(1, "BBB Rental"); - insert.execute(); - - // Verify insert - // Verify - Command select = das.createCommand("Select ID, NAME from COMPANY"); - DataObject root = select.executeQuery(); - - assertEquals(5, root.getList("COMPANY").size()); - - } - - // Test ability to retrieve and utilize the generated key - public void testInsert3() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConnection()); - Command insert = das.createCommand("insert into COMPANY (NAME) values (?)"); - insert.setParameter(1, "AAA Rental"); - insert.execute(); - // Integer key = (Integer) insert.getParameterValue("generated_key"); - Integer key = new Integer(insert.getGeneratedKey()); - - // Verify insert - Command select = das.createCommand("Select ID, NAME from COMPANY where ID = ?"); - select.setParameter(1, key); - DataObject root = select.executeQuery(); - assertEquals(key, root.get("COMPANY[1]/ID")); - - } - - // Test insert into row with generated ID and generated insert - public void testInsert4() throws Exception { - - DAS das = DAS.FACTORY.createDAS(getConfig("CompanyConfig.xml"), getConnection()); - Command select = das.getCommand("all companies"); - DataObject root = select.executeQuery(); - - DataObject company = root.createDataObject("COMPANY"); - company.setString("NAME", "Phil's Tires"); - // This shouldn't do anything - company.setInt("ID", 999); - - das.applyChanges(root); - - // Verify insert - root = select.executeQuery(); - - assertEquals(4, root.getList("COMPANY").size()); - Iterator i = root.getList("COMPANY").iterator(); - while (i.hasNext()) { - DataObject comp = (DataObject) i.next(); - assertFalse(comp.getInt("ID") == 999); - } - - } - - /** - * Test insert into row with generated ID and no attributes set - */ - public void testInsert5() throws Exception { - - DAS das = DAS.FACTORY.createDAS(getConfig("CompanyConfig.xml"), getConnection()); - Command select = das.getCommand("all companies"); - DataObject root = select.executeQuery(); - - root.createDataObject("COMPANY"); - - das.applyChanges(root); - - // Verify insert - root = select.executeQuery(); - assertEquals(4, root.getList("COMPANY").size()); - - } - - - // Test ability to propogate generated values back to owning data objects - public void testPropagateIds() throws Exception { - - DAS das = DAS.FACTORY.createDAS(getConfig("CompanyConfig.xml"), getConnection()); - Command select = das.getCommand("all companies"); - DataObject root = select.executeQuery(); - - // Create a new Company - DataObject company = root.createDataObject("COMPANY"); - company.setString("NAME", "Do-rite Pest Control"); - - // verify pre-condition (id is not there until after flush) - assertNull(company.get("ID")); - - // Flush changes - das.applyChanges(root); - - // Save the id - Integer id = (Integer) company.get("ID"); - - // Verify the change - select = das.createCommand("Select * from COMPANY where ID = ?"); - select.setParameter(1, id); - root = select.executeQuery(); - assertEquals("Do-rite Pest Control", root.getDataObject("COMPANY[1]").getString("NAME")); - - } - - /** - * Same as above but metadata provided by XML config file - */ - public void testPropagateIdsXML() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("basicCompanyMapping.xml"), getConnection()); - Command select = das.createCommand("Select * from COMPANY"); - DataObject root = select.executeQuery(); - - // Create a new Company - DataObject company = root.createDataObject("COMPANY"); - company.setString("NAME", "Do-rite Pest Control"); - - // verify pre-condition (id is not there until after flush) - assertNull(company.get("ID")); - - // Flush changes - das.applyChanges(root); - - // Save the id - Integer id = (Integer) company.get("ID"); - - // Verify the change - select = das.createCommand("Select * from COMPANY where ID = ?"); - select.setParameter(1, id); - root = select.executeQuery(); - assertEquals("Do-rite Pest Control", root.getDataObject("COMPANY[1]").getString("NAME")); - - } - - /** - * Test ability to correctly flush heirarchy of objects that have generated - * keys - */ - public void testFlushCreateHeirarchy() throws Exception { - - DAS das = DAS.FACTORY.createDAS(getConfig("basicCompanyDepartmentMapping.xml"), getConnection()); - String selectCompanys = "SELECT * FROM COMPANY LEFT JOIN DEPARTMENT ON COMPANY.ID = DEPARTMENT.COMPANYID"; - - Command select = das.createCommand(selectCompanys); - DataObject root = select.executeQuery(); - - // Create a new Company - DataObject company = root.createDataObject("COMPANY"); - company.setString("NAME", "Do-rite Pest Control"); - - // Create a new Department - // Do not set ID or CompanyID since these are generated - // ID INT, NAME VARCHAR(30), LOCATION VARCHAR(30), NUMBER VARCHAR(10), - // COMPANYID INT, EOTM INT - DataObject department = root.createDataObject("DEPARTMENT"); - department.setString("NAME", "Do-rite Pest Control"); - department.setString("LOCATION", "The boonies"); - department.setString("DEPNUMBER", "101"); - - // Associate the new department with the new company - company.getList("departments").add(department); - - das.applyChanges(root); - - // Save the id - Integer id = (Integer) company.get("ID"); - - // Verify the change - String selectString = "SELECT * FROM COMPANY LEFT JOIN DEPARTMENT " - + "ON COMPANY.ID = DEPARTMENT.COMPANYID WHERE COMPANY.ID = ?"; - - select = das.createCommand(selectString); - select.setParameter(1, id); - root = select.executeQuery(); - assertEquals("Do-rite Pest Control", root.getDataObject("COMPANY[1]").getString("NAME")); - - } - - /** - * Test ability to correctly flush heirarchy of objects that have generated - * keys even when a created object has legal but NULL property values - */ - public void testFlushCreateHeirarchy2() throws Exception { - - String selectCompanys = "SELECT * FROM COMPANY LEFT JOIN DEPARTMENT ON COMPANY.ID = DEPARTMENT.COMPANYID"; - - DAS das = DAS.FACTORY.createDAS(getConfig("basicCompanyDepartmentMapping.xml"), getConnection()); - Command select = das.createCommand(selectCompanys); - DataObject root = select.executeQuery(); - - // Create a new Company - DataObject company = root.createDataObject("COMPANY"); - company.setString("NAME", "Do-rite Pest Control"); - - // Create a new Department - // Do not set ID or CompanyID since these are generated - // ID INT, NAME VARCHAR(30), LOCATION VARCHAR(30), NUMBER VARCHAR(10), - // COMPANYID INT, EOTM INT - DataObject department = root.createDataObject("DEPARTMENT"); - department.setString("NAME", "Do-rite Pest Control"); - // Do not set this property to force storing NULL to DB - // department.setString("LOCATION", "The boonies"); - department.setString("DEPNUMBER", "101"); - - // Associate the new department with the new company - company.getList("departments").add(department); - - das.applyChanges(root); - - // Save the id - Integer id = (Integer) company.get("ID"); - - // Verify the change - String selectString = "SELECT * FROM COMPANY LEFT JOIN DEPARTMENT " - + "ON COMPANY.ID = DEPARTMENT.COMPANYID WHERE COMPANY.ID = ?"; - - select = das.createCommand(selectString); - select.setParameter(1, id); - root = select.executeQuery(); - assertEquals("Do-rite Pest Control", root.getDataObject("COMPANY[1]").getString("NAME")); - - } - - // Test that error is thrown when no key has been generated (as in a select) - public void testRead() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConnection()); - Command select = das.createCommand("Select * from COMPANY"); - select.executeQuery(); - - try { - select.getGeneratedKey(); - fail("Should throw exception"); - } catch (RuntimeException e) { - assertEquals("This method is only valid for insert commands", e.getMessage()); - } - } - -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GraphMergeTests.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GraphMergeTests.java deleted file mode 100644 index 47a498d620..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GraphMergeTests.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.ConfigHelper; -import org.apache.tuscany.das.rdb.DAS; -import org.apache.tuscany.das.rdb.merge.impl.GraphMerger; -import org.apache.tuscany.das.rdb.test.customer.Customer; -import org.apache.tuscany.das.rdb.test.customer.CustomerFactory; -import org.apache.tuscany.das.rdb.test.data.CustomerData; -import org.apache.tuscany.das.rdb.test.data.OrderData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; -import commonj.sdo.helper.HelperContext; -import commonj.sdo.impl.HelperProvider; - -public class GraphMergeTests extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - - new CustomerData(getAutoConnection()).refresh(); - new OrderData(getAutoConnection()).refresh(); - - } - - public void testCreateEmptyGraph() throws Exception { - String typeUri = "http:///org.apache.tuscany.das.rdb.test/customer.xsd"; - HelperContext context = HelperProvider.getDefaultContext(); - CustomerFactory.INSTANCE.register(context); - ConfigHelper helper = new ConfigHelper(); - helper.setDataObjectModel(typeUri); - DataObject graph = new GraphMerger().emptyGraph(helper.getConfig()); - assertEquals(0, graph.getList("Customer").size()); - assertEquals(0, graph.getList("AnOrder").size()); - - } - - public void testCreateEmptyGraphAndAddCustomer() throws Exception { - String typeUri = "http:///org.apache.tuscany.das.rdb.test/customer.xsd"; - HelperContext context = HelperProvider.getDefaultContext(); - CustomerFactory.INSTANCE.register(context); - ConfigHelper helper = new ConfigHelper(); - helper.setDataObjectModel(typeUri); - helper.addTable("CUSTOMER", "Customer"); - helper.addPrimaryKey("CUSTOMER.ID"); - - DataObject graph = new GraphMerger().emptyGraph(helper.getConfig()); - Customer c = (Customer) graph.createDataObject("Customer"); - c.setID(4000); - c.setLastName("Smith"); - c.setAddress("400 Fourth Street"); - - DAS das = DAS.FACTORY.createDAS(helper.getConfig(), getConnection()); - das.applyChanges(graph); - - Command cmd = das.createCommand("select * from CUSTOMER order by ID desc"); - graph = cmd.executeQuery(); - assertEquals(6, graph.getList("Customer").size()); - assertEquals("Smith", graph.getDataObject("Customer[1]").getString("lastName")); - assertEquals("400 Fourth Street", graph.getDataObject("Customer[1]").getString("address")); - - } - - public void testSingleTableMerge() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConnection()); - Command select = das.createCommand("Select ID, LASTNAME, ADDRESS from CUSTOMER where ID <= ?"); - select.setParameter(1, "3"); - DataObject graph1 = select.executeQuery(); - assertEquals(3, graph1.getList("CUSTOMER").size()); - - select.setParameter(1, "5"); - DataObject graph2 = select.executeQuery(); - assertEquals(5, graph2.getList("CUSTOMER").size()); - - GraphMerger merger = new GraphMerger(); - merger.addPrimaryKey("CUSTOMER.ID"); - DataObject mergedGraph = merger.merge(graph1, graph2); - - assertEquals(5, mergedGraph.getList("CUSTOMER").size()); - } - - public void testSingleTableMergeThreeGraphs() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConnection()); - Command select = das.createCommand("Select ID, LASTNAME, ADDRESS from CUSTOMER where ID <= ?"); - select.setParameter(1, "3"); - DataObject graph1 = select.executeQuery(); - assertEquals(3, graph1.getList("CUSTOMER").size()); - - select.setParameter(1, "4"); - DataObject graph2 = select.executeQuery(); - assertEquals(4, graph2.getList("CUSTOMER").size()); - - select.setParameter(1, "5"); - DataObject graph3 = select.executeQuery(); - assertEquals(5, graph3.getList("CUSTOMER").size()); - - GraphMerger merger = new GraphMerger(); - merger.addPrimaryKey("CUSTOMER.ID"); - List graphs = new ArrayList(); - graphs.add(graph1); - graphs.add(graph2); - graphs.add(graph3); - DataObject mergedGraph = merger.merge(graphs); - - assertEquals(5, mergedGraph.getList("CUSTOMER").size()); - - } - - public void testMultiTableMerge2() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("CustomersOrdersConfig.xml"), getConnection()); - // Read some customers and related orders - Command select = das.createCommand("SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON " - + "CUSTOMER.ID = ANORDER.CUSTOMER_ID where CUSTOMER.ID = ?"); - - select.setParameter(1, new Integer(1)); - DataObject graph1 = select.executeQuery(); - - DataObject customer = (DataObject) graph1.getList("CUSTOMER").get(0); - assertEquals(2, customer.getList("orders").size()); - - select.setParameter(1, new Integer(2)); - DataObject graph2 = select.executeQuery(); - DataObject customer2 = (DataObject) graph2.getList("CUSTOMER").get(0); - assertEquals(1, graph2.getList("CUSTOMER").size()); - assertEquals(1, customer2.getList("orders").size()); - assertEquals(2, customer2.getInt("ID")); - - GraphMerger merger = new GraphMerger(); - merger.addPrimaryKey("CUSTOMER.ID"); - merger.addPrimaryKey("ANORDER.ID"); - DataObject mergedGraph = merger.merge(graph1, graph2); - - assertEquals(3, mergedGraph.getList("ANORDER").size()); - assertEquals(2, mergedGraph.getList("CUSTOMER").size()); - - DataObject mergedCustomer = (DataObject) mergedGraph.getList("CUSTOMER").get(1); - assertEquals(2, mergedCustomer.getInt("ID")); - assertEquals(1, mergedCustomer.getList("orders").size()); - DataObject mergedOrder = (DataObject) mergedCustomer.getList("orders").get(0); - assertEquals(4, mergedOrder.getInt("ID")); - - } - - public void testMultiTableAppendSingleTable2() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("CustomersOrdersConfig.xml"), getConnection()); - // Read some customers and related orders - Command select = das.createCommand("SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON " - + "CUSTOMER.ID = ANORDER.CUSTOMER_ID where CUSTOMER.ID = ?"); - - select.setParameter(1, new Integer(1)); - DataObject graph1 = select.executeQuery(); - - DataObject customer = (DataObject) graph1.getList("CUSTOMER").get(0); - assertEquals(2, customer.getList("orders").size()); - - DAS das2 = DAS.FACTORY.createDAS(getConnection()); - Command select2 = das2.createCommand("select * from ANORDER"); - DataObject graph2 = select2.executeQuery(); - assertEquals(4, graph2.getList("ANORDER").size()); - - GraphMerger merger = new GraphMerger(); - merger.addPrimaryKey("CUSTOMER.ID"); - merger.addPrimaryKey("ANORDER.ID"); - DataObject mergedGraph = merger.merge(graph1, graph2); - assertEquals(4, mergedGraph.getList("ANORDER").size()); - assertEquals(1, mergedGraph.getList("CUSTOMER").size()); - } - -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ImpliedRelationshipTests.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ImpliedRelationshipTests.java deleted file mode 100644 index e52684a067..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ImpliedRelationshipTests.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test; - -import java.util.Iterator; - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.ConfigHelper; -import org.apache.tuscany.das.rdb.DAS; -import org.apache.tuscany.das.rdb.config.Relationship; -import org.apache.tuscany.das.rdb.test.data.CustomerData; -import org.apache.tuscany.das.rdb.test.data.OrderData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; -import commonj.sdo.Property; - -public class ImpliedRelationshipTests extends DasTest { - protected void setUp() throws Exception { - super.setUp(); - - new CustomerData(getAutoConnection()).refresh(); - new OrderData(getAutoConnection()).refresh(); - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - /** - * Ensure that an implied relationship is not created when a defined one already exists - * - * @throws Exception - */ - public void testRelationshipAlreadyDefined() throws Exception { - ConfigHelper helper = new ConfigHelper(); - Relationship r = helper.addRelationship("CUSTOMER.ID", "ANORDER.CUSTOMER_ID"); - r.setName("definedRelationship"); - - DAS das = DAS.FACTORY.createDAS(helper.getConfig(), getConnection()); - Command select = das.createCommand("select * from CUSTOMER left join ANORDER " - + "ON CUSTOMER.ID = ANORDER.CUSTOMER_ID"); - - DataObject root = select.executeQuery(); - DataObject cust = root.getDataObject("CUSTOMER[1]"); - Iterator i = cust.getType().getProperties().iterator(); - while (i.hasNext()) { - Property p = (Property) i.next(); - if (!p.getType().isDataType()) { - assertEquals(p.getName(), "definedRelationship"); - } - } - } - - /** - * Add a new Order to a list of Customers without defining any config information - * - * @throws Exception - */ - public void testAddNewOrder() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConnection()); - - Command select = das.createCommand("SELECT * FROM CUSTOMER LEFT JOIN ANORDER " - + "ON CUSTOMER.ID = ANORDER.CUSTOMER_ID"); - - DataObject root = select.executeQuery(); - - DataObject cust = root.getDataObject("CUSTOMER[1]"); - - // Save ID and Order Count - int custID = cust.getInt("ID"); - int custOrderCount = cust.getList("ANORDER").size(); - - // Create a new Order and add to customer1 - DataObject order = root.createDataObject("ANORDER"); - - order.set("ID", new Integer(99)); - order.set("PRODUCT", "The 99th product"); - order.set("QUANTITY", new Integer(99)); - cust.getList("ANORDER").add(order); - - assertEquals(custOrderCount + 1, cust.getList("ANORDER").size()); - - // Build apply changes command - das.applyChanges(root); - - // verify cust1 relationship updates - select = das.createCommand("SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON CUSTOMER.ID = ANORDER.CUSTOMER_ID " - + "where CUSTOMER.ID = ?"); - - select.setParameter(1, new Integer(custID)); - root = select.executeQuery(); - - assertEquals(custOrderCount + 1, root.getList("CUSTOMER[1]/ANORDER").size()); - } -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/KennelTests.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/KennelTests.java deleted file mode 100644 index b2aa8a8691..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/KennelTests.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test; - -import java.sql.Timestamp; - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.DAS; -import org.apache.tuscany.das.rdb.test.data.DogData; -import org.apache.tuscany.das.rdb.test.data.KennelData; -import org.apache.tuscany.das.rdb.test.data.OwnerData; -import org.apache.tuscany.das.rdb.test.data.OwnerDogData; -import org.apache.tuscany.das.rdb.test.data.VisitData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; -import org.apache.tuscany.das.rdb.test.framework.TestData; - -import commonj.sdo.DataObject; - -public class KennelTests extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - - new DogData(getAutoConnection()).refresh(); - new OwnerData(getAutoConnection()).refresh(); - new OwnerDogData(getAutoConnection()).refresh(); - new KennelData(getAutoConnection()).refresh(); - new VisitData(getAutoConnection()).refresh(); - - - } - - public void testSimple() throws Exception { - - DAS das = DAS.FACTORY.createDAS(getConnection()); - - // Build the select command - Command selectCommand = das.createCommand("select * from DOG"); - - // Get the graph - DataObject root = selectCommand.executeQuery(); - - assertEquals(3, root.getList("DOG").size()); - - } - - public void testSimple2() throws Exception { - - DAS das = DAS.FACTORY.createDAS(getConnection()); - - // Build the select command - Command selectCommand = das.createCommand("select * from OWNER"); - - // Get the graph - DataObject root = selectCommand.executeQuery(); - - assertEquals(3, root.getList("OWNER").size()); - - } - - public void testSimple3() throws Exception { - - DAS das = DAS.FACTORY.createDAS(getConnection()); - - // Build the select command - Command selectCommand = das.createCommand("select * from OWNER, DOG " - + "where DOG.OWNER_ID = OWNER.ID and OWNER.NAME = 'Fanny'"); - - // Get the graph - DataObject root = selectCommand.executeQuery(); - - //Get Fanny - DataObject fanny = root.getDataObject("OWNER[1]"); - assertEquals("Fido", fanny.getString("DOG[1]/NAME")); - - } - - public void testSimple4() throws Exception { - - DAS das = DAS.FACTORY.createDAS(getConnection()); - - // Build the select command - Command selectCommand = das.createCommand("select * from KENNEL"); - - // Get the graph - DataObject root = selectCommand.executeQuery(); - - assertEquals(3, root.getList("KENNEL").size()); - - } - - public void testSimple5() throws Exception { - - DAS das = DAS.FACTORY.createDAS(getConnection()); - - // Build the select command - Command selectCommand = das.createCommand("select * from VISIT"); - - // Get the graph - DataObject root = selectCommand.executeQuery(); - - assertEquals(3, root.getList("VISIT").size()); - assertEquals(TestData.getTimestamp("2006-10-20 00:00:00.0"), (Timestamp)root.get("VISIT[1]/CHECK_IN")); - - } - -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/LOBTests.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/LOBTests.java deleted file mode 100644 index c186ea4ad6..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/LOBTests.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test; - -import java.util.List; - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.DAS; -import org.apache.tuscany.das.rdb.test.data.DocumentsImagesData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; - -public class LOBTests extends DasTest { - protected void setUp() throws Exception { - super.setUp(); - - new DocumentsImagesData(getAutoConnection()).refresh(); - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - public void testReadWriteBlob() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConnection()); - - //Select image - Command read = das.createCommand("SELECT PIC FROM DOCUMENTS_IMAGES WHERE id = 100"); - DataObject root = read.executeQuery(); - List result = root.getList("DOCUMENTS_IMAGES"); - assertEquals(1, result.size()); - byte[] imgArray = ((DataObject)result.get(0)).getBytes(0); - assertEquals(150, imgArray.length); - - //insert same image - Command insert = das.createCommand("INSERT INTO DOCUMENTS_IMAGES (ID, PIC) VALUES (?,?)"); - insert.setParameter(1, new Integer(101)); - insert.setParameter(2, imgArray); - insert.execute(); - - //Select again - Command readNew = das.createCommand("SELECT PIC FROM DOCUMENTS_IMAGES WHERE id = 101"); - root = readNew.executeQuery(); - result = root.getList("DOCUMENTS_IMAGES"); - assertEquals(1, result.size()); - imgArray = ((DataObject)result.get(0)).getBytes(0); - assertEquals(150, imgArray.length); - } - - public void testReadWriteClob() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConnection()); - - //Select image - Command read = das.createCommand("SELECT TEXT FROM DOCUMENTS_IMAGES WHERE id = 100"); - DataObject root = read.executeQuery(); - List result = root.getList("DOCUMENTS_IMAGES"); - assertEquals(1, result.size()); - Object txtObj = ((DataObject)result.get(0)).get(0); - assertTrue(txtObj instanceof java.sql.Clob); - java.sql.Clob txtClob = (java.sql.Clob)txtObj; - assertEquals(19, txtClob.length()); - - //insert same image - Command insert = das.createCommand("INSERT INTO DOCUMENTS_IMAGES (ID, TEXT) VALUES (?,?)"); - insert.setParameter(1, new Integer(101)); - insert.setParameter(2, txtClob); - insert.execute(); - - //Select again - Command readNew = das.createCommand("SELECT TEXT FROM DOCUMENTS_IMAGES WHERE id = 101"); - root = readNew.executeQuery(); - result = root.getList("DOCUMENTS_IMAGES"); - assertEquals(1, result.size()); - txtObj = ((DataObject)result.get(0)).get(0); - assertTrue(txtObj instanceof java.sql.Clob); - txtClob = (java.sql.Clob)txtObj; - assertEquals(19, txtClob.length()); - } -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/MissingPKTests.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/MissingPKTests.java deleted file mode 100644 index f12e383cae..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/MissingPKTests.java +++ /dev/null @@ -1,350 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test; - -import java.util.List; - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.DAS; -import org.apache.tuscany.das.rdb.test.data.BookData; -import org.apache.tuscany.das.rdb.test.data.DogData; -import org.apache.tuscany.das.rdb.test.data.MultiSchemaData; -import org.apache.tuscany.das.rdb.test.data.OrderDetailsData; -import org.apache.tuscany.das.rdb.test.data.OrderDetailsDescriptionData; -import org.apache.tuscany.das.rdb.test.data.OwnerData; -import org.apache.tuscany.das.rdb.test.data.OwnerDogData; -import org.apache.tuscany.das.rdb.test.data.PartData; -import org.apache.tuscany.das.rdb.test.data.SingerData; -import org.apache.tuscany.das.rdb.test.data.SongData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; - -public class MissingPKTests extends DasTest { - protected void setUp() throws Exception { - super.setUp(); - new PartData(getAutoConnection()).refresh(); - new DogData(getAutoConnection()).refresh(); - new OwnerData(getAutoConnection()).refresh(); - new OwnerDogData(getAutoConnection()).refresh(); - new OrderDetailsData(getAutoConnection()).refresh(); - new OrderDetailsDescriptionData(getAutoConnection()).refresh(); - new MultiSchemaData(getAutoConnection()).refresh(); - new BookData(getAutoConnection()).refresh(); - new SingerData(getAutoConnection()).refresh(); - new SongData(getAutoConnection()).refresh(); - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - //join with both tables PKs present in SELECT, PK data in child is null - public void testNullDataInPK() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("MissingPK.xml"), getConnection()); - Command select = das.getCommand("testNullDataInPK"); - try{ - select.executeQuery(); - fail("Expected exception"); - }catch(RuntimeException e){ - if(e.getMessage(). - indexOf("in query does not include Primary Key "+ - "column or has null value in it, can not proceed!") >0){ - assertTrue(true);//expected failure - } - } - } - - //join with both tables PKs present in SELECT, child row is complete null, outer join - public void testOuterJoin() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("MissingPK.xml"), getConnection()); - Command select = das.getCommand("testOuterJoin"); - DataObject root = select.executeQuery(); - List singers = root.getList("SINGER"); - List songs = root.getList("SONG");//as there is no relationship (explicit/implicit) - assertNotNull(singers); - assertEquals(1, singers.size()); - assertNotNull(songs); - assertEquals(0, songs.size()); - } - - //join with both tables' PKs present in SELECT - public void test11() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("MissingPK.xml"), getConnection()); - Command select = das.getCommand("test11"); - DataObject root = select.executeQuery(); - List owners = root.getList("OWNER"); - List dogs = root.getList("DOG");//as there is no relationship (explicit/implicit) - assertNotNull(owners); - assertNotNull(dogs); - for(int i=0; i0){ - assertTrue(true);//expected failure - } - } - } - - //join with child table's PK missing in SELECT - public void test33() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("MissingPK.xml"), getConnection()); - Command select = das.getCommand("test33"); - try{ - select.executeQuery(); - fail("Expected exception"); - }catch(RuntimeException e){ - if(e.getMessage(). - indexOf("in query does not include Primary Key "+ - "column or has null value in it, can not proceed!") >0){ - assertTrue(true);//expected failure - } - } - } - - //join with both tables' PK missing in SELECT - public void test44() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("MissingPK.xml"), getConnection()); - Command select = das.getCommand("test44"); - try{ - select.executeQuery(); - fail("Expected exception"); - }catch(RuntimeException e){ - if(e.getMessage(). - indexOf("in query does not include Primary Key "+ - "column or has null value in it, can not proceed!") >0){ - assertTrue(true);//expected failure - } - } - } - - //join with both tables' PK present in SELECT (use relationship) - public void test11_rel() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("MissingPKREL.xml"), getConnection()); - Command select = das.getCommand("test11"); - DataObject root = select.executeQuery(); - List owners = root.getList("OWNER"); - assertNotNull(owners); - assertEquals(3, owners.size()); - - if(owners != null){ - for(int i=0; i0){ - assertTrue(true);//expected failure - } - } - } - - //join with child table's PK missing in SELECT (use relationship) - public void test33_rel() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("MissingPKREL.xml"), getConnection()); - Command select = das.getCommand("test33"); - try{ - select.executeQuery(); - fail("Expected exception"); - }catch(RuntimeException e){ - if(e.getMessage(). - indexOf("in query does not include Primary Key "+ - "column or has null value in it, can not proceed!") >0){ - assertTrue(true);//expected failure - } - } - } - - //join with both tables' PK missing in SELECT (use relationship) - public void test44_rel() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("MissingPKREL.xml"), getConnection()); - Command select = das.getCommand("test44"); - try{ - select.executeQuery(); - fail("Expected exception"); - }catch(RuntimeException e){ - if(e.getMessage(). - indexOf("in query does not include Primary Key "+ - "column or has null value in it, can not proceed!") >0){ - assertTrue(true);//expected failure - } - } - } - - public void testCompoundPks() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("MissingPKREL.xml"), getConnection()); - Command select = das.getCommand("compound_pks"); - DataObject root = select.executeQuery(); - assertEquals(4, root.getList("ORDERDETAILS").size()); - } - - public void testCompoundPksFail() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("MissingPKREL.xml"), getConnection()); - Command select = das.getCommand("compound_pks_fail"); - try{ - select.executeQuery(); - fail("Expected exception"); - }catch(RuntimeException e){ - if(e.getMessage(). - indexOf("in query does not include Primary Key "+ - "column or has null value in it, can not proceed!") >0){ - assertTrue(true);//expected failure - } - } - } - - public void testCompoundPksJoin() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("MissingPKREL.xml"), getConnection()); - Command select = das.getCommand("compound_pks_join"); - DataObject root = select.executeQuery(); - List ordDetList = root.getList("ORDERDETAILS"); - assertEquals(4, ordDetList.size()); - for(int i=0; i0){ - assertTrue(true);//expected failure - } - } - } - - //case when no PK defined in Config but column ID is there in table and is not in SELECT clause - //convention over configuration should assume it as PK and fail select - public void testPartFail() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("MissingPK.xml"), getConnection()); - Command select = das.getCommand("testPartFail"); - try{ - select.executeQuery(); - fail("Expected exception"); - }catch(RuntimeException e){ - if(e.getMessage(). - indexOf("in query does not include Primary Key "+ - "column or has null value in it, can not proceed!") >0){ - assertTrue(true);//expected failure - } - } - } - - public void testMultiSchemaPKMiss() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("MultiSchemaDasConfig14.xml"), getConnection()); - - //Explicit compound key relationship between DASTEST1.ORDERDETAILS and DASTEST3.ORDERDETAILSDESC - //ORDERID <-> ORDERID, PRODUCTID<->PRODUCTID - // Read some order details and related order details descs - Command select = das - .createCommand("SELECT DASTEST1.ORDERDETAILS.ORDERID, DASTEST1.ORDERDETAILS.PRODUCTID," + - "DASTEST3.ORDERDETAILSDESC.ORDERID FROM DASTEST1.ORDERDETAILS LEFT JOIN DASTEST3.ORDERDETAILSDESC " + - " ON DASTEST1.ORDERDETAILS.ORDERID = DASTEST3.ORDERDETAILSDESC.ORDERID " + - " AND DASTEST1.ORDERDETAILS.PRODUCTID = DASTEST3.ORDERDETAILSDESC.PRODUCTID"); - - try{ - select.executeQuery(); - fail("Expected exception"); - }catch(RuntimeException e){ - if(e.getMessage(). - indexOf("in query does not include Primary Key "+ - "column or has null value in it, can not proceed!") >0){ - assertTrue(true);//expected failure - } - } - } - - public void testTypePropsDifferent() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("MissingPK.xml"), getConnection()); - Command select = das.getCommand("get all books"); - try{ - select.executeQuery(); - fail("Expected exception"); - }catch(RuntimeException e){ - if(e.getMessage(). - indexOf("in query does not include Primary Key "+ - "column or has null value in it, can not proceed!") >0){ - assertTrue(true);//expected failure - } - } - } -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/MultiSchemaTests.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/MultiSchemaTests.java deleted file mode 100644 index ee16434236..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/MultiSchemaTests.java +++ /dev/null @@ -1,715 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test; - -import java.text.DateFormat; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.List; - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.DAS; -import org.apache.tuscany.das.rdb.test.data.MultiSchemaData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; - -public class MultiSchemaTests extends DasTest{ - protected void setUp() throws Exception { - super.setUp(); - new MultiSchemaData(getAutoConnection()).refresh(); - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - /**If database is present connect to it and create necessary tables, procedures, data etc. - * - * Below is test database schema required. - * Schema Layout - - * Database: DASTEST - * Schema: DASTEST1 - * Tables: CUSTOMER, EMPLOYEE, CITY, ORDERDETAILS - * Schema: DASTEST2 - * Tables: CUSTOMER, ACCOUNT, CITY - * Schema: DASTEST3 - * Tables: CUSTOMER, CUSTORDER, ORDERDETAILSDESC - */ - - public void testMulitiSchemaCase1() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("MultiSchemaDasConfig1.xml"), getConnection()); - //test case 1 - CRUD when schemaName, tableName, typeName present - DASTEST1.CUSTOMER - //System.out.println("Result:test case 1 - CRUD when schemaName, tableName, typeName present:DASTEST1.CUSTOMER"); - //test select - //System.out.println("Result:test case 1 - SELECT"); - assertEquals(getCustomers(das).size(), 3); - - //test insert - basic - //System.out.println("Result:test case 1 - INSERT(execute())"); - addCustomer(das); - assertEquals(getCustomers(das).size(), 4); - - //test insert - use SDO - //System.out.println("Result:test case 1 - INSERT(applyChanges())"); - addSDOCustomer(das); - assertEquals(getCustomers(das).size(), 5); - - //test delete - basic - //System.out.println("Result:test case 1 - DELETE(execute())"); - deleteCustomer(das); - assertEquals(getCustomers(das).size(), 4); - - //test delete - SDO - //System.out.println("Result:test case 1 - DELETE(applyChanges())"); - deleteSDOCustomer(das); - assertEquals(getCustomers(das).size(), 3); - - //test update - //System.out.println("Result:test case 1 - UPDATE"); - changeFirstCustomerName(das); - assertEquals( ((DataObject)getCustomers(das).get(0)).get("LASTNAME"), "Williams"); - //System.out.println("******************************************"); - } - - public void testMultiSchemaCase2()throws Exception{ - DAS das = DAS.FACTORY.createDAS(getConfig("MultiSchemaDasConfig2.xml"), getConnection()); - //test case 1 - CRUD when schemaName, tableName present, typeName not present - DASTEST2.ACCOUNT - //System.out.println("Result:test case 2 - CRUD when schemaName, tableName present, typeName not present:DASTEST2.ACCOUNT"); - //test select - //System.out.println("Result:test case 2 - SELECT"); - assertEquals(getAccounts(das).size(), 4); - - //test insert - basic - //System.out.println("Result:test case 2 - INSERT(execute())"); - addAccount(das); - assertEquals(getAccounts(das).size(), 5); - - //test insert - SDO - //System.out.println("Result:test case 2 - INSERT(applyChanges())"); - addSDOAccount(das); - assertEquals(getAccounts(das).size(), 6); - - //test delete - basic - //System.out.println("Result:test case 2 - DELETE(execute())"); - deleteAccount(das); - assertEquals(getAccounts(das).size(), 5); - - //test delete - SDO - //System.out.println("Result:test case 2 - DELETE(applyChanges())"); - deleteSDOAccount(das); - assertEquals(getAccounts(das).size(), 4); - - //test update - //System.out.println("Result:test case 2 - UPDATE"); - changeFirstAccountBalance(das); - assertEquals( ((DataObject)getAccounts(das).get(0)).get("BALANCE"), new Integer(45000)); - //System.out.println("******************************************"); - } - - public void testMultiSchemaCase3() throws Exception{ - DAS das = DAS.FACTORY.createDAS(getConfig("MultiSchemaDasConfig3.xml"), getConnection()); - //test case 3 - CRUD when is not there in config - DASTEST1.CITY - //System.out.println("Result:test case 3 - CRUD when
is not there in config:DASTEST1.CITY"); - //test select - //System.out.println("Result:test case 3 - SELECT"); - assertEquals(getCities(das).size(), 2); - - //test insert - basic - //System.out.println("Result:test case 3 - INSERT(execute())"); - addCity(das); - assertEquals(getCities(das).size(), 3); - - //test insert - SDO - //System.out.println("Result:test case 3 - INSERT(applyChanges())"); - assertEquals(addSDOCity(das),"Expected failure to insert"); - assertEquals(getCities(das).size(), 3); - - //test delete - basic - //System.out.println("Result:test case 3 - DELETE(execute())"); - deleteCity(das); - assertEquals(getCities(das).size(), 2); - - //test delete - SDO - //System.out.println("Result:test case 3 - DELETE(applyChanges())"); - assertEquals(deleteSDOCity(das), "Expected failure to delete"); - assertEquals(getCities(das).size(), 2); - - //test update - //System.out.println("Result:test case 3 - UPDATE"); - assertEquals(changeFirstCityName(das), "Expected failure to update"); - //System.out.println("******************************************"); - } - - public void testMultiSchemaCase4() throws Exception{ - //System.out.println("Result:test case 4 - with multi schema support ON, have table with no schemaName"); - try{ - //get das handle for invalid config - DAS das = DAS.FACTORY.createDAS(getConfig("MultiSchemaInvalidDasConfig.xml"), getConnection()); - }catch(Exception e){ - //No schemaName provided for tableName CUSTORDER when schemaNameSupport is ON - assertEquals("No schemaName provided for tableName CUSTORDER when schemaNameSupport is ON", - e.getMessage()); - } - - //System.out.println("******************************************"); - } - - public void testMultiSchemaCase5() throws Exception{ - DAS das = DAS.FACTORY.createDAS(getConfig("MultiSchemaDasConfig5.xml"), getConnection()); - - //test case 5 - SELECT when CUSTOMER.ID is present in DASTEST1 and DASTEST2 - //and DASTEST2.CUSTOMER
not in config - //System.out.println("Result:test case 5 - SELECT when CUSTOMER.ID is present in DASTEST1 and DASTEST2 and"+ - // " DASTEST2.CUSTOMER
not in config"); - DataObject root = getCustomersFrom2SchemasWithOneSchemaNotInConfig(das); - assertEquals(root.getList("DASTEST1_CUSTOMER").size(), 3); - assertEquals(root.getList("DASTEST2.CUSTOMER").size(), 3); - //System.out.println("******************************************"); - } - - public void testMultiSchemaCase6()throws Exception{ - DAS das = DAS.FACTORY.createDAS(getConfig("MultiSchemaDasConfig6.xml"), getConnection()); - //test case 6 - SELECT when CUSTOMER.ID is present in DASTEST1 and DB2ADMIN - and both
entries are in Config - //System.out.println("Result:test case 6 - SELECT when CUSTOMER.ID is present in DASTEST1 and DB2ADMIN, and both
in config"); - //test select - //System.out.println("Result:test case 6 - SELECT"); - DataObject root = getCustomersFrom2SchemasBothSchemaInConfig(das); - assertEquals(root.getList("DASTEST1_CUSTOMER").size(),3); - assertEquals(root.getList("DASTEST3_CUSTOMER").size(),3); - //System.out.println("******************************************"); - } - - public void testMultiSchemaCase7()throws Exception{ - DAS das = DAS.FACTORY.createDAS(getConfig("MultiSchemaDasConfig7.xml"), getConnection()); - //test case 7 - SELECT when CITY.INDX is present in DASTEST1 and DASTEST2 and no enrty for - //any
in config - //System.out.println("Result:test case 7 - SELECT when CITY.INDX is present in DASTEST1 and DASTEST2, and no
in config"); - //test select - //System.out.println("Result:test case 7 - SELECT"); - DataObject root = getCitiesFrom2SchemasNoneInConfig(das); - assertEquals(root.getList("DASTEST1.CITY").size(), 2); - assertEquals(root.getList("DASTEST2.CITY").size(), 2); - //System.out.println("******************************************"); - } - - public void testMultiSchemaCase8()throws Exception{ - DAS das = DAS.FACTORY.createDAS(getConfig("MultiSchemaDasConfig8.xml"), getConnection()); - - //test case 8 - SELECT using ResultDescriptor - DASTEST2.ACCOUNT - //System.out.println("Result:test case 8 - SELECT using ResultDescriptor:DASTEST2.ACCOUNT"); - assertEquals(getAccountRSDesc(das).size(), 4); - //System.out.println("******************************************"); - } - - public void testMultiSchemaCase9()throws Exception{ - DAS das = DAS.FACTORY.createDAS(getConfig("MultiSchemaDasConfig9.xml"), getConnection()); - //test case 9, 11 - Implied relationship , PK when both tables in same schema DASTEST2.CUSTOMER, DASTEST2.ACCOUNT - //System.out.println("Result:test case 9, 11 - Implied relationship when both tables in same schema DASTEST2.CUSTOMER, DASTEST2.ACCOUNT"); - DataObject root = getSingleSchemaCustomersAccounts(das); - assertEquals(root.getList("DASTEST2.CUSTOMER").size(), 2); - assertEquals(root.getList("DASTEST2.ACCOUNT").size(), 4); - //System.out.println("******************************************"); - } - - private static Date kbday; - private static Date tbday; - private static DateFormat myformat = new SimpleDateFormat("yyyy.MM.dd"); - static { - try { - kbday = myformat.parse("1957.09.27"); - tbday = myformat.parse("1966.12.20"); - } catch (ParseException e) { - throw new RuntimeException(e); - } - } - - public void testMultiSchemaCase12()throws Exception{ - DAS das = DAS.FACTORY.createDAS(getConfig("MultiSchemaDasConfig12.xml"), getConnection()); - //test case 12 - use converter with multi-schema ON:DASTEST1.EMPLOYEE - //System.out.println("Result:test case 12 - converter on DASTEST1.EMPLOYEE.LASTNAME"); - Command read = das.getCommand("testArbitraryConverter"); - // Read - DataObject root = read.executeQuery(); - - // Verify - assertEquals(kbday,root.getDate("DASTEST1.EMPLOYEE[1]/LASTNAME")); - - // Modify - root.setDate("DASTEST1.EMPLOYEE[1]/LASTNAME", tbday); - das.applyChanges(root); - - // Read - root = read.executeQuery(); - - // Verify - assertEquals(tbday, root.getDate("DASTEST1.EMPLOYEE[1]/LASTNAME")); - - //System.out.println("******************************************"); - } - - public void testMultiSchemaCase13()throws Exception{ - DAS das = DAS.FACTORY.createDAS(getConfig("MultiSchemaDasConfig13.xml"), getConnection()); - - //Explicit relationship between DASTEST1.CUSTOMER and DASTEST2.ACCOUNT - //System.out.println("Result:test case13 - Explicit relationship when both tables in different schema DASTEST1.CUSTOMER, DASTEST2.ACCOUNT"); - // Read some customers and related accounts - Command select = das - .createCommand("SELECT * FROM DASTEST1.CUSTOMER LEFT JOIN DASTEST2.ACCOUNT "+ - " ON DASTEST1.CUSTOMER.ID = DASTEST2.ACCOUNT.CUSTOMER_ID"); - - DataObject root = select.executeQuery(); - - DataObject cust1 = root.getDataObject("DASTEST1_CUSTOMER[1]"); - DataObject cust2 = root.getDataObject("DASTEST1_CUSTOMER[2]"); - - // Save IDs - Integer cust1ID = (Integer) cust1.get("ID"); - Integer cust2ID = (Integer) cust2.get("ID"); - - //System.out.println("cust 1 ID :"+cust1ID); - //System.out.println("cust 2 ID :"+cust2ID); - // save account count - Integer cust1AccountCount = new Integer(cust1.getList("accounts").size()); - Integer cust2AccountCount = new Integer(cust2.getList("accounts").size()); - - // Move an account to cust1 from cust2 - DataObject account = (DataObject) cust2.getList("accounts").get(0); - cust1.getList("accounts").add(account); - - // Flush changes - das.applyChanges(root); - - // verify cust1 relationship updates - select = das - .createCommand("SELECT * FROM DASTEST1.CUSTOMER LEFT JOIN DASTEST2.ACCOUNT ON " - + "DASTEST1.CUSTOMER.ID = DASTEST2.ACCOUNT.CUSTOMER_ID where DASTEST1.CUSTOMER.ID = ?"); - select.setParameter(1, cust1ID); - - root = select.executeQuery(); - assertEquals((cust1AccountCount.intValue() + 1), root.getList("DASTEST1_CUSTOMER[1]/accounts").size()); - - // verify cust2 relationship updates - select.setParameter(1, cust2ID); - root = select.executeQuery(); - assertEquals((cust2AccountCount.intValue() - 1),root.getList("DASTEST1_CUSTOMER[1]/accounts").size()); - //System.out.println("******************************************"); - } - - //steer away from implied relationships - we dont support multi schema there!!! - public void testMultiSchemaCase14()throws Exception{ - DAS das = DAS.FACTORY.createDAS(getConfig("MultiSchemaDasConfig14.xml"), getConnection()); - - //Explicit compound key relationship between DASTEST1.ORDERDETAILS and DASTEST3.ORDERDETAILSDESC - //ORDERID <-> ORDERID, PRODUCTID<->PRODUCTID - //System.out.println("Result:test case14 - Explicit compound key relationship when both " + - // "tables in different schema DASTEST1.ORDERDETAILS, DASTEST3.ORDERDETAILSDESC"); - - // Read some order details and related order details descs - Command select = das - .createCommand("SELECT * FROM DASTEST1.ORDERDETAILS LEFT JOIN DASTEST3.ORDERDETAILSDESC " + - " ON DASTEST1.ORDERDETAILS.ORDERID = DASTEST3.ORDERDETAILSDESC.ORDERID " + - " AND DASTEST1.ORDERDETAILS.PRODUCTID = DASTEST3.ORDERDETAILSDESC.PRODUCTID"); - - DataObject root = select.executeQuery(); - - DataObject ordDet1 = root.getDataObject("DASTEST1.ORDERDETAILS[1]"); - DataObject ordDet2 = root.getDataObject("DASTEST1.ORDERDETAILS[2]"); - - // Save IDs - Integer ord1ID = (Integer) ordDet1.get("ORDERID"); - Integer prod1ID = (Integer) ordDet1.get("PRODUCTID"); - - Integer ord2ID = (Integer) ordDet2.get("ORDERID"); - Integer prod2ID = (Integer) ordDet2.get("PRODUCTID"); - - // save order count - Integer order1DetDescCount = new Integer(ordDet1.getList("orderDetailsDesc").size()); - Integer order2DetDescCount = new Integer(ordDet2.getList("orderDetailsDesc").size()); - - // Move an order detail desc to ord det1 from ord det2 - DataObject orderDetailsDesc = (DataObject) ordDet2.getList("orderDetailsDesc").get(0); - ordDet1.getList("orderDetailsDesc").add(orderDetailsDesc); - - // Flush changes - das.applyChanges(root); - - // verify ord det1 relationship updates - select = das - .createCommand("SELECT * FROM DASTEST1.ORDERDETAILS LEFT JOIN DASTEST3.ORDERDETAILSDESC " + - " ON DASTEST1.ORDERDETAILS.ORDERID = DASTEST3.ORDERDETAILSDESC.ORDERID " + - " AND DASTEST1.ORDERDETAILS.PRODUCTID = DASTEST3.ORDERDETAILSDESC.PRODUCTID " + - " where DASTEST1.ORDERDETAILS.ORDERID = ? AND DASTEST1.ORDERDETAILS.PRODUCTID = ?"); - select.setParameter(1, ord1ID); - select.setParameter(2, prod1ID); - - root = select.executeQuery(); - assertEquals((order1DetDescCount.intValue() + 1), - root.getList("DASTEST1.ORDERDETAILS[1]/orderDetailsDesc").size()); - - // verify ord det2 relationship updates - select.setParameter(1, ord2ID); - select.setParameter(2, prod2ID); - - root = select.executeQuery(); - assertEquals((order2DetDescCount.intValue() - 1), - root.getList("DASTEST1.ORDERDETAILS[1]/orderDetailsDesc").size()); - } - - /** - * Display result - * @param list - * @param numCols - number of columns in each row - */ - public static void printList(List list, int numCols){ - if(list != null) - System.out.println("list size:"+list.size()); - - for(int i=0; i to create/update/delete - * through config, with duplicate indexes - * @throws Exception - */ - public void testCUDNamedParameters() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("namedParameter.xml"), getConnection()); - // Read customer 1 - Command select = das.createCommand("Select * from CUSTOMER where ID = 1"); - DataObject root = select.executeQuery(); - assertFalse(root.get("CUSTOMER[1]/LASTNAME").equals("Pavick")); - - // Modify customer - DataObject customer = (DataObject) root.get("CUSTOMER[1]"); - customer.set("LASTNAME", "Pavick"); - customer.set("ADDRESS", "Pavick's Address"); - // Build apply changes command - try{ - das.applyChanges(root); - fail("Expected exception"); - }catch(RuntimeException e){ - assertTrue(e.getMessage().startsWith("Parameters with improper indexes!")); - } - - //create - root = select.executeQuery(); - DataObject newCustomer = root.createDataObject("CUSTOMER"); - newCustomer.setInt("ID", 6); - newCustomer.setString("LASTNAME", "Louise"); - newCustomer.setString("ADDRESS", "U.K."); - try{ - das.applyChanges(root); - fail("Expected exception"); - }catch(RuntimeException e){ - assertTrue(e.getMessage().startsWith("Parameters with duplicate indexes!")); - } - - //delete - root = select.executeQuery(); - DataObject toBeDeleted = root.getDataObject("CUSTOMER[1]"); - toBeDeleted.setString("LASTNAME", "Pavick"); - toBeDeleted.delete(); - das.applyChanges(root); - root = select.executeQuery(); - assertEquals(null, root.getDataObject("CUSTOMER[1]")); - - } - - /** - * Test passing List to Command through config - * @throws Exception - */ - public void testCommandNamedParameters() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("namedParameter.xml"), getConnection()); - //select - Command select = das.getCommand("getCustomer"); - select.setParameter("ID", new Integer(1)); - DataObject root = select.executeQuery(); - List customers = root.getList("CUSTOMER"); - assertEquals(1, customers.size()); - DataObject customer = (DataObject)customers.get(0); - assertEquals("Williams", customer.get("LASTNAME")); - - //insert - command in config has - Command insert = das.getCommand("createCustomer"); - //see order is not maintained, but config depicts it through index attrb - //if index is missing , auto increment logic will be followed - insert.setParameter("LASTNAME", "Louise"); - insert.setParameter("ADDRESS", "TPO"); - insert.setParameter("ID", new Integer(6)); - insert.execute(); - select.setParameter("ID", new Integer(6)); - root = select.executeQuery(); - customers = root.getList("CUSTOMER"); - assertEquals(1, customers.size()); - customer = (DataObject)customers.get(0); - assertEquals("Louise", customer.get("LASTNAME")); - - //insert - command in config has no - Command insertNoParam = das.getCommand("createCustomerNoParam"); - //if param/index is missing in cfg, auto increment logic will be followed - insertNoParam.setParameter("ID", new Integer(7)); - insertNoParam.setParameter("LASTNAME", "Louise7"); - insertNoParam.setParameter("ADDRESS", "TPO7"); - insertNoParam.execute(); - select.setParameter("ID", new Integer(7)); - root = select.executeQuery(); - customers = root.getList("CUSTOMER"); - assertEquals(1, customers.size()); - customer = (DataObject)customers.get(0); - assertEquals("Louise7", customer.get("LASTNAME")); - - //update - Command update = das.getCommand("updateCustomer"); - update.setParameter("LASTNAME", "NoLouise"); - update.setParameter("ID", new Integer(6)); - update.execute(); - select.setParameter("ID", new Integer(6)); - root = select.executeQuery(); - customers = root.getList("CUSTOMER"); - assertEquals(1, customers.size()); - customer = (DataObject)customers.get(0); - assertEquals("NoLouise", customer.get("LASTNAME")); - - //update - no param in config - Command updateNoParam = das.getCommand("updateCustomerNoParam"); - updateNoParam.setParameter("LASTNAME", "YesLouise"); - updateNoParam.setParameter("ID", new Integer(6)); - updateNoParam.execute(); - select.setParameter("ID", new Integer(6)); - root = select.executeQuery(); - customers = root.getList("CUSTOMER"); - assertEquals(1, customers.size()); - customer = (DataObject)customers.get(0); - assertEquals("YesLouise", customer.get("LASTNAME")); - - //delete - Command delete = das.getCommand("deleteCustomer"); - delete.setParameter("ID", new Integer(6)); - delete.execute(); - select.setParameter("ID", new Integer(6)); - root = select.executeQuery(); - customers = root.getList("CUSTOMER"); - assertEquals(0, customers.size()); - - //delete - cfg command with no param - Command deleteNoParam = das.getCommand("deleteCustomerNoParam"); - deleteNoParam.setParameter("ID", new Integer(7)); - deleteNoParam.execute(); - select.setParameter("ID", new Integer(7)); - root = select.executeQuery(); - customers = root.getList("CUSTOMER"); - assertEquals(0, customers.size()); - } - - /** - * Test passing List to Command through program - * @throws Exception - */ - public void testProgrammaticCommandNamedParameters() throws Exception { - ConfigHelper helper = new ConfigHelper(); - //Command insertAdhoc = das.createCommand("insert into CUSTOMER values (?, ?, ?)"); - org.apache.tuscany.das.rdb.config.Command insertAdhoc = ConfigFactory.INSTANCE.createCommand(); - insertAdhoc.setKind("insert"); - insertAdhoc.setSQL("insert into CUSTOMER values (?, ?, ?)"); - insertAdhoc.setName("insertCustomer"); - Parameter parameter1 = ConfigFactory.INSTANCE.createParameter(); - parameter1.setName("ID"); - Parameter parameter2 = ConfigFactory.INSTANCE.createParameter(); - parameter2.setName("LASTNAME"); - Parameter parameter3 = ConfigFactory.INSTANCE.createParameter(); - parameter3.setName("ADDRESS"); - insertAdhoc.getParameter().add(parameter1); - insertAdhoc.getParameter().add(parameter2); - insertAdhoc.getParameter().add(parameter3); - Config cfg = helper.getConfig(); - cfg.getCommand().add(insertAdhoc); - DAS das = DAS.FACTORY.createDAS(cfg, getConnection()); - - //setup is over, now set values in params and execute - Command insert = das.getCommand("insertCustomer"); - insert.setParameter("ID", new Integer(6)); - insert.setParameter("LASTNAME", "Anthony"); - insert.setParameter("ADDRESS", "IND"); - insert.execute(); - - Command select = das.createCommand("select * from CUSTOMER where ID = ?"); - select.setParameter("ID", new Integer(6)); - DataObject root = select.executeQuery(); - List customers = root.getList("CUSTOMER"); - assertEquals(1, customers.size()); - DataObject customer = (DataObject)customers.get(0); - assertEquals("Anthony", customer.get("LASTNAME")); - } - - /** - * Test set/getParameter(name) on Command - * @throws Exception - */ - public void testNamedParameters() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConnection()); - Command insertAdhoc = das.createCommand("insert into CUSTOMER values (?, ?, ?)"); - insertAdhoc.setParameter("ID", new Integer(6)); - insertAdhoc.setParameter("LASTNAME", "MyLastName"); - insertAdhoc.setParameter("ADDRESS", "MyLastAddress"); - assertEquals("MyLastAddress", insertAdhoc.getParameter("ADDRESS")); - insertAdhoc.execute(); - - Command select = das.createCommand("select * from CUSTOMER where ID = ?"); - select.setParameter("ID", new Integer(6)); - DataObject root = select.executeQuery(); - List customers = root.getList("CUSTOMER"); - assertEquals(1, customers.size()); - DataObject customer = (DataObject)customers.get(0); - assertEquals("MyLastName", customer.get("LASTNAME")); - - } -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OCCTests.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OCCTests.java deleted file mode 100644 index 00a417da8d..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OCCTests.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test; - -import java.sql.SQLException; - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.ConfigHelper; -import org.apache.tuscany.das.rdb.DAS; -import org.apache.tuscany.das.rdb.config.Config; -import org.apache.tuscany.das.rdb.config.ConfigFactory; -import org.apache.tuscany.das.rdb.exception.OptimisticConcurrencyException; -import org.apache.tuscany.das.rdb.test.data.BookData; -import org.apache.tuscany.das.rdb.test.data.CustomerData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; - -public class OCCTests extends DasTest { - protected void setUp() throws Exception { - super.setUp(); - - new BookData(getAutoConnection()).refresh(); - new CustomerData(getAutoConnection()).refresh(); - } - - public void testAutomaticOCC() throws SQLException { - DAS das = DAS.FACTORY.createDAS(getConnection()); - // Read customer with particular ID - Command select = das.createCommand("Select * from CUSTOMER where ID = 1"); - DataObject root = select.executeQuery(); - - // Explicitly update the DB to force a collision - Command update = das.createCommand("update CUSTOMER set LASTNAME = 'Smith' where ID = 1"); - update.execute(); - - DataObject customer = root.getDataObject("CUSTOMER[1]"); - - // Modify customer - customer.set("LASTNAME", "Pavick"); - - // Build apply changes command - try { - das.applyChanges(root); - fail("An OCCException should be thrown"); - } catch (OptimisticConcurrencyException ex) { - if (!ex.getMessage().equals("An update collision occurred")) { - throw ex; - } - } - - } - - public void testSimpleOCC() throws SQLException { - - DAS das = DAS.FACTORY.createDAS(getConfig("BooksConfig.xml"), getConnection()); - // Read a book instance - Command select = das.getCommand("select book 1"); - DataObject root = select.executeQuery(); - DataObject book = root.getDataObject("BOOK[1]"); - // Change a field to mark the instance 'dirty' - book.setInt("QUANTITY", 2); - - // Explicitly change OCC column in database to force collision - Command update = das.getCommand("update book 1"); - update.setParameter(1, new Integer(100)); - update.execute(); - - // Try to apply changes and catch the expected An update collision occurred - try { - das.applyChanges(root); - fail("An OCCException should be thrown"); - } catch (OptimisticConcurrencyException ex) { - if (!ex.getMessage().equals("An update collision occurred")) { - throw ex; - } - } - } - - public void testManagedOCC() throws SQLException { - DAS das = DAS.FACTORY.createDAS(getConfig("ManagedBooksConfig.xml"), getConnection()); - Command select = das.getCommand("select book 1"); - DataObject root = select.executeQuery(); - DataObject book = root.getDataObject("BOOK[1]"); - // Change a field to mark the instance 'dirty' - book.setInt("QUANTITY", 2); - int occValue = book.getInt("OCC"); - das.applyChanges(root); - - root = select.executeQuery(); - book = root.getDataObject("BOOK[1]"); - assertEquals(occValue + 1, book.getInt("OCC")); - } - - public void testManagedOCCFailure() throws SQLException { - DAS das = DAS.FACTORY.createDAS(getConfig("ManagedBooksConfig.xml"), getConnection()); - // Read a book instance - Command select = das.getCommand("select book 1"); - DataObject root = select.executeQuery(); - DataObject book = root.getDataObject("BOOK[1]"); - // Change a field to mark the instance 'dirty' - book.setInt("QUANTITY", 2); - - DAS das2 = DAS.FACTORY.createDAS(getConfig("ManagedBooksConfig.xml"), getConnection()); - // Read a book instance - Command select2 = das2.getCommand("select book 1"); - DataObject root2 = select2.executeQuery(); - DataObject book2 = root2.getDataObject("BOOK[1]"); - // Change a field to mark the instance 'dirty' - book2.setInt("QUANTITY", 5); - das2.applyChanges(root2); - - // Try to apply changes and catch the expecetd An update collision occurred - try { - das.applyChanges(root); - fail("An OCCException should be thrown"); - } catch (OptimisticConcurrencyException ex) { - if (!ex.getMessage().equals("An update collision occurred")) { - throw ex; - } - } - } - - public void testProvidedConfig() throws SQLException { - // Create config programmatically - Config config = ConfigFactory.INSTANCE.createConfig(); - ConfigHelper helper = new ConfigHelper(config); - helper.addPrimaryKey("BOOK.BOOK_ID"); - DAS das = DAS.FACTORY.createDAS(helper.getConfig(), getConnection()); - - // Read a book instance - Command select = das.createCommand("SELECT * FROM BOOK WHERE BOOK_ID = 1"); - DataObject root = select.executeQuery(); - DataObject book = root.getDataObject("BOOK[1]"); - // Change a field to mark the instance 'dirty' - book.setInt("QUANTITY", 2); - - // Flush the change - - das.applyChanges(root); - - // Verify - root = select.executeQuery(); - book = root.getDataObject("BOOK[1]"); - assertEquals(2, book.getInt("QUANTITY")); - } -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OneToOneRelationshipTests.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OneToOneRelationshipTests.java deleted file mode 100644 index 2a58ca0fba..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OneToOneRelationshipTests.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test; - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.DAS; -import org.apache.tuscany.das.rdb.test.data.CompanyData; -import org.apache.tuscany.das.rdb.test.data.CompanyEmpData; -import org.apache.tuscany.das.rdb.test.data.EmployeeData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; - -public class OneToOneRelationshipTests extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - new CompanyData(getAutoConnection()).refresh(); - new EmployeeData(getAutoConnection()).refresh(); - new CompanyEmpData(getAutoConnection()).refresh(); - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - /** - * Read Company and traverse to EOTM - */ - public void test1() throws Exception { - - DAS das = DAS.FACTORY.createDAS(getConfig("CompanyEmployeeConfig.xml"), getConnection()); - - Command read = das.getCommand("get companies with employee of the month"); - DataObject root = read.executeQuery(); - DataObject employee = root.getDataObject("COMPANY[1]/company->employee_opposite"); - - assertEquals("Mary Smith", employee.getString("NAME")); - } - - /** - * Read Employee and traverse to Company - */ - public void test2() throws Exception { - - DAS das = DAS.FACTORY.createDAS(getConfig("CompanyEmployeeConfig.xml"), getConnection()); - - Command read = das.getCommand("get named employee with company"); - read.setParameter(1, "Mary Smith"); - DataObject root = read.executeQuery(); - DataObject company = root.getDataObject("EMPLOYEE[1]/company->employee"); - - assertEquals("ACME Publishing", company.getString("NAME")); - } - - /** - * Un-assign employee O' month - */ - public void test3() throws Exception { - - DAS das = DAS.FACTORY.createDAS(getConfig("CompanyEmployeeConfig.xml"), getConnection()); - - Command read = das.getCommand("get companies with employee of the month"); - DataObject root = read.executeQuery(); - DataObject company = root.getDataObject("COMPANY[1]"); - company.setDataObject("company->employee_opposite", null); - assertNull(company.getDataObject("company->employee_opposite")); - - //Flush changes - das.applyChanges(root); - - //Verify - root = read.executeQuery(); - company = root.getDataObject("COMPANY[1]"); - assertNull(company.getDataObject("company->employee_opposite")); - } - - /** - * Delete employee O' month - */ - public void test4() throws Exception { - - DAS das = DAS.FACTORY.createDAS(getConfig("CompanyEmployeeConfig.xml"), getConnection()); - - Command read = das.getCommand("get companies with employee of the month"); - DataObject root = read.executeQuery(); - DataObject company = root.getDataObject("COMPANY[1]"); - DataObject employee = company.getDataObject("company->employee_opposite"); - employee.delete(); - assertNull(company.getDataObject("company->employee_opposite")); - - //Flush changes - das.applyChanges(root); - - //Verify - root = read.executeQuery(); - company = root.getDataObject("COMPANY[1]"); - assertNull(company.getDataObject("company->employee_opposite")); - } - - /** - * Add new employee O' month - */ - public void test5() throws Exception { - - DAS das = DAS.FACTORY.createDAS(getConfig("CompanyEmployeeConfig.xml"), getConnection()); - - Command read = das.getCommand("get companies with employee of the month"); - DataObject root = read.executeQuery(); - DataObject company = root.getDataObject("COMPANY[1]"); - - //Create a new employee - DataObject employee = root.createDataObject("EMPLOYEE"); - employee.setString("NAME", "Joe Hotshot"); - - //Assigne a EOTM - //Strangely this statement results in "Could not find relationships" error - //although "company.setDataObject("company->employee_opposite", null);" dos not - company.setDataObject("company->employee_opposite", employee); - - //Flush changes - das.applyChanges(root); - - //Verify - root = read.executeQuery(); - - employee = root.getDataObject("COMPANY[1]/company->employee_opposite"); - - assertEquals("Joe Hotshot", employee.getString("NAME")); - - } - - public void testRestrictedOneToOneRelationship() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("OneToOneRestrictedConfig.xml"), getConnection()); - - Command read = das.getCommand("get named employee with company"); - read.setParameter(1, "Mary Smith"); - DataObject root = read.executeQuery(); - DataObject mary = root.getDataObject("EMPLOYEE[1]"); - DataObject company = mary.getDataObject("company"); - - DataObject bob = root.createDataObject("EMPLOYEE"); - bob.setString("NAME", "bob"); - bob.setString("SN", "E0005"); - bob.setInt("MANAGER", 0); - - bob.setDataObject("company", company); - - try { - das.applyChanges(root); - fail("Relationship modification should not be allowed."); - } catch (RuntimeException ex) { - assertEquals("Can not modify a one to one relationship that is key restricted", ex.getMessage()); - } - assertEquals("ACME Publishing", company.getString("NAME")); - - } -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OperationOrderingTests.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OperationOrderingTests.java deleted file mode 100644 index ccfae70bd5..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OperationOrderingTests.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.DAS; -import org.apache.tuscany.das.rdb.test.data.CityData; -import org.apache.tuscany.das.rdb.test.data.StateData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; - -public class OperationOrderingTests extends DasTest { - - public OperationOrderingTests() { - super(); - } - - protected void setUp() throws Exception { - super.setUp(); - - CityData city = new CityData(getAutoConnection()); - StateData state = new StateData(getAutoConnection()); - - city.doDeletes(); - state.doDeletes(); - state.doInserts(); - city.doInserts(); - - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - public void testInsert() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("cityStates.xml"), getConnection()); - Command select = das.createCommand("Select * from STATES inner join CITIES on STATES.ID = CITIES.STATE_ID"); - DataObject root = select.executeQuery(); - - int numberOfStates = root.getList("STATES").size(); - int numberOfCities = root.getList("CITIES").size(); - - DataObject atlanta = root.createDataObject("CITIES"); - atlanta.setString("NAME", "Atlanta"); - atlanta.setInt("ID", 6); - - // Create a new Company - DataObject georgia = root.createDataObject("STATES"); - georgia.setInt("ID", 4); - georgia.setString("NAME", "GA"); - - georgia.getList("cities").add(atlanta); - - das.applyChanges(root); - - root = select.executeQuery(); - assertEquals(numberOfCities + 1, root.getList("CITIES").size()); - assertEquals(numberOfStates + 1, root.getList("STATES").size()); - } - - public void testDeletes() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("cityStates.xml"), getConnection()); - Command select = das.createCommand("Select * from STATES inner join CITIES on STATES.ID = CITIES.STATE_ID"); - DataObject root = select.executeQuery(); - - DataObject firstState = root.getDataObject("STATES[1]"); - String stateName = firstState.getString("NAME"); - - List cityNames = new ArrayList(); - Iterator i = firstState.getList("cities").iterator(); - while (i.hasNext()) { - DataObject firstCity = (DataObject) i.next(); - cityNames.add(firstCity.getString("NAME")); - firstCity.delete(); - } - firstState.delete(); - - das.applyChanges(root); - - root = select.executeQuery(); - - Iterator iter = root.getList("STATES").iterator(); - while (iter.hasNext()) { - DataObject state = (DataObject) iter.next(); - assertFalse(state.getString("NAME").equals(stateName)); - } - - iter = root.getList("CITIES").iterator(); - while (iter.hasNext()) { - DataObject city = (DataObject) iter.next(); - assertFalse(cityNames.contains(city.getString("NAME"))); - } - - } -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/Paging.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/Paging.java deleted file mode 100644 index 859cc085f6..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/Paging.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test; - -import java.sql.SQLException; - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.DAS; -import org.apache.tuscany.das.rdb.Pager; -import org.apache.tuscany.das.rdb.impl.PagerImpl; -import org.apache.tuscany.das.rdb.test.data.CustomerData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; - -public class Paging extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - new CustomerData(getAutoConnection()).refresh(); - } - - public void testPaging() throws SQLException { - DAS das = DAS.FACTORY.createDAS(getConnection()); - // Build command to read all customers - Command custCommand = das.createCommand("select * from CUSTOMER order by ID"); - - // Create a pager with the command - Pager pager = new PagerImpl(custCommand, 2); - - // Get and work with first page - DataObject root = pager.next(); - DataObject customer1 = root.getDataObject("CUSTOMER[1]"); - DataObject customer2 = root.getDataObject("CUSTOMER[2]"); - assertEquals(1, customer1.getInt("ID")); - assertEquals(2, customer2.getInt("ID")); - - // Get and work with the second page - root = pager.next(); - customer1 = root.getDataObject("CUSTOMER[1]"); - customer2 = root.getDataObject("CUSTOMER[2]"); - assertEquals(3, customer1.getInt("ID")); - assertEquals(4, customer2.getInt("ID")); - - // First page again - root = pager.previous(); - customer1 = root.getDataObject("CUSTOMER[1]"); - customer2 = root.getDataObject("CUSTOMER[2]"); - assertEquals(1, customer1.getInt("ID")); - assertEquals(2, customer2.getInt("ID")); - - } - - public void testRandomPage() throws SQLException { - DAS das = DAS.FACTORY.createDAS(getConnection()); - // Build the select command - Command select = das.createCommand("select * from CUSTOMER order by ID"); - - // Create a pager - Pager pager = new PagerImpl(select, 2); - - // Get the first page - DataObject root = pager.getPage(1); - DataObject customer1 = root.getDataObject("CUSTOMER[1]"); - DataObject customer2 = root.getDataObject("CUSTOMER[2]"); - assertEquals(1, customer1.getInt("ID")); - assertEquals(2, customer2.getInt("ID")); - - // Get the second page - root = pager.getPage(2); - customer1 = root.getDataObject("CUSTOMER[1]"); - customer2 = root.getDataObject("CUSTOMER[2]"); - assertEquals(3, customer1.getInt("ID")); - assertEquals(4, customer2.getInt("ID")); - - // Get the first page again - root = pager.getPage(1); - customer1 = root.getDataObject("CUSTOMER[1]"); - customer2 = root.getDataObject("CUSTOMER[2]"); - assertEquals(1, customer1.getInt("ID")); - assertEquals(2, customer2.getInt("ID")); - } - - -/* public void testLightPager() throws SQLException { - - - // Build the command to page with - DAS das = DAS.FACTORY.createDAS(getConnection()); - Command select = das.createCommand("select * from CUSTOMER order by ID"); - - //Create the light Pager instance - Pager lp = Pager.FACTORY.createLightPager(2); - - // Get the first page - DataObject root = pager.getPage(1); - DataObject customer1 = root.getDataObject("CUSTOMER[1]"); - DataObject customer2 = root.getDataObject("CUSTOMER[2]"); - assertEquals(1, customer1.getInt("ID")); - assertEquals(2, customer2.getInt("ID")); - - // Get the second page - root = pager.getPage(2); - customer1 = root.getDataObject("CUSTOMER[1]"); - customer2 = root.getDataObject("CUSTOMER[2]"); - assertEquals(3, customer1.getInt("ID")); - assertEquals(4, customer2.getInt("ID")); - - // Get the first page again - root = pager.getPage(1); - customer1 = root.getDataObject("CUSTOMER[1]"); - customer2 = root.getDataObject("CUSTOMER[2]"); - assertEquals(1, customer1.getInt("ID")); - assertEquals(2, customer2.getInt("ID")); - }*/ - - -} \ No newline at end of file diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/PartialUpdateTests.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/PartialUpdateTests.java deleted file mode 100644 index f918309c55..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/PartialUpdateTests.java +++ /dev/null @@ -1,267 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test; - -import java.sql.SQLException; - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.DAS; -import org.apache.tuscany.das.rdb.test.data.CustomerData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; - -public class PartialUpdateTests extends DasTest { - - public PartialUpdateTests() { - super(); - } - - protected void setUp() throws Exception { - super.setUp(); - new CustomerData(getAutoConnection()).refresh(); - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - /** - * Update with one changed property - */ - public void testPartialUpdateSingleProperty() throws SQLException { - DAS das = DAS.FACTORY.createDAS(getConnection()); - Command readCustomers = das.createCommand("select * from CUSTOMER where ID = 1"); - - // Read - DataObject root = readCustomers.executeQuery(); - - DataObject customer = root.getDataObject("CUSTOMER[1]"); - // Verify - assertEquals(1, customer.getInt("ID")); - - Command update = das.createCommand("update CUSTOMER set LASTNAME = 'modified' where ID = 1"); - update.execute(); - - customer.setString("ADDRESS", "main street"); - - das.applyChanges(root); - - root = readCustomers.executeQuery(); - - // If partial update was not used, LASTNAME would not be 'modified' - customer = root.getDataObject("CUSTOMER[1]"); - assertEquals(1, customer.getInt("ID")); - assertEquals("modified", customer.getString("LASTNAME")); - assertEquals("main street", customer.getString("ADDRESS")); - } - - /** - * Update with all changed properties - */ - public void testPartialUpdateAllProperties() throws SQLException { - DAS das = DAS.FACTORY.createDAS(getConnection()); - Command readCustomers = das.createCommand("select * from CUSTOMER where ID = 1"); - - // Read - DataObject root = readCustomers.executeQuery(); - - DataObject customer = root.getDataObject("CUSTOMER[1]"); - // Verify - assertEquals(1, customer.getInt("ID")); - - customer.setString("LASTNAME", "lastname modified"); - customer.setString("ADDRESS", "address modified"); - - das.applyChanges(root); - - root = readCustomers.executeQuery(); - - // If partial update was not used, LASTNAME would not be 'modified' - customer = root.getDataObject("CUSTOMER[1]"); - assertEquals(1, customer.getInt("ID")); - assertEquals("lastname modified", customer.getString("LASTNAME")); - assertEquals("address modified", customer.getString("ADDRESS")); - } - - /** - * Insert with no changed properties and no generated ID - * Read graph. Add new DO and apply without seting any attributes. - * - */ -// public void testPartialReadInsertApply() throws Exception { -// -// DAS das = DAS.FACTORY.createDAS(getConnection()); -// // Read some customers -// Command select = das.createCommand("Select * from CUSTOMER"); -// DataObject root = select.executeQuery(); -// -// //Remember count -// int count = root.getList("CUSTOMER").size(); -// -// // Create a new customer -// root.createDataObject("CUSTOMER"); -// -// // Build apply changes command -// das.applyChanges(root); -// -// // verify insert -// root = select.executeQuery(); -// assertEquals(count + 1, root.getList("CUSTOMER").size()); -// -// } - - /** - * Insert with no changed properties to row with generated ID - * Read graph. Add new DO and apply without seting any attributes. - */ - public void testPartialInsertWithGeneratedID() throws Exception { - - DAS das = DAS.FACTORY.createDAS(getConfig("CompanyConfig.xml"),getConnection()); - // Read some companies - Command select = das.createCommand("Select * from COMPANY"); - DataObject root = select.executeQuery(); - - //Remember count - int count = root.getList("COMPANY").size(); - - // Create a new company - root.createDataObject("COMPANY"); - - // Build apply changes command - das.applyChanges(root); - - // verify insert - root = select.executeQuery(); - assertEquals(count + 1, root.getList("COMPANY").size()); - - } - - /** - * Insert with 1 changed property that is not the ID - * @throws SQLException - */ - public void testPartialInsertWithSinglePropertyChange() throws Exception { - - DAS das = DAS.FACTORY.createDAS(getConfig("CompanyConfig.xml"),getConnection()); - // Read some company - Command select = das.createCommand("Select * from COMPANY"); - DataObject root = select.executeQuery(); - - //Remember count - int count = root.getList("COMPANY").size(); - - // Create a new company - DataObject company = root.createDataObject("COMPANY"); - company.setString("NAME", "New company name"); - - // Build apply changes command - das.applyChanges(root); - - // verify insert - root = select.executeQuery(); - assertEquals(count + 1, root.getList("COMPANY").size()); - } - - /** - * Insert with 1 changed property that is the ID - * @throws SQLException - */ - public void testPartialInsertWithIdChange() throws SQLException { - DAS das = DAS.FACTORY.createDAS(getConnection()); - Command readCustomers = das.createCommand("select * from CUSTOMER"); - - // Read - DataObject root = readCustomers.executeQuery(); - - // Create a new customer - DataObject newCust = root.createDataObject("CUSTOMER"); - newCust.set("ID", new Integer(200)); - // Purposely do not set lastname to let it default to 'Garfugengheist' - // newCust.set("LASTNAME", "Gerkin" ); - - das.applyChanges(root); - - Command readNewCust = das.createCommand("select * from CUSTOMER where ID = 200"); - root = readNewCust.executeQuery(); - - // If partial insert was not used, LASTNAME would not be - // 'Garfugengheist' - newCust = root.getDataObject("CUSTOMER[1]"); - assertEquals(200, newCust.getInt("ID")); - assertEquals("Garfugengheist", newCust.getString("LASTNAME")); - assertNull(newCust.getString("ADDRESS")); - - } - - public void testPartialInsertWithAllPropertyChange() throws SQLException { - DAS das = DAS.FACTORY.createDAS(getConnection()); - Command readCustomers = das.createCommand("select * from CUSTOMER"); - - // Read - DataObject root = readCustomers.executeQuery(); - - // Create a new customer - DataObject newCust = root.createDataObject("CUSTOMER"); - newCust.set("ID", new Integer(300)); - newCust.set("ADDRESS", "5528 Wells Fargo Drive"); - newCust.set("LASTNAME", "Gerkin" ); - - das.applyChanges(root); - - Command readNewCust = das.createCommand("select * from CUSTOMER where ID = 300"); - root = readNewCust.executeQuery(); - - newCust = root.getDataObject("CUSTOMER[1]"); - assertEquals(300, newCust.getInt("ID")); - assertEquals("Gerkin", newCust.getString("LASTNAME")); - assertEquals("5528 Wells Fargo Drive", newCust.getString("ADDRESS")); - - } - - public void testPartialInsert() throws SQLException { - DAS das = DAS.FACTORY.createDAS(getConnection()); - Command readCustomers = das.createCommand("select * from CUSTOMER"); - - // Read - DataObject root = readCustomers.executeQuery(); - - // Create a new customer - DataObject newCust = root.createDataObject("CUSTOMER"); - newCust.set("ID", new Integer(100)); - newCust.set("ADDRESS", "5528 Wells Fargo Drive"); - // Purposely do not set lastname to let it default to 'Garfugengheist' - // newCust.set("LASTNAME", "Gerkin" ); - - das.applyChanges(root); - - Command readNewCust = das.createCommand("select * from CUSTOMER where ID = 100"); - root = readNewCust.executeQuery(); - - // If partial insert was not used, LASTNAME would not be - // 'Garfugengheist' - newCust = root.getDataObject("CUSTOMER[1]"); - assertEquals(100, newCust.getInt("ID")); - assertEquals("Garfugengheist", newCust.getString("LASTNAME")); - assertEquals("5528 Wells Fargo Drive", newCust.getString("ADDRESS")); - - } - - -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/PassiveConnectionTests.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/PassiveConnectionTests.java deleted file mode 100644 index 270f46ddd8..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/PassiveConnectionTests.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test; - -/* - * Test capability to participate in an extenrlly managed transaction. - * The client is managing the transaction boundary so the DAS will not issue - * commit/rollback - * - */ - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.DAS; -import org.apache.tuscany.das.rdb.test.data.CustomerData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; - -public class PassiveConnectionTests extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - new CustomerData(getAutoConnection()).refresh(); - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - /** - * Read and modify a customer. Uses a "passive" connection - */ - public void testReadModifyApply() throws Exception { - - // Create and initialize a DAS connection and initialize for externally - // managed transaction boundaries - java.sql.Connection c = getConnection(); - - DAS das = DAS.FACTORY.createDAS(getConfig("passiveConnection.xml"), c); - // Read customer 1 - Command select = das.getCommand("get a customer"); - DataObject root = select.executeQuery(); - - DataObject customer = (DataObject) root.get("CUSTOMER[1]"); - - String lastName = customer.getString("LASTNAME"); - - // Modify customer - customer.set("LASTNAME", "Pavick"); - - try { - das.applyChanges(root); - - throw new Exception("Test Exception"); - - // Since the DAS is not managing tx boundaries, I must - } catch (Exception e) { - // assert here to make sure we didn't run into some hidden error - assertEquals("Test Exception", e.getMessage()); - // Roll back the transaction - c.rollback(); - } - - // Verify that the changes did not go through - root = select.executeQuery(); - assertEquals(lastName, root.getString("CUSTOMER[1]/LASTNAME")); - - // Try again - customer = (DataObject) root.get("CUSTOMER[1]"); - customer.set("LASTNAME", "Pavick"); - das.applyChanges(root); - c.commit(); - - root = select.executeQuery(); - assertEquals("Pavick", root.getString("CUSTOMER[1]/LASTNAME")); - } - -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ProgrammaticConfigTests.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ProgrammaticConfigTests.java deleted file mode 100644 index 66f8649039..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ProgrammaticConfigTests.java +++ /dev/null @@ -1,387 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test; - -import java.sql.SQLException; -import java.util.List; - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.ConfigHelper; -import org.apache.tuscany.das.rdb.DAS; -import org.apache.tuscany.das.rdb.config.Config; -import org.apache.tuscany.das.rdb.config.ConnectionInfo; -import org.apache.tuscany.das.rdb.config.Table; -import org.apache.tuscany.das.rdb.test.data.BookData; -import org.apache.tuscany.das.rdb.test.data.CustomerData; -import org.apache.tuscany.das.rdb.test.data.OrderData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; -import org.apache.tuscany.das.rdb.util.ConfigUtil; - -import commonj.sdo.DataObject; - -/** - * Tests the Converter framwork - */ -public class ProgrammaticConfigTests extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - new BookData(getAutoConnection()).refresh(); - new CustomerData(getAutoConnection()).refresh(); - new OrderData(getAutoConnection()).refresh(); - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - /** - * Simple read with command created programaticaly using the ConfigHelper. - */ - public void test0() throws Exception { - String commandName = "select book by id"; - String commandSQL = "SELECT * FROM BOOK WHERE BOOK_ID =?"; - // Create config programmatically - ConfigHelper helper = new ConfigHelper(); - helper.addSelectCommand( commandName, commandSQL ); - helper.addPrimaryKey("BOOK.BOOK_ID"); - DAS das = DAS.FACTORY.createDAS(helper.getConfig(), getConnection()); - - // Read a book instance - Command select = das.getCommand("select book by id"); - select.setParameter(1, new Integer(1)); - DataObject root = select.executeQuery(); - DataObject book = root.getDataObject("BOOK[1]"); - // Change a field to mark the instance 'dirty' - book.setInt("QUANTITY", 2); - - // Flush the change - - das.applyChanges(root); - - // Verify - root = select.executeQuery(); - book = root.getDataObject("BOOK[1]"); - assertEquals(2, book.getInt("QUANTITY")); - } - - /** - * Simple read followed by a write. This should fail since there is no - * config associaed with the applychanges command - */ - public void test1() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConnection()); - // Read a book instance - Command select = das.createCommand("SELECT * FROM BOOK WHERE BOOK_ID = 1"); - DataObject root = select.executeQuery(); - - DataObject book = root.getDataObject("BOOK[1]"); - // Change a field to mark the instance 'dirty' - book.setInt("QUANTITY", 2); - - try { - das.applyChanges(root); - fail("An exception should be thrown since here is no config to identify the primary key"); - } catch (RuntimeException ex) { - // Expected - } - } - - /** - * Simple read followed by a write. Config instance is generated - * programmatically using the ConfigHelper. - */ - public void test2() throws Exception { - // Create config programmatically - ConfigHelper helper = new ConfigHelper(); - helper.addPrimaryKey("BOOK.BOOK_ID"); - DAS das = DAS.FACTORY.createDAS(helper.getConfig(), getConnection()); - - // Read a book instance - Command select = das.createCommand("SELECT * FROM BOOK WHERE BOOK_ID = 1"); - DataObject root = select.executeQuery(); - DataObject book = root.getDataObject("BOOK[1]"); - // Change a field to mark the instance 'dirty' - book.setInt("QUANTITY", 2); - - // Flush the change - - das.applyChanges(root); - - // Verify - root = select.executeQuery(); - book = root.getDataObject("BOOK[1]"); - assertEquals(2, book.getInt("QUANTITY")); - } - - /** - * Test ability to read a compound graph (Read with Relationship) - */ - public void test3() throws Exception { - - String statement = "SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON CUSTOMER.ID = ANORDER.CUSTOMER_ID WHERE CUSTOMER.ID = 1"; - - // Read some customers and related orders - // Create relationship config programmatically - ConfigHelper helper = new ConfigHelper(); - helper.addRelationship("CUSTOMER.ID", "ANORDER.CUSTOMER_ID"); - DAS das = DAS.FACTORY.createDAS(helper.getConfig(), getConnection()); - Command select = das.createCommand(statement); - - DataObject root = select.executeQuery(); - DataObject customer = root.getDataObject("CUSTOMER[1]"); - - assertEquals(2, customer.getList("ANORDER").size()); - - } - - /** - * Programatically create table config with "property" name - */ - public void test4() throws Exception { - - String statement = "SELECT * FROM BOOK WHERE BOOK.BOOK_ID = ?"; - - // Create Table config programmatically - ConfigHelper helper = new ConfigHelper(); - helper.addTable("BOOK", "Book"); - helper.addPrimaryKey("Book.BOOK_ID"); - - DAS das = DAS.FACTORY.createDAS(helper.getConfig(), getConnection()); - Command select = das.createCommand(statement); - select.setParameter(1, new Integer(1)); - - DataObject root = select.executeQuery(); - - DataObject newBook = root.createDataObject("Book"); - newBook.setString("NAME", "Ant Colonies of the Old World"); - newBook.setInt("BOOK_ID", 1001); - root.getList("Book").add(newBook); - - das.applyChanges(root); - - //Verify - select.setParameter(1, new Integer(1001)); - root = select.executeQuery(); - assertEquals("Ant Colonies of the Old World", root.getString("Book[1]/NAME")); - - } - - /** - * - */ - public void testAddColumnWithPropertyName() throws SQLException { - String statement = "SELECT * FROM BOOK WHERE BOOK.BOOK_ID = ?"; - - // Create Table config programmatically - ConfigHelper helper = new ConfigHelper(); - Table table = helper.addTable("BOOK", "Book"); - helper.addPrimaryKey("Book.BOOK_ID"); - helper.addColumn(table, "NAME", "bookName"); - DAS das = DAS.FACTORY.createDAS(helper.getConfig(), getConnection()); - Command select = das.createCommand(statement); - select.setParameter(1, new Integer(1)); - - DataObject root = select.executeQuery(); - - DataObject newBook = root.createDataObject("Book"); - newBook.setString("bookName", "Ant Colonies of the Old World"); - newBook.setInt("BOOK_ID", 1001); - root.getList("Book").add(newBook); - - das.applyChanges(root); - - //Verify - select.setParameter(1, new Integer(1001)); - root = select.executeQuery(); - assertEquals("Ant Colonies of the Old World", root.getString("Book[1]/bookName")); - } - /** - * Simple unit test for ConnectionInfo - * @throws Exception - */ - public void testConnectionInfo() throws Exception { - ConfigHelper helper = new ConfigHelper(); - helper.addConnectionInfo("jdbc/adatasource"); - - Config config = helper.getConfig(); - ConnectionInfo info = config.getConnectionInfo(); - assertEquals(info.getDataSource(), "jdbc/adatasource"); - assertEquals(info.isManagedtx(), true); - } - - /** - * Simple unit test for ConnectionInfo - * @throws Exception - */ - public void testConnectionInfo2() throws Exception { - ConfigHelper helper = new ConfigHelper(); - helper.addConnectionInfo("jdbc/adatasource", false); - - Config config = helper.getConfig(); - ConnectionInfo info = config.getConnectionInfo(); - assertEquals(info.getDataSource(), "jdbc/adatasource"); - assertEquals(info.isManagedtx(), false); - } - - /** - * Simple unit test for ConnectionInfo using DriverManager - * @throws Exception - */ - public void testConnectionInfoDriverManager() throws Exception { - ConfigHelper helper = new ConfigHelper(); - helper.addConnectionInfo("org.apache.derby.jdbc.EmbeddedDriver","jdbc:derby:target/dastest", "user", "password", 600); - - Config config = helper.getConfig(); - ConnectionInfo info = config.getConnectionInfo(); - assertNull(info.getDataSource()); - assertEquals(info.getConnectionProperties().getDriverClass(), "org.apache.derby.jdbc.EmbeddedDriver"); - assertEquals(info.getConnectionProperties().getDatabaseURL(), "jdbc:derby:target/dastest"); - assertEquals(info.getConnectionProperties().getUserName(), "user"); - assertEquals(info.getConnectionProperties().getPassword(), "password"); - assertEquals(info.getConnectionProperties().getLoginTimeout(), 600); - } - - /** - * Simple unit test for adding a select command - * @throws Exception - */ - public void testAddSelectCommand() throws Exception { - ConfigHelper helper = new ConfigHelper(); - helper.addSelectCommand("get all customers", "select * from customers"); - - Config config = helper.getConfig(); - List commands = config.getCommand(); - assertEquals(1, commands.size()); - org.apache.tuscany.das.rdb.config.Command cmd = (org.apache.tuscany.das.rdb.config.Command) commands.get(0); - assertEquals("select", cmd.getKind()); - assertEquals("get all customers", cmd.getName()); - assertEquals("select * from customers", cmd.getSQL()); - } - - - /** - * Simple unit test for adding an update command - * @throws Exception - */ - public void testAddUpdateCommand() throws Exception { - ConfigHelper helper = new ConfigHelper(); - helper.addUpdateCommand("update a customer", "update customers set name = ? where id = ?"); - - Config config = helper.getConfig(); - List commands = config.getCommand(); - assertEquals(1, commands.size()); - org.apache.tuscany.das.rdb.config.Command cmd = (org.apache.tuscany.das.rdb.config.Command) commands.get(0); - assertEquals("update", cmd.getKind()); - assertEquals("update a customer", cmd.getName()); - assertEquals("update customers set name = ? where id = ?", cmd.getSQL()); - } - - /** - * Simple unit test for adding an insert command - * @throws Exception - */ - public void testAddInsertCommand() throws Exception { - ConfigHelper helper = new ConfigHelper(); - helper.addInsertCommand("insert customer", "insert into customers(ID,NAME) values (?,?)"); - - Config config = helper.getConfig(); - List commands = config.getCommand(); - assertEquals(1, commands.size()); - org.apache.tuscany.das.rdb.config.Command cmd = (org.apache.tuscany.das.rdb.config.Command) commands.get(0); - assertEquals("insert", cmd.getKind()); - assertEquals("insert customer", cmd.getName()); - assertEquals("insert into customers(ID,NAME) values (?,?)", cmd.getSQL()); - } - - /** - * Simple unit test for adding a delete command - * @throws Exception - */ - public void testAddDeleteCommand() throws Exception { - ConfigHelper helper = new ConfigHelper(); - helper.addDeleteCommand("delete customer", "delete from customers where id = ?"); - - Config config = helper.getConfig(); - List commands = config.getCommand(); - assertEquals(1, commands.size()); - org.apache.tuscany.das.rdb.config.Command cmd = (org.apache.tuscany.das.rdb.config.Command) commands.get(0); - assertEquals("delete", cmd.getKind()); - assertEquals("delete customer", cmd.getName()); - assertEquals("delete from customers where id = ?", cmd.getSQL()); - } - - /** - * Simple unit test for DataObjectModel - * @throws Exception - */ - public void testDataObjectModel() throws Exception { - ConfigHelper helper = new ConfigHelper(); - helper.setDataObjectModel("org.apache.tuscany/mytypes"); - - Config config = helper.getConfig(); - assertEquals("org.apache.tuscany/mytypes", config.getDataObjectModel()); - - } - - /** - * Simple unit test for adding a Delete statement to a Table - * @throws Exception - */ - public void testAddDeleteStatement() throws Exception { - ConfigHelper helper = new ConfigHelper(); - Table table = helper.addTable("widgets", "WIDGETS"); - helper.addDeleteStatement(table, "delete from widgets where id = ?", "ID"); - - Config cfg = helper.getConfig(); - assertEquals(1, cfg.getTable().size()); - Table widgets = (Table) cfg.getTable().get(0); - assertEquals("delete from widgets where id = ?", widgets.getDelete().getSql()); - assertEquals("WIDGETS", widgets.getTypeName()); - assertEquals("ID", ConfigUtil.getParameters(widgets.getDelete())); - - } - - /** - * Simple unit test for adding a Create statement to a Table - * @throws Exception - */ - public void testAddCreateStatement() throws Exception { - ConfigHelper helper = new ConfigHelper(); - Table table = helper.addTable("widgets", "WIDGETS"); - helper.addCreateStatement(table, "insert into widgets values (?,?)", "ID NAME"); - - Config cfg = helper.getConfig(); - assertEquals(1, cfg.getTable().size()); - Table widgets = (Table) cfg.getTable().get(0); - assertEquals("insert into widgets values (?,?)", widgets.getCreate().getSql()); - assertEquals("WIDGETS", widgets.getTypeName()); - assertEquals("ID NAME", ConfigUtil.getParameters(widgets.getCreate())); - - } - - public void testAddInvalidPrimaryKey() throws Exception { - ConfigHelper helper = new ConfigHelper(); - try { - helper.addPrimaryKey("PK"); - } catch (RuntimeException ex) { - this.assertEquals ("Column PK must be qualified with a table name and optional schema name", ex.getMessage()); - } - } -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ReadDBSchemaTests.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ReadDBSchemaTests.java deleted file mode 100644 index 6fb52ad17d..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ReadDBSchemaTests.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test; - -/* - * Test the ability to query Database schema(metadata) information using regular DAS APIs This is speciic to DB2 - * - */ - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.DAS; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; - -public class ReadDBSchemaTests extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - public void testReadTableInfo() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConnection()); - Command select = das.createCommand("SELECT * from SYSIBM.SYSTABLES WHERE TYPE = 'T'"); - DataObject root = select.executeQuery(); - - DataObject table = (DataObject) root.get("SYSTABLES[1]"); - - assertEquals('T', table.getChar("TYPE")); - - } - - //Utilities - -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/RecursiveTests.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/RecursiveTests.java deleted file mode 100644 index 4af085a6a5..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/RecursiveTests.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test; - -import java.util.Iterator; - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.DAS; -import org.apache.tuscany.das.rdb.test.data.PartData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; - -public class RecursiveTests extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - new PartData(getAutoConnection()).refresh(); - } - - public void testReadEngineParts() throws Exception { - - DAS das = DAS.FACTORY.createDAS(getConfig("PartsConfig.xml"), getConnection()); - // Table definition - // CREATE TABLE PART (ID INT PRIMARY KEY NOT NULL, NAME VARCHAR(50), QUANTITY INT, PARENT_ID INT ); - - Command select = das.getCommand("readEngineParts"); - - // Need to set the key explicitly. The aggregate of columns not working - // because of null values - DataObject root = select.executeQuery(); - - assertEquals(5, root.getList("PART").size()); - // printList(root.getList("PART")); - DataObject engine = root.getDataObject("PART.0"); - assertEquals("Engine", engine.getString("NAME")); - - assertEquals(3, engine.getList("subparts").size()); - - DataObject piston = null; - Iterator i = engine.getList("subparts").iterator(); - while (i.hasNext()) { - DataObject obj = (DataObject) i.next(); - if (obj.getString("NAME").equals("Piston")) { - piston = obj; - } - } - - assertEquals("Piston", piston.getString("NAME")); - assertEquals(1, piston.getList("subparts").size()); - assertEquals("Piston Ring", piston.getDataObject("subparts.0").getString("NAME")); - - } - -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/RelationshipTests.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/RelationshipTests.java deleted file mode 100644 index b44630e3f2..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/RelationshipTests.java +++ /dev/null @@ -1,241 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test; - -/* - * - * - */ - -import java.sql.SQLException; - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.ConfigHelper; -import org.apache.tuscany.das.rdb.DAS; -import org.apache.tuscany.das.rdb.config.Relationship; -import org.apache.tuscany.das.rdb.test.data.CompanyData; -import org.apache.tuscany.das.rdb.test.data.CompanyEmpData; -import org.apache.tuscany.das.rdb.test.data.CustomerData; -import org.apache.tuscany.das.rdb.test.data.DepEmpData; -import org.apache.tuscany.das.rdb.test.data.DepartmentData; -import org.apache.tuscany.das.rdb.test.data.EmployeeData; -import org.apache.tuscany.das.rdb.test.data.OrderData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; - -public class RelationshipTests extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - - new CustomerData(getAutoConnection()).refresh(); - new OrderData(getAutoConnection()).refresh(); - - new CompanyData(getAutoConnection()).refresh(); - new EmployeeData(getAutoConnection()).refresh(); - new DepartmentData(getAutoConnection()).refresh(); - new CompanyEmpData(getAutoConnection()).refresh(); - new DepEmpData(getAutoConnection()).refresh(); - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - /** - * Test ability to read a compound graph - */ - public void testRead() throws Exception { - - String statement = "SELECT * FROM CUSTOMER LEFT JOIN ANORDER " - + "ON CUSTOMER.ID = ANORDER.CUSTOMER_ID WHERE CUSTOMER.ID = 1"; - - DAS das = DAS.FACTORY.createDAS(getConfig("customerOrderRelationshipMapping.xml"), getConnection()); - // Read some customers and related orders - Command select = das.createCommand(statement); - - DataObject root = select.executeQuery(); - DataObject customer = root.getDataObject("CUSTOMER[1]"); - - assertEquals(2, customer.getList("orders").size()); - - } - - /** - * Same as above except uses xml file for relationhip and key information. - * Employs CUD generation. - */ - public void testRelationshipModification2() throws Exception { - - DAS das = DAS.FACTORY.createDAS(getConfig("basicCustomerOrderMapping.xml"), getConnection()); - // Read some customers and related orders - Command select = das - .createCommand("SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON CUSTOMER.ID = ANORDER.CUSTOMER_ID"); - - DataObject root = select.executeQuery(); - - DataObject cust1 = root.getDataObject("CUSTOMER[1]"); - DataObject cust2 = root.getDataObject("CUSTOMER[2]"); - - // Save IDs - Integer cust1ID = (Integer) cust1.get("ID"); - Integer cust2ID = (Integer) cust2.get("ID"); - // save order count - Integer cust1OrderCount = new Integer(cust1.getList("orders").size()); - Integer cust2OrderCount = new Integer(cust2.getList("orders").size()); - - // Move an order to cust1 from cust2 - DataObject order = (DataObject) cust2.getList("orders").get(0); - cust1.getList("orders").add(order); - - // Flush changes - das.applyChanges(root); - - // verify cust1 relationship updates - select = das - .createCommand("SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON " - + "CUSTOMER.ID = ANORDER.CUSTOMER_ID where CUSTOMER.ID = ?"); - select.setParameter(1, cust1ID); - - root = select.executeQuery(); - assertEquals(cust1OrderCount.intValue() + 1, root.getList("CUSTOMER[1]/orders").size()); - - // verify cust2 relationship updates - select.setParameter(1, cust2ID); - root = select.executeQuery(); - assertEquals(cust2OrderCount.intValue() - 1, root.getList("CUSTOMER[1]/orders").size()); - - } - - /** - * This scenario uses union to simmulate full outer join - * The resulted graph will have departments without employees, and employees without departments - * And this testcase will modify the relationship between these entities and assign the employees to the department - * - * @throws Exception - */ - public void testSimulateFullOuterJoinRelationshipModification() throws Exception { - - DAS das = DAS.FACTORY.createDAS(getConfig("companyMappingWithResultDescriptor.xml"), getConnection()); - // Read some customers and related orders - - Command select = das.getCommand("testFullOuterJoinRelationship"); - DataObject root = select.executeQuery(); - - DataObject department = root.getDataObject("DEPARTMENT[NAME='New Technologies']"); //department with no employees - - DataObject emp1 = root.getDataObject("EMPLOYEE[NAME='Mary Smith']"); //employee not assgned to department - DataObject emp2 = root.getDataObject("EMPLOYEE[NAME='John Smith']"); //employee not assgned to department - - department.getList("employees").add(emp1); - department.getList("employees").add(emp2); - - das.applyChanges(root); - - //verify cust1 relationship updates - select = das.getCommand("testEmployeesFromDepartment"); - select.setParameter(1, "New Technologies" ); - - root = select.executeQuery(); - assertEquals(2, root.getDataObject("DEPARTMENT[NAME='New Technologies']").getList("employees").size()); - - - - } - - public void testFKBehavior() throws SQLException { - - DAS das = DAS.FACTORY.createDAS(getConfig("basicCustomerOrderMapping.xml"), getConnection()); - // Read some customers and related orders - Command select = das - .createCommand("SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON CUSTOMER.ID = ANORDER.CUSTOMER_ID"); - - DataObject root = select.executeQuery(); - - DataObject cust1 = root.getDataObject("CUSTOMER[1]"); - DataObject cust2 = root.getDataObject("CUSTOMER[2]"); - - // Save IDs - Integer cust1ID = (Integer) cust1.get("ID"); - - // Move an order to cust1 from cust2 - DataObject order = (DataObject) cust2.getList("orders").get(0); - cust1.getList("orders").add(order); - order.setInt("CUSTOMER_ID", cust1ID.intValue()); - - try { - das.applyChanges(root); - fail("An exception should be thrown"); - } catch (RuntimeException ex) { - assertEquals("Foreign key properties should not be set when the corresponding relationship has changed", ex.getMessage()); - } - - } - - public void testFKBehavior2() throws SQLException { - DAS das = DAS.FACTORY.createDAS(getConfig("basicCustomerOrderMapping.xml"), getConnection()); - // Read some customers and related orders - Command select = das - .createCommand("SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON CUSTOMER.ID = ANORDER.CUSTOMER_ID"); - - DataObject root = select.executeQuery(); - - DataObject cust1 = root.getDataObject("CUSTOMER[1]"); - - // Save IDs - Integer cust1ID = (Integer) cust1.get("ID"); - - // Move an order to cust1 from cust2 - DataObject order = root.createDataObject("ANORDER"); - order.setInt("ID", 500); - order.setInt("CUSTOMER_ID", cust1ID.intValue()); - cust1.getList("orders").add(order); - - try { - das.applyChanges(root); - fail("An exception should be thrown"); - } catch (RuntimeException ex) { - assertEquals("Foreign key properties should not be set when the corresponding relationship has changed", ex.getMessage()); - } - } - - public void testInvalidFKColumn() throws SQLException { - ConfigHelper helper = new ConfigHelper(); - Relationship r = helper.addRelationship("CUSTOMER.ID", "ANORDER.CUSTOMER_ID_INVALID"); - r.setName("orders"); - - - DAS das = DAS.FACTORY.createDAS(helper.getConfig(), getConnection()); - Command select = das.createCommand("select * from CUSTOMER left join ANORDER " - + "ON CUSTOMER.ID = ANORDER.CUSTOMER_ID"); - - DataObject root = select.executeQuery(); - DataObject cust1 = root.getDataObject("CUSTOMER[1]"); - DataObject order = root.createDataObject("ANORDER"); - order.setInt("ID", 500); - cust1.getList("orders").add(order); - try { - das.applyChanges(root); - } catch (RuntimeException ex) { - assertEquals("Invalid foreign key column: CUSTOMER_ID_INVALID", ex.getMessage()); - } - } - -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ResultSetShapeTests.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ResultSetShapeTests.java deleted file mode 100644 index 74cc753911..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ResultSetShapeTests.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test; - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.DAS; -import org.apache.tuscany.das.rdb.test.data.CustomerData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; - -/** - * Test ability to specify format(shape) of the ResultSet. This is necessary - * when the JDBC driver in use does not provide adequate support for - * ResultSetMetadata. Also, we expect that specifying the result set shape will - * increase performance. - * - */ -public class ResultSetShapeTests extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - new CustomerData(getAutoConnection()).refresh(); - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - /** - * Read a specific customer - */ - public void testReadSingle() throws Exception { - - DAS das = DAS.FACTORY.createDAS(getConfig("CustomerConfigWithIDConverter.xml"), getConnection()); - // Create and initialize command to read customers - Command readCustomers = das.getCommand("literal"); - - // Read - DataObject root = readCustomers.executeQuery(); - - // Verify - assertEquals(5, root.getList("CUSTOMER").size()); - assertEquals(99, root.getInt("CUSTOMER[1]/ID")); - assertEquals("Roosevelt", root.getString("CUSTOMER[1]/LASTNAME")); - assertEquals("1600 Pennsylvania Avenue", root.getString("CUSTOMER[1]/ADDRESS")); - - } - - /** - * Read a specific customer This duplicates the previous tests but does not - * provide the shape info. Since the select will not return valid metadata, - * this test is expected to fail - */ - public void testReadSingleVerifyShapeUse() throws Exception { - - - // Using literals in the select forces invalid resultset metadata - String sqlString = "Select 99, 'Roosevelt', '1600 Pennsylvania Avenue' from customer"; - - DAS das = DAS.FACTORY.createDAS(getConnection()); - // Create and initialize command to read customers - Command readCustomers = das.createCommand(sqlString); - - // Read - try { - readCustomers.executeQuery(); - fail("exception not thrown"); - } catch (RuntimeException ex) { - assertEquals("Unable to obtain table information from JDBC. DAS configuration must specify ResultDescriptors", ex.getMessage()); - } - - } - -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/SerializationTests.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/SerializationTests.java deleted file mode 100644 index ca6174956e..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/SerializationTests.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test; - -/* - * This class provides tests for all supported "types". The current plan - * is to use the Data type definitions provided in the SDO 2 specification. We - * must test the ability to use all of these types as well as different mapping - * from thse types to types used in the database. For example, a SDO Data - * Type "STRING", might be staored as a "TIMESTAMP" in DB2. - * - */ - -import org.apache.tuscany.das.rdb.test.data.TypesData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -public class SerializationTests extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - new TypesData(getAutoConnection()).refresh(); - } - - /** - * Read various types. - */ - - public void testReadandSerialize() throws Exception { - /** - * Currently failing because of TUSCANY-22 - * Command select = Command.FACTORY .createCommand("Select * from TYPETEST where ID = 1"); - * select.setConnection(getConnection()); DataObject root = select.executeQuery(); - * - * DataObject obj = root.getDataObject("TYPETEST[1]"); - * - * assertTrue(obj.isSet("ID")); assertTrue(obj.isSet("ATIMESTAMP")); - * assertTrue(obj.isSet("ADECIMAL")); assertTrue(obj.isSet("AFLOAT")); - * - * //Java serilaization to file FileOutputStream fos = null; ObjectOutputStream out = null; try { fos = new - * FileOutputStream("serializedGraph.xml"); out = new ObjectOutputStream(fos); - * out.writeObject(root); - * out.flush(); - * } finally { - * out.close(); - * fos.close(); } - * - * //Reconstruct the graph FileInputStream fis = null; ObjectInputStream in = null; - * DataObject root2; try { fis = new - * FileInputStream("serializedGraph.xml"); in = new ObjectInputStream(fis); - * root2 = (DataObject) in.readObject(); } finally { in.close(); - * fis.close(); } - * - * assertEquals(1, root.getInt("TYPETEST[1]/ID")); assertEquals(TypesData.getTimestamp(), - * (java.sql.Timestamp)root.get("TYPETEST[1]/ATIMESTAMP")); - * assertEquals(1234567.89f, root2.getFloat("TYPETEST[1]/ADECIMAL"), .001); - * assertEquals(1234567.89f, root2.getFloat("TYPETEST[1]/AFLOAT"), .001); - * - */ - } -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/SimplestCrud.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/SimplestCrud.java deleted file mode 100644 index 881fb109f6..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/SimplestCrud.java +++ /dev/null @@ -1,228 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test; - -/* - * These are the simplest possible uses of the JDBC DAS. In this mode, the programming model is not much more than JDBC - * - * The assumptions for these tests are: - * - * Single type Client explicitly Read/Create/Update/Delete commands - * No O/R mapping metadata SDO change history is not used Dynamic DataObjects No - * specified graph model - * - * - */ - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.DAS; -import org.apache.tuscany.das.rdb.test.data.CustomerData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; - -public class SimplestCrud extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - new CustomerData(getAutoConnection()).refresh(); - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - /** - * Read a specific customer - */ - public void testReadSingle() throws Exception { - - // Create and initialize command to read customers - DAS das = DAS.FACTORY.createDAS(getConnection()); - Command readCustomers = das.createCommand("select * from CUSTOMER where ID = 1"); - - // Read - DataObject root = readCustomers.executeQuery(); - - // Verify - assertEquals(1, root.getInt("CUSTOMER[1]/ID")); - } - - /** - * Read a specific customer - */ - public void testReadSingle2() throws Exception { - - DAS das = DAS.FACTORY.createDAS(getConnection()); - // Create and initialize command to read customers - Command readCustomers = das.createCommand("select * from CUSTOMER where ID = 1"); - - // Read - DataObject root = readCustomers.executeQuery(); - - // Verify - assertEquals(1, root.getInt("CUSTOMER[1]/ID")); - } - - /** - * Read a specific customer Same as above but tests tolerance of white space in provided SQL - */ - public void testReadSingleWithWhiteSpace() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConnection()); - // Create and initialize command to read customers - Command readCustomers = das.createCommand(" select * from CUSTOMER where ID = 1"); - - // Read - DataObject root = readCustomers.executeQuery(); - - // Verify - assertEquals(1, root.getInt("CUSTOMER[1]/ID")); - } - - /** - * Read all customers with a specific last name - */ - public void testReadMultiple() throws Exception { - - DAS das = DAS.FACTORY.createDAS(getConnection()); - // Create and initialize command to read customers - Command readCustomers = das.createCommand("select * from CUSTOMER where LASTNAME = 'Williams'"); - - // Read - DataObject root = readCustomers.executeQuery(); - - // Verify - assertEquals(4, root.getList("CUSTOMER").size()); - } - - /** - * Read all customers with a specific last name LASTNAME value is provided via a parameter - */ - public void testReadMultipleWithParameters() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConnection()); - // Create and initialize command to read customers - Command readCustomers = das.createCommand("select * from CUSTOMER where LASTNAME = ?"); - - // Parameterize the command - readCustomers.setParameter(1, "Williams"); - DataObject root = readCustomers.executeQuery(); - - // Verify - assertEquals(4, root.getList("CUSTOMER").size()); - } - - public void testInsert() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConnection()); - Command insert = das.createCommand("insert into CUSTOMER values (10, 'Williams', '5528 Wells Fargo Dr')"); - insert.execute(); - - // Verify - Command select = das.createCommand("Select * from CUSTOMER where ID = 10"); - DataObject root = select.executeQuery(); - assertEquals(1, root.getList("CUSTOMER").size()); - assertEquals("5528 Wells Fargo Dr", root.get("CUSTOMER[1]/ADDRESS")); - - } - - public void testInsertWithParameters() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConnection()); - Command insert = das.createCommand("insert into CUSTOMER values (?, ?, ?)"); - insert.setParameter(1, new Integer(10)); - insert.setParameter(2, "Williams"); - insert.setParameter(3, "5528 Wells Fargo Dr"); - insert.execute(); - - // Verify - Command select = das.createCommand("Select * from CUSTOMER where ID = 10"); - DataObject root = select.executeQuery(); - assertEquals(1, root.getList("CUSTOMER").size()); - assertEquals("5528 Wells Fargo Dr", root.get("CUSTOMER[1]/ADDRESS")); - - } - - public void testDelete() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConnection()); - // Verify pre-condition - Command select = das.createCommand("Select * from CUSTOMER where ID = 1"); - DataObject root = select.executeQuery(); - assertEquals(1, root.getList("CUSTOMER").size()); - - // Create and execute the delete command - Command delete = das.createCommand("delete from CUSTOMER where ID = 1"); - delete.execute(); - - // Verify delete by reusing the original select command - root = select.executeQuery(); - assertEquals(0, root.getList("CUSTOMER").size()); - - } - - public void testUpdate() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConnection()); - // Verify pre-condition - Command select = das.createCommand("Select * from CUSTOMER where ID = 1"); - DataObject root = select.executeQuery(); - assertFalse(root.get("CUSTOMER[1]/LASTNAME").equals("Pavick")); - - Command update = das.createCommand("update CUSTOMER set LASTNAME = 'Pavick' where ID = 1"); - update.execute(); - - // Verify update - reuse select command - root = select.executeQuery(); - assertEquals("Pavick", root.get("CUSTOMER[1]/LASTNAME")); - - } - - public void testUpdateWithParameters() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConnection()); - // Verify pre-condition - Command select = das.createCommand("Select * from CUSTOMER where ID = 1"); - DataObject root = select.executeQuery(); - assertFalse(root.get("CUSTOMER[1]/LASTNAME").equals("Pavick")); - - Command update = das.createCommand("update CUSTOMER set LASTNAME = ? where ID = ?"); - update.setParameter(1, "Pavick"); - update.setParameter(2, new Integer(1)); - update.execute(); - - // Verify update - reuse select command - root = select.executeQuery(); - assertEquals("Pavick", root.get("CUSTOMER[1]/LASTNAME")); - - } - - public void testUpdateWithParmarkers() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConnection()); - // Verify pre-condition - Command select = das.createCommand("Select * from CUSTOMER where ID = 1"); - DataObject root = select.executeQuery(); - assertFalse(root.get("CUSTOMER[1]/LASTNAME").equals("Pavick")); - - Command update = das.createCommand("update CUSTOMER set LASTNAME = ? where ID = ?"); - update.setParameter(1, "Pavick"); - update.setParameter(2, new Integer(1)); - update.execute(); - - //Verify update - reuse select command - root = select.executeQuery(); - assertEquals("Pavick", root.get("CUSTOMER[1]/LASTNAME")); - - } - -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/StoredProcs.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/StoredProcs.java deleted file mode 100644 index 74126b2668..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/StoredProcs.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test; - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.DAS; -import org.apache.tuscany.das.rdb.test.data.CompanyData; -import org.apache.tuscany.das.rdb.test.data.CustomerData; -import org.apache.tuscany.das.rdb.test.data.OrderData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; - -public class StoredProcs extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - - new CompanyData(getAutoConnection()).refresh(); - new CustomerData(getAutoConnection()).refresh(); - new OrderData(getAutoConnection()).refresh(); - - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - public void testMultipleResultSets() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConnection()); - Command read = das.createCommand("{call GETALLCUSTOMERSANDORDERS()}"); - - DataObject root = read.executeQuery(); - - // Verify - assertEquals(5, root.getList("CUSTOMER").size()); - assertEquals(4, root.getList("ANORDER").size()); - } - - // Call a simple stored proc to read all companies - public void testGetCompanies() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConnection()); - Command read = das.createCommand("{call GETALLCOMPANIES()}"); - - DataObject root = read.executeQuery(); - - // Verify - assertEquals(3, root.getList("COMPANY").size()); - assertTrue(root.getInt("COMPANY[1]/ID") > 0); - - } - - public void testGetNamedCompany() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConnection()); - Command read = das.createCommand("{call GETNAMEDCOMPANY(?)}"); - - read.setParameter(1, "MegaCorp"); - DataObject root = read.executeQuery(); - - assertEquals("MegaCorp", root.getString("COMPANY[1]/NAME")); - - } - - public void testGetNamedCompanyByName() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConnection()); - Command read = das.createCommand("{call GETNAMEDCOMPANY(?)}"); - - read.setParameter(1, "MegaCorp"); - DataObject root = read.executeQuery(); - - assertEquals("MegaCorp", root.getString("COMPANY[1]/NAME")); - } - - // Retreive heirarchy using a stored proc ... new programming model - public void testGetCustomersAndOrder() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("CustomersOrdersConfig.xml"), getConnection()); - Command read = das.createCommand("{call getCustomerAndOrders(?)}"); - read.setParameter(1, new Integer(1)); - - DataObject root = read.executeQuery(); - - DataObject customer = (DataObject) root.getList("CUSTOMER").get(0); - assertEquals(2, customer.getList("orders").size()); - - } - - /** - * Call a stored proc requiring an in parameter and producing - * an out parameter and a resultset - * - * This stored proc takes a lastname argument and returns a - * graph of customers with that last name. The number of read - * customers is returned in - * the out parameter - */ - public void testGetNamedCustomers() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("storedProcTest.xml"), getConnection()); - Command read = das.getCommand("getNamedCustomers"); - read.setParameter(1, "Williams"); - DataObject root = read.executeQuery(); - - Integer customersRead = (Integer) read.getParameter(2); - - assertEquals(4, customersRead.intValue()); - assertEquals(customersRead.intValue(), root.getList("CUSTOMER").size()); - - } - - // TODO - Resolve issue with programmatic creation of GETNAMEDCUSTOMERS on DB2 and - // re-enable this test - - // Simplest possible SP write - public void testDelete() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConnection()); - Command delete = das.createCommand("{call DELETECUSTOMER(?)}"); - delete.setParameter(1, new Integer(1)); - delete.execute(); - - // Verify DELETE - Command select = das.createCommand("Select * from CUSTOMER where ID = 1"); - DataObject root = select.executeQuery(); - assertTrue(root.getList("CUSTOMER").isEmpty()); - - } - -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/TopDown.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/TopDown.java deleted file mode 100644 index 0fb75dc424..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/TopDown.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test; - -import java.sql.SQLException; - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.DAS; -import org.apache.tuscany.das.rdb.test.customer.AnOrder; -import org.apache.tuscany.das.rdb.test.customer.Customer; -import org.apache.tuscany.das.rdb.test.customer.CustomerFactory; -import org.apache.tuscany.das.rdb.test.data.CustomerData; -import org.apache.tuscany.das.rdb.test.data.OrderData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; -import commonj.sdo.helper.HelperContext; -import commonj.sdo.impl.HelperProvider; - -public class TopDown extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - - new CustomerData(getAutoConnection()).refresh(); - new OrderData(getAutoConnection()).refresh(); - - } - - // Uses dynamic SDOs but user provides the model - public void testUserProvidedModelDynamic() throws SQLException { - - DAS das = DAS.FACTORY.createDAS(getConfig("staticCustomerOrder.xml"), getConnection()); - - Command select = das.getCommand("Customer and Orders"); - - HelperContext context = HelperProvider.getDefaultContext(); - CustomerFactory.INSTANCE.register(context); - - // Parameterize the command - select.setParameter(1, new Integer(1)); - - // Get the graph - DataGraphRoot is from the typed package - DataObject root = select.executeQuery(); - - // Modify a customer - Customer customer = (Customer) root.getDataObject("Customer[1]"); - customer.setLastName("Pavick"); - - // Modify an order - AnOrder order = (AnOrder) customer.getOrders().get(0); - order.setProduct("Kitchen Sink 001"); - - // Flush changes - das.applyChanges((DataObject) root); - - } - -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/TransactionTests.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/TransactionTests.java deleted file mode 100644 index 60eff851d6..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/TransactionTests.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test; - -/* - * Test capability to participate in an extenrlly managed transaction. - * The client is managing the transaction boundary so the DAS will not issue - * commit/rollback - * - */ - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.DAS; -import org.apache.tuscany.das.rdb.test.data.CustomerData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; - -public class TransactionTests extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - new CustomerData(getAutoConnection()).refresh(); - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - /** - * Read and modify a customer. Uses a "passive" connection - */ - public void testReadModifyApply() throws Exception { - - // Create and initialize a DAS connection and initialize for externally - // managed transaction boundaries - java.sql.Connection c = getConnection(); - - DAS das = DAS.FACTORY.createDAS(c); - // Read customer 1 - Command select = das.createCommand("select * from CUSTOMER"); - DataObject root = select.executeQuery(); - - int numCustomers = root.getList("CUSTOMER").size(); - - //Create two identical customers. Will force insert error on dup key - - DataObject custA = root.createDataObject("CUSTOMER"); - custA.set("ID", new Integer(100)); - custA.set("ADDRESS", "5528 Wells Fargo Drive"); - custA.set("LASTNAME", "Gerkin"); - - DataObject custB = root.createDataObject("CUSTOMER"); - custB.set("ID", new Integer(100)); - custB.set("ADDRESS", "5528 Wells Fargo Drive"); - custB.set("LASTNAME", "Gerkin"); - try { - das.applyChanges(root); - fail("An exception was expected"); - } catch (Exception e) { - //do nothing - } - - // Verify that the changes did not go through - // Roll back should discard al changes - root = select.executeQuery(); - assertEquals(numCustomers, root.getList("CUSTOMER").size()); - - } - -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/TypeTests.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/TypeTests.java deleted file mode 100644 index e6972357f6..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/TypeTests.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test; - -/* - * This class provides tests for all supported "types". The current plan is to use the Data - * type definitions provided in the SDO 2 specification. We must test the ability to use - * all of these types as well as different mapping from thse types to types used in the - * database. For example, a SDO Data Type "STRING", might be staored as a "TIMESTAMP" in DB2. - * - */ - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.DAS; -import org.apache.tuscany.das.rdb.test.data.TypesData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; - -public class TypeTests extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - new TypesData(getAutoConnection()).refresh(); - } - - /** - * Read various types. - */ - public void testRead() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConnection()); - // Read customer 1 - Command select = das.createCommand("Select * from TYPETEST where ID = 1"); - DataObject root = select.executeQuery(); - - DataObject types = (DataObject) root.get("TYPETEST[1]"); - - java.sql.Timestamp ts = (java.sql.Timestamp) types.get("ATIMESTAMP"); - assertEquals(ts, TypesData.getTimestamp()); - - float decimal = types.getFloat("ADECIMAL"); - assertEquals(1234567.89f, decimal, .0001); - - } - - /** - * Write various types. - * TODO - Need to rethink the Timestamp write. My current thinking id that writes of non-SDO2 defined types - * require a converter - */ - /* public void testWrite() throws Exception { - - //Read customer 1 - Command select = Command.FACTORY.createCommand("Select * from TYPETEST where ID = 1"); - select.setConnection(getConnection()); - DataObject root = select.executeQuery(); - - DataObject types = (DataObject)root.get("TYPETEST[1]"); - Date now = new Date(); - types.set("ATIMESTAMP", now); - - ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(); - apply.setConnection(getConnection()); - apply.addPrimaryKey("TYPETEST.ID"); - apply.execute(root); - - //Verify - root = select.executeQuery(); - java.sql.Timestamp ts = (java.sql.Timestamp)types.get("ATIMESTAMP"); - assertEquals(now, ts); - - }*/ - -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersByLastnameCommand.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersByLastnameCommand.java deleted file mode 100644 index f98e014ca9..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersByLastnameCommand.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test.commands; - -import org.apache.tuscany.das.rdb.config.Column; -import org.apache.tuscany.das.rdb.config.Config; -import org.apache.tuscany.das.rdb.config.ConfigFactory; -import org.apache.tuscany.das.rdb.config.Table; -import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper; -import org.apache.tuscany.das.rdb.impl.ReadCommandImpl; - -public class ReadCustomersByLastnameCommand extends ReadCommandImpl { - - private static final String SQL_STRING = "select * from CUSTOMER where LASTNAME = ?"; - - private static final Config CONFIG; - - static { - ConfigFactory factory = ConfigFactory.INSTANCE; - CONFIG = factory.createConfig(); - Table t = factory.createTable(); - Column id = factory.createColumn(); - id.setColumnName("ID"); - id.setPrimaryKey(true); - Column lastname = factory.createColumn(); - lastname.setColumnName("LASTNAME"); - Column address = factory.createColumn(); - address.setColumnName("ADDRESS"); - - t.getColumn().add(id); - t.getColumn().add(lastname); - t.getColumn().add(address); - t.setTableName("CUSTOMER"); - CONFIG.getTable().add(t); - } - - public ReadCustomersByLastnameCommand() { - super(SQL_STRING, new MappingWrapper(CONFIG), null); - } -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersCommand.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersCommand.java deleted file mode 100644 index 7a4b8f49dd..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersCommand.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test.commands; - -import org.apache.tuscany.das.rdb.config.Column; -import org.apache.tuscany.das.rdb.config.Config; -import org.apache.tuscany.das.rdb.config.ConfigFactory; -import org.apache.tuscany.das.rdb.config.Table; -import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper; -import org.apache.tuscany.das.rdb.impl.ReadCommandImpl; - -public class ReadCustomersCommand extends ReadCommandImpl { - - private static final String SQL_STRING = "select * from CUSTOMER"; - - private static final Config CONFIG; - - static { - ConfigFactory factory = ConfigFactory.INSTANCE; - CONFIG = factory.createConfig(); - Table t = factory.createTable(); - Column id = factory.createColumn(); - id.setColumnName("ID"); - id.setPrimaryKey(true); - Column lastname = factory.createColumn(); - lastname.setColumnName("LASTNAME"); - Column address = factory.createColumn(); - address.setColumnName("ADDRESS"); - - t.getColumn().add(id); - t.getColumn().add(lastname); - t.getColumn().add(address); - t.setTableName("CUSTOMER"); - CONFIG.getTable().add(t); - } - - public ReadCustomersCommand() { - super(SQL_STRING, new MappingWrapper(CONFIG), null); - } - -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersStaticTypesCommand.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersStaticTypesCommand.java deleted file mode 100644 index 52e1274d8a..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersStaticTypesCommand.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test.commands; - -import org.apache.tuscany.das.rdb.config.Column; -import org.apache.tuscany.das.rdb.config.Config; -import org.apache.tuscany.das.rdb.config.ConfigFactory; -import org.apache.tuscany.das.rdb.config.Table; -import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper; -import org.apache.tuscany.das.rdb.impl.ReadCommandImpl; -import org.apache.tuscany.das.rdb.test.customer.CustomerFactory; - -import commonj.sdo.helper.HelperContext; -import commonj.sdo.impl.HelperProvider; - -public class ReadCustomersStaticTypesCommand extends ReadCommandImpl { - - private static final String SQL_STRING = "Select ID, LASTNAME, ADDRESS from CUSTOMER where LASTNAME = ?"; - - private static final Config CONFIG; - - static { - ConfigFactory factory = ConfigFactory.INSTANCE; - CONFIG = factory.createConfig(); - Table t = factory.createTable(); - Column id = factory.createColumn(); - id.setColumnName("ID"); - id.setPrimaryKey(true); - Column lastname = factory.createColumn(); - lastname.setColumnName("LASTNAME"); - Column address = factory.createColumn(); - address.setColumnName("ADDRESS"); - - t.getColumn().add(id); - t.getColumn().add(lastname); - t.getColumn().add(address); - t.setTableName("CUSTOMER"); - t.setTypeName("Customer"); - CONFIG.getTable().add(t); - - CONFIG.setDataObjectModel("http:///org.apache.tuscany.das.rdb.test/customer.xsd"); - HelperContext context = HelperProvider.getDefaultContext(); - CustomerFactory.INSTANCE.register(context); - } - - public ReadCustomersStaticTypesCommand() { - super(SQL_STRING, new MappingWrapper(CONFIG), null); - } - -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersWithShapeCommand.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersWithShapeCommand.java deleted file mode 100644 index ba771ca3e5..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersWithShapeCommand.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test.commands; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.tuscany.das.rdb.config.ConfigFactory; -import org.apache.tuscany.das.rdb.config.ResultDescriptor; -import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper; -import org.apache.tuscany.das.rdb.impl.ReadCommandImpl; - -public class ReadCustomersWithShapeCommand extends ReadCommandImpl { - // This sql string ensures that we won't have resultset metadata - static String sqlString = "select * from customer union select * from customer"; - - static List descriptor = new ArrayList(); - - static { - ConfigFactory factory = ConfigFactory.INSTANCE; - - ResultDescriptor desc1 = factory.createResultDescriptor(); - desc1.setColumnName("ID"); - desc1.setColumnType("commonj.sdo.Int"); - desc1.setTableName("CUSTOMER"); - - ResultDescriptor desc2 = factory.createResultDescriptor(); - desc2.setColumnName("LASTNAME"); - desc2.setColumnType("commonj.sdo.String"); - desc2.setTableName("CUSTOMER"); - - ResultDescriptor desc3 = factory.createResultDescriptor(); - desc3.setColumnName("ADDRESS"); - desc3.setColumnType("commonj.sdo.String"); - desc3.setTableName("CUSTOMER"); - - descriptor.add(desc1); - descriptor.add(desc2); - descriptor.add(desc3); - - } - - public ReadCustomersWithShapeCommand() { - super(sqlString, new MappingWrapper(), descriptor); - } - -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/SimpleReadCustomersWithShapeCommand.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/SimpleReadCustomersWithShapeCommand.java deleted file mode 100644 index 44eea42445..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/SimpleReadCustomersWithShapeCommand.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test.commands; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.tuscany.das.rdb.config.Column; -import org.apache.tuscany.das.rdb.config.Config; -import org.apache.tuscany.das.rdb.config.ConfigFactory; -import org.apache.tuscany.das.rdb.config.ResultDescriptor; -import org.apache.tuscany.das.rdb.config.Table; -import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper; -import org.apache.tuscany.das.rdb.impl.ReadCommandImpl; - -public class SimpleReadCustomersWithShapeCommand extends ReadCommandImpl { - - // This sql string ensures that we won't have resultset metadata - private static final String SQL_STRING = "Select * from customer union select * from customer"; - - private static final List DESCRIPTOR = new ArrayList(); - - private static final Config CONFIG; - - static { - ConfigFactory factory = ConfigFactory.INSTANCE; - CONFIG = factory.createConfig(); - Table t = factory.createTable(); - Column id = factory.createColumn(); - id.setColumnName("ID"); - id.setPrimaryKey(true); - Column lastname = factory.createColumn(); - lastname.setColumnName("LASTNAME"); - Column address = factory.createColumn(); - address.setColumnName("ADDRESS"); - - t.getColumn().add(id); - t.getColumn().add(lastname); - t.getColumn().add(address); - t.setTableName("CUSTOMER"); - CONFIG.getTable().add(t); - - ResultDescriptor desc1 = factory.createResultDescriptor(); - desc1.setColumnName("ID"); - desc1.setColumnType("commonj.sdo.Int"); - desc1.setTableName("CUSTOMER"); - - ResultDescriptor desc2 = factory.createResultDescriptor(); - desc2.setColumnName("LASTNAME"); - desc2.setColumnType("commonj.sdo.String"); - desc2.setTableName("CUSTOMER"); - - ResultDescriptor desc3 = factory.createResultDescriptor(); - desc3.setColumnName("ADDRESS"); - desc3.setColumnType("commonj.sdo.String"); - desc3.setTableName("CUSTOMER"); - - DESCRIPTOR.add(desc1); - DESCRIPTOR.add(desc2); - DESCRIPTOR.add(desc3); - } - - public SimpleReadCustomersWithShapeCommand() { - super(SQL_STRING, new MappingWrapper(CONFIG), DESCRIPTOR); - } - -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/BookData.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/BookData.java deleted file mode 100644 index 33f7152c04..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/BookData.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.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-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CityData.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CityData.java deleted file mode 100644 index 6a99f825e7..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CityData.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.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-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyData.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyData.java deleted file mode 100644 index 0c28ed2caa..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyData.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.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-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyDeptData.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyDeptData.java deleted file mode 100644 index 686e3243cb..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyDeptData.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.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-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyEmpData.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyEmpData.java deleted file mode 100644 index b1d3fb12b5..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyEmpData.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.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-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CustomerData.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CustomerData.java deleted file mode 100644 index f64b0076b8..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CustomerData.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.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-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DepEmpData.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DepEmpData.java deleted file mode 100644 index ad8ff14e86..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DepEmpData.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.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-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DepartmentData.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DepartmentData.java deleted file mode 100644 index 54e2713498..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DepartmentData.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.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-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DocumentsImagesData.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DocumentsImagesData.java deleted file mode 100644 index 98954fade4..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DocumentsImagesData.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.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-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DogData.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DogData.java deleted file mode 100644 index 96346ff21d..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DogData.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.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-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/EmployeeData.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/EmployeeData.java deleted file mode 100644 index 402d62fb67..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/EmployeeData.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.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-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/KennelData.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/KennelData.java deleted file mode 100644 index 50b1227b47..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/KennelData.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.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-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/MultiSchemaData.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/MultiSchemaData.java deleted file mode 100644 index bc59c09fb2..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/MultiSchemaData.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.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-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderData.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderData.java deleted file mode 100644 index 279da7b9e3..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderData.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.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-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderDetailsData.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderDetailsData.java deleted file mode 100644 index 1eae4a73dd..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderDetailsData.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.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-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderDetailsDescriptionData.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderDetailsDescriptionData.java deleted file mode 100644 index b72bc8afae..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderDetailsDescriptionData.java +++ /dev/null @@ -1,47 +0,0 @@ - /* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.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-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OwnerData.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OwnerData.java deleted file mode 100644 index 02afac5e98..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OwnerData.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.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-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OwnerDogData.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OwnerDogData.java deleted file mode 100644 index a06a2124f3..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OwnerDogData.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.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-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/PartData.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/PartData.java deleted file mode 100644 index fc8256dde1..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/PartData.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.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-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/SingerData.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/SingerData.java deleted file mode 100644 index 0cfa4dadca..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/SingerData.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.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-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/SongData.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/SongData.java deleted file mode 100644 index d74db4d7bd..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/SongData.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.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-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/StateData.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/StateData.java deleted file mode 100644 index d4e2b99570..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/StateData.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.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-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/TypesData.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/TypesData.java deleted file mode 100644 index 97c024109a..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/TypesData.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.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-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/VisitData.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/VisitData.java deleted file mode 100644 index 78396b4b2e..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/VisitData.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.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"; - } - -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DB2Setup.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DB2Setup.java deleted file mode 100644 index 370c1d42d7..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DB2Setup.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test.framework; - -import junit.framework.Test; - -public class DB2Setup extends DatabaseSetup { - - public DB2Setup(Test test) { - super(test); - } - - protected void initConnectionProtocol() { - - platformName = "DB2"; - driverName = "com.ibm.db2.jcc.DB2Driver"; - databaseURL = "jdbc:db2:DASTEST"; - - } - -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DasTest.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DasTest.java deleted file mode 100644 index 78b1cf19e1..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DasTest.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test.framework; - -import java.io.InputStream; -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -import java.sql.SQLException; -import java.util.Iterator; -import java.util.List; - -import junit.framework.TestCase; - -import commonj.sdo.DataObject; -import commonj.sdo.Property; - -/** - * - */ -public class DasTest extends TestCase { - - protected static Connection connection; - - /** - * Tears down the fixture, for example, close a network connection. This method is called after a test is executed. - */ - protected void tearDown() throws Exception { - // if (usingDefaultSetup) - // connection = null; - } - - protected Connection getAutoConnection() throws SQLException { - - Connection c = primGetConnection(); - c.setAutoCommit(true); - return connection; - - } - - protected Connection getConnection() throws SQLException { - - Connection c = primGetConnection(); - c.setAutoCommit(false); - return connection; - } - - /** - * This provides the default connection for runing single test cases on a chosen platform. - */ - private Connection primGetConnection() { - if (connection == null) { - defaultSetup(); - } - return connection; - } - - /** - * This is a bit of a hack since it counts on constructor initialization - * of the DatabaseSet up class and also calls its setUp method directly. - * This is a misuse of this JUnit TestSetup subclass . - * - * TODO - refactor to avoid this hackiness ... could move this logic to its - * own class that is then invoked by DatabaseSetUp - */ - private void defaultSetup() { - - // DatabaseSetup setUp = new DB2Setup(this); - DatabaseSetup setUp = new DerbySetup(this); - try { - setUp.setUp(); - } catch (Exception e) { - throw new RuntimeException(e); - } - - } - - // Utilities - protected InputStream getConfig(String fileName) { - return Thread.currentThread().getContextClassLoader().getResourceAsStream(fileName); - } - - protected void write(String label, ResultSet rs) throws SQLException { - - ResultSetMetaData md = rs.getMetaData(); - int count = md.getColumnCount(); - System.out.println("Contents of ResultSet from " + label); - for (int i = 1; i <= count; i++) { - System.out.print("\t"); - System.out.println(md.getColumnLabel(i)); - } - System.out.println(""); - while (rs.next()) { - for (int i = 1; i <= count; i++) { - System.out.print("\t"); - System.out.print(rs.getString(i)); - } - System.out.println("\t"); - } - System.out.println("done"); - } - - protected void printList(List data) { - Iterator i = data.iterator(); - while (i.hasNext()) { - System.out.println(); - DataObject obj = (DataObject) i.next(); - Iterator props = obj.getType().getProperties().iterator(); - while (props.hasNext()) { - Property p = (Property) props.next(); - if (p.isMany()) { - System.out.print("[ " + p.getName() + " ] "); - Iterator children = obj.getList(p).iterator(); - while (children.hasNext()) { - DataObject child = (DataObject) children.next(); - System.out.print("[ " + child.get("ID") + " ]"); - } - System.out.println(); - } else if (!p.getType().isDataType()) { - DataObject child = obj.getDataObject(p); - if (child != null) { - System.out.println("[ " + p.getName() + " ] " + "[ " + child.get("ID") + " ]"); - } - } else { - System.out.println("[ " + p.getName() + " ] " + obj.get(p)); - } - } - } - } - -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DatabaseSetup.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DatabaseSetup.java deleted file mode 100644 index 535aa3376b..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DatabaseSetup.java +++ /dev/null @@ -1,558 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test.framework; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.SQLException; -import java.sql.Statement; - -import junit.extensions.TestSetup; -import junit.framework.Test; - -public class DatabaseSetup extends TestSetup { - - protected Statement s; - - protected String platformName = "Not initialized"; - - protected String driverName = "Not initialized"; - - protected String databaseURL = "Not initialized"; - - protected String userName; - - protected String password; - - // Data Types - protected String stringType = "VARCHAR"; - - protected String integerType = "INT"; - - protected String timestampType = "TIMESTAMP"; - - protected String floatType = "FLOAT"; - - protected String decimalType = "DECIMAL"; - - private Connection connection; - - public DatabaseSetup(Test test) { - super(test); - initConnectionProtocol(); - initConnection(); - DasTest.connection = connection; - } - - protected void initConnectionProtocol() { - // Subclasses provide implementation - } - - private void initConnection() { - - try { - - Class.forName(driverName).newInstance(); - if (userName != null) { - connection = DriverManager.getConnection(databaseURL, userName, password); - } else { - connection = DriverManager.getConnection(databaseURL); - } - connection.setAutoCommit(false); - - } catch (SQLException e) { - - if (e.getNextException() != null) { - e.getNextException().printStackTrace(); - } else { - e.printStackTrace(); - } - - throw new RuntimeException(e); - } catch (IllegalAccessException e) { - throw new RuntimeException(e); - } catch (InstantiationException e) { - throw new RuntimeException(e); - } catch (ClassNotFoundException e) { - throw new RuntimeException(e); - } - - } - - protected void setUp() throws Exception { - - System.out.println("Setting up for " + platformName + " run"); - - s = connection.createStatement(); - - try { - dropTriggers(); - dropSequences(); - dropTables(); - dropProcedures(); - dropSchema();//JIRA-952 - - createSchema();//JIRA-952 - createSequences(); - createTables(); - createTriggers(); - createProcedures(); - connection.commit(); - } catch (SQLException e) { - connection.rollback(); - } - - } - - protected void tearDown() throws Exception { - - System.out.println("Ending " + platformName + " run"); - connection.close(); - - } - - //JIRA-952 - private void dropSchema(){ - String[] statements = {"DROP SCHEMA DASTEST1 RESTRICT", - "DROP SCHEMA DASTEST2 RESTRICT", - "DROP SCHEMA DASTEST3 RESTRICT", - }; - - for (int i = 0; i < statements.length; i++) { - try { - s.execute(statements[i]); - } catch (SQLException e) { - // If the table does not exist then ignore the exception on drop - if ((!(e.getMessage().indexOf("does not exist") >= 0)) && (!(e.getMessage().indexOf("Unknown table") >= 0)) - && (!(e.getMessage().indexOf("42704") >= 0))) { - throw new RuntimeException(e); - } - } - } - } - - private void dropTables() { - - String[] statements = { - "DROP TABLE CUSTOMER", "DROP TABLE ANORDER", "DROP TABLE ORDERDETAILS", - "DROP TABLE ORDERDETAILSDESC", "DROP TABLE ITEM", "DROP TABLE COMPANY", - "DROP TABLE EMPLOYEE", "DROP TABLE DEPARTMENT", "DROP TABLE BOOK", - "DROP TABLE PART", "DROP TABLE TYPETEST", "DROP TABLE CITIES", - "DROP TABLE STATES", "DROP TABLE conmgt.SERVERSTATUS", - "DROP TABLE DOG", "DROP TABLE OWNER", "DROP TABLE KENNEL", - "DROP TABLE VISIT", - "DROP TABLE DASTEST1.CUSTOMER" ,"DROP TABLE DASTEST2.CUSTOMER","DROP TABLE DASTEST3.CUSTOMER", - "DROP TABLE DASTEST1.CITY", "DROP TABLE DASTEST2.CITY", - "DROP TABLE DASTEST2.ACCOUNT", - "DROP TABLE DASTEST3.CUSTORDER", - "DROP TABLE DASTEST3.ORDERDETAILSDESC", "DROP TABLE DASTEST1.ORDERDETAILS", - "DROP TABLE DASTEST1.EMPLOYEE", - "DROP TABLE SINGER", - "DROP TABLE SONG", - "DROP TABLE DASTEST1.EMPLOYEE", - "DROP TABLE DOCUMENTS_IMAGES" - - }; - - for (int i = 0; i < statements.length; i++) { - try { - s.execute(statements[i]); - } catch (SQLException e) { - // If the table does not exist then ignore the exception on drop - if ((!(e.getMessage().indexOf("does not exist") >= 0)) && (!(e.getMessage().indexOf("Unknown table") >= 0)) - && (!(e.getMessage().indexOf("42704") >= 0))) { - throw new RuntimeException(e); - } - } - } - } - - protected void dropTriggers() { - - } - - protected void createTriggers() { - - } - - protected void dropSequences() { - - } - - protected void createSequences() { - - } - - protected void dropProcedures() { - - // System.out.println("Dropping procedures"); - - String[] statements = { - - "DROP PROCEDURE GETALLCOMPANIES", "DROP PROCEDURE DELETECUSTOMER", - "DROP PROCEDURE GETNAMEDCOMPANY", "DROP PROCEDURE GETCUSTOMERANDORDERS", - "DROP PROCEDURE GETNAMEDCUSTOMERS", "DROP PROCEDURE GETALLCUSTOMERSANDORDERS" - - }; - - for (int i = 0; i < statements.length; i++) { - try { - s.execute(statements[i]); - } catch (SQLException e) { - // If the proc does not exist then ignore the exception on drop - if (!(e.getMessage().indexOf("does not exist") >= 0) && !(e.getMessage().indexOf("42704") >= 0)) { - throw new RuntimeException(e); - } - } - } - } - - //JIRA-952 - private void createSchema() { - // System.out.println("Creating schema"); - try { - - s.execute("CREATE SCHEMA DASTEST1"); - s.execute("CREATE SCHEMA DASTEST2"); - s.execute("CREATE SCHEMA DASTEST3"); - }catch (SQLException e) { - throw new RuntimeException(e); - } - } - private void createTables() { - - // System.out.println("Creating tables"); - - try { - - s.execute(getCreateCustomer()); - s.execute(getCreateAnOrder()); - s.execute(getCreateOrderDetails()); - s.execute(getCreateItem()); - s.execute(getCreateCompany()); - s.execute(getCreateEmployee()); - s.execute(getCreateDepartment()); - s.execute(getCreateBook()); - s.execute(getCreatePart()); - s.execute(getCreateTypeTest()); - s.execute(getCreateStates()); - s.execute(getCreateCities()); - s.execute(getCreateServerStatus()); - - s.execute(getCreateDog()); - s.execute(getCreateOwner()); - s.execute(getCreateKennel()); - s.execute(getCreateVisit()); - s.execute(getCreateOrderDetailsDesc());//JIRA-841 - - //JIRA-952 start - s.execute(getCreateDASTEST1Customer()); - s.execute(getCreateDASTEST1Employee()); - s.execute(getCreateDASTEST2Customer()); - s.execute(getCreateDASTEST3Customer()); - s.execute(getCreateDASTEST1City()); - s.execute(getCreateDASTEST2City()); - s.execute(getCreateDASTEST2Account()); - s.execute(getCreateDASTEST3CustOrder()); - s.execute(getCreateDASTEST1OrderDetails()); - s.execute(getCreateDASTEST3OrderDetailsDesc()); - //JIRA-952 end - s.execute(getCreateSinger()); - s.execute(getCreateSong()); - s.execute(getCreateDocumentsImages()); - - } catch (SQLException e) { - throw new RuntimeException(e); - } - } - - protected void createProcedures() { - - // System.out.println("Creating procedures"); - try { - - s.execute("CREATE PROCEDURE GETALLCOMPANIES() PARAMETER STYLE JAVA LANGUAGE JAVA " - + "READS SQL DATA DYNAMIC RESULT SETS 1 " - + "EXTERNAL NAME " - + "'org.apache.tuscany.das.rdb.test.framework.JavaStoredProcs.getAllCompanies'"); - s.execute("CREATE PROCEDURE DELETECUSTOMER(theId int) PARAMETER STYLE JAVA LANGUAGE JAVA " - + "MODIFIES SQL DATA EXTERNAL NAME " - + "'org.apache.tuscany.das.rdb.test.framework.JavaStoredProcs.deleteCustomer'"); - s.execute("CREATE PROCEDURE GETNAMEDCOMPANY(theName VARCHAR(100)) PARAMETER STYLE JAVA LANGUAGE JAVA " - + "READS SQL DATA DYNAMIC RESULT SETS 1 EXTERNAL NAME " - + "'org.apache.tuscany.das.rdb.test.framework.JavaStoredProcs.getNamedCompany'"); - s.execute("CREATE PROCEDURE GETCUSTOMERANDORDERS(theID INTEGER) PARAMETER STYLE JAVA LANGUAGE JAVA " - + "READS SQL DATA DYNAMIC RESULT SETS 1 EXTERNAL NAME " - + "'org.apache.tuscany.das.rdb.test.framework.JavaStoredProcs.getCustomerAndOrders'"); - s.execute("CREATE PROCEDURE GETNAMEDCUSTOMERS(theName VARCHAR(100), OUT theCount INTEGER) " - + "PARAMETER STYLE JAVA LANGUAGE JAVA READS SQL DATA DYNAMIC RESULT SETS 1 EXTERNAL NAME " - + "'org.apache.tuscany.das.rdb.test.framework.JavaStoredProcs.getNamedCustomers'"); - s.execute("CREATE PROCEDURE GETALLCUSTOMERSANDORDERS() PARAMETER STYLE JAVA LANGUAGE JAVA " - + "READS SQL DATA DYNAMIC RESULT SETS 2 EXTERNAL NAME " - + "'org.apache.tuscany.das.rdb.test.framework.JavaStoredProcs.getAllCustomersAndAllOrders'"); - // TODO - "GETNAMEDCUSTOMERS" is failing on DB2 with SQLCODE: 42723. Need to investigate - } catch (SQLException e) { - throw new RuntimeException(e); - } - } - - // - // This section povides methods that return strings for table creation. - // Platform-specific sublcasses - // can override these as necessary - // - - protected String getCreateCustomer() { - return "CREATE TABLE CUSTOMER (" + getIntegerColumn("ID") + " PRIMARY KEY NOT NULL, " - + getStringColumn("LASTNAME", 30) - + " DEFAULT 'Garfugengheist', " + getStringColumn("ADDRESS", 30) + ")"; - } - - protected String getCreateAnOrder() { - return "CREATE TABLE ANORDER (" + getIntegerColumn("ID") + " PRIMARY KEY NOT NULL, " - + getStringColumn("PRODUCT", 30) + ", " - + getIntegerColumn("QUANTITY") + "," + getIntegerColumn("CUSTOMER_ID") + ")"; - } - - protected String getCreateOrderDetails() { - return "CREATE TABLE ORDERDETAILS (" + getIntegerColumn("ORDERID") + " NOT NULL, " - + getIntegerColumn("PRODUCTID") - + " NOT NULL, PRICE FLOAT, PRIMARY KEY (ORDERID, PRODUCTID))"; - } - - protected String getCreateItem() { - return "CREATE TABLE ITEM (" + getIntegerColumn("ID") + " PRIMARY KEY NOT NULL, " - + getStringColumn("NAME", 30) + ")"; - } - - protected String getCreateCompany() { - return "CREATE TABLE COMPANY (" + getIntegerColumn("ID") + " PRIMARY KEY NOT NULL " - + getGeneratedKeyClause() + " , " - + getStringColumn("NAME", 30) + ", " + getIntegerColumn("EOTMID") + ")"; - } - - protected String getCreateEmployee() { - return "CREATE TABLE EMPLOYEE (" + getIntegerColumn("ID") + " PRIMARY KEY NOT NULL " - + getGeneratedKeyClause() + "," - + getStringColumn("NAME", 30) + "," + getStringColumn("SN", 10) + ", MANAGER SMALLINT, " - + getIntegerColumn("DEPARTMENTID") + ")"; - } - - protected String getCreateDepartment() { - return "CREATE TABLE DEPARTMENT (" + getIntegerColumn("ID") + " PRIMARY KEY NOT NULL " - + getGeneratedKeyClause() + ", " - + getStringColumn("NAME", 30) + "," + getStringColumn("LOCATION", 30) + ", " - + getStringColumn("DEPNUMBER", 10) + "," - + getIntegerColumn("COMPANYID") + ")"; - } - - protected String getCreateBook() { - return "CREATE TABLE BOOK (" + getIntegerColumn("BOOK_ID") + " PRIMARY KEY NOT NULL, " - + getStringColumn("NAME", 50) + "," - + getStringColumn("AUTHOR", 30) + ", " + getIntegerColumn("QUANTITY") + "," - + getIntegerColumn("OCC") + ")"; - } - - protected String getCreatePart() { - return "CREATE TABLE PART (" + getIntegerColumn("ID") + " PRIMARY KEY NOT NULL, NAME VARCHAR(50), " - + getIntegerColumn("QUANTITY") + "," - + getIntegerColumn("PARENT_ID") + " )"; - } - - protected String getCreateTypeTest() { - return "CREATE TABLE TYPETEST (" + getIntegerColumn("ID") + " PRIMARY KEY NOT NULL, " - + getTimestampColumn("ATIMESTAMP") + "," - + getDecimalColumn("ADECIMAL", 9, 2) + "," + getFloatColumn("AFLOAT") + ")"; - } - - protected String getCreateStates() { - return "CREATE TABLE STATES (" + getIntegerColumn("ID") + " PRIMARY KEY NOT NULL, " - + getStringColumn("NAME", 2) + ")"; - } - - protected String getCreateCities() { - return "CREATE TABLE CITIES (" + getIntegerColumn("ID") + " PRIMARY KEY NOT NULL," - + getStringColumn("NAME", 50) + "," - + getIntegerColumn("STATE_ID") + "," + getForeignKeyConstraint("STATES", "ID", "STATE_ID") + ")"; - } - - protected String getCreateServerStatus() { - - return "CREATE TABLE CONMGT.SERVERSTATUS (STATUSID INTEGER PRIMARY KEY NOT NULL " + getGeneratedKeyClause() - + " (START WITH 1 ,INCREMENT BY 1), MANAGEDSERVERID INTEGER NOT NULL, TIMESTAMP TIMESTAMP NOT NULL)"; - - } - - // Dog Kennel Schema - - protected String getCreateDog() { - return "CREATE TABLE DOG (" + getIntegerColumn("ID") + " NOT NULL " + getGeneratedKeyClause() + " , " - + getIntegerColumn("OWNER_ID") + " , " - + getStringColumn("NAME", 20) + ", " + getStringColumn("BREED", 20) + ", " - + getIntegerColumn("OCC_COUNT") + ", " - + "PRIMARY KEY(ID))"; - } - - protected String getCreateOwner() { - return "CREATE TABLE OWNER (" + getIntegerColumn("ID") + " NOT NULL " + getGeneratedKeyClause() + " , " - + getStringColumn("NAME", 20) + ", " - + getStringColumn("CONTACT_PHONE", 20) + ", " + getIntegerColumn("OCC_COUNT") + ", " - + "PRIMARY KEY(ID))"; - } - - protected String getCreateKennel() { - return "CREATE TABLE KENNEL (" + getIntegerColumn("ID") + " NOT NULL " + getGeneratedKeyClause() - + " , " + getIntegerColumn("KNUMBER") + ", " - + getStringColumn("KIND", 20) + ", " + getIntegerColumn("OCC_COUNT") + ", " + "PRIMARY KEY(ID))"; - } - - protected String getCreateVisit() { - return "CREATE TABLE VISIT (" + getIntegerColumn("ID") + " NOT NULL " + getGeneratedKeyClause() + " , " - + getTimestampColumn("CHECK_IN") - + ", " + getTimestampColumn("CHECK_OUT") + ", " + getIntegerColumn("OCC_COUNT") + ", " - + "PRIMARY KEY(ID))"; - } - - protected String getCreateOrderDetailsDesc() { - return "CREATE TABLE ORDERDETAILSDESC ("+ getIntegerColumn("ID") + " NOT NULL, " + getIntegerColumn("ORDERID") + " NOT NULL, " - + getIntegerColumn("PRODUCTID") - + " NOT NULL,"+ getStringColumn("DESCR", 20)+", PRIMARY KEY (ID))"; - } - - //JIRA-952 start - protected String getCreateDASTEST1Customer() { - return "CREATE TABLE DASTEST1.CUSTOMER (" + getIntegerColumn("ID") + " PRIMARY KEY NOT NULL, " - + getStringColumn("LASTNAME", 30) - + " DEFAULT 'Garfugengheist', " + getStringColumn("ADDRESS", 30) + ")"; - } - - protected String getCreateDASTEST1Employee() { - return "CREATE TABLE DASTEST1.EMPLOYEE (" + getIntegerColumn("ID") + " PRIMARY KEY NOT NULL, " - + getStringColumn("LASTNAME", 30) - + " DEFAULT 'Garfugengheist', " + getStringColumn("ADDRESS", 30) + ")"; - } - - protected String getCreateDASTEST2Customer() { - return "CREATE TABLE DASTEST2.CUSTOMER (" + getIntegerColumn("ID") + " PRIMARY KEY NOT NULL, " - + getStringColumn("LASTNAME", 30) - + " DEFAULT 'Garfugengheist', " + getStringColumn("ADDRESS", 30) + ")"; - } - - protected String getCreateDASTEST3Customer() { - return "CREATE TABLE DASTEST3.CUSTOMER (" + getIntegerColumn("ID") + " PRIMARY KEY NOT NULL, " - + getStringColumn("LASTNAME", 30) - + " DEFAULT 'Garfugengheist', " + getStringColumn("ADDRESS", 30) + ")"; - } - - protected String getCreateDASTEST1City() { - return "CREATE TABLE DASTEST1.CITY (" + getIntegerColumn("INDX") + " PRIMARY KEY NOT NULL," - + getStringColumn("NAME", 50) + ")"; - } - - protected String getCreateDASTEST2City() { - return "CREATE TABLE DASTEST2.CITY (" + getIntegerColumn("INDX") + " PRIMARY KEY NOT NULL," - + getStringColumn("NAME", 50) + ")"; - } - - protected String getCreateDASTEST2Account() { - return "CREATE TABLE DASTEST2.ACCOUNT ("+ getIntegerColumn("ACCOUNT_ID") + " PRIMARY KEY NOT NULL," + - getIntegerColumn("CUSTOMER_ID") +", "+ getIntegerColumn("BALANCE") + ")"; - } - - protected String getCreateDASTEST3CustOrder() { - return "CREATE TABLE DASTEST3.CUSTORDER ("+ getIntegerColumn("ORDER_ID") + " PRIMARY KEY NOT NULL," + - getIntegerColumn("CUSTOMER_ID") +", "+getIntegerColumn("ORDER_COUNT")+ ")"; - } - - protected String getCreateDASTEST1OrderDetails() { - return "CREATE TABLE DASTEST1.ORDERDETAILS (" + getIntegerColumn("ORDERID") + " NOT NULL, " - + getIntegerColumn("PRODUCTID") - + " NOT NULL, PRICE FLOAT, PRIMARY KEY (ORDERID, PRODUCTID))"; - } - - protected String getCreateDASTEST3OrderDetailsDesc() { - return "CREATE TABLE DASTEST3.ORDERDETAILSDESC ("+ getIntegerColumn("ID") + " NOT NULL, " + getIntegerColumn("ORDERID") + " NOT NULL, " - + getIntegerColumn("PRODUCTID") - + " NOT NULL,"+ getStringColumn("DESCR", 20)+", PRIMARY KEY (ID))"; - } - //JIRA-952 end - // ////////////// - - protected String getCreateSinger() { - return "CREATE TABLE SINGER ("+ getIntegerColumn("ID") + " NOT NULL, " + - getStringColumn("NAME", 20) +" )"; - } - - protected String getCreateSong() { - return "CREATE TABLE SONG ("+ getIntegerColumn("ID") + " , " +//" NOT NULL, " + - getStringColumn("TITLE", 20) + ", "+ - getIntegerColumn("SINGERID") + " )"; - } - - - protected String getCreateDocumentsImages() { - return "CREATE TABLE DOCUMENTS_IMAGES (ID INT, TEXT CLOB(64K),PIC BLOB(16M))"; - } - - - - - - - - - - protected String getForeignKeyConstraint(String pkTable, String pkColumn, String foreignKey) { - StringBuffer buffer = new StringBuffer(); - buffer.append("CONSTRAINT FK1 FOREIGN KEY ("); - buffer.append(foreignKey); - buffer.append(") REFERENCES "); - buffer.append(pkTable); - buffer.append("("); - buffer.append(pkColumn); - buffer.append(") ON DELETE NO ACTION ON UPDATE NO ACTION"); - return buffer.toString(); - } - - protected String getStringColumn(String name, int length) { - return name + ' ' + stringType + "(" + new Integer(length).toString() + ")"; - } - - protected String getIntegerColumn(String name) { - return name + ' ' + integerType; - } - - protected String getGeneratedKeyClause() { - return "GENERATED ALWAYS AS IDENTITY"; - } - - protected String getDecimalColumn(String name, int size1, int size2) { - return name + ' ' + decimalType + "(" + new Integer(size1).toString() + ',' - + new Integer(size2).toString() + ")"; - } - - protected String getFloatColumn(String name) { - return name + ' ' + floatType; - } - - protected String getTimestampColumn(String name) { - return name + ' ' + timestampType; - } - -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DerbySetup.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DerbySetup.java deleted file mode 100644 index 300f315465..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DerbySetup.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test.framework; - -import java.util.Properties; - -import junit.framework.Test; - -public class DerbySetup extends DatabaseSetup { - - public DerbySetup(Test test) { - super(test); - } - - protected void initConnectionProtocol() { - - // Set the derby property to explicitly specify the database location relative - // from current directory to "target" - Properties p = System.getProperties(); - p.put("derby.system.home", "target"); - - platformName = "Derby"; - driverName = "org.apache.derby.jdbc.EmbeddedDriver"; - databaseURL = "jdbc:derby:dastest; create = true"; - - } - -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/JavaStoredProcs.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/JavaStoredProcs.java deleted file mode 100644 index 71a7d1c4e4..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/JavaStoredProcs.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test.framework; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; - -/** - * Stored Procedures for DB2 and Derby SP tests - * - */ -public final class JavaStoredProcs { - - private JavaStoredProcs() { - - } - - public static void getAllCustomersAndAllOrders(ResultSet[] result1, ResultSet[] result2) throws SQLException { - Connection conn = DriverManager.getConnection("jdbc:default:connection"); - PreparedStatement ps = conn.prepareStatement("SELECT * FROM CUSTOMER"); - - result1[0] = ps.executeQuery(); - - PreparedStatement ps2 = conn.prepareStatement("select * from anorder"); - result2[0] = ps2.executeQuery(); - - } - - public static void getAllCompanies(ResultSet[] results) throws SQLException { - - Connection conn = DriverManager.getConnection("jdbc:default:connection"); - PreparedStatement ps = conn.prepareStatement("SELECT * FROM COMPANY"); - results[0] = ps.executeQuery(); - } - - public static void deleteCustomer(int theId) throws SQLException { - - Connection conn = DriverManager.getConnection("jdbc:default:connection"); - PreparedStatement ps = conn.prepareStatement("DELETE FROM CUSTOMER WHERE ID = ?"); - ps.setInt(1, theId); - ps.execute(); - - } - - public static void getNamedCompany(String theName, ResultSet[] results) throws SQLException { - - Connection conn = DriverManager.getConnection("jdbc:default:connection"); - PreparedStatement ps = conn.prepareStatement("SELECT * FROM COMPANY WHERE NAME = ?"); - ps.setString(1, theName); - results[0] = ps.executeQuery(); - } - - public static void getCustomerAndOrders(int theId, ResultSet[] results) throws SQLException { - - Connection conn = DriverManager.getConnection("jdbc:default:connection"); - PreparedStatement ps = conn - .prepareStatement("SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON CUSTOMER.ID = ANORDER.CUSTOMER_ID " - + "WHERE CUSTOMER.ID = ?"); - ps.setInt(1, theId); - results[0] = ps.executeQuery(); - } - - public static void getNamedCustomers(String theName, int[] outCount, ResultSet[] results) throws SQLException { - - Connection conn = DriverManager.getConnection("jdbc:default:connection"); - PreparedStatement ps = conn.prepareStatement("SELECT * FROM CUSTOMER WHERE LASTNAME = ?"); - ps.setString(1, theName); - results[0] = ps.executeQuery(); - - ps = conn.prepareStatement("SELECT COUNT(*) FROM CUSTOMER WHERE LASTNAME = ?"); - ps.setString(1, theName); - - ResultSet rs = ps.executeQuery(); - rs.next(); - outCount[0] = rs.getInt(1); - } - -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/MySQLSetup.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/MySQLSetup.java deleted file mode 100644 index 580f1c5f25..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/MySQLSetup.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test.framework; - -import java.sql.SQLException; - -import junit.framework.Test; - -public class MySQLSetup extends DatabaseSetup { - - public MySQLSetup(Test test) { - super(test); - } - - protected void initConnectionProtocol() { - - platformName = "MySQL"; - driverName = "com.mysql.jdbc.Driver"; - databaseURL = "jdbc:mysql:///dastest?user=dastester&password=dastester"; - - } - - protected void createProcedures() { - - String createGetAllCompanies = "CREATE PROCEDURE `dastest`.`GETALLCOMPANIES` () " - + " SELECT * FROM COMPANY "; - - String createDeleteCustomer = "CREATE PROCEDURE `dastest`.`DELETECUSTOMER` (theId INT) " - + " DELETE FROM CUSTOMER WHERE ID = theId "; - - String createGetNamedCustomers = "CREATE PROCEDURE `dastest`.`GETNAMEDCUSTOMERS`(IN thename VARCHAR(30), " - + "OUT theCount INTEGER ) " + " BEGIN " - + " SELECT * FROM CUSTOMER AS CUSTOMER WHERE LASTNAME = theName; " - + " SET theCount = (SELECT COUNT(*) FROM CUSTOMER WHERE LASTNAME = theName); " + " END "; - - String createGetCustomerAndOrders = " CREATE PROCEDURE `dastest`.`GETCUSTOMERANDORDERS` (theId INT) " - + " SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON CUSTOMER.ID = ANORDER.CUSTOMER_ID " - + "WHERE CUSTOMER.ID = theId "; - - String createGetNamedCompany = " CREATE PROCEDURE `dastest`.`GETNAMEDCOMPANY` (theName VARCHAR(100)) " - + " SELECT * FROM COMPANY WHERE NAME = theName"; - - String createCustomersAndOrders = "CREATE PROCEDURE `dastest`.`GETALLCUSTOMERSANDORDERS` () " - + " BEGIN SELECT * FROM CUSTOMER; SELECT * FROM ANORDER; END;"; - - System.out.println("Creating procedures"); - try { - - s.execute(createGetAllCompanies); - s.execute(createDeleteCustomer); - s.execute(createGetNamedCompany); - s.execute(createGetCustomerAndOrders); - s.execute(createGetNamedCustomers); - s.execute(createCustomersAndOrders); - - } catch (SQLException e) { - throw new RuntimeException(e); - } - } - - // Overrides for table creation - protected String getCreateCompany() { - return "CREATE TABLE COMPANY (ID INT PRIMARY KEY NOT NULL AUTO_INCREMENT, NAME VARCHAR(30), EOTMID INT)"; - } - - protected String getCreateEmployee() { - return "CREATE TABLE EMPLOYEE (ID INT PRIMARY KEY NOT NULL AUTO_INCREMENT, NAME VARCHAR(30), " - + "SN VARCHAR(10), MANAGER SMALLINT, DEPARTMENTID INT)"; - } - -// protected String getCreateDepartment() { -// return "CREATE TABLE DEPARTMENT (ID INT PRIMARY KEY NOT NULL AUTO_INCREMENT, NAME VARCHAR(30), " -// + "LOCATION VARCHAR(30), DEPNUMBER VARCHAR(10), COMPANYID INT, EOTM INT)"; -// } - - protected String getCreateTypeTest() { - return "CREATE TABLE TYPETEST (ID INT PRIMARY KEY NOT NULL, ATIMESTAMP DATETIME, ADECIMAL DECIMAL(9,2), " - + "AFLOAT FLOAT)"; - } - - protected String getCreateServerStatus() { - return "CREATE TABLE CONMGT.SERVERSTATUS (STATUSID INT PRIMARY KEY NOT NULL AUTO_INCREMENT, " - + "MANAGEDSERVERID INTEGER NOT NULL, TIMESTAMP TIMESTAMP NOT NULL)"; - } - protected String getGeneratedKeyClause() { - return "AUTO_INCREMENT"; - } - -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/RelationshipData.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/RelationshipData.java deleted file mode 100644 index 094fe13456..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/RelationshipData.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test.framework; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; - -public abstract class RelationshipData { - protected Object[][] data; - - protected Connection connection; - - private int currentRow = -1; - - public RelationshipData(Connection c, Object[][] inputData) { - this.connection = c; - this.data = inputData; - } - - public int size() { - return data[0].length; - } - - public int numberOfRows() { - return data.length; - } - - public boolean next() { - ++currentRow; - return currentRow < numberOfRows(); - } - - public void refresh() throws SQLException { - updateRelationships(); - } - - protected abstract String getParentRetrievalStatement(); - - protected abstract String getChildUpdateStatement(); - - protected void updateRelationships() throws SQLException { - // { MegaCorp, Advanced Technologies } - // select company.id from company where company.name = ? - PreparedStatement retrieveParent = connection.prepareStatement(getParentRetrievalStatement()); - // update department set department.companyid = ? where department.name = ? - PreparedStatement updateChild = connection.prepareStatement(getChildUpdateStatement()); - - while (next()) { - retrieveParent.setObject(1, data[currentRow][0]); - retrieveParent.execute(); - ResultSet rs = retrieveParent.getResultSet(); - rs.next(); - Object parentID = rs.getObject(1); - retrieveParent.clearParameters(); - - updateChild.setObject(1, parentID); - updateChild.setObject(2, data[currentRow][1]); - updateChild.execute(); - updateChild.clearParameters(); - } - } -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/TestData.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/TestData.java deleted file mode 100644 index 4b91cde06b..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/TestData.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test.framework; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.SQLException; -import java.sql.Timestamp; -import java.text.DateFormat; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; - -public abstract class TestData { - - protected static final DateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd hh:ss:mm.SSS"); - - protected static final Timestamp TIMESTAMP = getTimestamp(); - - protected Object[][] data; - - protected Connection connection; - - private int currentRow = -1; - - - public TestData(Connection c, Object[][] customerData) { - this.connection = c; - this.data = customerData; - } - - public int size() { - return data[0].length; - } - - public int numberOfRows() { - return data.length; - } - - public boolean next() { - ++currentRow; - return currentRow < numberOfRows(); - } - - public abstract String getTableName(); - - public Object getObject(int i) { - return data[currentRow][i - 1]; - } - - public void refresh() throws SQLException { - deleteRowsFromTable(); - insertRows(); - } - - protected void deleteRowsFromTable() throws SQLException { - PreparedStatement ps = connection.prepareStatement("delete from " + getTableName()); - ps.execute(); - ps.close(); - } - - protected void insertRows() throws SQLException { - StringBuffer sql = new StringBuffer(); - sql.append("insert into "); - sql.append(getTableName()); - sql.append(" values ("); - for (int i = 1; i < size(); i++) { - sql.append("?,"); - } - sql.append("?)"); - PreparedStatement ps = connection.prepareStatement(sql.toString()); - - while (next()) { - for (int i = 1; i <= size(); i++) { - ps.setObject(i, getObject(i)); - } - ps.execute(); - ps.clearParameters(); - } - ps.close(); - } - - // Utilities - protected static Date getDate() { - - try { - return DATE_FORMAT.parse("1966-12-20 00:00:00.0"); - } catch (ParseException e) { - throw new RuntimeException(e); - } - } - - protected static Date getDate(String timeStamp) { - - try { - return DATE_FORMAT.parse(timeStamp); - } catch (ParseException e) { - throw new RuntimeException(e); - } - } - - public static Timestamp getTimestamp() { - return new Timestamp(getDate().getTime()); - } - - public static Timestamp getTimestamp(String timeStamp) { - return new Timestamp(getDate(timeStamp).getTime()); - } - -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/TestDataWithExplicitColumns.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/TestDataWithExplicitColumns.java deleted file mode 100644 index 5a329d0b74..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/TestDataWithExplicitColumns.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test.framework; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.SQLException; - -import org.apache.log4j.Logger; - -public abstract class TestDataWithExplicitColumns extends TestData { - - private String[] columns; - - private int[] sqlTypes; - - private final Logger logger = Logger.getLogger(TestDataWithExplicitColumns.class); - - public TestDataWithExplicitColumns(Connection c, Object[][] data, String[] columns, int[] sqlTypes) { - super(c, data); - this.columns = columns; - this.sqlTypes = sqlTypes; - } - - private String getColumn(int i) { - return columns[i - 1]; - } - - private int getSqlType(int i) { - return sqlTypes[i - 1]; - } - - // Create an insert statement of the following form ... - // "INSERT INTO table_name (column1, column2,...) VALUES (value1, value2,....)" - // This is necessary for tables with a generated column since the PK value is not provided - protected void insertRows() throws SQLException { - StringBuffer sql = new StringBuffer(); - sql.append("insert into "); - sql.append(getTableName()); - - sql.append(" ("); - for (int i = 1; i <= size(); i++) { - sql.append(getColumn(i)); - if (i < size()) { - sql.append(','); - } - } - sql.append(" )"); - - sql.append(" values ("); - for (int i = 1; i < size(); i++) { - sql.append("?,"); - } - sql.append("?)"); - - if (this.logger.isDebugEnabled()) { - this.logger.debug(sql.toString()); - } - - PreparedStatement ps = connection.prepareStatement(sql.toString()); - - while (next()) { - for (int i = 1; i <= size(); i++) { - ps.setObject(i, getObject(i), getSqlType(i)); - } - ps.execute(); - ps.clearParameters(); - } - } - -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/IntegerToBooleanConverter.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/IntegerToBooleanConverter.java deleted file mode 100644 index 282aeaeb36..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/IntegerToBooleanConverter.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test.mappings; - -import org.apache.tuscany.das.rdb.Converter; - -public class IntegerToBooleanConverter implements Converter { - - public IntegerToBooleanConverter() { - super(); - } - - public Object getPropertyValue(Object columnData) { - Integer value = (Integer) columnData; - return value.intValue() == 0 ? Boolean.FALSE : Boolean.TRUE; - } - - public Object getColumnValue(Object propertyData) { - Boolean value = (Boolean) propertyData; - if (value.booleanValue()) { - return new Integer(1); - } - return new Integer(0); - } - - -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/SillyDateStringConverter.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/SillyDateStringConverter.java deleted file mode 100644 index df9d2978eb..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/SillyDateStringConverter.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test.mappings; - -import java.text.DateFormat; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; - -import org.apache.tuscany.das.rdb.Converter; - -public class SillyDateStringConverter implements Converter { - - private static DateFormat myformat = new SimpleDateFormat("yyyy.MM.dd"); - - private static Date kbday; - - private static Date tbday; - - public SillyDateStringConverter() { - super(); - } - - static { - try { - kbday = myformat.parse("1957.09.27"); - tbday = myformat.parse("1966.12.20"); - } catch (ParseException e) { - throw new RuntimeException(e); - } - } - - public Object getPropertyValue(Object columnData) { - - if (columnData.equals("Williams")) { - return kbday; - } - - if (columnData.equals("Pavick")) { - return tbday; - } - - throw new IllegalArgumentException(); - - } - - public Object getColumnValue(Object propertyData) { - - if (propertyData.equals(kbday)) { - return "Williams"; - } - - if (propertyData.equals(tbday)) { - return "Pavick"; - } - - throw new IllegalArgumentException(); - - } - -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/StringObfuscationConverter.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/StringObfuscationConverter.java deleted file mode 100644 index efea61c7de..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/StringObfuscationConverter.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test.mappings; - -import java.io.UnsupportedEncodingException; - -import org.apache.tuscany.das.rdb.Converter; - -public class StringObfuscationConverter implements Converter { - - public StringObfuscationConverter() { - super(); - } - - public Object getPropertyValue(Object columnData) { - return toRot13((String) columnData); - } - - public Object getColumnValue(Object propertyData) { - return toRot13((String) propertyData); - } - - // Utilities - - // A simple, reversible, obfuscation algorithm using a ROT13 implementation - private String toRot13(String original) { - - int abyte = 0; - byte[] buffer = {}; - try { - buffer = original.getBytes("ISO-8859-1"); - } catch (UnsupportedEncodingException e) { - throw new Error(e); - } - - for (int i = 0; i < buffer.length; i++) { - abyte = buffer[i]; - int cap = abyte & 32; - abyte &= ~cap; - abyte = ((abyte >= 'A') && (abyte <= 'Z') ? ((abyte - 'A' + 13) % 26 + 'A') : abyte) | cap; - buffer[i] = (byte) abyte; - } - try { - return new String(buffer, "ISO-8859-1"); - } catch (UnsupportedEncodingException e) { - throw new Error(e); - } - } -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/StringToIntegerConverter.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/StringToIntegerConverter.java deleted file mode 100644 index 2be6522fcc..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/StringToIntegerConverter.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test.mappings; - -import org.apache.tuscany.das.rdb.Converter; - -public class StringToIntegerConverter implements Converter { - - public StringToIntegerConverter() { - super(); - } - - public Object getPropertyValue(Object columnData) { - // System.out.println("Converting object.. " + columnData); - - return new Integer(columnData.toString()); - } - - public Object getColumnValue(Object columnData) { - return columnData.toString(); - } - -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/StringToLongConverter.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/StringToLongConverter.java deleted file mode 100644 index a15cef37e6..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/StringToLongConverter.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test.mappings; - -import org.apache.tuscany.das.rdb.Converter; - -public class StringToLongConverter implements Converter { - - public StringToLongConverter() { - super(); - } - - public Object getPropertyValue(Object columnData) { - return new Long(columnData.toString()); - } - - public Object getColumnValue(Object columnData) { - return columnData.toString(); - } - -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllCommonTests.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllCommonTests.java deleted file mode 100644 index ab78c816fd..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllCommonTests.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test.suites; - -import junit.framework.Test; -import junit.framework.TestSuite; - -import org.apache.tuscany.das.rdb.test.AliasTests; -import org.apache.tuscany.das.rdb.test.BestPracticeTests; -import org.apache.tuscany.das.rdb.test.CUDGeneration; -import org.apache.tuscany.das.rdb.test.CommandGroupTests; -import org.apache.tuscany.das.rdb.test.CompanyTests; -import org.apache.tuscany.das.rdb.test.CompoundKeyRelationshipTests; -import org.apache.tuscany.das.rdb.test.CompoundKeyTests; -import org.apache.tuscany.das.rdb.test.ConverterTests; -import org.apache.tuscany.das.rdb.test.CorrectedDefectTests; -import org.apache.tuscany.das.rdb.test.CrudWithChangeHistory; -import org.apache.tuscany.das.rdb.test.DynamicResultDescriptorTests; -import org.apache.tuscany.das.rdb.test.ExceptionTests; -import org.apache.tuscany.das.rdb.test.GeneratedCommandTests; -import org.apache.tuscany.das.rdb.test.GeneratedId; -import org.apache.tuscany.das.rdb.test.GraphMergeTests; -import org.apache.tuscany.das.rdb.test.ImpliedRelationshipTests; -import org.apache.tuscany.das.rdb.test.KennelTests; -import org.apache.tuscany.das.rdb.test.MissingPKTests; -import org.apache.tuscany.das.rdb.test.LOBTests; -import org.apache.tuscany.das.rdb.test.MultiSchemaTests; -import org.apache.tuscany.das.rdb.test.NamedParameterTests; -import org.apache.tuscany.das.rdb.test.OCCTests; -import org.apache.tuscany.das.rdb.test.OneToOneRelationshipTests; -import org.apache.tuscany.das.rdb.test.OperationOrderingTests; -import org.apache.tuscany.das.rdb.test.Paging; -import org.apache.tuscany.das.rdb.test.PartialUpdateTests; -import org.apache.tuscany.das.rdb.test.PassiveConnectionTests; -import org.apache.tuscany.das.rdb.test.ProgrammaticConfigTests; -import org.apache.tuscany.das.rdb.test.RecursiveTests; -import org.apache.tuscany.das.rdb.test.RelationshipTests; -import org.apache.tuscany.das.rdb.test.ResultSetShapeTests; -import org.apache.tuscany.das.rdb.test.SerializationTests; -import org.apache.tuscany.das.rdb.test.SimplestCrud; -import org.apache.tuscany.das.rdb.test.StoredProcs; -import org.apache.tuscany.das.rdb.test.TopDown; -import org.apache.tuscany.das.rdb.test.TransactionTests; -import org.apache.tuscany.das.rdb.test.TypeTests; -import org.apache.tuscany.das.rdb.test.typed.SimplestStaticCrud; - -public final class AllCommonTests { - - private AllCommonTests() { - } - - public static Test suite() { - TestSuite suite = new TestSuite("All platform-common DAS tests"); - // $JUnit-BEGIN$ - - suite.addTest(new TestSuite(SimplestCrud.class)); - suite.addTest(new TestSuite(CrudWithChangeHistory.class)); - suite.addTest(new TestSuite(SimplestStaticCrud.class)); - suite.addTest(new TestSuite(Paging.class)); - suite.addTest(new TestSuite(GeneratedId.class)); - - suite.addTest(new TestSuite(StoredProcs.class)); - suite.addTest(new TestSuite(CUDGeneration.class)); - suite.addTest(new TestSuite(TopDown.class)); - suite.addTest(new TestSuite(OCCTests.class)); - suite.addTest(new TestSuite(RecursiveTests.class)); - - suite.addTest(new TestSuite(GraphMergeTests.class)); - suite.addTest(new TestSuite(CompoundKeyTests.class)); - suite.addTest(new TestSuite(CompoundKeyRelationshipTests.class)); - suite.addTest(new TestSuite(RelationshipTests.class)); - suite.addTest(new TestSuite(GeneratedCommandTests.class)); - - suite.addTest(new TestSuite(CompanyTests.class)); - suite.addTest(new TestSuite(ResultSetShapeTests.class)); - suite.addTest(new TestSuite(TypeTests.class)); - suite.addTest(new TestSuite(OperationOrderingTests.class)); - suite.addTest(new TestSuite(ConverterTests.class)); - - suite.addTest(new TestSuite(PartialUpdateTests.class)); - suite.addTest(new TestSuite(ExceptionTests.class)); - suite.addTest(new TestSuite(PassiveConnectionTests.class)); - suite.addTest(new TestSuite(SerializationTests.class)); - - suite.addTest(new TestSuite(CommandGroupTests.class)); - suite.addTest(new TestSuite(BestPracticeTests.class)); - suite.addTest(new TestSuite(CorrectedDefectTests.class)); - suite.addTest(new TestSuite(OneToOneRelationshipTests.class)); - - suite.addTest(new TestSuite(ProgrammaticConfigTests.class)); - suite.addTest(new TestSuite(AliasTests.class)); - - suite.addTest(new TestSuite(ImpliedRelationshipTests.class)); - - suite.addTest(new TestSuite(KennelTests.class)); - - suite.addTest(new TestSuite(TransactionTests.class)); - suite.addTest(new TestSuite(MultiSchemaTests.class)); - suite.addTest(new TestSuite(MissingPKTests.class)); - - - suite.addTest(new TestSuite(DynamicResultDescriptorTests.class)); - suite.addTest(new TestSuite(LOBTests.class)); - suite.addTest(new TestSuite(NamedParameterTests.class)); - //$JUnit-END$ - return suite; - } - -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllTestsDB2.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllTestsDB2.java deleted file mode 100644 index ea8a2ddbaf..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllTestsDB2.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test.suites; - -import junit.framework.Test; -import junit.framework.TestSuite; - -import org.apache.tuscany.das.rdb.test.ReadDBSchemaTests; -import org.apache.tuscany.das.rdb.test.framework.DB2Setup; - -public final class AllTestsDB2 { - - private AllTestsDB2() { - - } - - public static Test suite() { - - TestSuite suite = new TestSuite(); - suite.addTest(AllCommonTests.suite()); - suite.addTest(new TestSuite(ReadDBSchemaTests.class)); - - TestSuite suite2 = new TestSuite("All DAS tests on DB2"); - suite2.addTest(new DB2Setup(suite)); - return suite2; - - } -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllTestsDerby.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllTestsDerby.java deleted file mode 100644 index 0649fa815c..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllTestsDerby.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test.suites; - -import junit.framework.Test; -import junit.framework.TestSuite; - -import org.apache.tuscany.das.rdb.test.framework.DerbySetup; - -public class AllTestsDerby extends TestSuite { - - public static Test suite() { - - TestSuite suite = new TestSuite("All DAS tests on Derby"); - suite.addTest(new DerbySetup(AllCommonTests.suite())); - return suite; - - } -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllTestsMySQL.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllTestsMySQL.java deleted file mode 100644 index e68aaad8aa..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllTestsMySQL.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test.suites; - -import junit.framework.Test; -import junit.framework.TestSuite; - -import org.apache.tuscany.das.rdb.test.framework.MySQLSetup; - -public final class AllTestsMySQL { - - private AllTestsMySQL() { - - } - - public static Test suite() { - - TestSuite suite = new TestSuite("All DAS tests on MySQL"); - suite.addTest(new MySQLSetup(AllCommonTests.suite())); - return suite; - - } -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/typed/SimplestStaticCrud.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/typed/SimplestStaticCrud.java deleted file mode 100644 index dc1296d92a..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/typed/SimplestStaticCrud.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test.typed; - -import java.io.InputStream; -import java.util.Collection; - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.ConfigHelper; -import org.apache.tuscany.das.rdb.DAS; -import org.apache.tuscany.das.rdb.merge.impl.GraphMerger; -import org.apache.tuscany.das.rdb.test.customer.CustomerFactory; -import org.apache.tuscany.das.rdb.test.data.CustomerData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; -import commonj.sdo.helper.HelperContext; -import commonj.sdo.impl.HelperProvider; - -/** - */ -public class SimplestStaticCrud extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - new CustomerData(getAutoConnection()).refresh(); - } - - public void testRead() throws Exception { - InputStream mapping = getClass().getClassLoader().getResourceAsStream("basicStaticCustomer.xml"); - DAS das = DAS.FACTORY.createDAS(mapping, getConnection()); - HelperContext context = HelperProvider.getDefaultContext(); - CustomerFactory.INSTANCE.register(context); - - Command select = das.createCommand("Select ID, LASTNAME, ADDRESS from CUSTOMER where LASTNAME = ?"); - select.setParameter(1, "Williams"); - - DataObject root = select.executeQuery(); - - Collection customers = root.getList("Customer"); - assertEquals(4, customers.size()); - } - -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/util/PrintPropertiesOfDataObject.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/util/PrintPropertiesOfDataObject.java deleted file mode 100644 index 897e8d39b3..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/util/PrintPropertiesOfDataObject.java +++ /dev/null @@ -1,134 +0,0 @@ -/** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.das.rdb.test.util; - -import java.util.List; - -import commonj.sdo.DataObject; -import commonj.sdo.Property; -import commonj.sdo.Type; - -/** - * Demonstrates iterating through, and inspecting properites of a DataObject. This - * sample shows listing properties of a DataObject, determining if the properties are - * set and whether they are simple properties or represent DataObjects
- *
- * This sample is from the Apache Tuscany project. It was written to help users - * understand and experiment with SDO. It is based upon code snippets contained - * within, and is meant for use with, and reference to the SDO Specification. This specific examples was based upon code - * snippets in the section titled 'Property Indexes'.
- * Usage:
- * This sample can easily be run from within Eclipse as a Java Application if Tuscany or - * the sample-sdo project is imported into Eclipse as an existing project. - *

- * If executing as a standalone application please do the following: - *
- *
    - *
  • Include the following jar files on your classpath : - *
      - *
    • SDO API and Tuscany Implementation - *
        - *
      • sdo-api-{version}.jar - SDO API - *
      • tuscany-sdo-impl-{version}.jar - Tuscany SDO implementation - *
      - *
    • - *
    • EMF dependencies. - *
        - *
      • emf-common-{version}.jar - some common framework utility and base classes - *
      • emf-ecore-{version}.jar - the EMF core runtime implementation classes (the Ecore metamodel) - *
      • emf-ecore-change-{version}.jar - the EMF change recorder and framework - *
      • emf-ecore-xmi-{version}.jar - EMF's default XML (and XMI) serializer and loader - *
      • xsd-{version}.jar - the XML Schema model - *
      - *
    • - *
    - * - * These jar files can be obtained by downloading and unpacking a Tuscany binary distribution
  • - *
  • Execute:
    - * java org.apache.tuscany.samples.sdo.specCodeSnippets.PrintPropertiesOfDataObject
  • - *
- */ - -public class PrintPropertiesOfDataObject { - - /** - * Calls recursive method to inspect and print properties of a DataObject. - * - * @param DataObject. - * The DataObject to print the properties of - */ - public static void printDataObjectProperties(DataObject myDo) throws Exception { - System.out.println("Recursivly inspecting and printing properties of DataObject"); - printAndInspectDataObject(" ", myDo); - } - - /** - * Recursivly inspects and prints DataObject. This method will list all set - * properties - * - * @param buffer. - * Blank string to help with formating - * @param myDo. - * DataObject to recursivly inspect and print the properties of. - * @throws Exception - */ - private static void printAndInspectDataObject(String buffer, DataObject dataObject) throws Exception { - for (int i = 0; i < dataObject.getInstanceProperties().size(); i++) { - Property p = (Property) dataObject.getInstanceProperties().get(i); - // just print out the name, type and string value of the property - Type type = p.getType(); - System.out.print(buffer + " " + p.getName() + ",type=" + type.getName()); - if (dataObject.isSet(p)) { - // see if this represents a simple property or if the type is also a - // datatype - if (type.isDataType()) { - System.out.println(", simple type : " + dataObject.get(i)); - } else { - - // check to see if the property has many values - if (p.isMany()) { - System.out.println(buffer + ", many valued with list of DataObjects : "); - List dataObjects = dataObject.getList(p); - for (int x = 0; x < dataObjects.size(); x++) { - if (p.isContainment()) { - printAndInspectDataObject(buffer + " ", (DataObject) dataObjects.get(x)); - System.out.println(); - } - } - - } else { - - System.out.println(buffer + ", data object : "); - DataObject newDataObject = dataObject.getDataObject(p); - printAndInspectDataObject(buffer + " ", newDataObject); - System.out.println(""); - } - } - } else { - System.out.println(buffer + ", is not set"); - } - } - - } -} diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/1xM_mapping_no_cud.xml b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/1xM_mapping_no_cud.xml deleted file mode 100644 index 95267de08b..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/1xM_mapping_no_cud.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - -
- -
- - - - -
- - - - - -
- diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/BooksConfig.xml b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/BooksConfig.xml deleted file mode 100644 index 2da86cbdb2..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/BooksConfig.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - -
- -
diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/BooksConfigWithAlias.xml b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/BooksConfigWithAlias.xml deleted file mode 100644 index 91bdccfac5..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/BooksConfigWithAlias.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - -
- -
diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/CompanyConfig.xml b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/CompanyConfig.xml deleted file mode 100644 index 793697c314..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/CompanyConfig.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - -
- - - -
- - - - - - -
diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/CompanyEmployeeConfig.xml b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/CompanyEmployeeConfig.xml deleted file mode 100644 index 0e25268afa..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/CompanyEmployeeConfig.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - - - - - - - - - - -
- - - -
- - - -
- - - - - -
- diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/CustomerConfig.xml b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/CustomerConfig.xml deleted file mode 100644 index ed544f39dd..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/CustomerConfig.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/CustomerConfigWithConverter.xml b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/CustomerConfigWithConverter.xml deleted file mode 100644 index b38922b53a..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/CustomerConfigWithConverter.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - -
- -
diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/CustomerConfigWithConverter2.xml b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/CustomerConfigWithConverter2.xml deleted file mode 100644 index bb49a414c4..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/CustomerConfigWithConverter2.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - -
- -
diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/CustomerConfigWithIDConverter.xml b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/CustomerConfigWithIDConverter.xml deleted file mode 100644 index 9a567b7ea8..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/CustomerConfigWithIDConverter.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - -
- -
diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/CustomersOrdersConfig.xml b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/CustomersOrdersConfig.xml deleted file mode 100644 index 323c8cb6ba..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/CustomersOrdersConfig.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - -
- - - -
- - - - - -
diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/InvalidConfig1.xml b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/InvalidConfig1.xml deleted file mode 100644 index fa1e353281..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/InvalidConfig1.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - -
- - - - - -
\ No newline at end of file diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/InvalidConverter.xml b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/InvalidConverter.xml deleted file mode 100644 index e6c15ad11f..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/InvalidConverter.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - -
- - - - -
- - - - - -
- diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/ManagedBooksConfig.xml b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/ManagedBooksConfig.xml deleted file mode 100644 index c2b833d2bf..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/ManagedBooksConfig.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - -
- -
diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MissingPK.xml b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MissingPK.xml deleted file mode 100644 index a236f4b0e9..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MissingPK.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - -
- - - -
- - - - - - - - -
- - - -
- - - - - -
- - - - - - - -
- -
diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MissingPKREL.xml b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MissingPKREL.xml deleted file mode 100644 index 0efd7bf63c..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MissingPKREL.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - -
- - - -
- - - - - - - - - - - - - - - -
- - - -
- - - - - - -
diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MultiSchemaDasConfig1.xml b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MultiSchemaDasConfig1.xml deleted file mode 100644 index 2555a9ed64..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MultiSchemaDasConfig1.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - -
- -
diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MultiSchemaDasConfig12.xml b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MultiSchemaDasConfig12.xml deleted file mode 100644 index 63ac8230ce..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MultiSchemaDasConfig12.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - -
- -
diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MultiSchemaDasConfig13.xml b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MultiSchemaDasConfig13.xml deleted file mode 100644 index 6458108a63..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MultiSchemaDasConfig13.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - -
- - - -
- - - - - -
diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MultiSchemaDasConfig14.xml b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MultiSchemaDasConfig14.xml deleted file mode 100644 index 4b37a11138..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MultiSchemaDasConfig14.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - -
- - - -
- - - - - - - -
diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MultiSchemaDasConfig2.xml b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MultiSchemaDasConfig2.xml deleted file mode 100644 index d055735590..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MultiSchemaDasConfig2.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - -
- - - -
- - - - - -
diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MultiSchemaDasConfig3.xml b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MultiSchemaDasConfig3.xml deleted file mode 100644 index 06727c6a79..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MultiSchemaDasConfig3.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MultiSchemaDasConfig5.xml b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MultiSchemaDasConfig5.xml deleted file mode 100644 index 6915c69576..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MultiSchemaDasConfig5.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - -
- -
diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MultiSchemaDasConfig6.xml b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MultiSchemaDasConfig6.xml deleted file mode 100644 index fd3d177ad4..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MultiSchemaDasConfig6.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - -
- - - - -
- - -
diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MultiSchemaDasConfig7.xml b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MultiSchemaDasConfig7.xml deleted file mode 100644 index eab57c759e..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MultiSchemaDasConfig7.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MultiSchemaDasConfig8.xml b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MultiSchemaDasConfig8.xml deleted file mode 100644 index 205010c5c6..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MultiSchemaDasConfig8.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - -
- -
diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MultiSchemaDasConfig9.xml b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MultiSchemaDasConfig9.xml deleted file mode 100644 index 84a10531aa..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MultiSchemaDasConfig9.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - -
- -
diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MultiSchemaInvalidDasConfig.xml b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MultiSchemaInvalidDasConfig.xml deleted file mode 100644 index 4658493dbd..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/MultiSchemaInvalidDasConfig.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - -
- - - -
- - - -
- - - -
- - - -
- - - -
diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/OneToOneRestrictedConfig.xml b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/OneToOneRestrictedConfig.xml deleted file mode 100644 index 82956b5b1d..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/OneToOneRestrictedConfig.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - - - - - - - - - - -
- - - -
- - - -
- - - - - -
- diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/OrderDetailsAndDescription.xml b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/OrderDetailsAndDescription.xml deleted file mode 100644 index d5bc8d44a8..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/OrderDetailsAndDescription.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - -
- - - -
- - - - - -
diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/OrdersOrderDetailsConfig.xml b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/OrdersOrderDetailsConfig.xml deleted file mode 100644 index 2e998ee57e..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/OrdersOrderDetailsConfig.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - -
- - - -
- - - - - -
diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/PartsConfig.xml b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/PartsConfig.xml deleted file mode 100644 index b1809079d6..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/PartsConfig.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - -
diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/asciifile.txt b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/asciifile.txt deleted file mode 100644 index d3c922ab52..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/asciifile.txt +++ /dev/null @@ -1 +0,0 @@ -this is a long file \ No newline at end of file diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/basicCompanyDepartmentMapping.xml b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/basicCompanyDepartmentMapping.xml deleted file mode 100644 index bd648cd2ef..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/basicCompanyDepartmentMapping.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - -
- - - - - - - -
- - - - - -
diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/basicCompanyMapping.xml b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/basicCompanyMapping.xml deleted file mode 100644 index b6ca4f9feb..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/basicCompanyMapping.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - -
-
diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/basicCustomerMapping.xml b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/basicCustomerMapping.xml deleted file mode 100644 index a81ca90f8e..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/basicCustomerMapping.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - -
- -
diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/basicCustomerMappingWithCUD.xml b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/basicCustomerMappingWithCUD.xml deleted file mode 100644 index f27a50f4f3..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/basicCustomerMappingWithCUD.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - -
- -
diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/basicCustomerMappingWithCUD2.xml b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/basicCustomerMappingWithCUD2.xml deleted file mode 100644 index faddf3835b..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/basicCustomerMappingWithCUD2.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/basicCustomerMappingWithInvalidCUD.xml b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/basicCustomerMappingWithInvalidCUD.xml deleted file mode 100644 index 347cd53f45..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/basicCustomerMappingWithInvalidCUD.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/basicCustomerOrderMapping.xml b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/basicCustomerOrderMapping.xml deleted file mode 100644 index c03d9392ed..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/basicCustomerOrderMapping.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - -
- - - -
- - - - - -
- diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/basicStaticCustomer.xml b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/basicStaticCustomer.xml deleted file mode 100644 index c4b4fe56af..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/basicStaticCustomer.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - -
- -
diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/cityStates.xml b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/cityStates.xml deleted file mode 100644 index 1908ba4268..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/cityStates.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - -
- - - - - - - -
- - - - - - -
diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/company.xsd b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/company.xsd deleted file mode 100644 index 0bf0229201..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/company.xsd +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/companyMapping.xml b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/companyMapping.xml deleted file mode 100644 index 9388cf8264..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/companyMapping.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - -
- - - -
- - - -
- - - - - - - - - -
diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/companyMappingWithConverters.xml b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/companyMappingWithConverters.xml deleted file mode 100644 index 74c6e0619f..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/companyMappingWithConverters.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - -
- - - - -
- - - - -
- - - - - - - - - -
diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/companyMappingWithResultDescriptor.xml b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/companyMappingWithResultDescriptor.xml deleted file mode 100644 index 419f27eca3..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/companyMappingWithResultDescriptor.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - -
- - - -
- - - -
- - - - - - - - - -
diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/companynoid.xsd b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/companynoid.xsd deleted file mode 100644 index 7c301ff16a..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/companynoid.xsd +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/companynoidMappingWithConverters.xml b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/companynoidMappingWithConverters.xml deleted file mode 100644 index bfbefddd2f..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/companynoidMappingWithConverters.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - -
- - - - -
- - - - -
- - - - - - - - - -
diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/customer.xsd b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/customer.xsd deleted file mode 100644 index e5482ae3a0..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/customer.xsd +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/customerMapping.xml b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/customerMapping.xml deleted file mode 100644 index 3de367e0c6..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/customerMapping.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - -
- -
diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/customerMappingWithResultDescriptor.xml b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/customerMappingWithResultDescriptor.xml deleted file mode 100644 index 587c437423..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/customerMappingWithResultDescriptor.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - -
- -
diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/customerOrderRelationshipMapping.xml b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/customerOrderRelationshipMapping.xml deleted file mode 100644 index ed931e03cd..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/customerOrderRelationshipMapping.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - -
- - -
- - - - - -
- diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/moin-www.png b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/moin-www.png deleted file mode 100644 index 253471485a..0000000000 Binary files a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/moin-www.png and /dev/null differ diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/namedParameter.xml b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/namedParameter.xml deleted file mode 100644 index d0b0811e33..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/namedParameter.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/passiveConnection.xml b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/passiveConnection.xml deleted file mode 100644 index 6a23200d49..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/passiveConnection.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/staticCustomer.xml b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/staticCustomer.xml deleted file mode 100644 index 705e4b34a9..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/staticCustomer.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/staticCustomerOrder.xml b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/staticCustomerOrder.xml deleted file mode 100644 index afbe2a8cfb..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/staticCustomerOrder.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - -
- - - -
- - - - - -
diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/staticInvalid.xml b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/staticInvalid.xml deleted file mode 100644 index 965c99717f..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/staticInvalid.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/storedProcTest.xml b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/storedProcTest.xml deleted file mode 100644 index beb1ca34ac..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/resources/storedProcTest.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - -- cgit v1.2.3