1 28 package de.nava.informa.utils.manager; 29 30 import de.nava.informa.core.ChannelGroupIF; 31 import de.nava.informa.core.ChannelIF; 32 import de.nava.informa.core.ItemIF; 33 import junit.framework.TestCase; 34 35 import java.net.URL ; 36 37 41 public class TestPersistenceManagerConfig extends TestCase { 42 46 public void testGetPersistenceManager() { 47 assertNull(PersistenceManagerConfig.getPersistenceManager()); 49 50 try { 52 PersistenceManagerConfig.setPersistenceManagerClassName("badname"); 53 fail("ClassNotFountException should be thrown."); 54 } catch (ClassNotFoundException e) { 55 } catch (Exception e) { 57 fail("ClassNotFountException should be thrown."); 58 } 59 60 final String className = DummyPersistenceManager.class.getName(); 62 try { 63 PersistenceManagerConfig.setPersistenceManagerClassName(className); 64 assertTrue(PersistenceManagerConfig.getPersistenceManager() 65 instanceof DummyPersistenceManager); 66 67 } catch (Exception e) { 68 e.printStackTrace(); 69 fail("Unexpected exception."); 70 } 71 } 72 73 76 public static class DummyPersistenceManager implements PersistenceManagerIF { 77 83 public ChannelGroupIF createGroup(String title) { 84 return null; 85 } 86 87 92 public void updateGroup(ChannelGroupIF group) { 93 } 94 95 100 public void deleteGroup(ChannelGroupIF group) { 101 } 102 103 110 public void mergeGroups(ChannelGroupIF first, ChannelGroupIF second) { 111 } 112 113 118 public ChannelGroupIF[] getGroups() { 119 return new ChannelGroupIF[0]; 120 } 121 122 129 public ChannelIF createChannel(String title, URL location) { 130 return null; 131 } 132 133 138 public void updateChannel(ChannelIF channel) { 139 } 140 141 147 public void addChannelToGroup(ChannelIF channel, ChannelGroupIF group) { 148 } 149 150 158 public void removeChannelFromGroup(ChannelIF channel, ChannelGroupIF group) { 159 } 160 161 166 public void deleteChannel(ChannelIF channel) { 167 } 168 169 176 public ItemIF createItem(ChannelIF channel, String title) { 177 return null; 178 } 179 180 187 public ItemIF createItem(ChannelIF channel, ItemIF ethalon) { 188 return null; 189 } 190 191 196 public void updateItem(ItemIF item) { 197 } 198 199 204 public void deleteItem(ItemIF item) { 205 } 206 } 207 } 208 | Popular Tags |