File: Queue.t

package info (click to toggle)
otrs2 2.2.7-2lenny3
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 13,444 kB
  • ctags: 5,808
  • sloc: perl: 129,825; xml: 16,139; sql: 11,400; sh: 1,198; makefile: 31; php: 16
file content (151 lines) | stat: -rw-r--r-- 3,056 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# --
# Queue.t - Queue tests
# Copyright (C) 2001-2007 OTRS GmbH, http://otrs.org/
# --
# $Id: Queue.t,v 1.4 2007/03/16 09:59:24 martin Exp $
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see http://www.gnu.org/licenses/gpl.txt.
# --

use Kernel::System::Queue;

$Self->{QueueObject} = Kernel::System::Queue->new(%{$Self});

my $QueueRand = 'Some::Queue'.int(rand(1000000));
my $QueueID = $Self->{QueueObject}->QueueAdd(
    Name => $QueueRand,
    ValidID => 1,
    GroupID => 1,
    FirstResponseTime => 30,
    UpdateTime => 240,
    SolutionTime => 2440,
    SystemAddressID => 1,
    SalutationID => 1,
    SignatureID => 1,
    UserID => 1,
    MoveNotify => 0,
    StateNotify => 0,
    LockNotify => 0,
    OwnerNotify => 0,
    Comment => 'Some Comment',
);

$Self->True(
    $QueueID,
    'QueueAdd()',
);

my %QueueGet = $Self->{QueueObject}->QueueGet(
    ID => $QueueID,
);

$Self->True(
    $QueueGet{Name} eq $QueueRand,
    'QueueGet() - Name',
);
$Self->True(
    $QueueGet{ValidID} eq 1,
    'QueueGet() - ValidID',
);
$Self->True(
    $QueueGet{Calendar} eq '',
    'QueueGet() - Calendar',
);
$Self->True(
    $QueueGet{Comment} eq 'Some Comment',
    'QueueGet() - Comment',
);
$Self->True(
    $QueueGet{FirstResponseTime} eq 30,
    'QueueGet() - FirstResponseTime',
);

$Self->True(
    $QueueGet{UpdateTime} eq 240,
    'QueueGet() - UpdateTime',
);

$Self->True(
    $QueueGet{SolutionTime} eq 2440,
    'QueueGet() - SolutionTime',
);

my $QueueUpdate = $Self->{QueueObject}->QueueUpdate(
    QueueID => $QueueID,
    Name => $QueueRand."1",
    ValidID => 2,
    GroupID => 1,
    Calendar => 1,
    FirstResponseTime => 60,
    UpdateTime => 480,
    SolutionTime => 4880,
    SystemAddressID => 1,
    SalutationID => 1,
    SignatureID => 1,
    FollowUpID => 1,
    UserID => 1,
    MoveNotify => 0,
    StateNotify => 0,
    LockNotify => 0,
    OwnerNotify => 0,
    Comment => 'Some Comment1',
);

$Self->True(
    $QueueUpdate,
    'QueueUpdate()',
);

%QueueGet = $Self->{QueueObject}->QueueGet(
    ID => $QueueID,
);

$Self->True(
    $QueueGet{Name} eq $QueueRand."1",
    'QueueGet() - Name',
);
$Self->True(
    $QueueGet{ValidID} eq 2,
    'QueueGet() - ValidID',
);
$Self->True(
    $QueueGet{Calendar} eq 1,
    'QueueGet() - Calendar',
);
$Self->True(
    $QueueGet{Comment} eq 'Some Comment1',
    'QueueGet() - Comment',
);

$Self->True(
    $QueueGet{FirstResponseTime} eq 60,
    'QueueGet() - FirstResponseTime',
);

$Self->True(
    $QueueGet{UpdateTime} eq 480,
    'QueueGet() - UpdateTime',
);

$Self->True(
    $QueueGet{SolutionTime} eq 4880,
    'QueueGet() - SolutionTime',
);

my $Queue = $Self->{QueueObject}->QueueLookup(QueueID => $QueueID);

$Self->True(
    $Queue eq $QueueRand."1",
    'QueueLookup() by ID',
);

my $QueueIDLookup = $Self->{QueueObject}->QueueLookup(Queue => $Queue);

$Self->True(
    $QueueID eq $QueueIDLookup,
    'QueueLookup() by Name',
);

1;