summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlzhang2011-11-16 23:32:42 (EST)
committer mwu2011-11-16 23:32:42 (EST)
commit2a825db5b91188b6e5837037de06e277f197a0f0 (patch)
treeb01162ab2d5eeb2eebd92df6a0f0e208dd05c768
parent613915f582ae15167ad60ed472b15d8b9e907525 (diff)
downloadorg.eclipse.birt-2a825db5b91188b6e5837037de06e277f197a0f0.zip
org.eclipse.birt-2a825db5b91188b6e5837037de06e277f197a0f0.tar.gz
org.eclipse.birt-2a825db5b91188b6e5837037de06e277f197a0f0.tar.bz2
Checkin: update some test cases for TimeFunction "QTD,YTD,PreviousN"
-rw-r--r--data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/api/CubeFeaturesTest.java8
-rw-r--r--data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/PreviousNPeriodsFunctionTest.java20
-rw-r--r--data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/golden/QuarterToDateFunctionTest.testFunctions4.txt1
-rw-r--r--data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/golden/YearToDateFunctionTest.testFunctions4.txt9
-rw-r--r--data/org.eclipse.birt.data/src/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/PreviousNPeriodsFunction.java1
-rw-r--r--data/org.eclipse.birt.data/src/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/QuarterToDateFunction.java1
-rw-r--r--data/org.eclipse.birt.data/src/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/YearToDateFunction.java1
7 files changed, 22 insertions, 19 deletions
diff --git a/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/api/CubeFeaturesTest.java b/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/api/CubeFeaturesTest.java
index 68fd30f..0c8c5e0 100644
--- a/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/api/CubeFeaturesTest.java
+++ b/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/api/CubeFeaturesTest.java
@@ -8134,7 +8134,7 @@ public class CubeFeaturesTest extends BaseTestCase
timeFunction.setReferenceDate(referenceDate);
timeFunction.setBaseTimePeriod(timePeriod);
timeFunction.setTimeDimension("dimension1");
- timePeriod = new TimePeriod(3, TimePeriodType.MONTH);
+ timePeriod = new TimePeriod(-3, TimePeriodType.MONTH);
timeFunction.setRelativeTimePeriod(timePeriod);
Binding binding3 = new Binding("measure2");
@@ -8154,7 +8154,7 @@ public class CubeFeaturesTest extends BaseTestCase
timeFunction.setReferenceDate(referenceDate);
timeFunction.setBaseTimePeriod(timePeriod);
timeFunction.setTimeDimension("dimension1");
- timePeriod = new TimePeriod(3, TimePeriodType.MONTH);
+ timePeriod = new TimePeriod(-3, TimePeriodType.MONTH);
timeFunction.setRelativeTimePeriod(timePeriod);
Binding binding4 = new Binding("measure3");
@@ -8296,7 +8296,7 @@ public class CubeFeaturesTest extends BaseTestCase
timeFunction.setReferenceDate(referenceDate);
timeFunction.setBaseTimePeriod(timePeriod);
timeFunction.setTimeDimension("dimension1");
- timePeriod = new TimePeriod(3, TimePeriodType.MONTH);
+ timePeriod = new TimePeriod(-3, TimePeriodType.MONTH);
timeFunction.setRelativeTimePeriod(timePeriod);
IBinding binding2 = new Binding("measure1");
@@ -8364,7 +8364,7 @@ public class CubeFeaturesTest extends BaseTestCase
timeFunction.setReferenceDate(referenceDate);
timeFunction.setBaseTimePeriod(timePeriod);
timeFunction.setTimeDimension("dimension1");
- timePeriod = new TimePeriod(3, TimePeriodType.WEEK);
+ timePeriod = new TimePeriod(-3, TimePeriodType.WEEK);
timeFunction.setRelativeTimePeriod(timePeriod);
IBinding binding2 = new Binding("measure1");
diff --git a/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/PreviousNPeriodsFunctionTest.java b/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/PreviousNPeriodsFunctionTest.java
index e9d32b5..b658064 100644
--- a/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/PreviousNPeriodsFunctionTest.java
+++ b/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/PreviousNPeriodsFunctionTest.java
@@ -34,7 +34,7 @@ public class PreviousNPeriodsFunctionTest extends TestCase
TimeMember member = new TimeMember( values, levels );
TimeMember resultMember = TimeFunctionFactory.createParallelPeriodFunction( TimeMember.TIME_LEVEL_TYPE_YEAR,
- 1 )
+ -1 )
.getResult( member );
int[] result = new int[]{
2001, 3, 8, 7
@@ -58,7 +58,7 @@ public class PreviousNPeriodsFunctionTest extends TestCase
};
TimeMember member = new TimeMember( values, levels );
- TimeMember resultMember = TimeFunctionFactory.createParallelPeriodFunction( TimeMember.TIME_LEVEL_TYPE_QUARTER, 5 ).getResult( member );
+ TimeMember resultMember = TimeFunctionFactory.createParallelPeriodFunction( TimeMember.TIME_LEVEL_TYPE_QUARTER, -5 ).getResult( member );
int[] result = new int[]{
2001, 2, 5, 7
};
@@ -81,7 +81,7 @@ public class PreviousNPeriodsFunctionTest extends TestCase
};
TimeMember member = new TimeMember( values, levels );
- TimeMember resultMember = TimeFunctionFactory.createParallelPeriodFunction( TimeMember.TIME_LEVEL_TYPE_MONTH, 4 ).getResult( member );
+ TimeMember resultMember = TimeFunctionFactory.createParallelPeriodFunction( TimeMember.TIME_LEVEL_TYPE_MONTH, -4 ).getResult( member );
int[] result = new int[]{
2002, 2, 4, 7
};
@@ -104,7 +104,7 @@ public class PreviousNPeriodsFunctionTest extends TestCase
};
TimeMember member = new TimeMember( values, levels );
- TimeMember resultMember = TimeFunctionFactory.createParallelPeriodFunction( TimeMember.TIME_LEVEL_TYPE_DAY_OF_MONTH, 4 ).getResult( member );
+ TimeMember resultMember = TimeFunctionFactory.createParallelPeriodFunction( TimeMember.TIME_LEVEL_TYPE_DAY_OF_MONTH, -4 ).getResult( member );
int[] result = new int[]{
2002, 3, 8, 3
};
@@ -127,7 +127,7 @@ public class PreviousNPeriodsFunctionTest extends TestCase
};
TimeMember member = new TimeMember( values, levels );
- TimeMember resultMember = TimeFunctionFactory.createParallelPeriodFunction( TimeMember.TIME_LEVEL_TYPE_DAY_OF_MONTH, 10 ).getResult( member );
+ TimeMember resultMember = TimeFunctionFactory.createParallelPeriodFunction( TimeMember.TIME_LEVEL_TYPE_DAY_OF_MONTH, -10 ).getResult( member );
int[] result = new int[]{
2002, 3, 7, 28
};
@@ -149,7 +149,7 @@ public class PreviousNPeriodsFunctionTest extends TestCase
};
TimeMember member = new TimeMember( values, levels );
- TimeMember resultMember = TimeFunctionFactory.createParallelPeriodFunction( TimeMember.TIME_LEVEL_TYPE_DAY_OF_MONTH, 10 ).getResult( member );
+ TimeMember resultMember = TimeFunctionFactory.createParallelPeriodFunction( TimeMember.TIME_LEVEL_TYPE_DAY_OF_MONTH, -10 ).getResult( member );
int[] result = new int[]{
2002, 7, 28
};
@@ -170,9 +170,9 @@ public class PreviousNPeriodsFunctionTest extends TestCase
};
TimeMember member = new TimeMember( values, levels );
- TimeMember resultMember = TimeFunctionFactory.createParallelPeriodFunction( TimeMember.TIME_LEVEL_TYPE_WEEK_OF_MONTH, 5 ).getResult( member );
+ TimeMember resultMember = TimeFunctionFactory.createParallelPeriodFunction( TimeMember.TIME_LEVEL_TYPE_WEEK_OF_MONTH, -5 ).getResult( member );
int[] result = new int[]{
- 2002, 7, 3
+ 2002, 7, 2
};
assertEquals( resultMember.getMemberValue( )[0], result[0] );
assertEquals( resultMember.getMemberValue( )[1], result[1] );
@@ -190,7 +190,7 @@ public class PreviousNPeriodsFunctionTest extends TestCase
};
TimeMember member = new TimeMember( values, levels );
- TimeMember resultMember = TimeFunctionFactory.createParallelPeriodFunction( TimeMember.TIME_LEVEL_TYPE_DAY_OF_YEAR, 25 ).getResult( member );
+ TimeMember resultMember = TimeFunctionFactory.createParallelPeriodFunction( TimeMember.TIME_LEVEL_TYPE_DAY_OF_YEAR, -25 ).getResult( member );
int[] result = new int[]{
2002, 100
};
@@ -209,7 +209,7 @@ public class PreviousNPeriodsFunctionTest extends TestCase
};
TimeMember member = new TimeMember( values, levels );
- TimeMember resultMember = TimeFunctionFactory.createParallelPeriodFunction( TimeMember.TIME_LEVEL_TYPE_WEEK_OF_YEAR, 10 ).getResult( member );
+ TimeMember resultMember = TimeFunctionFactory.createParallelPeriodFunction( TimeMember.TIME_LEVEL_TYPE_WEEK_OF_YEAR, -10 ).getResult( member );
int[] result = new int[]{
2002, 13
};
diff --git a/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/golden/QuarterToDateFunctionTest.testFunctions4.txt b/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/golden/QuarterToDateFunctionTest.testFunctions4.txt
index 54b5c09..f6dfc3e 100644
--- a/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/golden/QuarterToDateFunctionTest.testFunctions4.txt
+++ b/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/golden/QuarterToDateFunctionTest.testFunctions4.txt
@@ -1,7 +1,6 @@
2002 3 8 3
2002 3 8 2
2002 3 8 1
-2002 3 7 5
2002 3 7 4
2002 3 7 3
2002 3 7 2
diff --git a/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/golden/YearToDateFunctionTest.testFunctions4.txt b/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/golden/YearToDateFunctionTest.testFunctions4.txt
index 94b2e01..8d766cd 100644
--- a/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/golden/YearToDateFunctionTest.testFunctions4.txt
+++ b/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/golden/YearToDateFunctionTest.testFunctions4.txt
@@ -2,24 +2,24 @@
2004 3 8 3
2004 3 8 2
2004 3 8 1
+2004 3 7 5
2004 3 7 4
2004 3 7 3
2004 3 7 2
2004 3 7 1
-2004 2 6 5
2004 2 6 4
2004 2 6 3
2004 2 6 2
2004 2 6 1
+2004 2 5 5
2004 2 5 4
2004 2 5 3
2004 2 5 2
-2004 2 5 1
+2004 2 4 5
2004 2 4 4
2004 2 4 3
2004 2 4 2
2004 2 4 1
-2004 1 3 5
2004 1 3 4
2004 1 3 3
2004 1 3 2
@@ -28,7 +28,8 @@
2004 1 2 3
2004 1 2 2
2004 1 2 1
+2004 1 1 5
2004 1 1 4
2004 1 1 3
2004 1 1 2
-2004 1 1 1
+2004 1 1 1 \ No newline at end of file
diff --git a/data/org.eclipse.birt.data/src/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/PreviousNPeriodsFunction.java b/data/org.eclipse.birt.data/src/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/PreviousNPeriodsFunction.java
index c561c1d..6714cc2 100644
--- a/data/org.eclipse.birt.data/src/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/PreviousNPeriodsFunction.java
+++ b/data/org.eclipse.birt.data/src/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/PreviousNPeriodsFunction.java
@@ -31,6 +31,7 @@ public class PreviousNPeriodsFunction extends AbstractMDX implements IParallelPe
Calendar cal = new GregorianCalendar( TimeMemberUtil.getTimeZone( ),
TimeMemberUtil.getDefaultLocale( ) );
+ cal.setMinimalDaysInFirstWeek(1);
translateToCal( cal, levels, values );
if ( levelName.equals( TimeMember.TIME_LEVEL_TYPE_YEAR ) )
diff --git a/data/org.eclipse.birt.data/src/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/QuarterToDateFunction.java b/data/org.eclipse.birt.data/src/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/QuarterToDateFunction.java
index f6cf54e..bdf043b 100644
--- a/data/org.eclipse.birt.data/src/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/QuarterToDateFunction.java
+++ b/data/org.eclipse.birt.data/src/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/QuarterToDateFunction.java
@@ -16,6 +16,7 @@ public class QuarterToDateFunction extends AbstractMDX implements IPeriodsFuncti
Calendar cal = new GregorianCalendar( TimeMemberUtil.getTimeZone( ),
TimeMemberUtil.getDefaultLocale( ) );
+ cal.setMinimalDaysInFirstWeek(1);
String calculateUnit = this.translateToCal( cal, levels, values ) ;
List<TimeMember> list = new ArrayList<TimeMember>( );
diff --git a/data/org.eclipse.birt.data/src/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/YearToDateFunction.java b/data/org.eclipse.birt.data/src/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/YearToDateFunction.java
index 5c8c7ff..f056a6d 100644
--- a/data/org.eclipse.birt.data/src/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/YearToDateFunction.java
+++ b/data/org.eclipse.birt.data/src/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/YearToDateFunction.java
@@ -16,6 +16,7 @@ public class YearToDateFunction extends AbstractMDX implements IPeriodsFunction
Calendar cal = new GregorianCalendar( TimeMemberUtil.getTimeZone( ),
TimeMemberUtil.getDefaultLocale( ) );
+ cal.setMinimalDaysInFirstWeek(1);
String calculateUnit = this.translateToCal( cal, levels, values ) ;
List<TimeMember> list = new ArrayList<TimeMember>( );