KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > activemq > filter > DestinationMapMemoryTest


1 /**
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one or more
4  * contributor license agreements. See the NOTICE file distributed with
5  * this work for additional information regarding copyright ownership.
6  * The ASF licenses this file to You under the Apache License, Version 2.0
7  * (the "License"); you may not use this file except in compliance with
8  * the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18 package org.apache.activemq.filter;
19
20 import junit.framework.TestCase;
21 import org.apache.activemq.command.ActiveMQDestination;
22 import org.apache.activemq.command.ActiveMQTopic;
23
24 public class DestinationMapMemoryTest extends TestCase {
25
26
27     public void testLongDestinationPath() throws Exception JavaDoc {
28         ActiveMQTopic d1 = new ActiveMQTopic("1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18");
29         DestinationMap map = new DestinationMap();
30         map.put(d1, d1);
31     }
32
33     public void testVeryLongestinationPaths() throws Exception JavaDoc {
34
35         for (int i = 1; i < 100; i++) {
36             String JavaDoc name = "1";
37             for (int j = 2; j <= i; j++) {
38                 name += "." + j;
39             }
40             //System.out.println("Checking: " + name);
41
try {
42                 ActiveMQDestination d1 = createDestination(name);
43                 DestinationMap map = new DestinationMap();
44                 map.put(d1, d1);
45             }
46             catch (Throwable JavaDoc e) {
47                 fail("Destination name too long: " + name + " : " + e);
48             }
49         }
50     }
51
52     protected ActiveMQDestination createDestination(String JavaDoc name) {
53         return new ActiveMQTopic(name);
54     }
55 }
56
Popular Tags