@@ -46,7 +46,7 @@ public class QueueLease extends BrokerTestCase {
46
46
47
47
// Currently the expiration timer is very responsive but this may
48
48
// very well change in the future, so tweak accordingly.
49
- private final static long QUEUE_EXPIRES = 1000L ; // msecs
49
+ private final static int QUEUE_EXPIRES = 1000 ; // msecs
50
50
private final static int SHOULD_EXPIRE_WITHIN = 2000 ;
51
51
52
52
/**
@@ -65,27 +65,42 @@ public void testDoesNotExpireOthers() throws IOException,
65
65
verifyQueueExpires (TEST_NORMAL_QUEUE , false );
66
66
}
67
67
68
- /**
69
- * Verify that the server throws an error if the type of x-expires is not
70
- * long.
71
- */
72
- public void testExpireMustBeLong () throws IOException {
68
+ public void testExpireMayBeByte () throws IOException {
73
69
Map <String , Object > args = new HashMap <String , Object >();
74
- args .put ("x-expires" , 100 );
70
+ args .put ("x-expires" , ( byte ) 100 );
75
71
76
72
try {
77
- channel
78
- .queueDeclare ("expiresMustBeLong" , false , false , false ,
79
- args );
80
- fail ("server accepted x-expires not of type long" );
73
+ channel .queueDeclare ("expiresMayBeByte" , false , true , false , args );
81
74
} catch (IOException e ) {
82
- checkShutdownSignal (AMQP .PRECONDITION_FAILED , e );
75
+ fail ("server did not accept x-expires of type byte" );
76
+ }
77
+ }
78
+
79
+ public void testExpireMayBeShort () throws IOException {
80
+ Map <String , Object > args = new HashMap <String , Object >();
81
+ args .put ("x-expires" , (short )100 );
82
+
83
+ try {
84
+ channel .queueDeclare ("expiresMayBeShort" , false , true , false , args );
85
+ } catch (IOException e ) {
86
+ fail ("server did not accept x-expires of type short" );
87
+ }
88
+ }
89
+
90
+ public void testExpireMayBeLong () throws IOException {
91
+ Map <String , Object > args = new HashMap <String , Object >();
92
+ args .put ("x-expires" , 100L );
93
+
94
+ try {
95
+ channel .queueDeclare ("expiresMayBeLong" , false , true , false , args );
96
+ } catch (IOException e ) {
97
+ fail ("server did not accept x-expires of type long" );
83
98
}
84
99
}
85
100
86
101
public void testExpireMustBeGtZero () throws IOException {
87
102
Map <String , Object > args = new HashMap <String , Object >();
88
- args .put ("x-expires" , 0L );
103
+ args .put ("x-expires" , 0 );
89
104
90
105
try {
91
106
channel .queueDeclare ("expiresMustBeGtZero" , false , false , false ,
@@ -98,7 +113,7 @@ public void testExpireMustBeGtZero() throws IOException {
98
113
99
114
public void testExpireMustBePositive () throws IOException {
100
115
Map <String , Object > args = new HashMap <String , Object >();
101
- args .put ("x-expires" , -10L );
116
+ args .put ("x-expires" , -10 );
102
117
103
118
try {
104
119
channel .queueDeclare ("expiresMustBePositive" , false , false , false ,
@@ -115,9 +130,9 @@ public void testExpireMustBePositive() throws IOException {
115
130
*/
116
131
public void testQueueRedeclareEquivalence () throws IOException {
117
132
Map <String , Object > args1 = new HashMap <String , Object >();
118
- args1 .put ("x-expires" , 10000L );
133
+ args1 .put ("x-expires" , 10000 );
119
134
Map <String , Object > args2 = new HashMap <String , Object >();
120
- args2 .put ("x-expires" , 20000L );
135
+ args2 .put ("x-expires" , 20000 );
121
136
122
137
channel .queueDeclare (TEST_EXPIRE_REDECLARE_QUEUE , false , false , false ,
123
138
args1 );
@@ -145,6 +160,7 @@ void verifyQueueExpires(String name, boolean expire) throws IOException,
145
160
try {
146
161
channel .queueDeclarePassive (name );
147
162
} catch (IOException e ) {
163
+ checkShutdownSignal (AMQP .NOT_FOUND , e );
148
164
fail ("Queue expired before deadline." );
149
165
}
150
166
0 commit comments