3232package com .rabbitmq .client .test .functional ;
3333
3434import java .io .IOException ;
35- import java .lang .InterruptedException ;
36- import java .util .Map ;
3735import java .util .HashMap ;
36+ import java .util .Map ;
3837
39- import com .rabbitmq .client .AMQP ;
4038import com .rabbitmq .client .test .BrokerTestCase ;
4139
4240public class QueueLeaseExpires extends BrokerTestCase {
@@ -47,12 +45,12 @@ public class QueueLeaseExpires extends BrokerTestCase {
4745
4846 // Currently the expiration timer is very responsive but this may
4947 // very well change in the future, so tweak accordingly.
50- private final static long QUEUE_EXPIRES = 1000L ; // msecs
48+ private final static long QUEUE_EXPIRES = 1000L ; // msecs
5149 private final static int SHOULD_EXPIRE_WITHIN = 2000 ;
5250
5351 /**
54- * Verify that a queue with the 'x-expires` flag is actually
55- * deleted within a sensible period of time after expiry.
52+ * Verify that a queue with the 'x-expires` flag is actually deleted within
53+ * a sensible period of time after expiry.
5654 */
5755 public void testQueueExpires () throws IOException , InterruptedException {
5856 verifyQueueExpires (TEST_EXPIRE_QUEUE , true );
@@ -62,75 +60,81 @@ public void testQueueExpires() throws IOException, InterruptedException {
6260 * Verify that the server does not delete normal queues... ;)
6361 */
6462 public void testDoesNotExpireOthers () throws IOException ,
65- InterruptedException {
63+ InterruptedException {
6664 verifyQueueExpires (TEST_NORMAL_QUEUE , false );
6765 }
6866
6967 /**
70- * Verify that the server throws an error if the type of x-expires
71- * is not long.
68+ * Verify that the server throws an error if the type of x-expires is not
69+ * long.
7270 */
7371 public void testExpireMustBeLong () throws IOException {
7472 Map <String , Object > args = new HashMap <String , Object >();
7573 args .put ("x-expires" , 100 );
7674
7775 try {
78- channel .queueDeclare ("expiresMustBeLong" ,
79- false , false , false , args );
76+ channel
77+ .queueDeclare ("expiresMustBeLong" , false , false , false ,
78+ args );
8079 fail ("server accepted x-expires not of type long" );
81- } catch (IOException e ) { }
80+ } catch (IOException e ) {
81+ }
8282 }
8383
8484 public void testExpireMustBeGtZero () throws IOException {
8585 Map <String , Object > args = new HashMap <String , Object >();
8686 args .put ("x-expires" , 0L );
8787
8888 try {
89- channel .queueDeclare ("expiresMustBeGtZero" ,
90- false , false , false , args );
89+ channel .queueDeclare ("expiresMustBeGtZero" , false , false , false ,
90+ args );
9191 fail ("server accepted x-expires of zero ms." );
92- } catch (IOException e ) { }
92+ } catch (IOException e ) {
93+ }
9394 }
9495
9596 public void testExpireMustBePositive () throws IOException {
9697 Map <String , Object > args = new HashMap <String , Object >();
9798 args .put ("x-expires" , -10L );
9899
99100 try {
100- channel .queueDeclare ("expiresMustBePositive" ,
101- false , false , false , args );
101+ channel .queueDeclare ("expiresMustBePositive" , false , false , false ,
102+ args );
102103 fail ("server accepted negative x-expires." );
103- } catch (IOException e ) { }
104+ } catch (IOException e ) {
105+ }
104106 }
105107
106108 /**
107- * Verify that the server throws an error if the client redeclares
108- * a queue with mismatching 'x-expires' values.
109+ * Verify that the server throws an error if the client redeclares a queue
110+ * with mismatching 'x-expires' values.
109111 */
110112 public void testQueueRedeclareEquivalence () throws IOException {
111113 Map <String , Object > args1 = new HashMap <String , Object >();
112114 args1 .put ("x-expires" , 10000L );
113115 Map <String , Object > args2 = new HashMap <String , Object >();
114116 args2 .put ("x-expires" , 20000L );
115117
116- channel .queueDeclare (TEST_EXPIRE_REDECLARE_QUEUE ,
117- false , false , false , args1 );
118+ channel .queueDeclare (TEST_EXPIRE_REDECLARE_QUEUE , false , false , false ,
119+ args1 );
118120
119121 try {
120- channel .queueDeclare (TEST_EXPIRE_REDECLARE_QUEUE ,
121- false , false , false , args2 );
122+ channel .queueDeclare (TEST_EXPIRE_REDECLARE_QUEUE , false , false ,
123+ false , args2 );
122124 fail ("Able to redeclare queue with mismatching expire flags." );
123- } catch (IOException e ) { }
125+ } catch (IOException e ) {
126+ }
124127 }
125128
126- void verifyQueueExpires (String name , boolean expire )
127- throws IOException , InterruptedException {
129+ void verifyQueueExpires (String name , boolean expire ) throws IOException ,
130+ InterruptedException {
128131 int interval = SHOULD_EXPIRE_WITHIN / 4 ;
129132
130133 Map <String , Object > args = new HashMap <String , Object >();
131134 if (expire ) {
132135 args .put ("x-expires" , QUEUE_EXPIRES );
133- };
136+ }
137+ ;
134138
135139 channel .queueDeclare (name , false , false , false , args );
136140
@@ -161,7 +165,8 @@ protected void releaseResources() throws IOException {
161165 channel .queueDelete (TEST_NORMAL_QUEUE );
162166 channel .queueDelete (TEST_EXPIRE_QUEUE );
163167 channel .queueDelete (TEST_EXPIRE_REDECLARE_QUEUE );
164- } catch (IOException e ) { }
168+ } catch (IOException e ) {
169+ }
165170
166171 super .releaseResources ();
167172 }
0 commit comments