@ -30,6 +30,7 @@ use NGCP::Panel::Utils::DateTime qw();
my $ is_local_env = 0 ;
my $ is_local_env = 0 ;
my $ disable_parallel_catchup = 1 ;
my $ disable_parallel_catchup = 1 ;
my $ disable_hourly_intervals = 1 ;
#my $enable_profile_packages = NGCP::Panel::Utils::ProfilePackages::ENABLE_PROFILE_PACKAGES;
#my $enable_profile_packages = NGCP::Panel::Utils::ProfilePackages::ENABLE_PROFILE_PACKAGES;
#my $enable_profile_packages = 1;
#my $enable_profile_packages = 1;
@ -150,71 +151,73 @@ if (_get_allow_fake_client_time()) { # && $enable_profile_packages) {
#goto SKIP;
#goto SKIP;
#goto THREADED;
#goto THREADED;
if ( 'Europe/Vienna' eq NGCP::Panel::Utils::DateTime:: current_local ( ) - > time_zone - > name ) {
if ( 'Europe/Vienna' eq NGCP::Panel::Utils::DateTime:: current_local ( ) - > time_zone - > name ) {
my $ package = _create_profile_package ( 'create' , 'hour' , 1 ) ;
if ( ! $ disable_hourly_intervals ) {
my $ package = _create_profile_package ( 'create' , 'hour' , 1 ) ;
{
my $ dt = NGCP::Panel::Utils::DateTime:: from_string ( '2015-03-29 01:27:00' ) ;
{
ok ( ! $ dt - > is_dst ( ) , NGCP::Panel::Utils::DateTime:: to_string ( $ dt ) . " is not in daylight saving time (winter)" ) ;
my $ dt = NGCP::Panel::Utils::DateTime:: from_string ( '2015-03-29 01:27:00' ) ;
_set_time ( $ dt ) ;
ok ( ! $ dt - > is_dst ( ) , NGCP::Panel::Utils::DateTime:: to_string ( $ dt ) . " is not in daylight saving time (winter)" ) ;
my $ customer = _create_customer ( $ package , 'hourly_interval_dst_at' ) ;
_set_time ( $ dt ) ;
my $ customer = _create_customer ( $ package , 'hourly_interval_dst_at' ) ;
_check_interval_history ( $ customer , [
{ start = > '2015-03-29 00:00:00' , stop = > '2015-03-29 00:59:59' } ,
_check_interval_history ( $ customer , [
{ start = > '2015-03-29 01:00:00' , stop = > '2015-03-29 01:59:59' } ,
{ start = > '2015-03-29 00:00:00' , stop = > '2015-03-29 00:59:59' } ,
] ) ;
{ start = > '2015-03-29 01:00:00' , stop = > '2015-03-29 01:59:59' } ,
] ) ;
$ dt = NGCP::Panel::Utils::DateTime:: from_string ( '2015-03-29 03:27:00' ) ;
ok ( $ dt - > is_dst ( ) , NGCP::Panel::Utils::DateTime:: to_string ( $ dt ) . " is in daylight saving time (summer)" ) ;
$ dt = NGCP::Panel::Utils::DateTime:: from_string ( '2015-03-29 03:27:00' ) ;
_set_time ( $ dt ) ;
ok ( $ dt - > is_dst ( ) , NGCP::Panel::Utils::DateTime:: to_string ( $ dt ) . " is in daylight saving time (summer)" ) ;
_set_time ( $ dt ) ;
_check_interval_history ( $ customer , [
{ start = > '2015-03-29 00:00:00' , stop = > '2015-03-29 00:59:59' } ,
_check_interval_history ( $ customer , [
{ start = > '2015-03-29 01:00:00' , stop = > '2015-03-29 01:59:59' } ,
{ start = > '2015-03-29 00:00:00' , stop = > '2015-03-29 00:59:59' } ,
#{ start => '2015-03-29 02:00:00', stop => '2015-03-29 02:59:59' }, #a dead one
{ start = > '2015-03-29 01:00:00' , stop = > '2015-03-29 01:59:59' } ,
{ start = > '2015-03-29 03:00:00' , stop = > '2015-03-29 03:59:59' } ,
#{ start => '2015-03-29 02:00:00', stop => '2015-03-29 02:59:59' }, #a dead one
] ) ;
{ start = > '2015-03-29 03:00:00' , stop = > '2015-03-29 03:59:59' } ,
] ) ;
_set_time ( ) ;
}
_set_time ( ) ;
{
}
my $ dt = NGCP::Panel::Utils::DateTime:: from_string ( '2015-10-25 01:27:00' ) ;
{
ok ( $ dt - > is_dst ( ) , NGCP::Panel::Utils::DateTime:: to_string ( $ dt ) . " is in daylight saving time (summer)" ) ;
my $ dt = NGCP::Panel::Utils::DateTime:: from_string ( '2015-10-25 01:27:00' ) ;
_set_time ( $ dt ) ;
ok ( $ dt - > is_dst ( ) , NGCP::Panel::Utils::DateTime:: to_string ( $ dt ) . " is in daylight saving time (summer)" ) ;
my $ customer = _create_customer ( $ package , 'hourly_interval_dst_at' ) ;
_set_time ( $ dt ) ;
my $ customer = _create_customer ( $ package , 'hourly_interval_dst_at' ) ;
_check_interval_history ( $ customer , [
{ start = > '2015-10-25 00:00:00' , stop = > '2015-10-25 00:59:59' } ,
_check_interval_history ( $ customer , [
{ start = > '2015-10-25 01:00:00' , stop = > '2015-10-25 01:59:59' } ,
{ start = > '2015-10-25 00:00:00' , stop = > '2015-10-25 00:59:59' } ,
] ) ;
{ start = > '2015-10-25 01:00:00' , stop = > '2015-10-25 01:59:59' } ,
] ) ;
#$dt = NGCP::Panel::Utils::DateTime::from_string('2015-10-25 02:27:00');
#ok(!$dt->is_dst(),NGCP::Panel::Utils::DateTime::to_string($dt)." is not in daylight saving time (winter)");
#$dt = NGCP::Panel::Utils::DateTime::from_string('2015-10-25 02:27:00');
#_set_time($dt);
#ok(!$dt->is_dst(),NGCP::Panel::Utils::DateTime::to_string($dt)." is not in daylight saving time (winter)");
#
#_set_time($dt);
#_check_interval_history($customer,[
#
# { start => '2015-10-25 00:00:00', stop => '2015-10-25 00:59:59' },
#_check_interval_history($customer,[
# { start => '2015-10-25 01:00:00', stop => '2015-10-25 01:59:59' },
# { start => '2015-10-25 00:00:00', stop => '2015-10-25 00:59:59' },
# { start => '2015-10-25 02:00:00', stop => '2015-10-25 02:59:59' },
# { start => '2015-10-25 01:00:00', stop => '2015-10-25 01:59:59' },
#]);
# { start => '2015-10-25 02:00:00', stop => '2015-10-25 02:59:59' },
#]);
$ dt = NGCP::Panel::Utils::DateTime:: from_string ( '2015-10-25 03:27:00' ) ;
ok ( ! $ dt - > is_dst ( ) , NGCP::Panel::Utils::DateTime:: to_string ( $ dt ) . " is not in daylight saving time (winter)" ) ;
$ dt = NGCP::Panel::Utils::DateTime:: from_string ( '2015-10-25 03:27:00' ) ;
_set_time ( $ dt ) ;
ok ( ! $ dt - > is_dst ( ) , NGCP::Panel::Utils::DateTime:: to_string ( $ dt ) . " is not in daylight saving time (winter)" ) ;
_set_time ( $ dt ) ;
_check_interval_history ( $ customer , [
{ start = > '2015-10-25 00:00:00' , stop = > '2015-10-25 00:59:59' } ,
_check_interval_history ( $ customer , [
{ start = > '2015-10-25 01:00:00' , stop = > '2015-10-25 01:59:59' } ,
{ start = > '2015-10-25 00:00:00' , stop = > '2015-10-25 00:59:59' } ,
{ start = > '2015-10-25 02:00:00' , stop = > '2015-10-25 02:59:59' } ,
{ start = > '2015-10-25 01:00:00' , stop = > '2015-10-25 01:59:59' } ,
{ start = > '2015-10-25 03:00:00' , stop = > '2015-10-25 03:59:59' } ,
{ start = > '2015-10-25 02:00:00' , stop = > '2015-10-25 02:59:59' } ,
] ) ;
{ start = > '2015-10-25 03:00:00' , stop = > '2015-10-25 03:59:59' } ,
] ) ;
_set_time ( ) ;
_set_time ( ) ;
}
}
}
} else {
} else {
diag ( "time zone '" . NGCP::Panel::Utils::DateTime:: current_local ( ) - > time_zone - > name . "', skipping DST test" ) ;
diag ( "time zone '" . NGCP::Panel::Utils::DateTime:: current_local ( ) - > time_zone - > name . "', skipping DST test" ) ;
}
}
{
if ( ! $ disable_hourly_intervals ) {
my $ package = _create_profile_package ( 'create' , 'hour' , 1 ) ;
my $ package = _create_profile_package ( 'create' , 'hour' , 1 ) ;
_set_time ( NGCP::Panel::Utils::DateTime:: from_string ( '2015-09-02 01:59:41' ) ) ;
_set_time ( NGCP::Panel::Utils::DateTime:: from_string ( '2015-09-02 01:59:41' ) ) ;
@ -237,7 +240,7 @@ if (_get_allow_fake_client_time()) { # && $enable_profile_packages) {
_set_time ( ) ;
_set_time ( ) ;
}
}
{
if ( ! $ disable_hourly_intervals ) {
my $ package = _create_profile_package ( 'create' , 'minute' , 1 ) ;
my $ package = _create_profile_package ( 'create' , 'minute' , 1 ) ;
_set_time ( NGCP::Panel::Utils::DateTime:: from_string ( '2015-09-03 00:01:41' ) ) ;
_set_time ( NGCP::Panel::Utils::DateTime:: from_string ( '2015-09-03 00:01:41' ) ) ;
@ -825,13 +828,14 @@ if (_get_allow_fake_client_time()) { # && $enable_profile_packages) {
undef $ gantt_events ;
undef $ gantt_events ;
}
}
#SKIP:
{
{
_set_time ( NGCP::Panel::Utils::DateTime:: from_string ( '2015-01-30 13:00:00' ) ) ;
_set_time ( NGCP::Panel::Utils::DateTime:: from_string ( '2015-01-30 13:00:00' ) ) ;
my $ profile_underrun = _create_billing_profile ( 'UNDERRUN_NOTOPUP' ) ;
my $ profile_underrun = _create_billing_profile ( 'UNDERRUN_NOTOPUP' ) ;
my $ profile_topup = _create_billing_profile ( 'TOPUP_NOTOPUP' ) ;
my $ profile_topup = _create_billing_profile ( 'TOPUP_NOTOPUP' ) ;
my $ package = _create_profile_package ( 'create' , 'month' , 1 , notopup_discard_intervals = > 3 ,
my $ package = _create_profile_package ( 'create' , 'month' , 1 , notopup_discard_intervals = > 2 ,
initial_balance = > 0 , carry_over_mode = > 'carry_over' ,
initial_balance = > 0 , carry_over_mode = > 'carry_over' ,
topup_profiles = > [ { profile_id = > $ profile_topup - > { id } , } , ] ,
topup_profiles = > [ { profile_id = > $ profile_topup - > { id } , } , ] ,
underrun_profile_threshold = > 1 , underrun_profiles = > [ { profile_id = > $ profile_underrun - > { id } , } , ] , ) ;
underrun_profile_threshold = > 1 , underrun_profiles = > [ { profile_id = > $ profile_underrun - > { id } , } , ] , ) ;
@ -849,7 +853,7 @@ if (_get_allow_fake_client_time()) { # && $enable_profile_packages) {
{ start = > '2015-01-30 00:00:00' , stop = > '2015-02-27 23:59:59' , cash = > 10 , topups = > 1 , profile = > $ profile_underrun - > { id } } , #topup
{ start = > '2015-01-30 00:00:00' , stop = > '2015-02-27 23:59:59' , cash = > 10 , topups = > 1 , profile = > $ profile_underrun - > { id } } , #topup
{ start = > '2015-02-28 00:00:00' , stop = > '2015-03-29 23:59:59' , cash = > 10 , topups = > 0 , profile = > $ profile_topup - > { id } } ,
{ start = > '2015-02-28 00:00:00' , stop = > '2015-03-29 23:59:59' , cash = > 10 , topups = > 0 , profile = > $ profile_topup - > { id } } ,
{ start = > '2015-03-30 00:00:00' , stop = > '2015-04-29 23:59:59' , cash = > 10 , topups = > 0 , profile = > $ profile_topup - > { id } } ,
{ start = > '2015-03-30 00:00:00' , stop = > '2015-04-29 23:59:59' , cash = > 10 , topups = > 0 , profile = > $ profile_topup - > { id } } ,
{ start = > '2015-04-30 00:00:00' , stop = > '2015-05-29 23:59:59' , cash = > 1 0, topups = > 0 , profile = > $ profile_ topup - > { id } } ,
{ start = > '2015-04-30 00:00:00' , stop = > '2015-05-29 23:59:59' , cash = > 0, topups = > 0 , profile = > $ profile_ underrun - > { id } } , #'notopup_discard_expiry' => '2015-04-30 00:00:00'
{ start = > '2015-05-30 00:00:00' , stop = > '2015-06-29 23:59:59' , cash = > 0 , topups = > 0 , profile = > $ profile_underrun - > { id } } ,
{ start = > '2015-05-30 00:00:00' , stop = > '2015-06-29 23:59:59' , cash = > 0 , topups = > 0 , profile = > $ profile_underrun - > { id } } ,
#{ start => '2015-06-30 00:00:00', stop => '2015-07-29 23:59:59', cash => 0, topups => 0 },
#{ start => '2015-06-30 00:00:00', stop => '2015-07-29 23:59:59', cash => 0, topups => 0 },
] ) ;
] ) ;