KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > roller > util > rome > DiskFeedInfoCacheTest


1 /*
2  * Copyright 2005 Sun Microsystems, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.roller.util.rome;
18
19 import java.net.URL JavaDoc;
20
21 import junit.framework.Test;
22 import junit.framework.TestCase;
23 import junit.framework.TestSuite;
24
25 import org.roller.business.FileManagerTest;
26 import org.roller.util.rome.DiskFeedInfoCache;
27 import com.sun.syndication.fetcher.impl.SyndFeedInfo;
28
29 /**
30  * @author David M Johnson
31  */

32 public class DiskFeedInfoCacheTest extends TestCase
33 {
34     public static void main(String JavaDoc[] args)
35     {
36         junit.textui.TestRunner.run(DiskFeedInfoCacheTest.class);
37     }
38
39     public void testCache() throws Exception JavaDoc
40     {
41         URL JavaDoc url = new URL JavaDoc("http://cnn.com");
42         SyndFeedInfo info = new SyndFeedInfo();
43         info.setUrl(url);
44         
45         DiskFeedInfoCache cache = new DiskFeedInfoCache("./cache");
46         cache.setFeedInfo(info.getUrl(), info);
47         
48         SyndFeedInfo info2 = cache.getFeedInfo(url);
49         assertNotNull(info2);
50         assertEquals(url, info2.getUrl());
51     }
52
53     public static Test suite()
54     {
55         return new TestSuite(DiskFeedInfoCacheTest.class);
56
57     }
58 }
59
Popular Tags