Skip to content

Commit

Permalink
Add Product.xml test
Browse files Browse the repository at this point in the history
  • Loading branch information
raczeja committed Feb 10, 2021
1 parent 2afc9ef commit d000041
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test-definitions/key_comparator/Product/Product.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<cmpSqlResultsTest>
<compare mode="KEY" diffTableSize="5" chunk="0" fileOutputOn="true" keyColumns="1,2">
<sql datasourceName="SQL_SERVER" filename="product.sql" keyTableName="AdventureWorks2008R2.dbo.TemplateKeyComparatorCheckAggregators" keyTableColumns="StoreNumber INTEGER not NULL, ProductID INTEGER not NULL" />
<beforeSqls>
<sql datasourceName="SQL_SERVER" filename="drop.sql"/>
<sql datasourceName="SQL_SERVER" filename="create.sql"/>
<sql datasourceName="SQL_SERVER" filename="insert.sql"/>
</beforeSqls>
<file filename="product.csv" separator=";" startAtRow="2" ignoredColumns="1" threadColumn="1">
<transformers>
<transformer column="2">REMOVE_LEADING_ZEROS</transformer>
</transformers>
<aggregators>
<condition column="4" conditionValue="0">NOT_EQUALS</condition>
<aggregator column="3" params="yyyy-MM-dd;gt">DATE</aggregator>
<aggregator column="4">SUM_INTEGERS</aggregator>
</aggregators>
</file>
</compare>
</cmpSqlResultsTest>
9 changes: 9 additions & 0 deletions test-definitions/key_comparator/Product/create.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
CREATE TABLE [dbo].[TemplateKeyComparatorProducts](
[StoreNumber] [int] NOT NULL,
[ProductID] [int] NULL,
[Date] [date] NOT NULL,
[Quantity] [int] NOT NULL)




1 change: 1 addition & 0 deletions test-definitions/key_comparator/Product/drop.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
drop table [dbo].[TemplateKeyComparatorProducts]
12 changes: 12 additions & 0 deletions test-definitions/key_comparator/Product/insert.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

INSERT INTO [dbo].[TemplateKeyComparatorProducts]
([StoreNumber]
,[ProductID]
,[Date]
,[Quantity])
VALUES
(11,123 ,'2020-09-09',300),
(12,124 ,'2020-09-10',400)



5 changes: 5 additions & 0 deletions test-definitions/key_comparator/Product/product.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
TestSet;Store;Product;Date;Qty
1;11;00123;2020-09-08;100
1;11;00123;2020-09-09;200
2;12;00124;2020-09-08;200
2;12;00124;2020-09-10;200
8 changes: 8 additions & 0 deletions test-definitions/key_comparator/Product/product.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
SELECT
pr.[StoreNumber]
,pr.ProductID
,pr.[Date]
,sum(pr.[Quantity])
FROM [dbo].[TemplateKeyComparatorProducts] pr
inner join AdventureWorks2008R2.dbo.TemplateKeyComparatorCheckAggregators d on d.[StoreNumber]=pr.[StoreNumber] and d.ProductID=pr.ProductID
group by pr.[StoreNumber],pr.ProductID,pr.Date

0 comments on commit d000041

Please sign in to comment.